    * { box-sizing: border-box; margin: 0; padding: 0; }

    /* ── Design tokens ── */
    :root {
      --bg:           #131520;   /* page background */
      --surface:      #1e2133;   /* panel / card surface */
      --surface-hi:   #272b42;   /* elevated element (buttons, inputs) */
      --surface-lo:   #191c2c;   /* inset content box */
      --border:       #333752;   /* standard border — visible */
      --border-sub:   #252840;   /* subtle separator */
      --text:         #e8eaf6;   /* primary text */
      --text-2:       #9aa3c8;   /* secondary text */
      --text-3:       #c4c9de;   /* muted / labels */
      --text-hint:    #bdc2d5;   /* empty-state hints */
      --purple:       #60a5fa;   /* primary accent — blue */
      --purple-dim:   #3b82f6;   /* accent dim — for borders, secondary */
      --blue:         #38bdf8;
      --green:        #34d399;
      --red:          #f87171;
      --amber:        #fbbf24;
      --c-tech:       #3b82f6;
      --c-metric:     #10b981;
      --c-compliance: #ef4444;
      --c-company:    #f59e0b;
      --c-strategy:   #8b5cf6;
      --c-number:     #06b6d4;
      /* tinted hover / active backgrounds */
      --active-bg:    #1e3a5c;   /* active element bg — dark blue */
      --active-text:  #ffffff;   /* text on active bg — white */
      --hover-green:  #1a3d30;
      --hover-red:    #3d1a1a;
      --hover-blue:   #152535;
      --hover-amber:  #3a2d14;
      --hover-purple: #1a3356;   /* accent hover bg — deep navy */
      /* ── Size scale (default = medium) ── */
      --fs-xs:   12px;   /* badges, labels, uppercase headings */
      --fs-sm:   13px;   /* buttons, secondary text, controls */
      --fs-base: 15px;   /* body text, inputs */
      --fs-md:   16px;   /* card titles, prominent text */
      --fs-lg:   18px;   /* panel headers */
      --btn-pad: 6px 12px;   /* button padding */
      --btn-pad-sm: 4px 8px; /* small button padding */
      /* ── Radius scale ── */
      --radius-sm: 8px;
      --radius-md: 12px;
      --radius-lg: 16px;
      /* ── Shadows ── */
      --shadow-sm: 0 1px 3px rgba(0,0,0,0.24), 0 1px 2px rgba(0,0,0,0.16);
      --shadow-md: 0 4px 12px rgba(0,0,0,0.32), 0 2px 4px rgba(0,0,0,0.16);
      --shadow-lg: 0 8px 32px rgba(0,0,0,0.48), 0 4px 8px rgba(0,0,0,0.24);
      /* ── Motion ── */
      --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
      --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
      --duration-fast: 0.15s;
      --duration-normal: 0.25s;
      --duration-slow: 0.4s;
      /* ── Surface glass ── */
      --surface-glass: rgba(30, 33, 51, 0.85);
      /* ── Border card ── */
      --border-card: rgba(58, 63, 92, 0.6);
      /* ── Accent glow ── */
      --accent-glow: rgba(96, 165, 250, 0.15);
      /* ── Line-height ── */
      --lh-tight: 1.3;
      --lh-normal: 1.5;
      --lh-relaxed: 1.7;
    }

    /* ── Light theme overrides ── */
    html.light {
      --bg:           #f0f2fa;
      --surface:      #ffffff;
      --surface-hi:   #e8eaf4;
      --surface-lo:   #f5f6fc;
      --border:       #c8cce0;
      --border-sub:   #dddff0;
      --text:         #1a1d2e;
      --text-2:       #3d4570;
      --text-3:       #5c6490;
      --text-hint:    #7a84aa;
      --purple:       #2563eb;   /* accent — darker blue, readable on white */
      --purple-dim:   #93c5fd;   /* accent dim — light blue border */
      --active-bg:    #dbeafe;   /* active element bg — light blue */
      --active-text:  #1d4ed8;   /* text on active bg — dark blue */
      --hover-green:  #dcfce7;
      --hover-red:    #fee2e2;
      --hover-blue:   #e0f2fe;
      --hover-amber:  #fef3c7;
      --hover-purple: #eff6ff;   /* accent hover bg — very light blue */
      --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
      --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
      --shadow-lg: 0 8px 32px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
      --surface-glass: rgba(255, 255, 255, 0.85);
      --border-card: rgba(200, 204, 224, 0.6);
    }

    /* ── Size: Small ── */
    html.size-sm {
      --fs-xs: 11px; --fs-sm: 12px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 17px;
      --btn-pad: 5px 10px; --btn-pad-sm: 3px 8px;
    }
    /* ── Size: Large ── */
    html.size-lg {
      --fs-xs: 14px; --fs-sm: 15px; --fs-base: 17px; --fs-md: 18px; --fs-lg: 20px;
      --btn-pad: 7px 15px; --btn-pad-sm: 5px 11px;
    }

    html, body {
      height: 100%;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background: var(--bg);
      color: var(--text);
      font-size: var(--fs-base);
      overflow: hidden;
    }

    .root { display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding: 8px; gap: 8px; box-sizing: border-box; }

    /* ── Header ── */
    header {
      display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
      padding: 12px 16px; background: var(--surface-glass);
      border: 1px solid var(--border); border-radius: var(--radius-md); flex-shrink: 0;
      box-shadow: var(--shadow-sm); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
      position: relative; z-index: 20;
    }
    header h1 { display: flex; align-items: center; gap: 8px; }
    header h1 img { width: 56px; height: 56px; border-radius: var(--radius-md); flex-shrink: 0; }
    .brand-name { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; color: var(--text); line-height: 1; }
    #brand-icon-light { display: none; }
    html.light #brand-icon-dark  { display: none; }
    html.light #brand-icon-light { display: block; }
    #status { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-3); }
    #dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex-shrink: 0; }
    #dot.live { background: var(--green); animation: headerPulse 2.5s ease-in-out infinite; }
    @keyframes blink { 0%,100%{opacity:1} 50%{opacity:.4} }
    @keyframes headerPulse { 0%,100%{box-shadow: 0 0 4px rgba(52,211,153,0.2);} 50%{box-shadow: 0 0 10px rgba(52,211,153,0.5), 0 0 24px rgba(52,211,153,0.15);} }

    .header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
    .btn {
      font-size: var(--fs-sm); font-weight: 500; color: var(--text-2);
      background: var(--surface-hi); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: var(--btn-pad); cursor: pointer;
      transition: color var(--duration-fast), border-color var(--duration-fast), background var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-fast);
    }
    .btn svg { vertical-align: -2px; }
    .btn:hover { color: var(--text); border-color: var(--purple-dim); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
    .btn:active { transform: translateY(0) scale(0.97); transition-duration: 0.05s; }
    .btn.active { color: var(--active-text); border-color: var(--purple-dim); background: var(--active-bg); }
    .capture-on  { color: var(--green); border-color: #1a6648; font-weight: 700; }
    .capture-on:hover  { background: var(--hover-green); border-color: var(--green); }
    .capture-off { color: var(--red);   border-color: #5a2020; font-weight: 700; }
    .capture-off:hover { background: var(--hover-red); border-color: var(--red); }
    .mic-on  { color: var(--purple); border-color: var(--purple-dim); font-weight: 700; }
    .mic-on:hover { background: var(--hover-purple); border-color: var(--purple); }

    /* ── Panels ── */
    .panels { display: flex; gap: 8px; flex: 1; min-height: 0; overflow: hidden; }

    .panel {
      display: flex; flex-direction: column;
      background: var(--surface); border: 1px solid var(--border);
      border-radius: var(--radius-md); overflow: hidden; flex: 1; min-width: 0; min-height: 0;
      max-height: 100%; box-shadow: var(--shadow-sm);
    }
    .panel-header {
      padding: 8px 12px; font-size: var(--fs-xs); font-weight: 600;
      text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3);
      border-bottom: 1px solid var(--border-sub); flex-shrink: 0;
      display: flex; justify-content: space-between; align-items: center;
    }
    .active-meeting-label {
      font-size: var(--fs-xs); font-weight: 500; color: var(--text-3);
      text-transform: none; letter-spacing: 0; max-width: 180px;
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
      cursor: pointer; transition: color 0.15s;
    }
    .active-meeting-label:hover { color: var(--text); }
    .count-badge {
      background: var(--surface-hi); color: var(--text-2);
      font-size: var(--fs-xs); font-weight: 600; border-radius: 10px; padding: 2px 8px;
    }
    .panel-body { flex: 1; overflow-y: auto; padding: 12px; min-height: 0; overscroll-behavior: contain; }
    .panel-body::-webkit-scrollbar { width: 6px; }
    .panel-body::-webkit-scrollbar-track { background: transparent; }
    .panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
    .panel-body::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
    .empty-hint { color: var(--text-hint); font-size: var(--fs-base); text-align: center; margin-top: 40px; line-height: 1.6; }

    /* Hide empty hint when there are bubbles or thread headers */
    .panel-body > .bubble ~ .empty-hint,
    .panel-body > .thread-header ~ .empty-hint { display: none; }

    @keyframes spin { to { transform: rotate(360deg); } }
    .bubble.kb-known { border-color: #a78bfa; border-width: 2px; box-shadow: 0 0 8px rgba(167, 139, 250, 0.35); }
    .kb-hint { font-size: var(--fs-xs); color: #a78bfa; opacity: 0.8; margin-left: auto; white-space: nowrap; }
    .boundary-card {
      background: var(--card-bg); border: 1.5px dashed var(--border); border-radius: 12px;
      padding: 14px 16px; margin-bottom: 10px; text-align: center; cursor: pointer;
    }
    .boundary-card .boundary-title { font-weight: 600; font-size: var(--fs-sm); color: var(--text-1); margin-bottom: 4px; }
    .boundary-card .boundary-context { font-size: var(--fs-xs); color: var(--text-3); font-style: italic; }
    .boundary-card .boundary-hint { font-size: var(--fs-xs); color: var(--text-hint); margin-top: 6px; }

    /* ── Panel tab toggle ── */
    .panel-tabs { display: flex; gap: 2px; }
    .tab-btn {
      font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px;
      color: var(--text-3); background: none; border: none; padding: 4px 8px; cursor: pointer;
      border-radius: var(--radius-sm); display: flex; align-items: center; gap: 4px;
      transition: color var(--duration-fast), background var(--duration-fast);
    }
    .tab-btn:hover { color: var(--text-2); background: var(--surface-hi); }
    .tab-btn.active { color: var(--active-text); background: var(--active-bg); }
    .tab-count {
      background: var(--surface-hi); color: var(--text-2); font-size: var(--fs-xs);
      border-radius: 8px; padding: 0 5px; min-width: 16px; text-align: center;
    }
    .tab-btn.active .tab-count { background: var(--active-bg); color: var(--active-text); }

    /* ── Thought Bubbles ── */
    .bubble {
      margin-bottom: 8px; border-radius: var(--radius-md);
      border: 1px solid var(--border-card); background: var(--surface-lo);
      overflow: hidden; box-shadow: var(--shadow-sm);
      transition: border-color var(--duration-fast), box-shadow var(--duration-normal), opacity 0.35s, transform 0.35s;
      animation: popIn 0.35s var(--ease-out);
    }
    @keyframes popIn {
      from { opacity: 0; transform: scale(0.96) translateY(-4px); }
      to   { opacity: 1; transform: scale(1) translateY(0); }
    }
    .bubble.dismissing { opacity: 0; transform: scale(0.96) translateY(-6px); pointer-events: none; }
    .bubble:hover { border-color: var(--purple-dim); box-shadow: var(--shadow-md); }
    .bubble.open  { border-color: var(--purple-dim); background: var(--surface-hi); box-shadow: var(--shadow-md); }

    .bubble-head {
      display: flex; align-items: center; gap: 8px;
      padding: 10px 12px; cursor: pointer; user-select: none;
    }
    .bubble-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .bubble-term { font-weight: 600; font-size: var(--fs-md); color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .bubble-badge {
      font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase;
      letter-spacing: 0.5px; padding: 2px 8px; border-radius: 10px; flex-shrink: 0;
    }
    .bubble-latency {
      font-size: 10px; color: var(--text-3); opacity: 0.6; flex-shrink: 0;
      font-variant-numeric: tabular-nums;
    }
    .bubble-chevron { font-size: var(--fs-xs); color: var(--text-3); flex-shrink: 0; transition: transform 0.2s; }
    .bubble.open .bubble-chevron { transform: rotate(180deg); }

    /* Draining timer bar */
    .bubble-timer { height: 3px; overflow: hidden; background: var(--border-sub); }
    .bubble-timer-bar {
      height: 100%; width: 100%; background: linear-gradient(90deg, var(--purple-dim), var(--purple));
      transform-origin: left; animation: drain 15s linear forwards;
    }
    @keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

    /* Expanded body */
    .bubble-body { display: none; padding: 0 12px 12px; border-top: 1px solid var(--border-sub); }
    .bubble.open .bubble-body { display: block; }
    .bubble-context { font-size: var(--fs-sm); color: var(--text-2); line-height: var(--lh-normal); padding-top: 8px; margin-bottom: 8px; }

    .bubble-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; margin-top: 8px; }
    .dismiss-btn {
      width: 28px; height: 28px; border-radius: 50%;
      font-size: 17px; font-weight: 700; line-height: 1;
      display: flex; align-items: center; justify-content: center;
      border: 1px solid var(--border); background: var(--surface-hi);
      cursor: pointer; flex-shrink: 0;
      transition: background var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-fast);
      color: var(--red);
    }
    .dismiss-btn:hover { background: var(--hover-red); border-color: var(--red); transform: scale(1.1); box-shadow: 0 0 12px rgba(248,113,113,0.25); }
    .dismiss-btn:active { transform: scale(0.95); }

    .lookup-btn {
      display: inline-flex; align-items: center; gap: 5px;
      font-size: var(--fs-sm); font-weight: 500; padding: var(--btn-pad); border-radius: var(--radius-sm);
      border: 1px solid var(--border); background: var(--surface-hi);
      color: var(--purple); cursor: pointer;
      transition: background var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast);
    }
    .lookup-btn:hover { background: var(--active-bg); border-color: var(--purple-dim); }
    .lookup-btn:disabled { opacity: 0.45; cursor: default; }
    .lookup-btn .spinner {
      width: 10px; height: 10px;
      border: 2px solid #a78bfa55; border-top-color: var(--purple);
      border-radius: 50%; animation: spin 0.6s linear infinite; display: none;
    }
    .lookup-btn.loading .spinner { display: block; }
    .lookup-btn.loading .btn-label { display: none; }
    @keyframes spin { to { transform: rotate(360deg); } }

    .lookup-result {
      display: none; margin-top: 8px;
      font-size: var(--fs-base); line-height: 1.65; color: var(--text-2);
      padding: 10px 12px; background: var(--surface);
      border-radius: var(--radius-sm); border-left: 3px solid var(--purple-dim);
    }
    .lookup-result.visible { display: block; }
    .lookup-result strong { color: var(--text); display: block; margin-bottom: 3px; margin-top: 10px; }
    .lookup-result strong:first-child { margin-top: 0; }
    .retry-link { color: var(--purple); font-weight: 600; text-decoration: underline; cursor: pointer; margin-left: 4px; }
    .fallback-notice { font-size: 11px; color: var(--text-3); font-style: italic; margin-bottom: 6px; }

    /* Category theming */
    .bubble-technologies       .bubble-dot { background: var(--c-tech); }
    .bubble-technologies       .bubble-badge,
    .badge-technologies        { background: #1e3a5c; color: #7cb9ff; }
    .bubble-business_metrics   .bubble-dot { background: var(--c-metric); }
    .bubble-business_metrics   .bubble-badge,
    .badge-business_metrics    { background: #1a3d2e; color: #6ee7b7; }
    .bubble-compliance_risk    .bubble-dot { background: var(--c-compliance); }
    .bubble-compliance_risk    .bubble-badge,
    .badge-compliance_risk     { background: #3d1e1e; color: #fca5a5; }
    .bubble-companies_products .bubble-dot { background: var(--c-company); }
    .bubble-companies_products .bubble-badge,
    .badge-companies_products  { background: #3a2d14; color: #fcd34d; }
    .bubble-strategic_concepts .bubble-dot { background: var(--c-strategy); }
    .bubble-strategic_concepts .bubble-badge,
    .badge-strategic_concepts  { background: #2d1f45; color: #c4b5fd; }
    .bubble-concepts           .bubble-dot { background: var(--c-strategy); }
    .bubble-concepts           .bubble-badge,
    .badge-concepts            { background: #2d1f45; color: #c4b5fd; }
    .bubble-people_references  .bubble-dot { background: var(--c-metric); }
    .bubble-people_references  .bubble-badge,
    .badge-people_references   { background: #1a3d2e; color: #6ee7b7; }
    .bubble-key_numbers        .bubble-dot { background: var(--c-number); }
    .bubble-key_numbers        .bubble-badge,
    .badge-key_numbers         { background: #163040; color: #67e8f9; }

    /* Light mode badge overrides */
    html.light .bubble-technologies       .bubble-badge,
    html.light .badge-technologies        { background: #dbeafe; color: #1d4ed8; }
    html.light .bubble-business_metrics   .bubble-badge,
    html.light .badge-business_metrics    { background: #dcfce7; color: #15803d; }
    html.light .bubble-compliance_risk    .bubble-badge,
    html.light .badge-compliance_risk     { background: #fee2e2; color: #b91c1c; }
    html.light .bubble-companies_products .bubble-badge,
    html.light .badge-companies_products  { background: #fef3c7; color: #92400e; }
    html.light .bubble-strategic_concepts .bubble-badge,
    html.light .badge-strategic_concepts  { background: #ede9fe; color: #6d28d9; }
    html.light .bubble-concepts           .bubble-badge,
    html.light .badge-concepts            { background: #ede9fe; color: #6d28d9; }
    html.light .bubble-people_references  .bubble-badge,
    html.light .badge-people_references   { background: #dcfce7; color: #15803d; }
    html.light .bubble-key_numbers        .bubble-badge,
    html.light .badge-key_numbers         { background: #e0f2fe; color: #0369a1; }

    /* ── Thread Headers ── */
    .thread-header {
      font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
      letter-spacing: 0.6px; color: var(--text-3);
      padding: 10px 4px 4px; margin-top: 2px;
      border-top: 1px solid var(--border);
    }
    .thread-header:first-child { border-top: none; padding-top: 2px; }

    /* ── History Items ── */
    .history-item {
      display: flex; align-items: flex-start; gap: 8px;
      padding: 8px 12px; border-radius: var(--radius-sm);
      border: 1px solid var(--border-sub); background: var(--surface-lo);
      margin-bottom: 8px; animation: popIn 0.2s var(--ease-out);
    }
    .history-item.already-kept { opacity: 0.4; }
    .history-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }
    .history-info { flex: 1; min-width: 0; }
    .history-term { font-size: var(--fs-base); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .history-context { font-size: var(--fs-xs); color: var(--text-2); line-height: 1.4; margin-top: 2px; }
    .history-badge {
      font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase;
      letter-spacing: 0.5px; padding: 2px 8px; border-radius: var(--radius-sm);
      flex-shrink: 0; margin-top: 1px;
    }
    .history-keep-btn {
      width: 22px; height: 22px; border-radius: 50%;
      font-size: 15px; font-weight: 700; line-height: 1;
      display: flex; align-items: center; justify-content: center;
      border: 1px solid #1a6648; background: var(--surface-hi);
      color: var(--green); cursor: pointer; flex-shrink: 0;
      transition: background 0.15s;
    }
    .history-keep-btn:hover { background: var(--hover-green); }
    .history-keep-btn:disabled { opacity: 0.5; cursor: default; font-size: var(--fs-sm); }

    /* ── Kept Panel ── */
    .kept-item {
      display: flex; align-items: flex-start; gap: 8px;
      padding: 12px; border-radius: var(--radius-md);
      border: 1px solid var(--border-card); background: var(--surface-lo);
      margin-bottom: 8px;
    }
    .kept-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
    .kept-info { flex: 1; min-width: 0; }
    .kept-term {
      font-weight: 600; font-size: var(--fs-md); color: var(--text); cursor: pointer; user-select: none;
      display: flex; align-items: center; gap: 4px;
    }
    .kept-thread { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 3px; cursor: pointer; }
    .kept-term-text { flex: 1; min-width: 0; }
    .kept-chevron { font-size: var(--fs-xs); color: var(--text-3); transition: transform 0.2s; flex-shrink: 0; }
    .kept-item.collapsed .kept-chevron { transform: rotate(-90deg); }
    .kept-badge {
      font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase;
      letter-spacing: 0.5px; padding: 2px 8px; border-radius: var(--radius-sm); margin-left: 4px; flex-shrink: 0;
    }
    .kept-context { font-size: var(--fs-sm); color: var(--text-2); line-height: var(--lh-normal); margin-top: 4px; }
    .kept-explanation {
      display: none;
      font-size: var(--fs-base); color: var(--text-2); line-height: 1.65;
      margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-sub);
    }
    .kept-explanation.visible { display: block; }
    .kept-explanation strong { color: var(--text); display: block; margin-bottom: 3px; margin-top: 10px; }
    .kept-explanation strong:first-child { margin-top: 0; }
    .kept-item.collapsed .kept-context,
    .kept-item.collapsed .kept-explanation,
    .kept-item.collapsed .kept-actions { display: none !important; }
    .kept-remove { color: var(--text-3); cursor: pointer; flex-shrink: 0; line-height: 1; padding: 2px 4px; border-radius: var(--radius-sm); opacity: 0.35; display: flex; align-items: center; transition: opacity var(--duration-fast), color var(--duration-fast); }
    .kept-remove:hover { opacity: 0.9; color: var(--red); background: var(--hover-red); }

    /* Kept action buttons */
    .kept-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
    .kept-lookup-btn {
      display: inline-flex; align-items: center; gap: 4px;
      font-size: var(--fs-sm); font-weight: 500; padding: var(--btn-pad); border-radius: var(--radius-sm);
      border: 1px solid var(--border); background: var(--surface-hi); cursor: pointer;
      transition: background 0.15s, border-color 0.15s; color: var(--purple);
    }
    .kept-lookup-btn:hover { background: var(--active-bg); border-color: var(--purple-dim); }
    .kept-lookup-btn:disabled { opacity: 0.4; cursor: default; }
    .kept-lookup-btn .spinner {
      width: 9px; height: 9px;
      border: 2px solid currentColor; border-top-color: transparent;
      border-radius: 50%; animation: spin 0.6s linear infinite; display: none;
    }
    .kept-lookup-btn.loading .spinner { display: block; }
    .kept-lookup-btn.loading .btn-label { display: none; }

    /* ── Context Panel ── */
    #context-panel {
      display: none; flex-direction: column; gap: 16px;
      background: var(--surface); border: 1px solid var(--border);
      border-radius: var(--radius-md); padding: 16px; flex-shrink: 0;
      box-shadow: var(--shadow-sm);
    }
    #context-panel.open { display: flex; }
    /* context-btn active state removed — controls moved to hamburger menu */

    /* ── Meeting list ── */
    .meeting-list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
    .meeting-list-header h3 { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-3); margin: 0; }
    #meeting-items { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; }
    .meeting-row {
      display: flex; align-items: center; justify-content: space-between;
      padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer;
      border: 1px solid var(--border-sub); background: var(--surface-lo);
      transition: border-color var(--duration-fast), background var(--duration-fast);
    }
    .meeting-row:hover { border-color: var(--purple-dim); background: var(--surface-hi); }
    .meeting-row.active { border-color: var(--purple-dim); background: var(--surface-hi); }
    .meeting-list-divider { border: none; border-top: 1px solid var(--border-sub); margin: 10px 0 6px; }
    .meeting-row-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .meeting-row-date { font-size: var(--fs-xs); color: var(--text-3); flex-shrink: 0; margin-left: 8px; }
    .meeting-empty { font-size: var(--fs-sm); color: var(--text-3); text-align: center; padding: 16px 0; }

    /* ── Context mode header (back + title + delete) ── */
    .ctx-mode-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
    .ctx-back-btn {
      font-size: var(--fs-sm); color: var(--text-3); background: none; border: none;
      cursor: pointer; padding: 2px 4px; transition: color 0.15s;
    }
    .ctx-back-btn:hover { color: var(--text); }
    .ctx-mode-title { font-size: var(--fs-md); font-weight: 600; color: var(--text); flex: 1; min-width: 0; }
    .ctx-mode-title input {
      font-size: var(--fs-md); font-weight: 600; color: var(--text); background: transparent;
      border: none; border-bottom: 1px dashed var(--border); outline: none; width: 100%;
      padding: 0 0 2px 0; font-family: inherit;
    }
    .ctx-mode-title input:focus { border-bottom-color: var(--purple-dim); }
    .ctx-mode-delete {
      font-size: var(--fs-xs); color: var(--red); background: none; border: none;
      cursor: pointer; padding: 2px 6px; opacity: 0.7; transition: opacity 0.15s;
    }
    .ctx-mode-delete:hover { opacity: 1; }

    /* Long-press visual feedback */
    .cat-btn.pressing { transform: scale(0.95); opacity: 0.7; transition: transform 0.15s, opacity 0.15s; }
    .cat-btn.loaded { opacity: 0.5; }
    .cat-btn.loaded::after { content: " ✓"; }
    #context-textarea {
      width: 100%; min-height: 72px; max-height: 150px; resize: vertical; box-sizing: border-box;
      background: var(--surface-lo); border: 1px solid var(--border); border-radius: var(--radius-sm);
      color: var(--text); font-size: var(--fs-base); line-height: var(--lh-normal); padding: 8px 12px; font-family: inherit;
    }
    #vocab-input {
      width: 100%; box-sizing: border-box;
      background: var(--surface-lo); border: 1px solid var(--border); border-radius: var(--radius-sm);
      color: var(--text); font-size: var(--fs-base); padding: 8px 12px; font-family: inherit;
    }
    #vocab-input:focus { outline: none; border-color: var(--purple-dim); box-shadow: 0 0 0 3px var(--accent-glow); }
    #vocab-input::placeholder { color: var(--text-3); }
    .ctx-field-label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); margin-bottom: 6px; margin-top: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
    .ctx-field-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-3); }
    #context-textarea:focus { outline: none; border-color: var(--purple-dim); box-shadow: 0 0 0 3px var(--accent-glow); }
    #context-textarea::placeholder { color: var(--text-3); }
    .context-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
    .context-file-btn {
      font-size: var(--fs-sm); font-weight: 500; padding: var(--btn-pad);
      background: var(--surface-hi); border: 1px solid var(--border);
      border-radius: var(--radius-sm); color: var(--text-2); cursor: pointer;
      transition: border-color var(--duration-fast), color var(--duration-fast);
    }
    .context-file-btn:hover { border-color: var(--purple-dim); color: var(--text); }
    #context-char-count { font-size: var(--fs-sm); color: var(--text-3); transition: color 0.2s; }
    #context-char-count.warn { color: #d97706; }
    #context-char-count.over { color: var(--red); }
    #context-saved { font-size: var(--fs-sm); color: var(--green); display: none; }
    #context-saved.visible { display: inline; }

    /* Toolbar status indicator */
    .toolbar-status { display: flex; align-items: center; gap: 8px; }
    .toolbar-dot {
      width: 10px; height: 10px; border-radius: 50%; background: var(--text-3);
      display: inline-block; flex-shrink: 0;
    }
    .toolbar-dot.listening { background: var(--green); animation: breathe 3s ease-in-out infinite; }
    .toolbar-dot.paused    { background: var(--amber); }
    .toolbar-label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-3); }
    .toolbar-dot.listening + .toolbar-label { color: var(--green); }
    .toolbar-dot.paused + .toolbar-label    { color: var(--amber); }

    /* Hamburger menu */
    .hamburger-wrap { position: relative; }
    .hamburger-menu {
      position: absolute; top: calc(100% + 6px); right: 0; min-width: 200px;
      background: var(--surface-glass); border: 1px solid var(--border);
      border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
      backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
      z-index: 300; display: none; flex-direction: column; padding: 4px 0;
    }
    .hamburger-menu.open { display: flex; }
    .hm-item {
      display: flex; align-items: center; gap: 10px; width: 100%;
      padding: 10px 16px; border: none; background: none; cursor: pointer;
      font-size: var(--fs-sm); font-weight: 500; color: var(--text-2);
      text-align: left; transition: background var(--duration-fast), color var(--duration-fast);
    }
    .hm-item:hover { background: var(--hover-purple); color: var(--text); }
    .hm-item svg { flex-shrink: 0; }
    .hm-divider { height: 1px; background: var(--border); margin: 4px 12px; }
    .hm-about { color: var(--text-3); cursor: default; font-size: var(--fs-xs); }
    .hm-about:hover { background: none; color: var(--text-3); }

    /* Reset confirmation modal */
    .modal-overlay {
      position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 400;
      display: none; align-items: center; justify-content: center;
      backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    }
    .modal-overlay.open { display: flex; }
    .modal-box {
      background: var(--surface-glass); border: 1px solid var(--border);
      border-radius: var(--radius-lg); padding: 24px; max-width: 380px; width: 90%;
      box-shadow: var(--shadow-lg);
      backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    }
    .modal-box h3 { margin: 0 0 8px; font-size: 18px; font-weight: 600; color: var(--text); }
    .modal-box p  { margin: 0 0 20px; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.5; }
    .modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
    .modal-danger { color: #fff !important; background: var(--red) !important; border-color: var(--red) !important; }
    .modal-danger:hover { background: #991b1b !important; }

    /* Feedback modal */
    .fb-type-group { display: flex; gap: 6px; margin-bottom: 14px; }
    .fb-type-btn { flex: 1; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius);
      background: transparent; color: var(--text-2); font-size: var(--fs-sm); cursor: pointer; text-align: center; }
    .fb-type-btn.active { border-color: var(--purple); color: var(--purple); background: rgba(167,139,250,0.1); }
    html.light .fb-type-btn.active { background: rgba(37,99,235,0.08); }
    .fb-textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
      color: var(--text); padding: 10px; font-size: var(--fs-sm); resize: vertical; font-family: inherit; }
    .fb-textarea:focus { outline: none; border-color: var(--accent); }
    .fb-stars { display: flex; gap: 4px; margin: 12px 0; align-items: center; }
    .fb-stars .star { font-size: 22px; cursor: pointer; color: var(--border); transition: color 0.15s; }
    .fb-stars .star.lit { color: #fbbf24; }
    .fb-stars label { font-size: var(--fs-sm); color: var(--text-2); margin-right: 8px; }
    .fb-send { width: 100%; padding: 10px; border: none; border-radius: var(--radius); background: var(--purple);
      color: #fff; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; margin-top: 12px; }
    .fb-send:disabled { opacity: 0.4; cursor: not-allowed; }
    .fb-send:not(:disabled):hover { filter: brightness(1.1); }
    .fb-success { text-align: center; padding: 24px 0; }
    .fb-success svg { color: var(--green); margin-bottom: 8px; }
    .fb-success p { color: var(--text-2); font-size: var(--fs-sm); }

    /* Settings panel (slide-in drawer from right) */
    #settings-panel {
      position: fixed; top: 0; right: 0; bottom: 0; width: 320px;
      background: var(--surface-glass); border-left: 1px solid var(--border);
      z-index: 200; display: flex; flex-direction: column; overflow-y: auto;
      box-shadow: var(--shadow-lg);
      border-radius: var(--radius-lg) 0 0 var(--radius-lg);
      backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
      transform: translateX(100%); transition: transform var(--duration-normal) var(--ease-out);
      pointer-events: none;
    }
    #settings-panel.open { transform: translateX(0); pointer-events: auto; }
    .settings-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
    .settings-header h2 { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
    .settings-close { background: none; border: none; color: var(--text-3); font-size: 18px; cursor: pointer; line-height: 1; transition: color var(--duration-fast); }
    .settings-close:hover { color: var(--text); }
    .settings-section { border-bottom: 1px solid var(--border-sub); }
    .settings-section-hdr { display: flex; align-items: center; padding: 14px 20px; cursor: pointer; gap: 8px; transition: background var(--duration-fast); user-select: none; }
    .settings-section-hdr:hover { background: var(--surface-hi); }
    .settings-section-hdr h3 { flex: 1; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-3); margin: 0; }
    .settings-section-sum { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
    .settings-section-chev { color: var(--text-3); font-size: 10px; transition: transform var(--duration-fast); flex-shrink: 0; }
    .settings-section.expanded .settings-section-chev { transform: rotate(90deg); }
    .settings-section-body { max-height: 0; overflow: hidden; transition: max-height var(--duration-normal) var(--ease-out); padding: 0 20px; }
    .settings-section.expanded .settings-section-body { max-height: 800px; padding: 0 20px 16px; }
    .cat-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
    .cat-btn { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); background: var(--surface-hi); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--btn-pad); cursor: pointer; transition: all var(--duration-fast); }
    .cat-btn:hover { border-color: var(--purple-dim); color: var(--text); }
    .cat-btn.active { color: var(--active-text); border-color: var(--purple-dim); background: var(--active-bg); }
    .cat-btn.cat-default { color: var(--text-3); }
    .cat-btn.cat-edited { border-style: dashed; }
    .cat-btn.cat-custom { font-style: italic; }
    .ctx-action-btn { font-size: var(--fs-xs) !important; padding: var(--btn-pad-sm) !important; }
    .ctx-delete-btn { color: var(--red) !important; }
    #cat-add-form { margin-top: 10px; display: none; flex-direction: column; gap: 6px; }
    #cat-add-form.open { display: flex; }
    #cat-add-form input, #cat-add-form textarea { background: var(--surface-lo); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: var(--fs-sm); padding: 6px 8px; resize: vertical; }
    #cat-add-form textarea { min-height: 60px; }
    .settings-select { width: 100%; background: var(--surface-lo); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: var(--fs-sm); padding: 6px 8px; margin-top: 4px; }
    .settings-label { font-size: var(--fs-sm); color: var(--text-2); margin-bottom: 4px; display: block; }
    .settings-note { font-size: var(--fs-xs); color: var(--text-3); margin-top: 6px; }
    .hf-model-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: var(--fs-sm); color: var(--text-2); border: 1px solid transparent; transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease; }
    .hf-model-item:hover { background: var(--surface-lo); }
    .hf-model-item.active { border-color: var(--purple-dim); background: rgba(167,139,250,0.08); color: var(--text); }
    .hf-model-item .hf-model-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .hf-model-item .hf-model-size { font-size: var(--fs-xs); color: var(--text-3); flex-shrink: 0; }
    .hf-model-item .hf-model-delete { color: var(--text-3); cursor: pointer; opacity: 0; transition: opacity var(--duration-fast) ease, color var(--duration-fast) ease; flex-shrink: 0; padding: 2px; }
    .hf-model-item:hover .hf-model-delete { opacity: 1; }
    .hf-model-item .hf-model-delete:hover { color: var(--red); }
    .settings-range-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
    .settings-range-row input[type="range"] { flex: 1; accent-color: var(--purple); }
    .settings-range-val { font-size: var(--fs-sm); font-weight: 600; color: var(--text); min-width: 28px; text-align: right; }
    .engine-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-top: 6px; }
    .engine-btn { flex: 1; font-size: var(--fs-sm); font-weight: 500; color: var(--text-3); background: var(--surface-hi); border: none; padding: 6px; cursor: pointer; transition: all var(--duration-fast); }
    .engine-btn + .engine-btn { border-left: 1px solid var(--border); }
    .engine-btn.active { color: var(--active-text); background: var(--active-bg); }
    #settings-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 199; opacity: 0; pointer-events: none; transition: opacity var(--duration-normal) var(--ease-in-out); }
    #settings-overlay.open { opacity: 1; pointer-events: auto; }

    /* Help panel */
    #help-panel {
      position: fixed; top: 0; right: 0; bottom: 0; width: 360px;
      background: var(--surface-glass); border-left: 1px solid var(--border);
      z-index: 200; display: flex; flex-direction: column;
      box-shadow: var(--shadow-lg);
      border-radius: var(--radius-lg) 0 0 var(--radius-lg);
      backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
      transform: translateX(100%); transition: transform var(--duration-normal) var(--ease-out);
      pointer-events: none;
    }
    #help-panel.open { transform: translateX(0); pointer-events: auto; }
    .help-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
    .help-header h2 { font-size: var(--fs-md); font-weight: 600; color: var(--text); margin: 0; }
    .help-header-left { display: flex; align-items: center; gap: 10px; }
    .help-new-chat { background: none; border: 1px solid var(--border-sub); border-radius: var(--radius-sm); padding: 5px 6px; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; opacity: 0.3; pointer-events: none; transition: border-color var(--duration-fast), color var(--duration-fast), opacity var(--duration-fast); }
    .help-new-chat.active { opacity: 1; pointer-events: auto; }
    .help-new-chat.active:hover { border-color: var(--purple); color: var(--text); }
    .help-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
    .help-msg { max-width: 85%; padding: 10px 14px; border-radius: var(--radius-md); font-size: var(--fs-sm); line-height: 1.5; }
    .help-msg.user { align-self: flex-end; background: var(--purple); color: #fff; border-bottom-right-radius: 4px; }
    .help-msg.assistant { align-self: flex-start; background: var(--surface-hi); color: var(--text); border-bottom-left-radius: 4px; }
    .help-msg.assistant p { margin: 0 0 8px 0; }
    .help-msg.assistant p:last-child { margin-bottom: 0; }
    .help-msg.assistant strong { color: var(--text); }
    .help-msg.assistant ol, .help-msg.assistant ul { margin: 4px 0; padding-left: 20px; }
    .help-msg.assistant li { margin: 2px 0; }
    .help-msg.assistant code { background: var(--surface); padding: 1px 4px; border-radius: 3px; font-size: 0.9em; }
    .help-msg.assistant h2, .help-msg.assistant h3, .help-msg.assistant h4 { font-size: var(--fs-sm); font-weight: 600; color: var(--text); margin: 10px 0 4px 0; }
    .help-msg.assistant h2:first-child, .help-msg.assistant h3:first-child { margin-top: 0; }
    .help-msg.assistant blockquote { border-left: 2px solid var(--purple); padding-left: 10px; margin: 6px 0; color: var(--text-2); font-style: italic; }
    .help-msg.assistant hr { border: none; border-top: 1px solid var(--border-sub); margin: 8px 0; }
    .help-suggestions { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
    .help-suggestion { background: var(--surface); border: 1px solid var(--border-sub); border-radius: var(--radius-md); padding: 10px 14px; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; text-align: left; transition: background var(--duration-fast), border-color var(--duration-fast); }
    .help-suggestion:hover { background: var(--surface-hi); border-color: var(--purple); color: var(--text); }
    .help-guide-btn { display: flex; align-items: center; gap: 10px; background: var(--purple); color: #fff; border-radius: var(--radius-md); padding: 12px 16px; font-size: var(--fs-sm); font-weight: 600; text-decoration: none; transition: opacity var(--duration-fast); }
    .help-guide-btn:hover { opacity: 0.85; }
    .help-input-row { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
    .help-input-row input { flex: 1; background: var(--surface); border: 1px solid var(--border-sub); border-radius: var(--radius-md); padding: 10px 14px; color: var(--text); font-size: var(--fs-sm); outline: none; }
    .help-input-row input:focus { border-color: var(--purple); }
    .help-input-row input::placeholder { color: var(--text-hint); }
    .help-send-btn { background: var(--purple); color: #fff; border: none; border-radius: var(--radius-md); padding: 10px 16px; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; transition: opacity var(--duration-fast); }
    .help-send-btn:hover { opacity: 0.85; }
    .help-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
    .help-typing { align-self: flex-start; color: var(--text-3); font-size: var(--fs-xs); padding: 8px 14px; }
    #help-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 199; opacity: 0; pointer-events: none; transition: opacity var(--duration-normal) var(--ease-in-out); }
    #help-overlay.open { opacity: 1; pointer-events: auto; }

    /* ── Dashboard panel ── */
    #dashboard-panel {
      position: fixed; top: 0; right: 0; bottom: 0; width: 360px;
      background: var(--surface-glass); border-left: 1px solid var(--border);
      z-index: 200; display: flex; flex-direction: column; overflow-y: auto;
      box-shadow: var(--shadow-lg);
      border-radius: var(--radius-lg) 0 0 var(--radius-lg);
      backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
      transform: translateX(100%); transition: transform var(--duration-normal) var(--ease-out);
      pointer-events: none;
    }
    #dashboard-panel.open { transform: translateX(0); pointer-events: auto; }
    #dashboard-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 199; opacity: 0; pointer-events: none; transition: opacity var(--duration-normal) var(--ease-in-out); }
    #dashboard-overlay.open { opacity: 1; pointer-events: auto; }
    .dash-section { padding: 14px 20px; border-bottom: 1px solid var(--border-sub); }
    .dash-section:last-child { border-bottom: none; }
    .dash-section h3 { font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 10px 0; }
    .dash-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: var(--fs-sm); }
    .dash-label { color: var(--text-2); }
    .dash-value { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
    .dash-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
    .dash-pill { font-size: var(--fs-xs); padding: 2px 8px; border-radius: 10px; font-weight: 500; }
    .dash-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

    /* Account overlay — forced modal */

    /* Apple-style toggle switch */
    .apple-toggle { position: relative; display: inline-block; width: 42px; height: 26px; cursor: pointer; }
    .apple-toggle input { opacity: 0; width: 0; height: 0; }
    .apple-toggle .track { position: absolute; inset: 0; background: var(--border); border-radius: 13px; transition: background .25s; }
    .apple-toggle input:checked + .track { background: #34c759; }
    .apple-toggle .knob { position: absolute; left: 2px; top: 2px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: transform .25s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
    .apple-toggle input:checked ~ .knob { transform: translateX(16px); }

    /* Context mic button */
    .ctx-mic-btn { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); background: var(--surface-hi); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--btn-pad); cursor: pointer; transition: all var(--duration-fast); margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; }
    .ctx-mic-btn svg, .context-file-btn svg, .ctx-back-btn svg { vertical-align: -2px; }
    .ctx-mic-btn.recording { color: var(--red); border-color: var(--red); animation: blink 1s infinite; }
    .ctx-mic-status { font-size: var(--fs-xs); color: var(--text-3); margin-left: 6px; }

    /* ── Bubble Edit Form ── */
    .bubble-edit-btn {
      margin-left: auto; width: 20px; height: 20px; padding: 0; flex-shrink: 0;
      background: transparent; border: none; color: var(--border); cursor: pointer;
      font-size: var(--fs-base); border-radius: 4px; line-height: 1;
      display: flex; align-items: center; justify-content: center;
      transition: color 0.15s, background 0.15s;
    }
    .bubble:hover .bubble-edit-btn { color: var(--text-3); }
    .bubble-edit-btn:hover { color: var(--text-2) !important; background: var(--surface-hi); }
    .bubble-edit-form {
      display: none; flex-direction: column; gap: 8px;
      padding: 10px 12px; background: var(--surface-lo); border-top: 1px solid var(--border-sub);
    }
    .bubble-edit-form.open { display: flex; }
    .bubble-edit-input {
      background: var(--surface-hi); border: 1px solid var(--border); border-radius: var(--radius-sm);
      color: var(--text); font-size: var(--fs-base); padding: 6px 10px; width: 100%; box-sizing: border-box;
    }
    .bubble-edit-input:focus { outline: none; border-color: var(--purple-dim); box-shadow: 0 0 0 3px var(--accent-glow); }
    .bubble-edit-row { display: flex; gap: 8px; align-items: center; }
    .bubble-edit-select {
      flex: 1; background: var(--surface-hi); border: 1px solid var(--border); border-radius: var(--radius-sm);
      color: var(--text-2); font-size: var(--fs-sm); padding: 6px 8px;
    }
    .bubble-edit-save {
      font-size: var(--fs-sm); font-weight: 500; padding: var(--btn-pad); border-radius: var(--radius-sm);
      background: var(--active-bg); border: 1px solid var(--purple-dim); color: var(--purple); cursor: pointer;
    }
    .bubble-edit-save:hover { background: var(--hover-purple); }
    .bubble-edit-cancel {
      font-size: var(--fs-sm); padding: var(--btn-pad); border-radius: var(--radius-sm);
      background: var(--surface-hi); border: 1px solid var(--border); color: var(--text-3); cursor: pointer;
    }
    .bubble-edit-cancel:hover { color: var(--text-2); border-color: var(--border); }

    /* ── Questions panel ── */
    .questions-expand-hint { display: none; }
    .questions-clear-btn {
      font-size: var(--fs-xs); color: var(--red); background: none;
      border: 1px solid var(--border); border-radius: var(--radius-sm);
      padding: var(--btn-pad-sm); cursor: pointer;
      transition: background var(--duration-fast), border-color var(--duration-fast);
    }
    .questions-clear-btn:hover { background: color-mix(in srgb, var(--red) 10%, transparent); border-color: var(--red); }
    .question-item {
      display: flex; align-items: flex-start; gap: 8px;
      padding: 8px 10px; margin-bottom: 4px;
      background: var(--surface-lo); border: 1px solid var(--border-card);
      border-radius: var(--radius-sm); font-size: var(--fs-sm);
      line-height: var(--lh-normal); color: var(--text);
      animation: popIn 0.25s var(--ease-out);
      transition: opacity 0.3s, transform 0.3s;
    }
    .question-item.checked { opacity: 0.5; }
    .question-item.checked .question-text { text-decoration: line-through; color: var(--text-3); }
    .question-item input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; cursor: pointer; accent-color: var(--purple); }
    .question-item .question-content { flex: 1; }
    .question-item .question-thread { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 3px; }
    .question-item .question-term { font-size: var(--fs-sm); font-weight: 600; color: var(--text); margin-bottom: 3px; }
    .clickable-question:hover { background: color-mix(in srgb, var(--purple) 12%, transparent); }
    .clickable-question.added { opacity: 0.5; pointer-events: none; }

    /* ── Global polish ── */
    ::selection { background: rgba(96, 165, 250, 0.3); }
    html.light ::selection { background: rgba(37, 99, 235, 0.2); }
    ::placeholder { color: var(--text-3); opacity: 0.7; }
    ::-webkit-scrollbar { width: 6px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
    ::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

    /* ── Panel collapse (mobile only — desktop panels never collapse) ── */

    /* ── Responsive ── */
    .kept-expand-hint { display: none; }

    @media (max-width: 900px) {
      /*
       * Stacked layout: panels fill the screen vertically.
       * Empty panels collapse to header-only; panels with content expand.
       */
      .root { overflow: hidden; }
      .panels { flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }

      .panel {
        flex: 1 1 0; min-height: 0;
        max-height: none;
      }
      .panel.panel-collapsed {
        flex: 0 0 auto; min-height: 0;
      }
      .panel.panel-collapsed .panel-body {
        display: none;
      }
      .panel-header { cursor: pointer; }
      .panel-body {
        flex: 1 1 0; min-height: 0;
        max-height: none;
      }
      .kept-expand-hint { display: inline; }
      .questions-expand-hint { display: inline; }
    }
    @media (max-width: 540px) {
      .root { padding: 4px; gap: 4px; }
      header { padding: 8px 12px; }
      header h1 { font-size: var(--fs-base); }
      .btn { padding: var(--btn-pad-sm); font-size: var(--fs-xs); }
      .panel-header { font-size: var(--fs-xs); }
      .bubble-term { font-size: var(--fs-base); }
    }
    /* ── Splash screen (inside Incoming panel) ── */
    #kp-feed { position: relative; }
    #splash {
      position: absolute; inset: 0; z-index: 10;
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      background: transparent;
      pointer-events: none;
      transition: opacity 0.6s ease-out;
    }
    #splash.fade-out { opacity: 0; }
    #splash-logo-dark, #splash-logo-light { width: 360px; height: 360px; }

    /* Pipeline warmup indicator */
    .pipeline-indicator {
      margin-top: 24px;
      display: flex; flex-direction: column; align-items: center; gap: 10px;
      opacity: 0; animation: pip-fadeIn 0.6s ease-out 0.5s forwards;
    }
    @keyframes pip-fadeIn { to { opacity: 1; } }
    .pipeline-steps { display: flex; align-items: center; }
    .pipeline-step {
      display: flex; align-items: center; gap: 6px;
      opacity: 0.35; transition: opacity 0.4s ease;
    }
    .pipeline-step.active { opacity: 1; }
    .pipeline-step.done   { opacity: 0.6; }
    .pip-dot {
      width: 8px; height: 8px; border-radius: 50%;
      background: var(--text-3, #5c6490);
      transition: background 0.4s, box-shadow 0.4s;
    }
    .pipeline-step.active .pip-dot {
      background: var(--green, #10b981);
      box-shadow: 0 0 8px rgba(16,185,129,0.5);
      animation: pip-pulse 1.2s ease-in-out infinite;
    }
    .pipeline-step.done .pip-dot { background: var(--green, #10b981); }
    @keyframes pip-pulse {
      0%, 100% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.3); opacity: 0.7; }
    }
    .pip-label {
      font-size: 11px; font-weight: 600; color: var(--text-3, #5c6490);
      letter-spacing: 0.3px; transition: color 0.4s;
    }
    .pipeline-step.active .pip-label { color: var(--text, #e0e0e0); }
    .pipeline-connector {
      width: 24px; height: 2px; background: var(--text-3, #5c6490);
      opacity: 0.3; margin: 0 4px;
    }
    .pipeline-status {
      font-size: 12px; color: var(--text-3, #5c6490); letter-spacing: 0.3px;
    }
    #splash-logo-light { display: none; }
    html.light #splash-logo-dark  { display: none; }
    html.light #splash-logo-light { display: block; }
