/* ─────────────────────────────────────────────────────────────────────────────
   HOPTIX QA Platform — Design System
   Adapted from OMNI Sales Trainer | Hoptix dark-blue palette
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  --navy:       #071426;
  --navy-mid:   #0d2040;
  --navy-light: #1a3a60;
  --accent:     #4f9dff;
  --accent-dark:#2d7dd9;
  --green:      #2ecc71;
  --green-bg:   #d4f8e8;
  --green-text: #0a6640;
  --amber:      #f0a500;
  --amber-bg:   #fff3cd;
  --amber-text: #7a4f00;
  --red:        #e74c3c;
  --red-bg:     #fde8e6;
  --red-text:   #8b1c1c;
  --bg:         #dce9ff;
  --surface:    #ffffff;
  --border:     #b8cce8;
  --border-mid: #9ab2d4;
  --text-1:     #0a1e3a;
  --text-2:     #3a5a80;
  --text-3:     #7a9ab8;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow-sm:  0 1px 3px rgba(7,20,38,0.10), 0 4px 12px rgba(7,20,38,0.08);
  --shadow-md:  0 4px 16px rgba(7,20,38,0.14);
  --shadow-lg:  0 10px 40px rgba(7,20,38,0.20);
  --kpi-surface: linear-gradient(160deg, #ffffff 0%, #f0f7ff 100%);
  --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
}

[data-theme="dark"] {
  --navy:       #040e1e;
  --navy-mid:   #0a1a30;
  --navy-light: #112540;
  --accent:     #5aaeff;
  --accent-dark:#3d90f0;
  --green:      #34d981;
  --green-bg:   #0d3b25;
  --green-text: #6effa8;
  --amber:      #ffc234;
  --amber-bg:   #3b2800;
  --amber-text: #ffc234;
  --red:        #f56565;
  --red-bg:     #3b0f0f;
  --red-text:   #fc8181;
  --bg:         #050f1f;
  --surface:    #0a1930;
  --border:     #1a3355;
  --border-mid: #234570;
  --text-1:     #dce9ff;
  --text-2:     #7aa8d0;
  --text-3:     #4a6a8a;
  --kpi-surface: linear-gradient(160deg, #0a1930 0%, #0d2040 100%);
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
       background: var(--bg); color: var(--text-1);
       display: flex; min-height: 100vh; font-size: 14px; line-height: 1.5;
       transition: background-color 0.2s ease, color 0.2s ease; }

/* ── Mobile top bar ─────────────────────────────────────────────────────── */
.mobile-topbar { display: none; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar-overlay { display: none; }
.sidebar-close   { display: none; }

.sidebar { width: 232px; background: var(--navy); display: flex;
           flex-direction: column; flex-shrink: 0;
           position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: 10px;
                 padding: 18px 16px 16px;
                 border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-mark { width: 30px; height: 30px; background: var(--accent);
              border-radius: 8px; display: flex; align-items: center;
              justify-content: center; font-size: 14px; font-weight: 800;
              color: #fff; flex-shrink: 0; letter-spacing: -1px; }
.brand-mark-lg { width: 44px; height: 44px; font-size: 20px; border-radius: 12px; }
.brand-name { font-size: 1rem; font-weight: 700; color: #edf4ff; letter-spacing: -0.01em; }
.brand-name span { color: #80bfff; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 8px 0 0; }
.nav-group { padding: 12px 0 4px; }
.nav-group-label { font-size: 0.65rem; font-weight: 600; color: rgba(255,255,255,.25);
                   text-transform: uppercase; letter-spacing: 0.08em; padding: 0 16px 5px; }
.nav-item { display: flex; align-items: center; gap: 9px; color: rgba(255,255,255,.55);
            text-decoration: none; padding: 7px 12px; font-size: 0.8rem; font-weight: 500;
            border-radius: 7px; margin: 1px 8px; transition: all .15s; position: relative; }
.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.nav-active { background: rgba(79,157,255,.2) !important; color: #80bfff !important; font-weight: 600; }
.nav-active .nav-ico { color: #80bfff; }
.nav-ico { width: 15px; height: 15px; flex-shrink: 0; opacity: .6; }
.nav-item:hover .nav-ico, .nav-active .nav-ico { opacity: 1; }
.nav-badge { margin-left: auto; font-size: 0.58rem; font-weight: 800;
             background: var(--accent); color: #fff; padding: 1px 5px;
             border-radius: 4px; letter-spacing: .3px; }
.nav-item-logout { color: rgba(255,255,255,.35); margin-top: 4px; }
.nav-item-logout:hover { color: var(--red-bg); background: rgba(231,76,60,.1); }

.nav-user-card { display: flex; align-items: center; gap: 10px;
                 margin: 4px 8px 6px; padding: 10px;
                 background: rgba(255,255,255,.05); border-radius: 8px;
                 border: 1px solid rgba(255,255,255,.07); }
.nav-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent);
              display: flex; align-items: center; justify-content: center;
              font-size: 0.8rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.nav-user-name { font-size: 0.78rem; font-weight: 600; color: rgba(255,255,255,.85);
                 white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.nav-user-role { font-size: 0.65rem; color: rgba(255,255,255,.3); text-transform: capitalize; }

/* ── Main ────────────────────────────────────────────────────────────────── */
.main { flex: 1; padding: 32px 40px; overflow-y: auto; min-width: 0; }
.flash { background: var(--amber-bg); border: 1px solid var(--amber);
         border-radius: var(--radius); padding: 10px 16px; margin-bottom: 18px;
         font-size: 0.82rem; color: var(--amber-text); }
.flash-success { background: var(--green-bg); border-color: var(--green); color: var(--green-text); }

/* ── Theme bar ───────────────────────────────────────────────────────────── */
.theme-bar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 7px;
                padding: 5px 7px; cursor: pointer; color: var(--text-2);
                display: flex; align-items: center; gap: 4px; transition: all .15s; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.sidebar-brand .theme-toggle { width:30px; height:30px; padding:0;
  display:flex; align-items:center; justify-content:center;
  background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.18);
  border-radius:8px; color:#fff; flex-shrink:0; }
.sidebar-brand .theme-toggle:hover { background:rgba(255,255,255,.22);
  border-color:rgba(255,255,255,.35); color:#fff; }
.theme-icon { width: 14px; height: 14px; }
.theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun  { display: block; }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: flex-end;
               margin-bottom: 28px; }
.page-eyebrow { font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
                letter-spacing: 1px; color: var(--accent); margin-bottom: 4px; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-1);
                  letter-spacing: -0.02em; font-family: var(--font-display); }
.sub { color: var(--text-2); font-size: 0.78rem; margin-top: 3px; }
.back-link { font-size: 0.78rem; color: var(--accent); text-decoration: none; display: block; margin-bottom: 4px; }

/* ── Page progress bar ───────────────────────────────────────────────────── */
#page-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 9999;
                 background: transparent; pointer-events: none; }
#page-progress.is-loading { background: linear-gradient(90deg, var(--accent) 0%, #80bfff 50%, var(--accent) 100%);
                             background-size: 200% 100%;
                             animation: progress-slide 1.5s linear infinite; }
#page-progress.is-done    { background: var(--accent); opacity: 0; transition: opacity .4s ease .1s; }
@keyframes progress-slide { 0%{background-position:100% 0} 100%{background-position:-100% 0} }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary { background: var(--accent); color: #fff; border: none;
               border-radius: var(--radius-sm); padding: 8px 16px; font-size: 0.82rem;
               font-weight: 600; cursor: pointer; text-decoration: none;
               display: inline-flex; align-items: center; gap: 6px; transition: background 0.15s; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-full { width: 100%; justify-content: center; padding: 11px 16px; font-size: 0.9rem; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--text-2);
               border-radius: var(--radius-sm); padding: 6px 12px; font-size: 0.8rem;
               font-weight: 600; cursor: pointer; text-decoration: none;
               display: inline-flex; align-items: center; gap: 5px; transition: all .15s; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--red); color: #fff; border: none;
              border-radius: var(--radius-sm); padding: 6px 12px; font-size: 0.8rem;
              font-weight: 600; cursor: pointer; transition: opacity .15s; }
.btn-danger:hover { opacity: .85; }
.btn-link { color: var(--accent); text-decoration: none; font-size: 0.78rem; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius);
        border: 1px solid var(--border); box-shadow: var(--shadow-sm); padding: 22px 24px; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start;
               margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 0.75rem; font-weight: 600; color: var(--text-2);
              text-transform: uppercase; letter-spacing: 0.07em; }
.full-width { grid-column: 1 / -1; }

/* ── KPI row ─────────────────────────────────────────────────────────────── */
.kpi-row { display: flex; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.kpi-card { background: var(--kpi-surface); border-radius: var(--radius);
            border: 1px solid var(--border); padding: 20px 20px 16px; flex: 1;
            min-width: 140px; box-shadow: var(--shadow-sm);
            border-top: 4px solid var(--border-mid); }
.kpi-card.kpi-good { border-top-color: var(--green); }
.kpi-card.kpi-warn { border-top-color: var(--amber); }
.kpi-card.kpi-bad  { border-top-color: var(--red); }
.kpi-label { font-size: 0.68rem; font-weight: 600; text-transform: uppercase;
             letter-spacing: 0.07em; color: var(--text-3); margin-bottom: 6px; }
.kpi-value { font-size: 1.8rem; font-weight: 800; color: var(--text-1);
             line-height: 1; margin-bottom: 4px; letter-spacing: -0.03em;
             font-family: var(--font-display); }
.kpi-unit { font-size: .9rem; font-weight: 400; color: var(--text-3); margin-left: 2px; }
.kpi-sub  { font-size: 0.68rem; color: var(--text-3); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-block; border-radius: 20px; padding: 2px 9px;
         font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.badge-green  { background: var(--green-bg);  color: var(--green-text); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber-text); }
.badge-red    { background: var(--red-bg);    color: var(--red-text); }
.badge-blue   { background: #dbeafe;          color: #1e40af; }
.badge-muted  { background: var(--bg);        color: var(--text-3); border: 1px solid var(--border); }

/* ── Score pill ──────────────────────────────────────────────────────────── */
.score-pill { display: inline-flex; align-items: center; justify-content: center;
              min-width: 44px; height: 24px; border-radius: 20px; padding: 0 8px;
              font-size: 0.75rem; font-weight: 700; }
.pill-good    { background: var(--green-bg);  color: var(--green-text); }
.pill-warn    { background: var(--amber-bg);  color: var(--amber-text); }
.pill-bad     { background: var(--red-bg);    color: var(--red-text); }
.pill-neutral { background: var(--bg);        color: var(--text-2); }

/* ── Transaction table ────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.tx-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.tx-table th { padding: 10px 12px; text-align: left; font-size: 0.68rem;
               font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
               color: var(--text-3); border-bottom: 2px solid var(--border-mid);
               white-space: nowrap; background: var(--surface); }
.tx-table td { padding: 10px 12px; border-bottom: 1px solid var(--border);
               vertical-align: middle; }
.tx-table tr:last-child td { border-bottom: none; }
.tx-table tbody tr { cursor: pointer; transition: background .1s; }
.tx-table tbody tr:hover td { background: #eaf3ff; }
[data-theme="dark"] .tx-table tbody tr:hover td { background: #0d2040; }
.tx-table tbody tr.tx-selected td { background: #dbeafe; }
[data-theme="dark"] .tx-table tbody tr.tx-selected td { background: #0a2050; }
.tx-validated td { opacity: .75; }
.td-time    { white-space: nowrap; font-size: 0.75rem; color: var(--text-2); font-family: monospace; }
.td-name    { font-weight: 600; color: var(--text-1); white-space: nowrap; }
.td-items   { color: var(--text-2); max-width: 200px; overflow: hidden;
              text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; }
.td-metric  { text-align: center; font-size: 0.78rem; font-weight: 600; }
.td-actions { white-space: nowrap; }

/* Timeline table (Date/Start/End/Duration/✓) — every column centered. */
.tx-table-centered th, .tx-table-centered td { text-align: center; }

/* ── Edit panel ──────────────────────────────────────────────────────────── */
.edit-panel { background: var(--kpi-surface); border: 1px solid var(--border);
              border-radius: var(--radius); padding: 20px 24px; margin-top: 20px; }
.edit-panel h3 { font-size: 0.85rem; font-weight: 700; margin-bottom: 16px;
                 color: var(--text-1); display: flex; align-items: center; gap: 8px; }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .edit-grid { grid-template-columns: 1fr; } }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; }
.form-label { font-size: 0.7rem; font-weight: 700; color: var(--text-2);
              margin-bottom: 5px; text-transform: uppercase; letter-spacing: .4px; }
.form-input, .form-select, .form-textarea {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 11px;
  font-size: 0.82rem; font-family: inherit; outline: none; background: var(--surface);
  color: var(--text-1); transition: border-color .15s, box-shadow .15s; }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,157,255,.12); }
