/* ============================================================
   DSA TRACKER - STYLESHEET
   Design: Minimal productivity tool, inspired by Notion/Linear
   Signature: Frequency heat-dots as the visual language
   ============================================================ */

/* ─── TOKENS ─────────────────────────────────────────────── */
:root {
    --bg:          #0f0f11;
    --bg-2:        #16161a;
    --bg-3:        #1e1e24;
    --bg-4:        #26262e;
    --border:      #2a2a35;
    --border-2:    #333340;
    --text:        #e8e8ee;
    --text-2:      #9898aa;
    --text-3:      #5a5a70;
  
    --blue:        #4f7eff;
    --blue-dim:    #4f7eff22;
    --green:       #34d399;
    --green-dim:   #34d39922;
    --orange:      #fb923c;
    --orange-dim:  #fb923c22;
    --red:         #f87171;
    --red-dim:     #f8717122;
    --gold:        #fbbf24;
    --gold-dim:    #fbbf2422;
    --purple:      #a78bfa;
    --purple-dim:  #a78bfa22;
  
    --easy:        #34d399;
    --medium:      #fbbf24;
    --hard:        #f87171;
  
    --amazon:      #FF9900;
    --google:      #4285F4;
    --meta:        #0866FF;
    --microsoft:   #00A4EF;
  
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   16px;
  
    --sidebar-w:   220px;
    --topbar-h:    56px;
    --detail-w:    360px;
  
    --font-ui:     'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:   'JetBrains Mono', 'Fira Code', monospace;
  
    --transition:  150ms ease;
  }
  
  /* ─── RESET ─────────────────────────────────────────────── */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html { font-size: 14px; scroll-behavior: smooth; }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    line-height: 1.5;
    overflow-x: hidden;
  }
  a { color: inherit; text-decoration: none; }
  button { cursor: pointer; font-family: inherit; border: none; background: none; }
  select, input, textarea { font-family: inherit; color: var(--text); }
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: var(--bg-2); }
  ::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
  
  /* ─── LAYOUT ─────────────────────────────────────────────── */
  #app {
    display: flex;
    min-height: 100vh;
  }
  
  /* ─── SIDEBAR ───────────────────────────────────────────── */
  .sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform var(--transition), width var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
  }
  .sidebar.closed {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }
  
  .sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
  }
  .logo-icon { font-size: 20px; }
  .logo-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
  }
  
  .sidebar-section-label {
    padding: 16px 16px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-3);
  }
  
  .sidebar-nav { padding: 4px 8px; }
  .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 13.5px;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    user-select: none;
  }
  .nav-item:hover { background: var(--bg-3); color: var(--text); }
  .nav-item.active { background: var(--blue-dim); color: var(--blue); }
  .nav-icon { font-size: 14px; width: 20px; text-align: center; }
  .nav-label { flex: 1; }
  .nav-count {
    font-size: 11px;
    color: var(--text-3);
    background: var(--bg-4);
    padding: 1px 6px;
    border-radius: 10px;
  }
  .nav-badge {
    font-size: 10px;
    background: var(--red);
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
  }
  
  .sidebar-progress {
    padding: 8px 16px;
  }
  .sidebar-mini-stat {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-2);
    margin-bottom: 6px;
  }
  .text-green { color: var(--green); }
  .text-red { color: var(--red); }
  
  .sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--border);
  }
  
  .progress-track {
    height: 6px;
    background: var(--bg-4);
    border-radius: 3px;
    overflow: hidden;
  }
  .progress-track.thin { height: 4px; }
  .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--purple));
    border-radius: 3px;
    transition: width 0.5s ease;
  }
  .progress-fill-reality {
    background: linear-gradient(90deg, var(--green), var(--blue));
  }
  
  /* ─── MAIN LAYOUT ─────────────────────────────────────────── */
  .main-layout {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
  }
  .main-layout.sidebar-collapsed {
    margin-left: 0;
  }
  
  .topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .sidebar-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
  }
  .sidebar-toggle:hover { background: var(--bg-3); }
  .sidebar-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-2);
    border-radius: 1px;
  }
  .topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
  }
  .topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .topbar-date {
    font-size: 12px;
    color: var(--text-3);
  }
  
  /* Content split layout */
  .content-split {
    display: flex;
    flex: 1;
    overflow: hidden;
  }
  .main-content-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .content-split.has-detail .main-content-wrap {
    flex: 1;
    margin-right: var(--detail-w);
  }
  .detail-pane-sidebar {
    width: var(--detail-w);
    min-width: 320px;
    max-width: 400px;
    border-left: 1px solid var(--border);
    background: var(--bg-2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: calc(100vh - var(--topbar-h));
  }
  .detail-pane-sidebar:not(.detail-pane-empty) {
    position: fixed;
    top: var(--topbar-h);
    right: 0;
    z-index: 45;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.25);
  }
  .detail-pane-empty {
    display: none;
    position: static;
    box-shadow: none;
  }
  .detail-pane-sidebar .detail-panel,
  .detail-overlay > .detail-panel {
    flex: 1;
    min-height: 0;
  }
  .detail-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
    color: var(--text-3);
    font-size: 13px;
  }
  
  main#main-content {
    padding: 24px;
    max-width: 1100px;
  }
  
  /* ─── CARDS ─────────────────────────────────────────────────── */
  .card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
  }
  .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
  }
  .section-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
  }
  
  /* ─── DASHBOARD ─────────────────────────────────────────────── */
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .stat-cards {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
  }
  
  @media (max-width: 1200px) {
    .stat-cards { grid-template-columns: repeat(3, 1fr); }
  }
  
  .stat-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    position: relative;
    overflow: hidden;
  }
  .stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }
  .stat-card.accent-blue::before { background: var(--blue); }
  .stat-card.accent-green::before { background: var(--green); }
  .stat-card.accent-orange::before { background: var(--orange); }
  .stat-card.accent-gold::before { background: var(--gold); }
  .stat-card.accent-red::before { background: var(--red); }
  .stat-card.accent-purple::before { background: var(--purple); }
  
  .stat-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 4px;
  }
  .stat-label { font-size: 12px; color: var(--text-2); }
  .stat-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
  
  /* Diff bars */
  .diff-bars { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
  .diff-row { display: flex; align-items: center; gap: 10px; }
  .diff-track { flex: 1; height: 6px; background: var(--bg-4); border-radius: 3px; overflow: hidden; }
  .diff-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
  .diff-fill.diff-easy { background: var(--easy); }
  .diff-fill.diff-medium { background: var(--medium); }
  .diff-fill.diff-hard { background: var(--hard); }
  .diff-count { font-size: 11px; color: var(--text-3); width: 50px; text-align: right; }
  
  /* Category progress */
  .cat-list { display: flex; flex-direction: column; gap: 8px; }
  .cat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 0;
  }
  .cat-row:hover .cat-name { color: var(--blue); }
  .cat-name { font-size: 12px; color: var(--text-2); width: 140px; flex-shrink: 0; }
  .cat-track { flex: 1; height: 5px; background: var(--bg-4); border-radius: 3px; overflow: hidden; }
  .cat-fill { height: 100%; background: var(--blue); border-radius: 3px; transition: width 0.5s ease; }
  .cat-count { font-size: 11px; color: var(--text-3); width: 45px; text-align: right; }
  
  /* Progress section */
  .progress-pct { font-size: 20px; font-weight: 700; color: var(--blue); }
  
  /* Revision due section */
  .due-list { display: flex; flex-direction: column; gap: 6px; }
  .due-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
  }
  .due-item:hover { background: var(--bg-4); }
  .due-title { flex: 1; font-size: 13px; }
  .due-status { font-size: 11px; color: var(--text-3); }
  .due-more { font-size: 12px; color: var(--text-3); text-align: center; padding: 4px; }
  
  /* Reality quick access */
  .badge-new {
    font-size: 10px;
    background: var(--purple-dim);
    color: var(--purple);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .reality-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .reality-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-3);
    transition: all var(--transition);
    cursor: pointer;
    text-align: left;
  }
  .reality-btn:hover { border-color: var(--border-2); transform: translateY(-1px); }
  .reality-amazon:hover { border-color: var(--amazon); background: rgba(255,153,0,0.08); }
  .reality-google:hover { border-color: var(--google); background: rgba(66,133,244,0.08); }
  .reality-meta:hover { border-color: var(--meta); background: rgba(8,102,255,0.08); }
  .reality-microsoft:hover { border-color: var(--microsoft); background: rgba(0,164,239,0.08); }
  
  .reality-emoji { font-size: 22px; }
  .reality-name { font-size: 14px; font-weight: 600; color: var(--text); }
  .reality-coverage { font-size: 11px; color: var(--text-3); }
  
  /* Empty states */
  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    color: var(--text-3);
  }
  .empty-state.small { padding: 16px; }
  .empty-icon { font-size: 32px; }
  
  /* ─── FILTERS BAR ────────────────────────────────────────────── */
  .filters-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 0 12px;
    position: sticky;
    top: var(--topbar-h);
    background: var(--bg);
    z-index: 40;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
  }
  .search-wrap {
    position: relative;
    display: flex;
    align-items: center;
  }
  .search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-3);
    font-size: 16px;
    pointer-events: none;
  }
  .search-input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    transition: border-color var(--transition);
  }
  .search-input:focus {
    outline: none;
    border-color: var(--blue);
  }
  .search-input::placeholder { color: var(--text-3); }
  
  .filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  .filter-select {
    padding: 6px 10px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 12px;
    cursor: pointer;
    transition: border-color var(--transition);
  }
  .filter-select:focus { outline: none; border-color: var(--blue); }
  .filter-select:hover { border-color: var(--border-2); }
  
  .rev-due-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 12px;
    cursor: pointer;
  }
  .rev-due-toggle.active { border-color: var(--orange); color: var(--orange); background: var(--orange-dim); }
  .rev-due-toggle input { width: 12px; height: 12px; cursor: pointer; }
  
  .freq-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-2);
  }
  .freq-range { width: 80px; accent-color: var(--blue); }
  
  .clear-filters {
    padding: 6px 12px;
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid var(--red);
    border-radius: var(--radius-sm);
    font-size: 12px;
  }
  
  /* ─── QUESTION TABLE ─────────────────────────────────────────── */
  .questions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }
  .question-count { font-size: 13px; color: var(--text-2); }
  .sort-controls { display: flex; gap: 4px; align-items: center; }
  .sort-label { font-size: 12px; color: var(--text-3); }
  .sort-btn {
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-2);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
  }
  .sort-btn:hover { background: var(--bg-3); color: var(--text); }
  .sort-btn.active { background: var(--blue-dim); color: var(--blue); border-color: var(--blue); }
  
  /* Category sections */
  .category-section {
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
  }
  .category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-2);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
  }
  .category-header:hover { background: var(--bg-3); }
  .cat-header-left { display: flex; align-items: center; gap: 10px; }
  .cat-header-right { display: flex; align-items: center; gap: 8px; }
  .cat-chevron { font-size: 11px; color: var(--text-3); width: 14px; }
  .cat-title { font-size: 13px; font-weight: 600; color: var(--text); }
  .cat-pill {
    font-size: 11px;
    color: var(--text-3);
    background: var(--bg-4);
    padding: 1px 7px;
    border-radius: 10px;
  }
  .mini-prog { font-size: 11px; color: var(--text-3); }
  
  .question-table-wrap { overflow-x: auto; }
  .question-table {
    width: 100%;
    border-collapse: collapse;
  }
  .question-table tbody tr + tr {
    border-top: 1px solid var(--border);
  }
  
  .q-row {
    display: table-row;
    cursor: pointer;
    transition: background var(--transition);
  }
  .q-row:hover { background: var(--bg-3); }
  .q-row.q-row-active { background: var(--blue-dim); }
  .q-row.q-row-due { background: rgba(251, 146, 60, 0.06); }
  
  .q-row td {
    padding: 10px 12px;
    font-size: 13px;
    vertical-align: middle;
  }
  
  .q-status-cell { width: 36px; text-align: center; }
  .q-title-cell { max-width: 280px; }
  .q-diff-cell { width: 80px; }
  .q-freq-cell { width: 120px; }
  .q-company-cell { min-width: 120px; }
  .q-link-cell { width: 80px; }
  
  .status-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border: 1.5px solid var(--border-2);
    transition: all var(--transition);
    cursor: pointer;
  }
  .status-dot:hover { transform: scale(1.15); }
  
  /* Status dot colors */
  .status-not-started { border-color: var(--border-2); color: var(--text-3); }
  .status-attempted { border-color: var(--orange); color: var(--orange); background: var(--orange-dim); }
  .status-solved-hint { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }
  .status-solved { border-color: var(--green); color: var(--green); background: var(--green-dim); }
  .status-rev1 { border-color: var(--blue); color: var(--blue); background: var(--blue-dim); }
  .status-rev2 { border-color: var(--purple); color: var(--purple); background: var(--purple-dim); }
  .status-rev3 { border-color: var(--purple); color: var(--purple); background: rgba(167,139,250,0.15); }
  .status-mastered { border-color: var(--gold); color: var(--gold); background: rgba(251,191,36,0.2); box-shadow: 0 0 8px rgba(251,191,36,0.3); }
  
  .q-title {
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
  }
  .revision-badge {
    font-size: 10px;
    background: var(--orange-dim);
    color: var(--orange);
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 600;
  }
  .has-notes { font-size: 11px; margin-left: 4px; }
  
  /* Badges */
  .badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
  }
  .badge-easy { background: rgba(52,211,153,0.15); color: var(--easy); }
  .badge-medium { background: rgba(251,191,36,0.15); color: var(--medium); }
  .badge-hard { background: rgba(248,113,113,0.15); color: var(--hard); }
  .badge-category { background: var(--blue-dim); color: var(--blue); }
  .badge-pattern { background: var(--purple-dim); color: var(--purple); }
  
  /* Frequency dots */
  .freq-row, .freq-row-lg {
    display: flex;
    gap: 3px;
    align-items: center;
  }
  .freq-row-lg { gap: 4px; }
  .freq-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bg-4);
    transition: background var(--transition);
  }
  .freq-row-lg .freq-dot { width: 9px; height: 9px; }
  .freq-dot.filled { background: var(--blue); }
  
  /* Company chips */
  .company-chips { display: flex; flex-wrap: wrap; gap: 4px; }
  .company-chip {
    font-size: 10px;
    padding: 1px 6px;
    background: var(--bg-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-3);
  }
  .chip-more { color: var(--text-3); }
  
  /* Practice links */
  .lc-link, .gfg-link {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
    transition: opacity var(--transition);
  }
  .lc-link:hover, .gfg-link:hover { opacity: 0.8; }
  .lc-link { background: rgba(255,161,22,0.15); color: #FFA116; }
  .gfg-link { background: rgba(50,205,50,0.15); color: #32CD32; }
  
  /* ─── DETAIL PANEL ──────────────────────────────────────────── */
  .detail-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .detail-header {
    flex-shrink: 0;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-3);
    position: relative;
  }
  .close-detail {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text-2);
    transition: all var(--transition);
  }
  .close-detail:hover { background: var(--bg-4); color: var(--text); }
  .detail-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
  .detail-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
    margin-bottom: 8px;
    padding-right: 28px;
  }
  .detail-freq {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .freq-label { font-size: 11px; color: var(--text-3); }
  .freq-score { font-size: 12px; color: var(--text-2); font-weight: 600; }

  .detail-meta {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .detail-section { display: flex; flex-direction: column; gap: 6px; }
  .detail-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-3);
  }
  
  .status-select-wrap {
    position: relative;
  }
  .status-select {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-3);
    font-size: 13px;
    cursor: pointer;
    transition: border-color var(--transition);
  }
  .status-select:focus { outline: none; border-color: var(--blue); }
  
  .link-row { display: flex; gap: 8px; }
  .link-btn {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    transition: opacity var(--transition);
  }
  .link-btn:hover { opacity: 0.8; }
  .lc-btn { background: rgba(255,161,22,0.12); color: #FFA116; border: 1px solid rgba(255,161,22,0.3); }
  .gfg-btn { background: rgba(50,205,50,0.12); color: #32CD32; border: 1px solid rgba(50,205,50,0.3); }
  
  .company-tags, .sheet-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 72px;
    overflow-y: auto;
    padding-right: 2px;
  }
  .company-tag {
    font-size: 12px;
    padding: 3px 10px;
    background: var(--bg-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-2);
  }
  .sheet-tag {
    font-size: 11px;
    padding: 3px 10px;
    background: var(--blue-dim);
    border: 1px solid rgba(79,126,255,0.3);
    border-radius: var(--radius-sm);
    color: var(--blue);
  }
  
  .revision-info { display: flex; flex-direction: column; gap: 6px; }
  .rev-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-2);
  }
  .rev-row strong { color: var(--text); }
  
  .detail-notes {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-3);
    min-height: 160px;
    max-height: 38vh;
  }
  .notes-input {
    flex: 1;
    width: 100%;
    min-height: 100px;
    padding: 10px 12px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    line-height: 1.6;
    resize: none;
    overflow-y: auto;
    transition: border-color var(--transition);
    box-sizing: border-box;
  }
  .notes-input:focus { outline: none; border-color: var(--blue); }
  .notes-input::placeholder { color: var(--text-3); }

  /* Mobile overlay */
  .detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: flex-end;
    backdrop-filter: blur(2px);
  }
  .detail-overlay > .detail-panel {
    width: min(400px, 100vw);
    height: 100%;
    background: var(--bg-2);
    overflow: hidden;
  }
  .detail-overlay .detail-notes {
    max-height: 35vh;
  }
  
  /* ─── REALITY MODE VIEW ──────────────────────────────────────── */
  .reality-view { max-width: 900px; }
  .reality-hero {
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
  }
  .reality-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 80% 50%, rgba(255,255,255,0.04), transparent 70%);
  }
  .reality-amazon { background: linear-gradient(135deg, rgba(255,153,0,0.12), rgba(255,153,0,0.04)); border: 1px solid rgba(255,153,0,0.25); }
  .reality-google { background: linear-gradient(135deg, rgba(66,133,244,0.12), rgba(66,133,244,0.04)); border: 1px solid rgba(66,133,244,0.25); }
  .reality-meta { background: linear-gradient(135deg, rgba(8,102,255,0.12), rgba(8,102,255,0.04)); border: 1px solid rgba(8,102,255,0.25); }
  .reality-microsoft { background: linear-gradient(135deg, rgba(0,164,239,0.12), rgba(0,164,239,0.04)); border: 1px solid rgba(0,164,239,0.25); }
  
  .reality-back { margin-bottom: 16px; }
  .reality-hero-content { position: relative; z-index: 1; }
  .reality-logo { font-size: 40px; margin-bottom: 10px; }
  .reality-hero h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 8px; }
  .reality-desc { color: var(--text-2); font-size: 14px; line-height: 1.6; margin-bottom: 12px; }
  .reality-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
  .reality-sep { color: var(--text-3); }
  .reality-coverage { font-weight: 600; }
  
  .reality-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
  }
  .rstat {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    text-align: center;
  }
  .rstat.accent-green .rstat-val { color: var(--green); }
  .rstat-val { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
  .rstat-label { font-size: 11px; color: var(--text-3); margin-top: 2px; }
  
  .reality-progress, .reality-diff, .reality-cats {
    margin-bottom: 16px;
  }
  .diff-chips { display: flex; gap: 12px; flex-wrap: wrap; }
  .diff-chip { display: flex; align-items: center; gap: 8px; }
  .diff-chip-count { font-size: 13px; font-weight: 600; color: var(--text-2); }
  
  .cat-breakdown { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
  .cat-weight-row { display: flex; align-items: center; gap: 10px; }
  .cat-weight-name { font-size: 12px; color: var(--text-2); width: 160px; flex-shrink: 0; }
  .cat-weight-bar { flex: 1; height: 5px; background: var(--bg-4); border-radius: 3px; overflow: hidden; }
  .cat-weight-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--purple)); border-radius: 3px; }
  .cat-weight-pct { font-size: 11px; color: var(--text-3); width: 35px; text-align: right; }
  
  /* ─── REVISION VIEW ─────────────────────────────────────────── */
  .revision-view { max-width: 800px; }
  .revision-hero {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
  }
  .revision-hero h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
  }
  .revision-hero p { font-size: 13px; color: var(--text-2); }
  .revision-bands { display: flex; flex-direction: column; gap: 16px; }
  .rev-band {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
  }
  .rev-band-due { border-color: rgba(251,146,60,0.3); }
  .rev-band-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
  }
  .rev-band-title { font-size: 13px; font-weight: 600; }
  .rev-band-count {
    font-size: 11px;
    background: var(--bg-4);
    padding: 1px 8px;
    border-radius: 10px;
    color: var(--text-2);
  }
  .rev-due-in { font-size: 12px; color: var(--green); font-weight: 600; white-space: nowrap; }
  
  /* ─── BUTTONS ─────────────────────────────────────────────────── */
  .btn-primary {
    padding: 8px 16px;
    background: var(--blue);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    transition: opacity var(--transition);
  }
  .btn-primary:hover { opacity: 0.9; }
  
  .btn-ghost {
    padding: 6px 12px;
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    transition: all var(--transition);
  }
  .btn-ghost:hover { background: var(--bg-3); color: var(--text); }
  
  .btn-danger { padding: 8px 16px; background: var(--red); color: white; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; }
  .btn-danger-ghost {
    padding: 6px 12px;
    color: var(--red);
    border: 1px solid rgba(248,113,113,0.3);
    border-radius: var(--radius-sm);
    font-size: 12px;
    width: 100%;
  }
  .btn-danger-ghost:hover { background: var(--red-dim); }

  .sidebar-action {
    width: 100%;
    margin-bottom: 6px;
    text-align: center;
  }
  .hidden-input { display: none; }
  .keyboard-hints {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 10px;
    color: var(--text-3);
  }
  .keyboard-hints kbd {
    display: inline-block;
    padding: 1px 5px;
    background: var(--bg-4);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 10px;
    margin-right: 4px;
  }
  .btn-revise {
    width: 100%;
    margin-top: 10px;
  }
  .q-pattern-cell { white-space: nowrap; }
  .q-pattern-mobile { display: none; }
  .gfg-secondary { opacity: 0.7; margin-left: 4px; }

  .focus-list { display: flex; flex-direction: column; gap: 6px; }
  .focus-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-3);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
  }
  .focus-item:hover { background: var(--bg-4); border-color: var(--border-2); }
  .focus-rank {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-dim);
    color: var(--blue);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
  }
  .focus-info { flex: 1; min-width: 0; }
  .focus-title { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .focus-meta { font-size: 11px; color: var(--text-3); }
  .freq-row.sm .freq-dot { width: 5px; height: 5px; }
  
  /* ─── MODAL ─────────────────────────────────────────────────── */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
  }
  .modal {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 380px;
    max-width: calc(100vw - 32px);
  }
  .modal h3 { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
  .modal p { font-size: 13px; color: var(--text-2); margin-bottom: 20px; line-height: 1.6; }
  .modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
  
  /* ─── EMPTY STATES ──────────────────────────────────────────── */
  .empty-full {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 80px 24px;
    text-align: center;
  }
  .empty-full .empty-icon { font-size: 48px; margin-bottom: 8px; }
  .empty-full h3 { font-size: 17px; font-weight: 700; }
  .empty-full p { color: var(--text-2); font-size: 13px; }
  
  /* ─── RESPONSIVE ─────────────────────────────────────────────── */
  @media (max-width: 1024px) {
    .detail-pane-sidebar { display: none; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .stat-cards { grid-template-columns: repeat(3, 1fr); }
  }
  @media (max-width: 768px) {
    :root { --sidebar-w: 240px; }
    .main-layout { margin-left: 0; }
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
    .sidebar.open { transform: translateX(0); }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .reality-stats { grid-template-columns: repeat(2, 1fr); }
    .reality-buttons { grid-template-columns: 1fr; }
    main#main-content { padding: 16px; }
    .q-company-cell, .q-link-cell, .q-freq-cell, .q-pattern-cell { display: none; }
  .q-pattern-mobile { display: inline-flex; margin-left: 6px; }
    .filter-controls { flex-direction: column; align-items: stretch; }
    .filter-select { width: 100%; }
    .dashboard-grid { grid-template-columns: 1fr; }
  }
  @media (max-width: 480px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .reality-stats { grid-template-columns: repeat(2, 1fr); }
    .topbar { padding: 0 14px; }
  }
  
  /* ─── ANIMATION ─────────────────────────────────────────────── */
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .category-section { animation: fadeIn 0.15s ease; }
  .stat-card { animation: fadeIn 0.2s ease; }
  
  /* ─── SEO STATIC CONTENT ────────────────────────────────────── */
  .seo-static {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.65;
  }
  .seo-static h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
  }
  .seo-static h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 1.25rem 0 0.5rem;
  }
  .seo-static ul {
    padding-left: 1.25rem;
    margin-bottom: 0.75rem;
  }
  .seo-static li { margin-bottom: 0.35rem; }
  .seo-static strong { color: var(--text); font-weight: 600; }
  .seo-static-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .noscript-fallback {
    padding: 2rem;
    text-align: center;
    color: var(--text-2);
    background: var(--bg);
    min-height: 50vh;
  }
  .noscript-fallback h1 {
    color: var(--text);
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }

  /* ─── PRINT ─────────────────────────────────────────────────── */
  @media print {
    .sidebar, .topbar, .filters-bar { display: none; }
    .main-layout { margin-left: 0; }
    .seo-static-hidden {
      position: static;
      width: auto;
      height: auto;
      clip: auto;
      white-space: normal;
      margin: 2rem;
    }
  }