:root {
  --bg: #080c14; --bg2: #0f172a; --bg3: #1e293b;
  --border: #1e293b; --border2: #334155;
  --text: #f1f5f9; --text2: #94a3b8; --text3: #64748b;
  --accent: #22d3ee; --accent2: #0e7490;
  --success: #10b981; --danger: #f43f5e; --warning: #f59e0b;
  --radius: 16px;
  --font-mono: 'Space Mono', monospace;
  --font-sans: 'DM Sans', sans-serif;
  --nav-h: 64px; --header-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 15px; overflow: hidden; overscroll-behavior: none; }
#app { height: 100%; position: relative; }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

/* ── LOGIN ── */
#screen-login { background: var(--bg); overflow-y: auto; align-items: center; justify-content: center; }
.login-bg { position: fixed; inset: 0; background: radial-gradient(ellipse at 30% 20%, #0e7490aa 0%, transparent 60%), radial-gradient(ellipse at 80% 80%, #1e3a5f88 0%, transparent 60%); pointer-events: none; }
.login-box { position: relative; z-index: 1; width: 100%; max-width: 400px; padding: 32px 24px; }
.brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 36px; }
.brand-logo { position: relative; width: 56px; height: 56px; margin-bottom: 14px; }
.brand-ring { position: absolute; inset: 0; border: 2px solid var(--accent); border-radius: 50%; opacity: 0.5; animation: spin 8s linear infinite; }
.brand-dot { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 18px; height: 18px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 20px var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.brand-name { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -1px; }
.brand-sub { font-size: 12px; color: var(--text2); letter-spacing: 2px; text-transform: uppercase; margin-top: 4px; }
.login-card { background: var(--bg2); border: 1px solid var(--border2); border-radius: 20px; padding: 28px; }
.login-card h2 { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text3); margin-bottom: 6px; }
.form-group input { width: 100%; background: var(--bg3); border: 1px solid var(--border2); border-radius: 10px; color: var(--text); font-family: var(--font-sans); font-size: 15px; padding: 12px 14px; outline: none; transition: border-color 0.2s; }
.form-group input:focus { border-color: var(--accent); }
.form-group input::placeholder { color: var(--text3); }
/* Date inputs — compact width so calendar icon stays near the text */
input[type="date"] { color-scheme: dark; width: auto; min-width: 140px; max-width: 100%; }
.modal-form input[type="date"] { width: 100%; }  /* inside modal-form grid, let container control width */
.btn-primary { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px 20px; background: var(--accent); color: #000; font-family: var(--font-sans); font-size: 15px; font-weight: 700; border: none; border-radius: 12px; cursor: pointer; transition: opacity 0.2s, transform 0.1s; }
.btn-primary:active { transform: scale(0.98); opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px 20px; background: var(--bg3); color: var(--text); font-family: var(--font-sans); font-size: 14px; font-weight: 600; border: 1px solid var(--border2); border-radius: 12px; cursor: pointer; transition: background 0.2s; }
.btn-secondary:hover { background: var(--border2); }
.btn-ghost { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: transparent; color: var(--accent); font-family: var(--font-sans); font-size: 13px; font-weight: 500; border: 1px solid var(--accent2); border-radius: 10px; cursor: pointer; transition: background 0.2s; }
.btn-ghost:hover { background: #0e749022; }
.btn-danger { padding: 12px 20px; background: transparent; color: var(--danger); font-family: var(--font-sans); font-size: 14px; font-weight: 600; border: 1px solid var(--danger); border-radius: 12px; cursor: pointer; transition: background 0.2s; width: 100%; margin-top: 8px; }
.btn-danger:hover { background: #f43f5e18; }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }

/* ── MAIN APP ── */
#screen-main { flex-direction: column; height: 100%; overflow: hidden; background: var(--bg); }
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: var(--header-h);
  background: linear-gradient(90deg, #0f172a 0%, #0c1a2e 50%, #0f172a 100%);
  border-bottom: 1px solid #1e4a6e55;
  box-shadow: 0 2px 12px #22d3ee0d;
  flex-shrink: 0; padding-top: env(safe-area-inset-top, 0px); gap: 10px;
}
.header-logo {
  font-family: var(--font-mono); font-size: 16px; font-weight: 700;
  background: linear-gradient(90deg, #22d3ee, #38bdf8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; white-space: nowrap;
}
.header-time {
  font-family: var(--font-mono); font-size: 14px; font-weight: 600;
  color: #38bdf8; flex: 1; text-align: center;
  text-shadow: 0 0 12px #38bdf840;
}
.header-right { display: flex; align-items: center; gap: 8px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #0284c7); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: #000; cursor: pointer; flex-shrink: 0; }
.tabs-viewport { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.tab-content { display: none; position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; flex-direction: column; }
.tab-content.active { display: flex; }
.tab-header { padding: 18px 16px 0; flex-shrink: 0; }
.tab-header h2 { font-size: 20px; font-weight: 700; }
.bottom-nav { display: flex; align-items: center; justify-content: space-around; height: calc(var(--nav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom); background: var(--bg2); border-top: 1px solid var(--border); flex-shrink: 0; z-index: 10; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; background: none; border: none; color: var(--text3); font-family: var(--font-sans); font-size: 10px; font-weight: 500; cursor: pointer; transition: color 0.2s; }
.nav-item svg { width: 20px; height: 20px; }
.nav-item.active { color: var(--accent); }

/* ── HOME TAB ── */
.home-scroll { flex: 1; overflow-y: auto; padding: 0 16px 20px; }
.greeting-section { padding: 16px 0 12px; }
.greeting-label { font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: 1.5px; }
.greeting-name {
  font-size: 24px; font-weight: 700; margin: 3px 0 2px;
  background: linear-gradient(90deg, #f1f5f9, #38bdf8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.greeting-date { font-size: 12px; color: #22d3ee99; font-family: var(--font-mono); }
.office-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 4px 10px; background: #0e749015; border: 1px solid #22d3ee33; border-radius: 20px; font-size: 12px; color: var(--text2); }
.office-badge span { color: var(--accent); font-weight: 600; }

/* ── SHIFT BANNER ── */
.shift-banner { display: flex; align-items: center; justify-content: space-between; background: linear-gradient(135deg, #0c1e35, #0f2040); border: 1px solid #1d4ed833; border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; box-shadow: 0 2px 8px #1d4ed820; }
.shift-banner-left { display: flex; align-items: center; gap: 10px; }
.shift-dot { width: 10px; height: 10px; border-radius: 50%; background: #38bdf8; flex-shrink: 0; box-shadow: 0 0 10px #38bdf8; }
.shift-name { font-size: 14px; font-weight: 700; color: #e2e8f0; }
.shift-time { font-size: 11px; color: #38bdf8aa; font-family: var(--font-mono); margin-top: 2px; }
.shift-office { font-size: 12px; color: #94a3b8; text-align: right; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── PUNCH TIMELINE ── */
.punch-timeline-card { background: var(--bg2); border: 1px solid var(--border); border-top: 2px solid #818cf855; border-radius: var(--radius); padding: 0; margin-bottom: 16px; overflow: hidden; }
.punch-timeline-toggle { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: none; border: none; cursor: pointer; text-align: left; color: inherit; }
.punch-timeline-toggle:hover { background: #ffffff06; }
#punch-timeline-body { padding: 0 16px 12px; }
#punch-timeline-body.collapsed { display: none; }
#punch-timeline-chevron.open { transform: rotate(180deg); }
.punch-timeline { display: flex; flex-direction: column; gap: 6px; }
.punch-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--bg3); }
.punch-type-badge { padding: 3px 10px; border-radius: 10px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; flex-shrink: 0; }
.punch-type-badge.in  { background: #10b98120; color: var(--success); border: 1px solid var(--success); }
.punch-type-badge.out { background: #f59e0b20; color: var(--warning); border: 1px solid var(--warning); }
.punch-type-badge.leave { background: #f8717120; color: #f87171; border: 1px solid #f87171; }
.punch-type-badge.wfh  { background: #93c5fd20; color: #93c5fd; border: 1px solid #93c5fd; }
.punch-time { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--text); }
.punch-num  { font-size: 11px; color: var(--text3); margin-left: auto; }
.punch-empty { font-size: 13px; color: var(--text3); text-align: center; padding: 12px 0; }
.punch-connector { width: 2px; height: 10px; background: var(--border2); margin-left: 28px; }
.gps-card {
  background: linear-gradient(135deg, #071a2e, #0a2240);
  border: 1px solid #22d3ee22; border-radius: var(--radius);
  padding: 16px; display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; position: relative; overflow: hidden;
  box-shadow: 0 2px 16px #22d3ee08;
}
.gps-card::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 10% 50%, #22d3ee08 0%, transparent 60%); pointer-events: none; }
.gps-pulse-ring { position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 2px solid #22d3ee; left: 12px; opacity: 0; animation: gps-pulse 2s ease-out infinite; }
@keyframes gps-pulse { 0% { transform: scale(0.5); opacity: 0.6; } 100% { transform: scale(2); opacity: 0; } }
.gps-icon-wrap { width: 40px; height: 40px; border-radius: 10px; background: #22d3ee15; border: 1px solid #22d3ee33; display: flex; align-items: center; justify-content: center; flex-shrink: 0; z-index: 1; }
.gps-icon { width: 20px; height: 20px; stroke: #22d3ee; }
.gps-info { flex: 1; z-index: 1; min-width: 0; }
.gps-status-label { font-size: 13px; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #e2e8f0; }
.gps-distance { font-size: 11px; color: #22d3eeaa; font-family: var(--font-mono); }
.gps-badge { padding: 4px 10px; border-radius: 20px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; background: var(--bg3); color: var(--text3); border: 1px solid var(--border2); z-index: 1; transition: all 0.3s; white-space: nowrap; flex-shrink: 0; }
.gps-badge.in-range { background: #10b98120; color: #10b981; border-color: #10b981; box-shadow: 0 0 8px #10b98130; }
.gps-badge.out-range { background: #f43f5e15; color: #f87171; border-color: #f43f5e; }
.checkin-section { display: flex; flex-direction: column; align-items: center; padding: 10px 0 20px; }
.checkin-time {
  font-family: var(--font-mono); font-size: 38px; font-weight: 700;
  letter-spacing: -2px; margin-bottom: 16px;
  background: linear-gradient(90deg, #f1f5f9 30%, #38bdf8 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; text-shadow: none;
  filter: drop-shadow(0 0 8px #38bdf840);
}
.checkin-btn { width: 150px; height: 150px; border-radius: 50%; border: 3px solid var(--border2); background: var(--bg2); cursor: pointer; position: relative; transition: all 0.3s; outline: none; }
.checkin-btn::before { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 2px dashed var(--border2); transition: all 0.3s; animation: slow-spin 20s linear infinite; }
@keyframes slow-spin { to { transform: rotate(360deg); } }
.checkin-btn:not(:disabled) { border-color: var(--accent); box-shadow: 0 0 30px #22d3ee20, inset 0 0 30px #22d3ee0a; }
.checkin-btn.checked-in:not(:disabled) { border-color: var(--success); box-shadow: 0 0 30px #10b98120, inset 0 0 30px #10b9810a; }
.checkin-btn:disabled { cursor: not-allowed; opacity: 0.5; }
.checkin-btn:not(:disabled):active { transform: scale(0.95); }
.checkin-btn-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.checkin-btn-icon { font-size: 26px; }
.checkin-btn-text { font-size: 13px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: 1px; }
.checkin-hint { margin-top: 12px; font-size: 12px; color: var(--text3); text-align: center; padding: 0 20px; }
.attendance-options { display: flex; gap: 12px; margin-top: 16px; }
.option-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border2); background: var(--bg2); cursor: pointer; transition: all 0.2s; outline: none; min-width: 80px; }
.option-btn:hover { background: var(--bg3); border-color: var(--accent); }
.option-btn:active { transform: scale(0.95); }
.option-btn .option-icon { font-size: 18px; }
.option-btn .option-text { font-size: 11px; font-weight: 600; color: var(--text); text-transform: uppercase; letter-spacing: 0.5px; text-align: center; }
.leave-btn .option-text { color: #f87171; }
.wfh-btn .option-text { color: #93c5fd; }
.change-btn .option-text { color: #6b7280; }
.stats-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 16px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 8px; text-align: center; position: relative; overflow: hidden; }
.stat-card:nth-child(1) { border-top: 2px solid #10b981; }
.stat-card:nth-child(2) { border-top: 2px solid #f59e0b; }
.stat-card:nth-child(3) { border-top: 2px solid #38bdf8; }
.stat-card:nth-child(1) .stat-value { color: #10b981; }
.stat-card:nth-child(2) .stat-value { color: #f59e0b; }
.stat-card:nth-child(3) .stat-value { color: #38bdf8; }
.stat-value { font-family: var(--font-mono); font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.stat-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
.weekly-card { background: var(--bg2); border: 1px solid var(--border); border-top: 2px solid #22d3ee33; border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px;
  color: transparent; margin-bottom: 14px;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  -webkit-background-clip: text; background-clip: text;
}
.week-bars { display: flex; align-items: flex-end; gap: 6px; height: 50px; margin-bottom: 6px; }
.week-bar { flex: 1; border-radius: 4px 4px 0 0; background: var(--border2); min-height: 3px; transition: height 0.4s ease; }
.week-bar.present { background: var(--accent); }
.week-bar.today { background: var(--success); }
.week-days { display: flex; gap: 6px; }
.week-day-label { flex: 1; text-align: center; font-size: 10px; color: var(--text3); font-family: var(--font-mono); }

/* ── CALENDAR TAB ── */
.calendar-nav { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; flex-shrink: 0; }
.calendar-nav button { width: 34px; height: 34px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--border2); color: var(--text); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
#cal-month-label { font-size: 15px; font-weight: 600; font-family: var(--font-mono); }
.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; padding: 0 10px; flex-shrink: 0; }
.cal-day-header { text-align: center; font-size: 10px; font-weight: 600; color: var(--text3); padding: 4px 0 5px; text-transform: uppercase; }
.cal-day { height: 42px; border-radius: 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; color: var(--text2); cursor: pointer; transition: all 0.15s; gap: 2px; }
.cal-day:hover:not(.present):not(.late):not(.half-day):not(.absent):not(.leave):not(.wfh):not(.holiday) { background: var(--bg3); }
.cal-day.empty { pointer-events: none; }
.cal-day.other-month { opacity: 0.3; }
.cal-day.present       { background: #86efac !important; color: #0f172a !important; border: 1px solid #86efac !important; }
.cal-day.late          { background: #fb923c !important; color: white   !important; border: 1px solid #fb923c !important; }
.cal-day.half-day,
.cal-day.late-half-day { background: #f9a8d4 !important; color: #0f172a !important; border: 1px solid #f9a8d4 !important; }
.cal-day.absent        { background: #fef08a !important; color: #0f172a !important; border: 1px solid #fef08a !important; }
.cal-day.leave         { background: #f87171 !important; color: white   !important; border: 1px solid #f87171 !important; }
.cal-day.wfh           { background: #93c5fd !important; color: #0f172a !important; border: 1px solid #93c5fd !important; }
.cal-day.holiday       { background: #34d399 !important; color: #0f172a !important; border: 1px solid #34d399 !important; }
.cal-day.weekend  { opacity: 0.45; }
.cal-day.today    { border: 2px solid var(--accent); font-weight: 700; box-shadow: 0 0 0 1px var(--bg); }
.cal-dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.calendar-legend { display: flex; gap: 8px; padding: 8px 10px 10px; flex-shrink: 0; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--text2); font-weight: 500; }
.legend-item::before { content: ''; width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.legend-item.present::before       { background: #86efac; }
.legend-item.wfh::before           { background: #93c5fd; }
.legend-item.leave::before         { background: #f87171; }
.legend-item.late::before          { background: #fb923c; }
.legend-item.half-day::before,
.legend-item.late-half-day::before { background: #f9a8d4; }
.legend-item.absent::before        { background: #fef08a; }
.legend-item.weekend          { opacity: 0.45; }
.legend-item.weekend::before  { background: var(--text2); }
.legend-item.today::before    { background: transparent; border: 2px solid var(--accent); }
.calendar-detail { padding: 10px 10px 24px; border-top: 1px solid var(--border); flex-shrink: 0; }
.detail-hint { font-size: 12px; color: var(--text3); text-align: center; padding: 14px 0; }
.detail-card { background: var(--bg2); border: 1px solid var(--border2); border-radius: 12px; padding: 14px; }
.detail-date { font-size: 13px; font-weight: 700; margin-bottom: 10px; font-family: var(--font-mono); }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.detail-row:last-child { border-bottom: none; }
.detail-row span { color: var(--text2); }
.detail-row strong { color: var(--text); font-family: var(--font-mono); }

/* ── HISTORY TAB ── */
.history-summary { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.hsummary-badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--bg3); color: var(--text2); border: 1px solid var(--border2); }
.hsummary-badge.present { background: #86efac15; color: #86efac; border-color: #86efac33; }
.history-list { padding: 10px 16px 24px; display: flex; flex-direction: column; gap: 8px; }
.history-empty { text-align: center; padding: 40px; color: var(--text3); font-size: 13px; line-height: 2; }
.history-item { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.history-status { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.history-status.present       { background: #86efac; }
.history-status.absent        { background: #fef08a; }
.history-status.half-day,
.history-status.late-half-day { background: #f9a8d4; }
.history-status.late          { background: #fb923c; }
.history-status.weekend       { background: var(--text3); }
.history-status.leave         { background: #f87171; }
.history-status.wfh           { background: #93c5fd; }
.history-status.holiday       { background: #34d399; }
.history-info { flex: 1; min-width: 0; }
.history-date { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.history-times { font-size: 11px; color: var(--text2); font-family: var(--font-mono); }
.history-hours { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--accent); white-space: nowrap; }

/* ── ADMIN TAB ── */
.admin-scroll { flex: 1; overflow-y: auto; padding: 0 16px 24px; }
.admin-sub-nav { display: flex; gap: 2px; margin: 16px 0 20px; padding: 0 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.admin-sub-tab { flex-shrink: 0; padding: 8px 16px; background: var(--bg3); color: var(--text3); font-family: var(--font-sans); font-size: 13px; font-weight: 600; border: 1px solid var(--border2); border-radius: 20px; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.admin-sub-tab.active { background: var(--accent); color: #000; border-color: var(--accent); }
.admin-sub-content { display: none; }
.admin-sub-content.active { display: block; }
.admin-section { margin-top: 16px; margin-bottom: 4px; }
.admin-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text3); margin-bottom: 10px; }
.admin-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.admin-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.admin-card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.admin-card-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.admin-btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.admin-empty { font-size: 13px; color: var(--text3); padding: 8px 0; }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-admin { background: #7c3aed22; color: #a78bfa; border: 1px solid #7c3aed44; }
.badge-employee { background: #22d3ee15; color: var(--accent); border: 1px solid #22d3ee33; }
.badge-inactive { background: #f43f5e15; color: var(--danger); border: 1px solid #f43f5e33; }
.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.summary-box { background: var(--bg3); border-radius: 10px; padding: 12px; text-align: center; }
.summary-num { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--accent); }
.summary-lbl { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: #000a; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--bg2); border: 1px solid var(--border2); border-radius: 20px 20px 0 0; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; padding: 24px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { width: 30px; height: 30px; border-radius: 50%; background: var(--bg3); border: none; color: var(--text2); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal-form .form-group { margin-bottom: 14px; }
.modal-form label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text3); margin-bottom: 6px; }
.modal-form input, .modal-form select { width: 100%; background: var(--bg3); border: 1px solid var(--border2); border-radius: 10px; color: var(--text); font-family: var(--font-sans); font-size: 14px; padding: 11px 13px; outline: none; transition: border-color 0.2s; }
.modal-form select option { background: var(--bg3); }
.modal-form input:focus, .modal-form select:focus { border-color: var(--accent); }
.modal-form input::placeholder { color: var(--text3); }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; }
.modal-actions .btn-primary { flex: 1; }
.modal-actions .btn-secondary { flex: 0 0 auto; }

/* ── SETTINGS TAB ── */
.settings-list { padding: 14px 16px 30px; display: flex; flex-direction: column; gap: 4px; }
.settings-section { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.settings-section h3 { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text3); margin-bottom: 12px; }
.settings-item { margin-bottom: 10px; }
.settings-item label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 5px; font-weight: 500; }
.settings-item input { width: 100%; background: var(--bg3); border: 1px solid var(--border2); border-radius: 8px; color: var(--text); font-family: var(--font-sans); font-size: 13px; padding: 9px 11px; outline: none; transition: border-color 0.2s; }
.settings-item input:focus { border-color: var(--accent); }

/* ── VOICE NOTES TAB ── */
.voice-recorder-card {
  margin: 14px 16px 0;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 20px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Animated visualiser bars */
.recorder-visualiser {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
}
.vis-bar {
  width: 4px;
  background: var(--border2);
  border-radius: 2px;
  transition: height 0.1s ease;
}
.recording .vis-bar {
  background: var(--danger);
  animation: vis-pulse 0.6s ease-in-out infinite alternate;
}
.recording .vis-bar:nth-child(2)  { animation-delay: 0.1s; }
.recording .vis-bar:nth-child(3)  { animation-delay: 0.2s; }
.recording .vis-bar:nth-child(4)  { animation-delay: 0.05s; }
.recording .vis-bar:nth-child(5)  { animation-delay: 0.15s; }
.recording .vis-bar:nth-child(6)  { animation-delay: 0.3s; }
.recording .vis-bar:nth-child(7)  { animation-delay: 0.08s; }
.recording .vis-bar:nth-child(8)  { animation-delay: 0.22s; }
.recording .vis-bar:nth-child(9)  { animation-delay: 0.18s; }
@keyframes vis-pulse {
  from { transform: scaleY(0.3); opacity: 0.6; }
  to   { transform: scaleY(1.8); opacity: 1; }
}

.recorder-timer {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 2px;
}
.recording .recorder-timer { color: var(--danger); }

.recorder-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}
.rec-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  background: var(--bg3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.rec-btn svg { width: 22px; height: 22px; }
.rec-btn:active { transform: scale(0.92); }

.rec-btn-record { border-color: var(--danger); color: var(--danger); }
.rec-btn-record:hover { background: #f43f5e18; }
.rec-btn-stop   { border-color: var(--warning); color: var(--warning); }
.rec-btn-stop:hover { background: #f59e0b18; }
.rec-btn-save   { border-color: var(--success); color: var(--success); width: 60px; height: 60px; }
.rec-btn-save svg { width: 26px; height: 26px; }
.rec-btn-save:hover { background: #10b98118; }
.rec-btn-discard { border-color: var(--text3); color: var(--text3); }
.rec-btn-discard:hover { background: #ffffff0a; }

.recorder-status {
  font-size: 12px;
  color: var(--text3);
  text-align: center;
}

/* Voice notes list */
.voice-notes-list {
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 600px;
}
.voice-empty {
  font-size: 13px;
  color: var(--text3);
  text-align: center;
  padding: 20px 0;
}

.voice-note-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.voice-note-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}
.voice-note-meta { flex: 1; min-width: 0; }
.voice-note-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice-note-info {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--font-mono);
}
.voice-note-user {
  font-size: 11px;
  color: var(--accent);
  margin-top: 2px;
}
.voice-note-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.voice-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.voice-action-btn:hover { background: var(--border2); }
.voice-action-btn.delete:hover { background: #f43f5e22; color: var(--danger); border-color: var(--danger); }
.voice-action-btn svg { width: 14px; height: 14px; }

/* Native audio player */
.voice-audio-player {
  width: 100%;
  height: 36px;
  outline: none;
  border-radius: 8px;
  margin-top: 4px;
}
/* Style the audio element (limited browser support, but looks better in Chrome/Firefox) */
audio::-webkit-media-controls-panel { background: var(--bg3); }

/* ── TOAST ── */
.toast { position: fixed; bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px); left: 50%; transform: translateX(-50%) translateY(20px); background: var(--bg3); color: var(--text); padding: 10px 18px; border-radius: 30px; font-size: 13px; font-weight: 500; border: 1px solid var(--border2); opacity: 0; transition: all 0.3s; pointer-events: none; white-space: nowrap; z-index: 200; max-width: calc(100vw - 32px); text-overflow: ellipsis; overflow: hidden; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--success); color: var(--success); }

/* ── LOADING ── */
.loading-screen { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 300; flex-direction: column; gap: 16px; }
.loading-screen.hidden { display: none; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.loading-screen p { font-size: 13px; color: var(--text3); }

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.hidden { display: none !important; }

/* ── TICKETS ── */
.ticket-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; cursor: pointer; transition: border-color 0.2s; }
.ticket-card:hover { border-color: var(--accent); }
.ticket-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ticket-id { font-family: var(--font-mono); font-size: 12px; color: var(--text3); }
.ticket-priority { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; letter-spacing: .5px; }
.ticket-priority-normal   { background: #1e293b; color: #94a3b8; }
.ticket-priority-low      { background: #14532d22; color: #4ade80; }
.ticket-priority-high     { background: #7f1d1d22; color: #f87171; }
.ticket-priority-urgent   { background: #7f1d1d; color: #fca5a5; }
.ticket-priority-immediate{ background: #450a0a; color: #fca5a5; }
/* P1/P2/P3 priority classes */
.ticket-pri-p1 { background: #7f1d1d33; color: #f87171; border: 1px solid #f8717155; }
.ticket-pri-p2 { background: #78350f22; color: #fbbf24; border: 1px solid #fbbf2455; }
.ticket-pri-p3 { background: #14532d22; color: #4ade80; border: 1px solid #4ade8055; }
.ticket-subject { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 4px; line-height: 1.4; }
.ticket-meta { font-size: 12px; color: var(--text3); }
.ticket-comment { background: var(--bg3); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.ticket-comment-author { font-size: 11px; color: var(--text3); margin-bottom: 6px; font-weight: 600; }
.ticket-comment-body { font-size: 13px; color: var(--text2); white-space: pre-wrap; line-height: 1.5; }

/* ── Inline ticket recorder buttons ────────────────────────── */
.tk-rec-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--danger); color: #fff; transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}
.tk-rec-btn:hover  { background: #dc2626; transform: scale(1.05); }
.tk-rec-btn:active { transform: scale(0.96); }
.tk-rec-btn-stop   { background: #64748b; }
.tk-rec-btn-stop:hover { background: #475569; }

/* ── Login page layout ──────────────────────────────────────── */
#screen-login { background: #f0f4f8; overflow-y: auto; }
#screen-login.active { display: flex !important; flex-direction: row !important; align-items: stretch !important; }
.lp-left {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: #f0f4f8; padding: 40px 32px;
}
.lp-map { width: 100%; max-width: 520px; height: auto; }
.lp-brand { text-align: center; margin-top: 28px; }
.lp-brand-name { font-size: 34px; font-weight: 800; color: #1e293b; letter-spacing: -1px; }
.lp-brand-name span { color: #e11d48; }
.lp-brand-sub { font-size: 14px; color: #64748b; margin-top: 6px; }
.lp-right {
  width: 440px; flex-shrink: 0;
  background: #2563eb;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 36px;
}
.lp-card {
  background: #fff; border-radius: 18px;
  padding: 38px 34px; width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.20);
}
.lp-card h2 { font-size: 24px; font-weight: 700; color: #1e293b; margin-bottom: 28px; }
.lp-f { margin-bottom: 20px; }
.lp-f label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 7px; }
.lp-f input {
  width: 100%; background: #f8fafc;
  border: 1.5px solid #e2e8f0; border-radius: 9px;
  color: #1e293b; font-size: 15px; padding: 12px 16px;
  outline: none; transition: border-color .2s;
  font-family: inherit;
}
.lp-f input:focus { border-color: #2563eb; background: #fff; }
.lp-f input::placeholder { color: #94a3b8; }
.lp-pwrap { position: relative; }
.lp-pwrap input { padding-right: 46px; }
.lp-peye {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: #2563eb;
  display: flex; align-items: center; padding: 0;
}
.lp-submit {
  display: block; width: 100%; padding: 14px;
  background: #2563eb; color: #fff;
  font-size: 15px; font-weight: 700;
  border: none; border-radius: 9px; cursor: pointer;
  transition: background .2s, transform .1s;
  margin-top: 6px; font-family: inherit; letter-spacing: .3px;
}
.lp-submit:hover { background: #1d4ed8; }
.lp-submit:active { transform: scale(.98); }
.lp-submit:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.lp-err { color: #e11d48; font-size: 13px; margin-top: 12px; text-align: center; display: none; }
.lp-foot { text-align: center; font-size: 12px; color: #94a3b8; margin-top: 18px; }
.lp-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 14px; }
.lp-divider::before, .lp-divider::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }
.lp-divider span { font-size: 12px; color: #94a3b8; white-space: nowrap; }
.lp-sso {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px 16px; border: 1.5px solid #e2e8f0;
  border-radius: 9px; background: #fff; color: #374151;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: border-color .2s, box-shadow .2s; font-family: inherit;
}
.lp-sso:hover { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
#lp-sso-wrap { display: none; }
@media (max-width: 720px) {
  #screen-login.active { flex-direction: column !important; }
  .lp-left { padding: 28px 20px 16px; }
  .lp-right { width: 100%; padding: 24px 20px 40px; }
  .lp-card { padding: 26px 22px; }
}