.form-textarea { resize: vertical; }
.form-hint { font-size: 0.7rem; color: var(--text-3); margin-top: 4px; }

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center;
              min-height: 100vh; background: var(--navy); }
.login-wrap { background: var(--surface); border-radius: 16px; padding: 40px;
              width: 100%; max-width: 380px; box-shadow: var(--shadow-lg);
              border: 1px solid var(--border); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-title { font-size: 1.2rem; font-weight: 800; color: var(--text-1);
               font-family: var(--font-display); letter-spacing: -0.01em; }
.login-title span { color: var(--accent); }
.login-sub   { font-size: 0.72rem; color: var(--text-3); margin-top: 2px; }
.login-form  { display: flex; flex-direction: column; gap: 16px; }

/* ── Video player ────────────────────────────────────────────────────────── */
.video-container { position: relative; background: #000; border-radius: var(--radius);
                   overflow: hidden; }
.video-container video { width: 100%; display: block; max-height: 480px; }
.video-placeholder { display: flex; align-items: center; justify-content: center;
                     height: 200px; background: var(--navy-mid); border-radius: var(--radius);
                     color: var(--text-3); font-size: 0.85rem; border: 2px dashed var(--border); }
.video-skip-bar { display: flex; gap: 8px; margin-top: 8px; }

/* ── Player layout ───────────────────────────────────────────────────────── */
.player-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .player-layout { grid-template-columns: 1fr; } }
.seek-list { display: flex; flex-direction: column; gap: 4px; max-height: 460px; overflow-y: auto; }
.seek-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px;
             border-radius: 8px; cursor: pointer; transition: background .1s;
             border: 1px solid transparent; }
