*, *::before, *::after { box-sizing: border-box; }
.spinner { width: 28px; height: 28px; border: 3px solid #334155; border-top-color: #3b82f6; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
html, body, #app { margin: 0; padding: 0; height: 100%; width: 100%; overflow: hidden; touch-action: pan-x pan-y; }
/* position:fixed prevents iOS from scrolling the page when the virtual keyboard opens */
html { position: fixed; }
:root {
  --sat: env(safe-area-inset-top, 0px);
  --chrome-bg: #080d16;
  --chrome-panel: #0d1422;
  --chrome-panel-2: #111b2d;
  --chrome-line: rgba(125, 211, 252, 0.24);
  --chrome-line-soft: rgba(148, 163, 184, 0.16);
  --chrome-accent: #22d3ee;
  --chrome-accent-2: #34d399;
  --chrome-accent-3: #a78bfa;
  --chrome-warm: #f59e0b;
  --imcodes-app-font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --imcodes-app-cjk-font-family: 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}
/* Global: all fixed full-screen overlays respect iOS safe area (status bar/notch) */
.dialog-overlay, .ask-dialog-overlay, .fb-overlay, .mobile-fb-overlay { padding-top: var(--sat); }
@media (max-width: 640px) { .fb-body-split .fb-preview { padding-top: var(--sat); } }
body {
  background: var(--chrome-bg);
  color: #e2e8f0;
  font-family: var(--imcodes-app-font-family);
  font-size: 14px;
  overflow: hidden;
}

/* Layout — accounts for iOS safe area (status bar/notch) and mobile keyboard (--vvh) */
/* Layout — accounts for iOS safe area (status bar/notch) and mobile keyboard (--vvh) */
.layout { display: flex; height: calc(100vh - env(safe-area-inset-top, 0px)); height: calc(var(--vvh, 100dvh) - env(safe-area-inset-top, 0px)); margin-top: env(safe-area-inset-top); }
.sidebar { width: 220px; min-width: 180px; background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(125,211,252,0.025) 22px 23px), linear-gradient(180deg, #0d1422 0%, #080d16 100%); border-right: 1px solid rgba(34,211,238,0.18); box-shadow: inset -1px 0 0 rgba(255,255,255,0.035), 8px 0 24px rgba(0,0,0,0.24); display: flex; flex-direction: column; overflow-y: auto; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: #070b13; }

/* Sidebar */
.sidebar-header { padding: 16px; font-size: 12px; font-weight: 700; color: #dbeafe; letter-spacing: 0; text-transform: uppercase; border-bottom: 1px solid rgba(34,211,238,0.18); background: linear-gradient(180deg, rgba(34,211,238,0.12), rgba(15,23,42,0.08)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), inset 0 -1px 0 rgba(34,211,238,0.12); text-shadow: 0 0 10px rgba(34,211,238,0.18); }
.server-list { padding: 8px 0; flex: 1; overflow-y: auto; }
.server-item { display: flex; align-items: center; gap: 7px; width: 100%; padding: 8px 16px; cursor: pointer; color: #cbd5e1; border-left: 3px solid transparent; border-top: none; border-right: none; border-bottom: none; background: none; transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s; font-size: 13px; font-family: inherit; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-item:hover { background: rgba(8,145,178,0.14); color: #f1f5f9; box-shadow: inset 0 1px 0 rgba(255,255,255,0.035); }
.server-item.active { background: linear-gradient(90deg, rgba(34,211,238,0.18), rgba(15,23,42,0.30)); border-left-color: var(--chrome-accent); color: #bfdbfe; box-shadow: inset 0 0 18px rgba(34,211,238,0.08); }
.server-item.offline { color: #64748b; }
.server-item-dot { font-size: 8px; flex-shrink: 0; }
.server-ctx-menu { background: linear-gradient(180deg, rgba(17,27,45,0.98), rgba(8,13,22,0.98)); border: 1px solid rgba(125,211,252,0.18); border-radius: 7px; min-width: 148px; box-shadow: 0 12px 28px rgba(0,0,0,0.44), inset 0 1px 0 rgba(255,255,255,0.04); z-index: 200; overflow: hidden; }
.server-ctx-item { display: block; width: 100%; padding: 9px 14px; background: none; border: none; color: #cbd5e1; font-size: 13px; font-family: inherit; text-align: left; cursor: pointer; }
.server-ctx-item:hover { background: rgba(8,145,178,0.16); color: #eff6ff; }
.server-ctx-item-danger { color: #f87171; }
.server-ctx-item-danger:hover { background: #7f1d1d40; }
.sidebar-stats { padding: 8px 16px; border-top: 1px solid rgba(34,211,238,0.16); background: rgba(8,13,22,0.34); font-size: 11px; }
.sidebar-stats-row { display: flex; justify-content: space-between; margin-bottom: 4px; }

/* Session tabs */
.tab-bar { display: flex; align-items: stretch; gap: 2px; padding: 4px 8px 0; background: linear-gradient(180deg, #0a1220 0%, #080d16 100%); border-bottom: 1px solid rgba(34,211,238,0.18); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 6px 20px rgba(0,0,0,0.28); overflow-x: auto; flex-shrink: 0; scrollbar-width: none; min-height: 42px; position: relative; }
.tab-bar::before { content: ''; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, rgba(34,211,238,0.8), rgba(52,211,153,0.7), transparent); pointer-events: none; }
.tab-bar::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(125,211,252,0.035) 22px 23px); pointer-events: none; opacity: 0.72; }
.tab-bar::-webkit-scrollbar { display: none; }
.tab-wrap { display: flex; align-items: stretch; transition: transform 0.15s; position: relative; z-index: 1; }
.tab-wrap[draggable] { cursor: grab; }
.tab-wrap.tab-drop-target { border-left: 2px solid var(--chrome-accent); filter: drop-shadow(0 0 8px rgba(34,211,238,0.45)); }
.tab-dragging { opacity: 0.4; }
.tab-pin { font-size: 10px; margin-right: 4px; color: var(--chrome-warm); filter: drop-shadow(0 0 4px rgba(245,158,11,0.42)); }
.tab.pinned { box-shadow: inset 0 1px 0 rgba(245,158,11,0.28); }
.tab { min-height: 34px; padding: 0 15px; cursor: pointer; color: #7b8797; border: 1px solid transparent; border-bottom: none; border-radius: 7px 7px 0 0; white-space: nowrap; font-size: 12px; font-weight: 600; transition: color 0.14s, background 0.14s, border-color 0.14s, box-shadow 0.14s; background: rgba(15,23,42,0.38); display: flex; align-items: center; position: relative; overflow: hidden; }
.tab::before { content: ''; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; border-radius: 999px 999px 0 0; background: transparent; pointer-events: none; }
.tab:hover { color: #dbeafe; background: rgba(15,23,42,0.86); border-color: rgba(125,211,252,0.2); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); }
.tab.active { color: #f8fafc; background: linear-gradient(180deg, rgba(34,211,238,0.16), rgba(15,23,42,0.92)); border-color: rgba(34,211,238,0.32); box-shadow: 0 0 0 1px rgba(34,211,238,0.10), 0 0 18px rgba(34,211,238,0.14), inset 0 1px 0 rgba(255,255,255,0.06); }
.tab.active::before { background: linear-gradient(90deg, var(--chrome-accent), var(--chrome-accent-2)); box-shadow: 0 0 10px rgba(34,211,238,0.62); }
.tab.brain { color: #c4b5fd; }
.tab.brain.active { color: #ede9fe; background: linear-gradient(180deg, rgba(167,139,250,0.18), rgba(15,23,42,0.94)); border-color: rgba(167,139,250,0.34); border-top-color: transparent; border-bottom-color: #8b5cf6; border-bottom-width: 2px; box-shadow: 0 0 0 1px rgba(167,139,250,0.12), 0 0 18px rgba(167,139,250,0.16), inset 0 1px 0 rgba(255,255,255,0.06); }
.tab.brain.active::before { background: linear-gradient(90deg, var(--chrome-accent-3), var(--chrome-accent)); box-shadow: 0 0 10px rgba(167,139,250,0.62); }
@media (pointer: coarse) { .tab { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: pan-x; } }
.tab.idle::after { content: '●'; margin-left: 6px; color: var(--chrome-accent-2); font-size: 7px; vertical-align: middle; text-shadow: 0 0 8px rgba(52,211,153,0.75); }
.tab.busy::after { content: '◌'; margin-left: 6px; color: var(--chrome-warm); font-size: 7px; vertical-align: middle; animation: spin 1s linear infinite; text-shadow: 0 0 8px rgba(245,158,11,0.7); }
@keyframes spin { to { transform: rotate(360deg); } }
/* Alert pulse: session just went idle (task completed) */
.tab.alert { animation: tab-alert 0.5s ease-in-out 6; }
@keyframes tab-alert { 0%, 100% { background: transparent; box-shadow: none; border-color: transparent; } 50% { background: #3a1c1c; box-shadow: 0 0 12px #ef444480 inset, 0 0 4px #ef444440; border-color: #ef4444; } }
.tab.alert.active { animation: tab-alert-active 0.5s ease-in-out 6; }
@keyframes tab-alert-active { 0%, 100% { background: #161b22; border-color: #3b82f6; } 50% { background: #3a1c1c; box-shadow: 0 0 14px #ef444490 inset; border-color: #ef4444; } }
/* WS dot inline on active tab */
.tab-ws-dot { margin-left: 6px; font-size: 7px; line-height: 1; vertical-align: middle; flex-shrink: 0; text-shadow: 0 0 8px currentColor; }
.tab-latency { font-size: 9px; font-family: monospace; margin-left: 2px; vertical-align: middle; }
.tab-tool { margin-left: 5px; font-size: 9px; color: var(--chrome-accent); opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60px; vertical-align: middle; }
.tab-rename-input { padding: 0 10px; height: 34px; margin-top: 4px; background: #0b1220; border: 1px solid var(--chrome-accent); border-radius: 7px 7px 0 0; color: #e6edf3; font-family: inherit; font-size: 12px; outline: none; width: 120px; box-shadow: 0 0 12px rgba(34,211,238,0.18); }
.tab-add-btn { width: 30px; height: 30px; margin: 3px 2px 4px; padding: 0; background: rgba(15,23,42,0.62); border: 1px solid rgba(125,211,252,0.18); border-radius: 7px; color: #64748b; font-size: 16px; cursor: pointer; transition: color 0.12s, border-color 0.12s, background 0.12s, box-shadow 0.12s; flex-shrink: 0; align-self: center; line-height: 1; position: relative; z-index: 1; }
.tab-add-btn:hover { color: var(--chrome-accent); border-color: rgba(34,211,238,0.5); background: rgba(8,145,178,0.16); box-shadow: 0 0 12px rgba(34,211,238,0.18); }
.tab-empty { padding: 0 16px; color: #4b5563; font-size: 12px; display: flex; align-items: center; }
/* Toast notifications */
.toast-container { position: fixed; bottom: 80px; right: 16px; z-index: 500; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: #1c2128; border: 1px solid #3fb950; border-radius: 8px; padding: 10px 14px; color: #e6edf3; font-size: 13px; display: flex; align-items: center; gap: 8px; cursor: pointer; pointer-events: all; box-shadow: 0 4px 16px #00000080; animation: toast-in 0.25s ease; min-width: 200px; max-width: 280px; }
.toast:hover { background: #21291f; }
.toast-notification { border-color: #60a5fa; }
.toast-notification:hover { background: #1a2033; }
.toast-notification .toast-icon { color: #60a5fa; }
.toast-icon { color: #3fb950; font-size: 15px; flex-shrink: 0; }
.toast-body { flex: 1; font-size: 13px; }
.toast-close { background: none; border: none; color: #6e7681; cursor: pointer; font-size: 12px; padding: 0 0 0 4px; flex-shrink: 0; line-height: 1; }
.toast-close:hover { color: #e6edf3; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .toast-container { bottom: 130px; right: 8px; left: 8px; } .toast { max-width: 100%; } }
.tab-context-menu { position: fixed; background: #1c2128; border: 1px solid #30363d; border-radius: 6px; min-width: 150px; box-shadow: 0 8px 24px #00000080; z-index: 100; overflow: hidden; }
.menu-divider { height: 1px; background: #21262d; margin: 2px 0; }

/* Terminal */
.terminal-container { flex: 1; min-height: 0; overflow: hidden; background: #0f0f13; }
/* Hide xterm's built-in scrollbar — frees up width for FitAddon so tmux cols match visual width */
.xterm-viewport { scrollbar-width: none; }
.xterm-viewport::-webkit-scrollbar { display: none; }
/* xterm's CharSizeService injects a hidden <span class="xterm-char-measure-element">
   with textContent = "W".repeat(32) for each Terminal instance. Even though the
   element is visibility:hidden + position:absolute left:-9999em, mobile WebViews
   (iOS Safari/Android WebView) still include its text in Select-All. With many
   terminal sessions open, that's hundreds of "W"s pasted at the end of any
   document-wide copy (e.g. when the user opens the chat zoom dialog and uses the
   native "Select All" callout). Belt-and-suspenders: also mark it inert/aria-hidden
   semantics with user-select:none and -webkit-user-select:none. */
.xterm-char-measure-element {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  pointer-events: none !important;
}

/* Terminal scroll overlay — progress bar + scroll-to-bottom */
.term-scroll-track { position: absolute; right: 2px; top: 4px; bottom: 4px; width: 4px; border-radius: 2px; background: #ffffff10; opacity: 1; transition: opacity 0.3s; pointer-events: none; z-index: 5; }
.term-scroll-thumb { position: absolute; width: 100%; height: 24px; border-radius: 2px; background: #64748b; transform: translateY(-50%); }
.term-scroll-bottom { position: absolute; right: 12px; bottom: 12px; width: 32px; height: 32px; border-radius: 50%; background: #1e293bee; border: 1px solid #475569; color: #93c5fd; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 5; transition: background 0.15s, transform 0.15s; box-shadow: 0 2px 8px #00000060; line-height: 1; }
.term-scroll-bottom:hover { background: #334155; transform: scale(1.1); }
.term-scroll-bottom:active { transform: scale(0.95); }

/* Controls — flex-shrink: 0 so keyboard doesn't push it off screen */
.session-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.session-pane-inactive { display: none; }
.controls-wrapper {
  background: linear-gradient(180deg, #0b1220 0%, #080d16 100%);
  border-top: 1px solid rgba(34,211,238,0.18);
  box-shadow: 0 -8px 22px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.04);
  flex-shrink: 0;
}
@keyframes scan-sweep { 0% { left: -60%; } 100% { left: 130%; } }
.controls-wrapper { position: relative; }
.controls-wrapper::before { content: ''; position: absolute; top: -1px; left: -60%; width: 60%; height: 2px; background: linear-gradient(90deg, transparent, #00e5ff, #818cf8, #00e5ff, transparent); z-index: 2; opacity: 0; transition: opacity 0.3s ease-out; }
.controls-wrapper::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(125,211,252,0.025) 22px 23px); opacity: 0.55; pointer-events: none; }
.controls-wrapper-running::before { animation: scan-sweep 3s linear infinite; opacity: 1; }
.session-file-drop-overlay {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border: 2px dashed rgba(34, 211, 238, 0.72);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 50%, rgba(34, 211, 238, 0.20), rgba(15, 23, 42, 0.76) 58%, rgba(2, 6, 23, 0.88)),
    repeating-linear-gradient(135deg, rgba(125, 211, 252, 0.12) 0 10px, rgba(125, 211, 252, 0.04) 10px 20px);
  box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.14), inset 0 0 42px rgba(34, 211, 238, 0.14), 0 18px 46px rgba(0, 0, 0, 0.36);
  pointer-events: none;
  z-index: 9999;
  backdrop-filter: blur(2px);
  animation: session-file-drop-pulse 1.05s ease-in-out infinite alternate;
}
.session-file-drop-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: min(320px, 80vw);
  padding: 14px 18px;
  border: 1px solid rgba(125, 211, 252, 0.32);
  border-radius: 8px;
  background: rgba(8, 13, 22, 0.72);
  color: #e0f2fe;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}
.session-file-drop-icon { font-size: 26px; line-height: 1; filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.45)); }
.session-file-drop-title { font-size: 14px; font-weight: 700; letter-spacing: 0.01em; }
.session-file-drop-hint { font-size: 12px; line-height: 1.35; color: #93c5fd; }
@keyframes session-file-drop-pulse {
  from { border-color: rgba(34, 211, 238, 0.52); box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.10), inset 0 0 32px rgba(34, 211, 238, 0.10), 0 18px 46px rgba(0, 0, 0, 0.32); }
  to { border-color: rgba(96, 165, 250, 0.92); box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.20), inset 0 0 54px rgba(34, 211, 238, 0.20), 0 18px 46px rgba(0, 0, 0, 0.38); }
}
.shortcuts-row { display: flex; align-items: center; border-bottom: 1px solid rgba(125,211,252,0.14); background: linear-gradient(180deg, rgba(17,27,45,0.58), rgba(8,13,22,0.24)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.035); position: relative; z-index: 1; }
.shortcuts { display: flex; gap: 4px; padding: 4px 8px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.shortcuts-transport { flex: 1 1 auto; min-width: 0; margin-left: 0; padding-left: 0; }
.shortcuts::-webkit-scrollbar { display: none; }
.shortcuts-model { padding: 4px 8px 4px 0; flex-shrink: 0; position: relative; }
.session-ctx-wrap { display: flex; align-items: center; gap: 4px; padding: 4px 8px 4px 0; flex-shrink: 0; cursor: default; }
.session-ctx-label { font-size: 10px; color: #7b8797; white-space: nowrap; }
.session-ctx-bar { position: relative; width: 60px; height: 5px; background: rgba(15,23,42,0.92); border: 1px solid rgba(125,211,252,0.14); border-radius: 999px; overflow: hidden; box-shadow: inset 0 0 8px rgba(0,0,0,0.42), 0 0 10px rgba(34,211,238,0.06); }
.session-ctx-bar::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent); opacity: 0.45; pointer-events: none; }
.session-ctx-input { position: absolute; left: 0; top: 0; height: 100%; background: linear-gradient(90deg, var(--chrome-accent-2), var(--chrome-accent)); border-radius: 999px; box-shadow: 0 0 10px rgba(52,211,153,0.42); }
.session-ctx-cache { position: absolute; left: 0; top: 0; height: 100%; background: linear-gradient(90deg, var(--chrome-accent-3), #818cf8); border-radius: 999px; box-shadow: 0 0 10px rgba(129,140,248,0.36); }
.shortcut-btn { flex-shrink: 0; padding: 4px 8px; background: rgba(15,23,42,0.58); border: 1px solid rgba(125,211,252,0.16); border-radius: 7px; color: #7b8797; font-size: 11px; font-family: inherit; cursor: pointer; transition: color 0.12s, border-color 0.12s, background 0.12s, box-shadow 0.12s; white-space: nowrap; box-shadow: inset 0 1px 0 rgba(255,255,255,0.03); touch-action: manipulation; }
/* Instant optimistic feedback while a stop is in flight (before the session
   state round-trip + provider interrupt land). */
.shortcut-btn-stop-pending { animation: shortcut-btn-stop-pulse 0.42s ease-in-out infinite; border-color: rgba(248,113,113,0.95) !important; background: rgba(127,29,29,0.72) !important; color: #fecaca !important; text-shadow: 0 0 10px rgba(254,202,202,0.85); position: relative; z-index: 2; }
@keyframes shortcut-btn-stop-pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(239,68,68,0), inset 0 0 0 1px rgba(254,202,202,0.12); }
  42% { opacity: 0.56; transform: scale(1.16); box-shadow: 0 0 24px 5px rgba(248,113,113,0.62), 0 0 44px 10px rgba(220,38,38,0.34), inset 0 0 18px rgba(254,202,202,0.36); }
  68% { opacity: 1; transform: scale(1.08); box-shadow: 0 0 14px 3px rgba(248,113,113,0.48), inset 0 0 14px rgba(254,202,202,0.28); }
}
/* Agent task list (TodoWrite / todo_write / update_plan) — pinned checklist at
   the top of the chat scroll viewport, auto-updating as the agent progresses. */
.agent-todos { position: sticky; top: 0; z-index: 5; margin: 0 0 10px; padding: 9px 10px; background: linear-gradient(180deg, rgba(30,47,76,0.96), rgba(14,22,36,0.98)), rgba(15,23,42,0.98); border: 1px solid rgba(147,197,253,0.48); border-radius: 10px; box-shadow: 0 0 0 1px rgba(59,130,246,0.18) inset, 0 8px 22px rgba(0,0,0,0.42), 0 0 18px rgba(59,130,246,0.12); backdrop-filter: blur(6px); }
.agent-todos::before { content: ''; display: block; height: 2px; margin: -9px -10px 8px; border-radius: 10px 10px 0 0; background: linear-gradient(90deg, rgba(96,165,250,0.82), rgba(52,211,153,0.58), rgba(168,85,247,0.72)); opacity: 0.85; }
.agent-todos-complete { opacity: 0.72; }
.agent-todos-header { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; width: 100%; padding: 0; background: none; border: none; cursor: pointer; font: inherit; text-align: left; color: inherit; }
.agent-todos-collapsed .agent-todos-header { margin-bottom: 0; }
.agent-todos-collapsed::before { margin-bottom: 7px; }
.agent-todos-chevron { font-size: 10px; color: #93c5fd; flex-shrink: 0; line-height: 1; }
.agent-todos-title { font-size: 12px; font-weight: 700; color: #e2e8f0; letter-spacing: 0.02em; }
.agent-todos-count { font-size: 11px; color: #bfdbfe; font-variant-numeric: tabular-nums; flex-shrink: 0; margin-left: auto; }
.agent-todos-header:hover .agent-todos-title { color: #f8fafc; }
.agent-todos-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; max-height: 188px; overflow-y: auto; }
.agent-todos-item { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px; line-height: 1.4; color: #cbd5e1; }
.agent-todos-icon { flex-shrink: 0; width: 14px; text-align: center; line-height: 1.4; }
.agent-todos-text { min-width: 0; word-break: break-word; }
.agent-todos-item-pending .agent-todos-icon { color: #5f7087; }
.agent-todos-item-in_progress .agent-todos-text { color: #f8fafc; font-weight: 600; }
.agent-todos-item-in_progress .agent-todos-icon { color: #38bdf8; }
.agent-todos-item-completed .agent-todos-icon { color: #34d399; }
.agent-todos-item-completed .agent-todos-text { color: #6b7a8d; text-decoration: line-through; }
.shortcut-btn:hover:not(:disabled) { background: rgba(8,145,178,0.14); border-color: rgba(34,211,238,0.42); color: #dbeafe; box-shadow: 0 0 12px rgba(34,211,238,0.12), inset 0 1px 0 rgba(255,255,255,0.05); }
.shortcut-btn:disabled { opacity: 0.4; cursor: default; }
.shortcut-btn-wide { padding-left: 14px; padding-right: 14px; }
.shortcut-btn-icon { width: 28px; min-width: 28px; padding: 4px 0; display: inline-flex; align-items: center; justify-content: center; }
.shortcut-btn-stop { width: 44px; min-width: 44px; font-size: 18px; line-height: 1; }
/* Mobile arrow D-pad — replaces the separate up/down buttons on small screens.
 * Drag toward a direction to send that arrow key. touch-action:none keeps the
 * drag from scrolling the page; the four glyphs sit around a center. */
.shortcut-dpad { position: relative; width: 36px; min-width: 36px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.shortcut-dpad .dpad-arrow { position: absolute; font-size: 7px; line-height: 1; color: #5b6573; pointer-events: none; transition: color 0.1s, text-shadow 0.1s; }
.shortcut-dpad .dpad-arrow-up { top: 3px; left: 50%; transform: translateX(-50%); }
.shortcut-dpad .dpad-arrow-down { bottom: 3px; left: 50%; transform: translateX(-50%); }
.shortcut-dpad .dpad-arrow-left { left: 4px; top: 50%; transform: translateY(-50%); }
.shortcut-dpad .dpad-arrow-right { right: 4px; top: 50%; transform: translateY(-50%); }
.shortcut-dpad.shortcut-dpad-active { border-color: rgba(34,211,238,0.5); background: rgba(8,145,178,0.16); box-shadow: 0 0 12px rgba(34,211,238,0.14), inset 0 1px 0 rgba(255,255,255,0.05); }
.shortcut-dpad.dpad-dir-up .dpad-arrow-up,
.shortcut-dpad.dpad-dir-down .dpad-arrow-down,
.shortcut-dpad.dpad-dir-left .dpad-arrow-left,
.shortcut-dpad.dpad-dir-right .dpad-arrow-right { color: #67e8f9; text-shadow: 0 0 6px rgba(34,211,238,0.7); }
.shortcut-dpad[data-disabled="true"] { opacity: 0.4; pointer-events: none; }
/* Tool-call toggle wrench (UsageFooter). Three visual states correspond to
 * the show_tool_calls preference:
 *   - off  → grey border, dim icon (default tool-row hidden state)
 *   - on   → green border, full-color icon (developer view active)
 *   - undecided → grey border with a pulsing green ring (drawing the user's
 *                 eye to make the first-run choice). */
.shortcut-btn-tools { font-size: 13px; line-height: 1; opacity: 0.68; filter: grayscale(0.45); border-color: rgba(125,211,252,0.18); }
.shortcut-btn-tools:hover:not(:disabled) { opacity: 1; filter: none; border-color: rgba(34,211,238,0.42); color: #dbeafe; background: rgba(8,145,178,0.14); }
.shortcut-btn-tools.is-on { background: rgba(20,83,45,0.28); border-color: rgba(52,211,153,0.62); color: #86efac; opacity: 1; filter: none; box-shadow: 0 0 0 1px rgba(52,211,153,0.18), 0 0 12px rgba(52,211,153,0.16); }
.shortcut-btn-tools.is-on:hover:not(:disabled) { background: rgba(20,83,45,0.42); border-color: rgba(74,222,128,0.78); color: #bbf7d0; }
.shortcut-btn-tools.is-undecided { animation: shortcut-btn-tools-pulse 2.4s ease-in-out infinite; }
.shortcut-btn-memory-sync { font-size: 14px; line-height: 1; border-color: rgba(125,211,252,0.18); color: #93c5fd; }
.shortcut-btn-memory-sync:hover:not(:disabled) { background: rgba(8,145,178,0.14); border-color: rgba(34,211,238,0.46); color: #bfdbfe; }
.shortcut-btn-memory-sync.is-busy { animation: shortcut-btn-memory-sync-spin 0.9s linear infinite; }
@keyframes shortcut-btn-memory-sync-spin {
  to { transform: rotate(360deg); }
}
@keyframes shortcut-btn-tools-pulse {
  0%, 100% { opacity: 0.6; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
  50%      { opacity: 1;   box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25); }
}
/* Wrapper lets us anchor the undecided-state bubble above the button. */
.shortcut-btn-tools-wrapper { position: relative; display: inline-flex; align-items: center; }
/* Speech bubble that prompts the user to make the first-run choice. Sits
 * above the wrench, with a tail pointing down to the button. Removed from
 * the DOM the moment the show_tool_calls preference is set. */
.shortcut-btn-tools-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 9px;
  background: #14532d;
  border: 1px solid #22c55e;
  border-radius: 6px;
  color: #bbf7d0;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(34, 197, 94, 0.25);
  animation: shortcut-btn-tools-bubble-bob 2.4s ease-in-out infinite;
  z-index: 5;
}
.shortcut-btn-tools-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #22c55e;
  filter: drop-shadow(0 1px 0 #14532d);
}
.shortcut-btn-tools-bubble::before {
  content: '';
  position: absolute;
  top: calc(100% - 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #14532d;
  z-index: 1;
}
@keyframes shortcut-btn-tools-bubble-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(-2px); }
}

/* First-time tool-call view chooser shown above the chat timeline. */
.chat-tool-chooser { margin: 12px 16px; padding: 14px 16px; background: linear-gradient(180deg, #0f1d33 0%, #0d1729 100%); border: 1px solid #1e3a5f; border-radius: 8px; color: #cbd5e1; }
.chat-tool-chooser-title { font-size: 13px; font-weight: 600; color: #e2e8f0; margin-bottom: 2px; }
.chat-tool-chooser-subtitle { font-size: 11px; color: #94a3b8; margin-bottom: 12px; }
.chat-tool-chooser-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.chat-tool-chooser-btn { flex: 1 1 180px; min-width: 160px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 10px 12px; background: #0b1729; border: 1px solid #334155; border-radius: 6px; color: #cbd5e1; cursor: pointer; transition: all 0.12s; text-align: left; font-family: inherit; }
.chat-tool-chooser-btn:hover { background: #142845; border-color: #3b82f6; color: #e2e8f0; }
.chat-tool-chooser-btn-icon { grid-row: 1 / span 2; font-size: 22px; line-height: 1; }
.chat-tool-chooser-btn-label { font-size: 12px; font-weight: 600; color: #e2e8f0; }
.chat-tool-chooser-btn-hint { font-size: 11px; color: #94a3b8; }
.chat-tool-chooser-btn-developer:hover { border-color: #60a5fa; }
.chat-tool-chooser-footnote { font-size: 10px; color: #64748b; margin-top: 10px; }
.shortcut-btn-auto { display: inline-flex; align-items: center; gap: 5px; padding-left: 8px; padding-right: 8px; font-weight: 600; }
.shortcut-btn-auto-dot { width: 6px; height: 6px; border-radius: 999px; flex-shrink: 0; }
.shortcut-btn-auto-label { letter-spacing: 0.01em; }
.shortcut-btn-auto-caret { font-size: 10px; line-height: 1; opacity: 0.85; }
.p2p-mode-btn { letter-spacing: 0.01em; }
.p2p-mode-btn-solo { background: #132033; border-color: #425a78; box-shadow: inset 0 0 0 1px rgba(219, 231, 245, 0.08); }
.p2p-mode-btn-solo:hover:not(:disabled) { background: #1a3150; border-color: #60a5fa; color: #f8fafc; }
.p2p-settings-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; color: #dbe7f5; }
.p2p-settings-btn:hover:not(:disabled) { color: #eff6ff; }
.p2p-settings-icon { font-size: 12px; line-height: 1; }
.p2p-settings-label { font-size: 11px; font-weight: 600; letter-spacing: 0.01em; }
.controls { padding: 6px 8px; display: flex; gap: 6px; align-items: center; position: relative; z-index: 1; background: linear-gradient(180deg, rgba(8,13,22,0.12), rgba(8,13,22,0.36)); }
.controls-composer { position: relative; flex: 1; min-width: 0; display: flex; align-items: stretch; }
.controls-composer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  z-index: 4090;
}
.controls-input-with-trailing { padding-right: 64px; }
.btn-input-expand {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(15,23,42,0.82);
  border: 1px solid rgba(125,211,252,0.18);
  color: #cbd5e1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.btn-input-expand:hover,
.btn-input-expand:active {
  background: rgba(8,145,178,0.18);
  border-color: rgba(34,211,238,0.5);
  color: #f8fafc;
  box-shadow: 0 0 12px rgba(34,211,238,0.18), inset 0 1px 0 rgba(255,255,255,0.06);
}
.btn-input-expand-floating {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 2;
}
.btn-voice-embedded {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
}
.controls-queued-hint {
  margin: 0 8px 8px;
  padding: 8px 10px;
  color: #fbbf24;
  font-size: 12px;
  line-height: 1.35;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  pointer-events: auto;
}
/* Collapsed-state pill: just a count chip, shown only when the user has
   chosen to hide the full queue list. Keeps vertical space above the
   composer minimal (the full hint was previously taking 3+ lines). */
.controls-queued-pill {
  align-self: flex-start;
  margin: 0 8px 6px;
  padding: 3px 10px 3px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: max-content;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 999px;
  color: #fbbf24;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  pointer-events: auto;
  font-family: inherit;
}
.controls-queued-pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fbbf24;
  flex-shrink: 0;
}
.controls-queued-pill:hover { color: #fde68a; border-color: rgba(251, 191, 36, 0.6); }
.controls-queued-pill:hover::before { background: #fde68a; }
.controls-queued-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.controls-queued-toggle {
  border: none;
  background: transparent;
  color: #fcd34d;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.controls-queued-toggle:hover { color: #fde68a; }
.controls-queued-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.controls-queued-summary {
  color: #cbd5e1;
  font-size: 11px;
}
.controls-queued-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.88);
  border: 1px solid rgba(251, 191, 36, 0.18);
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: calc(1.35em * 2 + 14px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.controls-queued-item-text {
  flex: 1;
  min-width: 0;
}
.controls-queued-item-status {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 999px;
  flex-shrink: 0;
  background: #fbbf24;
}
.controls-queued-item-status-sending {
  background: #38bdf8;
  animation: queued-status-pulse 1s ease-in-out infinite;
}
.controls-queued-item-status-failed {
  background: #fb7185;
}
@keyframes queued-status-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
.controls-queued-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.controls-queued-action {
  border: none;
  background: transparent;
  color: #fcd34d;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.controls-queued-action:hover { color: #fde68a; }
.controls-queued-action-danger { color: #fda4af; }
.controls-queued-action-danger:hover { color: #fecdd3; }
.controls-queued-editing {
  margin: 0 8px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #cbd5e1;
}
.attachment-badges { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 8px 2px; position: relative; z-index: 1; }
.attachment-badge { display: inline-flex; align-items: center; gap: 4px; background: rgba(15,23,42,0.72); border: 1px solid rgba(125,211,252,0.16); border-radius: 999px; padding: 2px 8px 2px 6px; font-size: 12px; color: #94a3b8; max-width: 200px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.03); }
.attachment-badge-icon { font-size: 11px; flex-shrink: 0; }
.attachment-badge-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-badge-remove { background: none; border: none; color: #64748b; cursor: pointer; font-size: 14px; padding: 0 2px; line-height: 1; }
.attachment-badge-remove:hover { color: #ef4444; }
.quote-badge { border-color: rgba(167,139,250,0.42); background: rgba(76,29,149,0.28); }
.quote-badge .attachment-badge-icon { color: #a78bfa; }
.controls-input { flex: 1; min-width: 0; background: linear-gradient(180deg, rgba(15,23,42,0.92), rgba(8,13,22,0.94)); border: 1px solid rgba(125,211,252,0.18); color: #e2e8f0; padding: 7px 11px; border-radius: 7px; font-family: inherit; font-size: 13px; outline: none; overflow-y: auto; min-height: 32px; max-height: 120px; line-height: 1.45; word-break: break-word; white-space: pre-wrap; text-align: left !important; direction: ltr; -webkit-user-modify: read-write-plaintext-only; box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), inset 0 0 18px rgba(34,211,238,0.025); transition: border-color 0.14s, box-shadow 0.14s, background 0.14s; }
.controls-input:focus { border-color: rgba(34,211,238,0.62); box-shadow: 0 0 0 1px rgba(34,211,238,0.14), 0 0 16px rgba(34,211,238,0.12), inset 0 1px 0 rgba(255,255,255,0.055); background: linear-gradient(180deg, rgba(15,40,62,0.72), rgba(8,13,22,0.94)); }
.controls-input-file-drag-over { border-color: rgba(96,165,250,0.82); box-shadow: 0 0 0 1px rgba(96,165,250,0.42), 0 0 18px rgba(59,130,246,0.2), inset 0 1px 0 rgba(255,255,255,0.06); background: linear-gradient(180deg, rgba(20,53,82,0.74), rgba(8,13,22,0.94)); }
.controls-input-p2p { background: linear-gradient(180deg, rgba(44,27,60,0.64), rgba(15,18,32,0.94)); }
.controls-input-p2p:focus { border-color: inherit; }
.controls-input-disabled { opacity: 0.4; pointer-events: none; }
/* Placeholder via CSS when empty */
.controls-input:empty::before { content: attr(data-placeholder); color: #5f7087; pointer-events: none; }
/* Menu dropdown */
.menu-wrap { position: relative; }
.menu-dropdown { position: absolute; bottom: calc(100% + 4px); right: 0; background: #1e293b; border: 1px solid #334155; border-radius: 6px; min-width: 200px; max-width: calc(100vw - 16px); max-height: 60vh; overflow-y: auto; box-shadow: 0 4px 16px #00000060; z-index: 50; }
.menu-dropdown-auto { left: 0; right: auto; min-width: 168px; max-width: min(220px, calc(100vw - 24px)); }
.menu-dropdown-models { min-width: min(260px, calc(100vw - 24px)); max-width: min(320px, calc(100vw - 24px)); }
.menu-dropdown-openspec { width: max-content; min-width: min(380px, calc(100vw - 24px)); max-width: calc(100vw - 24px); overscroll-behavior: contain; display: flex; flex-direction: column; z-index: 2147483646; }
.menu-dropdown-openspec-inline { position: absolute; right: 0; bottom: calc(100% + 4px); }
.menu-dropdown-openspec .menu-item,
.menu-dropdown-openspec .p2p-menu-section-label { white-space: nowrap; }
.openspec-dropdown-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 2px; }
.openspec-dropdown-footer { flex-shrink: 0; margin-top: 8px; padding: 8px 0 0; border-top: 1px solid rgba(148, 163, 184, 0.18); }
.openspec-footer-action-wrap { width: 100%; }
.openspec-section-label { margin-top: 0; }
.openspec-section-meta { text-transform: none; letter-spacing: normal; margin-top: 4px; }
.openspec-section-error { color: #fca5a5; }
.openspec-change-row { display: flex; align-items: center; gap: 6px; }
.openspec-change-header { display: contents; }
.openspec-change-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; overflow: hidden; text-overflow: ellipsis; }
.openspec-change-ref-prefix { flex-shrink: 0; color: #fb923c; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; font-size: 12px; font-weight: 800; line-height: 1; }
.openspec-change-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.openspec-change-folder-btn { flex-shrink: 0; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #334155; border-radius: 6px; background: rgba(15, 23, 42, 0.32); color: #cbd5e1; cursor: pointer; padding: 0; }
.openspec-change-folder-btn:hover { background: #334155; border-color: #475569; }
.openspec-change-folder-btn .fb-create-icon-folder { transform: scale(0.9); transform-origin: center; }
.openspec-change-toggle { display: none; flex-shrink: 0; width: 30px; height: 30px; border: none; border-radius: 6px; background: transparent; color: #94a3b8; cursor: pointer; font-size: 14px; font-weight: 700; line-height: 1; }
.openspec-change-toggle:hover { background: #334155; color: #e2e8f0; }
.openspec-change-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.openspec-change-action-wrap { position: relative; flex-shrink: 0; }
.openspec-change-action-btn { padding: 4px 8px; font-size: 11px; white-space: nowrap; }
.openspec-submenu { z-index: 2147483647; }
.openspec-submenu-inline { position: static; width: 100%; min-width: 0; max-width: none; max-height: none; margin-top: 6px; overflow: visible; }
.openspec-folder-overlay { z-index: 2147483645; }
.openspec-folder-modal { width: min(94vw, 980px); height: min(84vh, 760px); max-height: min(84vh, 760px); }
.openspec-folder-header { min-width: 0; gap: 10px; }
.menu-dropdown-p2p {
  z-index: 10001;
  width: min(360px, calc(100vw - 24px));
  min-width: 280px;
  max-width: min(560px, calc(100vw - 24px));
  max-height: none;
  padding: 8px;
  overflow-y: visible;
  border: 1px solid rgba(96, 165, 250, 0.24);
  border-radius: 12px;
  background:
    radial-gradient(circle at 18% 0%, rgba(59, 130, 246, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94));
  box-shadow: 0 18px 46px rgba(2, 6, 23, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.menu-dropdown-p2p .p2p-dropdown-rounds {
  display: grid;
  gap: 7px;
  padding: 9px 10px 8px;
  margin: 0 0 8px;
  background: linear-gradient(180deg, rgba(29, 78, 216, 0.52), rgba(15, 23, 42, 0.58));
  border: 1px solid #22c55e;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.12), 0 8px 24px rgba(15, 23, 42, 0.25);
}
.menu-dropdown-p2p .p2p-dropdown-rounds .p2p-menu-section-label { color: #bbf7d0; font-weight: 800; }
.p2p-dropdown-rounds-hint { color: #bfdbfe; opacity: 0.86; }
.p2p-dropdown-round {
  padding: 6px 0;
  text-align: center;
  border: 1px solid rgba(34, 197, 94, 0.42);
  border-radius: 7px;
  background: rgba(30, 64, 175, 0.42);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.p2p-dropdown-round:hover { background: rgba(37, 99, 235, 0.6); border-color: rgba(74, 222, 128, 0.72); color: #ffffff; }
.p2p-dropdown-round.menu-item-active {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.88), rgba(29, 78, 216, 0.76)) !important;
  border-color: #4ade80;
  color: #eff6ff;
  font-weight: 800;
  box-shadow: inset 0 0 14px rgba(96, 165, 250, 0.36), 0 0 0 1px rgba(34, 197, 94, 0.3);
}
.p2p-dropdown-intro {
  position: relative;
  margin: 0 0 8px;
  padding: 9px 11px 9px 13px;
  border: 1px solid rgba(71, 85, 105, 0.76);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.68), rgba(15, 23, 42, 0.6));
  max-width: none;
}
.p2p-dropdown-intro::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #60a5fa, #22c55e);
}
.p2p-dropdown-intro-title { color: #e2e8f0; font-size: 11px; font-weight: 800; line-height: 1.25; }
.p2p-dropdown-intro-body { color: #aebdd0; font-size: 11px; line-height: 1.4; margin-top: 4px; white-space: normal; }
.menu-item { display: block; width: 100%; padding: 9px 14px; background: none; border: none; color: #cbd5e1; font-size: 13px; font-family: inherit; text-align: left; cursor: pointer; transition: background 0.1s; }
.session-action-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
}
.session-action-menu-icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.session-action-menu-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
.session-action-menu-icon-pin { color: #a78bfa; }
.session-action-menu-icon-unpin { color: #94a3b8; }
.session-action-menu-icon-restart { color: #60a5fa; }
.session-action-menu-icon-new { color: #4ade80; }
.session-action-menu-icon-rename { color: #fbbf24; }
.session-action-menu-icon-settings { color: #22d3ee; }
.session-action-menu-icon-clone { color: #c084fc; }
.session-action-menu-icon-stop { color: #f87171; }
.session-action-menu-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-dropdown-p2p .menu-item,
.menu-dropdown-p2p .menu-divider,
.p2p-menu-section-label { white-space: nowrap; }
.menu-dropdown-p2p .menu-divider { margin: 7px 0; border-color: rgba(148, 163, 184, 0.12); }
.menu-dropdown-p2p .menu-item {
  border-radius: 8px;
  margin: 1px 0;
  padding: 8px 10px;
}
.menu-dropdown-p2p .menu-item:hover { background: rgba(51, 65, 85, 0.78); }
.menu-dropdown-p2p .menu-item-active {
  background: rgba(30, 41, 59, 0.92) !important;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.22);
}
.p2p-dropdown-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 0 0 7px;
  border: 1px solid rgba(51, 65, 85, 0.9);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.28);
}
.p2p-dropdown-tab.menu-item {
  flex: 1;
  margin: 0;
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 650;
  border-radius: 7px;
}
.p2p-dropdown-tab.menu-item-active {
  color: #dbeafe;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.42), rgba(30, 64, 175, 0.34)) !important;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.2);
}
.p2p-dropdown-tab.menu-item:hover { color: #e2e8f0; }
.p2p-alpha-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  border: 1px solid rgba(251, 191, 36, 0.38);
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  font-size: 9px;
  font-weight: 850;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.p2p-alpha-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 11px;
  border: 1px solid rgba(251, 191, 36, 0.34);
  border-radius: 8px;
  background: rgba(120, 53, 15, 0.18);
  color: #fef3c7;
  font-size: 12px;
  line-height: 1.45;
}
.p2p-dropdown-combo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.p2p-dropdown-combo-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p2p-recommended-icon {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(34, 197, 94, 0.34);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
.menu-item:hover { background: #334155; }
.menu-item:disabled { cursor: not-allowed; opacity: 0.8; }
.menu-item:disabled:hover { background: none; }
.menu-item-warn { color: #fbbf24; background: #292005 !important; }
.menu-item-warn:hover { background: #3a2e07 !important; }
.menu-item-danger { color: #f87171; background: #1f0808 !important; }
.menu-item-danger:hover { background: #2d0e0e !important; }
.menu-item-danger:disabled:hover { background: #1f0808 !important; }
.menu-item-active { color: #a78bfa; background: #1e1338 !important; }
.menu-item-active:hover { background: #2a1b4e !important; }
.p2p-menu-section-label { font-size: 10px; color: #64748b; padding: 2px 12px; text-transform: uppercase; letter-spacing: 0.05em; }
@media (max-width: 640px) {
  .controls { align-items: center; }
  .controls-mobile-multiline { align-items: flex-end; }
  .controls-composer { min-height: 32px; }
  .shortcuts-row { overflow: visible; }
  .shortcuts { gap: 3px; padding: 4px 4px 4px 6px; }
  .shortcuts-transport { flex: 1 1 auto; min-width: 30px; max-width: none; overflow: visible; padding-left: 0; }
  /* Bigger stop tap-target on mobile. Extra height comes from padding that is
     cancelled by equal negative vertical margins, so the button's margin-box
     (which drives the toolbar row height) is unchanged — the toolbar does not
     grow; the button just extends a few px above/below (overflow:visible
     above keeps it from being clipped). */
  .shortcut-btn-icon.shortcut-btn-stop {
    min-width: 64px;
    width: 64px;
    padding-top: 8px;
    padding-bottom: 8px;
    margin-top: -5px;
    margin-bottom: -5px;
    font-size: 22px;
    line-height: 1;
    border-radius: 8px;
  }
  .shortcuts-model { padding: 4px 4px 4px 0; }
  .shortcuts-model .shortcut-btn {
    max-width: 82px;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 6px;
    padding-right: 6px;
    font-size: 10px !important;
  }
  .shortcut-btn-icon {
    width: 26px;
    min-width: 26px;
    padding-left: 0;
    padding-right: 0;
  }
  .p2p-settings-btn { gap: 0; padding-left: 6px; padding-right: 6px; min-width: auto; }
  .p2p-settings-label { display: none; }
  .session-ctx-wrap { gap: 3px; padding: 4px 5px 4px 0; }
  .session-ctx-bar { width: 44px; }
  .controls-composer-mobile-expanded {
    position: fixed;
    inset: calc(var(--sat, 0px) + 8px) 8px 8px;
    z-index: 4100;
    background: linear-gradient(180deg, rgba(17,27,45,0.98), rgba(8,13,22,0.98));
    border: 1px solid rgba(34,211,238,0.28);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 24px rgba(34,211,238,0.12), inset 0 1px 0 rgba(255,255,255,0.06);
    padding: 44px 10px 10px;
  }
  .controls-composer-mobile-expanded .controls-input {
    height: 100%;
    min-height: 100%;
    max-height: none;
    border-radius: 12px;
  }
  .btn-voice-embedded {
    right: 5px;
    /* Fill the input's height (absolute-positioned, so it never pushes the
       input taller) and make it comfortably wide for an easy tap target. */
    top: 4px;
    bottom: 4px;
    transform: none;
    width: 54px;
    height: auto;
    padding: 0;
    /* Remove the 300ms tap delay / double-tap zoom on touch so the press
       registers immediately and is not mistaken for a gesture. */
    touch-action: manipulation;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(15,23,42,0.82);
    border: 1px solid rgba(125,211,252,0.18);
    color: #cbd5e1;
  }
  .controls-composer-mobile-expanded .btn-voice-embedded {
    top: 10px;
    right: 10px;
    bottom: auto;
    height: 34px;
    width: 54px;
    transform: none;
  }
  .controls-wrapper-mobile-expanded .btn-input-expand-floating {
    position: fixed;
    left: 18px;
    top: calc(var(--sat, 0px) + 18px);
    bottom: auto;
    z-index: 4101;
  }
  .btn-voice-embedded:hover,
  .btn-voice-embedded:active {
    background: rgba(8,145,178,0.18);
    border-color: rgba(34,211,238,0.5);
    color: #f8fafc;
  }
  .controls { padding: 5px 6px; gap: 4px; }
  .controls .btn { padding: 7px 8px; }
  .controls .btn-voice { padding: 4px 6px; }
  .controls .controls-icon-btn { padding: 6px 8px; }
  .menu-dropdown { max-width: calc(100vw - 16px); }
  .menu-dropdown-openspec { width: 100vw; min-width: 100vw; max-width: 100vw; max-height: none; border-radius: 0; border: none; }
  .menu-dropdown-openspec-inline { position: fixed; top: var(--sat, 0px); left: 0; right: 0; bottom: env(safe-area-inset-bottom, 0px); z-index: 2147483646; height: calc(var(--vvh, 100dvh) - var(--sat, 0px) - env(safe-area-inset-bottom, 0px)); max-height: calc(var(--vvh, 100dvh) - var(--sat, 0px) - env(safe-area-inset-bottom, 0px)); overflow: hidden; box-sizing: border-box; border-radius: 12px 12px 0 0; }
  .openspec-mobile-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #334155; flex-shrink: 0; background: #1e293b; z-index: 1; }
  .openspec-mobile-title { font-size: 14px; font-weight: 600; color: #f97316; }
  .openspec-mobile-close { background: none; border: 1px solid #475569; border-radius: 6px; color: #94a3b8; font-size: 16px; width: 32px; height: 32px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
  .openspec-change-row { flex-direction: column; align-items: stretch; gap: 4px; }
  .openspec-change-header { display: flex; align-items: center; gap: 6px; width: 100%; }
  .openspec-change-name { width: 100%; padding: 8px 12px; font-size: 12px; }
  .openspec-change-folder-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #1e293b;
  }
  .openspec-change-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-right: 4px;
    margin-left: 0;
    border: 1px solid #475569;
    border-radius: 10px;
    background: #1e293b;
    color: #f8fafc;
    font-size: 18px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.28);
  }
  .openspec-change-toggle:hover,
  .openspec-change-toggle:active {
    background: #334155;
    border-color: #64748b;
    color: #ffffff;
  }
  .openspec-change-row-expanded .openspec-change-toggle {
    border-color: #fb923c;
    background: rgba(249, 115, 22, 0.16);
    color: #fdba74;
  }
  .openspec-change-actions { display: none; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 4px; }
  .openspec-change-actions-visible { display: grid; }
  .openspec-change-action-wrap { min-width: 0; }
  .openspec-change-action-btn { width: 100%; padding: 5px 6px; font-size: 10px; }
  .openspec-folder-modal {
    width: 100vw;
    height: calc(var(--vvh, 100dvh) - var(--sat, 0px));
    max-height: none;
    border-radius: 0;
  }
  .openspec-submenu { max-height: min(45vh, calc(100vh - 120px)); }
  .openspec-submenu-inline { margin-top: 4px; }
  .openspec-submenu-inline .menu-item { white-space: normal; }
  .menu-dropdown-p2p {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 64px);
    z-index: 2147483646;
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: min(72vh, calc(var(--vvh, 100dvh) - var(--sat, 0px) - env(safe-area-inset-bottom, 0px) - 96px));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  @supports (height: 100dvh) {
    .menu-dropdown-p2p {
      max-height: min(72dvh, calc(var(--vvh, 100dvh) - var(--sat, 0px) - env(safe-area-inset-bottom, 0px) - 96px));
    }
  }
  .menu-dropdown-p2p .p2p-dropdown-rounds {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0 0 6px;
    border-radius: 0 0 10px 10px;
    background: linear-gradient(180deg, rgba(29, 78, 216, 0.54), rgba(30, 64, 175, 0.42));
    border-color: #22c55e;
  }
  .p2p-dropdown-intro { max-width: none; margin: 0 8px 6px; }
  .menu-dropdown-p2p .menu-item,
  .menu-dropdown-p2p .menu-divider,
  .p2p-menu-section-label { white-space: normal; }
}
.btn { padding: 6px 12px; border-radius: 7px; border: 1px solid transparent; cursor: pointer; font-size: 12px; font-family: inherit; font-weight: 600; transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s; box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); }
.controls-icon-btn { padding: 6px 10px; }
.btn-primary { background: linear-gradient(180deg, rgba(34,211,238,0.92), rgba(37,99,235,0.92)); border-color: rgba(125,211,252,0.38); color: #f8fafc; box-shadow: 0 0 14px rgba(34,211,238,0.16), inset 0 1px 0 rgba(255,255,255,0.16); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, rgba(103,232,249,0.96), rgba(37,99,235,0.96)); border-color: rgba(165,243,252,0.62); box-shadow: 0 0 18px rgba(34,211,238,0.28), inset 0 1px 0 rgba(255,255,255,0.20); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.46; cursor: default; transform: none; box-shadow: none; }
.voice-btn-wrap { display: flex; flex-direction: column; align-items: center; align-self: center; gap: 2px; flex-shrink: 0; }
.btn-input-clear { background: rgba(15,23,42,0.72); border: 1px solid rgba(125,211,252,0.18); color: #94a3b8; cursor: pointer; padding: 1px 5px; font-size: 11px; line-height: 1.2; border-radius: 10px; flex-shrink: 0; transition: color 0.15s, border-color 0.15s, background 0.15s; }
.btn-input-clear:hover { color: #ef4444; border-color: #ef4444; }
.btn-voice { background: rgba(15,23,42,0.52); border: 1px solid rgba(125,211,252,0.14); color: #7b8797; cursor: pointer; padding: 4px 7px; font-size: 18px; line-height: 1; border-radius: 7px; transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s; flex-shrink: 0; }
.btn-voice:hover:not(:disabled) { color: #dbeafe; background: rgba(8,145,178,0.14); border-color: rgba(34,211,238,0.42); box-shadow: 0 0 12px rgba(34,211,238,0.12); }
.btn-voice-active { color: #ef4444; animation: voice-pulse 1s ease-in-out infinite; }
@keyframes voice-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── Voice Overlay (sci-fi 2/3 sheet) ── */
.voice-overlay {
  position: fixed; left: 0; right: 0; top: 0; z-index: 9999;
  height: 66vh;
  background: radial-gradient(ellipse at 50% 0%, #0c1929 0%, #020617 70%);
  display: flex; flex-direction: column; align-items: center;
  padding: var(--sat, 0px) 20px 20px; box-sizing: border-box;
  overflow: hidden;
  border-radius: 0 0 24px 24px;
  box-shadow: 0 4px 40px rgba(0,0,0,0.6);
  animation: voice-slide-down 0.3s ease-out;
}
@keyframes voice-slide-down { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.voice-overlay-grid {
  position: absolute; inset: 0; opacity: 0.04; border-radius: 0 0 24px 24px;
  background-image:
    linear-gradient(rgba(56,189,248,0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56,189,248,0.4) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: voice-grid-scroll 20s linear infinite;
}
@keyframes voice-grid-scroll { to { background-position: 40px 40px; } }
.voice-overlay-header {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 16px 0 0; z-index: 1;
}
.voice-overlay-close {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: #94a3b8; font-size: 18px; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.voice-overlay-close:hover { background: rgba(255,255,255,0.12); color: #e2e8f0; }
.voice-overlay-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #64748b;
  letter-spacing: 2px; text-transform: uppercase;
}
.voice-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #475569; transition: all 0.3s;
}
.voice-status-dot-active {
  background: #22d3ee;
  box-shadow: 0 0 12px #22d3ee, 0 0 24px rgba(34,211,238,0.3);
  animation: voice-dot-pulse 1.5s ease-in-out infinite;
}
@keyframes voice-dot-pulse { 0%,100% { box-shadow: 0 0 12px #22d3ee, 0 0 24px rgba(34,211,238,0.3); } 50% { box-shadow: 0 0 20px #22d3ee, 0 0 40px rgba(34,211,238,0.5); } }
.voice-overlay-text {
  flex: 1; width: 100%; max-width: 600px;
  margin: 20px 0; padding: 20px;
  font-size: 18px; line-height: 1.7; color: #e2e8f0;
  overflow-y: auto; z-index: 1;
  border: 1px solid rgba(56,189,248,0.1);
  border-radius: 16px;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 30px rgba(56,189,248,0.03), 0 0 1px rgba(56,189,248,0.2);
  resize: none; font-family: inherit;
}
.voice-overlay-text::placeholder { color: #475569; font-style: italic; }
.voice-overlay-text:focus { outline: none; border-color: rgba(56,189,248,0.25); }
.voice-overlay-controls {
  position: relative; display: flex; align-items: center; justify-content: center;
  gap: 14px; z-index: 1; flex-shrink: 0;
  width: 100%; height: 52px;
  border-radius: 26px; overflow: hidden;
}
.voice-waveform-bg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  gap: 2px; pointer-events: none;
}
.voice-waveform-bar {
  width: 3px; min-height: 2px; border-radius: 1.5px;
  background: linear-gradient(180deg, #22d3ee, #8b5cf6);
  transition: none;
}
.voice-overlay-mic {
  position: relative; z-index: 1;
  width: 40px; height: 40px; border-radius: 50%;
  background: #0f172a;
  border: 1.5px solid rgba(34,211,238,0.4);
  color: #22d3ee; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.voice-overlay-mic:hover { background: #1e293b; border-color: #22d3ee; }
.voice-overlay-mic-active {
  background: #1c1017;
  border-color: #ef4444; color: #ef4444;
  animation: voice-mic-glow 2s ease-in-out infinite;
}
@keyframes voice-mic-glow { 0%,100% { box-shadow: 0 0 10px rgba(239,68,68,0.2); } 50% { box-shadow: 0 0 20px rgba(239,68,68,0.4); } }
.voice-overlay-send {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 20px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border: none; color: white; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.3s;
  letter-spacing: 0.5px;
}
.voice-overlay-send:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}
.voice-overlay-send:disabled { background: #334155; color: #64748b; cursor: default; }

.btn-danger { background: linear-gradient(180deg, rgba(239,68,68,0.9), rgba(153,27,27,0.9)); border-color: rgba(248,113,113,0.42); color: white; }
.btn-danger:hover:not(:disabled) { background: linear-gradient(180deg, rgba(248,113,113,0.96), rgba(185,28,28,0.96)); border-color: rgba(252,165,165,0.62); box-shadow: 0 0 14px rgba(239,68,68,0.22); }
.btn-secondary { background: rgba(15,23,42,0.62); border-color: rgba(125,211,252,0.16); color: #94a3b8; }
.btn-secondary:hover:not(:disabled) { background: rgba(8,145,178,0.14); border-color: rgba(34,211,238,0.42); color: #dbeafe; box-shadow: 0 0 12px rgba(34,211,238,0.12); }

/* Quick Input Panel */
.qp-trigger-wrap { position: relative; flex-shrink: 0; }
.qp-trigger { padding: 6px 9px; background: rgba(15,23,42,0.62); border: 1px solid rgba(251,191,36,0.28); border-radius: 7px; color: #fbbf24; font-size: 14px; cursor: pointer; line-height: 1; transition: color 0.12s, border-color 0.12s, background 0.12s, box-shadow 0.12s; flex-shrink: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,0.035); }
.qp-trigger:hover { background: rgba(120,53,15,0.24); border-color: rgba(251,191,36,0.58); color: #fde68a; box-shadow: 0 0 12px rgba(251,191,36,0.16), inset 0 1px 0 rgba(255,255,255,0.05); }
.qp-backdrop { display: none; }
.qp { position: absolute; bottom: calc(100% + 6px); left: 0; width: min(75vw, 1050px); max-height: min(78vh, 760px); background: linear-gradient(180deg, #111827, #0d1422); border: 1px solid rgba(125,211,252,0.18); border-radius: 8px; box-shadow: 0 12px 34px rgba(0,0,0,0.58), 0 0 24px rgba(34,211,238,0.08); z-index: 10002; display: flex; flex-direction: column; overflow: hidden; }
.qp-toolbar { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid rgba(125,211,252,0.14); flex-shrink: 0; background: rgba(8,13,22,0.36); }
.qp-toolbar-btn { padding: 4px 10px; background: rgba(15,23,42,0.7); border: 1px solid rgba(125,211,252,0.16); border-radius: 6px; color: #94a3b8; font-size: 11px; font-family: inherit; cursor: pointer; transition: color 0.1s, border-color 0.1s, background 0.1s, box-shadow 0.1s; }
.qp-toolbar-btn:hover { background: rgba(8,145,178,0.14); border-color: rgba(34,211,238,0.45); color: #bfdbfe; box-shadow: 0 0 10px rgba(34,211,238,0.10); }
.qp-toolbar-btn-danger { color: #f87171; border-color: #7f1d1d; background: #1f0808; margin-left: auto; }
.qp-toolbar-btn-danger:hover { background: #2d0e0e; border-color: #ef4444; color: #fca5a5; }
.qp-add-row { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid #334155; flex-shrink: 0; }
.qp-add-label { font-size: 11px; color: #64748b; flex-shrink: 0; }
.qp-add-input { flex: 1; min-width: 0; background: #0f172a; border: 1px solid #334155; color: #e2e8f0; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-family: inherit; outline: none; }
.qp-add-input:focus { border-color: #3b82f6; }
.qp-add-confirm { padding: 4px 8px; background: #1d4ed8; border: none; border-radius: 4px; color: #fff; font-size: 13px; cursor: pointer; }
.qp-add-confirm:hover { background: #2563eb; }
.qp-add-cancel { padding: 4px 6px; background: none; border: none; color: #64748b; font-size: 13px; cursor: pointer; }
.qp-add-cancel:hover { color: #f87171; }
.qp-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #334155 transparent; }
.qp-section-header { padding: 6px 10px 3px; font-size: 10px; font-weight: 700; color: #64748b; letter-spacing: 0; text-transform: uppercase; position: sticky; top: 0; background: linear-gradient(180deg, #111827, #0f172a); z-index: 1; border-bottom: 1px solid rgba(125,211,252,0.08); }
.qp-history-empty { padding: 6px 10px 8px; font-size: 11px; color: #475569; font-style: italic; }
.qp-history-header { display: flex; align-items: center; justify-content: space-between; padding-right: 8px; }
.qp-scope-toggle { display: flex; gap: 2px; }
.qp-scope-btn { padding: 2px 8px; background: none; border: 1px solid #334155; border-radius: 3px; color: #475569; font-size: 10px; font-family: inherit; cursor: pointer; transition: all 0.1s; }
.qp-scope-btn.active { background: #1e3a5f; border-color: #3b82f6; color: #93c5fd; }
.qp-scope-btn:not(.active):hover { border-color: #475569; color: #94a3b8; }
/* Pills for commands + phrases */
.qp-pills { display: flex; flex-wrap: wrap; gap: 5px; padding: 5px 10px 8px; }
.qp-pill { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-family: inherit; cursor: pointer; transition: all 0.1s; white-space: nowrap; border: 1px solid; }
.qp-pill-default { background: #0f172a; border-color: #334155; color: #94a3b8; }
.qp-pill-default:hover { background: #1e3a5f; border-color: #3b82f6; color: #93c5fd; }
.qp-pill-custom { background: #1e293b; border-color: #475569; color: #cbd5e1; display: inline-flex; align-items: center; border-radius: 999px; overflow: hidden; padding: 0; }
.qp-pill-text { padding: 4px 8px 4px 10px; font-size: 12px; cursor: pointer; }
.qp-pill-text:hover { background: #334155; }
.qp-pill-edit { padding: 4px 4px 4px 2px; background: none; border: none; color: #475569; font-size: 10px; cursor: pointer; transition: color 0.1s; }
.qp-pill-edit:hover { color: #60a5fa; }
.qp-pill-del { padding: 4px 7px 4px 2px; background: none; border: none; color: #475569; font-size: 10px; cursor: pointer; transition: color 0.1s; }
.qp-pill-del:hover { color: #f87171; }
.qp-pill-editing { display: inline-flex; }
.qp-edit-input { background: #0f172a; border: 1px solid #3b82f6; color: #e2e8f0; font-size: 11px; padding: 3px 8px; border-radius: 10px; outline: none; min-width: 120px; font-family: inherit; }
/* History rows — compact */
.qp-item { display: flex; align-items: flex-start; gap: 6px; padding: 5px 10px; cursor: pointer; transition: background 0.1s; }
.qp-item:hover { background: #293548; }
.qp-item-history { opacity: 0.8; }
.qp-item-history:hover { opacity: 1; background: #293548; }
.qp-item-text { flex: 1; min-width: 0; font-size: 12px; color: #94a3b8; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; line-height: 1.5; }
.qp-item-del { flex-shrink: 0; padding: 2px 5px; margin-top: 1px; background: none; border: none; color: #3f4f63; font-size: 10px; cursor: pointer; border-radius: 3px; transition: all 0.1s; }
.qp-item-del:hover { color: #f87171; }
.qp-empty { padding: 12px; font-size: 12px; color: #475569; text-align: center; }
.qp-pagination { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 5px 10px; border-top: 1px solid #1e3250; flex-shrink: 0; }
.qp-page-btn { padding: 3px 10px; background: #0f172a; border: 1px solid #334155; border-radius: 4px; color: #64748b; font-size: 11px; font-family: inherit; cursor: pointer; transition: all 0.1s; }
.qp-page-btn:hover:not(:disabled) { border-color: #3b82f6; color: #93c5fd; }
.qp-page-btn:disabled { opacity: 0.3; cursor: default; }
.qp-page-info { font-size: 11px; color: #475569; }

/* Mobile responsive */
@media (max-width: 640px) {
  .qp-backdrop { display: block; position: fixed; inset: 0; background: #00000070; z-index: 10001; }
  .qp { position: fixed; bottom: 0; left: 0; right: 0; width: 100%; max-height: min(82vh, calc(var(--vvh, 100dvh) - var(--sat, 0px) - 72px)); border-radius: 12px 12px 0 0; border-bottom: none; }
}

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; height: 100vh; height: 100dvh; padding-top: env(safe-area-inset-top); }
.login-card { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 32px; width: 360px; max-width: calc(100vw - 32px); }
.login-card h1 { margin: 0 0 24px; font-size: 20px; color: #f1f5f9; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 12px; color: #94a3b8; }
.form-group input { width: 100%; background: #0f172a; border: 1px solid #334155; color: #e2e8f0; padding: 8px 12px; border-radius: 4px; font-family: inherit; font-size: 14px; outline: none; }
.form-group input:focus { border-color: #3b82f6; }
.login-card .btn { width: 100%; padding: 10px; }

/* Status badge */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 9999px; font-size: 11px; font-weight: 600; border: 1px solid rgba(148,163,184,0.16); }
.badge-online { background: rgba(20,83,45,0.58); color: #4ade80; border-color: rgba(74,222,128,0.28); box-shadow: 0 0 10px rgba(74,222,128,0.08); }
.badge-offline { background: #1f1f1f; color: #64748b; }
.badge-connecting { background: rgba(56,189,248,.08); color: #38bdf8; border: 1px solid rgba(56,189,248,.25); animation: badge-connecting-glow 2s ease-in-out infinite; }
.badge-error { background: #450a0a; color: #f87171; }

/* Connecting animation */
@keyframes badge-connecting-glow {
  0%, 100% { box-shadow: 0 0 4px rgba(56,189,248,.15); border-color: rgba(56,189,248,.2); }
  50% { box-shadow: 0 0 12px rgba(56,189,248,.35), 0 0 4px rgba(56,189,248,.2); border-color: rgba(56,189,248,.5); }
}
.connecting-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: #38bdf8; animation: connecting-pulse 1.4s ease-in-out infinite;
}
@keyframes connecting-pulse {
  0%, 100% { opacity: .3; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Agent type badge in tabs */
.agent-badge { display: inline-flex; align-items: center; justify-content: center; padding: 1px 5px; border-radius: 999px; font-size: 9px; font-weight: 700; color: #fff; margin-right: 6px; letter-spacing: 0; flex-shrink: 0; box-shadow: 0 0 10px rgba(34,211,238,0.12); }
.p2p-tag { display: inline-flex; align-items: center; justify-content: center; padding: 1px 5px; border-radius: 999px; font-size: 9px; font-weight: 700; color: #dbeafe; background: linear-gradient(180deg, rgba(59,130,246,0.85), rgba(37,99,235,0.68)); border: 1px solid rgba(125,211,252,0.26); margin-left: 4px; letter-spacing: 0; flex-shrink: 0; box-shadow: 0 0 10px rgba(59,130,246,0.22); }

/* Mobile server bar — only visible on mobile */
.mobile-server-bar { display: none; }
.mobile-sidebar-toggle { display: none; }

/* Shared Context management gets the same compact sci-fi chrome as the rest of the app. */
.shared-context-floating-panel {
  background: linear-gradient(180deg, #08111d 0%, #090e19 100%) !important;
  border-color: rgba(34,211,238,0.24) !important;
  box-shadow: 0 18px 48px rgba(0,0,0,0.48), 0 0 34px rgba(34,211,238,0.12) !important;
}
.shared-context-floating-panel .floating-panel-safe-area,
.shared-context-floating-panel .floating-panel-titlebar {
  background: linear-gradient(180deg, rgba(13,20,35,0.98), rgba(8,13,22,0.96)) !important;
}
.shared-context-floating-panel .floating-panel-titlebar {
  border-bottom: 1px solid rgba(34,211,238,0.22) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 1px 18px rgba(34,211,238,0.08);
}
.shared-context-floating-panel .floating-panel-content {
  background: #08111d !important;
}
.shared-context-shell-tech {
  scrollbar-width: thin;
  scrollbar-color: rgba(34,211,238,0.42) transparent;
}
.shared-context-shell-tech::-webkit-scrollbar { width: 6px; }
.shared-context-shell-tech::-webkit-scrollbar-track { background: transparent; }
.shared-context-shell-tech::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(34,211,238,0.44), rgba(124,58,237,0.34));
  border-radius: 999px;
}
.shared-context-shell-tech::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(34,211,238,0.12), transparent) 0 0 / 100% 1px no-repeat,
    radial-gradient(circle at 50% 0%, rgba(34,211,238,0.12), transparent 46%);
  opacity: 0.8;
  z-index: 0;
}
.shared-context-shell-tech > * {
  position: relative;
  z-index: 1;
}
.shared-context-hero-tech {
  position: relative;
}
.shared-context-hero-tech::before {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(103,232,249,0.72), rgba(168,85,247,0.52), transparent);
  pointer-events: none;
}
.shared-context-tabbar-tech {
  position: relative;
}
.shared-context-tabbar-tech::before {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34,211,238,0.52), transparent);
  pointer-events: none;
}
.shared-context-tab-tech:hover {
  color: #e0f2fe !important;
  border-color: rgba(34,211,238,0.36) !important;
  background: rgba(8,145,178,0.16) !important;
  box-shadow: 0 0 14px rgba(34,211,238,0.10) !important;
}
.shared-context-tab-tech.is-active {
  text-shadow: 0 0 10px rgba(34,211,238,0.24);
}
.shared-context-shell-tech input:focus,
.shared-context-shell-tech select:focus,
.shared-context-shell-tech textarea:focus {
  border-color: rgba(34,211,238,0.70) !important;
  box-shadow: 0 0 0 1px rgba(34,211,238,0.24), 0 0 18px rgba(34,211,238,0.13), inset 0 1px 0 rgba(255,255,255,0.06) !important;
}
.shared-context-shell-tech button:not(:disabled):hover {
  border-color: rgba(34,211,238,0.44) !important;
  filter: brightness(1.06);
}

/* Mobile responsive */
@media (max-width: 640px) {
  .sidebar { display: none; }
  /* NOTE: do NOT add `padding-top: env(safe-area-inset-top)` on `.main`
     here. `.layout` already sets `margin-top: env(safe-area-inset-top)`
     AND `height: calc(100dvh - env(safe-area-inset-top))` at the root
     level — stacking another inset on `.main` causes a double-gap that
     shows up as ~80-100px of black space under the iOS status bar on
     iPhone X+ devices. Regression landed in commit 6f9a5e0 and reverted
     here. */
  .mobile-server-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; background: linear-gradient(180deg, #0d1422 0%, #09111d 100%); border-bottom: 1px solid rgba(34,211,238,0.18); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 4px 16px rgba(0,0,0,0.24); flex-shrink: 0; position: relative; z-index: 50; }
  .mobile-server-bar::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(34,211,238,0.72), rgba(52,211,153,0.55), transparent); pointer-events: none; }
  .mobile-sidebar-toggle { display: block; width: 36px; height: 36px; background: rgba(15,23,42,0.55); border: 1px solid rgba(125,211,252,0.16); border-radius: 10px; color: #94a3b8; font-size: 18px; cursor: pointer; padding: 0; line-height: 1; flex-shrink: 0; }
  .mobile-sidebar-toggle:active { color: var(--chrome-accent); border-color: rgba(34,211,238,0.5); background: rgba(8,145,178,0.16); }
  .mobile-server-switcher-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
  .mobile-server-btn { width: 100%; min-height: 38px; display: flex; align-items: center; gap: 8px; background: linear-gradient(135deg, rgba(8,145,178,0.24), rgba(15,23,42,0.78) 46%, rgba(76,29,149,0.22)); border: 1px solid rgba(125,211,252,0.24); border-radius: 13px; color: #dbeafe; font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; padding: 6px 7px 6px 9px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 0 18px rgba(34,211,238,0.10); }
  .mobile-server-btn:active { color: var(--chrome-accent); border-color: rgba(34,211,238,0.58); background: linear-gradient(135deg, rgba(8,145,178,0.34), rgba(15,23,42,0.86) 46%, rgba(76,29,149,0.30)); }
  .mobile-server-btn-icon { width: 24px; height: 24px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; background: rgba(34,211,238,0.12); border: 1px solid rgba(34,211,238,0.18); box-shadow: 0 0 12px rgba(34,211,238,0.16); }
  .mobile-server-btn-name { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; letter-spacing: 0; }
  .mobile-server-btn-chevron { width: 24px; height: 24px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; color: #67e8f9; background: rgba(15,23,42,0.52); }
  .mobile-server-actions { display: flex; gap: 5px; align-items: center; flex: 0 0 auto; }
  .mobile-server-backdrop { position: fixed; inset: 0; z-index: 49; }
  .mobile-server-menu { position: absolute; top: calc(100% + 8px); left: 0; width: min(300px, calc(100vw - 18px)); background: #1e293b; border: 1px solid rgba(125,211,252,0.20); border-radius: 12px; min-width: min(240px, calc(100vw - 18px)); box-shadow: 0 14px 34px #00000090, 0 0 20px rgba(34,211,238,0.10); z-index: 50; overflow: hidden; }
  .mobile-server-menu-item { display: block; width: 100%; padding: 10px 14px; background: none; border: none; color: #cbd5e1; font-size: 13px; font-family: inherit; text-align: left; cursor: pointer; }
  .mobile-server-menu-item:hover, .mobile-server-menu-item:active { background: #334155; }
  .mobile-server-menu-item.active { color: #93c5fd; background: #1d4ed820; }
  .mobile-server-menu-change { color: #f59e0b !important; border-top: 1px solid #334155; }
  .controls { padding: 5px 6px; gap: 4px; }
  .controls-input { font-size: 16px; } /* prevent iOS zoom on focus */
  .btn { padding: 7px 8px; font-size: 13px; }
  .p2p-settings-btn { gap: 0; padding: 6px 6px; min-width: auto; }
  .p2p-settings-label { display: none; }
}

/* Mobile sidebar overlay — always mounted, shown/hidden via .open class */
.mobile-sidebar-overlay { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,0); pointer-events: none; transition: background 0.25s ease; }
.mobile-sidebar-overlay.open { pointer-events: auto; background: rgba(0,0,0,0.5); }
.mobile-sidebar-panel { position: absolute; top: 0; left: 0; width: 88%; max-width: 360px; height: var(--vvh, 100%); background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(125,211,252,0.024) 22px 23px), linear-gradient(180deg, #0d1422 0%, #080d16 100%); border-right: 1px solid rgba(34,211,238,0.18); display: flex; flex-direction: column; box-shadow: 8px 0 28px rgba(0,0,0,0.48); transform: translateX(-100%); transition: transform 0.25s cubic-bezier(0.4,0,0.2,1); }
.mobile-sidebar-overlay.open .mobile-sidebar-panel { transform: translateX(0); }
.mobile-sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; padding-top: calc(12px + var(--sat, 0px)); border-bottom: 1px solid rgba(34,211,238,0.16); background: linear-gradient(180deg, rgba(34,211,238,0.10), rgba(8,13,22,0.18)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); flex-shrink: 0; }
.mobile-sidebar-close { background: rgba(15,23,42,0.42); border: 1px solid rgba(125,211,252,0.14); border-radius: 6px; color: #7b8797; font-size: 18px; cursor: pointer; padding: 4px; line-height: 1; }
.mobile-sidebar-close:active { color: var(--chrome-accent); border-color: rgba(34,211,238,0.5); background: rgba(8,145,178,0.16); }
.mobile-sidebar-body { flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: rgba(34,211,238,0.38) transparent; scroll-behavior: smooth; }
.mobile-sidebar-footer { flex-shrink: 0; padding: 8px 14px; border-top: 1px solid rgba(34,211,238,0.13); background: rgba(8,13,22,0.42); }
.mobile-sidebar-hdr-btn { background: rgba(15,23,42,0.42); border: 1px solid rgba(125,211,252,0.14); color: #7b8797; border-radius: 6px; padding: 2px 6px; font-size: 13px; cursor: pointer; line-height: 1; }
.mobile-sidebar-hdr-btn.active { color: var(--chrome-accent); border-color: rgba(34,211,238,0.5); background: rgba(8,145,178,0.16); box-shadow: 0 0 12px rgba(34,211,238,0.14); }

/* ── Chat view ──────────────────────────────────────────────────── */
.chat-view-wrap { flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.chat-split { flex-direction: row !important; }
.chat-main { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; overflow: hidden; }
/* Pinned "Last sent" banner — appears only when the original user bubble has
   scrolled off the top of the chat viewport. Sits above the scroll area so it
   doesn't bob with the user's scroll position, only its visibility changes. */
.chat-pinned-last-sent { display: flex; flex-direction: column; gap: 2px; margin: 6px 10px 0; padding: 6px 10px; background: linear-gradient(180deg, rgba(30, 58, 95, 0.85), rgba(30, 58, 95, 0.7)); border: 1px solid rgba(59, 130, 246, 0.35); border-left: 3px solid #3b82f6; border-radius: 6px; cursor: pointer; user-select: none; color: #dbeafe; font-size: 12px; line-height: 1.4; transition: background 0.15s; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
.chat-pinned-last-sent:hover { background: linear-gradient(180deg, rgba(30, 58, 95, 1), rgba(30, 58, 95, 0.9)); }
.chat-pinned-last-sent:focus-visible { outline: 2px solid #3b82f6; outline-offset: 1px; }
.chat-pinned-last-sent-label { font-size: 10px; font-weight: 600; color: #93c5fd; letter-spacing: 0.05em; text-transform: uppercase; }
.chat-pinned-last-sent-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden; text-overflow: ellipsis; word-break: break-word; white-space: pre-wrap; }
/* Expanded state still caps at 3 lines — the toggle reveals one extra
   line of context, never the full message. Tap-again jumps to the
   message in chat history for the full content. */
.chat-pinned-last-sent.chat-pinned-expanded .chat-pinned-last-sent-text { -webkit-line-clamp: 3; line-clamp: 3; }
.chat-view { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; scrollbar-color: #6366f1 #1e293b; overflow-anchor: none; }
/* In sub-session cards `.subcard-preview` (parent) owns the scrollbar. If
   `.chat-view` ALSO scrolls (default rule above), every new event triggers
   two independent scrollTop writes — one from ChatView's preview-mode auto-
   follow, one from SubSessionCard.forceFollowLatest — and near the bottom
   they oscillate against each other, producing the "infinite up/down jitter"
   reported when card height ≈ content height. Force `.chat-view-preview`
   to stop being a scroll container so the only scroll surface is
   `.subcard-preview`. `justify-content: flex-end` keeps content pinned to
   bottom inside the bounded card, just like before. */
.chat-view-preview { overflow-y: visible; overflow-x: visible; justify-content: flex-end; }
.chat-view::-webkit-scrollbar { width: 5px; }
.chat-view::-webkit-scrollbar-track { background: #1e293b; border-radius: 3px; }
.chat-view::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #3b82f6, #6366f1, #3b82f6); border-radius: 3px; box-shadow: 0 0 8px #6366f1cc; }
.chat-view::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #60a5fa, #818cf8, #60a5fa); box-shadow: 0 0 12px #818cf8ee; }
/* Top-right control cluster: Agents, force-sync (↻), and file-panel toggle (⊞). */
.chat-top-actions { position: absolute; top: 6px; right: 8px; z-index: 10; display: flex; gap: 6px; align-items: center; }
.chat-panel-toggle { background: rgba(15,23,42,.85); border: 1px solid #334155; border-radius: 5px; color: #64748b; cursor: pointer; padding: 3px 7px; font-size: 14px; line-height: 1; transition: color .15s, border-color .15s, background .15s, box-shadow .15s; }
.chat-sdk-agents-toggle { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 28px; min-height: 24px; padding: 3px 6px; color: #8b9dc7; }
.chat-sdk-agents-glyph { width: 16px; height: 16px; flex: 0 0 auto; }
/* Count rides the glyph's top-right corner as a superscript (absolute), so it
   never widens the button — the toggle stays a compact icon at every count. */
.chat-sdk-agents-badge { position: absolute; top: -4px; right: -2px; display: inline-flex; align-items: center; justify-content: center; min-width: 13px; height: 13px; padding: 0 3px; border-radius: 999px; background: #16a34a; color: #ecfdf5; font-size: 9px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 1px rgba(187,247,208,0.18); pointer-events: none; }
/* No agents running: keep the count visible (0) but mute it so the green badge
   isn't mistaken for "running". The toggle's own .active frame shows open/closed. */
.chat-sdk-agents-badge-zero { background: #334155; color: #94a3b8; box-shadow: 0 0 0 1px rgba(148,163,184,0.16); }
.chat-sync-btn[disabled] { opacity: .55; cursor: default; }
.chat-sync-btn.spinning { animation: chat-spinner-rotate 0.8s linear infinite; }
.chat-panel-toggle:hover, .chat-panel-toggle.active { color: #818cf8; border-color: #6366f1; }
.chat-sdk-agents-toggle.active { background: rgba(20,83,45,0.28); border-color: rgba(52,211,153,0.62); color: #86efac; box-shadow: 0 0 0 1px rgba(52,211,153,0.18), 0 0 12px rgba(52,211,153,0.16); }
.chat-sdk-agents-toggle.active:hover { background: rgba(20,83,45,0.42); border-color: rgba(74,222,128,0.78); color: #bbf7d0; }
/* Drag handle between chat and file panel */
.chat-panel-drag { width: 4px; flex-shrink: 0; cursor: col-resize; background: #1e293b; transition: background .15s; }
.chat-panel-drag:hover { background: #6366f1; }
/* Split file panel container */
.chat-file-panel { display: flex; flex-direction: column; border-left: 1px solid #334155; background: #0f172a; overflow: hidden; min-width: 220px; }
.chat-sdk-agents-panel { display: flex; flex-direction: column; width: clamp(260px, 28vw, 360px); min-width: 240px; flex-shrink: 0; border-left: 1px solid #334155; background: #0f172a; overflow: hidden; }
.chat-sdk-agents-header { display: flex; align-items: center; gap: 8px; padding: 6px 9px; background: #1e293b; border-bottom: 1px solid #334155; min-height: 30px; box-sizing: border-box; }
/* Title + running-count subtitle share one row ("Agents · 2 running"). */
.chat-sdk-agents-heading { flex: 1; min-width: 0; display: flex; flex-direction: row; align-items: baseline; gap: 6px; }
.chat-sdk-agents-title { flex: 0 0 auto; font-size: 12px; color: #dbeafe; font-weight: 800; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sdk-agents-subtitle { flex: 0 1 auto; min-width: 0; font-size: 10px; color: #94a3b8; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sdk-agents-subtitle::before { content: '·'; margin-right: 5px; color: #475569; }
.chat-sdk-agents-close { flex: 0 0 auto; background: none; border: none; color: #64748b; cursor: pointer; font-size: 14px; line-height: 1; padding: 3px 6px; border-radius: 4px; }
.chat-sdk-agents-close:hover { color: #e2e8f0; background: rgba(148,163,184,0.12); }
.chat-sdk-agents-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 9px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: #475569 #0f172a; }
.chat-sdk-agents-section { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.chat-sdk-agents-section-title { color: #94a3b8; font-size: 10px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
.chat-sdk-agent-row { min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 7px 9px; border: 1px solid rgba(71,85,105,0.85); border-left: 3px solid #64748b; border-radius: 7px; background: rgba(15,23,42,0.72); box-shadow: inset 0 1px 0 rgba(255,255,255,0.03); }
.chat-sdk-agent-row.active { border-left-color: #22c55e; }
.chat-sdk-agent-row.terminal { border-left-color: #64748b; }
.chat-sdk-agent-row.diagnostic { border-left-color: #f59e0b; }
.chat-sdk-agent-row.status-error { border-left-color: #ef4444; }
.chat-sdk-agent-row.status-stale,
.chat-sdk-agent-row.status-unknown { border-left-color: #f59e0b; }
.chat-sdk-agent-row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.chat-sdk-agent-provider { min-width: 0; color: #dbeafe; font-size: 12px; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sdk-agent-status { flex: 0 0 auto; color: #94a3b8; font-size: 10px; font-weight: 800; line-height: 1.2; text-transform: uppercase; }
.chat-sdk-agent-summary { color: #cbd5e1; font-size: 12px; line-height: 1.35; word-break: break-word; overflow-wrap: anywhere; }
.chat-sdk-agent-detail { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px; align-items: start; color: #94a3b8; font-size: 10px; line-height: 1.25; min-width: 0; }
.chat-sdk-agent-detail-label { color: #64748b; font-weight: 800; text-transform: uppercase; }
.chat-sdk-agent-detail-value { min-width: 0; color: #cbd5e1; word-break: break-word; overflow-wrap: anywhere; }
/* Short stats (ID/Model/Started/Duration) flow inline and wrap to use the card
   width instead of one tall row each; long fields (summary/prompt/result) clamp
   to 2 lines so a card stays short. */
.chat-sdk-agent-stats { display: flex; flex-wrap: wrap; gap: 2px 12px; min-width: 0; }
.chat-sdk-agent-stat { display: inline-flex; align-items: baseline; gap: 4px; min-width: 0; max-width: 100%; }
.chat-sdk-agent-stat .chat-sdk-agent-detail-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.chat-sdk-agent-summary,
.chat-sdk-agent-detail:not(.chat-sdk-agent-stat) .chat-sdk-agent-detail-value { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chat-sdk-agent-meta { display: flex; flex-wrap: wrap; gap: 5px; color: #94a3b8; font-size: 10px; line-height: 1.2; }
.chat-sdk-agent-meta:empty { display: none; }
@media (max-width: 640px) {
  .chat-view-wrap.chat-split { flex-direction: column !important; }
  .chat-sdk-agents-panel,
  .chat-file-panel { width: 100% !important; min-width: 0; min-height: 150px; max-height: min(42dvh, 320px); border-left: 0; border-top: 1px solid #334155; }
  /* Agents panel on phones: cap at ~one agent card tall — its body scrolls for
     more — so a burst of sub-agents doesn't bury the chat. */
  .chat-sdk-agents-panel { min-height: 0; max-height: 140px; }
  .chat-panel-drag { display: none; }
  .chat-top-actions { top: 5px; right: 6px; gap: 5px; }
  .chat-sdk-agents-toggle { max-width: 112px; }
}
.chat-attachment-row { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; }
.chat-attachment-dl { background: #172337; border: 1px solid #334155; border-radius: 6px; color: #94a3b8; padding: 3px 8px; font-size: 12px; cursor: pointer; text-align: left; }
.chat-attachment-dl:hover { color: #e2e8f0; border-color: #475569; }
.chat-attachment-dl-btn { background: #172337; border: 1px solid #334155; border-radius: 6px; color: #64748b; padding: 3px 6px; font-size: 11px; cursor: pointer; line-height: 1; }
.chat-attachment-dl-btn:hover { color: #60a5fa; border-color: #3b82f6; }
.chat-event { margin: 2px 0; min-width: 0; transition: background 0.15s; border-radius: 6px; }
.chat-event.chat-highlight { background: rgba(52,211,153,0.12); box-shadow: inset 0 0 0 1.5px rgba(52,211,153,0.5); }
.chat-user { background: #1e3a5f; border-radius: 8px; padding: 6px 12px; align-self: flex-end; max-width: 80%; width: fit-content; text-align: left; word-break: break-all; overflow-wrap: break-word; position: relative; }
.chat-user.chat-pending { background: #1e3a5f80; color: #94a3b8; }
.chat-user.chat-failed { background: #3a1a1a; color: #fca5a5; border: 1px solid #7f1d1d; }
.chat-user-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11px; line-height: 1; }
.chat-user-status-pending { width: 11px; height: 11px; border: 1.5px solid #60a5fa80; border-top-color: #60a5fa; border-radius: 50%; animation: chat-spinner-rotate 0.8s linear infinite; vertical-align: -1px; margin-top: 4px; margin-left: 2px; }
@keyframes chat-spinner-rotate { to { transform: rotate(360deg); } }
.chat-user-status-failed { gap: 8px; }
.chat-user-status-icon { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; background: #dc2626; color: #fff; font-size: 10px; font-weight: 700; font-family: ui-sans-serif, system-ui, sans-serif; line-height: 1; cursor: help; }
.chat-user-retry-btn { background: #7f1d1d; color: #fecaca; border: 1px solid #b91c1c; border-radius: 4px; padding: 2px 10px; font-size: 11px; cursor: pointer; font-family: inherit; }
.chat-user-retry-btn:hover { background: #991b1b; color: #fff; border-color: #dc2626; }
.chat-user-retry-btn:active { background: #7f1d1d; }
.chat-user-message-fold { position: relative; min-width: 0; }
.chat-user-message-fold-content { line-height: 1.45; }
.chat-user-message-fold-content.is-folded { max-height: calc(1.45em * 10); overflow: hidden; }
.chat-user-message-fold.is-folded::after { content: ''; position: absolute; left: 0; right: 0; bottom: 28px; height: 28px; background: linear-gradient(transparent, #1e3a5f); pointer-events: none; border-radius: 0 0 8px 8px; }
.chat-user.chat-pending .chat-user-message-fold.is-folded::after { background: linear-gradient(transparent, rgba(30, 58, 95, 0.5)); }
.chat-user.chat-failed .chat-user-message-fold.is-folded::after { background: linear-gradient(transparent, #3a1a1a); }
.chat-user-message-fold-toggle { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; margin-top: 6px; padding: 2px 8px; border: 1px solid rgba(147, 197, 253, 0.35); border-radius: 999px; background: rgba(15, 23, 42, 0.18); color: #bfdbfe; font-family: inherit; font-size: 11px; line-height: 1.4; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.chat-user-message-fold-toggle:hover { background: rgba(15, 23, 42, 0.32); border-color: rgba(147, 197, 253, 0.6); color: #e0f2fe; }
.chat-user-message-fold-toggle:active { transform: translateY(1px); }
.chat-assistant { padding: 6px 10px; word-break: break-word; overflow-wrap: break-word; line-height: 1.5; background: #161b22; border-radius: 8px; border-left: 2px solid #1e293b; }
.chat-assistant-automation { border-left-color: #10b981; background: #101a19; }
.chat-rich-text { white-space: pre-wrap; }
.chat-code-block { background: #1a1a2e; border-radius: 8px; margin: 8px 0; overflow: hidden; }
.chat-code-block pre { margin: 0; padding: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; font-size: 13px; line-height: 1.4; }
.chat-code-block code { font-family: 'Cascadia Code', 'Fira Code', 'SF Mono', monospace; color: #e2e8f0; }
.chat-code-header { display: flex; align-items: center; background: #2a2a4a; padding: 3px 6px; }
.chat-code-titlebar { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.chat-code-header .chat-code-lang { background: transparent; padding: 2px 6px; }
.chat-code-lang { background: #2a2a4a; color: #94a3b8; font-size: 11px; padding: 4px 12px; font-family: sans-serif; }
.chat-code-copy-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; background: rgba(15,23,42,0.28); color: #94a3b8; border: 1px solid rgba(148,163,184,0.18); border-radius: 6px; padding: 0; cursor: pointer; line-height: 0; transition: color 0.15s, background 0.15s, border-color 0.15s; -webkit-tap-highlight-color: transparent; }
.chat-code-copy-btn:hover { color: #e2e8f0; background: rgba(15,23,42,0.58); border-color: rgba(148,163,184,0.36); }
.chat-code-copy-btn.is-copied { color: #34d399; background: rgba(16,185,129,0.12); border-color: rgba(52,211,153,0.32); }
.chat-code-copy-btn svg { display: block; }
.chat-inline-code { background: #1e293b; color: #93c5fd; padding: 1px 5px; border-radius: 3px; font-family: 'Cascadia Code', 'Fira Code', 'SF Mono', monospace; font-size: 0.9em; }
.chat-tool { color: #94a3b8; font-size: 14px; line-height: 1.6; min-height: 28px; padding: 6px 10px; background: #1e293b; border-radius: 6px; border-left: 3px solid #3b82f6; overflow: visible; white-space: normal; word-break: break-all; flex-shrink: 0; }
.chat-tool-icon { margin-right: 6px; font-weight: bold; color: #60a5fa; font-size: 14px; }
.chat-tool-name { color: #c4b5fd; font-weight: 600; margin-right: 6px; font-size: 14px; }
.chat-tool-input { color: #94a3b8; font-size: 13px; }
.chat-tool-result-preview { border-left-color: #334155; background: #0f172a; font-size: 12px; color: #64748b; margin-top: 1px; white-space: pre-wrap; word-break: break-word; max-height: 80px; overflow-y: auto; }
.chat-tool-group { display: flex; flex-direction: column; gap: 2px; }
.chat-tool-group .chat-event { margin: 0; }
.chat-tool-group-indent { margin-left: 6px; display: flex; flex-direction: column; gap: 2px; }
.chat-tool-block-fold.collapsed { position: relative; }
.chat-tool-block-fold.collapsed::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 20px; background: linear-gradient(transparent, #0a0e1a); pointer-events: none; }
.chat-tool-fold-btn { background: none; border: 1px dashed #334155; color: #64748b; font-size: 11px; padding: 2px 10px; cursor: pointer; border-radius: 4px; text-align: center; }
.chat-tool-fold-btn:hover { color: #94a3b8; border-color: #475569; }
.chat-tool-fold-inline { background: none; border: none; color: #64748b; font-size: 11px; cursor: pointer; padding: 0 2px; }
.chat-tool-fold-inline:hover { color: #94a3b8; }
.chat-tool-detail { margin-top: 4px; border-top: 1px dashed #334155; padding-top: 4px; }
.chat-tool-detail-summary { cursor: pointer; color: #94a3b8; font-size: 11px; user-select: none; }
.chat-tool-detail-section { margin-top: 6px; }
.chat-tool-detail-label { color: #64748b; font-size: 11px; margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
.chat-tool-detail-pre { margin: 0; padding: 6px 8px; background: #0f172a; border-radius: 4px; color: #cbd5e1; font-size: 11px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; overflow-x: auto; }
.chat-file-change { padding: 8px 10px; background: #0f172a; border-radius: 8px; border-left: 3px solid #22c55e; display: flex; flex-direction: column; gap: 8px; }
.chat-file-change-header { display: flex; flex-direction: column; gap: 4px; }
.chat-file-change-title { color: #dcfce7; font-size: 13px; font-weight: 700; }
.chat-file-change-meta, .chat-file-change-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chat-file-change-file { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 2px; border-top: 1px solid #1f2937; }
.chat-file-change-file:first-child { border-top: none; padding-top: 0; }
.chat-file-change-path { color: #93c5fd; font-size: 13px; font-weight: 600; cursor: pointer; user-select: text; word-break: break-word; }
.chat-file-change-path:hover { color: #bfdbfe; }
.chat-file-change-path:focus { outline: none; text-decoration: underline; }
.chat-file-change-chip { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 999px; background: rgba(15, 23, 42, 0.9); border: 1px solid #334155; color: #cbd5e1; font-size: 10px; }
.chat-file-change-chip-muted { color: #64748b; }
.chat-file-change-patches { display: flex; flex-direction: column; gap: 8px; }
.chat-file-change-patch { display: flex; flex-direction: column; gap: 6px; }
.chat-file-change-diff { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; background: #111827; border: 1px solid #1f2937; border-radius: 6px; }
.chat-file-change-diff-block { display: flex; flex-direction: column; gap: 0; }
/* Block header label (+ or -) is kept in DOM for accessibility but hidden —
   the per-row sign inside each .chat-file-change-diff-row already makes the
   direction obvious, so a separate legend adds noise. */
.chat-file-change-diff-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chat-file-change-diff-label-removed { color: #fca5a5; }
.chat-file-change-diff-label-added { color: #86efac; }
.chat-file-change-diff-pre { margin: 0; padding: 0; border-radius: 4px; color: #dbeafe; font-size: 11px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; overflow-x: auto; background: #0b1220; max-height: 260px; overflow-y: auto; }
.chat-file-change-diff-pre-removed { background: rgba(185, 28, 28, 0.28); color: #fecaca; }
.chat-file-change-diff-pre-added { background: rgba(34, 197, 94, 0.28); color: #dcfce7; }
/* Per-row: [ sign | line# | code ]. Background extends the full row so the
   green/red tint reads as a continuous band (mirrors git/gh diff layout). */
.chat-file-change-diff-row { display: grid; grid-template-columns: 20px 44px minmax(0, 1fr); gap: 8px; align-items: start; padding: 1px 8px; }
.chat-file-change-diff-sign { text-align: center; font-weight: 700; user-select: none; font-variant-numeric: tabular-nums; line-height: inherit; }
.chat-file-change-diff-pre-added .chat-file-change-diff-sign { color: #4ade80; }
.chat-file-change-diff-pre-removed .chat-file-change-diff-sign { color: #f87171; }
.chat-file-change-diff-ln { color: #94a3b8; text-align: right; user-select: none; font-variant-numeric: tabular-nums; opacity: 0.9; }
.chat-file-change-diff-code { white-space: pre-wrap; word-break: break-word; min-width: 0; }
.chat-file-change-diff-coarse { gap: 4px; }
.chat-file-change-coarse-text { color: #94a3b8; font-size: 11px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.chat-memory-context { margin-left: 18px; background: #0f172a; border: 1px solid #233044; border-left: 3px solid #6366f1; border-radius: 8px; }
.chat-memory-context-toggle { width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: none; color: #cbd5e1; padding: 8px 10px; cursor: pointer; text-align: left; }
.chat-memory-context-toggle:hover { background: rgba(99,102,241,0.08); }
.chat-memory-context-title { font-size: 12px; font-weight: 600; color: #c4b5fd; }
.chat-memory-context-summary { font-size: 11px; color: #94a3b8; }
.chat-memory-context-caret { margin-left: auto; font-size: 11px; color: #64748b; }
.chat-memory-context-body { display: flex; flex-direction: column; gap: 8px; padding: 0 10px 10px; }
.chat-memory-context-query { font-size: 11px; color: #94a3b8; white-space: pre-wrap; word-break: break-word; }
.chat-memory-context-list { display: flex; flex-direction: column; gap: 8px; }
.chat-memory-context-section { display: flex; flex-direction: column; gap: 6px; }
.chat-memory-context-section-title { color: #a5b4fc; font-size: 11px; font-weight: 600; letter-spacing: 0; }
.chat-memory-context-item { background: #111827; border: 1px solid #1f2937; border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.chat-memory-context-preference-item { border-color: #334155; background: #0b1220; }
.chat-memory-context-item-summary { font-size: 12px; line-height: 1.5; color: #e2e8f0; white-space: pre-wrap; word-break: break-word; }
.chat-memory-context-item-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-memory-context-chip { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 999px; background: rgba(30,41,59,0.9); border: 1px solid #334155; color: #94a3b8; font-size: 10px; }
.chat-memory-context-chip-muted { color: #64748b; }
.chat-memory-context-collapse-bottom { align-self: flex-start; background: none; border: 1px solid #334155; color: #94a3b8; border-radius: 6px; padding: 6px 10px; font-size: 11px; cursor: pointer; transition: color 0.15s, border-color 0.15s, background 0.15s; }
.chat-memory-context-collapse-bottom:hover { color: #e2e8f0; border-color: #6366f1; background: rgba(99,102,241,0.08); }
/* Gap shrunk to 0 because the expand toggle owns its own padding; the
   inner detail block adds its own margin-top below. */
.chat-memory-context-status { display: flex; flex-direction: column; padding: 0; }
.chat-memory-context-status-title { font-size: 12px; font-weight: 600; color: #c4b5fd; }
.chat-memory-context-status-summary { font-size: 12px; color: #e2e8f0; }
/* The single-line summary row for skipped/no-match cards. The title +
   summary sit side-by-side so the collapsed card reads as "Title — reason"
   instead of two stacked lines. */
.chat-memory-context-status-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
/* When a detail body exists we expose the toggle form so the user can
   expand-on-demand. Reuse chat-memory-context-toggle baseline but add a
   status-specific alignment override so the caret sits on the right. */
.chat-memory-context-status-toggle { justify-content: flex-start; }
.chat-memory-context-status-toggle .chat-memory-context-caret { margin-left: auto; font-size: 11px; color: #64748b; }
.chat-memory-context-status-detail { font-size: 11px; color: #94a3b8; white-space: pre-wrap; word-break: break-word; padding: 0 10px 10px; }
.chat-mode { display: inline-block; background: #1e1338; color: #a78bfa; padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.chat-system { text-align: center; color: #475569; font-size: 11px; padding: 4px 0; }
.chat-loading { text-align: center; color: #475569; padding: 24px; }
.chat-history-overlay { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 4; min-height: 24px; max-width: min(92%, 560px); border-radius: 999px; background: rgba(15, 23, 42, 0.82); border: 1px solid rgba(51, 65, 85, 0.82); box-shadow: 0 8px 24px rgba(2, 6, 23, 0.28); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 5px 9px; pointer-events: none; color: #94a3b8; }
.chat-history-overlay:not(.has-steps) { width: 24px; height: 24px; padding: 0; }
.chat-history-overlay-label { font-size: 10px; color: #cbd5e1; white-space: nowrap; flex-shrink: 0; }
.chat-history-overlay-steps { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.chat-history-step { display: inline-flex; align-items: center; gap: 3px; min-width: 0; font-size: 10px; line-height: 1.2; color: #64748b; white-space: nowrap; }
.chat-history-step-icon { display: inline-block; width: 10px; text-align: center; color: inherit; opacity: 0.9; }
.chat-history-step.running { color: #60a5fa; }
.chat-history-step.pending { color: #94a3b8; }
.chat-history-step.done { color: #34d399; }
.chat-refreshing-spinner { width: 10px; height: 10px; border: 1.5px solid #475569; border-top-color: #60a5fa; border-radius: 50%; animation: chat-spinner-rotate 0.8s linear infinite; }
.chat-thinking-bar { color: #94a3b8; font-size: 12px; padding: 6px 16px; background: #1e293b; border-top: 1px solid #334155; flex-shrink: 0; }
.chat-thinking-dots { animation: thinking-pulse 1.2s ease-in-out infinite; letter-spacing: 2px; }
.chat-thinking { padding: 2px 0; }
.chat-thinking-toggle { display: flex; align-items: center; gap: 6px; background: none; border: none; color: #64748b; cursor: pointer; font-family: inherit; font-size: 12px; padding: 3px 0; text-align: left; width: 100%; transition: color 0.15s; }
.chat-thinking-toggle.no-text { cursor: default; }
.chat-thinking-toggle:not(.no-text):hover { color: #94a3b8; }
.chat-thinking-dot { font-size: 13px; color: #818cf8; transition: color 0.3s; }
.chat-thinking-dot.done { color: #475569; }
.chat-thinking-label { color: #64748b; font-size: 12px; font-style: italic; }
.chat-thinking-text { display: block; margin-top: 4px; font-style: italic; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: #64748b; }
@keyframes thinking-pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
.chat-bubble-content { white-space: pre-wrap; word-break: break-word; }
.chat-bubble-time { font-size: 10px; color: #64748b; margin-top: 2px; }
.chat-sel-menu { position: absolute; z-index: 20; pointer-events: auto; display: flex; flex-wrap: wrap; gap: 4px; max-width: calc(100% - 16px); box-sizing: border-box; }
/* Touch-pointer layout: disable native text selection/callout in chat so our
   custom long-press timer handles Copy/Quote. This intentionally does NOT use
   viewport width: desktop users can run narrow windows and still need native
   selection plus the Copy/Quote popup. Keep in sync with ChatView.tsx's
   TOUCH_GESTURE_MEDIA_QUERY. */
@media (pointer: coarse) {
  .chat-view { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  /* `touch-action: manipulation` hands the second short tap to JS without
     iOS Safari's ~300ms double-tap-zoom probe. Viewport user-scalable=no
     already suppresses the zoom itself; this just removes the latency. */
  .chat-event.chat-assistant,
  .chat-event.chat-user {
    touch-action: manipulation;
  }
}
.chat-sel-btn { background: #1e293b; border: 1px solid #475569; color: #e2e8f0; font-size: 13px; padding: 5px 14px; border-radius: 6px; cursor: pointer; font-family: inherit; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,0.4); transition: background 0.15s; }
.chat-sel-btn:hover { background: #334155; }
.chat-sel-btn.copied { background: #166534; border-color: #16a34a; color: #86efac; }
.chat-scroll-btn { position: absolute; bottom: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; background: #334155; color: #e2e8f0; border: 1px solid #475569; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; z-index: 10; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.chat-scroll-btn:hover { background: #475569; }
.chat-snapshot-toggle { background: none; border: none; color: #64748b; cursor: pointer; font-size: 11px; font-family: inherit; padding: 2px 4px; }
.chat-snapshot-toggle:hover { color: #94a3b8; }
.chat-snapshot-content { background: #1e293b; border-radius: 4px; padding: 8px; font-size: 11px; overflow-x: auto; max-height: 200px; margin-top: 4px; }
.view-toggle { background: none; border: 1px solid #475569; color: #e2e8f0; border-radius: 4px; padding: 4px 8px; cursor: pointer; font-size: 14px; }
.file-badge { position: absolute; top: -6px; right: -6px; background: #f59e0b; color: #000; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; line-height: 1; }

/* ── Transport chat view ─────────────────────────────────────────── */
.transport-chat-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #0f172a; }
.transport-chat-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.transport-chat-input-row { flex-shrink: 0; display: flex; flex-direction: column; }
.transport-chat-textarea:focus { border-color: #3b82f6 !important; }
.view-toggle:hover { background: #334155; }
.desktop-view-toggle { display: flex; justify-content: flex-end; padding: 2px 8px; background: #0f172a; gap: 4px; }
.desktop-view-toggle .view-toggle { font-size: 12px; padding: 2px 8px; }
.desktop-view-toggle .desktop-main-maximize-toggle { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; }
.desktop-fb-float { position: fixed; z-index: 1500; display: flex; flex-direction: column; background: #0f172a; border: 1px solid #334155; border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); overflow: hidden; }
.desktop-fb-titlebar { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-bottom: 1px solid #334155; cursor: grab; flex-shrink: 0; user-select: none; }
.desktop-fb-titlebar:active { cursor: grabbing; }
.desktop-fb-resize-corner { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; }
.desktop-fb-resize-corner::after { content: ''; position: absolute; right: 3px; bottom: 3px; width: 8px; height: 8px; border-right: 2px solid #475569; border-bottom: 2px solid #475569; }

/* ── Sub-session preview cards ────────────────────────────────────────────── */
.subcard-bar { background: linear-gradient(180deg, #0b1220 0%, #080d16 100%); border-top: 1px solid rgba(34,211,238,0.18); box-shadow: 0 -8px 22px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.04); flex-shrink: 0; position: relative; }
.subcard-bar::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(34,211,238,0.65), rgba(52,211,153,0.5), transparent); pointer-events: none; }
.subcard-toolbar { display: flex; align-items: center; gap: 7px; padding: 6px 10px 5px; position: relative; z-index: 1; }
.subcard-toolbar-btn { background: rgba(15,23,42,0.58); border: 1px solid rgba(125,211,252,0.16); border-radius: 7px; color: #7b8797; cursor: pointer; font-size: 12px; padding: 3px 8px; transition: color 0.12s, border-color 0.12s, background 0.12s, box-shadow 0.12s; box-shadow: inset 0 1px 0 rgba(255,255,255,0.03); }
.subcard-toolbar-btn-labeled { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; white-space: nowrap; }
.subcard-toolbar-btn-label { font-size: 11px; font-weight: 600; letter-spacing: 0; line-height: 1; }
.subcard-toolbar-btn:hover { border-color: rgba(34,211,238,0.42); color: #dbeafe; background: rgba(8,145,178,0.14); box-shadow: 0 0 12px rgba(34,211,238,0.12), inset 0 1px 0 rgba(255,255,255,0.05); }
.subcard-toolbar-btn-active { border-color: rgba(34,211,238,0.6) !important; color: var(--chrome-accent) !important; background: rgba(8,145,178,0.22); box-shadow: 0 0 14px rgba(34,211,238,0.18), inset 0 1px 0 rgba(255,255,255,0.06); }
.subcard-size-panel { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px; flex-wrap: wrap; }
.subcard-size-label { font-size: 11px; color: #475569; }
.subcard-size-field { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #64748b; }
.subcard-size-input { width: 56px; background: #0f172a; border: 1px solid #334155; border-radius: 4px; color: #e2e8f0; padding: 2px 6px; font-size: 12px; font-family: inherit; outline: none; }
.subcard-size-input:focus { border-color: #3b82f6; }
.subcard-toolbar-label { font-size: 11px; color: #64748b; }
.daemon-stats-inline { font-size: 11px; margin-left: 8px; white-space: nowrap; }
.daemon-stats-inline-tech {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: min(72vw, 820px);
  min-width: 0;
  padding: 2px 7px;
  border: 1px solid rgba(34,211,238,0.16);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(34,211,238,0.09), rgba(168,85,247,0.08), rgba(15,23,42,0.42)),
    repeating-linear-gradient(90deg, rgba(125,211,252,0.08) 0 1px, transparent 1px 12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 0 16px rgba(34,211,238,0.08);
  color: #94a3b8;
  overflow: hidden;
}
.daemon-stats-compact { font-size: 10px; }
.daemon-stat-version,
.daemon-stat-uptime,
.daemon-stat-sep { color: #94a3b8; }
.daemon-stat-cpu { color: #4ade80; text-shadow: 0 0 9px rgba(74,222,128,0.28); }
.daemon-stat-cpu.warn { color: #fbbf24; text-shadow: 0 0 9px rgba(251,191,36,0.30); }
.daemon-stat-cpu.danger { color: #f87171; text-shadow: 0 0 9px rgba(248,113,113,0.32); }
.daemon-stat-mem { color: #60a5fa; text-shadow: 0 0 9px rgba(96,165,250,0.28); }
.daemon-stat-load { color: #c084fc; text-shadow: 0 0 9px rgba(192,132,252,0.32); }
.daemon-local-clock { color: #67e8f9; font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-flex; align-items: baseline; gap: 0; padding-left: 2px; text-shadow: 0 0 10px rgba(34,211,238,0.38); }
.daemon-local-clock-date,
.daemon-local-clock-time { display: inline-flex; align-items: baseline; gap: 0; }
.daemon-local-clock-space { white-space: pre; width: 0.5em; }
.daemon-local-clock-digit { display: inline-block; min-width: 0.62em; text-align: center; animation: daemon-clock-tick 0.28s cubic-bezier(0.2, 0.85, 0.25, 1); }
.daemon-local-clock-separator { color: #38bdf8; opacity: 0.72; }
@keyframes daemon-clock-tick {
  0% { opacity: 0; transform: translateY(-0.55em) scale(0.92); filter: blur(1px); }
  55% { opacity: 1; transform: translateY(0.08em) scale(1.04); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@media (prefers-reduced-motion: reduce) {
  .daemon-local-clock-digit { animation: none; }
}
@media (max-width: 640px) {
  .daemon-stats-inline-tech { max-width: calc(100vw - 92px); padding: 2px 5px; gap: 2px; }
  .daemon-stats-mobile .daemon-stat-version { max-width: 76px; overflow: hidden; text-overflow: ellipsis; }
  .daemon-stats-mobile .daemon-local-clock { max-width: 54px; overflow: hidden; }
}
.subcard-toolbar-add { background: rgba(8,145,178,0.12); border: 1px dashed rgba(34,211,238,0.34); border-radius: 7px; color: var(--chrome-accent); cursor: pointer; font-size: 16px; padding: 0 8px; margin-left: auto; transition: color 0.12s, border-color 0.12s, background 0.12s, box-shadow 0.12s; white-space: nowrap; box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); }
.subcard-toolbar-add-desktop { min-height: 26px; padding: 2px 10px; font-size: 12px; font-weight: 600; letter-spacing: 0; }
.subcard-toolbar-add:hover { border-color: rgba(52,211,153,0.65); color: #a7f3d0; background: rgba(20,83,45,0.26); box-shadow: 0 0 14px rgba(52,211,153,0.18), inset 0 1px 0 rgba(255,255,255,0.06); }
.subcard-empty-state { padding: 8px 12px; font-size: 12px; color: #475569; }
.subcard-empty-state strong { color: #64748b; }

/* Card scroll container */
.subsession-row-with-close { display: flex; align-items: stretch; min-width: 0; position: relative; z-index: 1; }
.subsession-row-with-close .subsession-bar,
.subsession-row-with-close .subcard-scroll { flex: 1 1 auto; min-width: 0; }
.subsession-close-all-strip { flex: 0 0 18px; width: 18px; min-height: 34px; margin: 7px 0 8px 8px; padding: 0; border: 1px solid rgba(34,211,238,0.28); border-radius: 8px; background: linear-gradient(180deg, rgba(15,23,42,0.82), rgba(8,47,73,0.34)); color: #67e8f9; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 0 14px rgba(34,211,238,0.10); transition: color 0.14s, border-color 0.14s, background 0.14s, box-shadow 0.14s, transform 0.14s; }
.subsession-close-all-strip:hover { color: #a7f3d0; border-color: rgba(52,211,153,0.62); background: linear-gradient(180deg, rgba(8,145,178,0.28), rgba(20,83,45,0.32)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 0 18px rgba(52,211,153,0.18); transform: translateY(-1px); }
.subsession-close-all-strip:active { transform: translateY(0); }
.subsession-close-all-strip-restore { border-color: rgba(52,211,153,0.48); color: #a7f3d0; background: linear-gradient(180deg, rgba(6,95,70,0.28), rgba(8,47,73,0.34)); }
.subsession-close-all-strip:disabled { cursor: not-allowed; color: #475569; border-color: rgba(71,85,105,0.34); background: rgba(15,23,42,0.38); box-shadow: inset 0 1px 0 rgba(255,255,255,0.025); transform: none; opacity: 0.72; }
.subsession-close-all-strip:disabled:hover { color: #475569; border-color: rgba(71,85,105,0.34); background: rgba(15,23,42,0.38); box-shadow: inset 0 1px 0 rgba(255,255,255,0.025); transform: none; }
.subsession-close-all-arrow { display: inline-block; font-size: 15px; line-height: 1; text-shadow: 0 0 10px rgba(34,211,238,0.5); }
.subcard-scroll { padding: 7px 10px 8px; gap: 10px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #334155 transparent; overscroll-behavior-x: contain; overscroll-behavior-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x; position: relative; z-index: 1; }
.subcard-scroll::-webkit-scrollbar { height: 4px; }
.subcard-scroll::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }
.subcard-single { display: flex; flex-wrap: nowrap; }
.subcard-double { display: grid; grid-template-rows: repeat(2, auto); grid-auto-flow: column; grid-auto-columns: 350px; }
.subcard-drag-wrap { flex-shrink: 0; cursor: grab; transition: opacity 0.15s; }
.subcard-drag-wrap:active { cursor: grabbing; }

/* Individual card */
.subcard { width: 350px; height: 250px; min-width: 350px; background: linear-gradient(180deg, #101826 0%, #0b0f18 100%); border: 1px solid rgba(125,211,252,0.16); border-top: 3px solid var(--subsession-accent-color, #38bdf8); border-radius: 8px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; display: flex; flex-direction: column; isolation: isolate; box-shadow: inset 0 1px 0 rgba(255,255,255,0.035); }
.subcard-header { border-radius: 8px 8px 0 0; overflow: hidden; }
.subcard:hover { border-color: rgba(34,211,238,0.34); box-shadow: 0 2px 16px rgba(0,0,0,0.46), 0 0 18px rgba(34,211,238,0.08), inset 0 1px 0 rgba(255,255,255,0.04); transform: translateY(-1px); }
.subcard-open { border-color: rgba(34,211,238,0.38); box-shadow: 0 4px 18px rgba(0,0,0,0.42), 0 0 18px rgba(34,211,238,0.10); }
.subcard-quick-open { z-index: 300; }
.subcard-overlay-open { z-index: 300; }
@keyframes subcard-sci-fi { 0% { border-color: #334155; box-shadow: 0 0 4px #00e5ff22; } 40% { border-color: #00e5ff; box-shadow: 0 0 12px #00e5ff88, 0 0 24px #00e5ff33; } 70% { border-color: #818cf8; box-shadow: 0 0 12px #818cf888, 0 0 24px #818cf833; } 100% { border-color: #334155; box-shadow: 0 0 4px #00e5ff22; } }
.subcard-running-pulse { animation: subcard-sci-fi 3.6s ease-in-out infinite; }
@keyframes subcard-focus-glow { 0%, 100% { box-shadow: 0 0 8px #60a5faaa, 0 0 20px #3b82f644; } 50% { box-shadow: 0 0 16px #60a5facc, 0 0 32px #3b82f666; } }
.subcard-focused:not(.subcard-running-pulse) { border-color: #60a5fa; border-width: 2px; box-shadow: 0 0 8px #60a5faaa, 0 0 20px #3b82f644; }
.subcard-focused.subcard-running-pulse { border-width: 2px; box-shadow: 0 0 12px #60a5faaa, 0 0 24px #3b82f644; }
.subcard,
.subcard:hover,
.subcard-open,
.subcard-focused,
.subcard-running-pulse { border-top-color: var(--subsession-accent-color, #38bdf8) !important; border-top-width: 3px; }
/* Active sub-session → SOLID 2px bottom accent, mirroring the top strip so the
   active card is bracketed top + bottom by its own colour. The dock card uses
   .subcard-focused; the collapsed bar button uses .focused. Desktop marks the
   single active card via focusedSubId; mobile (only ever ONE open sub-session)
   marks its open card .focused in JS so it lands here too. */
.subcard-focused,
.subsession-card.focused { border-bottom-color: var(--subsession-accent-color, #38bdf8) !important; border-bottom-width: 2px; border-bottom-style: solid; }
/* Desktop can open MULTIPLE sub-sessions but only ONE is active. An opened-but-
   not-active bar button gets a DASHED 2px bottom accent so it still reads as
   "open" without competing with the active card's solid bar. */
.subsession-card.open:not(.focused) { border-bottom-color: var(--subsession-accent-color, #38bdf8) !important; border-bottom-width: 2px; border-bottom-style: dashed; }
.subcard:not(.subcard-running-pulse):not(.subcard-focused) { transition: border-color 0.3s ease-out, box-shadow 0.3s ease-out; }

@keyframes idle-flash-opacity { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
.idle-flash-layer { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 4; contain: paint; will-change: opacity; }
.idle-flash-layer--frame { border: 1px solid rgba(239,68,68,0.92); box-shadow: inset 0 0 0 1px rgba(248,113,113,0.28), 0 0 14px rgba(239,68,68,0.34); opacity: 0; animation: idle-flash-opacity 0.42s ease-in-out 6; }
.idle-flash-layer--fill { background: rgba(239,68,68,0.16); box-shadow: inset 0 0 0 1px rgba(248,113,113,0.34); opacity: 0; animation: idle-flash-opacity 0.42s ease-in-out 6; z-index: 0; }

.subcard-header { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: linear-gradient(180deg, rgba(17,27,45,0.96), rgba(12,18,31,0.96)); border-bottom: 1px solid rgba(125,211,252,0.14); flex-shrink: 0; font-size: 12px; color: #cbd5e1; box-shadow: inset 0 1px 0 rgba(255,255,255,0.035); }
.subcard-icon { font-size: 13px; }
.subcard-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.subcard-badge { font-size: 10px; color: #f59e0b; }
.subcard-running { font-size: 8px; color: #4ade80; }

/* Model label badge in card header */
.subcard-model { font-size: 9px; color: #ddd6fe; background: rgba(76,29,149,0.42); border: 1px solid rgba(167,139,250,0.22); border-radius: 999px; padding: 0 5px; flex-shrink: 0; line-height: 14px; box-shadow: 0 0 8px rgba(167,139,250,0.12); }

/* Custom API indicator — amber ◉ dot when session uses a CC preset */
.subcard-custom-api { font-size: 10px; color: #f59e0b; flex-shrink: 0; }

/* Context bar — mini, right ~1/3 of card header */
.subcard-ctx-bar { position: relative; width: 32%; height: 5px; background: rgba(15,23,42,0.92); border: 1px solid rgba(125,211,252,0.14); border-radius: 999px; overflow: hidden; flex-shrink: 0; box-shadow: inset 0 0 8px rgba(0,0,0,0.42), 0 0 10px rgba(34,211,238,0.06); }
.subcard-ctx-bar::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent); opacity: 0.42; pointer-events: none; }
.subcard-ctx-input { position: absolute; left: 0; top: 0; height: 100%; background: linear-gradient(90deg, var(--chrome-accent-2), var(--chrome-accent)); border-radius: 999px; box-shadow: 0 0 10px rgba(52,211,153,0.42); }
.subcard-ctx-cache { position: absolute; left: 0; top: 0; height: 100%; background: linear-gradient(90deg, var(--chrome-accent-3), #818cf8); border-radius: 999px; box-shadow: 0 0 10px rgba(129,140,248,0.36); }

.subcard-preview { flex: 1; overflow-y: auto; overflow-x: hidden; }
.subcard-preview-terminal { display: flex; min-height: 0; }
.subcard-preview-terminal .terminal-wrap { width: 100%; height: 100%; min-height: 0; }
.subcard-scroll-bottom { position: absolute; bottom: 6px; right: 10px; width: 26px; height: 26px; border-radius: 50%; background: #334155; border: 1px solid #475569; color: #e2e8f0; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 5; opacity: 0.8; transition: opacity 0.15s; line-height: 1; padding: 0; }
.subcard-scroll-bottom:hover { opacity: 1; background: #3b82f6; border-color: #3b82f6; }
.subcard-resize-handle { position: absolute; top: 0; right: -8px; width: 20px; height: 100%; cursor: ew-resize; background: transparent; z-index: 10; transition: background 0.15s; touch-action: none; }
.subcard-resize-handle::after { content: '⋮'; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 12px; color: #334155; pointer-events: none; line-height: 1; }
.subcard-resize-handle:hover { background: rgba(59,130,246,0.4); }
.subcard-resize-handle:hover::after { color: #60a5fa; }
.subcard-input-area { flex-shrink: 0; border-top: 1px solid rgba(125,211,252,0.12); background: linear-gradient(180deg, #0a101b, #080d16); padding: 5px 6px; display: flex; flex-direction: column; gap: 3px; border-radius: 0 0 8px 8px; }
.subcard-input-row { display: flex; align-items: stretch; gap: 6px; }
.subcard-input-main { flex: 1; min-width: 0; }
.subcard-stop-btn { flex: 0 0 auto; width: 40px; min-width: 40px; margin-left: -6px; border-radius: 0 6px 6px 0; border: 1px solid rgba(239,68,68,0.55); background: rgba(127,29,29,0.32); color: #f87171; cursor: pointer; font-size: 11px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
.subcard-stop-btn:hover:not(:disabled) { background: rgba(127,29,29,0.48); border-color: rgba(248,113,113,0.8); color: #fca5a5; }
.subcard-stop-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.subcard-input-area .menu-dropdown { z-index: 10000; right: auto; left: 0; max-width: calc(100vw - 24px); }
.subcard-input-area .qp { z-index: 10002; }
.subcard-shortcuts { display: flex; gap: 3px; }
.subcard-shortcut-btn { background: #1a2233; border: 1px solid #334155; border-radius: 3px; color: #64748b; font-size: 10px; padding: 1px 5px; cursor: pointer; transition: all 0.12s; line-height: 1.4; }
.subcard-shortcut-btn:hover { border-color: #475569; color: #94a3b8; }
.subcard-shortcut-btn:active { background: #334155; }
.subcard-input { width: 100%; background: rgba(15,23,42,0.78); border: 1px solid rgba(125,211,252,0.16); border-radius: 6px; color: #e2e8f0; padding: 4px 8px; font-size: 12px; font-family: inherit; outline: none; box-sizing: border-box; }
.subcard-input:focus { border-color: rgba(34,211,238,0.62); box-shadow: 0 0 0 1px rgba(34,211,238,0.12), 0 0 12px rgba(34,211,238,0.10); }
.subcard-input::placeholder { color: #475569; }
.subcard-input:disabled { opacity: 0.5; cursor: not-allowed; }


/* ── Sub-session collapsed bar (mobile compact buttons) ──────────────────── */
.subsession-bar { display: flex; flex-wrap: nowrap; gap: 7px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, #0a1220 0%, #080d16 100%); border-top: 1px solid rgba(34,211,238,0.18); transition: max-height 0.2s, padding 0.2s, opacity 0.2s; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-x; overscroll-behavior-x: contain; overscroll-behavior-y: auto; -webkit-overflow-scrolling: touch; }
.subsession-bar::-webkit-scrollbar { display: none; }
/* Mobile: when input/terminal gets focus, hide elements below input.
   .input-focused is toggled instantly on focusin/focusout (no viewport delay).
   .kb-open is kept as fallback for viewport-based detection. */
@media (pointer: coarse) {
  .input-focused .subcard-bar { display: none; }
  .input-focused .session-usage-footer { display: none; }
  .input-focused .shell-terminal-pane .controls { display: none; }
  .input-focused .shell-terminal-pane .attachment-badges { display: none; }
  .input-focused .shell-terminal-pane .shell-quick-trigger { display: inline-flex !important; color: #fbbf24 !important; }
}
.kb-open .subcard-bar { display: none; }
.kb-open .session-usage-footer { display: none; }
.kb-open .shell-terminal-pane .controls { display: none; }
.kb-open .shell-terminal-pane .attachment-badges { display: none; }
/* Quick input trigger in shortcuts row: hidden by default, shown when shell input is hidden */
.shell-quick-trigger { display: none !important; }
.kb-open .shell-terminal-pane .shell-quick-trigger { display: inline-flex !important; color: #fbbf24 !important; }
.subsession-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 54px; min-height: 54px; padding: 6px 1px; background: linear-gradient(180deg, rgba(17,27,45,0.92), rgba(10,16,27,0.92)); border: 1px solid rgba(125,211,252,0.16); border-top: 3px solid var(--subsession-accent-color, #38bdf8); border-radius: 8px; color: #94a3b8; cursor: pointer; font-family: inherit; font-size: 11px; transition: transform 0.15s, border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s; flex-shrink: 0; position: relative; isolation: isolate; overflow: hidden; box-shadow: inset 0 1px 0 rgba(255,255,255,0.035); }
.subsession-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(34,211,238,0.12), transparent 38%, rgba(52,211,153,0.08)); opacity: 0; transition: opacity 0.15s; pointer-events: none; }
.subsession-card:hover, .subsession-card.open { border-color: rgba(34,211,238,0.44); background: linear-gradient(180deg, rgba(15,40,62,0.92), rgba(10,20,34,0.94)); color: #dbeafe; }
.subsession-card:hover::before, .subsession-card.open::before, .subsession-card.focused::before { opacity: 1; }
.subsession-card.open { transform: scale(1.08); z-index: 1; box-shadow: 0 0 0 1px rgba(34,211,238,0.16), 0 0 16px rgba(34,211,238,0.24); }
.subsession-card.focused { border-color: rgba(96,165,250,0.78); box-shadow: 0 0 0 1px rgba(96,165,250,0.28), 0 0 18px rgba(59,130,246,0.34); }
.subsession-card,
.subsession-card:hover,
.subsession-card.open,
.subsession-card.focused,
.subsession-card.subcard-running-pulse { border-top-color: var(--subsession-accent-color, #38bdf8) !important; border-top-width: 3px; }
.subsession-card-icon { font-size: 13px; font-weight: 700; letter-spacing: 0; line-height: 1; position: relative; z-index: 1; }
.subsession-card-label { font-size: 10px; color: #7b8797; position: relative; z-index: 1; }
.subsession-card.open .subsession-card-label { color: #bfdbfe; }
.subsession-card-badge { font-size: 10px; color: #f59e0b; }
.subsession-card-model { font-size: 9px; color: #818cf8; margin-left: 2px; }
.subsession-card-custom-api { font-size: 9px; color: #f59e0b; margin-left: 2px; }
.subsession-card-ctx { display: block; height: 3px; background: rgba(15,23,42,0.92); border-radius: 999px; overflow: hidden; margin-top: 2px; box-shadow: inset 0 0 5px rgba(0,0,0,0.42); }
.subsession-card-ctx-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--chrome-accent), var(--chrome-accent-2)); border-radius: 999px; transition: width 0.3s; box-shadow: 0 0 8px rgba(34,211,238,0.5); }

/* ── Sub-session window ───────────────────────────────────────────────────── */
.subsession-window { display: flex; flex-direction: column; background: linear-gradient(180deg, #0f1724, #090d15); border: 1px solid var(--subsession-accent-color, #38bdf8); border-radius: 8px; box-shadow: 0 12px 38px rgba(0,0,0,0.62), 0 0 0 1px rgba(255,255,255,0.025), 0 0 24px rgba(34,211,238,0.12); overflow: hidden; min-width: 300px; min-height: 200px; isolation: isolate; }
.subsession-window::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--subsession-accent-color, #38bdf8); opacity: 0.45; box-shadow: 0 0 10px color-mix(in srgb, var(--subsession-accent-color, #38bdf8) 45%, transparent); pointer-events: none; z-index: 3; transition: height 0.15s, opacity 0.15s, box-shadow 0.15s; }
.subsession-window-active { box-shadow: 0 14px 42px rgba(0,0,0,0.68), 0 0 0 1px rgba(96,165,250,0.22), 0 0 28px color-mix(in srgb, var(--subsession-accent-color, #38bdf8) 28%, transparent); }
.subsession-window-active::before { height: 3px; opacity: 1; box-shadow: 0 0 14px color-mix(in srgb, var(--subsession-accent-color, #38bdf8) 72%, transparent); }
/* Mirror the top accent strip onto the BOTTOM edge of an active sub-session
   window so the focused window is bracketed top + bottom by its own colour,
   matching the dock card (.subcard) / bar button (.subsession-card). 2px is
   enough for the bottom — the top strip stays the dominant 5px indicator. */
.subsession-window-active::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: var(--subsession-accent-color, #38bdf8); opacity: 1; box-shadow: 0 0 12px color-mix(in srgb, var(--subsession-accent-color, #38bdf8) 60%, transparent); pointer-events: none; z-index: 3; }
.subsession-window-maximized { border: 2px solid var(--subsession-accent-color, #38bdf8); box-shadow: 0 0 0 1px rgba(15,23,42,0.75), 0 8px 32px rgba(0,0,0,0.6), 0 0 24px rgba(34,211,238,0.12); box-sizing: border-box; }
.subsession-header { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: linear-gradient(180deg, rgba(17,27,45,0.98), rgba(10,16,27,0.98)); border-bottom: 1px solid rgba(125,211,252,0.16); cursor: move; user-select: none; flex-shrink: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); }
.subsession-drag-icon { color: rgba(34,211,238,0.48); font-size: 16px; cursor: grab; text-shadow: 0 0 8px rgba(34,211,238,0.16); }
.subsession-title { font-size: 12px; color: #dbeafe; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subsession-mode-btn { background: rgba(15,23,42,0.55); border: 1px solid rgba(125,211,252,0.14); border-radius: 6px; color: #7b8797; cursor: pointer; font-size: 13px; padding: 2px 6px; transition: color 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s; }
.subsession-mode-btn:hover { border-color: rgba(34,211,238,0.42); color: #dbeafe; background: rgba(8,145,178,0.14); }
.subsession-mode-btn.active { border-color: rgba(34,211,238,0.6); color: var(--chrome-accent); background: rgba(8,145,178,0.22); box-shadow: 0 0 12px rgba(34,211,238,0.14); }
.subsession-minimize-btn { background: rgba(15,23,42,0.35); border: 1px solid transparent; border-radius: 6px; color: #7b8797; cursor: pointer; font-size: 16px; padding: 3px 10px; line-height: 1; transition: color 0.15s, border-color 0.15s, background 0.15s; }
.subsession-minimize-btn:hover { color: #dbeafe; border-color: rgba(125,211,252,0.18); background: rgba(8,145,178,0.12); }
.subsession-close-btn { background: none; border: none; color: #64748b; cursor: pointer; font-size: 16px; padding: 4px 12px; line-height: 1; transition: color 0.15s; }
.subsession-close-btn:hover { color: #ef4444; }
.subsession-close-confirm-label { font-size: 11px; color: #f87171; padding: 0 2px; }
.subsession-session-surface { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.subsession-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Usage footer — between chat/terminal and input controls */
.session-usage-footer { flex-shrink: 0; padding: 5px 10px 4px; background: linear-gradient(180deg, rgba(17,27,45,0.88), rgba(8,13,22,0.96)); border-top: 1px solid rgba(34,211,238,0.16); box-shadow: inset 0 1px 0 rgba(255,255,255,0.035); }
.session-ctx-bar { position: relative; width: 100%; height: 6px; background: rgba(15,23,42,0.92); border: 1px solid rgba(125,211,252,0.14); border-radius: 999px; overflow: hidden; margin-bottom: 4px; box-shadow: inset 0 0 8px rgba(0,0,0,0.48), 0 0 10px rgba(34,211,238,0.06); }
.session-ctx-bar::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent); opacity: 0.45; pointer-events: none; }
.session-repo-branch-summary-chat-titlebar { min-width: 0; max-width: 180px; flex-shrink: 1; }
.session-usage-codex-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; align-items: center; }
.session-usage-codex-quota { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; margin-bottom: 2px; }
.session-usage-codex-line { color: #64748b; font-size: 9px; line-height: 1.2; text-align: right; }
.session-usage-weekly-authorize { background: none; border: none; padding: 0; margin: 0; font: inherit; font-size: 9px; line-height: 1.2; text-align: right; color: var(--chrome-accent, #22d3ee); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.session-usage-weekly-authorize:hover { color: #67e8f9; }
.session-ctx-input { position: absolute; left: 0; top: 0; height: 100%; background: linear-gradient(90deg, var(--chrome-accent-2), var(--chrome-accent)); border-radius: 999px; box-shadow: 0 0 10px rgba(52,211,153,0.42); }
.session-ctx-cache { position: absolute; left: 0; top: 0; height: 100%; background: linear-gradient(90deg, var(--chrome-accent-3), #818cf8); border-radius: 999px; box-shadow: 0 0 10px rgba(129,140,248,0.36); }

/* Tech-style context meters. Keep these static: ctx bars are numerous on
   mobile, and continuous animation here would compete with chat scrolling. */
.session-ctx-bar,
.subcard-ctx-bar,
.subsession-card-ctx {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(125,211,252,0.28);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(15,23,42,0.96), rgba(3,7,18,0.94)),
    repeating-linear-gradient(90deg, transparent 0 8px, rgba(125,211,252,0.10) 8px 9px);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.035),
    inset 0 0 12px rgba(0,0,0,0.62),
    0 0 14px rgba(34,211,238,0.16);
  isolation: isolate;
}
.session-usage-footer .session-ctx-bar { height: 8px; margin-bottom: 5px; }
.session-ctx-wrap .session-ctx-bar { width: 68px; height: 7px; margin-bottom: 0; }
.subcard-ctx-bar { width: 34%; height: 7px; }
.subsession-card-ctx { height: 4px; }
.session-ctx-bar::before,
.subcard-ctx-bar::before,
.subsession-card-ctx::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(191,219,254,0.34) 0 1px, transparent 1px 8px),
    linear-gradient(180deg, rgba(255,255,255,0.18), transparent 45%, rgba(15,23,42,0.28));
  opacity: 0.42;
}
.session-ctx-bar::after,
.subcard-ctx-bar::after,
.subsession-card-ctx::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 0 18%, rgba(255,255,255,0.28) 44%, transparent 72%);
  opacity: 0.22;
}
.session-ctx-input,
.subcard-ctx-input,
.subsession-card-ctx-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  overflow: hidden;
  border-radius: 999px;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.20) 0 3px, transparent 3px 7px),
    linear-gradient(90deg, var(--chrome-accent-2), var(--chrome-accent), #60a5fa);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    0 0 14px rgba(34,211,238,0.45);
  transition: width 0.32s cubic-bezier(0.22, 0.72, 0.22, 1), left 0.32s cubic-bezier(0.22, 0.72, 0.22, 1);
  z-index: 2;
}
.subcard-ctx-input,
.subsession-card-ctx-fill {
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.18) 0 3px, transparent 3px 7px),
    linear-gradient(90deg, var(--subsession-accent-color, #38bdf8), var(--chrome-accent-2), var(--chrome-accent));
}
.session-ctx-cache,
.subcard-ctx-cache {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  overflow: hidden;
  border-radius: 999px;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.18) 0 3px, rgba(255,255,255,0.04) 3px 6px, transparent 6px 9px),
    linear-gradient(90deg, #c084fc, #a855f7, #7c3aed);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.24),
    0 0 14px rgba(168,85,247,0.56);
  transition: width 0.32s cubic-bezier(0.22, 0.72, 0.22, 1), left 0.32s cubic-bezier(0.22, 0.72, 0.22, 1);
  z-index: 1;
}
.session-usage-footer .session-ctx-bar.is-burning {
  overflow: visible;
}
.session-usage-footer .session-ctx-bar.is-burning .session-ctx-cache,
.session-usage-footer .session-ctx-bar.is-burning .session-ctx-input {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.28),
    0 0 16px rgba(34,211,238,0.54),
    0 0 12px rgba(251,191,36,0.38);
}
.session-ctx-burn {
  position: absolute;
  left: 0;
  top: -7px;
  height: 13px;
  z-index: 6;
  pointer-events: none;
  border-radius: 999px;
  overflow: hidden;
  mix-blend-mode: screen;
}
.session-ctx-burn::before,
.session-ctx-burn::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.session-ctx-burn::before {
  opacity: 0;
  background:
    linear-gradient(100deg, transparent 0 12%, rgba(251,191,36,0.62) 34%, rgba(34,211,238,0.72) 48%, rgba(248,113,113,0.38) 58%, transparent 76%),
    linear-gradient(180deg, rgba(255,255,255,0.18), transparent 58%);
  animation: ctx-energy-scan 0.78s ease-out both;
}
.session-ctx-burn::after {
  opacity: 0;
  background:
    radial-gradient(circle at 7% 72%, rgba(251,191,36,0.98) 0 1px, transparent 2px),
    radial-gradient(circle at 16% 28%, rgba(34,211,238,0.92) 0 1px, transparent 2px),
    radial-gradient(circle at 29% 64%, rgba(248,113,113,0.86) 0 1px, transparent 2px),
    radial-gradient(circle at 43% 24%, rgba(253,224,71,0.92) 0 1px, transparent 2px),
    radial-gradient(circle at 58% 70%, rgba(34,211,238,0.86) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 34%, rgba(251,146,60,0.94) 0 1px, transparent 2px),
    radial-gradient(circle at 88% 62%, rgba(125,211,252,0.86) 0 1px, transparent 2px),
    linear-gradient(90deg, transparent, rgba(251,191,36,0.34), rgba(34,211,238,0.28), transparent);
  filter: drop-shadow(0 0 5px rgba(251,146,60,0.62)) drop-shadow(0 0 8px rgba(34,211,238,0.34));
  animation: ctx-burn-sparks 0.78s ease-out both;
}
@keyframes ctx-energy-scan {
  0% { opacity: 0; transform: translateX(-18%); }
  18% { opacity: 0.95; }
  70% { opacity: 0.48; }
  100% { opacity: 0; transform: translateX(18%); }
}
@keyframes ctx-burn-sparks {
  0% { opacity: 0; transform: translateY(4px) scaleX(0.96); }
  16% { opacity: 1; }
  46% { opacity: 0.86; }
  100% { opacity: 0; transform: translateY(-5px) scaleX(1.02); }
}
@media (prefers-reduced-motion: reduce) {
  .session-ctx-burn::before,
  .session-ctx-burn::after {
    animation: none;
    opacity: 0;
  }
}
.session-usage-stats { display: flex; align-items: center; gap: 6px; justify-content: space-between; min-width: 0; font-size: 10px; color: #475569; }
.session-live-status-inline { display: inline-flex; align-items: center; justify-content: center; gap: 1px; min-width: 20px; color: #818cf8; min-width: 0; max-width: min(42vw, 240px); }
.session-live-status-emoji { display: inline-block; font-size: 12px; line-height: 1; filter: saturate(1.1); }
.session-live-status-emoji.robot { transform: translateY(0.2px); }
.session-live-status-robot-avatar { width: 16px; height: 16px; flex: 0 0 auto; object-fit: contain; filter: saturate(1.08) drop-shadow(0 0 4px rgba(34,211,238,0.34)); transform-origin: 50% 50%; }
.session-live-status-emoji.robot.session-live-status-robot-avatar { transform: translateY(0.2px) scale(1.125); }
.session-live-status-text { color: #818cf8; font-size: 10px; line-height: 1.1; margin-left: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.92; }
.session-live-status-inline.running .session-live-status-emoji.gear { animation: status-gear-spin 0.8s linear infinite; transform-origin: 50% 50%; }
.session-live-status-inline.thinking .session-live-status-emoji.thought { font-size: 10px; transform: translateY(-2px) translateX(-1px); opacity: 0.94; animation: status-thought-breathe 1.8s ease-in-out infinite; transform-origin: 50% 100%; }
.session-live-status-inline.tool .session-live-status-emoji.tool { animation: status-tool-peek 1.15s ease-in-out infinite; transform-origin: 50% 50%; }
.session-live-status-inline.waiting .session-live-status-emoji.wait { animation: status-wait-flip 1.2s ease-in-out infinite; transform-origin: 50% 50%; }
.session-live-status-inline.result { color: #34d399; }
.session-live-status-inline.result .session-live-status-emoji.result { filter: saturate(1.2); }
.session-live-status-inline.idle .session-live-status-emoji.sleep { font-size: 9px; transform: translateY(-3px) translateX(-1px); opacity: 0.9; animation: status-sleep-breathe 1.8s ease-in-out infinite; transform-origin: 50% 100%; }
.session-usage-model { color: #c4b5fd; font-size: 10px; font-weight: 600; margin-right: 6px; text-shadow: 0 0 8px rgba(167,139,250,0.18); }
.session-usage-tokens { color: #7b8797; }
.session-usage-badge { color: #93c5fd; border: 1px solid rgba(34,211,238,0.28); background: rgba(8,145,178,0.10); border-radius: 999px; padding: 1px 6px; line-height: 1.4; box-shadow: inset 0 1px 0 rgba(255,255,255,0.035); }
.session-usage-quota-inline { color: #64748b; font-size: 9px; line-height: 1.4; white-space: nowrap; }
.session-usage-cost { color: #94a3b8; }
@keyframes status-gear-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes status-thought-breathe {
  0%, 100% { transform: translateY(-2px) translateX(-1px) scale(0.9); opacity: 0.72; }
  50% { transform: translateY(-3px) translateX(-1px) scale(1.06); opacity: 1; }
}
@keyframes status-tool-peek {
  0%, 100% { transform: translateX(0) rotate(0deg) scale(0.98); }
  35% { transform: translateX(0.5px) rotate(-8deg) scale(1.03); }
  65% { transform: translateX(0.5px) rotate(8deg) scale(1.03); }
}
@keyframes status-wait-flip {
  0%, 100% { transform: rotate(0deg) scale(0.95); opacity: 0.76; }
  50% { transform: rotate(180deg) scale(1.08); opacity: 1; }
}
@keyframes status-sleep-breathe {
  0%, 100% { transform: translateY(-3px) translateX(-1px) scale(0.88); opacity: 0.72; }
  50% { transform: translateY(-4px) translateX(-1px) scale(1.08); opacity: 1; }
}
.subsession-input-bar { display: flex; gap: 6px; padding: 6px 8px; background: linear-gradient(180deg, rgba(17,27,45,0.88), rgba(8,13,22,0.96)); border-top: 1px solid rgba(34,211,238,0.16); box-shadow: inset 0 1px 0 rgba(255,255,255,0.035); flex-shrink: 0; }
.subsession-input { flex: 1; background: linear-gradient(180deg, rgba(15,23,42,0.92), rgba(8,13,22,0.94)); border: 1px solid rgba(125,211,252,0.18); border-radius: 7px; color: #e2e8f0; font-family: inherit; font-size: 13px; padding: 6px 10px; outline: none; box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), inset 0 0 18px rgba(34,211,238,0.025); transition: border-color 0.14s, box-shadow 0.14s, background 0.14s; }
.subsession-input:focus { border-color: rgba(34,211,238,0.62); box-shadow: 0 0 0 1px rgba(34,211,238,0.14), 0 0 16px rgba(34,211,238,0.12), inset 0 1px 0 rgba(255,255,255,0.055); background: linear-gradient(180deg, rgba(15,40,62,0.72), rgba(8,13,22,0.94)); }
.subsession-send-btn { flex-shrink: 0; font-size: 12px; padding: 4px 12px; }

/* ── Resize handles ───────────────────────────────────────────────────────── */
.resize-handle { position: absolute; z-index: 10; }
.resize-n  { top: 0; left: 8px; right: 8px; height: 4px; cursor: n-resize; }
.resize-s  { bottom: 0; left: 8px; right: 8px; height: 4px; cursor: s-resize; }
.resize-e  { right: 0; top: 8px; bottom: 8px; width: 4px; cursor: e-resize; }
.resize-w  { left: 0; top: 8px; bottom: 8px; width: 4px; cursor: w-resize; }
.resize-ne { top: 0; right: 0; width: 12px; height: 12px; cursor: ne-resize; }
.resize-nw { top: 0; left: 0; width: 12px; height: 12px; cursor: nw-resize; }
.resize-se { bottom: 0; right: 0; width: 12px; height: 12px; cursor: se-resize; }
.resize-sw { bottom: 0; left: 0; width: 12px; height: 12px; cursor: sw-resize; }

/* ── Generic dialog overlay ──────────────────────────────────────────────── */
/* Padding bakes in iOS safe-area insets so the dialog never touches the
   status bar/notch or the home-indicator. Dialog itself is capped to the
   remaining vertical space and split into flex-column header/body so the
   body scrolls while the header stays pinned — required because some
   dialogs (SessionSettingsDialog) are taller than the viewport on mobile. */
.dialog-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  padding: calc(var(--sat, 0px) + 16px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
}
.dialog {
  background: #1e293b; border: 1px solid #334155; border-radius: 8px;
  width: 100%;
  max-width: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 32px);
  min-width: 0;
  box-sizing: border-box;
  max-height: 100%;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.dialog, .dialog * { box-sizing: border-box; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; flex-shrink: 0; }
.dialog-header h2 { margin: 0; font-size: 15px; color: #f1f5f9; }
.dialog-close { background: none; border: none; color: #64748b; font-size: 20px; cursor: pointer; line-height: 1; padding: 0; }
.dialog-close:hover { color: #e2e8f0; }
.dialog-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
}

/* ── Sub-session start dialog extras ─────────────────────────────────────── */
.subsession-type-groups { display: flex; flex-direction: column; gap: 12px; }
.subsession-type-group { display: flex; flex-direction: column; gap: 8px; }
.subsession-type-group-title { font-size: 11px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: #64748b; }
.subsession-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.subsession-type-btn { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: #1e293b; border: 1px solid #334155; border-radius: 6px; color: #94a3b8; cursor: pointer; font-size: 13px; font-family: inherit; transition: all 0.15s; }
.subsession-type-btn:hover { background: #253348; border-color: #475569; color: #e2e8f0; }
.subsession-type-btn.active { background: #1e3a5f; border-color: #3b82f6; color: #93c5fd; }

/* ── Discussion dialog ────────────────────────────────────────────────────── */
.discussion-participant-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 8px; background: #0f172a; border: 1px solid #1e293b; border-radius: 6px; }
.discussion-verdict-badge { font-size: 14px; margin-left: 2px; flex-shrink: 0; }
.discussion-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
.discussion-panel .discussions-progress-card {
  border-radius: 10px;
}
.discussion-panel .discussions-progress-card-compact {
  padding: 8px 10px 10px;
}
.discussion-panel .discussions-progress-card-compact .discussions-progress-head {
  margin-bottom: 6px;
}
.discussion-panel .discussions-progress-card-compact .discussions-progress-title {
  font-size: 12px;
}
.discussion-panel .discussions-progress-card-compact .discussions-progress-meta {
  margin-bottom: 6px;
}
.discussion-panel .discussions-progress-card-compact .discussions-progress-lines {
  gap: 6px;
  margin-bottom: 8px;
}
.discussion-panel .discussions-progress-card-compact .discussions-progress-segments-round {
  height: 16px;
}
.discussion-panel .discussions-progress-card-compact .discussions-progress-segments-hop {
  height: 12px;
}
.discussion-panel .discussions-progress-card-compact .discussions-progress-node {
  padding: 4px 7px;
  font-size: 10px;
}
.discussion-panel-desktop-compact { padding: 5px 8px; gap: 5px; }
.discussion-panel-desktop-compact .discussions-progress-card-mobile { padding: 4px 8px !important; }
.discussion-panel-desktop-compact .discussions-progress-mobile-title { margin-top: 1px; }
/* Mobile ultra-compact P2P card */
.discussion-panel-mobile { padding: 4px 6px; gap: 4px; }
.discussions-progress-card-mobile {
  flex: none !important;
  min-width: 0 !important;
  max-width: none !important;
  width: 100%;
  padding: 5px 8px !important;
  border-radius: 8px !important;
}
.discussions-progress-card-mobile::before { display: none; }
.discussions-progress-mobile-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.discussions-progress-mobile-row .discussions-progress-kicker { font-size: 9px; flex: 0 0 auto; }
.discussions-progress-mobile-row .discussions-progress-badge { padding: 1px 5px; font-size: 9px; }
.discussions-progress-mobile-row .discussions-progress-node {
  padding: 2px 6px;
  font-size: 9px;
  gap: 4px;
  border: none;
  background: transparent;
  flex: 0 1 auto;
  min-width: 0;
}
.discussions-progress-mobile-row .discussions-progress-node-dot { width: 5px; height: 5px; }
.discussions-progress-mobile-row .discussions-progress-node-label { max-width: 120px; font-size: 9px; }
.discussions-progress-mobile-row .discussions-progress-node-phase { font-size: 8px; }
.discussions-progress-mobile-title {
  font-size: 10px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.discussion-card { background: #0f172a; border: 1px solid #1e293b; border-radius: 6px; padding: 10px; }
.discussion-card.running { border-color: #22c55e40; }
.discussion-card.verdict { border-color: #f59e0b40; }
.discussion-card.done { border-color: #3b82f640; }
.discussion-card.failed { border-color: #ef444440; }
.discussion-card-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.discussion-card-title { font-size: 13px; font-weight: 500; color: #e2e8f0; flex: 1; }
.discussion-card-actions { flex-shrink: 0; }
.discussion-card-body { margin-top: 8px; }
.discussion-status { font-size: 12px; color: #94a3b8; }
.discussion-status.done { color: #22c55e; }
.discussion-status.failed { color: #ef4444; }
.discussion-progress-bar { height: 4px; background: #1e293b; border-radius: 2px; overflow: hidden; margin-bottom: 6px; }
.discussion-progress-fill { height: 100%; background: #22c55e; border-radius: 2px; transition: width 0.3s ease; }
.discussion-conclusion { font-size: 12px; color: #94a3b8; margin-top: 6px; line-height: 1.5; border-top: 1px solid #1e293b; padding-top: 6px; max-height: 100px; overflow-y: auto; }
.discussion-filepath { font-size: 11px; color: #64748b; margin-top: 4px; font-family: monospace; }

/* ── Discussions Page ──────────────────────────────────────────────────── */
.discussions-page { display: flex; flex: 1; min-width: 0; min-height: 0; flex-direction: column; height: 100%; background: #0a0e1a; color: #e2e8f0; }
.discussions-layout { display: flex; flex: 1; min-width: 0; min-height: 0; overflow: hidden; }
.discussions-list { width: 320px; min-width: 280px; border-right: 1px solid #1e293b; overflow-y: auto; }
.discussions-list-item { padding: 12px 16px; border-bottom: 1px solid #1e293b10; cursor: pointer; transition: background 0.15s; }
.discussions-list-item:hover { background: #1e293b60; }
.discussions-list-item.active { background: #1e293b; border-left: 3px solid #3b82f6; }
.discussions-list-item.live { border-left: 3px solid #22c55e; }
.discussions-list-item.active.live { border-left: 3px solid #22c55e; }
.discussions-list-topic { font-size: 14px; font-weight: 500; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.discussions-list-meta { font-size: 12px; color: #64748b; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.discussions-list-state { font-weight: 500; display: flex; align-items: center; gap: 4px; }
.discussions-list-time { margin-left: auto; }
.discussions-copy-wrap { position: relative; flex: 0 0 auto; }
.discussions-copy-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #334155;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.82);
  color: #94a3b8;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.discussions-copy-btn:hover { border-color: #64748b; color: #e2e8f0; }
.discussions-copy-btn.is-copied { color: #22c55e; border-color: rgba(34, 197, 94, 0.65); }
.discussions-copy-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  min-width: 126px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 10px 28px rgba(2, 6, 23, 0.42);
}
.discussions-copy-menu-item {
  border: none;
  background: transparent;
  color: #cbd5e1;
  border-radius: 6px;
  padding: 7px 10px;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
}
.discussions-copy-menu-item:hover { background: rgba(30, 41, 59, 0.9); }
.discussions-pulse { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; animation: pulse-glow 3s ease-in-out infinite; will-change: opacity; }
@keyframes pulse-glow { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.discussions-empty { padding: 40px 20px; text-align: center; color: #64748b; font-size: 14px; }
.discussions-progress-strip {
  padding: 10px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid #1e293b;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(10, 14, 26, 0.96));
}
.discussions-progress-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.discussions-progress-strip-headcopy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.discussions-progress-strip-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #93c5fd;
}
.discussions-progress-strip-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(96, 165, 250, 0.45) rgba(15, 23, 42, 0.65);
}
.discussions-progress-strip-scroll::-webkit-scrollbar {
  height: 8px;
}
.discussions-progress-strip-scroll::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.65);
  border-radius: 999px;
}
.discussions-progress-strip-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.9), rgba(56, 189, 248, 0.9));
  border-radius: 999px;
}
.discussions-progress-strip-toggle {
  border: 1px solid rgba(71, 85, 105, 0.9);
  background: rgba(15, 23, 42, 0.76);
  color: #cbd5e1;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.discussions-progress-strip-toggle:hover {
  border-color: rgba(96, 165, 250, 0.65);
  color: #e2e8f0;
}
.discussions-progress-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(2, 6, 23, 0.96)),
    linear-gradient(135deg, rgba(59, 130, 246, 0.10), rgba(34, 197, 94, 0.06));
  border: 1px solid rgba(71, 85, 105, 0.7);
  border-radius: 12px;
  padding: 10px 12px 8px;
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.06), 0 10px 24px rgba(2, 6, 23, 0.28);
}
/* In the horizontal strip: stretch to fill, max 3 visible, scroll beyond */
.discussions-progress-strip-inner {
  display: flex;
  gap: 10px;
  min-width: 100%;
}
.discussions-progress-strip-inner .discussions-progress-card {
  flex: 1 1 calc(33.333% - 7px);
  min-width: calc(33.333% - 7px);
}
.discussions-progress-card::before {
  display: none;
}
.discussions-progress-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.discussions-progress-titlewrap { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.discussions-progress-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #60a5fa;
}
.discussions-progress-title {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  max-height: calc(1.35em * 2);
  word-break: break-word;
}
.discussions-progress-stop {
  flex: 0 0 auto;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(127, 29, 29, 0.18);
  color: #fca5a5;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.discussions-progress-stop:hover { background: rgba(127, 29, 29, 0.28); }

/* ── P2P elapsed timers ─────────────────────────────────────────────── */
.p2p-timer {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}
.p2p-timer-total {
  font-size: 12px;
  padding: 3px 10px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}
.p2p-timer-hop {
  font-size: 10px;
  padding: 2px 8px;
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.22);
  text-shadow: 0 0 6px rgba(167, 139, 250, 0.4);
}
/* Mobile compact timers */
.p2p-timer-compact {
  font-size: 9px;
  padding: 1px 5px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  text-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}
.p2p-timer-hop-compact {
  font-size: 9px;
  padding: 1px 5px;
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.06);
  border: 1px solid rgba(167, 139, 250, 0.18);
  text-shadow: 0 0 5px rgba(167, 139, 250, 0.35);
}

.discussions-progress-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.discussions-progress-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  min-width: 0;
  max-width: 100%;
}
.discussions-progress-line {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}
.discussions-progress-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.discussions-progress-line-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}
.discussions-progress-line-value {
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
}
.discussions-progress-slogan {
  align-self: center;
  max-width: 100%;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.discussions-progress-badge {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(71, 85, 105, 0.8);
  background: rgba(15, 23, 42, 0.72);
  color: #94a3b8;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.discussions-progress-badge-mode {
  border-color: rgba(96, 165, 250, 0.35);
  color: #93c5fd;
  background: rgba(30, 41, 59, 0.95);
}
.discussions-progress-badge-phase {
  border-color: rgba(34, 197, 94, 0.3);
  color: #86efac;
}
.discussions-progress-segments {
  display: flex;
  gap: 3px;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}
.discussions-progress-segments-round { height: 18px; }
.discussions-progress-segments-hop { height: 14px; }
.discussions-progress-segment {
  flex: 1;
  border-radius: 999px;
  background: #334155;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
  opacity: 0.95;
}
.discussions-progress-segment.is-done { background: linear-gradient(90deg, #16a34a, #4ade80); box-shadow: 0 0 10px rgba(74, 222, 128, 0.35); }
.discussions-progress-segment.is-active,
.discussions-progress-segment.is-active-static {
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
  outline: 1px solid rgba(125, 211, 252, 0.75);
  z-index: 1;
}
.discussions-progress-segment.is-active {
  animation: discussions-active-pulse 3s ease-in-out infinite;
  will-change: opacity, transform;
}
.discussions-progress-segment.is-skipped { background: linear-gradient(90deg, #dc2626, #f87171); box-shadow: 0 0 10px rgba(248, 113, 113, 0.35); }
.discussions-progress-segment.is-pending { background: linear-gradient(90deg, #1e293b, #475569); }
.discussions-progress-segment-index {
  font-size: 9px;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.92);
  text-shadow: 0 1px 2px rgba(2, 6, 23, 0.6);
  pointer-events: none;
}
.discussions-progress-segment.is-pending .discussions-progress-segment-index {
  color: rgba(148, 163, 184, 0.75);
}
.discussions-progress-nodes { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; min-width: 0; max-width: 100%; scrollbar-width: none; }
.discussions-progress-nodes::-webkit-scrollbar { display: none; }
.discussions-progress-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid rgba(51, 65, 85, 0.9);
  background: rgba(15, 23, 42, 0.78);
  color: #94a3b8;
  font-size: 11px;
}
.discussions-progress-node-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
  flex: 0 0 auto;
}
.discussions-progress-node-label {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e2e8f0;
}
.discussions-progress-node-mode,
.discussions-progress-node-phase {
  font-size: 10px;
  color: #64748b;
}
.discussions-progress-node.is-done { color: #4ade80; border-color: rgba(34, 197, 94, 0.25); }
.discussions-progress-node.is-active,
.discussions-progress-node.is-active-static {
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.14);
}
.discussions-progress-node.is-active {
  animation: discussions-active-chip 3s ease-in-out infinite;
  will-change: opacity;
}
.discussions-progress-node.is-active .discussions-progress-node-label,
.discussions-progress-node.is-active .discussions-progress-node-dot {
  animation: discussions-active-text 3s ease-in-out infinite;
  will-change: opacity;
}
.discussions-progress-node.is-skipped { color: #f87171; border-color: rgba(248, 113, 113, 0.3); }
.discussions-progress-node.is-pending { color: #64748b; }
.discussions-detail { position: relative; flex: 1 1 auto; min-width: 0; max-width: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.discussions-detail-scroll { flex: 1; width: 100%; max-width: 100%; min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior-x: contain; }
.discussions-file-preview {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}
.discussions-file-preview .fb-preview-md {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.discussions-file-preview .fb-preview-md * {
  max-width: 100%;
}
.discussions-file-preview .fb-preview-md p,
.discussions-file-preview .fb-preview-md li,
.discussions-file-preview .fb-preview-md blockquote,
.discussions-file-preview .fb-preview-md code,
.discussions-file-preview .fb-preview-md pre,
.discussions-file-preview .fb-preview-md pre code {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.discussions-file-preview .fb-preview-md pre {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.discussions-file-preview .fb-preview-md table {
  display: table;
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  overflow-wrap: anywhere;
}
.discussions-file-preview .fb-preview-md th,
.discussions-file-preview .fb-preview-md td {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.discussions-file-preview .fb-preview-md img {
  max-width: 100%;
  height: auto;
}
.discussions-nav-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(10, 14, 26, 0.98), rgba(10, 14, 26, 0.94));
  border-bottom: 1px solid rgba(30, 41, 59, 0.9);
}
.discussions-nav-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
.discussions-back-btn { background: none; border: none; color: #3b82f6; cursor: pointer; padding: 0; font-size: 14px; line-height: 1.2; text-align: left; }
@media (min-width: 769px) { .discussions-back-btn { display: none; } }
.discussions-follow-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 180px;
  min-width: 0;
  color: #cbd5e1;
  font-size: 13px;
  user-select: none;
}
.discussions-follow-toggle input {
  margin: 0;
  accent-color: #38bdf8;
}
.discussions-follow-toggle span {
  white-space: normal;
  line-height: 1.2;
}
.discussions-scroll-arrows {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}
.discussions-scroll-btn-floating {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.24);
}
.discussions-scroll-btn { background: none; border: 1px solid #334155; color: #94a3b8; cursor: pointer; border-radius: 4px; width: 28px; height: 28px; font-size: 14px; display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
.discussions-scroll-btn:active { background: #334155; color: #e2e8f0; }
.discussions-detail-header { padding: 16px; border-bottom: 1px solid #1e293b; }
.discussions-detail-header h3 { margin: 0 0 8px; font-size: 16px; }
.discussions-detail-meta { font-size: 13px; color: #94a3b8; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.discussions-detail-participants { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.discussions-participant-tag { background: #1e293b; padding: 2px 8px; border-radius: 4px; font-size: 11px; color: #94a3b8; }
.discussions-progress-bar { height: 4px; background: #1e293b; border-radius: 2px; overflow: hidden; margin-top: 10px; }
.discussions-progress-fill { height: 100%; background: #22c55e; border-radius: 2px; transition: width 0.5s ease; }
.discussions-rounds { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.discussions-round { background: #0f172a; border: 1px solid #1e293b; border-radius: 8px; padding: 14px; }
.discussions-round-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.discussions-round-agent { color: #64748b; font-size: 11px; }
.discussions-round-num { margin-left: auto; color: #475569; font-size: 11px; }
.discussions-round-body { font-size: 13px; line-height: 1.6; color: #cbd5e1; white-space: pre-wrap; word-break: break-word; }
.discussions-conclusion { margin: 0 16px 16px; background: #172337; border: 1px solid #22c55e40; border-radius: 8px; padding: 14px; }
.discussions-conclusion-label { font-size: 13px; font-weight: 600; color: #22c55e; margin-bottom: 8px; }
.discussions-conclusion-text { font-size: 13px; line-height: 1.6; color: #e2e8f0; white-space: pre-wrap; }
.discussions-file-content { margin: 0 16px 16px; }
.discussions-file-content summary { font-size: 13px; color: #94a3b8; cursor: pointer; padding: 8px; }
.discussions-file-content pre { background: #0f172a; border: 1px solid #1e293b; border-radius: 6px; padding: 12px; font-size: 12px; color: #94a3b8; overflow-x: auto; white-space: pre-wrap; max-height: 400px; overflow-y: auto; }
@media (max-width: 768px) {
  .discussions-layout { flex-direction: column; position: relative; }
  .discussions-list { width: 100%; border-right: none; border-bottom: 1px solid #1e293b; flex: 1; overflow-y: auto; }
  /* When a discussion is selected on mobile, detail goes full-screen over the list */
  .discussions-layout .discussions-detail-fullscreen {
    position: absolute; inset: 0; z-index: 10; background: #0a0e1a;
    display: flex; flex-direction: column;
  }
  .discussions-nav-row { align-items: flex-start; }
  .discussions-nav-controls {
    flex-basis: 100%;
    row-gap: 8px;
    justify-content: flex-end;
  }
  .discussions-scroll-btn-floating { width: 38px; height: 38px; }
}

/* AskQuestionDialog */
.ask-dialog-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 9999; padding: calc(var(--sat, 0px) + 16px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px); }
.ask-dialog { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 20px; width: 100%; max-width: 480px; max-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 16px; }
.ask-question-block { display: flex; flex-direction: column; gap: 8px; }
.ask-status { font-size: 12px; font-weight: 600; border-radius: 8px; padding: 8px 10px; line-height: 1.4; }
.ask-status-waiting { color: #fbbf24; background: rgba(251,191,36,0.10); border: 1px solid rgba(251,191,36,0.28); }
.ask-status-retained { color: #94a3b8; background: rgba(148,163,184,0.10); border: 1px solid rgba(148,163,184,0.24); }
.ask-header { font-size: 11px; font-weight: 600; color: #818cf8; text-transform: uppercase; letter-spacing: 0.05em; }
.ask-question { font-size: 14px; color: #e2e8f0; line-height: 1.5; }
.ask-options { display: flex; flex-direction: column; gap: 6px; }
.ask-option { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; border: 1px solid #334155; cursor: pointer; transition: border-color 0.15s; }
.ask-option input { display: none; }
.ask-option-selected { border-color: #818cf8; background: #818cf810; }
.ask-option-label { font-size: 13px; color: #e2e8f0; }
.ask-option-desc { font-size: 11px; color: #64748b; }
.ask-custom-input { background: #0f172a; border: 1px solid #334155; border-radius: 8px; padding: 8px 12px; color: #e2e8f0; font-size: 13px; outline: none; }
.ask-custom-input:focus { border-color: #818cf8; }
.ask-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }
.ask-btn-cancel { background: transparent; border: 1px solid #334155; border-radius: 8px; padding: 8px 16px; color: #64748b; font-size: 13px; cursor: pointer; }
.ask-btn-submit { background: #818cf8; border: none; border-radius: 8px; padding: 8px 16px; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.ask-btn-submit:hover { background: #6366f1; }

/* Stop session confirm dialog */
.stop-session-dialog { max-width: 380px; text-align: center; }
.stop-session-dialog-icon { font-size: 32px; line-height: 1; color: #f59e0b; }
.stop-session-dialog-title { font-size: 16px; font-weight: 700; color: #f1f5f9; }
.stop-session-dialog-body { font-size: 13px; color: #94a3b8; line-height: 1.6; }
.stop-session-dialog-body strong { color: #e2e8f0; }
.stop-session-confirm-btn { background: #ef4444 !important; }
.stop-session-confirm-btn:hover { background: #dc2626 !important; }
.single-agent-dialog { max-width: 460px; }
.single-agent-dialog-icon { font-size: 28px; line-height: 1; }
.single-agent-dialog-title { font-size: 16px; font-weight: 700; color: #f1f5f9; }
.single-agent-dialog-body { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: #94a3b8; line-height: 1.6; }
.single-agent-dialog-checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #cbd5e1; cursor: pointer; }
.single-agent-dialog-checkbox input { margin: 0; }
.onboarding-choice-dialog { max-width: 520px; }
.onboarding-choice-title { font-size: 18px; font-weight: 700; color: #f1f5f9; }
.onboarding-choice-body { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: #94a3b8; line-height: 1.6; }
.onboarding-choice-actions { flex-wrap: wrap; }
.onboarding-overlay { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.72); z-index: 10000; }
.onboarding-highlight { position: fixed; border: 2px solid #60a5fa; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.45), 0 0 0 6px rgba(96, 165, 250, 0.18); pointer-events: none; z-index: 10001; }
.onboarding-card { position: fixed; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); background: #1e293b; border: 1px solid #334155; border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; z-index: 10002; box-shadow: 0 20px 50px rgba(0,0,0,0.45); }
.onboarding-card-floating { transform: none; inset: auto; }
.onboarding-step { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #60a5fa; }
.onboarding-title { font-size: 17px; font-weight: 700; color: #f8fafc; }
.onboarding-body { display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.6; color: #cbd5e1; }
.team-discussion-guide { position: fixed; z-index: 10003; background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.98)); border: 1px solid rgba(96, 165, 250, 0.42); border-radius: 12px; padding: 14px 14px 12px; color: #dbeafe; box-shadow: 0 18px 48px rgba(2, 6, 23, 0.48), 0 0 0 1px rgba(14, 165, 233, 0.10), 0 0 28px rgba(37, 99, 235, 0.16); }
.team-discussion-guide::before { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: linear-gradient(135deg, rgba(125, 211, 252, 0.13), transparent 36%, rgba(168, 85, 247, 0.08)); }
.team-discussion-guide-arrow { position: absolute; width: 16px; height: 16px; background: rgba(15, 23, 42, 0.98); border: 1px solid rgba(96, 165, 250, 0.42); transform: rotate(45deg); }
.team-discussion-guide-arrow-above { bottom: -9px; border-left: 0; border-top: 0; }
.team-discussion-guide-arrow-below { top: -9px; border-right: 0; border-bottom: 0; }
.team-discussion-guide-close { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border: 0; border-radius: 999px; background: rgba(15, 23, 42, 0.62); color: #93c5fd; cursor: pointer; font-size: 17px; line-height: 22px; display: flex; align-items: center; justify-content: center; }
.team-discussion-guide-close:hover { background: rgba(30, 41, 59, 0.92); color: #eff6ff; }
.team-discussion-guide-kicker { position: relative; width: fit-content; margin-bottom: 7px; padding: 2px 7px; border-radius: 999px; background: rgba(14, 165, 233, 0.14); color: #7dd3fc; border: 1px solid rgba(125, 211, 252, 0.22); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.team-discussion-guide-title { position: relative; padding-right: 28px; color: #f8fafc; font-size: 15px; font-weight: 800; line-height: 1.35; }
.team-discussion-guide-body { position: relative; margin-top: 8px; display: flex; flex-direction: column; gap: 7px; color: #bfdbfe; font-size: 12.5px; line-height: 1.52; }
.team-discussion-guide-action { position: relative; margin-top: 12px; align-self: flex-start; border: 1px solid rgba(96, 165, 250, 0.38); border-radius: 8px; background: rgba(37, 99, 235, 0.24); color: #dbeafe; padding: 6px 10px; font-size: 12px; font-weight: 700; cursor: pointer; }
.team-discussion-guide-action:hover { background: rgba(37, 99, 235, 0.36); color: #ffffff; }
@media (max-width: 640px) {
  .team-discussion-guide { display: none; }
}

/* ── Sidebar redesign (tasks 1.2-1.4) ────────────────────────────────────── */

/* Server icon bar — narrow fixed-width vertical strip (Discord/Slack style) */
.server-icon-bar { display: flex; flex-direction: column; align-items: center; width: 48px; min-width: 48px; background: repeating-linear-gradient(180deg, transparent 0 22px, rgba(125,211,252,0.026) 22px 23px), linear-gradient(180deg, #0b1220 0%, #070b13 100%); border-right: 1px solid rgba(34,211,238,0.18); padding: 8px 0; gap: 4px; overflow-y: auto; scrollbar-width: none; flex-shrink: 0; box-shadow: inset -1px 0 0 rgba(255,255,255,0.035), 8px 0 24px rgba(0,0,0,0.22); }
.server-icon-bar::-webkit-scrollbar { display: none; }
.server-icon { position: relative; width: 38px; height: 34px; border-radius: 11px; background: linear-gradient(180deg, rgba(30,41,59,0.84), rgba(15,23,42,0.86)); border: 1px solid rgba(125,211,252,0.16); color: #94a3b8; font-size: 15px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s, border-color 0.15s, color 0.15s, border-radius 0.15s, box-shadow 0.15s, transform 0.15s; padding: 0; flex-shrink: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); overflow: visible; }
.server-icon::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,0.10), transparent 42%); opacity: 0.35; pointer-events: none; }
.server-icon:hover { background: linear-gradient(180deg, rgba(8,145,178,0.24), rgba(15,23,42,0.88)); color: #e2e8f0; border-color: rgba(34,211,238,0.42); border-radius: 11px; box-shadow: 0 0 16px rgba(34,211,238,0.16), inset 0 1px 0 rgba(255,255,255,0.06); transform: translateY(-1px); }
.server-icon-active { background: linear-gradient(180deg, rgba(34,211,238,0.28), rgba(29,78,216,0.30)); color: #fff; border-color: rgba(34,211,238,0.68); border-radius: 11px; box-shadow: 0 0 0 1px rgba(34,211,238,0.16), 0 0 18px rgba(34,211,238,0.22), inset 0 1px 0 rgba(255,255,255,0.08); }
.server-icon-active:hover { background: linear-gradient(180deg, rgba(34,211,238,0.32), rgba(29,78,216,0.34)); border-radius: 11px; }
.server-icon-letter { line-height: 1; pointer-events: none; }
.server-icon-dot { position: absolute; bottom: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid #080d16; pointer-events: none; box-shadow: 0 0 8px currentColor; z-index: 1; }

/* Sidebar panel — collapsible, resizable */
.sidebar-panel { display: flex; flex-direction: column; min-width: 0; background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(125,211,252,0.024) 22px 23px), linear-gradient(180deg, #0d1422 0%, #080d16 100%); border-right: 1px solid rgba(34,211,238,0.18); position: relative; transition: width 0.2s ease; overflow: visible; flex-shrink: 0; box-shadow: inset -1px 0 0 rgba(255,255,255,0.035), 10px 0 26px rgba(0,0,0,0.24); }
.sidebar-panel-collapsed { width: 0 !important; border-right: none; }
.sidebar-panel-header { display: flex; align-items: center; justify-content: flex-end; padding: 4px 6px; border-bottom: 1px solid rgba(34,211,238,0.16); background: linear-gradient(180deg, rgba(34,211,238,0.09), rgba(8,13,22,0.16)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); flex-shrink: 0; min-height: 32px; }
.sidebar-content { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(34,211,238,0.38) transparent; min-height: 0; }
.sidebar-content::-webkit-scrollbar { width: 4px; }
.sidebar-content::-webkit-scrollbar-track { background: transparent; }
.sidebar-content::-webkit-scrollbar-thumb { background: rgba(34,211,238,0.34); border-radius: 2px; }
.sidebar-toggle { background: rgba(15,23,42,0.42); border: 1px solid rgba(125,211,252,0.14); color: #7b8797; cursor: pointer; font-size: 16px; padding: 2px 6px; line-height: 1; border-radius: 6px; transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s; }
.sidebar-toggle:hover { color: var(--chrome-accent); background: rgba(8,145,178,0.16); border-color: rgba(34,211,238,0.42); box-shadow: 0 0 12px rgba(34,211,238,0.14); }
.sidebar-resize-handle { position: absolute; top: 0; right: 0; width: 4px; height: 100%; cursor: ew-resize; background: transparent; z-index: 10; transition: background 0.15s; touch-action: none; }
.sidebar-resize-handle:hover { background: rgba(34,211,238,0.38); box-shadow: 0 0 12px rgba(34,211,238,0.22); }
@media (pointer: coarse) { .sidebar-resize-handle { width: 12px; right: -4px; } }
.sidebar-resize-grip { position: absolute; right: -10px; bottom: 80px; z-index: 12; cursor: ew-resize; user-select: none; touch-action: none; font-size: 10px; letter-spacing: 2px; color: #7b8797; background: linear-gradient(180deg, rgba(15,23,42,0.96), rgba(8,13,22,0.96)); border: 1px solid rgba(125,211,252,0.18); border-radius: 7px; padding: 4px 2px; line-height: 1; display: flex; align-items: center; opacity: 0.62; transition: opacity 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s; box-shadow: 0 6px 16px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.04); }
.sidebar-resize-grip::after { content: ''; position: absolute; top: -12px; bottom: -12px; left: -12px; right: -12px; } /* larger touch target */
.sidebar-resize-grip:hover { color: var(--chrome-accent); border-color: rgba(34,211,238,0.52); opacity: 1; box-shadow: 0 0 14px rgba(34,211,238,0.18), inset 0 1px 0 rgba(255,255,255,0.06); }
.sidebar-resize-grip:active { color: #67e8f9; border-color: rgba(103,232,249,0.68); opacity: 1; }
.sidebar-footer { flex-shrink: 0; padding: 6px 8px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 6px; border-top: 1px solid rgba(34,211,238,0.13); background: rgba(8,13,22,0.42); box-shadow: inset 0 1px 0 rgba(255,255,255,0.025); }
.sidebar-build-time { font-size: 9px; color: #7b8797; white-space: nowrap; }
.sidebar-copyright { font-size: 9px; color: #7b8797; white-space: nowrap; }

/* ── Session Tree (task 2.1–2.5) ─────────────────────────────────────────── */
.session-tree { display: flex; flex-direction: column; padding: 6px 0; }
.session-tree-empty { padding: 12px 16px; color: #5f7087; font-size: 12px; }
.session-tree-header { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 0; }
.session-tree-collapse-all { background: none; border: none; color: #5f7087; font-size: 10px; cursor: pointer; padding: 2px 10px; text-align: left; transition: color 0.15s; }
.session-tree-collapse-all:hover { color: #bfdbfe; }
.session-tree-add-btn { background: rgba(15,23,42,0.52); border: 1px solid rgba(125,211,252,0.18); color: #7b8797; font-size: 13px; cursor: pointer; border-radius: 7px; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; transition: color 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s; margin-left: auto; box-shadow: inset 0 1px 0 rgba(255,255,255,0.03); }
.session-tree-add-btn:hover { color: var(--chrome-accent); border-color: rgba(34,211,238,0.5); background: rgba(8,145,178,0.16); box-shadow: 0 0 12px rgba(34,211,238,0.16); }
.session-tree-add-sub-btn { background: none; border: none; color: #5f7087; font-size: 13px; cursor: pointer; padding: 0 4px; opacity: 0; transition: opacity 0.15s, color 0.15s; flex-shrink: 0; }
.session-tree-main-row:hover .session-tree-add-sub-btn { opacity: 1; }
.session-tree-add-sub-btn:hover { color: var(--chrome-accent); }
.session-tree-main-row { display: flex; align-items: stretch; }
.session-tree-main-row > .session-tree-node { flex: 1; min-width: 0; }
.session-tree-toggle { background: none; border: none; color: #5f7087; cursor: pointer; padding: 0 2px 0 6px; font-size: 10px; line-height: 1; flex-shrink: 0; transition: color 0.15s, text-shadow 0.15s; }
.session-tree-toggle:hover { color: #bfdbfe; text-shadow: 0 0 8px rgba(34,211,238,0.24); }

/* Main and sub-session nodes */
.session-tree-node { display: flex; align-items: center; gap: 5px; width: calc(100% - 8px); margin: 1px 4px; padding: 5px 8px; background: rgba(15,23,42,0.20); border: 1px solid transparent; color: #94a3b8; font-size: 12px; font-family: inherit; cursor: pointer; text-align: left; border-radius: 7px; transition: background 0.12s, color 0.12s, border-color 0.12s, box-shadow 0.12s; flex-shrink: 0; overflow: hidden; position: relative; isolation: isolate; }
.session-tree-node::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(34,211,238,0.12), transparent 52%); opacity: 0; pointer-events: none; z-index: 0; }
.session-tree-node:hover { background: rgba(8,145,178,0.12); border-color: rgba(125,211,252,0.14); color: #e2e8f0; box-shadow: inset 0 1px 0 rgba(255,255,255,0.035); }
.session-tree-node:hover::before { opacity: 0.6; }
.session-tree-node--active { background: linear-gradient(90deg, rgba(34,211,238,0.18), rgba(15,23,42,0.34)); border-color: rgba(34,211,238,0.36); color: #f8fafc; box-shadow: 0 0 0 1px rgba(34,211,238,0.08), 0 0 14px rgba(34,211,238,0.12), inset 0 1px 0 rgba(255,255,255,0.05); }
.session-tree-node--active::before { opacity: 1; }
.session-tree-node--active:hover { background: linear-gradient(90deg, rgba(34,211,238,0.22), rgba(15,23,42,0.40)); }
.session-tree-node > * { position: relative; z-index: 1; }
/* Sub-session indent */
.session-tree-node--sub { padding-left: 34px; font-size: 11px; }

/* Icon (terminal ▶ or cloud ☁) */
.session-tree-icon { font-size: 9px; color: #5f7087; flex-shrink: 0; }
.session-tree-node--active .session-tree-icon { color: var(--chrome-accent); text-shadow: 0 0 8px rgba(34,211,238,0.45); }

/* Label */
.session-tree-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }

/* Spacer between label and badges */
.session-tree-spacer { flex: 1; min-width: 4px; }

/* State dot */
.session-tree-state-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 8px currentColor; }

/* Unread count badge (task 2.4) */
.sidebar-unread-badge { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(180deg, var(--chrome-accent-3), #6366f1); color: #fff; border-radius: 999px; font-size: 10px; font-weight: 700; padding: 0 5px; min-width: 16px; height: 16px; line-height: 1; flex-shrink: 0; box-shadow: 0 0 10px rgba(167,139,250,0.34); }

/* On desktop, hide the legacy server-list sidebar (replaced by ServerIconBar) */
.sidebar-desktop-hidden { display: none !important; }

/* ── Sidebar Pinned Panels (task 4.2, 4.3) ──────────────────────────────── */
/* Drop zone highlight when dragging a panel over the sidebar */
.sidebar-panel-drop-active { background: rgba(34,211,238,0.08); }
.sidebar-drop-zone { position: absolute; inset: 0; border: 2px dashed rgba(34,211,238,0.72); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #a5f3fc; font-size: 13px; font-weight: 600; background: rgba(8,145,178,0.16); pointer-events: none; z-index: 100; margin: 4px; box-shadow: inset 0 0 24px rgba(34,211,238,0.14), 0 0 20px rgba(34,211,238,0.12); }

/* Individual pinned panel container */
.sidebar-pinned-panel { display: flex; flex-direction: column; border-top: 1px solid rgba(34,211,238,0.22); background: linear-gradient(180deg, rgba(15,23,42,0.92), rgba(8,13,22,0.94)); position: relative; overflow: hidden; flex-shrink: 0; min-height: 100px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 -1px 0 rgba(0,0,0,0.18); }

/* Panel header: title + unpin button */
.sidebar-pinned-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px; background: linear-gradient(180deg, rgba(17,27,45,0.86), rgba(8,13,22,0.78)); border-bottom: 1px solid rgba(125,211,252,0.13); flex-shrink: 0; min-height: 28px; gap: 4px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.035); }
.sidebar-pinned-title { font-size: 11px; font-weight: 600; color: #bfdbfe; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; text-shadow: 0 0 8px rgba(34,211,238,0.10); }
.sidebar-pinned-unpin { background: none; border: none; color: #5f7087; cursor: pointer; font-size: 14px; padding: 0 4px; line-height: 1; border-radius: 3px; flex-shrink: 0; transition: color 0.15s, background 0.15s; }
.sidebar-pinned-unpin:hover { color: #f87171; }

/* Content area fills remaining height — 6px bottom padding for absolute resize handle */
.sidebar-pinned-content { flex: 1; overflow: hidden; min-height: 0; display: flex; flex-direction: column; padding-bottom: 6px; }

/* Unavailable / stale panel placeholder */
.sidebar-pinned-unavailable { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #5f7087; padding: 16px; text-align: center; }

/* Resize handle at the bottom of each pinned panel */
/* When keyboard is open, constrain the focused panel to fit above the keyboard */
.kb-open .sidebar-pinned-panel:focus-within { max-height: calc(var(--vvh, 100vh) - 80px); }
.sidebar-pinned-resize-handle { position: absolute; bottom: 0; left: 0; right: 0; height: 6px; cursor: ns-resize; background: rgba(30,41,59,0.62); transition: background 0.15s, box-shadow 0.15s; touch-action: none; z-index: 5; }
.sidebar-pinned-resize-handle:hover { background: rgba(34,211,238,0.28); box-shadow: 0 0 12px rgba(34,211,238,0.16); }
@media (pointer: coarse) { .sidebar-pinned-resize-handle { height: 14px; } .sidebar-pinned-resize-handle::before { content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 32px; height: 3px; border-radius: 2px; background: rgba(125,211,252,0.28); } }

/* Language switcher */
.lang-switcher { background: #1e293b; border: 1px solid #334155; color: #94a3b8; cursor: pointer; font-size: 11px; padding: 2px 4px; border-radius: 4px; transition: all 0.15s; font-family: inherit; max-width: 120px; }
.lang-switcher:hover { border-color: #64748b; color: #e2e8f0; }

/* ── FileBrowser ─────────────────────────────────────────────────────────── */
.fb-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; }
.fb-modal { background: linear-gradient(180deg, #111827, #0d1422); border: 1px solid rgba(125,211,252,0.2); border-radius: 10px; width: min(92vw, 680px); max-height: 84vh; display: flex; flex-direction: column; box-shadow: 0 14px 42px rgba(0,0,0,.58), 0 0 24px rgba(34,211,238,0.08); overflow: hidden; }
.fb-panel { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
/* Panel layout: remove max-width cap so tree can be resized freely */
.fb-panel .fb-files-and-changes.fb-tree-split { max-width: none; }
.fb-panel .fb-body-split > .fb-tree { max-width: none; }
/* Draggable resize handle between tree and preview */
.fb-resize-handle { width: 4px; cursor: col-resize; background: transparent; flex-shrink: 0; transition: background .15s; position: relative; z-index: 1; }
.fb-resize-handle:hover, .fb-resize-handle:active { background: #3b82f6; }
/* Panel tabs (Files | Changes) */
.fb-panel-tabs { display: flex; border-bottom: 1px solid rgba(125,211,252,0.14); flex-shrink: 0; background: linear-gradient(180deg, rgba(15,23,42,0.76), rgba(8,13,22,0.62)); }
.fb-panel-tab { flex: 1; background: none; border: none; border-bottom: 2px solid transparent; color: #64748b; cursor: pointer; padding: 7px 10px; font-size: 12px; font-weight: 600; transition: color .15s, background .15s, border-color .15s; display: flex; align-items: center; justify-content: center; gap: 4px; position: relative; }
.fb-panel-tab:hover { color: #dbeafe; background: rgba(8,145,178,0.10); }
.fb-panel-tab.active { color: #e2e8f0; background: rgba(34,211,238,0.08); border-bottom-color: var(--chrome-accent); box-shadow: inset 0 -1px 0 rgba(34,211,238,0.32); }
.fb-panel-tab-badge { background: #6366f1; color: #fff; border-radius: 10px; font-size: 10px; padding: 0 5px; min-width: 16px; text-align: center; }
/* Files-and-changes wrapper in panel mode */
.fb-files-and-changes { display: flex; flex-direction: column; overflow: hidden; min-height: 0; flex: 1; min-width: 0; }
.fb-files-and-changes.fb-tree-split { flex: 0 0 38%; min-width: 180px; border-right: 1px solid #334155; overflow: hidden; }
.fb-files-and-changes .fb-tree { flex: 3; overflow-y: auto; min-height: 0; }
.fb-body-split .fb-files-and-changes { border-right: 1px solid #334155; }
/* Git changes section.
   Currently always the sole content of its container — directly under
   `.fb-body` when no preview is split, inside `.fb-tree.fb-tree-split`
   when a preview pane is open. The earlier `max-height: 25%` cap was
   for the old layout where the section sat alongside the file tree
   inside `.fb-files-and-changes` (embedded use removed in commit
   6c3c1169). With no sibling to share space with, the cap just clipped
   the list to ~10 items because `.fb-changes-section` is also
   `overflow: hidden` — hiding everything past the cap even though
   `.fb-changes-list` is `overflow-y: auto`. Let the section fill its
   container so the list scrolls naturally. */
.fb-changes-section { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.fb-tree.fb-changes-tree { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.fb-tree.fb-changes-tree > .fb-changes-section { flex: 1; min-height: 0; }
.fb-changes-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: linear-gradient(180deg, #0d1422, #0a101b); border-bottom: 1px solid rgba(125,211,252,0.08); flex-shrink: 0; }
.fb-changes-title { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .05em; }
.fb-changes-refresh { background: none; border: none; color: #64748b; cursor: pointer; font-size: 14px; padding: 0 4px; }
.fb-changes-refresh:hover { color: #e2e8f0; }
.fb-changes-list { overflow-y: auto; flex: 1; }
.fb-changes-group { }
.fb-changes-group-label { font-size: 10px; color: #475569; text-transform: uppercase; letter-spacing: .05em; padding: 4px 10px 2px; font-weight: 600; }
.fb-changes-item { display: flex; align-items: center; gap: 5px; padding: 3px 10px; cursor: pointer; font-size: 12px; user-select: none; }
.fb-changes-item:hover { background: rgba(255,255,255,.05); }
.fb-changes-item.active { background: rgba(99,102,241,.15); }
.fb-changes-item-badge { font-size: 9px; font-weight: 700; padding: 0 3px; border-radius: 3px; background: rgba(251,191,36,.15); color: #fbbf24; flex-shrink: 0; font-family: monospace; }
.fb-changes-item-name { color: #e2e8f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.fb-changes-item-dir { font-size: 10px; color: #475569; flex-shrink: 0; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-changes-item-stats { font-size: 10px; font-family: monospace; margin-left: auto; flex-shrink: 0; white-space: nowrap; }
.fb-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid rgba(125,211,252,0.16); background: linear-gradient(180deg, rgba(17,27,45,0.96), rgba(10,16,27,0.96)); font-weight: 700; font-size: 13px; flex-shrink: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); }
.fb-close { background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 4px; flex-shrink: 0; }
.fb-close:hover { color: #e2e8f0; }
.fb-breadcrumb { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid #1e293b; font-size: 11px; color: #64748b; font-family: monospace; overflow: hidden; flex-shrink: 0; }
.fb-breadcrumb-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.fb-error-inline { color: #f87171; font-size: 11px; flex-shrink: 0; }
.fb-nav-stack { display: flex; flex-direction: column; background: #0b1220; border-bottom: 1px solid rgba(125,211,252,0.10); flex-shrink: 0; min-width: 0; }
.fb-nav { display: flex; align-items: center; gap: 4px; padding: 6px 10px 4px; background: #0b1220; flex-shrink: 0; }
.fb-nav-spacer { flex: 1; min-width: 8px; }
.fb-nav-btn { background: rgba(15,23,42,0.58); border: 1px solid rgba(125,211,252,0.14); border-radius: 6px; color: #64748b; cursor: pointer; padding: 2px 7px; font-size: 13px; line-height: 1.4; transition: color .12s, border-color .12s, background .12s; }
.fb-nav-btn:hover:not(:disabled) { color: #e2e8f0; border-color: rgba(34,211,238,0.42); background: rgba(8,145,178,0.12); }
.fb-nav-btn:disabled { opacity: 0.3; cursor: default; }
.fb-nav-btn-error { color: #f87171; border-color: #7f1d1d; }
.fb-nav-btn-error:hover { color: #fca5a5; border-color: #991b1b; }
.fb-breadcrumb-row { display: flex; align-items: center; min-width: 0; padding: 0 10px 6px; }
.fb-breadcrumb-segments { display: flex; align-items: center; gap: 2px; overflow-x: auto; overflow-y: hidden; flex: 1; min-width: 0; scrollbar-width: none; }
.fb-breadcrumb-segments::-webkit-scrollbar { display: none; }
.fb-breadcrumb-seg { color: #94a3b8; cursor: pointer; padding: 1px 4px; border-radius: 3px; font-size: 12px; white-space: nowrap; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.fb-breadcrumb-seg:hover { color: #e2e8f0; background: #1e293b; }
.fb-breadcrumb-seg.active { color: #e2e8f0; cursor: default; max-width: 22ch; }
.fb-breadcrumb-sep { color: #334155; font-size: 11px; flex-shrink: 0; }
.fb-nav-hidden-toggle { display: flex; align-items: center; gap: 3px; color: #475569; font-size: 11px; cursor: pointer; flex-shrink: 0; user-select: none; }
.fb-nav-hidden-toggle:hover { color: #94a3b8; }
.fb-nav-hidden-toggle input { cursor: pointer; accent-color: #6366f1; }
.fb-create-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 22px; background: #111827; border: 1px solid #334155; cursor: pointer; border-radius: 5px; flex-shrink: 0; line-height: 1; overflow: visible; }
.fb-create-icon { position: relative; display: block; flex-shrink: 0; }
.fb-create-icon-file { width: 11px; height: 14px; border: 1px solid #7dd3fc; border-radius: 2px; background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%); box-shadow: inset 0 -3px 0 rgba(3, 105, 161, 0.35); }
.fb-create-icon-file::after { content: ""; position: absolute; right: -1px; top: -1px; width: 5px; height: 5px; background: #bae6fd; clip-path: polygon(0 0, 100% 100%, 100% 0); border-radius: 0 1px 0 0; }
.fb-create-icon-folder { width: 15px; height: 11px; margin-top: 2px; border: 1px solid #fbbf24; border-radius: 3px; background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); box-shadow: inset 0 -3px 0 rgba(146, 64, 14, 0.3); }
.fb-create-icon-folder::before { content: ""; position: absolute; left: 1px; top: -5px; width: 8px; height: 5px; border: 1px solid #fbbf24; border-bottom: 0; border-radius: 3px 3px 0 0; background: #fde68a; }
.fb-create-plus { position: absolute; right: -2px; top: -4px; display: inline-flex; align-items: center; justify-content: center; width: 11px; height: 11px; border-radius: 999px; background: #22c55e; color: #052e16; border: 1px solid #86efac; font-size: 10px; font-weight: 800; line-height: 1; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.fb-create-btn:hover { border-color: #64748b; background: #172033; }
.fb-create-btn:hover .fb-create-plus { background: #4ade80; }
.fb-create-btn:active { transform: translateY(1px); }
.fb-new-folder-bar { display: flex; gap: 6px; padding: 4px 12px; align-items: center; }
.fb-new-folder-bar input { flex: 1; background: #0f172a; border: 1px solid #334155; color: #e2e8f0; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-family: inherit; }
.fb-tree { flex: 1; overflow-y: auto; padding: 4px 0; min-height: 0; }
.fb-footer { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid #334155; flex-shrink: 0; flex-wrap: wrap; }
.fb-footer-copy-path { max-width: min(180px, 45vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-hidden-toggle { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #64748b; cursor: pointer; user-select: none; }
.fb-count { font-size: 11px; color: #94a3b8; }
/* tree nodes */
.fb-node { display: flex; align-items: center; gap: 4px; padding: 3px 8px; cursor: pointer; font-size: 13px; user-select: none; transition: background 0.1s; min-height: 26px; }
.fb-node:hover { background: rgba(255,255,255,.05); }
.fb-node.selected { background: rgba(99,102,241,.2); }
.fb-node.already { opacity: .7; }
.fb-node.disabled { cursor: default; opacity: .4; }
.fb-node-check { flex-shrink: 0; cursor: pointer; accent-color: #6366f1; }
.fb-node-expand { font-size: 10px; color: #64748b; width: 10px; flex-shrink: 0; }
.fb-node-icon { font-size: 13px; flex-shrink: 0; }
.fb-node-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.fb-node-badge { font-size: 10px; color: #6366f1; flex-shrink: 0; }
.fb-node-empty { font-size: 11px; color: #475569; padding: 2px 8px; }
/* Preview pane */
.fb-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.fb-body-split > .fb-tree { flex: 0 0 38%; min-width: 180px; max-width: 260px; border-right: 1px solid #334155; overflow-y: auto; }
.fb-body-split .fb-preview { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.fb-tree-split { flex: 0 0 38%; min-width: 180px; max-width: 260px; }
.fb-preview { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow: hidden; }
.fb-preview-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-bottom: 1px solid rgba(125,211,252,0.14); background: linear-gradient(180deg, #0d1422, #0a101b); font-size: 12px; font-weight: 700; color: #cbd5e1; flex-shrink: 0; font-family: monospace; min-width: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,0.035); }
.fb-preview-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.fb-preview-content { flex: 1; overflow: auto; min-height: 0; }
.fb-preview-msg { padding: 12px; font-size: 12px; color: #64748b; }
.fb-preview-error { color: #f87171; }
/* File preview loading */
.fb-preview-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px 20px; flex: 1; }
.fb-loading-spinner { width: 28px; height: 28px; border: 2px solid #1e293b; border-top-color: #3b82f6; border-radius: 50%; animation: spin 0.7s linear infinite; }
.fb-loading-text { font-size: 11px; color: #475569; letter-spacing: 0.05em; }
/* Directory node loading spin */
.fb-icon-spin { display: inline-block; animation: spin 0.8s linear infinite; }
.fb-preview-image { display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; background: #0a0f1a; min-height: 0; flex: 1; }
.fb-preview-image img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; background: repeating-conic-gradient(#1e293b 0% 25%, #0f172a 0% 50%) 0 0 / 16px 16px; cursor: zoom-in; }
.fb-preview-video { display: flex; align-items: center; justify-content: center; padding: 16px; overflow: hidden; background: #0a0f1a; min-height: 0; flex: 1; }
.fb-preview-video video { max-width: 100%; max-height: 100%; width: 100%; border-radius: 4px; background: #000; outline: none; }
.fb-lightbox { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: calc(var(--sat, 0px) + 12px) calc(env(safe-area-inset-right, 0px) + 12px) calc(env(safe-area-inset-bottom, 0px) + 12px) calc(env(safe-area-inset-left, 0px) + 12px); box-sizing: border-box; }
.fb-lightbox img { max-width: min(92vw, 100%); max-height: min(92vh, 100%); object-fit: contain; border-radius: 6px; cursor: default; }
.fb-lightbox-close { position: absolute; top: calc(var(--sat, 0px) + 16px); right: calc(env(safe-area-inset-right, 0px) + 16px); background: rgba(255,255,255,0.15); border: none; color: #fff; font-size: 20px; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.fb-preview-code { margin: 0; padding: 10px 12px; font-size: 12px; line-height: 1.5; font-family: 'Menlo', 'Monaco', 'Consolas', monospace; overflow: auto; background: #0f172a; color: #e2e8f0; white-space: pre; tab-size: 2; }
.fb-preview-md { padding: 12px 16px; font-size: 13px; line-height: 1.6; color: #e2e8f0; overflow: auto; max-width: 100%; }
.fb-preview-md h1, .fb-preview-md h2, .fb-preview-md h3 { margin: 0.8em 0 0.4em; color: #f1f5f9; }
.fb-preview-md p { margin: 0.4em 0; }
.fb-preview-md code { font-family: monospace; font-size: 11px; background: #1e293b; padding: 1px 4px; border-radius: 3px; }
.fb-preview-md pre { background: #0f172a; padding: 10px 12px; border-radius: 6px; overflow-x: auto; }
.fb-preview-md pre code { background: none; padding: 0; }
.fb-preview-md a { color: #818cf8; }
.fb-preview-md ul, .fb-preview-md ol { padding-left: 1.4em; }
.fb-preview-md blockquote { border-left: 3px solid #334155; margin: 0; padding-left: 12px; color: #94a3b8; }
.fb-preview-md table { display: block; width: max-content; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.fb-preview-md th, .fb-preview-md td { border: 1px solid #334155; padding: 6px 10px; text-align: left; font-size: 12px; white-space: nowrap; }
.fb-preview-md th { background: #1e293b; color: #e2e8f0; }
.fb-preview-md img { max-width: 100%; height: auto; }
.html-safe-preview-frame { display: block; width: 100%; max-width: 100%; min-width: 0; height: 100%; min-height: 100%; border: 0; background: #fff; color-scheme: light; overflow: hidden; }
.html-fullscreen-preview { position: fixed; inset: 0; width: 100vw; max-width: 100vw; height: 100vh; height: var(--vvh, 100dvh); max-height: 100vh; max-height: var(--vvh, 100dvh); z-index: 2147483646; overflow: hidden; background: #fff; box-sizing: border-box; }
.html-fullscreen-preview-body { position: absolute; inset: 0; width: 100%; max-width: 100vw; min-width: 0; height: 100%; max-height: 100%; overflow: hidden; background: #fff; box-sizing: border-box; }
.html-fullscreen-preview-close,
.html-fullscreen-preview-open-window {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  z-index: 1;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.34);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.78;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.24);
}
.html-fullscreen-preview-close { right: calc(env(safe-area-inset-right, 0px) + 12px); }
.html-fullscreen-preview-open-window { right: calc(env(safe-area-inset-right, 0px) + 58px); font-size: 17px; }
.html-fullscreen-preview-open-window:disabled { opacity: 0.36; cursor: default; }
.html-fullscreen-preview-close:hover,
.html-fullscreen-preview-close:focus-visible,
.html-fullscreen-preview-open-window:not(:disabled):hover,
.html-fullscreen-preview-open-window:not(:disabled):focus-visible { opacity: 1; background: rgba(15, 23, 42, 0.56); outline: none; }
.html-fullscreen-preview-status {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: #475569;
  background: #fff;
  font-size: 14px;
  text-align: center;
}
.html-fullscreen-preview-error { color: #dc2626; }
.fb-modal-wide { width: min(92vw, 900px) !important; }
.mobile-fb-overlay { position: fixed; inset: 0; z-index: 2000; background: #0f172a; display: flex; flex-direction: column; }
.mobile-fb-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #334155; flex-shrink: 0; }
.fb-preview-back { display: none; background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 16px; padding: 2px 6px 2px 0; line-height: 1; }
.fb-preview-back:hover { color: #e2e8f0; }
@media (max-width: 640px) {
  .fb-breadcrumb-seg { max-width: 11ch; }
  .fb-breadcrumb-seg.active { max-width: 16ch; }
  .fb-body-split > .fb-tree { display: none; }
  .fb-body-split .fb-preview { position: fixed; inset: 0; z-index: 2000; background: #0f172a; display: flex; flex-direction: column; width: 100%; height: 100%; }
  .fb-preview-back { display: block; }
  .fb-modal-wide { width: min(96vw, 900px) !important; }
}
.fb-node.previewing { background: rgba(99,102,241,.15); }
/* Git status colors — VS Code style */
.fb-node.git-modified .fb-node-name { color: #e2b340; }
.fb-node.git-untracked .fb-node-name { color: #73c991; }
.fb-node.git-added .fb-node-name { color: #73c991; }
.fb-node.git-deleted .fb-node-name { color: #f14c4c; text-decoration: line-through; }
.fb-node-git-badge { font-size: 9px; font-weight: 700; padding: 0 4px; border-radius: 3px; flex-shrink: 0; font-family: monospace; }
.git-badge-modified { background: rgba(226,179,64,.15); color: #e2b340; }
.git-badge-untracked { background: rgba(115,201,145,.15); color: #73c991; }
.git-badge-added { background: rgba(115,201,145,.15); color: #73c991; }
.git-badge-deleted { background: rgba(241,76,76,.15); color: #f14c4c; }
.fb-diff-toggle { background: none; border: 1px solid #475569; border-radius: 4px; color: #94a3b8; cursor: pointer; padding: 1px 8px; font-size: 11px; margin-left: auto; }
.fb-diff-toggle:hover { border-color: #94a3b8; color: #e2e8f0; }
.fb-diff-toggle.active { border-color: #f59e0b; color: #f59e0b; }
/* Diff view — split (GitHub-style) */
.fb-diff { background: #0d1117; overflow: auto; flex: 1; font-size: 12px; }
.diff-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-family: 'SF Mono','Fira Code','Cascadia Code',monospace; font-size: 12px; }
.diff-table td { padding: 0; vertical-align: top; }
/* Line number cells */
.diff-ln { width: 1%; min-width: 36px; padding: 0 8px; text-align: right; color: #3d444d; user-select: none; white-space: nowrap; border-right: 1px solid #21262d; font-size: 11px; line-height: 20px; }
.diff-ln-del { background: rgba(255,70,70,.08); color: #6e4040; }
.diff-ln-add { background: rgba(46,160,67,.08); color: #3a5a3a; }
/* Code cells */
.diff-cell { width: 49%; padding: 0 8px; white-space: pre-wrap; overflow-wrap: break-word; overflow: hidden; line-height: 20px; word-break: break-all; }
.diff-cell.diff-del { background: rgba(255,70,70,.12); color: #ffa0a0; border-left: 3px solid #da3633; }
.diff-cell.diff-add { background: rgba(46,160,67,.12); color: #7ee787; border-left: 3px solid #3fb950; }
.diff-cell.diff-ctx { color: #8b949e; background: transparent; border-left: 3px solid transparent; }
.diff-cell.diff-empty { background: #161b22; border-left: 3px solid transparent; }
/* Hunk / file header rows */
.diff-hunk-header { background: #161b22; color: #79c0ff; padding: 2px 10px; font-style: italic; line-height: 20px; }
.diff-file-header { background: #1c2128; color: #8b949e; padding: 4px 10px; font-size: 11px; border-top: 1px solid #21262d; border-bottom: 1px solid #21262d; line-height: 20px; }
/* Row hover */
.diff-row-change:hover .diff-cell, .diff-row-ctx:hover .diff-cell { filter: brightness(1.15); }
/* Editor save button states */
.fb-save-btn { position: relative; }
.fb-save-btn.fb-save-dirty { border-color: #f59e0b !important; color: #f59e0b !important; background: rgba(245,158,11,.1) !important; }
.fb-save-btn.fb-save-dirty:hover { background: rgba(245,158,11,.2) !important; }
.fb-save-btn.fb-save-saving { border-color: #3b82f6 !important; color: #3b82f6 !important; opacity: 0.7; }
.fb-dirty-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #f59e0b; margin-left: 4px; vertical-align: middle; }
.fb-save-success { color: #4ade80; font-size: 11px; margin-left: 6px; }
.fb-save-error { color: #f87171; font-size: 11px; margin-left: 6px; }
/* CodeMirror 6 editor container */
.fb-editor-cm { height: 100%; overflow: auto; }
.fb-editor-cm .cm-editor { height: 100%; }
.fb-editor-cm .cm-scroller { overflow: auto; }
/* Modified line gutters (IDE-style green bar for changed lines) */
.fb-editor-cm .cm-editor .cm-changedLine { border-left: 3px solid #3fb950 !important; }
.fb-editor-cm .cm-editor .cm-addedLine { border-left: 3px solid #3fb950 !important; }
/* highlight.js token colors (github-dark compatible) */
.hljs { background: #0f172a; color: #e2e8f0; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in { color: #c792ea; }
.hljs-string, .hljs-attr { color: #c3e88d; }
.hljs-number, .hljs-literal { color: #f78c6c; }
.hljs-comment { color: #546e7a; font-style: italic; }
.hljs-function .hljs-title, .hljs-title.function_ { color: #82aaff; }
.hljs-class .hljs-title, .hljs-title.class_ { color: #ffcb6b; }
.hljs-type { color: #ffcb6b; }
.hljs-variable, .hljs-params { color: #e2e8f0; }
.hljs-property { color: #f07178; }
.hljs-punctuation { color: #89ddff; }
.hljs-tag { color: #f07178; }
.hljs-name { color: #f07178; }
.hljs-meta { color: #80cbc4; }
.hljs-doctag { color: #546e7a; }
.hljs-regexp { color: #c3e88d; }
.hljs-symbol { color: #f78c6c; }
.hljs-addition { color: #c3e88d; background: rgba(195,232,141,0.1); }
.hljs-deletion { color: #f07178; background: rgba(240,113,120,0.1); }
/* QuickInputPanel files tab */
.qp-tabs {
  display: flex;
  background: linear-gradient(180deg, rgba(15,23,42,0.76), rgba(8,13,22,0.62));
  border-bottom: 1px solid rgba(125,211,252,0.14);
  flex-shrink: 0;
}
.qp-tab {
  flex: 1;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  color: #64748b;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.qp-tab.active {
  color: #e2e8f0;
  background: rgba(34,211,238,0.08);
  border-bottom-color: var(--chrome-accent);
  box-shadow: inset 0 -1px 0 rgba(34,211,238,0.32);
}
.qp-tab:hover:not(.active) { background: rgba(8,145,178,0.10); color: #bfdbfe; }
/* inline path links in chat */
.chat-path-link { color: #818cf8; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }
.chat-path-link:hover { color: #a5b4fc; }
.chat-dl-btn { background: none; border: none; color: #64748b; cursor: pointer; font-size: 11px; padding: 0 2px; margin-left: 2px; vertical-align: middle; line-height: 1; }
.chat-dl-btn:hover { color: #818cf8; }
.chat-dl-btn:disabled { cursor: wait; opacity: 0.8; }
.chat-dl-btn.is-busy { color: #93c5fd; }
.chat-dl-btn.is-error { color: #f87171; font-weight: 700; }
.chat-html-preview-btn { color: #0891b2; }
.chat-html-preview-btn:hover { color: #06b6d4; }
.chat-local-image-preview { display: block; max-width: min(420px, 100%); margin: 6px 0 2px; }
.chat-local-image-preview-img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 8px;
  background: repeating-conic-gradient(rgba(30,41,59,0.9) 0% 25%, rgba(15,23,42,0.9) 0% 50%) 0 0 / 16px 16px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.24);
  cursor: zoom-in;
}
.chat-local-image-preview-img:hover { border-color: rgba(129, 140, 248, 0.46); }
.chat-local-image-preview-loading {
  width: min(220px, 70%);
  height: 78px;
  border: 1px solid rgba(125, 211, 252, 0.12);
  border-radius: 8px;
  background: linear-gradient(110deg, rgba(15,23,42,0.42), rgba(30,41,59,0.62), rgba(15,23,42,0.42));
  background-size: 200% 100%;
  animation: chatImagePreviewPulse 1.2s ease-in-out infinite;
}
@keyframes chatImagePreviewPulse { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.chat-external-link { color: #60a5fa; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.chat-external-link:hover { color: #93c5fd; }
.external-link-overlay {
  background:
    radial-gradient(circle at 50% 0%, rgba(59,130,246,0.18), transparent 34%),
    rgba(2,6,23,0.76);
  backdrop-filter: blur(6px);
}
.external-link-dialog {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - var(--sat, 0px) - env(safe-area-inset-bottom, 0px) - 32px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: #0f172a;
  border: 1px solid rgba(100,116,139,0.55);
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.52), inset 0 1px 0 rgba(255,255,255,0.04);
}
.external-link-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.external-link-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(37,99,235,0.16);
  border: 1px solid rgba(96,165,250,0.28);
  color: #93c5fd;
  font-size: 15px;
}
.external-link-title {
  min-width: 0;
  color: #f1f5f9;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}
.external-link-url {
  max-height: 108px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid rgba(51,65,85,0.9);
  border-radius: 8px;
  background: #020617;
  color: #bfdbfe;
  font-size: 12px;
  line-height: 1.45;
  font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
}
.external-link-warning {
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(245,158,11,0.10);
  border: 1px solid rgba(245,158,11,0.22);
  color: #fbbf24;
  font-size: 12px;
  line-height: 1.5;
}
.external-link-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 2px; }
.external-link-btn {
  border: 1px solid #334155;
  border-radius: 7px;
  background: #1e293b;
  color: #cbd5e1;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
}
.external-link-btn:hover { border-color: #475569; color: #f8fafc; background: #253348; }
.external-link-btn-primary {
  border-color: rgba(96,165,250,0.5);
  background: #2563eb;
  color: #eff6ff;
}
.external-link-btn-primary:hover { background: #1d4ed8; border-color: rgba(147,197,253,0.72); }
@media (max-width: 520px) {
  .external-link-dialog { width: calc(100vw - 24px); padding: 16px; }
  .external-link-actions { flex-direction: column-reverse; }
  .external-link-btn { width: 100%; }
}
/* ── Zoomed text dialog ──────────────────────────────────────────────────── */
/* Mobile users double-tap a chat bubble to open this modal. The chat view
   disables `user-select` on touch devices so long-press triggers our custom
   Copy/Quote menu rather than the native callout; inside this dialog the
   selection is re-enabled (via the `!important` overrides below) so users
   can drag the native iOS/Android handles and copy a specific portion. */
.zoom-text-overlay {
  background: rgba(2,6,23,0.78);
  backdrop-filter: blur(6px);
}
.zoom-text-dialog {
  position: relative;
  width: min(640px, calc(100vw - 24px));
  max-height: calc(100vh - var(--sat, 0px) - env(safe-area-inset-bottom, 0px) - 32px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
  background: #0f172a;
  border: 1px solid rgba(100,116,139,0.55);
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.52), inset 0 1px 0 rgba(255,255,255,0.04);
  overflow: hidden;
}
.zoom-text-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-shrink: 0; }
.zoom-text-title { font-size: 13px; font-weight: 600; color: #cbd5e1; letter-spacing: 0.02em; text-transform: uppercase; }
.zoom-text-close { background: none; border: none; color: #64748b; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.zoom-text-close:hover { color: #e2e8f0; }
.zoom-text-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border: 1px solid rgba(51,65,85,0.9);
  border-radius: 8px;
  background: #020617;
}
.zoom-text-content {
  margin: 0;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.55;
  color: #e2e8f0;
  font-family: inherit;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
/* Force-enable native selection inside the zoom dialog. The chat view's
   `@media (pointer: coarse)` rule turns off user-select for everything inside
   `.chat-view`, and the dialog is rendered as a sibling — but assistive
   tools and some WebViews can still inherit conservative defaults, so we
   make the override explicit and !important. */
.zoom-text-dialog,
.zoom-text-dialog * {
  -webkit-user-select: text !important;
  user-select: text !important;
  -webkit-touch-callout: default !important;
}
.zoom-text-selection-menu { z-index: 2; }
.zoom-text-hint { font-size: 11px; color: #64748b; line-height: 1.4; flex-shrink: 0; }
.zoom-text-actions { display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }
.zoom-text-btn {
  border: 1px solid rgba(96,165,250,0.5);
  border-radius: 7px;
  background: #2563eb;
  color: #eff6ff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  transition: background 0.15s, border-color 0.15s;
}
.zoom-text-btn:hover { background: #1d4ed8; border-color: rgba(147,197,253,0.72); }
.zoom-text-btn.is-copied { background: #166534; border-color: #16a34a; color: #86efac; }
@media (max-width: 520px) {
  .zoom-text-dialog { width: calc(100vw - 16px); padding: 12px; }
  .zoom-text-btn { width: 100%; padding: 10px; font-size: 13px; }
  .zoom-text-actions { width: 100%; }
}
/* GFM tables in chat */
.chat-table { border-collapse: collapse; margin: 8px 0; font-size: 13px; width: auto; max-width: 100%; overflow-x: auto; display: block; }
.chat-table th, .chat-table td { border: 1px solid #334155; padding: 4px 10px; text-align: left; white-space: nowrap; }
.chat-table th { background: #1e293b; color: #e2e8f0; font-weight: 600; }
.chat-table td { color: #cbd5e1; }
/* Markdown headings in chat */
.chat-rich-text h1, .chat-rich-text h2, .chat-rich-text h3, .chat-rich-text h4, .chat-rich-text h5, .chat-rich-text h6 { margin: 8px 0 4px; color: #e2e8f0; line-height: 1.3; }
.chat-rich-text h1 { font-size: 1.3em; } .chat-rich-text h2 { font-size: 1.15em; } .chat-rich-text h3 { font-size: 1.05em; }
.chat-rich-text h4, .chat-rich-text h5, .chat-rich-text h6 { font-size: 1em; }
/* Lists in chat */
.chat-list { margin: 4px 0; padding-left: 20px; }
.chat-list li { margin: 2px 0; }
/* Blockquote in chat */
.chat-blockquote { margin: 6px 0; padding: 4px 12px; border-left: 3px solid #475569; color: #94a3b8; }
/* Horizontal rule in chat */
.chat-hr { border: none; border-top: 1px solid #334155; margin: 8px 0; }
/* Paragraphs in chat rich text */
.chat-rich-text p { margin: 4px 0; }
/* browse button next to inputs */
.input-with-browse { display: flex; gap: 6px; }
.input-with-browse .input, .input-with-browse input { flex: 1; min-width: 0; }
.btn-browse { flex-shrink: 0; background: #1e293b; border: 1px solid #334155; color: #94a3b8; border-radius: 4px; padding: 0 10px; cursor: pointer; font-size: 14px; height: 100%; display: flex; align-items: center; }
.btn-browse:hover { border-color: #64748b; color: #e2e8f0; }
/* Repo detail panels */
.repo-detail-panel { padding: 12px 16px; background: #0f172a; border-top: 1px solid #1e293b; font-size: 12px; }
.repo-detail-body { white-space: pre-wrap; color: #94a3b8; margin: 0 0 8px; font-size: 12px; font-family: inherit; background: none; border: none; padding: 0; }
.repo-detail-stats { color: #94a3b8; margin: 8px 0; font-size: 11px; }
.repo-detail-files { max-height: 300px; overflow-y: auto; }
.repo-detail-file { display: flex; justify-content: space-between; padding: 2px 0; color: #cbd5e1; font-size: 11px; font-family: 'SF Mono', 'Menlo', 'Consolas', monospace; }
.repo-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.repo-file-stats { flex-shrink: 0; margin-left: 12px; }
.repo-detail-more { color: #64748b; font-style: italic; padding: 4px 0; font-size: 11px; }
.repo-detail-link { display: inline-block; margin-top: 8px; color: #60a5fa; font-size: 11px; text-decoration: none; }
.repo-detail-link:hover { text-decoration: underline; }
.repo-detail-markdown { color: #cbd5e1; font-size: 12px; line-height: 1.5; max-height: 400px; overflow-y: auto; margin-bottom: 8px; }
.repo-detail-truncated { color: #f59e0b; font-size: 11px; font-style: italic; margin-top: 4px; }
.repo-detail-badges { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.repo-badge { font-size: 10px; padding: 2px 8px; border: 1px solid; border-radius: 12px; }
.repo-detail-comments { margin-top: 12px; }
.repo-detail-comments-header { color: #64748b; font-size: 11px; margin-bottom: 8px; font-weight: 600; }
.repo-detail-comment { border-top: 1px solid #1e293b; padding: 8px 0; }
.repo-comment-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; font-size: 11px; color: #94a3b8; }
.repo-comment-time { color: #64748b; }
.repo-detail-no-comments { color: #475569; font-size: 11px; font-style: italic; }
.repo-detail-loading { color: #64748b; padding: 12px 16px; font-size: 12px; }
.repo-detail-error { color: #ef4444; padding: 12px 16px; font-size: 12px; display: flex; align-items: center; gap: 8px; }
.repo-detail-retry { background: none; border: 1px solid #334155; color: #94a3b8; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 11px; }
.repo-detail-retry:hover { background: #1e293b; }
.repo-action-job {
  position: relative;
  overflow: hidden;
}
.repo-action-step {
  position: relative;
}
.repo-action-step-test {
  background: rgba(59,130,246,0.10);
}
.repo-action-job.repo-action-focus-a,
.repo-action-job.repo-action-focus-b {
  animation: repo-action-focus-job 1.85s ease-out 1;
}
.repo-action-step.repo-action-focus-a,
.repo-action-step.repo-action-focus-b {
  animation: repo-action-focus-step 1.85s ease-out 1;
}
@keyframes repo-action-focus-job {
  0% {
    border-color: rgba(148,163,184,0.18);
    background: rgba(15,23,42,0.45);
    box-shadow: 0 0 0 0 rgba(15,23,42,0);
  }
  18% {
    border-color: color-mix(in srgb, var(--repo-action-focus-color, #60a5fa) 88%, white 12%);
    background: color-mix(in srgb, var(--repo-action-focus-color, #60a5fa) 12%, rgba(15,23,42,0.72));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--repo-action-focus-color, #60a5fa) 42%, transparent), 0 0 22px color-mix(in srgb, var(--repo-action-focus-color, #60a5fa) 28%, transparent);
  }
  55% {
    border-color: color-mix(in srgb, var(--repo-action-focus-color, #60a5fa) 54%, rgba(148,163,184,0.18));
    background: color-mix(in srgb, var(--repo-action-focus-color, #60a5fa) 7%, rgba(15,23,42,0.6));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--repo-action-focus-color, #60a5fa) 18%, transparent), 0 0 10px color-mix(in srgb, var(--repo-action-focus-color, #60a5fa) 12%, transparent);
  }
  100% {
    border-color: rgba(148,163,184,0.18);
    background: rgba(15,23,42,0.45);
    box-shadow: 0 0 0 0 rgba(15,23,42,0);
  }
}
@keyframes repo-action-focus-step {
  0% {
    background: transparent;
    box-shadow: 0 0 0 0 rgba(15,23,42,0);
  }
  18% {
    background: color-mix(in srgb, var(--repo-action-focus-color, #f87171) 16%, rgba(15,23,42,0.12));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--repo-action-focus-color, #f87171) 36%, transparent), 0 0 16px color-mix(in srgb, var(--repo-action-focus-color, #f87171) 18%, transparent);
  }
  55% {
    background: color-mix(in srgb, var(--repo-action-focus-color, #f87171) 8%, rgba(15,23,42,0.08));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--repo-action-focus-color, #f87171) 14%, transparent), 0 0 8px color-mix(in srgb, var(--repo-action-focus-color, #f87171) 10%, transparent);
  }
  100% {
    background: transparent;
    box-shadow: 0 0 0 0 rgba(15,23,42,0);
  }
}
.repo-item-clickable { cursor: pointer; }
.repo-item-clickable:hover { background: #1e293b; }

/* ── Repo page container ── */
.repo-page {
  background: #0f172a; color: #e2e8f0;
  display: flex; flex-direction: column;
  overflow: hidden;
  flex: 1;
}

/* ── P2P Ring Progress ── */
.p2p-ring {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  user-select: none;
}
.p2p-ring-clickable { cursor: pointer; }
.p2p-ring-clickable:hover .p2p-ring-progress { stroke: #60a5fa; }
.p2p-ring-inner {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.p2p-ring-mode {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7dd3fc;
  pointer-events: none;
}
.p2p-ring svg { display: block; }
.p2p-ring-track {
  stroke: #334155;
}
.p2p-ring-progress {
  stroke: #3b82f6;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.4));
  transition: stroke-dasharray 0.5s ease, stroke 0.3s ease;
}
.p2p-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1.2;
  color: #94a3b8;
  text-align: center;
  padding: 0 6px;
  pointer-events: none;
  word-break: break-all;
}
.p2p-ring-label {
  font-size: 9px;
  color: #94a3b8;
  text-align: center;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p2p-ring-sub {
  font-size: 8px;
  color: #64748b;
  text-align: center;
  margin-top: -2px;
}
.p2p-ring-status-running .p2p-ring-progress,
.p2p-ring-status-dispatched .p2p-ring-progress,
.p2p-ring-status-awaiting_next_hop .p2p-ring-progress,
.p2p-ring-status-setup .p2p-ring-progress {
  stroke: #38bdf8;
}
.p2p-ring-status-done .p2p-ring-progress,
.p2p-ring-status-completed .p2p-ring-progress {
  stroke: #22c55e;
}
.p2p-ring-status-failed .p2p-ring-progress,
.p2p-ring-status-cancelled .p2p-ring-progress {
  stroke: #f87171;
}
@keyframes discussions-active-pulse {
  0%, 100% {
    transform: scaleY(1);
    opacity: 1;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
  }
  50% {
    transform: scaleY(1.18);
    opacity: 0.68;
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.75);
  }
}
@keyframes discussions-active-chip {
  0%, 100% {
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 16px rgba(37, 99, 235, 0.14);
    background: rgba(15, 23, 42, 0.82);
  }
  50% {
    border-color: rgba(56, 189, 248, 0.85);
    box-shadow: 0 0 22px rgba(56, 189, 248, 0.28);
    background: rgba(10, 25, 47, 0.95);
  }
}
@keyframes discussions-active-text {
  0%, 100% {
    opacity: 1;
    filter: drop-shadow(0 0 0 rgba(125, 211, 252, 0));
  }
  50% {
    opacity: 0.58;
    filter: drop-shadow(0 0 8px rgba(125, 211, 252, 0.9));
  }
}
