/* ── Lessonify — Dashboard Styles ── */

:root {
    --ink:    #0f0e0c;
    --paper:  #f5f0e8;
    --sage:   #4a6741;
    --gold:   #c9922a;
    --rust:   #b84c2a;
    --mist:   #d6e4d0;
    --cream:  #ede7d9;
    --white:  #fdfaf4;
    --sidebar-w: 220px;
  }

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; overflow: hidden; }

  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--paper);
    color: var(--ink);
    display: flex;
  }

  /* ── AUTH GATE ── */
  .gate-google-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: white !important;
    color: #1a1a1a !important;
    border: 1.5px solid rgba(0,0,0,0.15) !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1) !important;
    margin-bottom: 0.25rem;
  }
  .gate-google-btn:hover {
    background: #f8f8f8 !important;
    border-color: rgba(0,0,0,0.25) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
  }
  .gate-secondary-btn {
    background: var(--ink) !important;
  }
  .gate-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0;
    color: rgba(15,14,12,0.35);
    font-size: 0.72rem;
    font-family: 'DM Sans', sans-serif;
  }
  .gate-divider::before, .gate-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(15,14,12,0.12);
  }

  #authGate {
    position: fixed; inset: 0;
    background: var(--paper);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    flex-direction: column;
    gap: 1rem;
  }
  #authGate.hidden { display: none; }
  .gate-card {
    background: var(--white);
    border: 1px solid rgba(74,103,65,0.15);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    width: 100%; max-width: 400px;
    text-align: center;
    box-shadow: 0 24px 64px rgba(15,14,12,0.1);
  }
  .gate-logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem; font-weight: 900;
    color: var(--ink); margin-bottom: 0.5rem;
  }
  .gate-logo span { color: var(--sage); }
  .gate-sub { font-size: 0.85rem; color: rgba(15,14,12,0.5); margin-bottom: 1.8rem; }
  .gate-field {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1.5px solid rgba(74,103,65,0.2);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    background: var(--white);
    color: var(--ink);
    margin-bottom: 0.7rem;
    outline: none;
    transition: border-color 0.2s;
  }
  .gate-field:focus { border-color: var(--sage); }
  .gate-btn {
    width: 100%;
    padding: 0.8rem;
    background: var(--sage);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem; font-weight: 600;
    cursor: pointer;
    margin-top: 0.3rem;
    transition: opacity 0.2s;
  }
  .gate-btn:hover { opacity: 0.88; }
  .gate-link {
    font-size: 0.8rem; color: rgba(15,14,12,0.45);
    margin-top: 1rem;
  }
  .gate-link a { color: var(--sage); text-decoration: none; font-weight: 600; }

  /* ── SIDEBAR ── */
  #sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--ink);
    display: flex; flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.25s ease;
    position: relative;
    z-index: 10;
  }

  .sidebar-logo {
    padding: 1.4rem 1.4rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }
  .sidebar-logo-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem; font-weight: 900;
    color: white;
    line-height: 1;
  }
  .sidebar-logo-text span { color: var(--gold); }
  .sidebar-logo-sub {
    font-size: 0.62rem; color: rgba(255,255,255,0.3);
    text-transform: uppercase; letter-spacing: 0.8px;
    margin-top: 0.25rem;
  }

  .sidebar-section-label {
    font-size: 0.58rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.2px;
    color: rgba(255,255,255,0.25);
    padding: 1.2rem 1.4rem 0.5rem;
  }

  .sidebar-nav { flex: 1; overflow-y: auto; padding-bottom: 1rem; }
  .nav-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.65rem 1.4rem;
    cursor: pointer;
    border-radius: 0;
    transition: background 0.15s;
    position: relative;
    border: none; background: none; width: 100%; text-align: left;
  }
  .nav-item:hover { background: rgba(255,255,255,0.05); }
  .nav-item.active {
    background: rgba(74,103,65,0.25);
  }
  .nav-item.active::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--sage);
    border-radius: 0 2px 2px 0;
  }
  .nav-icon {
    font-size: 1rem;
    width: 20px; text-align: center;
    flex-shrink: 0;
  }
  .nav-label {
    font-size: 0.82rem; font-weight: 500;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
  }
  .nav-item.active .nav-label { color: white; font-weight: 600; }

  .nav-badge {
    margin-left: auto;
    background: var(--gold);
    color: white;
    font-size: 0.58rem; font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 20px;
    text-transform: uppercase; letter-spacing: 0.3px;
  }

  .sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.07);
    padding: 1rem 1.4rem;
  }
  .user-pill {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.6rem 0.8rem;
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
  }
  .user-pill:hover { background: rgba(255,255,255,0.1); }
  .user-avatar {
    width: 28px; height: 28px;
    background: var(--sage);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700;
    color: white; flex-shrink: 0;
  }
  .user-name {
    font-size: 0.78rem; font-weight: 600;
    color: rgba(255,255,255,0.8);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .user-plan {
    font-size: 0.62rem; color: rgba(255,255,255,0.35);
    margin-top: 0.05rem;
  }
  .sidebar-upgrade {
    display: flex; align-items: center;
    padding: 0.5rem 0.8rem;
    background: linear-gradient(135deg, rgba(201,146,42,0.15), rgba(201,146,42,0.05));
    border: 1px solid rgba(201,146,42,0.2);
    border-radius: 8px;
    margin-top: 0.6rem;
    cursor: pointer;
    gap: 0.5rem;
    text-decoration: none;
  }
  .upgrade-text { font-size: 0.72rem; color: var(--gold); font-weight: 600; }
  .upgrade-sub { font-size: 0.6rem; color: rgba(201,146,42,0.6); }

  /* ── MAIN ── */
  #main {
    flex: 1;
    height: 100vh;
    overflow: hidden;
    display: flex; flex-direction: column;
  }

  /* ── TOPBAR ── */
  .topbar {
    height: 56px;
    border-bottom: 1px solid rgba(15,14,12,0.08);
    display: flex; align-items: center;
    padding: 0 1.8rem;
    gap: 1rem;
    background: var(--white);
    flex-shrink: 0;
  }
  .topbar-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem; font-weight: 700;
    color: var(--ink);
  }
  .topbar-sub {
    font-size: 0.75rem; color: rgba(15,14,12,0.4);
    margin-left: 0.3rem;
  }
  .topbar-right {
    margin-left: auto;
    display: flex; align-items: center; gap: 0.8rem;
  }
  .topbar-btn {
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    font-size: 0.78rem; font-weight: 600;
    border: 1.5px solid rgba(74,103,65,0.2);
    background: transparent; color: var(--sage);
    cursor: pointer; transition: all 0.15s;
    font-family: 'DM Sans', sans-serif;
  }
  .topbar-btn:hover { background: var(--mist); border-color: var(--sage); }
  .topbar-btn.primary {
    background: var(--sage); color: white; border-color: var(--sage);
  }
  .topbar-btn.primary:hover { opacity: 0.88; }
  .toggle-group { display:flex; flex-wrap:wrap; gap:0.5rem; }
  .toggle-item { display:flex; align-items:center; gap:0.4rem; font-size:0.83rem; font-family:'DM Sans',sans-serif; cursor:pointer; color:rgba(15,14,12,0.7); }
  .toggle-item input[type=checkbox] { accent-color:var(--sage); cursor:pointer; }

  /* ── CONTENT PANELS ── */
  .panel {
    flex: 1;
    overflow-y: auto;
    display: none;
    padding: 1.8rem;
  }
  .panel.active { display: block; }

  /* ── HOME PANEL ── */
  .home-greeting {
    margin-bottom: 1.8rem;
  }
  .home-greeting h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem; font-weight: 700;
    line-height: 1.2;
  }
  .home-greeting p {
    font-size: 0.85rem; color: rgba(15,14,12,0.5);
    margin-top: 0.3rem;
  }

  .quick-actions {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem; margin-bottom: 2rem;
  }
  .qa-card {
    background: var(--white);
    border: 1px solid rgba(15,14,12,0.07);
    border-radius: 14px;
    padding: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; flex-direction: column;
    gap: 0.6rem;
  }
  .qa-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,14,12,0.08); border-color: rgba(74,103,65,0.2); }
  .qa-icon { font-size: 1.4rem; }
  .qa-title { font-size: 0.88rem; font-weight: 700; }
  .qa-sub { font-size: 0.72rem; color: rgba(15,14,12,0.45); }
  .qa-card.sage-card { border-color: rgba(74,103,65,0.2); }
  .qa-card.gold-card { border-color: rgba(201,146,42,0.2); }
  .qa-card.rust-card { border-color: rgba(184,76,42,0.15); }

  .section-heading {
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: rgba(15,14,12,0.4);
    margin-bottom: 0.8rem;
  }

  .recent-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 0.7rem; margin-bottom: 2rem;
  }
  .recent-card {
    background: var(--white);
    border: 1px solid rgba(15,14,12,0.07);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex; align-items: center; gap: 0.8rem;
  }
  .recent-card:hover { border-color: rgba(74,103,65,0.25); background: var(--mist); }
  .recent-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .recent-info { flex: 1; min-width: 0; }
  .recent-title { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .recent-meta { font-size: 0.7rem; color: rgba(15,14,12,0.4); margin-top: 0.1rem; }
  .recent-type { font-size: 0.62rem; font-weight: 700; padding: 0.15rem 0.45rem; border-radius: 4px; }

  .stats-row {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
  }
  .stat-card {
    background: var(--white);
    border: 1px solid rgba(15,14,12,0.07);
    border-radius: 12px;
    padding: 1rem 1.2rem;
  }
  .stat-val { font-family: 'Playfair Display', serif; font-size: 1.8rem; font-weight: 700; }
  .stat-label { font-size: 0.72rem; color: rgba(15,14,12,0.45); margin-top: 0.1rem; }

  /* ── TOOL PANELS (lesson + worksheet) ── */
  .tool-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 0;
    height: calc(100vh - 56px);
    overflow: hidden;
  }
  .tool-sidebar {
    background: var(--white);
    border-right: 1px solid rgba(15,14,12,0.08);
    overflow-y: auto;
    padding: 1.4rem;
    display: flex; flex-direction: column; gap: 1rem;
  }
  .tool-output-area {
    overflow-y: auto;
    background: var(--paper);
    padding: 1.4rem;
    display: flex; flex-direction: column;
  }

  .input-group { display: flex; flex-direction: column; gap: 0.35rem; }
  .input-label {
    font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.4px;
    color: rgba(15,14,12,0.5);
  }
  .input-field {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1.5px solid rgba(74,103,65,0.15);
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.83rem; color: var(--ink);
    background: var(--white);
    outline: none; transition: border-color 0.2s;
    appearance: none; -webkit-appearance: none;
  }
  .input-field:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(74,103,65,0.08); }
  .input-field::placeholder { color: rgba(15,14,12,0.35); }
  .input-field optgroup { font-size: 0.72rem; font-weight: 700; color: rgba(15,14,12,0.4); }
  .input-field option { font-size: 0.83rem; font-weight: 400; color: var(--ink); }

  .divider { border: none; border-top: 1px dashed rgba(74,103,65,0.15); margin: 0.3rem 0; }

  .toggle-row {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }
  .toggle-chip {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 0.6rem;
    border: 1.5px solid rgba(74,103,65,0.12);
    border-radius: 8px;
    background: var(--white);
    cursor: pointer; font-size: 0.73rem; font-weight: 500;
    transition: all 0.15s;
  }
  .toggle-chip input { accent-color: var(--sage); }
  .toggle-chip:has(input:checked) {
    border-color: var(--sage); background: var(--mist);
    color: var(--sage); font-weight: 600;
  }

  .gen-btn {
    width: 100%; padding: 0.85rem;
    background: var(--sage); color: white;
    border: none; border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem; font-weight: 700;
    cursor: pointer; transition: opacity 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  }
  .gen-btn:hover:not(:disabled) { opacity: 0.88; }
  .gen-btn:disabled { opacity: 0.5; cursor: not-allowed; }
  .gen-btn.gold { background: var(--gold); }

  .usage-hint {
    font-size: 0.65rem; color: rgba(15,14,12,0.4);
    text-align: center; margin-top: 0.5rem;
  }

  /* ── SLIDE THEME PICKER ── */
  .pro-pill {
    display: inline-block; font-size: 0.6rem; font-weight: 700;
    background: var(--gold); color: #fff;
    padding: 1px 6px; border-radius: 20px;
    letter-spacing: 0.3px; text-transform: uppercase;
    vertical-align: middle; margin-left: 4px;
  }
  .theme-picker {
    display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.4rem;
  }
  .theme-swatch {
    display: flex; align-items: center; gap: 5px;
    padding: 0.35rem 0.65rem;
    border: 1.5px solid rgba(15,14,12,0.12);
    border-radius: 8px; background: #fff;
    cursor: pointer; transition: all 0.18s;
    font-family: 'DM Sans', sans-serif;
  }
  .theme-swatch:hover { border-color: var(--sage); }
  .theme-swatch.active { border-color: var(--sage); background: var(--mist); }
  .swatch-dot {
    width: 12px; height: 12px; border-radius: 50%;
    flex-shrink: 0; display: inline-block;
  }
  .swatch-name {
    font-size: 0.75rem; font-weight: 600; color: var(--ink);
  }

  /* output area internals */
  .output-placeholder {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 0.8rem; text-align: center;
    color: rgba(15,14,12,0.3);
    padding: 3rem;
  }
  .output-placeholder .ph-icon { font-size: 2.5rem; opacity: 0.4; }
  .output-placeholder p { font-size: 0.82rem; line-height: 1.6; max-width: 260px; }

  .loading-state {
    display: none;
    flex-direction: column; align-items: center; justify-content: center;
    gap: 1rem; padding: 3rem; text-align: center; flex: 1;
  }
  .loading-state.visible { display: flex; }
  .loading-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--mist);
    border-top-color: var(--sage);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .loading-text { font-size: 0.82rem; color: rgba(15,14,12,0.5); font-style: italic; }

  .output-content { display: none; flex-direction: column; gap: 0; }
  .output-content.visible { display: flex; }

  /* output sections */
  .out-section {
    background: var(--white);
    border: 1px solid rgba(15,14,12,0.07);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    margin-bottom: 0.8rem;
  }
  .out-section-title {
    font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--sage); margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(74,103,65,0.1);
  }
  .acara-code-badge {
    display: inline-block;
    background: var(--sage); color: white;
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem; font-weight: 500;
    padding: 0.2rem 0.55rem; border-radius: 4px;
    margin-right: 0.4rem;
  }

  .li-box {
    background: var(--cream);
    border-left: 3px solid var(--gold);
    border-radius: 0 8px 8px 0;
    padding: 0.8rem 1rem;
    margin-bottom: 0.6rem;
  }
  .li-label { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gold); margin-bottom: 0.3rem; }
  .li-text { font-size: 0.84rem; line-height: 1.6; font-style: italic; }

  .sc-box {
    background: var(--cream);
    border-left: 3px solid var(--sage);
    border-radius: 0 8px 8px 0;
    padding: 0.8rem 1rem;
  }
  .sc-label { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--sage); margin-bottom: 0.5rem; }
  .sc-item { font-size: 0.82rem; line-height: 1.6; padding: 0.25rem 0; border-bottom: 1px solid rgba(74,103,65,0.07); display: flex; gap: 0.5rem; }
  .sc-check { color: var(--sage); font-weight: 700; flex-shrink: 0; }

  .diff-tier {
    border: 1px solid rgba(15,14,12,0.07);
    border-radius: 10px; padding: 0.8rem 1rem; margin-bottom: 0.6rem;
  }
  .diff-tier-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
  .diff-pill {
    font-size: 0.62rem; font-weight: 700;
    padding: 0.2rem 0.55rem; border-radius: 20px;
    text-transform: uppercase; letter-spacing: 0.3px;
  }
  .pill-below { background: rgba(184,76,42,0.1); color: var(--rust); }
  .pill-at    { background: rgba(74,103,65,0.1); color: var(--sage); }
  .pill-above { background: rgba(201,146,42,0.1); color: var(--gold); }
  .diff-desc { font-size: 0.75rem; color: rgba(15,14,12,0.45); }
  .diff-content { font-size: 0.8rem; line-height: 1.6; color: rgba(15,14,12,0.7); }
  .diff-content strong { color: var(--ink); }

  .phase-row {
    display: flex; gap: 0.7rem; align-items: flex-start;
    padding: 0.65rem 0; border-bottom: 1px solid var(--cream);
  }
  .phase-num {
    width: 22px; height: 22px;
    background: var(--sage); color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 0.65rem; font-weight: 700; flex-shrink: 0; margin-top: 1px;
  }
  .phase-info { flex: 1; }
  .phase-name { font-size: 0.8rem; font-weight: 700; }
  .phase-dur { font-size: 0.7rem; color: var(--gold); font-weight: 600; }
  .phase-desc { font-size: 0.78rem; color: rgba(15,14,12,0.6); line-height: 1.55; margin-top: 0.2rem; }

  .blooms-item {
    background: var(--cream); border-radius: 8px;
    padding: 0.55rem 0.8rem; margin-bottom: 0.4rem;
    display: flex; gap: 0.6rem; align-items: flex-start;
  }
  .blooms-badge {
    background: var(--sage); color: white;
    font-size: 0.6rem; font-weight: 700;
    padding: 0.15rem 0.45rem; border-radius: 4px;
    white-space: nowrap; text-transform: uppercase; letter-spacing: 0.3px;
    margin-top: 1px;
  }
  .blooms-q { font-size: 0.8rem; line-height: 1.5; }

  .exit-box {
    background: var(--mist);
    border-left: 3px solid var(--sage);
    border-radius: 0 8px 8px 0;
    padding: 0.8rem 1rem;
    font-size: 0.84rem; line-height: 1.6;
  }

  .output-actions {
    display: flex; gap: 0.5rem; flex-wrap: wrap;
    padding: 1rem 0;
  }
  .action-btn {
    padding: 0.5rem 0.9rem;
    border: 1.5px solid rgba(74,103,65,0.2);
    border-radius: 8px; background: white;
    color: var(--sage); font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem; font-weight: 600;
    cursor: pointer; transition: all 0.15s;
  }
  .action-btn:hover { background: var(--mist); border-color: var(--sage); }
  .action-btn.primary-btn { background: var(--sage); color: white; border-color: var(--sage); }
  .action-btn.gold-btn { background: var(--gold); color: white; border-color: var(--gold); }

  .save-indicator {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.68rem; color: var(--sage); font-weight: 600;
    opacity: 0; transition: opacity 0.3s;
  }
  .save-indicator.show { opacity: 1; }

  /* syllabus note */
  .syllabus-note {
    display: none;
    background: var(--mist);
    border-radius: 8px; padding: 0.6rem 0.8rem;
    font-size: 0.72rem; line-height: 1.5;
    color: rgba(15,14,12,0.6);
    margin-top: -0.5rem;
  }

  /* LI format toggle */
  .li-toggle-row { display: flex; gap: 0.4rem; }
  .li-toggle-btn {
    flex: 1; padding: 0.45rem 0.5rem;
    border: 1.5px solid rgba(74,103,65,0.15);
    border-radius: 8px; background: white;
    font-size: 0.72rem; font-weight: 600;
    cursor: pointer; transition: all 0.15s;
    font-family: 'DM Sans', sans-serif;
    color: rgba(15,14,12,0.5);
  }
  .li-toggle-btn.active { border-color: var(--sage); background: var(--mist); color: var(--sage); }

  /* ── HISTORY PANEL ── */
  .history-list { display: flex; flex-direction: column; gap: 0.6rem; }
  .history-card {
    background: var(--white);
    border: 1px solid rgba(15,14,12,0.07);
    border-radius: 12px; padding: 1rem 1.2rem;
    cursor: pointer; transition: all 0.15s;
    display: flex; align-items: center; gap: 1rem;
  }
  .history-card:hover { border-color: rgba(74,103,65,0.25); transform: translateX(3px); }
  .history-type-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  }
  .history-info { flex: 1; min-width: 0; }
  .history-title { font-size: 0.86rem; font-weight: 600; }
  .history-sub { font-size: 0.72rem; color: rgba(15,14,12,0.4); margin-top: 0.15rem; }
  .history-date { font-size: 0.68rem; color: rgba(15,14,12,0.35); white-space: nowrap; }
  .history-empty {
    text-align: center; padding: 4rem 2rem;
    color: rgba(15,14,12,0.3); font-size: 0.85rem;
  }
  .history-empty .ph-icon { font-size: 2rem; margin-bottom: 0.5rem; }

  /* ── WORKSHEET output colours ── */
  .ws-tier-label {
    font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.8px;
    margin: 0.8rem 0 0.4rem;
    display: flex; align-items: center; gap: 0.4rem;
  }
  .ws-q {
    background: var(--cream); border-radius: 8px;
    padding: 0.7rem 0.9rem; margin-bottom: 0.5rem;
  }
  .ws-q-type { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: rgba(15,14,12,0.4); margin-bottom: 0.3rem; }
  .ws-q-text { font-size: 0.82rem; line-height: 1.5; }
  .ws-mc-opts { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.5rem; }
  .ws-mc-opt { font-size: 0.78rem; padding: 0.3rem 0.6rem; border: 1px solid rgba(15,14,12,0.1); border-radius: 5px; }
  .ws-ans-line { height: 1px; background: rgba(15,14,12,0.15); margin-top: 0.6rem; }

  /* ── MOBILE ── */
  /* ── PRO LOCKS ── */
  .nav-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
  }
  .nav-item.locked:hover {
    background: transparent;
    color: rgba(253,250,244,0.6);
  }
  .pro-badge {
    background: var(--gold) !important;
    color: var(--ink) !important;
    font-size: 0.55rem !important;
  }
  .nav-item.locked .pro-badge {
    background: rgba(255,255,255,0.15) !important;
    color: rgba(255,255,255,0.4) !important;
  }

  @media (max-width: 768px) {
    #sidebar { width: 60px; }
    .sidebar-logo-text, .sidebar-logo-sub, .nav-label, .sidebar-section-label,
    .nav-badge, .user-name, .user-plan, .upgrade-text, .upgrade-sub { display: none; }
    .sidebar-logo { padding: 1rem 0; text-align: center; }
    .nav-item { padding: 0.7rem 0; justify-content: center; }
    .sidebar-footer { padding: 0.6rem 0; }
    .user-pill { justify-content: center; padding: 0.5rem; }
    .sidebar-upgrade { display: none; }
    .tool-layout { grid-template-columns: 1fr; }
    .tool-sidebar { max-height: 45vh; border-right: none; border-bottom: 1px solid rgba(15,14,12,0.08); }
    .quick-actions { grid-template-columns: 1fr 1fr; }
    .recent-grid { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: 1fr; }
    .panel { padding: 1.2rem; }
  }