.seek-item:hover { background: var(--bg); border-color: var(--border); }
.seek-item.seek-active { background: #dbeafe; border-color: var(--accent); }
[data-theme="dark"] .seek-item.seek-active { background: #0a2050; }
.seek-time { font-size: 0.72rem; font-family: monospace; color: var(--text-3);
             min-width: 52px; flex-shrink: 0; }
.seek-name { font-size: 0.78rem; font-weight: 600; color: var(--text-1); flex: 1;
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seek-score { flex-shrink: 0; }

/* ── Video list items ────────────────────────────────────────────────────── */
.video-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px;
              text-decoration: none; border-bottom: 1px solid var(--border);
              transition: background .1s; color: inherit; }
.video-item:hover  { background: rgba(79,157,255,0.10); }
.video-item.active { background: rgba(79,157,255,0.20); }

/* ── Client/location tree ────────────────────────────────────────────────── */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }
.client-card { background: var(--surface); border-radius: var(--radius);
               border: 1px solid var(--border); padding: 18px 20px;
               text-decoration: none; color: var(--text-1);
               transition: box-shadow .15s, border-color .15s; display: block; }
.client-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.client-name { font-size: 1rem; font-weight: 700; margin-bottom: 4px; color: var(--text-1); }
.client-loc  { font-size: 0.78rem; color: var(--text-3); margin-bottom: 4px; }
.client-date { font-size: 0.72rem; color: var(--accent); font-weight: 600;
               letter-spacing: .01em; margin-bottom: 10px; }
.client-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-chip { font-size: 0.72rem; font-weight: 600; padding: 3px 8px;
             border-radius: 10px; background: var(--bg); color: var(--text-2);
             border: 1px solid var(--border); }

/* ── Filters bar ─────────────────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-input { padding: 7px 12px; border: 1px solid var(--border);
                border-radius: var(--radius-sm); font-size: 0.82rem;
                background: var(--surface); color: var(--text-1);
                min-width: 200px; outline: none; transition: border-color .15s; }
.filter-input:focus { border-color: var(--accent); }
.filter-select { padding: 7px 10px; border: 1px solid var(--border);
                 border-radius: var(--radius-sm); background: var(--surface);
                 color: var(--text-1); font-size: 0.82rem; outline: none; cursor: pointer; }
.filter-select:focus { border-color: var(--accent); }

/* ── Poll banner ─────────────────────────────────────────────────────────── */
.poll-banner { display: none; align-items: center; gap: 10px; padding: 9px 16px;
               background: #dbeafe; border: 1px solid var(--accent);
               border-radius: var(--radius-sm); margin-bottom: 12px;
               font-size: 0.82rem; color: #1e40af; }
[data-theme="dark"] .poll-banner { background: #0a2050; color: #80bfff; border-color: #234570; }
.poll-banner.visible { display: flex; }
.poll-banner a { color: var(--accent); font-weight: 600; text-decoration: none; }
.poll-banner a:hover { text-decoration: underline; }

/* ── Reports ─────────────────────────────────────────────────────────────── */
.reports-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
@media (max-width: 700px) { .reports-grid { grid-template-columns: 1fr; } }
.chart-wrap { position: relative; height: 220px; }

/* ── Settings ────────────────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-section { margin-bottom: 32px; }
.settings-section h2 { font-size: 0.9rem; font-weight: 700; color: var(--text-1);
                        margin-bottom: 16px; padding-bottom: 10px;
                        border-bottom: 1px solid var(--border); }

/* ── Users table ─────────────────────────────────────────────────────────── */
.users-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.users-table th { padding: 9px 12px; text-align: left; font-size: 0.68rem; font-weight: 600;
                  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3);
                  border-bottom: 2px solid var(--border-mid); }
.users-table td { padding: 10px 12px; border-bottom: 1px solid var(--border);
                  vertical-align: middle; }
.users-table tr:last-child td { border-bottom: none; }

/* ── Dash grid ───────────────────────────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
/* Visually hidden but still announced by screen readers — for labels on
   controls where a visible label would be redundant with adjacent context. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
           overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.empty-state p  { font-size: 0.82rem; }

/* ── Transcript box ──────────────────────────────────────────────────────── */
.transcript-box { background: var(--bg); border: 1px solid var(--border);
                  border-radius: var(--radius-sm); padding: 14px; font-size: 0.78rem;
                  line-height: 1.8; white-space: pre-wrap; word-break: break-word;
                  max-height: 300px; overflow-y: auto;
                  font-family: "SFMono-Regular", Consolas, monospace; }

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%); background: var(--navy); color: #edf4ff;
  font-size: 0.72rem; line-height: 1.4; padding: 8px 12px;
  border-radius: var(--radius-sm); white-space: normal; width: 220px;
  z-index: 100; box-shadow: var(--shadow-md); pointer-events: none; }
