:root {
      --red: #E5202D;
      --black: #111111;
      --white: #ffffff;
      --gray: #f4f4f4;
      --border: #e0e0e0;
      --bg-page: #ffffff;
      --bg-surface: #ffffff;
      --bg-surface-alt: #f4f4f4;
      --text-primary: #111111;
      --text-muted: #888888;
      --border-color: #e0e0e0;
      --purple: #7c4dff;
      --purple-bg: #f1ecfd;
      --err-bg: #fdeaea;
      --sys-bg: #fff8e1;
      --sys-border: #f0d878;
      --sys-text: #6b5600;
    }
    html[data-theme="dark"] {
      --bg-page: #15171b;
      --bg-surface: #1e2126;
      --bg-surface-alt: #262a30;
      --text-primary: #eaeaea;
      --text-muted: #9aa0a6;
      --border-color: #34383f;
      --purple-bg: #2a2440;
      --err-bg: #3a1f22;
      --sys-bg: #2e2a1a;
      --sys-border: #5c5324;
      --sys-text: #e0cf8a;
    }
    * { box-sizing: border-box; }
    html, body {
      height: 100%;
      overflow: hidden;
    }
    body {
      font-family: 'Segoe UI', Arial, sans-serif;
      background: var(--bg-page);
      color: var(--text-primary);
      margin: 0;
      padding: 0;
      transition: background 0.2s ease, color 0.2s ease;
    }
    .theme-toggle {
      background: transparent;
      border: 1px solid rgba(255,255,255,0.25);
      color: inherit;
      width: 32px;
      height: 32px;
      padding: 0;
      border-radius: 50%;
      font-size: 15px;
      display: flex;
      align-items: center;
      justify-content: center;
      line-height: 1;
    }
    .theme-toggle:hover { background: rgba(255,255,255,0.12); }
    #screen1 .theme-toggle {
      position: fixed;
      top: 16px;
      right: 16px;
      border-color: var(--border-color);
      color: var(--text-primary);
    }
    #screen1 .theme-toggle:hover { background: var(--bg-surface-alt); }
    .hidden { display: none !important; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
    @keyframes spin { to { transform: rotate(360deg); } }
    @keyframes pulseDot { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.7); } 40% { opacity: 1; transform: scale(1); } }
    @keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }

    header {
      background: linear-gradient(135deg, #1a1a1a, var(--black));
      color: var(--white);
      padding: 16px 24px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      box-shadow: 0 2px 10px rgba(0,0,0,0.25);
      position: relative;
      z-index: 5;
    }
    header .brand {
      font-weight: 700;
      font-size: 17px;
      letter-spacing: 0.5px;
    }
    header .brand span { color: var(--red); }

    button {
      background: var(--black);
      color: var(--white);
      border: none;
      padding: 10px 18px;
      border-radius: 8px;
      font-size: 14px;
      cursor: pointer;
      transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease, background 0.15s ease;
      position: relative;
    }
    button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,0,0,0.18); }
    button:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
    button.primary { background: var(--red); }
    button.primary:hover:not(:disabled) { box-shadow: 0 3px 12px rgba(229,32,45,0.35); }
    button:disabled { opacity: 0.55; cursor: default; transform: none !important; box-shadow: none !important; }

    /* Generic button-busy state: hides label, shows inline spinner */
    button.is-loading { color: transparent !important; pointer-events: none; }
    button.is-loading::after {
      content: '';
      position: absolute;
      top: 50%; left: 50%;
      width: 14px; height: 14px;
      margin: -7px 0 0 -7px;
      border: 2px solid rgba(255,255,255,0.4);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin 0.6s linear infinite;
    }
    button.secondary-outline.is-loading::after { border: 2px solid rgba(0,0,0,0.25); border-top-color: var(--black); }

    /* Typing / thinking indicator (three pulsing dots) */
    .typing-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
    .typing-dots span {
      width: 6px; height: 6px; border-radius: 50%;
      background: var(--text-muted); display: inline-block;
      animation: pulseDot 1.2s infinite ease-in-out both;
    }
    .typing-dots span:nth-child(2) { animation-delay: 0.15s; }
    .typing-dots span:nth-child(3) { animation-delay: 0.3s; }

    /* Skeleton loading rows for lists */
    .skeleton-row {
      height: 46px;
      border-radius: 8px;
      margin-bottom: 10px;
      background: linear-gradient(90deg, var(--bg-surface-alt) 25%, var(--bg-surface) 37%, var(--bg-surface-alt) 63%);
      background-size: 400px 100%;
      animation: shimmer 1.4s ease infinite;
    }

    .spinner {
      display: inline-block;
      width: 14px; height: 14px;
      border: 2px solid rgba(0,0,0,0.15);
      border-top-color: var(--red);
      border-radius: 50%;
      animation: spin 0.6s linear infinite;
      vertical-align: middle;
      margin-right: 6px;
    }

    /* ---------- Screen 1: Connect Gate ---------- */
    #screen1 {
      height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 18px;
      background: radial-gradient(circle at 50% 30%, #fafafa, #f0f0f0);
      position: relative;
    }
    html[data-theme="dark"] #screen1 { background: radial-gradient(circle at 50% 30%, #1c1f24, #131518); }
    #screen1 .brand-big {
      font-size: 34px;
      font-weight: 700;
      letter-spacing: 0.5px;
      animation: fadeIn 0.4s ease both;
    }
    #screen1 .brand-big span { color: var(--red); }
    #connectBtn {
      background: var(--red);
      padding: 14px 32px;
      font-size: 16px;
      border-radius: 10px;
      box-shadow: 0 4px 16px rgba(229,32,45,0.25);
      animation: fadeIn 0.4s ease 0.1s both;
    }
    #connectError {
      color: var(--red);
      font-size: 14px;
    }

    /* ---------- Screen 2: Project List ---------- */
    #screen2 main {
      max-width: 680px;
      margin: 0 auto;
      padding: 32px 24px;
      height: calc(100vh - 65px);
      overflow-y: auto;
    }
    .search-bar-wrap { position: relative; margin-bottom: 18px; }
    .search-bar-wrap input[type="text"] {
      width: 100%;
      padding: 10px 32px 10px 40px !important;
      border-radius: 10px;
      font-size: 14px;
    }
    .search-bar-wrap .search-icon {
      position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
      color: var(--text-muted); font-size: 14px; line-height: 1; pointer-events: none;
    }
    .search-bar-wrap .search-clear {
      position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
      background: transparent; border: none; color: var(--text-muted);
      cursor: pointer; padding: 4px; font-size: 13px; border-radius: 50%;
    }
    .search-bar-wrap .search-clear:hover { background: var(--bg-surface-alt); }
    .list-end-msg { text-align: center; color: var(--text-muted); font-size: 12px; padding: 14px 0; }
    .list-loading-more { text-align: center; padding: 10px 0; }

    /* ---------- New Project modal ---------- */
    .modal-overlay {
      position: fixed; inset: 0; background: rgba(0,0,0,0.45);
      display: flex; align-items: center; justify-content: center;
      z-index: 100; animation: fadeIn 0.15s ease both;
    }
    .modal-box {
      background: var(--bg-surface); color: var(--text-primary);
      width: 460px; max-width: 92vw; max-height: 86vh;
      border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.35);
      display: flex; flex-direction: column; overflow: hidden;
      animation: fadeIn 0.2s ease both;
    }
    .modal-header {
      padding: 20px 22px 14px;
      background: linear-gradient(135deg, #1a1a1a, var(--black));
      color: var(--white);
    }
    .modal-header .modal-title { font-size: 17px; font-weight: 700; }
    .modal-header .modal-title span { color: var(--red); }
    .modal-header .modal-sub { font-size: 12px; color: #ccc; margin-top: 3px; }
    .modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; min-height: 0; }
    .modal-field { margin-bottom: 16px; }
    .modal-field label {
      display: block; font-size: 12px; font-weight: 600;
      color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px;
    }
    .modal-field input[type="text"] { width: 100%; }
    .modal-field input[disabled] { opacity: 0.65; cursor: not-allowed; }
    .modal-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
    .modal-section-label {
      font-size: 12px; font-weight: 600; color: var(--text-muted);
      text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px;
    }
    .modal-team-setup { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border, rgba(255,255,255,0.1)); }
    .modal-team-title {
      font-size: 13px; font-weight: 700; cursor: pointer; list-style: none;
      display: flex; align-items: center; gap: 6px;
    }
    .modal-team-title::-webkit-details-marker { display: none; }
    .modal-team-title::before { content: "▸"; font-size: 10px; color: var(--text-muted); transition: transform 0.15s ease; }
    details[open] > .modal-team-title::before { transform: rotate(90deg); }
    .modal-team-title span { font-weight: 400; opacity: 0.6; }
    .modal-team-body { margin-top: 14px; }
    .header-actions { display: flex; align-items: center; gap: 12px; }
    .logout-btn {
      width: auto;
      height: 32px;
      padding: 0 14px;
      border: none;
      border-radius: 8px;
      background: #e5484d;
      color: #fff;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
    }
    .logout-btn:hover { background: #c7373b; }
    .modal-tabs { display: flex; gap: 6px; margin-bottom: 16px; background: var(--bg-surface-alt); padding: 4px; border-radius: 10px; }
    .modal-tab {
      flex: 1; text-align: center; padding: 8px 10px; font-size: 13px; font-weight: 600;
      border-radius: 8px; cursor: pointer; color: var(--text-muted); background: transparent;
      border: none; transition: background 0.15s ease, color 0.15s ease;
    }
    .modal-tab.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
    .drive-search-results { max-height: 220px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: 10px; margin-top: 8px; }
    .drive-result-item {
      display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer;
      border-bottom: 1px solid var(--border-color); font-size: 13px; transition: background 0.12s ease;
    }
    .drive-result-item:last-child { border-bottom: none; }
    .drive-result-item:hover { background: var(--bg-surface-alt); }
    .drive-result-item.selected { background: rgba(229,32,45,0.08); border-left: 3px solid var(--red); }
    .drive-result-item .drive-icon { font-size: 18px; flex: 0 0 auto; }
    .drive-result-item .drive-meta { min-width: 0; }
    .drive-result-item .drive-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .drive-result-item .drive-owner { font-size: 11px; color: var(--text-muted); }
    .drive-search-empty, .drive-search-loading { text-align: center; color: var(--text-muted); font-size: 13px; padding: 18px 0; }
    .settings-sheet-current {
      display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px;
      background: var(--bg-surface-alt); border-radius: 8px; font-size: 13px; font-weight: 600;
    }
    .settings-sheet-current a { color: var(--red); text-decoration: none; }
    .settings-sheet-current a:hover { text-decoration: underline; }
    .upload-drop {
      border: 2px dashed var(--border-color); border-radius: 12px; padding: 28px 16px;
      text-align: center; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease;
    }
    .upload-drop:hover, .upload-drop.dragover { border-color: var(--red); background: var(--err-bg); }
    .upload-drop .upload-icon { font-size: 26px; margin-bottom: 8px; }
    .upload-drop .upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
    .upload-picked { font-size: 13px; margin-top: 10px; padding: 8px 10px; background: var(--bg-surface-alt); border-radius: 8px; }
    .modal-footer {
      padding: 14px 22px; border-top: 1px solid var(--border-color);
      display: flex; justify-content: flex-end; gap: 10px;
    }
    .modal-footer button.ghost { background: transparent; color: var(--text-primary); border: 1px solid var(--border-color); }
    .picker-fallback-link { background: transparent; border: none; color: var(--red); font-size: 12px; cursor: pointer; padding: 6px 0; text-decoration: underline; }
    /* Confirm dialog */
    #confirmModal .modal-box { width: 420px; }
    #confirmModal .modal-body { font-size: 14px; line-height: 1.5; color: var(--text-primary); }
    #confirmModal .modal-footer button.danger { background: var(--red); color: var(--white); border: none; }
    /* Toast notifications */
    #toastStack {
      position: fixed; bottom: 20px; right: 20px; z-index: 200;
      display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
      pointer-events: none;
    }
    .toast {
      pointer-events: auto; min-width: 220px; max-width: 360px;
      padding: 12px 16px; border-radius: 10px; font-size: 13px; font-weight: 500;
      color: var(--white); background: #333; box-shadow: 0 8px 24px rgba(0,0,0,0.3);
      display: flex; align-items: center; gap: 10px;
      animation: toastIn 0.2s ease both;
    }
    .toast.hide { animation: toastOut 0.2s ease both; }
    .toast.error { background: var(--red); }
    .toast.success { background: #1e8e3e; }
    .toast .toast-icon { font-size: 15px; flex: 0 0 auto; }
    @keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
    @keyframes toastOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(20px); } }
    #screen2 .screen-title {
      font-size: 20px;
      font-weight: 700;
      margin-bottom: 20px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .project-card {
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 16px 18px;
      margin-bottom: 12px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
      transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
      background: var(--bg-surface);
      border-color: var(--border-color);
      animation: fadeIn 0.25s ease both;
    }
    .project-card:hover { border-color: var(--red); box-shadow: 0 4px 14px rgba(0,0,0,0.08); transform: translateY(-1px); }
    .project-card.is-loading { opacity: 0.6; pointer-events: none; }
    .project-card .name { font-weight: 600; font-size: 15px; }
    .project-card .card-right { display: flex; align-items: center; gap: 6px; }
    .needs-link-badge {
      font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
      color: var(--red); border: 1px solid var(--red); background: transparent;
      border-radius: 100px; padding: 2px 9px; white-space: nowrap; cursor: pointer;
      font-family: inherit;
    }
    .needs-link-badge:hover { background: var(--red); color: #fff; }
    .project-card-wrap { position: relative; }
    .project-card-wrap.dragging, .chat-item-wrap.dragging {
      position: relative; z-index: 20; opacity: 0.85;
      box-shadow: 0 6px 16px rgba(0,0,0,0.25);
      user-select: none; -webkit-user-select: none;
      transition: none !important;
    }
    .project-card-wrap.drag-armed .project-card,
    .chat-item-wrap.drag-armed .chat-item { cursor: grabbing; }
    .rename-holder { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
    .rename-input {
      flex: 1; min-width: 0; font: inherit; font-weight: 600; font-size: 15px;
      padding: 2px 6px; border: 1px solid var(--red); border-radius: 4px;
      background: var(--bg-surface); color: var(--text-primary);
    }
    .rename-btn {
      border: none; background: transparent; cursor: pointer; font-size: 14px;
      line-height: 1; padding: 4px; border-radius: 4px; color: var(--text-muted);
    }
    .rename-btn:hover { background: var(--bg-surface-alt); }
    .rename-ok { color: var(--red); }
    .project-card-wrap.is-deleting .project-card { opacity: 0.4; pointer-events: none; transition: opacity 0.15s ease; }
    .empty-state {
      text-align: center;
      color: var(--text-muted);
      font-size: 15px;
      padding: 40px 0;
      animation: fadeIn 0.2s ease both;
    }
    .loading-state {
      text-align: center;
      color: var(--text-muted);
      font-size: 15px;
      padding: 40px 0;
    }

    /* ---------- Screen 3: Dashboard ---------- */
    #screen3 header .project-name {
      font-size: 14px;
      color: #ccc;
      margin-left: 10px;
    }
    #backBtn {
      background: transparent;
      border: 1px solid #555;
      color: var(--white);
      padding: 8px 14px;
      font-size: 14px;
      margin-right: 10px;
    }
    #screen3 .body {
      display: flex;
      height: calc(100vh - 51px);
    }
    #sidebar {
      width: 280px;
      flex: 0 0 280px;
      border-right: 1px solid var(--border-color);
      background: var(--bg-surface-alt);
      display: flex;
      flex-direction: column;
      overflow-y: auto;
      box-shadow: 2px 0 8px rgba(0,0,0,0.03);
      min-width: 0;
      transition: margin-left 0.18s ease, box-shadow 0.18s ease;
    }
    #screen3 .body { position: relative; }
    #sidebarResizer {
      flex: 0 0 5px;
      width: 5px;
      cursor: col-resize;
      background: transparent;
      position: relative;
      z-index: 5;
    }
    #sidebarResizer::after {
      content: '';
      position: absolute;
      top: 0; bottom: 0; left: 2px;
      width: 1px;
      background: var(--border-color);
    }
    #sidebarResizer:hover::after, #sidebarResizer.dragging::after {
      left: 0; width: 5px;
      background: var(--red);
      opacity: 0.5;
    }
    body.sidebar-dragging { cursor: col-resize; user-select: none; }
    #sidebarToggleBtn {
      display: none;
      background: transparent;
      border: 1px solid #555;
      color: var(--white);
      padding: 8px 12px;
      font-size: 14px;
      margin-right: 6px;
    }
    /* Collapsed state: slide sidebar off, keep it out of flow via margin so
       the resizer + chat panel reclaim its space without re-layout jank. */
    #screen3 .body.sidebar-collapsed #sidebar {
      margin-left: calc(-1 * var(--sidebar-w, 280px) - 5px);
    }
    #screen3 .body.sidebar-collapsed #sidebarResizer { display: none; }
    /* Narrow viewports: sidebar becomes an overlay drawer instead of pushing
       the chat panel around, and the toggle button appears to drive it. */
    @media (max-width: 760px) {
      #sidebarToggleBtn { display: inline-block; }
      #screen3 .body #sidebar {
        position: absolute;
        top: 0; bottom: 0; left: 0;
        z-index: 20;
        box-shadow: 4px 0 16px rgba(0,0,0,0.18);
      }
      #screen3 .body #sidebarResizer { display: none; }
      #screen3 .body.sidebar-collapsed #sidebar { margin-left: 0; transform: translateX(calc(-100% - 5px)); }
      #screen3 .body:not(.sidebar-collapsed) #sidebar { transform: translateX(0); }
      #sidebar { transition: transform 0.18s ease; }
    }
    #sidebar .sidebar-header {
      padding: 14px;
      border-bottom: 1px solid var(--border-color);
    }
    #newChatBtn { width: 100%; }
    #chatList { flex: 1; overflow-y: auto; padding: 4px 0; }
    .chat-item {
      padding: 12px 14px;
      cursor: pointer;
      border-bottom: 1px solid var(--border-color);
      font-size: 14px;
      transition: background 0.12s ease, border-left-color 0.12s ease;
      border-left: 3px solid transparent;
      animation: fadeIn 0.2s ease both;
    }
    .chat-item:hover { background: var(--bg-surface); }
    .chat-item.active { background: var(--bg-surface); border-left: 3px solid var(--red); box-shadow: inset 0 0 0 1px rgba(229,32,45,0.08); }
    .chat-item-wrap.is-deleting { opacity: 0.4; pointer-events: none; transition: opacity 0.15s ease; }
    .chat-item .chat-row { display: flex; align-items: center; justify-content: space-between; }
    .chat-item .chat-row > div:first-child { min-width: 0; flex: 1; }
    .chat-item .chat-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .chat-item .chat-status { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
    .chat-menu-btn {
      background: transparent;
      color: var(--text-muted);
      border: none;
      padding: 2px 6px;
      font-size: 17px;
      line-height: 1;
      cursor: pointer;
      border-radius: 4px;
      flex: 0 0 auto;
    }
    .chat-menu-btn:hover { background: var(--bg-surface-alt); color: var(--text-primary); }
    .chat-item-wrap { position: relative; }
    .chat-menu-dropdown {
      position: absolute;
      right: 8px;
      top: 34px;
      background: var(--bg-surface);
      border: 1px solid var(--border-color);
      border-radius: 6px;
      box-shadow: 0 4px 12px rgba(0,0,0,0.12);
      z-index: 10;
      min-width: 120px;
      overflow: hidden;
    }
    .chat-menu-dropdown button {
      display: block;
      width: 100%;
      text-align: left;
      background: var(--bg-surface);
      color: var(--text-primary);
      border: none;
      padding: 8px 12px;
      font-size: 13px;
      border-radius: 0;
    }
    .chat-menu-dropdown button:hover { background: var(--bg-surface-alt); }
    .chat-menu-dropdown button.danger { color: var(--red); }
    .typing-cursor { display: inline-block; width: 6px; animation: pulseDot 1s infinite; }
    .saving-badge { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; }

    /* ---------- Mic / voice input ---------- */
    #msgInputWrap {
      flex: 1;
      position: relative;
      display: flex;
      align-items: flex-end;
    }
    #msgInputWrap textarea#msg {
      width: 100%;
      padding: 12px 44px 12px 40px;
      font-size: 15px;
      line-height: 1.5;
      font-family: inherit;
      resize: none;
      overflow-y: auto;
      min-height: 92px;  /* ~3 lines at this line-height/padding */
      max-height: 118px; /* ~4 lines at this line-height/padding */
      white-space: pre-wrap;
      word-wrap: break-word;
    }
    /* While recording, the mic(stop) + discard buttons sit over the textarea's
       right edge — widen the padding so live transcript text doesn't run
       underneath them. */
    #msgInputWrap textarea#msg.recording { padding-right: 88px; }
    /* ponytail: 34px is as close to the 44px touch-target guideline as this compact
       (92-118px tall) composer row comfortably fits without reflowing the whole
       layout. Revisit if the composer height ever grows. */
    #micBtn {
      position: absolute;
      right: 5px;
      bottom: 5px;
      width: 34px;
      height: 34px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      color: var(--text-muted);
      border: none;
      padding: 0;
      cursor: pointer;
      border-radius: 50%;
      line-height: 1;
      transition: background 0.15s ease, color 0.15s ease;
    }
    #micBtn svg { width: 18px; height: 18px; }
    #micBtn:hover { background: var(--bg-surface-alt); }
    #micBtn:focus-visible, #micDiscardBtn:focus-visible {
      outline: none;
      box-shadow: 0 0 0 3px rgba(229,32,45,0.25);
    }
    #attachBtn {
      position: absolute;
      left: 6px;
      bottom: 6px;
      width: 28px;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      color: var(--text-muted);
      border: none;
      padding: 0;
      font-size: 22px;
      cursor: pointer;
      border-radius: 50%;
      line-height: 1;
    }
    #attachBtn:hover:not(:disabled) { background: var(--bg-surface-alt); color: var(--text-primary); }
    #attachBtn:disabled { opacity: 0.45; cursor: default; }
    #attachBtn.busy {
      border: 2px solid #e0d8f5;
      border-top-color: var(--purple);
      animation: micSpin 0.7s linear infinite;
    }
    #micBtn.listening {
      color: #fff;
      background: var(--red);
      animation: micPulseRing 1.6s ease-in-out infinite;
    }
    #micBtn.busy {
      border: 2px solid #e0d8f5;
      border-top-color: var(--purple);
      animation: micSpin 0.7s linear infinite;
    }
    @keyframes micSpin { to { transform: rotate(360deg); } }
    @keyframes micPulseRing {
      0%, 100% { box-shadow: 0 0 0 0 rgba(229,32,45,0.35); }
      50% { box-shadow: 0 0 0 7px rgba(229,32,45,0); }
    }
    @media (prefers-reduced-motion: reduce) {
      #micBtn.listening { animation: none; }
    }
    #attachChips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
    .attach-chip {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      max-width: 260px;
      padding: 6px 8px 6px 10px;
      background: var(--bg-surface-alt);
      border: 1px solid var(--border-color);
      border-radius: 10px;
      font-size: 13px;
    }
    .attach-chip .chip-icon { font-size: 16px; flex: 0 0 auto; }
    .attach-chip .chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .attach-chip .chip-remove {
      flex: 0 0 auto;
      width: 18px; height: 18px;
      display: flex; align-items: center; justify-content: center;
      border: none; background: transparent; color: var(--text-muted);
      cursor: pointer; border-radius: 50%; font-size: 14px; line-height: 1; padding: 0;
    }
    .attach-chip .chip-remove:hover { background: var(--red); color: #fff; }
    .attach-chip.uploading { opacity: 0.6; }
    .attach-chip.media { padding-left: 4px; }
    .attach-chip .chip-thumb {
      width: 28px; height: 28px; flex: 0 0 auto;
      object-fit: cover; border-radius: 6px; cursor: pointer;
    }
    .msg-thumb {
      width: 72px; height: 72px; object-fit: cover; border-radius: 8px;
      cursor: pointer; display: block; margin-top: 6px;
    }
    /* Status pill shown under the composer while recording/transcribing. */
    #micStatus {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      margin-top: 6px;
      padding: 3px 10px;
      font-size: 12px;
      font-weight: 500;
      border-radius: 999px;
      background: var(--bg-surface-alt);
      color: var(--text-muted);
      width: fit-content;
    }
    #micStatus .status-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: currentColor;
      flex: 0 0 auto;
    }
    #micStatus.recording-status {
      background: var(--err-bg);
      color: var(--red);
    }
    #micStatus.recording-status .status-dot { animation: micDotPulse 1.4s ease-in-out infinite; }
    #micStatus.busy-status {
      background: var(--purple-bg);
      color: var(--purple);
    }
    #micStatus.busy-status .status-dot { animation: micDotPulse 1.4s ease-in-out infinite; }
    @keyframes micDotPulse {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.35; transform: scale(0.7); }
    }
    @media (prefers-reduced-motion: reduce) {
      #micStatus .status-dot { animation: none; }
    }
    /* Live waveform — bar heights pushed from the popup's AnalyserNode (real RMS
       level), not a canned CSS animation, so it visibly reacts to voice. */
    #micWave {
      display: inline-flex;
      align-items: center;
      gap: 2px;
      height: 16px;
      flex: 0 0 auto;
    }
    #micWave span {
      display: inline-block;
      width: 3px;
      height: 4px;
      background: currentColor;
      border-radius: 2px;
      transition: height 0.08s ease-out;
    }
    @media (prefers-reduced-motion: reduce) {
      #micWave span { transition: none; }
    }
    #micDiscardBtn {
      position: absolute;
      right: 43px;
      bottom: 5px;
      width: 34px;
      height: 34px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      color: var(--text-muted);
      border: none;
      padding: 0;
      cursor: pointer;
      border-radius: 50%;
      line-height: 1;
      transition: background 0.15s ease, color 0.15s ease;
    }
    #micDiscardBtn svg { width: 16px; height: 16px; }
    #micDiscardBtn:hover { background: var(--bg-surface-alt); color: var(--text-primary); }
    #chatPanel {
      flex: 1;
      display: flex;
      flex-direction: column;
      padding: 20px 24px;
      min-width: 0;
      min-height: 0;
      overflow: hidden;
    }
    #chatArea.drag-over { outline: 2px dashed var(--red); outline-offset: -4px; background: var(--err-bg); }
    #chatArea {
      width: 100%;
      max-width: 900px;
      margin: 0 auto;
      min-height: 0;
    }
    .row {
      display: flex;
      gap: 10px;
      align-items: flex-end;
      margin-bottom: 14px;
    }
    input[type="text"], textarea {
      border: 1px solid var(--border-color);
      border-radius: 10px;
      padding: 10px 12px;
      font-size: 15px;
      color: var(--text-primary);
      background: var(--bg-surface);
      flex: 1;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }
    input[type="text"]:focus, textarea:focus {
      outline: none;
      border-color: var(--red);
      box-shadow: 0 0 0 3px rgba(229,32,45,0.12);
    }
    input[type="text"]:disabled, textarea:disabled { background: var(--bg-surface-alt); color: var(--text-muted); }
    #log {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      border: 1px solid var(--border-color);
      border-radius: 10px;
      padding: 16px;
      margin-bottom: 16px;
      background: var(--bg-surface-alt);
      scroll-behavior: smooth;
    }
    #log .you, #log .agent, #log .err, #log .sys {
      padding: 10px 14px;
      margin-bottom: 10px;
      border-radius: 10px;
      font-size: 15px;
      line-height: 1.5;
      max-width: 85%;
      animation: fadeIn 0.2s ease both;
    }
    #log .you {
      background: var(--black);
      color: var(--white);
      margin-left: auto;
      text-align: right;
      box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    }
    #log .agent {
      background: var(--bg-surface);
      color: var(--text-primary);
      border: 1px solid var(--border-color);
      box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    }
    #log .err {
      background: var(--err-bg);
      color: var(--red);
      border: 1px solid var(--red);
    }
    #log .sys {
      background: var(--sys-bg);
      border: 1px solid var(--sys-border);
      color: var(--sys-text);
      max-width: 100%;
    }
    .task-card {
      background: var(--bg-surface);
      color: var(--text-primary);
      border: 1px solid var(--red);
      border-radius: 10px;
      padding: 12px 14px;
      margin-bottom: 8px;
      font-size: 14px;
      max-width: 100%;
      box-shadow: 0 3px 12px rgba(229,32,45,0.1);
      animation: fadeIn 0.25s ease both;
    }
    .task-card-title { font-weight: 700; margin-bottom: 10px; }
    .task-cell-editable {
      cursor: text;
      border-radius: 4px;
      outline: none;
      padding: 2px 4px;
      margin: -2px -4px;
    }
    .task-cell-editable:hover { background: var(--bg-surface-alt); }
    .task-cell-editable:focus { background: var(--bg-surface-alt); box-shadow: 0 0 0 1px var(--red); }
    .task-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
    .task-meta-pill {
      background: var(--bg-surface-alt);
      border: 1px solid var(--border-color);
      border-radius: 12px;
      padding: 4px 11px;
      font-size: 12px;
      color: var(--text-muted);
    }
    .task-meta-pill b { color: var(--text-primary); font-weight: 600; }
    .task-card table { width: 100%; border-collapse: collapse; margin: 8px 0; }
    .task-card td { padding: 3px 6px; border-bottom: 1px solid var(--border-color); }
    .task-card .actions { display: flex; gap: 8px; margin-top: 8px; }
    .task-card .actions button { padding: 6px 14px; font-size: 13px; }
    /* Duplicate detection card — same base shape as .task-card, amber accent */
    .duplicate-card {
      background: var(--bg-surface);
      color: var(--text-primary);
      border: 1px solid #d97706;
      border-left: 4px solid #d97706;
      border-radius: 10px;
      padding: 12px 14px;
      margin-bottom: 8px;
      font-size: 14px;
      max-width: 100%;
      box-shadow: 0 3px 12px rgba(217,119,6,0.12);
      animation: fadeIn 0.25s ease both;
    }
    .duplicate-card .dup-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
    .duplicate-card .dup-icon { font-size: 17px; }
    .duplicate-card .dup-title { font-weight: 700; font-size: 14px; }
    .duplicate-card .dup-info-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
    .dup-pill {
      background: var(--bg-surface-alt);
      border: 1px solid var(--border-color);
      border-radius: 12px;
      padding: 4px 11px;
      font-size: 12px;
      color: var(--text-muted);
    }
    .dup-pill b { color: var(--text-primary); font-weight: 600; }
    .dup-confidence {
      display: inline-block;
      padding: 2px 9px;
      border-radius: 10px;
      font-size: 11px;
      font-weight: 700;
      background: #fef3c7;
      color: #92400e;
    }
    html[data-theme="dark"] .dup-confidence { background: #3b2a00; color: #fbbf24; }
    .duplicate-card .dup-reason { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; font-style: italic; }
    .duplicate-card .actions { display: flex; gap: 8px; margin-top: 8px; }
    .duplicate-card .actions button { padding: 6px 14px; font-size: 13px; }
    .no-dup-notice {
      font-size: 13px;
      color: var(--text-muted);
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      gap: 5px;
    }
    /* Goal 4: Create New justification inline area */
    .dup-justify-area {
      margin-top: 10px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .dup-justify-label {
      font-size: 12px;
      color: var(--text-muted);
    }
    .dup-justify-input {
      width: 100%;
      min-height: 52px;
      resize: vertical;
      border: 1px solid var(--border-color);
      border-radius: 6px;
      background: var(--bg-surface-alt);
      color: var(--text-primary);
      font-family: inherit;
      font-size: 13px;
      padding: 7px 9px;
      box-sizing: border-box;
      outline: none;
      transition: border-color 0.15s;
    }
    .dup-justify-input:focus { border-color: #d97706; }
    .dup-justify-row { display: flex; gap: 8px; }
    .dup-justify-row button { padding: 5px 13px; font-size: 13px; }
    /* Goal 5: Smart merge result badge */
    .dup-merge-badge {
      margin-top: 8px;
      font-size: 12px;
      color: var(--text-muted);
      display: flex;
      align-items: flex-start;
      gap: 5px;
      flex-direction: column;
    }
    .dup-merge-badge .merge-ok { color: #16a34a; font-weight: 600; }
    html[data-theme="dark"] .dup-merge-badge .merge-ok { color: #4ade80; }
    .dup-merge-badge .merge-detail { font-size: 11px; color: var(--text-muted); font-style: italic; }
    /* Goal 6: Edit result card */
    .edit-result-card {
      background: var(--bg-surface);
      border: 1px solid #3b82f6;
      border-left: 4px solid #3b82f6;
      border-radius: 10px;
      padding: 12px 14px;
      margin-bottom: 8px;
      font-size: 14px;
      animation: fadeIn 0.25s ease both;
    }
    .edit-result-card .er-header { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; font-weight: 700; }
    .edit-result-card .er-icon { font-size: 16px; }
    .edit-result-card table { width: 100%; border-collapse: collapse; margin: 6px 0; }
    .edit-result-card td { padding: 3px 6px; border-bottom: 1px solid var(--border-color); font-size: 13px; }
    .edit-result-card .er-reason { font-size: 12px; color: var(--text-muted); margin-top: 6px; font-style: italic; }
    .edit-result-card .er-error { color: #dc2626; font-size: 13px; }
    html[data-theme="dark"] .edit-result-card .er-error { color: #f87171; }

    .no-chat-selected {
      color: var(--text-muted);
      text-align: center;
      margin: auto;
    }

    .brand-logo { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
    .brand-logo img { display: block; margin: 0 auto; }
    .brand-logo .logo-name { font-weight: 700; letter-spacing: 0.5px; color: inherit; }
    .brand-logo.big img { width: 56px; height: 56px; }
    .brand-logo.big .logo-name { font-size: 15px; margin-top: 6px; }
    .brand-logo.small {
      flex-direction: row;
      align-items: center;
      gap: 7px;
    }
    .brand-logo.small img { width: 26px; height: 26px; }
    .brand-logo.small .logo-name { font-size: 14px; margin-top: 0; }
    header .brand-tagline { font-size: 12px; color: #ccc; margin-left: 8px; }
    #screen3 header .brand-row {
      display: flex;
      align-items: center;
      gap: 14px;
    }
    #screen3 header .project-name {
      padding-left: 14px;
      border-left: 1px solid rgba(255,255,255,0.25);
    }

/* ===== PGAGI skin — tokens + screen 2/3 restyle. Overrides only; no JS contracts touched. ===== */
    :root {
      --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
      --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, monospace;
      --red: #BF0404;
      --red-hover: #9C0606;
      --black: #0A0B0E;
      --ring: rgba(191,4,4,0.32);
      --bg-page: #FBFBFC;
      --bg-surface: #FFFFFF;
      --bg-surface-alt: #F3F4F6;
      --bg-surface-3: #E9EBEF;
      --text-primary: #0A0B0E;
      --text-muted: #6B7280;
      --border: #E3E5EA;
      --border-color: #E3E5EA;
      --err-bg: rgba(191,4,4,0.08);
      --sys-bg: rgba(194,130,11,0.10);
      --sys-border: rgba(194,130,11,0.35);
      --sys-text: #8A5B04;
      --purple: #2563C9;
      --purple-bg: rgba(37,99,201,0.10);
    }
    html[data-theme="dark"] {
      --bg-page: #06070A;
      --bg-surface: #111318;
      --bg-surface-alt: #0F1116;
      --bg-surface-3: #21242B;
      --text-primary: #F3F4F6;
      --text-muted: #9BA2AE;
      --border: rgba(255,255,255,0.10);
      --border-color: rgba(255,255,255,0.10);
      --err-bg: rgba(191,4,4,0.16);
      --sys-bg: rgba(194,130,11,0.14);
      --sys-text: #E0A82E;
      --purple-bg: rgba(37,99,201,0.16);
    }
    body { font-family: var(--font-sans); letter-spacing: -0.005em; }
    .mono-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted); }
    .mono-kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--red); font-weight: 500; }

    /* ---- controls ---- */
    button { font-family: var(--font-sans); font-weight: 500; border-radius: 8px; }
    button:hover:not(:disabled) { transform: none; box-shadow: none; }
    button:active:not(:disabled) { transform: translateY(0.5px); }
    button.primary { background: var(--red); color: #fff; font-weight: 600; }
    button.primary:hover:not(:disabled) { background: var(--red-hover); box-shadow: none; }
    button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
    button:disabled { opacity: 0.45; }
    input[type="text"], textarea, select { font-family: var(--font-sans); border-radius: 8px; }
    input[type="text"]:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--ring); }
    .theme-toggle { width: 32px; height: 32px; border-radius: 8px; background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); }
    .theme-toggle:hover { background: var(--bg-surface-alt); color: var(--text-primary); }
    .theme-toggle svg { width: 16px; height: 16px; }
    .logout-btn { width: auto !important; height: 32px; padding: 0 12px !important; background: transparent !important; border: 1px solid var(--border-color) !important; color: var(--text-muted) !important; font-size: 13px; font-weight: 500; border-radius: 8px; }
    .logout-btn:hover { background: var(--bg-surface-alt) !important; color: var(--text-primary) !important; }

    /* ---- floating pill chrome (screens 2 + 3) ---- */
    #screen2 header, #screen3 header { display: block; background: var(--bg-page); color: var(--text-primary); box-shadow: none; padding: 14px 20px; }
    #screen3 header { padding: 12px 16px; }
    html[data-theme="dark"] #screen2 header { background: radial-gradient(900px 320px at 50% -170px, rgba(191,4,4,0.20), transparent 70%), var(--bg-page); }
    .hdr-pill { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 999px; padding: 8px 12px 8px 16px; }
    .hdr-brand { display: flex; align-items: center; gap: 12px; }
    .hdr-div { width: 1px; height: 18px; background: var(--border-color); }
    .brand-logo.small img { background: #FBFBFC; border-radius: 5px; padding: 2px; }
    .brand-logo .logo-name { font-weight: 700; letter-spacing: -0.01em; }
    #screen3 header .brand-row { gap: 12px; }
    #screen3 header .project-name { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-left: 2px; padding-left: 12px; border-left: 1px solid var(--border-color); }
    #backBtn { display: flex; align-items: center; gap: 7px; background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); padding: 7px 12px; font-size: 13px; margin-right: 0; }
    #sidebarToggleBtn { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); padding: 7px 11px; margin-right: 0; }
    #backBtn:hover, #sidebarToggleBtn:hover { background: var(--bg-surface-alt); }
    #sheetSwitcher { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 6px; padding: 6px 8px; font-family: var(--font-mono); font-size: 11px; }

    /* ---- screen 2: projects ---- */
    #screen2 { height: 100vh; display: flex; flex-direction: column; }
    #screen2 main { max-width: 880px; width: 100%; height: auto; flex: 1; min-height: 0; padding: 26px 24px 48px; }
    #screen2 .screen-title { align-items: flex-end; margin-bottom: 20px; }
    .title-block { display: flex; flex-direction: column; gap: 8px; }
    .title-block h1 { margin: 0; font-size: 38px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
    #screen2 .screen-title button.primary { display: flex; align-items: center; gap: 8px; padding: 12px 18px; font-size: 14px; }
    .search-bar-wrap input[type="text"] { background: var(--bg-surface); padding: 11px 34px 11px 38px !important; }
    .search-bar-wrap .search-icon { display: flex; color: var(--text-muted); }
    .search-bar-wrap .search-icon svg { width: 16px; height: 16px; }
    .project-card { background: var(--bg-surface); border-radius: 10px; padding: 15px 16px; margin-bottom: 8px; }
    .project-card:hover { border-color: var(--text-muted); background: var(--bg-surface-alt); box-shadow: none; transform: none; }
    .project-card .name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
    .chat-menu-btn { border-radius: 6px; }
    .list-end-msg { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
    .empty-state { font-size: 14px; }

    /* ---- screen 3: workspace ---- */
    #screen3 { height: 100vh; display: flex; flex-direction: column; }
    #screen3 .body { height: auto; flex: 1; min-height: 0; }
    #sidebar { background: var(--bg-surface-alt); box-shadow: none; }
    #sidebar .sidebar-header { padding: 14px; }
    #newChatBtn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px; font-size: 14px; }
    .chat-item { padding: 12px 14px; }
    .chat-item .chat-title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.005em; }
    .chat-item.active { background: var(--bg-surface); border-left-color: var(--red); box-shadow: none; }
    .chat-item .chat-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 7px; padding: 3px 9px; border-radius: 999px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
    .chat-item .chat-status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
    .chat-item .chat-status.st-progress { color: #C2820B; background: rgba(194,130,11,0.14); }
    .chat-item .chat-status.st-applied { color: #1F9D55; background: rgba(31,157,85,0.14); }
    html[data-theme="dark"] .chat-item .chat-status.st-progress { color: #E0A82E; }
    html[data-theme="dark"] .chat-item .chat-status.st-applied { color: #3CBB74; }

    #chatPanel { padding: 20px 24px; }
    .no-chat-selected { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 440px; }
    .no-chat-selected h3 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; color: var(--text-primary); }
    .no-chat-selected p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-muted); }
    #log { border-radius: 12px; padding: 18px; }
    #screen3 #log .you { background: var(--bg-surface-3); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 12px 12px 4px 12px; box-shadow: none; font-size: 14px; }
    #screen3 #log .agent { border-radius: 12px 12px 12px 4px; box-shadow: none; font-size: 14px; }
    #screen3 #log .err { background: var(--err-bg); border-color: rgba(191,4,4,0.5); color: var(--red); }
    #log button, .task-card button, .duplicate-card button, .edit-result-card button { background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-primary); }
    #log button.primary, .task-card button.primary, .duplicate-card button.primary, .edit-result-card button.primary { background: var(--red); border-color: var(--red); color: #fff; }
    .task-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-left: 2px solid var(--red); border-radius: 12px; box-shadow: none; }
    .task-card-title { font-size: 13px; font-weight: 700; letter-spacing: -0.01em; }
    .task-meta-pill, .dup-pill { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; border-radius: 999px; }
    .task-card td { font-size: 13px; }
    .task-card td:first-child { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
    .duplicate-card { border-radius: 12px; box-shadow: none; }
    .edit-result-card { border-radius: 12px; }
    .saving-badge { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
    #msgInputWrap textarea#msg { background: var(--bg-surface); border-radius: 10px; font-size: 14px; }
    #chatArea .row button.primary { border-radius: 8px; }
    .composer-hint { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-top: 8px; }

    /* ---- modals + toasts ---- */
    .modal-box { border: 1px solid var(--border-color); border-radius: 14px; }
    .modal-header { background: var(--bg-surface); color: var(--text-primary); border-bottom: 1px solid var(--border-color); padding: 18px 22px 15px; }
    .modal-header .modal-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
    .modal-header .modal-title span { color: var(--red); }
    .modal-header .modal-sub { color: var(--text-muted); }
    .modal-field label, .modal-section-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; }
    .modal-tabs { background: var(--bg-surface-alt); border: 1px solid var(--border-color); }
    .modal-tab { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
    .modal-tab.active { background: var(--bg-surface); border: 1px solid var(--border-color); box-shadow: none; }
    .drive-result-item.selected { background: var(--err-bg); border-left: 2px solid var(--red); }
    .settings-sheet-current a { color: var(--red); }
    .upload-drop:hover, .upload-drop.dragover { border-color: var(--red); background: var(--err-bg); }
    .toast { background: var(--black); border-radius: 10px; font-family: var(--font-sans); }
    .toast.error { background: var(--red); }
    .toast.success { background: #1F9D55; }

    /* ---- fixes ---- */
    #log, #chatList { overflow-x: hidden; }
    #screen3 header .project-name { white-space: nowrap; }
    .task-meta-pill, .dup-pill { white-space: nowrap; }
    #newChatBtn { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); font-weight: 600; }
    #newChatBtn:hover:not(:disabled) { background: var(--bg-surface); border-color: var(--text-muted); }
    #newChatBtn svg { stroke: var(--red); }
    #screen2 main::-webkit-scrollbar, #chatList::-webkit-scrollbar, #log::-webkit-scrollbar, #sidebar::-webkit-scrollbar { width: 8px; height: 8px; }
    #screen2 main::-webkit-scrollbar-track, #chatList::-webkit-scrollbar-track, #log::-webkit-scrollbar-track, #sidebar::-webkit-scrollbar-track { background: transparent; }
    #screen2 main::-webkit-scrollbar-thumb, #chatList::-webkit-scrollbar-thumb, #log::-webkit-scrollbar-thumb, #sidebar::-webkit-scrollbar-thumb { background: var(--bg-surface-3); border-radius: 999px; }
    #screen2 main::-webkit-scrollbar-thumb:hover, #chatList::-webkit-scrollbar-thumb:hover, #log::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }