  /* ── TOKENS ─────────────────────────────────────────────── */
  :root {
    --bg:        #000000;
    --surface:   rgba(28, 28, 30, 0.6);
    --border:    rgba(255, 255, 255, 0.1);
    --accent:    #00ff88;
    --accent2:   #0088ff;
    --warn:      #ff6b35;
    --text:      #ffffff;
    --muted:     #8e8e93;
    --claude:    #D97757;
    --gpt:       #10A37F;
    --gemini:    #8E75FF;
    --grok:      #E11D48;
    --judge:     #ffaa00;
    --radius:    6px;
    --mono:      'Space Mono', monospace;
    --sans:      -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Display", sans-serif;
    --glass:     saturate(180%) blur(20px);
  }
  [data-theme="light"] {
    --bg:      #f5f5f7;
    --surface: rgba(255, 255, 255, 0.7);
    --border:  rgba(0, 0, 0, 0.08);
    --text:    #1d1d1f;
    --muted:   #86868b;
  }

  /* ── RESET ──────────────────────────────────────────────── */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-font-smoothing: antialiased; }
  html, body { height: 100%; }

  body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 53px;
    transition: background 0.3s, color 0.3s;
  }

  /* ── HEADER ─────────────────────────────────────────────── */
  header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 53px;
    z-index: 100;
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .logo {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
    color: var(--text);
  }

  .logo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
    animation: pulse 2s infinite;
  }

  @keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.85); }
  }

  .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  /* user-badge removed in 6.3.4 — privacy concern (email visible on screen is data leakage) */

  .btn-icon {
    background: none;
    border: none;
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: color 0.2s;
    opacity: 0.7;
  }
  .btn-icon:hover { opacity: 1; color: var(--accent); }

  .btn-logout {
    font-family: var(--mono);
    font-size: 0.72rem;
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    display: none;
  }
  .btn-logout:hover { border-color: var(--warn); color: var(--warn); }

  /* ── MAIN LAYOUT ────────────────────────────────────────── */
  main {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem 220px;
    gap: 1.5rem;
  }

  /* ── LOGIN SCREEN ───────────────────────────────────────── */
  #login-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    text-align: center;
    animation: fadeIn 0.5s ease;
    min-height: 60vh;
  }

  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .login-title {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -0.06em;
    line-height: 1;
    color: var(--text);
  }

  .login-sub {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--muted);
    letter-spacing: 0.15em;
    margin-top: 0.25rem;
  }

  .btn-login {
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--surface);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.85rem 2.5rem;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  }
  .btn-login:hover {
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  }

  /* 7.0: Google sign-in button */
  .btn-login-google {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: none;
    color: var(--text-muted, rgba(255,255,255,0.5));
    border: 1px solid var(--border);
    padding: 0.6rem 2rem;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    opacity: 0.75;
  }
  .btn-login-google:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text);
    opacity: 1;
  }

  /* ── CHAT SCREEN ────────────────────────────────────────── */
  #chat-screen { display: none; flex-direction: column; gap: 1.5rem; animation: fadeIn 0.4s ease; }
  #chat-screen.active { display: flex; }

  /* ── MESSAGES ───────────────────────────────────────────── */
  #messages {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-height: 200px;
  }

  /* Empty state shown inside #messages (not the login-screen one) */
  .empty-state {
    margin-top: 20vh;
    text-align: center;
    animation: fadeIn 0.4s ease;
  }
  .empty-state h1 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -0.06em;
    color: var(--text);
  }
  .empty-state p {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--muted);
    margin-top: 0.5rem;
    letter-spacing: 0.15em;
  }

  .msg {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease;
  }

  /* Rolled-up summary of earlier messages */
  .msg-context {
    font-size: 0.8rem;
    color: var(--muted);
    padding: 0.5rem 1rem;
    border-left: 2px solid var(--muted);
    white-space: pre-wrap;
    word-break: break-word;
    font-style: italic;
  }

  /* User question: monospace, left-border in accent, muted */
  .msg-question {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--muted);
    padding-left: 1rem;
    border-left: 2px solid var(--accent);
    white-space: pre-wrap;
    word-break: break-word;
  }

  /* AI answer: glassmorphism card */
  .msg-answer {
    background: var(--surface);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    font-size: 0.95rem;
    line-height: 1.7;
  }

  /* ── MARKDOWN CONTENT ───────────────────────────────────── */
  .msg-answer p { margin: 0 0 0.75rem; }
  .msg-answer p:last-child { margin-bottom: 0; }
  .msg-answer h1, .msg-answer h2, .msg-answer h3,
  .msg-answer h4, .msg-answer h5, .msg-answer h6 {
    font-family: var(--sans);
    font-weight: 700;
    margin: 1rem 0 0.5rem;
    line-height: 1.3;
    color: var(--accent);
  }
  .msg-answer h1 { font-size: 1.3rem; }
  .msg-answer h2 { font-size: 1.15rem; }
  .msg-answer h3 { font-size: 1rem; }
  .msg-answer ul, .msg-answer ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0 0.75rem;
  }
  .msg-answer li { margin-bottom: 0.25rem; }
  .msg-answer code {
    font-family: var(--mono);
    font-size: 0.82rem;
    background: rgba(255,255,255,0.07);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.1);
  }
  .msg-answer pre {
    background: #0d1117;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 0.75rem 0;
  }
  .msg-answer pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.82rem;
    line-height: 1.6;
  }
  .msg-answer table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin: 0.75rem 0;
  }
  .msg-answer th, .msg-answer td {
    border: 1px solid rgba(255,255,255,0.08);
    padding: 0.45rem 0.75rem;
    text-align: left;
  }
  .msg-answer th { background: rgba(255,255,255,0.05); font-weight: 700; }
  .msg-answer blockquote {
    border-left: 3px solid var(--accent);
    margin: 0.75rem 0;
    padding: 0.5rem 1rem;
    color: var(--muted);
    font-style: italic;
  }
  .msg-answer a { color: var(--accent2); text-decoration: underline; }
  .msg-answer strong { font-weight: 700; color: var(--text); }
  .msg-answer em { font-style: italic; }
  .msg-answer hr { border: none; border-top: 1px solid rgba(255,255,255,0.08); margin: 1rem 0; }

  /* Streaming: while chunks arrive, use pre-wrap to avoid flicker */
  .msg-answer.streaming { white-space: pre-wrap; }

  /* ── COPY DROPDOWN ──────────────────────────────────────── */
  .answer-wrap { position: relative; }

  .copy-dropdown-wrap {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    opacity: 0;
    transition: opacity 0.15s;
  }
  .answer-wrap:hover .copy-dropdown-wrap { opacity: 1; }

  .btn-copy {
    background: var(--surface);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: var(--radius);
    padding: 0.25rem 0.55rem;
    font-size: 0.72rem;
    font-family: var(--mono);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
    position: relative;
  }
  .btn-copy:hover { border-color: rgba(255,255,255,0.25); color: var(--text); }
  .btn-copy.copied { border-color: var(--accent); color: var(--accent); }

  .copy-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: rgba(28, 28, 30, 0.95);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    min-width: 160px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    z-index: 50;
  }
  .copy-menu.open { display: block; }

  .copy-menu-item {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.7rem;
    padding: 0.55rem 0.9rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
    letter-spacing: 0.02em;
  }
  .copy-menu-item:hover { background: rgba(255,255,255,0.07); }
  .copy-menu-item + .copy-menu-item { border-top: 1px solid var(--border); }
  [data-theme="light"] .copy-menu {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  }
  [data-theme="light"] .copy-menu-item:hover { background: rgba(0, 0, 0, 0.05); }

  /* ── ROUTING BADGE ──────────────────────────────────────── */
  .routing-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    padding-left: 0.25rem;
  }

  .badge {
    font-family: var(--mono);
    font-size: 0.62rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    border: 1px solid;
    letter-spacing: 0.04em;
  }

  .badge-type    { border-color: var(--border); color: var(--muted); }
  .badge-claude  { border-color: var(--claude); color: var(--claude); }
  .badge-gpt     { border-color: var(--gpt);    color: var(--gpt); }
  .badge-gemini  {
    border-color: #8E75FF;
    background: linear-gradient(135deg, #8E75FF, #4285F4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  .badge-grok    { border-color: var(--grok);   color: var(--grok); }
  .badge-judge   { border-color: var(--judge);  color: var(--judge); }
  .badge-latency { border-color: var(--border); color: var(--muted); }
  .badge-backup  { border-color: var(--warn);   color: var(--warn); }
  .badge-score   { border-color: var(--border); color: var(--muted); }
  .badge-haiku   { border-color: var(--claude); color: var(--claude); opacity: 0.7; }
  .badge-cost    { border-color: #4ade80; color: #4ade80; }
  .badge-source {
    background: var(--badge-source-bg, #1a6b3c);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    border-color: #1a6b3c;
  }
  .badge-source:hover { opacity: 0.85; }
  .badge-iaa {
    background: var(--badge-iaa-bg, #2d6a9f);
    color: #fff;
    border-color: #2d6a9f;
  }
  .badge-consensus {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
  }

  /* ── FILE UPLOAD ─────────────────────────────────────────── */
  .btn-attach {
    background: none;
    border: none;
    color: var(--muted);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.3rem;
    flex-shrink: 0;
    transition: color 0.2s;
    margin-bottom: 3px;
  }
  .btn-attach:hover { color: var(--text); }
  .btn-attach.has-file { color: var(--gemini); }

  .file-indicator {
    display: none;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--gemini);
    padding: 0.3rem 0.75rem;
    border: 1px solid rgba(142,117,255,0.3);
    border-radius: 10px;
    background: rgba(142,117,255,0.06);
    align-self: flex-start;
    margin-top: 4px;
  }
  .file-indicator.visible { display: flex; }
  .file-indicator button {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0;
  }
  .file-indicator button:hover { color: var(--warn); }

  /* ── FLOATING INPUT AREA ────────────────────────────────── */
  .input-container {
    position: fixed;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 760px;
    z-index: 100;
  }

  .input-wrap {
    background: var(--surface);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 0.5rem 0.6rem 0.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transition: border-color 0.2s ease;
  }
  .input-wrap:focus-within { border-color: rgba(255,255,255,0.2); }

  .input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
  }

  #question-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--sans);
    font-size: 1rem;
    resize: none;
    min-height: 24px;
    max-height: 160px;
    line-height: 1.5;
    padding: 0.55rem 0;
    transition: height 0.1s ease;
  }
  #question-input::placeholder { color: var(--muted); }

  .btn-send {
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
    margin-bottom: 3px;
    transition: transform 0.15s, opacity 0.15s, box-shadow 0.25s ease;
    will-change: transform, box-shadow;
  }
  .btn-send.ready {
    box-shadow: 0 0 10px rgba(0,255,136,0.35), 0 0 20px rgba(0,255,136,0.12);
  }
  .btn-send.ready:hover:not(:disabled) {
    transform: scale(1.07);
    box-shadow: 0 0 16px rgba(0,255,136,0.6), 0 0 32px rgba(0,255,136,0.2);
  }
  .btn-send:hover:not(:disabled) { transform: scale(1.05); }
  .btn-send:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }

  /* ── MIC BUTTON (voice input) ───────────────────────────── */
  #btn-mic {
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    position: relative;
    margin-bottom: 3px;
    transition: transform 0.15s, box-shadow 0.25s ease;
    will-change: transform, box-shadow;
  }
  #btn-mic:hover:not(:disabled) { transform: scale(1.05); }
  #btn-mic:disabled { opacity: 0.35; cursor: not-allowed; }

  #btn-mic.recording {
    box-shadow: 0 0 10px rgba(0,255,136,0.35), 0 0 20px rgba(0,255,136,0.12);
  }

  #btn-mic::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    box-shadow:
      0 0 12px rgba(0,255,136,0.42),
      0 0 28px rgba(0,255,136,0.16);
  }

  #btn-mic.recording::after {
    opacity: 1;
    animation: mic-pulse 1.15s ease-in-out infinite;
  }

  @keyframes mic-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
  }

  /* ── THINKING INDICATOR ─────────────────────────────────── */
  .thinking {
    display: flex;
    gap: 5px;
    padding: 1rem 1.5rem;
    background: var(--surface);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
  }
  .thinking span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: bounce 1.2s infinite;
  }
  .thinking span:nth-child(2) { animation-delay: 0.2s; }
  .thinking span:nth-child(3) { animation-delay: 0.4s; }

  @keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40%           { transform: translateY(-6px); opacity: 1; }
  }

  /* ── ERROR ──────────────────────────────────────────────── */
  .msg-error {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--warn);
    padding: 0.75rem 1rem;
    border: 1px solid var(--warn);
    border-radius: var(--radius);
    opacity: 0.8;
  }

  /* ── LOAD EARLIER / CLEAR ───────────────────────────────── */
  #btn-load-earlier {
    display: none;
    align-self: center;
    font-family: var(--mono);
    font-size: 0.72rem;
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.4rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    margin-bottom: 0.5rem;
  }
  #btn-load-earlier:hover { border-color: var(--accent2); color: var(--accent2); }

  /* ── STATS BAR ───────────────────────────────────────────── */
  #stats-bar {
    position: fixed;
    bottom: 0;
    width: 100%;
    padding: 0.5rem 1.5rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-family: var(--mono);
    font-size: 0.6rem;
    color: var(--muted);
    z-index: 99;
  }
  .v-tag {
    position: absolute;
    left: 1.5rem;
    opacity: 0.5;
  }
  @media (max-width: 480px) {
    .v-tag { display: none; }
    #stats-bar { gap: 1.25rem; padding: 0.5rem 1rem; }
  }
  #stats-bar .stat-value { color: #4ade80; }

  /* ── SCROLLBAR ──────────────────────────────────────────── */
  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

  /* ── SIDEBAR (6.1) ──────────────────────────────────────── */
  #sidebar {
    position: fixed;
    top: 53px;        /* below header */
    bottom: 38px;     /* above stats bar */
    width: 240px;
    background: var(--surface);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: 1px solid var(--border);
    z-index: 50;
    display: none;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    transition: transform 0.25s ease;
  }
  #sidebar.open { display: flex; }
  #sidebar.sidebar-left  { left: 0;  border-left: none; border-radius: 0 8px 8px 0; }
  #sidebar.sidebar-right { right: 0; border-right: none; border-radius: 8px 0 0 8px; }

  .sidebar-header {
    padding: 0.75rem 1rem 0.6rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-shrink: 0;
  }
  .sidebar-user-email {
    font-size: 0.65rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sidebar-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .sidebar-title {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .sidebar-section {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .btn-new-chat {
    width: 100%;
    font-family: var(--mono);
    font-size: 0.7rem;
    background: rgba(0,255,136,0.08);
    border: 1px solid rgba(0,255,136,0.25);
    color: var(--accent);
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-align: left;
  }
  .btn-new-chat:hover { background: rgba(0,255,136,0.15); border-color: var(--accent); }

  .btn-new-project {
    width: 100%;
    font-family: var(--mono);
    font-size: 0.65rem;
    background: none;
    border: 1px dashed var(--border);
    color: var(--muted);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    text-align: left;
    margin-top: 0.5rem;
  }
  .btn-new-project:hover { border-color: var(--accent2); color: var(--accent2); }

  #project-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
  }

  .project-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--muted);
    transition: background 0.15s, color 0.15s;
    border-left: 2px solid transparent;
  }
  .project-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
  .project-item.active {
    border-left-color: var(--accent);
    color: var(--text);
    background: rgba(0,255,136,0.05);
  }
  .project-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .btn-del-project {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    flex-shrink: 0;
  }
  .project-header:hover .btn-del-project { opacity: 1; }
  .btn-del-project:hover { color: var(--warn); }

  /* ── SIDEBAR TREE (6.3 Alpine.js) ──────────────────────── */
  .project-block { border-bottom: 1px solid rgba(255,255,255,0.04); }

  .project-header {
    display: flex; align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer; gap: 0.4rem;
    font-size: 0.75rem; color: var(--text);
    border-left: 2px solid transparent;
    user-select: none;
  }
  .project-header:hover { background: rgba(255,255,255,0.04); }
  .project-chevron { font-size: 0.55rem; color: var(--muted); width: 0.75rem; flex-shrink: 0; }
  .project-header-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .chat-item {
    display: flex; align-items: center;
    padding: 0.32rem 0.75rem 0.32rem 1.75rem;
    cursor: pointer; gap: 0.4rem;
    font-size: 0.71rem; color: var(--muted);
    border-left: 2px solid transparent;
  }
  .chat-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
  .chat-item.active { border-left-color: var(--accent); color: var(--text); background: rgba(255,255,255,0.06); }
  .chat-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .btn-del-chat {
    background: none; border: none; cursor: pointer;
    color: var(--muted); opacity: 0; font-size: 0.65rem;
    padding: 0 0.15rem; line-height: 1; flex-shrink: 0;
  }
  .chat-item:hover .btn-del-chat { opacity: 1; }
  .btn-del-chat:hover { color: var(--warn); }

  .btn-new-chat-inline {
    display: block;
    width: calc(100% - 2rem); margin: 0.2rem 0.75rem 0.2rem 1.75rem;
    text-align: left; background: none;
    border: 1px dashed rgba(255,255,255,0.1); border-radius: 4px;
    padding: 0.25rem 0.5rem; font-size: 0.67rem;
    color: var(--muted); cursor: pointer; font-family: var(--mono);
  }
  .btn-new-chat-inline:hover { border-color: var(--accent); color: var(--accent); }

  .sidebar-rename-input {
    flex: 1; background: rgba(255,255,255,0.1);
    border: 1px solid var(--accent); border-radius: 3px;
    color: var(--text); font-family: var(--mono);
    font-size: 0.72rem; padding: 0.1rem 0.3rem; outline: none;
  }

  /* sidebar toggle button */
  .btn-sidebar-toggle {
    background: none;
    border: none;
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    display: none;         /* shown only when logged in */
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    opacity: 0.7;
    transition: opacity 0.2s, color 0.2s;
  }
  .btn-sidebar-toggle:hover { opacity: 1; color: var(--accent); }

  /* sidebar position toggle */
  .btn-side-pos {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    transition: color 0.2s;
  }
  .btn-side-pos:hover { color: var(--text); }

  /* ── MEMORY PANEL ────────────────────────────────────────── */
  #memory-section {
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    max-height: 160px;
    display: flex;
    flex-direction: column;
  }
  .memory-header {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    flex-shrink: 0;
  }
  .memory-header:hover { background: rgba(255,255,255,0.03); }
  .memory-title {
    font-family: var(--mono);
    font-size: 0.6rem;
    color: var(--muted);
    letter-spacing: 0.1em;
  }
  #memory-list {
    overflow-y: auto;
    padding: 0 0.75rem 0.5rem;
    display: none;
  }
  #memory-list.open { display: block; }
  .memory-fact {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.25rem 0;
    font-size: 0.72rem;
    color: var(--muted);
    border-bottom: 1px solid rgba(255,255,255,0.04);
  }
  .memory-fact-text { flex: 1; line-height: 1.4; }
  .btn-del-fact {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.65rem;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
  }
  .memory-fact:hover .btn-del-fact { opacity: 1; }
  .btn-del-fact:hover { color: var(--warn); }