[data-tooltip]:hover::before {
  content: ''; position: absolute; bottom: calc(100% + 2px); left: 50%;
  transform: translateX(-50%); border: 5px solid transparent;
  border-top-color: var(--navy); z-index: 101; pointer-events: none; }

/* ── Loading spinner ─────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border);
           border-top-color: var(--accent); border-radius: 50%;
           animation: spin 0.7s linear infinite; display: inline-block; }

/* ── Mobile responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .mobile-topbar { display: flex; align-items: center; gap: 12px;
                   background: var(--navy); padding: 10px 16px; position: sticky;
                   top: 0; z-index: 200; height: 52px; }
  .mobile-brand  { flex: 1; display: flex; align-items: center; gap: 8px;
                   font-size: 0.9rem; font-weight: 700; color: #edf4ff; }
  .mobile-user   { width: 30px; height: 30px; border-radius: 50%; background: var(--accent);
                   display: flex; align-items: center; justify-content: center;
                   font-size: 0.78rem; font-weight: 700; color: #fff; flex-shrink: 0; }
  .hamburger     { background: none; border: none; cursor: pointer; padding: 4px;
                   display: flex; flex-direction: column; gap: 4px; }
  .hamburger span { width: 20px; height: 2px; background: #edf4ff; border-radius: 1px; display: block; }
  .sidebar-close { display: flex; margin-left: auto; background: none; border: none;
                   color: rgba(255,255,255,.5); font-size: 1rem; cursor: pointer; padding: 4px; }
  .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5);
                     z-index: 299; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .overlay-visible { opacity: 1; pointer-events: auto; }
  .sidebar { position: fixed; top: 0; left: 0; height: 100vh; z-index: 300;
             transform: translateX(-100%); transition: transform .25s ease; width: 260px; }
  .sidebar-open  { transform: translateX(0); }
  .main { padding: 16px; }
  .kpi-row { gap: 8px; }
  .reports-grid, .dash-grid, .settings-grid { grid-template-columns: 1fr; }
  .player-layout { grid-template-columns: 1fr; }
}

/* ── Transactions split layout (table left, video right) ─────────────────── */
.tx-split        { display: flex; gap: 16px; align-items: flex-start; }
.tx-split-table  { flex: 3; min-width: 0; }
.tx-split-video  { flex: 2; min-width: 300px; position: sticky; top: 76px; }
.pagination-bar  { display:flex; align-items:center; justify-content:space-between;
                   padding: 10px 14px; border-top: 1px solid var(--border); margin-top: 6px; }
.pagination-bar .page-info { font-size:0.78rem; color:var(--text-3); }

.tx-video-wrap       { position: relative; line-height: 0; }
.tx-video-wrap video { display: block; width: 100%; }
/* Video panel */
.tx-video-panel  { background: var(--surface); border: 1px solid var(--border);
                   border-radius: var(--radius); overflow: hidden;
                   box-shadow: var(--shadow-sm); }
.tx-video-panel video { width: 100%; display: block; background: #000;
                        aspect-ratio: 16/9; }
.tx-video-empty  { display: flex; align-items: center; justify-content: center;
                   flex-direction: column; gap: 6px;
                   aspect-ratio: 16/9; background: var(--navy);
                   color: var(--text-3); font-size: 0.82rem; }
.tx-video-empty .play-icon { font-size: 1.8rem; opacity: 0.4; }
.tx-video-meta   { padding: 12px 14px; border-top: 1px solid var(--border); }
.tx-vm-name      { font-weight: 600; font-size: 0.88rem; color: var(--text-1); }
.tx-vm-items     { font-size: 0.78rem; color: var(--text-2); margin-top: 2px;
                   white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-video-transcript { padding: 10px 14px; border-top: 1px solid var(--border);
                       font-size: 0.78rem; color: var(--text-2); line-height: 1.5;
                       max-height: 130px; overflow-y: auto; }
.tx-transcript-line   { padding: 4px 0; border-bottom: 1px dashed var(--border); }
.tx-transcript-line:last-child { border-bottom: none; }
.tx-transcript-speaker { font-weight: 600; color: var(--text-1); }
.tx-transcript-operator .tx-transcript-speaker { color: var(--accent); }
.tx-transcript-customer .tx-transcript-speaker { color: var(--text-2); }

/* Wall-clock overlay — top-left of video */
#tx-wc-overlay, #player-wc-overlay {
  display: none; position: absolute; top: 10px; left: 10px;
  background: rgba(0,0,0,.65); color: #fff;
  font-family: monospace; font-size: 0.9rem; font-weight: 700;
  padding: 3px 12px; border-radius: 4px;
  pointer-events: none; z-index: 5;
  letter-spacing: .04em; white-space: nowrap; }

/* Seek items — player page */
.seek-item { cursor: pointer; }
.seek-item:hover .seek-play-icon { opacity: 1; }
.seek-play-icon { opacity: 0; font-size: 0.7rem; color: var(--accent);
                  transition: opacity .15s; margin-right: 4px; flex-shrink: 0; }

/* Responsive — stack on narrow screens */
@media (max-width: 960px) {
  .tx-split { flex-direction: column; }
  .tx-split-video { position: static; min-width: unset; width: 100%; }
}

/* ── Transaction review workspace ────────────────────────────────────────────
   Two columns: LEFT = Event Information (PA Upselling Form), wide. RIGHT =
   video, transcript, and the timeline table stacked, narrower, sticky so it
   stays in view while scrolling a long form. */
.tx-review-layout { display: flex; gap: 16px; align-items: flex-start; }
.tx-review-left  { flex: 7; min-width: 0; }
.tx-review-right { flex: 3; min-width: 320px; position: sticky; top: 76px;
                   display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 960px) {
  .tx-review-layout { flex-direction: column; }
  .tx-review-right  { position: static; min-width: unset; width: 100%; }
}

.tx-ws-timeline .table-wrap { max-height: 380px; overflow-y: auto; }
.tx-ws-transcript .tx-video-transcript { max-height: 340px; overflow-y: auto; border-top: none; padding: 10px 0 0; }

.pa-form-toprow { display: flex; align-items: center; justify-content: space-between; }
.pa-form-header { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.pa-field-grid  { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 14px; }
@media (max-width: 600px) {
  .pa-field-grid { grid-template-columns: 1fr; }
}

/* Category boxes (Upselling / Upsizing / Extra Toppings) — always expanded,
   side by side, matching _metric_grp()'s three-QGroupBox row in the desktop
   reference rather than stacked accordions. */
.pa-categories-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.pa-category-box   { flex: 1; min-width: 240px; border: 1px solid var(--border);
                      border-radius: 8px; padding: 12px 14px; }
.pa-category-box h3 { margin: 0 0 10px; font-size: 0.85rem; color: var(--accent); }
.pa-category-box .pa-field-grid { grid-template-columns: 1fr; }
@media (max-width: 960px) {
  .pa-categories-row { flex-direction: column; }
}

.tx-ws-empty { display: flex; align-items: center; justify-content: center;
  min-height: 200px; color: var(--text-3); font-size: 0.85rem; }

.form-input[readonly], .form-textarea[readonly] {
  background: var(--bg); color: var(--text-2); cursor: default; }
.form-input[readonly]:focus, .form-textarea[readonly]:focus {
  border-color: var(--border); box-shadow: none; }

/* ── Transactions top bar ──────────────────────────────────────────────────── */
.tx-top-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
              padding: 10px 0 12px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tx-top-sel { display: flex; align-items: center; gap: 6px; }
.tx-top-label { font-size: 0.72rem; font-weight: 600; color: var(--text-3);
                text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.tx-top-select { padding: 5px 10px; border: 1px solid var(--border);
                 border-radius: 6px; background: var(--surface);
                 color: var(--text-1); font-size: 0.82rem; max-width: 260px; }
.tx-top-select:focus { border-color: var(--accent); outline: none; }

/* ── Badge row ────────────────────────────────────────────────────────────── */
.tx-badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.tx-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
            border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.tx-badge-blue  { background: #dbeafe; color: #1d4ed8; }
.tx-badge-green { background: var(--green-bg); color: var(--green-text); }
.tx-badge-amber { background: var(--amber-bg); color: var(--amber-text); }
.tx-badge-red   { background: var(--red-bg);   color: var(--red-text); }
.tx-badge-muted { background: var(--bg);        color: var(--text-3); border: 1px solid var(--border); }
[data-theme="dark"] .tx-badge-blue { background: #1e3a6e; color: #93c5fd; }

/* ── Status pill (T·A) ────────────────────────────────────────────────────── */
.status-pill  { font-family: monospace; font-size: 0.72rem; letter-spacing: .03em; }
.status-done  { color: var(--green-text); }
.status-err   { color: var(--red-text); }
.status-pend  { color: var(--text-3); }

/* ── Validate button ──────────────────────────────────────────────────────── */
.btn-validate { border: none; cursor: pointer; padding: 2px 8px;
                border-radius: 999px; font-size: 0.75rem; font-weight: 700;
                transition: background .15s, color .15s; }
.badge { display: inline-flex; align-items: center; justify-content: center; }
.badge-green { background: var(--green-bg); color: var(--green-text); }

/* ── Pipeline ─────────────────────────────────────────────────────────────── */

/* Job status pill — extends the existing status-pill vocabulary with a
   filled-badge look (unlike the plain colored-text T·A pill above) since a
   job's status is the primary thing being scanned in the jobs table. */
.status-pill.status-run  { background: var(--accent); color: #fff; padding: 2px 8px;
                            border-radius: 999px; font-weight: 700; }
.status-pill.status-done { background: var(--green-bg); color: var(--green-text);
                            padding: 2px 8px; border-radius: 999px; font-weight: 700; }
.status-pill.status-err  { background: var(--red-bg); color: var(--red-text);
                            padding: 2px 8px; border-radius: 999px; font-weight: 700; }
.status-pill.status-pend { background: var(--bg); color: var(--text-3); border: 1px solid var(--border);
                            padding: 2px 8px; border-radius: 999px; font-weight: 700; }

.job-progress-bar  { width: 100%; height: 6px; border-radius: 999px; background: var(--bg);
                     border: 1px solid var(--border); overflow: hidden; }
.job-progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.job-progress-label { font-size: 0.68rem; color: var(--text-3); }

.dropzone { border: 2px dashed var(--border); border-radius: var(--radius-sm);
            padding: 24px; text-align: center; color: var(--text-2); font-size: 0.85rem;
            transition: border-color .15s, background .15s; }
.dropzone-active { border-color: var(--accent); background: rgba(79,157,255,.06); }

.stage-check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem;
               color: var(--text-2); cursor: pointer; }

/* iOS-style toggle switch */
.toggle-switch-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem;
                        color: var(--text-2); cursor: pointer; }
.toggle-switch-inline input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch { position: relative; display: inline-block; width: 38px; height: 21px;
                 background: var(--border); border-radius: 999px; transition: background .2s; flex-shrink: 0; }
.toggle-switch-thumb { position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
                       background: #fff; border-radius: 50%; transition: transform .2s;
                       box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle-switch-inline input:checked + .toggle-switch { background: var(--accent); }
.toggle-switch-inline input:checked + .toggle-switch .toggle-switch-thumb { transform: translateX(17px); }
.toggle-switch-inline input:disabled + .toggle-switch { opacity: .5; cursor: not-allowed; }

/* Activity log */
.activity-item { display: flex; align-items: center; gap: 8px; padding: 8px 4px;
                 border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.activity-dot-info  { background: var(--accent); }
.activity-dot-warn  { background: var(--amber); }
.activity-dot-error { background: var(--red); }
.activity-msg { flex: 1; color: var(--text-1); }
.activity-ts  { font-size: 0.7rem; color: var(--text-3); white-space: nowrap; }
.badge-muted { background: var(--bg); color: var(--text-3); border: 1px solid var(--border); }
