/* ============================================================================
   UnivDash screen-specific styles — layered on top of theme.css (shared theme).
   Mobile first: the screen height follows visualViewport (--app-h) so that the input
   is not covered even when the keyboard comes up.
   ============================================================================ */
:root { --app-h: 100%; --vv-top: 0px; --term-font: 12px; --shell-bg: #070a13; }
html[data-ui-theme-mode="light"] { --shell-bg: #eef0f7; }
html[data-ui-theme="mono"]:not([data-ui-theme-mode="light"]) { --shell-bg: #0b0e14; }
html[data-ui-theme="mono"][data-ui-theme-mode="light"] { --shell-bg: #f3f4f6; }

html, body.app-shell { height: var(--app-h); overscroll-behavior: none; }
body.app-shell { min-height: 0; }
button, a, .key-chip, [role="button"] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.no-scrollbar { scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }
/* Notch · status bar · home indicator areas. Tailwind (h-14, p-5 etc.) comes later in CSS order, so !important wins.
   (the inset is non-zero only in the home-screen app, so the problem did not show in a Safari tab) */
.safe-bottom { padding-bottom: max(0.5rem, env(safe-area-inset-bottom)) !important; }
.safe-top { padding-top: max(1.25rem, env(safe-area-inset-top)) !important; }
header.safe-top-header { padding-top: env(safe-area-inset-top) !important; height: calc(3.5rem + env(safe-area-inset-top)) !important; }

/* ── Sidebar bottom buttons · new session ── */
.sb-icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 11px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.5); transition: background 150ms, color 150ms; }
@media (hover: hover) { .sb-icon:hover { background: rgba(255,255,255,.08); color: #fff; } }
.sb-account .sb-collapse { margin-left: auto; }   /* theme · settings on the left, only the collapse button at the right end */
html.sidebar-collapsed #sidebar .sb-account .sb-collapse { margin-left: 0; }
.sb-new { color: #dbeafe; background: rgba(59,130,246,.16); border: 1px solid rgba(96,165,250,.3); transition: background 150ms; }
.sidebar-link.nav-dragging { opacity: .4; cursor: grabbing; }
.nav-drag-handle { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin-left: auto; flex-shrink: 0; border-radius: 7px; color: rgba(255,255,255,.35); cursor: grab; touch-action: none; }
.nav-drag-handle:hover { color: rgba(255,255,255,.85); background: rgba(255,255,255,.08); }
.nav-drag-handle:active { cursor: grabbing; }
html.sidebar-collapsed #sidebar .nav-drag-handle { display: none; }
@media (hover: hover) { .sb-new:hover { background: rgba(59,130,246,.26); } }
html[data-ui-theme-mode="light"] .sb-icon { color: #5a6781; }
@media (hover: hover) { html[data-ui-theme-mode="light"] .sb-icon:hover { background: rgba(15,23,42,.07); color: #101828; } }
html[data-ui-theme-mode="light"] .sb-new { color: #1d4ed8; background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.25); }

/* Collapsing the sidebar on desktop: a narrow rail with icons only (expand again with » at the bottom) */
@media (min-width: 768px) {
    html.sidebar-collapsed #sidebar { width: 68px; }
    html.sidebar-collapsed #sidebar .sb-label,
    html.sidebar-collapsed #sidebar .sb-user,
    html.sidebar-collapsed #sidebar .sb-overview { display: none !important; }
    html.sidebar-collapsed #sidebar .sb-spacer { display: block; }
    html.sidebar-collapsed #sidebar .sb-top { padding: 14px 10px; }
    html.sidebar-collapsed #sidebar .sb-brand { display: none; }   /* when collapsed the name is hidden and only an empty row would remain */
    html.sidebar-collapsed #sidebar .sb-new { padding: 8px 0; }
    html.sidebar-collapsed #sidebar nav { padding-left: 10px; padding-right: 10px; }
    html.sidebar-collapsed #sidebar nav a { justify-content: center; padding-left: 0; padding-right: 0; }
    html.sidebar-collapsed #sidebar .sb-conn { justify-content: center; padding: 6px 0; }
    html.sidebar-collapsed #sidebar .sb-account { flex-direction: column; align-items: center; gap: 4px; }
    html.sidebar-collapsed #sidebarCollapseBtn i { transform: rotate(180deg); }
    html.sidebar-collapsed #sidebar .sb-bottom { padding: 10px 6px; }
}

/* ── Filter chips ─────────────────────────────────────────────────────── */
.filter-chip {
    display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
    padding: 6px 12px; border-radius: 999px;
    font-size: 12px; font-weight: 700; white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.10); background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.55); transition: background 150ms, color 150ms, border-color 150ms;
}
.filter-chip span:empty { display: none; }
.filter-chip span { font-family: 'JetBrains Mono', monospace; font-size: 10px; opacity: 0.8; }
@media (hover: hover) { .filter-chip:hover { background: rgba(255,255,255,0.08); color: #fff; } }
.filter-chip.active, .filter-chip[aria-pressed="true"] { background: rgba(59,130,246,0.15); border-color: rgba(96,165,250,0.35); color: #93c5fd; }
html[data-ui-theme-mode="light"] .filter-chip { border-color: rgba(15,23,42,0.10); background: rgba(15,23,42,0.03); color: #47536e; }
@media (hover: hover) { html[data-ui-theme-mode="light"] .filter-chip:hover { background: rgba(15,23,42,0.07); color: #101828; } }
html[data-ui-theme-mode="light"] .filter-chip.active,
html[data-ui-theme-mode="light"] .filter-chip[aria-pressed="true"] { background: rgba(59,130,246,0.10); border-color: rgba(37,99,235,0.3); color: #1d4ed8; }

/* ── Window list ─────────────────────────────────────────────────────── */
.folder-head {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 6px 8px; border-radius: 10px; text-align: left;
    font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
    color: rgba(255,255,255,0.5);
}
@media (hover: hover) { .folder-head:hover { background: rgba(255,255,255,0.04); } }
html[data-ui-theme-mode="light"] .folder-head { color: #5a6781; }
@media (hover: hover) { html[data-ui-theme-mode="light"] .folder-head:hover { background: rgba(15,23,42,0.04); } }
.folder-caret { transition: transform 150ms; font-size: 9px; width: 10px; }
.collapsed .folder-caret { transform: rotate(-90deg); }

.win-item {
    position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
    min-height: 60px; padding: 10px 8px 10px 12px; border-radius: 14px; text-align: left;
    border: 1px solid transparent; transition: background 120ms, border-color 120ms;
    user-select: none; -webkit-user-select: none;
}
@media (hover: hover) { .win-item:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.06); } }
.win-item.selected { background: rgba(59,130,246,0.13); border-color: rgba(96,165,250,0.30); }
.win-item.is-hidden { opacity: 0.45; }
@media (hover: hover) { html[data-ui-theme-mode="light"] .win-item:hover { background: rgba(15,23,42,0.04); border-color: rgba(15,23,42,0.06); } }
html[data-ui-theme-mode="light"] .win-item.selected { background: rgba(59,130,246,0.10); border-color: rgba(37,99,235,0.25); }
.win-more {
    width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.35);
}
@media (hover: hover) { .win-more:hover { background: rgba(255,255,255,0.08); color: #fff; } }
html[data-ui-theme-mode="light"] .win-more { color: #8a92aa; }
@media (hover: hover) { html[data-ui-theme-mode="light"] .win-more:hover { background: rgba(15,23,42,0.07); color: #101828; } }
.unread-dot { position: absolute; top: 9px; left: 7px; width: 7px; height: 7px; border-radius: 50%; background: #60a5fa; box-shadow: 0 0 0 2px var(--shell-bg); }

/* Status icons */
.status-icon {
    width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.st-idle    { background: rgba(16,185,129,0.12); color: #34d399; }
.st-busy    { background: rgba(59,130,246,0.15); color: #60a5fa; }
.st-waiting { background: rgba(245,158,11,0.16); color: #fbbf24; }
.st-shell   { background: rgba(148,163,184,0.12); color: #94a3b8; }
.st-dead    { background: rgba(239,68,68,0.12); color: #f87171; }
html[data-ui-theme-mode="light"] .st-idle { color: #059669; }
html[data-ui-theme-mode="light"] .st-busy { color: #2563eb; }
html[data-ui-theme-mode="light"] .st-waiting { color: #b45309; }
html[data-ui-theme-mode="light"] .st-shell { color: #64748b; }
.st-waiting { animation: tdxPulse 1.6s ease-in-out infinite; }
@keyframes tdxPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.35); } 50% { box-shadow: 0 0 0 5px rgba(245,158,11,0); } }

.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #64748b; }
.status-dot.idle { background: #10b981; box-shadow: 0 0 10px rgba(16,185,129,0.6); }
.status-dot.busy { background: #3b82f6; box-shadow: 0 0 10px rgba(59,130,246,0.7); animation: tdxBlink 1s ease-in-out infinite; }
.status-dot.waiting { background: #f59e0b; box-shadow: 0 0 10px rgba(245,158,11,0.7); animation: tdxBlink 1.4s ease-in-out infinite; }
.status-dot.dead { background: #ef4444; }
@keyframes tdxBlink { 50% { opacity: 0.35; } }

.agent-pill {
    flex-shrink: 0; display: inline-flex; align-items: center;
    padding: 1px 6px; border-radius: 6px; font-size: 9px; font-weight: 800; letter-spacing: 0.06em;
    font-family: 'JetBrains Mono', monospace; text-transform: uppercase;
}
.agent-claude { color: #f0a080; background: rgba(217,119,87,0.16); border: 1px solid rgba(217,119,87,0.30); }
.agent-codex  { color: #4fd1a5; background: rgba(16,163,127,0.16); border: 1px solid rgba(16,163,127,0.30); }
.agent-gemini { color: #8ab4f8; background: rgba(66,133,244,0.16); border: 1px solid rgba(66,133,244,0.32); }
.agent-shell  { color: #94a3b8; background: rgba(148,163,184,0.12); border: 1px solid rgba(148,163,184,0.2); }
html[data-ui-theme-mode="light"] .agent-claude { color: #b4532f; }
html[data-ui-theme-mode="light"] .agent-codex { color: #0b7a5f; }
html[data-ui-theme-mode="light"] .agent-gemini { color: #1a56c4; }
html[data-ui-theme-mode="light"] .agent-shell { color: #475569; }

/* Folder colours */
.fc-blue { color: #60a5fa; } .fc-purple { color: #c084fc; } .fc-emerald { color: #34d399; }
.fc-amber { color: #fbbf24; } .fc-rose { color: #fb7185; } .fc-cyan { color: #22d3ee; } .fc-slate { color: #94a3b8; }
.fb-blue { background: #3b82f6; } .fb-purple { background: #a855f7; } .fb-emerald { background: #10b981; }
.fb-amber { background: #f59e0b; } .fb-rose { background: #f43f5e; } .fb-cyan { background: #06b6d4; } .fb-slate { background: #64748b; }

/* ── Terminal panel ─────────────────────────────────────────────────── */
.term-shell { background: transparent; }
#termView.open { display: flex; }
.term-tool {
    width: 38px; height: 38px; flex-shrink: 0; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.55); transition: background 150ms, color 150ms;
}
@media (hover: hover) { .term-tool:hover { background: rgba(255,255,255,0.08); color: #fff; } }
html[data-ui-theme-mode="light"] .term-tool { color: #47536e; }
@media (hover: hover) { html[data-ui-theme-mode="light"] .term-tool:hover { background: rgba(15,23,42,0.07); color: #101828; } }

.pane-tab {
    flex-shrink: 0; padding: 4px 10px; border-radius: 8px; font-size: 11px; font-weight: 700;
    font-family: 'JetBrains Mono', monospace; color: rgba(255,255,255,0.5);
    border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03);
}
.pane-tab.active { color: #93c5fd; border-color: rgba(96,165,250,0.35); background: rgba(59,130,246,0.14); }
html[data-ui-theme-mode="light"] .pane-tab { color: #5a6781; border-color: rgba(15,23,42,0.1); }
html[data-ui-theme-mode="light"] .pane-tab.active { color: #1d4ed8; }

/* Mobile/tablet: the terminal is a panel that slides in full screen */
@media (max-width: 1023.98px) {
    #termPane {
        position: fixed; left: 0; right: 0; top: var(--vv-top); height: var(--app-h);
        z-index: 60; background: var(--shell-bg);
        transform: translateX(100%); visibility: hidden;
        transition: transform 240ms cubic-bezier(.2,.8,.2,1), visibility 0s linear 240ms;
    }
    body.term-open #termPane { transform: none; visibility: visible; transition: transform 240ms cubic-bezier(.2,.8,.2,1); }
    .safe-top-term { padding-top: env(safe-area-inset-top) !important; }
    #termPane .term-head.glass, #termPane .composer.glass { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) { #termPane { transition: none !important; } }

.terminal { -webkit-overflow-scrolling: touch; }
.term-screen {
    font-family: 'JetBrains Mono', ui-monospace, 'D2Coding', 'Nanum Gothic Coding', monospace;
    font-size: var(--term-font); line-height: 1.38;
    padding: 12px 12px 16px; color: #d4d8e1;
    font-variant-ligatures: none;
}
.term-inner { min-width: 100%; }
.term-screen .ln { white-space: pre; min-height: 1.38em; }
.term-screen.wrap .ln { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all; }
.term-screen.raw .term-inner, .term-screen.fit .term-inner { width: max-content; }
.term-screen .t-rule { height: 1px; margin: 0.6em 0; background: linear-gradient(90deg, rgba(148,163,184,0.28), rgba(148,163,184,0.08)); }
.term-screen .cur { background: #e2e8f0; color: #05070c; border-radius: 1px; animation: tdxCursor 1.1s steps(1) infinite; }
@keyframes tdxCursor { 50% { background: transparent; color: inherit; } }
.term-screen b, .term-screen .b { font-weight: 700; }
.term-screen ::selection { background: rgba(59,130,246,0.35); }
.term-empty-note { color: #64748b; font-style: italic; }

#loadMoreBtn:not(.hidden) {
    display: block; margin: 0 auto 8px; padding: 6px 14px; border-radius: 999px;
    font-size: 11px; font-weight: 700; color: #94a3b8; border: 1px solid rgba(255,255,255,0.08);
}
.jump-bottom {
    position: absolute; right: 14px; bottom: 12px; z-index: 5;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 999px; font-size: 12px; font-weight: 800;
    color: #fff; background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    box-shadow: 0 8px 24px rgba(59,130,246,0.35);
}
.jump-bottom.hidden { display: none; }

/* ── Composer ──────────────────────────────────────────────────────── */
.key-chip {
    flex-shrink: 0; min-width: 42px; height: 34px; padding: 0 11px; border-radius: 10px;
    font-family: 'JetBrains Mono', monospace; font-size: 12.5px; font-weight: 700;
    color: rgba(255,255,255,0.75); background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10); transition: background 100ms, transform 100ms;
}
.key-chip.is-pressed { background: rgba(59,130,246,0.25); }
.key-chip.key-accent { color: #93c5fd; border-color: rgba(96,165,250,0.3); }
.key-chip.key-danger { color: #fca5a5; border-color: rgba(248,113,113,0.3); }
html[data-ui-theme-mode="light"] .key-chip { color: #253046; background: rgba(15,23,42,0.05); border-color: rgba(15,23,42,0.12); }
html[data-ui-theme-mode="light"] .key-chip.key-accent { color: #1d4ed8; }
html[data-ui-theme-mode="light"] .key-chip.key-danger { color: #dc2626; }

.composer-btn {
    width: 42px; height: 42px; flex-shrink: 0; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10);
    transition: background 150ms, color 150ms;
}
@media (hover: hover) { .composer-btn:hover { background: rgba(255,255,255,0.1); color: #fff; } }
.composer-btn[aria-pressed="true"] { color: #fff; background: linear-gradient(135deg, #f59e0b, #ef4444); border-color: transparent; }
html[data-ui-theme-mode="light"] .composer-btn { color: #47536e; background: rgba(15,23,42,0.05); border-color: rgba(15,23,42,0.12); }
html[data-ui-theme-mode="light"] .composer-btn[aria-pressed="true"] { color: #fff; }
.send-btn { width: 42px; height: 42px; flex-shrink: 0; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.send-btn:disabled { opacity: 0.5; }
/* Must be at least 16px so iOS does not zoom the screen when the input is focused */
.prompt-input { font-size: 16px; line-height: 1.4; max-height: 38vh; min-height: 42px; display: block; }
@media (min-width: 1024px) { .prompt-input { font-size: 14px; } }
.submit-toggle { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.submit-toggle[aria-pressed="true"] { color: #34d399; }
html[data-ui-theme-mode="light"] .submit-toggle[aria-pressed="true"] { color: #059669; }

/* Direct input mode: an input sink that is off-screen but focusable */
.direct-input { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; font-size: 16px; pointer-events: none; }
body.direct-mode #promptInput { display: none; }
body.direct-mode .direct-banner { display: flex; }
.direct-banner {
    display: none; align-items: center; justify-content: center; gap: 8px; height: 42px;
    border-radius: 14px; font-size: 13px; font-weight: 700;
    color: #fbbf24; background: rgba(245,158,11,0.10); border: 1px dashed rgba(245,158,11,0.45);
}
html[data-ui-theme-mode="light"] .direct-banner { color: #b45309; }

/* ── Sheet / modal ─────────────────────────────────────────────────── */
.sheet-overlay {
    position: fixed; inset: 0; z-index: 400;
    background: rgba(5, 7, 15, 0.55);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: flex-end; justify-content: center;
}
.sheet-overlay[hidden] { display: none; }
body.ud-settings-open .sheet-overlay { z-index: 490; }   /* a confirmation opened from the Settings window goes above the Settings window */
/* Keyboard handling: sheets · modals that cover the screen fit the actually visible area (above the keyboard), not the whole layout (inset 0).
   iOS does not shrink the layout height when the keyboard is up, so with inset 0 a bottom sheet hides behind the keyboard.
   --vv-top · --app-h are kept in sync with visualViewport by app.js syncViewport (normally 0 · 100%). */
.sheet-overlay, .pmd-theme-overlay, .ud-settings-overlay, #sidebarOverlay, #logModal, #gitCommitModal {
    top: var(--vv-top) !important; bottom: auto !important; height: var(--app-h) !important;
}
#logModal > [role="dialog"], #gitCommitModal > [role="dialog"], .pmd-theme-modal, .ud-settings-modal { max-height: 100%; }
.pmd-theme-modal { overflow-y: auto; overscroll-behavior: contain; }
.tdx-sheet {
    width: 100%; max-height: calc(var(--app-h) - 40px); overflow-y: auto; overscroll-behavior: contain;
    border-radius: 22px 22px 0 0;
    background: rgba(20, 25, 40, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12); border-bottom: 0;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
    color: #e8e9ee;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}
html[data-ui-theme-mode="light"] .tdx-sheet { background: rgba(255,255,255,0.97); border-color: rgba(15,23,42,0.1); color: #1e2233; box-shadow: 0 -20px 60px rgba(30,41,59,0.2); }
.sheet-grip { width: 38px; height: 4px; border-radius: 99px; background: rgba(148,163,184,0.4); margin: 8px auto 4px; }
@media (min-width: 640px) {
    .sheet-overlay { align-items: center; padding: 20px; }
    .tdx-sheet { max-width: 420px; border-radius: 18px; border-bottom: 1px solid rgba(255,255,255,0.12); padding-bottom: 12px; }
    .sheet-grip { display: none; }
}
.sheet-head { padding: 12px 20px 8px; }
.sheet-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.sheet-head p { margin: 3px 0 0; font-size: 11.5px; opacity: 0.6; line-height: 1.5; word-break: keep-all; overflow-wrap: anywhere; white-space: pre-line; }
.sheet-actions { padding: 4px 8px; }
.sheet-action {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px;
    padding: 10px 12px; border-radius: 12px; text-align: left;
    font-size: 14px; font-weight: 600; color: inherit;
}
.sheet-action:focus-visible { background: rgba(148,163,184,0.12); outline: none; }
@media (hover: hover) { .sheet-action:hover { background: rgba(148,163,184,0.12); outline: none; } }
.sheet-action i.lead { width: 20px; text-align: center; opacity: 0.7; }
.sheet-action .sub { margin-left: auto; font-size: 11px; opacity: 0.5; font-weight: 500; }
.sheet-action.danger { color: #f87171; }
/* A separate button attached to the right of a row (per-account sign out etc.) */
.sheet-row { display: flex; align-items: center; gap: 6px; }
.sheet-row .sheet-action { flex: 1; min-width: 0; }
.sheet-side { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 32px; margin-right: 6px; padding: 0 11px; border-radius: 9px; font-size: 11.5px; font-weight: 700; white-space: nowrap; color: #fca5a5; background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.28); }
@media (hover: hover) { .sheet-side:hover { background: rgba(248,113,113,.18); border-color: rgba(248,113,113,.5); } }
html[data-ui-theme-mode="light"] .sheet-side { color: #dc2626; background: rgba(220,38,38,.06); border-color: rgba(220,38,38,.3); }
html[data-ui-theme-mode="light"] .sheet-action.danger { color: #dc2626; }
.sheet-action.current { color: #60a5fa; }
.sheet-sep { height: 1px; margin: 4px 12px; background: rgba(148,163,184,0.18); }
.sheet-form { padding: 4px 20px 8px; display: grid; gap: 12px; }
.sheet-form label { display: grid; gap: 6px; font-size: 11px; font-weight: 700; opacity: 0.75; }
.sheet-form input, .sheet-form textarea, .sheet-form select {
    width: 100%; padding: 10px 12px; border-radius: 12px; font-size: 16px; font-weight: 500;
    color: inherit; background: rgba(148,163,184,0.10); border: 1px solid rgba(148,163,184,0.25);
}
.sheet-form input:focus, .sheet-form textarea:focus { outline: none; border-color: rgba(96,165,250,0.7); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.sheet-buttons { display: flex; gap: 8px; padding: 8px 20px 4px; }
/* Keep the Save · Cancel buttons always visible even when the sheet scrolls because the content is long (e.g. the sheet got shorter with the keyboard up) */
.tdx-sheet .sheet-buttons { position: sticky; bottom: calc(-1 * max(12px, env(safe-area-inset-bottom))); z-index: 2; padding-bottom: max(12px, env(safe-area-inset-bottom)); margin-bottom: calc(-1 * max(12px, env(safe-area-inset-bottom))); background: rgb(20, 25, 40); }
html[data-ui-theme-mode="light"] .tdx-sheet .sheet-buttons { background: #fff; }
.tdx-sheet :is(input, textarea, select) { scroll-margin: 16px 0 96px; }   /* so it does not hide behind the pinned buttons when scrolled into view on focus */
@media (min-width: 640px) { .tdx-sheet .sheet-buttons { bottom: -12px; padding-bottom: 12px; margin-bottom: -12px; } }
.sheet-buttons button { flex: 1; min-height: 44px; border-radius: 12px; font-size: 14px; font-weight: 800; }
.sheet-cancel { background: rgba(148,163,184,0.14); }
.sheet-danger { color: #fff; background: linear-gradient(135deg, #ef4444, #dc2626); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(148,163,184,0.10); }
.seg button { min-height: 36px; border-radius: 9px; font-size: 12.5px; font-weight: 700; opacity: 0.7; }
.seg button.on { opacity: 1; background: rgba(59,130,246,0.2); color: #93c5fd; }
html[data-ui-theme-mode="light"] .seg button.on { color: #1d4ed8; }
.color-row { display: flex; gap: 10px; flex-wrap: wrap; }
.color-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; }
.color-swatch.on { border-color: currentColor; box-shadow: 0 0 0 2px rgba(148,163,184,0.5); }
.snippet-row { display: flex; align-items: center; gap: 4px; }
.snippet-row .sheet-action { flex: 1; min-width: 0; }
.snippet-row .sheet-action span.txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; min-width: 0; }
.snippet-del { width: 40px; height: 40px; border-radius: 10px; opacity: 0.45; flex-shrink: 0; }
@media (hover: hover) { .snippet-del:hover { opacity: 1; color: #f87171; } }

/* ── Toast ──────────────────────────────────────────────────────── */
.toast-host {
    position: fixed; left: 50%; transform: translateX(-50%); z-index: 600;
    top: max(12px, env(safe-area-inset-top)); display: grid; gap: 8px; width: min(92vw, 380px); pointer-events: none;
}
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: 10px;
    padding: 11px 14px; border-radius: 14px; font-size: 13px; font-weight: 600;
    background: rgba(20,25,40,0.95); color: #e8e9ee; border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 12px 30px rgba(0,0,0,0.4); animation: scaleUp 0.18s ease-out;
}
html[data-ui-theme-mode="light"] .toast { background: rgba(255,255,255,0.98); color: #1e2233; border-color: rgba(15,23,42,0.1); box-shadow: 0 12px 30px rgba(30,41,59,0.18); }
.toast.error i { color: #f87171; } .toast.ok i { color: #34d399; } .toast.info i { color: #60a5fa; } .toast.warn i { color: #fbbf24; }
.toast button { margin-left: auto; font-size: 12px; font-weight: 800; color: #60a5fa; white-space: nowrap; }
/* ── Upload panel (every page, bottom right; above the tab bar on phones) ── */
.upload-panel {
    position: fixed; z-index: 590; right: max(14px, env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom));
    width: min(92vw, 340px); border-radius: 16px; overflow: hidden; font-size: 12px;
    background: rgba(20,25,40,0.97); color: #e8e9ee; border: 1px solid rgba(255,255,255,0.12); box-shadow: 0 14px 34px rgba(0,0,0,0.45);
}
@media (max-width: 767px) { .upload-panel { bottom: calc(78px + env(safe-area-inset-bottom)); left: 50%; right: auto; transform: translateX(-50%); } }
html[data-ui-theme-mode="light"] .upload-panel { background: rgba(255,255,255,0.99); color: #1e2233; border-color: rgba(15,23,42,0.12); box-shadow: 0 12px 30px rgba(30,41,59,0.2); }
.upload-panel header { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 4px; }
.upload-panel header button { padding: 8px; border-radius: 10px; color: inherit; }
.upload-panel .up-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 13px; text-align: left; }
.upload-panel .up-title span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-panel .up-chev { opacity: .5; font-size: 10px; }
.upload-panel ul { list-style: none; margin: 0; padding: 4px 0 6px; max-height: min(40vh, 260px); overflow-y: auto; }
.upload-panel.collapsed ul { display: none; }
.upload-panel .up-row { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 12px 9px; }
.upload-panel .up-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.upload-panel .up-state { flex: none; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .65; font-variant-numeric: tabular-nums; }
.upload-panel .up-row.error .up-state { color: #f87171; opacity: 1; }
.upload-panel .up-row button { flex: none; width: 22px; height: 22px; border-radius: 999px; color: inherit; opacity: .6; }
.upload-panel .up-row button:hover { opacity: 1; background: rgba(148,163,184,0.2); }
.upload-panel .up-row > i { flex: none; width: 22px; text-align: center; }
.upload-panel .up-ok { color: #34d399; } .upload-panel .up-err { color: #f87171; } .upload-panel .up-off { opacity: .45; }
.upload-panel .up-bar { display: block; height: 3px; background: rgba(148,163,184,0.2); overflow: hidden; }
.upload-panel .up-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #5b7cfa, #8b5cf6); transition: width .25s ease; }
.upload-panel .up-row .up-bar { position: absolute; left: 12px; right: 12px; bottom: 3px; border-radius: 999px; }
.upload-panel .up-row:not(.uploading):not(.queued) .up-bar { display: none; }
.ex-progress-bar { position: relative; height: 6px; margin: 6px 0 4px; border-radius: 999px; overflow: hidden; background: rgba(148, 163, 184, 0.25); }
.ex-progress-bar span { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: #60a5fa; transition: width 0.3s ease; }
.ex-progress.indeterminate .ex-progress-bar span { width: 35% !important; animation: exProgressSlide 1.1s ease-in-out infinite; }
@keyframes exProgressSlide { from { left: -35%; } to { left: 100%; } }
.ex-progress-text { font-size: 11px; font-weight: 500; opacity: 0.75; font-variant-numeric: tabular-nums; }
.toast button:disabled { opacity: 0.4; }

/* ── Window organizer page ─────────────────────────────────────────────── */
.org-folder .org-list { min-height: 48px; }
.org-list:empty::after {
    content: "여기로 창을 끌어다 놓으십시오"; display: block; padding: 14px; text-align: center;
    font-size: 11px; color: rgba(148,163,184,0.7); border: 1px dashed rgba(148,163,184,0.3); border-radius: 12px;
}
.org-item { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 4px; border-radius: 12px; min-height: 54px; }
@media (hover: hover) { .org-item:hover { background: rgba(255,255,255,0.04); } }
@media (hover: hover) { html[data-ui-theme-mode="light"] .org-item:hover { background: rgba(15,23,42,0.03); } }
.org-item.is-hidden .org-main { opacity: 0.45; }
.drag-handle {
    width: 34px; height: 40px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    color: rgba(148,163,184,0.7); cursor: grab; touch-action: none; border-radius: 8px;
}
.drag-handle:active { cursor: grabbing; }
.org-icon-btn {
    width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; color: rgba(148,163,184,0.9);
}
@media (hover: hover) { .org-icon-btn:hover { background: rgba(148,163,184,0.14); } }
.org-icon-btn.on { color: #fbbf24; }
.sortable-ghost { opacity: 0.35; background: rgba(59,130,246,0.15) !important; border-radius: 12px; }
.sortable-chosen { background: rgba(59,130,246,0.08); }
.sortable-drag { opacity: 0.95 !important; }

/* ── Attachments ────────────────────────────────────────────────────────── */
.attach-btn {
    position: absolute; right: 4px; bottom: 3px; width: 36px; height: 36px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.5); transition: background 150ms, color 150ms;
}
@media (hover: hover) { .attach-btn:hover { background: rgba(255,255,255,0.08); color: #fff; } }
html[data-ui-theme-mode="light"] .attach-btn { color: #5a6781; }
@media (hover: hover) { html[data-ui-theme-mode="light"] .attach-btn:hover { background: rgba(15,23,42,0.06); color: #101828; } }
body.direct-mode .attach-btn { display: none; }
.attach-tray:not(.hidden) { display: flex; }
.attach-chip {
    position: relative; flex-shrink: 0; display: flex; align-items: center; gap: 8px;
    max-width: 220px; height: 52px; padding: 5px 30px 5px 5px; border-radius: 14px; overflow: hidden;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10);
}
html[data-ui-theme-mode="light"] .attach-chip { background: rgba(15,23,42,0.04); border-color: rgba(15,23,42,0.12); }
.attach-chip.error { border-color: rgba(248,113,113,0.5); background: rgba(239,68,68,0.08); }
.attach-thumb {
    width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px; object-fit: cover;
    display: flex; align-items: center; justify-content: center; font-size: 16px;
    background: rgba(148,163,184,0.15); color: #94a3b8;
}
.attach-meta { min-width: 0; display: grid; gap: 1px; }
.attach-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-sub { font-size: 10px; opacity: 0.55; font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.attach-chip.error .attach-sub { color: #f87171; opacity: 1; }
.attach-progress { position: absolute; left: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, #3b82f6, #8b5cf6); transition: width 150ms; }
.attach-remove {
    position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; font-size: 11px; opacity: 0.6;
}
@media (hover: hover) { .attach-remove:hover { opacity: 1; background: rgba(148,163,184,0.2); } }
.drop-overlay {
    position: absolute; inset: 10px; z-index: 30; border-radius: 20px;
    display: flex; align-items: center; justify-content: center; text-align: center;
    border: 2px dashed rgba(96,165,250,0.8); background: rgba(15,23,42,0.72);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); color: #bfdbfe; pointer-events: none;
}
.drop-overlay.hidden { display: none; }
.drop-card { padding: 24px; }
.win-item.drop-target { background: rgba(59,130,246,0.2); border-color: rgba(96,165,250,0.6); border-style: dashed; }

/* ── Sort button ───────────────────────────────────────────────────── */
.sort-btn {
    flex-shrink: 0; height: 38px; padding: 0 12px; border-radius: 12px;
    display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; white-space: nowrap;
    color: rgba(255,255,255,0.65); background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
    transition: background 150ms, color 150ms;
}
@media (hover: hover) { .sort-btn:hover { background: rgba(255,255,255,0.09); color: #fff; } }
html[data-ui-theme-mode="light"] .sort-btn { color: #47536e; background: rgba(255,255,255,0.7); border-color: rgba(15,23,42,0.12); }
@media (hover: hover) { html[data-ui-theme-mode="light"] .sort-btn:hover { background: rgba(15,23,42,0.06); color: #101828; } }

/* ── Screen / transcript switch ───────────────────────────────────────── */
#termModes:not(.hidden) { display: flex; }
.mode-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: rgba(148,163,184,0.12); flex-shrink: 0; }
.mode-switch button { padding: 5px 12px; border-radius: 8px; font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.55); white-space: nowrap; }
.mode-switch button i { font-size: 10px; margin-right: 3px; }
.mode-switch button.on { background: rgba(59,130,246,0.22); color: #bfdbfe; }
html[data-ui-theme-mode="light"] .mode-switch button { color: #5a6781; }
html[data-ui-theme-mode="light"] .mode-switch button.on { background: rgba(59,130,246,0.14); color: #1d4ed8; }

.alt-hint {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; padding: 8px 12px; border-radius: 10px;
    font-family: 'Inter', system-ui, sans-serif; font-size: 12px; color: #93c5fd;
    background: rgba(59,130,246,0.10); border: 1px solid rgba(96,165,250,0.25); white-space: normal;
}
.alt-hint button { font-weight: 800; color: #fff; padding: 3px 10px; border-radius: 8px; background: rgba(59,130,246,0.45); }

/* ── Transcript (inside the terminal area, so always a dark background) ─────────────── */
.chat-list { padding: 12px 12px 20px; display: flex; flex-direction: column; gap: 10px; font-family: 'Inter', 'Pretendard', system-ui, sans-serif; color: #dbe1ea; }
/* Chat search */
.chat-search { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 20; display: flex; flex-direction: column; gap: 6px; max-width: 640px; margin-left: auto; font-family: 'Inter', 'Pretendard', system-ui, sans-serif; }
.chat-search.hidden { display: none; }
.cs-bar { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.12); background: rgba(15,20,35,0.92); backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0,0,0,0.35); }
.cs-icon { font-size: 11px; color: #64748b; }
.cs-bar input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: #e2e8f0; font-size: 16px; padding: 6px 4px; }
@media (min-width: 768px) { .cs-bar input { font-size: 13px; } }
.cs-bar input::-webkit-search-cancel-button { display: none; }
.cs-count { flex-shrink: 0; font-size: 11px; color: #94a3b8; font-variant-numeric: tabular-nums; }
.cs-btn { flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; color: #94a3b8; font-size: 11px; display: flex; align-items: center; justify-content: center; }
@media (hover: hover) { .cs-btn:hover { background: rgba(255,255,255,0.08); color: #fff; } }
.cs-results { max-height: min(55vh, 420px); overflow-y: auto; overscroll-behavior: contain; border-radius: 12px; border: 1px solid rgba(255,255,255,0.12); background: rgba(15,20,35,0.96); backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0,0,0,0.35); padding: 4px; }
.cs-results.hidden { display: none; }
.cs-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 8px; width: 100%; text-align: left; padding: 8px; border-radius: 8px; font-size: 12px; line-height: 1.45; color: #cbd5e1; }
.cs-item.on { background: rgba(59,130,246,0.18); }
@media (hover: hover) { .cs-item:hover { background: rgba(255,255,255,0.06); } .cs-item.on:hover { background: rgba(59,130,246,0.22); } }
.cs-who { flex-shrink: 0; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; margin-top: 1px; }
.cs-who.me { background: rgba(59,130,246,0.2); color: #93c5fd; }
.cs-who.ai { background: rgba(16,185,129,0.18); color: #6ee7b7; }
.cs-text { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; word-break: keep-all; overflow-wrap: anywhere; }
.cs-time { font-size: 10px; color: #64748b; white-space: nowrap; margin-top: 2px; }
.cs-empty { padding: 10px; text-align: center; font-size: 11px; color: #64748b; }
.cs-item mark, mark.cs-mark { background: rgba(250,204,21,0.35); color: inherit; border-radius: 3px; padding: 0 1px; }
/* Skipping off-screen rendering (content-visibility) clips what is drawn outside, so an inner border is used instead of outline-offset */
.msg.msg-hit { box-shadow: inset 0 0 0 2px rgba(250,204,21,0.6); border-radius: 14px; }
html[data-ui-theme-mode="light"] .cs-bar, html[data-ui-theme-mode="light"] .cs-results { background: rgba(255,255,255,0.97); border-color: rgba(15,23,42,0.12); box-shadow: 0 10px 30px rgba(15,23,42,0.15); }
html[data-ui-theme-mode="light"] .cs-bar input { color: #0f172a; }
/* Usage overview panel (skills · plugins · MCP · subagents · built-in tools) */
.chat-usage { position: absolute; top: 8px; right: 8px; z-index: 21; width: min(340px, calc(100% - 16px)); max-height: min(70vh, 560px); display: flex; flex-direction: column; border-radius: 12px; border: 1px solid rgba(255,255,255,0.12); background: rgba(15,20,35,0.96); backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0,0,0,0.35); font-family: 'Inter', 'Pretendard', system-ui, sans-serif; font-size: 12px; color: #cbd5e1; outline: none; }
.chat-usage.hidden { display: none; }
.cu-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 8px 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.08); font-weight: 700; }
.cu-head > span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.cu-total { color: #94a3b8; }
.cu-idle { color: #94a3b8; }
.cu-row.past { color: #94a3b8; }
.cu-btn { margin-left: auto; padding: 3px 8px; border-radius: 8px; background: rgba(255,255,255,0.06); color: #cbd5e1; font-size: 11px; font-weight: 600; white-space: nowrap; }
.cu-btn.cu-x { margin-left: 0; width: 26px; height: 24px; padding: 0; color: #94a3b8; }
@media (hover: hover) { .cu-btn:hover { background: rgba(255,255,255,0.12); color: #fff; } }
.cu-body { overflow-y: auto; overscroll-behavior: contain; padding: 8px 12px 10px; }
.cu-title { font-weight: 800; color: #e2e8f0; margin-bottom: 4px; }
.cu-recent { margin-bottom: 8px; }
.cu-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; min-width: 0; }
.cu-kind { flex-shrink: 0; color: #94a3b8; }
.cu-kind::after { content: ' ·'; }
.cu-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; }
.cu-count { flex-shrink: 0; margin-left: auto; color: #94a3b8; font-variant-numeric: tabular-nums; }
.cu-count b { color: #6ee7b7; font-weight: 600; }
.cu-dot { flex-shrink: 0; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #64748b; }
.cu-dot.ok { background: #34d399; }
.cu-dot.run { background: #fbbf24; animation: cu-pulse 1.2s ease-in-out infinite; }
.cu-dot.err { background: #f43f5e; }
.cu-dot.idle { background: #64748b; opacity: 0.7; }
@keyframes cu-pulse { 50% { opacity: 0.35; } }
.cu-group { margin-top: 2px; }
.cu-ghead { display: flex; align-items: center; gap: 6px; width: 100%; padding: 4px 2px; border-radius: 6px; text-align: left; color: #cbd5e1; font-weight: 600; }
.cu-ghead:disabled { opacity: 0.45; cursor: default; }
.cu-ghead kbd { min-width: 18px; padding: 0 4px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.15); font-size: 10px; text-align: center; color: #94a3b8; font-family: inherit; }
.cu-ghead i { width: 8px; color: #94a3b8; }
.cu-gnow { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; color: #94a3b8; }
@media (hover: hover) { .cu-ghead:not(:disabled):hover { background: rgba(255,255,255,0.06); } }
.cu-items { padding: 2px 0 4px 32px; }
.cu-legend { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 10.5px; color: #64748b; }
.cu-legend .cu-dot { width: 8px; height: 8px; margin-left: 4px; }
.cu-empty { padding: 6px 0; color: #64748b; font-size: 11px; }
.chat-usage > .cu-empty { padding: 12px; text-align: center; }
#chatUsageBtn.on { color: #93c5fd; }
/* Usage overview summary at the right of the bottom bar (wide screens only) */
.usage-summary { display: none; align-items: center; gap: 8px; min-width: 0; max-width: min(520px, 42vw); margin-right: 6px; padding: 2px 8px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); font-size: 11px; color: #cbd5e1; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (min-width: 768px) { .usage-summary:not(.hidden) { display: inline-flex; } }
.usage-summary .us-light { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.usage-summary .cu-dot { width: 8px; height: 8px; }
.usage-summary .us-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: #94a3b8; }
.usage-summary.idle .us-light { opacity: 0.45; }
.usage-summary .us-text b { color: #e2e8f0; font-weight: 700; }
.usage-summary .us-spin { margin-right: 4px; font-size: 10px; color: #fbbf24; }
.usage-summary .us-past { margin-right: 4px; color: #64748b; }
html[data-ui-theme-mode="light"] .usage-summary .us-text b { color: #0f172a; }
.usage-summary.idle .cu-dot.run { animation: none; }
@media (hover: hover) { .usage-summary:hover { background: rgba(255,255,255,0.08); color: #fff; } }
html[data-ui-theme-mode="light"] .usage-summary { border-color: rgba(15,23,42,0.1); background: rgba(15,23,42,0.03); color: #334155; }
html[data-ui-theme-mode="light"] .chat-usage { background: rgba(255,255,255,0.97); border-color: rgba(15,23,42,0.12); box-shadow: 0 10px 30px rgba(15,23,42,0.15); color: #334155; }
html[data-ui-theme-mode="light"] .cu-title { color: #0f172a; }
html[data-ui-theme-mode="light"] .cu-ghead { color: #334155; }
html[data-ui-theme-mode="light"] .cu-btn { background: rgba(15,23,42,0.06); color: #334155; }
html[data-ui-theme-mode="light"] .cu-head { border-color: rgba(15,23,42,0.08); }
html[data-ui-theme-mode="light"] .cu-ghead kbd { border-color: rgba(15,23,42,0.15); }
html[data-ui-theme-mode="light"] .cs-item { color: #334155; }
html[data-ui-theme-mode="light"] .cs-item.on { background: rgba(59,130,246,0.12); }
html[data-ui-theme-mode="light"] .cs-who.me { color: #1d4ed8; }
html[data-ui-theme-mode="light"] .cs-who.ai { color: #047857; }
html[data-ui-theme-mode="light"] .cs-item mark, html[data-ui-theme-mode="light"] mark.cs-mark { background: rgba(250,204,21,0.5); }
.log-older { text-align: center; padding: 10px; font-size: 11px; color: #64748b; font-family: 'Inter', system-ui, sans-serif; }
.log-older button { font-weight: 700; color: #93c5fd; }
.log-empty { padding: 40px 16px; text-align: center; color: #64748b; font-size: 13px; line-height: 1.6; }
.msg { max-width: 100%; min-width: 0; }
/* The chat list never shifts sideways (on iOS Safari a single wide element used to push the whole conversation sideways).
   Long code blocks · tables scroll horizontally only inside their own box. :where keeps it from overriding .msg-user's 88% width */
#logScroll, .tp-log { overflow-x: hidden; }
.chat-list { overflow-x: clip; }   /* so the scroll width never exceeds the screen even with overflowing elements (hidden cannot stop programmatic scrolling) */
:where(.chat-list > *), .msg-body, .msg-tool { min-width: 0; max-width: 100%; }
.msg-tool { overflow: hidden; }
.msg-body code { overflow-wrap: anywhere; }
.msg-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 10.5px; font-weight: 700; color: #64748b; }
.msg-body { font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; word-break: keep-all; }
.msg-user { align-self: flex-end; max-width: 88%; }
.msg-user .msg-meta { justify-content: flex-end; }
.msg-user .msg-body { padding: 9px 13px; border-radius: 16px 16px 4px 16px; background: rgba(59,130,246,0.22); border: 1px solid rgba(96,165,250,0.28); color: #eaf2ff; }
.msg-ai .msg-body { padding: 2px 2px; }
.msg-ai .copy-btn { margin-left: auto; padding: 2px 6px; border-radius: 6px; color: #64748b; font-size: 11px; }
@media (hover: hover) { .msg-ai .copy-btn:hover { color: #cbd5e1; background: rgba(255,255,255,0.06); } }
/* The copy button only on my prompts and final answers (hidden on intermediate progress notes) */
.msg-ai:not(.final) > .msg-meta .copy-btn { display: none; }
.msg-user .copy-btn { padding: 2px 6px; border-radius: 6px; color: #64748b; font-size: 11px; }
@media (hover: hover) { .msg-user .copy-btn:hover { color: #cbd5e1; background: rgba(255,255,255,0.06); } }
.msg-user.pending .copy-btn { display: none; }
.msg-system { align-self: center; font-size: 11px; font-weight: 700; color: #94a3b8; padding: 3px 10px; border-radius: 999px; background: rgba(148,163,184,0.12); font-family: 'JetBrains Mono', monospace; }
.md-code { margin: 6px 0; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,0.45); border: 1px solid rgba(255,255,255,0.06); overflow-x: auto; overscroll-behavior-x: contain; white-space: pre; font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.5; color: #cbd5e1; }
.msg-body code { font-family: 'JetBrains Mono', monospace; font-size: 0.88em; padding: 1px 5px; border-radius: 5px; background: rgba(148,163,184,0.16); color: #fcd34d; }
.md-h { font-weight: 800; color: #fff; }
.md-table { margin: 10px 0; overflow-x: auto; overscroll-behavior-x: contain; white-space: normal; }
.md-table table { border-collapse: collapse; font-size: 13px; line-height: 1.45; min-width: 60%; }
.md-table th, .md-table td { padding: 6px 10px; border: 1px solid rgba(255,255,255,0.1); text-align: left; vertical-align: top; overflow-wrap: normal; word-break: keep-all; }
.md-table th { font-weight: 700; color: #fff; background: rgba(255,255,255,0.06); }
.md-table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.025); }
.msg-tool { border-radius: 10px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); font-size: 12px; }
.msg-tool summary { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; list-style: none; min-width: 0; }
.msg-tool summary::-webkit-details-marker { display: none; }
.msg-tool summary .tool-name { flex-shrink: 0; font-weight: 800; color: #a5b4fc; font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.msg-tool summary .tool-sum { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #94a3b8; font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.msg-tool summary .tool-state { flex-shrink: 0; font-size: 10px; color: #34d399; }
.msg-tool.error summary .tool-state { color: #f87171; }
.msg-tool.error { border-color: rgba(248,113,113,0.25); }
.msg-tool pre { margin: 0; padding: 8px 10px 10px; border-top: 1px solid rgba(255,255,255,0.06); overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; font-family: 'JetBrains Mono', monospace; font-size: 11px; line-height: 1.5; color: #a8b3c4; }
.msg-tool summary .sub-badge { flex-shrink: 0; padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 800; color: #6ee7b7; background: rgba(52,211,153,.12); }
.msg-tool summary .sub-badge.run { color: #93c5fd; background: rgba(96,165,250,.14); }
.msg-sub.error summary .sub-badge { color: #fca5a5; background: rgba(248,113,113,.14); }
.msg-sub summary .sub-time { flex-shrink: 0; font-size: 10px; color: #64748b; }
.msg-tool .sub-live { max-height: 420px; overflow: auto; padding: 8px; border-top: 1px solid rgba(255,255,255,0.06); display: flex; flex-direction: column; gap: 6px; background: rgba(0,0,0,.12); }
.msg-tool .sub-live:empty { display: none; }
/* Code changes (diff) — like the terminal */
.msg-diff summary .df-stat, .df-head .df-stat { flex-shrink: 0; font-family: 'JetBrains Mono', monospace; font-size: 10.5px; }
.df-stat b { font-weight: 700; }
.df-stat b.a { color: #4ade80; }
.df-stat b.d { color: #f87171; }
.df-file { border-top: 1px solid rgba(255,255,255,0.06); }
.df-head { display: flex; align-items: center; gap: 8px; padding: 5px 10px; background: rgba(255,255,255,0.025); font-size: 11px; }
.df-path { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; font-family: 'JetBrains Mono', monospace; color: #cbd5e1; }
.df-op { flex-shrink: 0; padding: 0 6px; border-radius: 999px; font-size: 10px; font-weight: 700; color: #93c5fd; background: rgba(96,165,250,.14); }
/* Cards scroll horizontally only (long code lines are not wrapped, like the terminal). Vertical wheel · diagonal trackpad gestures
   are forwarded to the whole chat by the wheel handler in app.js → the card does not steal the chat scroll. */
.df-body { overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; padding: 2px 0 4px; font-family: 'JetBrains Mono', monospace; font-size: 11px; line-height: 1.55; }
.df-row { display: block; min-width: max-content; white-space: pre; color: #e6edf3; }
.df-no { display: inline-block; width: 3.4em; padding-right: 6px; text-align: right; color: #64748b; user-select: none; font-variant-numeric: tabular-nums; vertical-align: top; }
.df-sign { display: inline-block; width: 1.4em; text-align: center; user-select: none; vertical-align: top; }
.df-text { padding-right: 10px; color: #e6edf3; }
/* Long diff · output: only the beginning is rendered and the rest sits in a <template> (rendered on click · the content is all still there) */
.fold-more { display: block; width: 100%; padding: 5px 10px; border-top: 1px dashed rgba(255,255,255,0.1); text-align: left; font-family: 'Inter', 'Pretendard', system-ui, sans-serif; font-size: 11px; font-weight: 700; color: #93c5fd; background: rgba(96,165,250,0.06); }
@media (hover: hover) { .fold-more:hover { background: rgba(96,165,250,0.14); } }
html[data-ui-theme-mode="light"] .fold-more { color: #1d4ed8; border-top-color: rgba(15,23,42,0.12); background: rgba(37,99,235,0.05); }
/* Chat items: off-screen ones are not rendered (the DOM stays → nothing is removed · search · jumping still work). The size from the first render is remembered */
.chat-list > * { content-visibility: auto; contain-intrinsic-size: auto 72px; }
/* Like the terminal (Claude Code): the whole line is red / green, changed words one step brighter · text in syntax colours.
   The background is fixed regardless of theme (dark: GitHub dark base, light: white base) → contrast of at least 4:1 in every theme */
.df-add { background: rgb(22, 58, 33); }
.df-del { background: rgb(74, 24, 31); }
.df-add .df-no, .df-del .df-no { color: rgba(255,255,255,0.6); }
.df-add .df-sign { color: #7ee787; font-weight: 700; }
.df-del .df-sign { color: #ffa198; font-weight: 700; }
.df-add .df-word { background: rgb(35, 96, 54); border-radius: 2px; }
.df-del .df-word { background: rgb(118, 38, 52); border-radius: 2px; }
.df-body { background: #0d1117; }
/* Syntax colours inside a diff: dark blue · grey are invisible on the line background so they are brightened, and one step brighter inside changed words */
:is(.df-text, .do-line) :is(.hljs-addition, .hljs-deletion) { background: transparent; }
html:not([data-ui-theme-mode="light"]) :is(.df-text, .do-line) .hljs-section { color: #79c0ff; }
html:not([data-ui-theme-mode="light"]) :is(.df-text, .do-line) :is(.hljs-comment, .hljs-code, .hljs-formula) { color: #a7b1bc; }
html:not([data-ui-theme-mode="light"]) .df-word :is(.hljs-keyword, .hljs-type, .hljs-doctag, .hljs-template-tag, .hljs-template-variable) { color: #ffa198; }
html:not([data-ui-theme-mode="light"]) .df-word :is(.hljs-comment, .hljs-code, .hljs-formula) { color: #c9d1d9; }
html:not([data-ui-theme-mode="light"]) .df-word :is(.hljs-section, .hljs-variable, .hljs-attr, .hljs-number, .hljs-literal, .hljs-built_in) { color: #a5d6ff; }
.msg-tool pre .do-line { display: inline-block; min-width: 100%; color: #e6edf3; }
.msg-tool pre .do-line > b { display: inline-block; width: 1.2em; color: #fff; }
.msg-tool pre .do-meta { color: #e6edf3; font-weight: 700; }
.msg-tool pre .do-hunk { color: #79c0ff; }
html[data-ui-theme-mode="light"] .msg-tool pre .do-line, html[data-ui-theme-mode="light"] .msg-tool pre .do-meta { color: #1f2328; }
html[data-ui-theme-mode="light"] .msg-tool pre .do-hunk { color: #0550ae; }
.df-gap .df-text { color: #64748b; }
.df-cut { padding: 4px 10px 6px; font-size: 10.5px; color: #94a3b8; }
@media (max-width: 767px) { .df-body { font-size: 10.5px; } .df-no { width: 2.8em; } .df-sign { width: 1.2em; } }
html[data-ui-theme-mode="light"] .df-file { border-top-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .df-head { background: rgba(15,23,42,.03); }
html[data-ui-theme-mode="light"] .df-body { background: #fff; }
html[data-ui-theme-mode="light"] .df-row, html[data-ui-theme-mode="light"] .df-path, html[data-ui-theme-mode="light"] .df-text { color: #1f2328; }
html[data-ui-theme-mode="light"] .df-add { background: #e6ffec; }
html[data-ui-theme-mode="light"] .df-del { background: #ffebe9; }
html[data-ui-theme-mode="light"] .df-add .df-word { background: #c2f0cf; }
html[data-ui-theme-mode="light"] .df-del .df-word { background: #ffd0cd; }
/* Light: orange · red · green · grey text made darker (at least 4:1 even on the pale line background) */
html[data-ui-theme-mode="light"] :is(.df-text, .do-line) :is(.hljs-built_in, .hljs-symbol) { color: #9a4a00; }
html[data-ui-theme-mode="light"] :is(.df-text, .do-line) :is(.hljs-keyword, .hljs-doctag, .hljs-type, .hljs-template-tag, .hljs-template-variable) { color: #b31d28; }
html[data-ui-theme-mode="light"] :is(.df-text, .do-line) :is(.hljs-name, .hljs-quote, .hljs-selector-pseudo, .hljs-selector-tag) { color: #1a6b30; }
html[data-ui-theme-mode="light"] :is(.df-text, .do-line) :is(.hljs-comment, .hljs-code, .hljs-formula) { color: #57606a; }html[data-ui-theme-mode="light"] .df-add .df-no, html[data-ui-theme-mode="light"] .df-del .df-no { color: #57606a; }
html[data-ui-theme-mode="light"] .df-add .df-sign { color: #1a7f37; }
html[data-ui-theme-mode="light"] .df-del .df-sign { color: #cf222e; }
html[data-ui-theme-mode="light"] .df-stat b.a { color: #15803d; }
html[data-ui-theme-mode="light"] .df-stat b.d { color: #b91c1c; }
.msg-tool .sub-live .msg-body { font-size: 12.5px; }
.msg-tool .sub-live .msg-meta { font-size: 10px; }
.sub-empty { font-size: 11px; color: #64748b; text-align: center; padding: 4px; }
.msg-sub { border-color: rgba(129,140,248,.22); background: rgba(99,102,241,.05); }
.msg-sub .sub-body { padding: 8px 12px 10px; border-top: 1px solid rgba(255,255,255,0.06); font-size: 13px; }
.msg-sub .sub-body .copy-btn { display: inline-flex; gap: 5px; align-items: center; margin-top: 6px; padding: 2px 8px; border-radius: 6px; font-size: 11px; color: #94a3b8; background: rgba(255,255,255,.05); }

/* Checkbox row inside a sheet form */
.sheet-form label.check-row { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; opacity: 0.9; }
.sheet-form input[type="checkbox"] { width: 18px; height: 18px; padding: 0; flex-shrink: 0; accent-color: #8b5cf6; }
.sheet-check { padding: 4px 20px 6px; }
.sheet-check label.check-row { align-items: flex-start; cursor: pointer; }
.sheet-check label.check-row input { margin-top: 1px; }
.sheet-check small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 500; opacity: .65; line-height: 1.45; }

/* ============================================================================
   App-like on phones — no zoom, keyboard handling, bottom tab bar, touch feedback
   ============================================================================ */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
/* So Korean sentences do not break mid-word: wrap only at spaces, and cut only words longer than the box (paths · URLs) when they overflow.
   Where text must break per character, like the terminal screen, that place's rule (word-break: break-all) takes precedence. */
body { word-break: keep-all; overflow-wrap: break-word; }
p, li, dd, h1, h2, h3, h4, label, figcaption, .sheet-head p, .toast, .ud-set-desc, .ud-set-note { text-wrap: pretty; }

/* Pin the whole app to the actually visible area (visualViewport).
   When the keyboard comes up, iOS leaves the layout as is and only pushes the visible area up (offsetTop);
   following that movement keeps the screen from being cut off or leaving empty space at the bottom. */
html:has(body.app-shell) { height: 100%; overflow: hidden; }
body.app-shell {
    position: fixed; left: 0; right: 0; top: var(--vv-top);
    height: var(--app-h); width: 100%; overflow: hidden;
}

@media (pointer: coarse), (max-width: 767.98px) {
    /* iOS zooms the screen when focusing an input smaller than 16px */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), textarea, select { font-size: 16px !important; }

    /* Buttons · menus do not trigger text selection · previews on long press (content areas stay selectable) */
    body.app-shell { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
    body.app-shell :is(input, textarea, pre, code, table, .term-screen, .chat-list, .git-diff, .msg-body, .select-text, #gitConsole) {
        -webkit-user-select: text; user-select: text; -webkit-touch-callout: default;
    }
    ::-webkit-scrollbar { width: 0; height: 0; }
    .overflow-y-auto, .overflow-auto, .overflow-x-auto { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
}

/* Bottom tab bar */
.tabbar {
    display: flex; flex-shrink: 0; z-index: 30;
    /* Overlaps the home indicator slightly to sit low like a native tab bar (using the full inset leaves it floating) */
    padding: 6px 6px max(6px, calc(env(safe-area-inset-bottom) - 12px));
    background: rgba(10, 13, 24, 0.92);
    backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
html[data-ui-theme-mode="light"] .tabbar { background: rgba(255, 255, 255, 0.92); border-top-color: rgba(15, 23, 42, 0.08); }
.tab-item {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 0 2px; border-radius: 12px; color: rgba(255, 255, 255, 0.45);
    -webkit-tap-highlight-color: transparent;
}
.tab-item .tab-icon { position: relative; font-size: 18px; line-height: 1; height: 20px; }
.tab-item .tab-label { font-size: 10.5px; font-weight: 700; letter-spacing: -0.01em; }
.tab-item.active { color: #93c5fd; }
html[data-ui-theme-mode="light"] .tab-item { color: #8a92aa; }
html[data-ui-theme-mode="light"] .tab-item.active { color: #2563eb; }
.tab-badge {
    position: absolute; top: -5px; left: 13px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px; background: #f59e0b; color: #111827; font-size: 10px; font-weight: 800;
    display: flex; align-items: center; justify-content: center; font-family: 'Inter', system-ui, sans-serif;
}
.tab-badge.hidden { display: none; }
/* While the keyboard is up, hide the tab bar to make room for typing */
html.kb-open .tabbar { display: none; }
@media (max-width: 767.98px) {
    /* The tab bar covers the home indicator area, so the body scroll area does not add that inset */
    main .safe-bottom:not(.composer) { padding-bottom: 0.75rem !important; }
}
/* The keyboard covers it, so no safe-area padding is needed below the input */
html.kb-open .composer.safe-bottom { padding-bottom: 0.25rem !important; }

/* ── Chat: queued · sending bubbles, agent status card (terminal area, so always a dark background) ── */
.chat-pending { padding-top: 0; padding-bottom: 0; }
.chat-pending:empty { display: none; }
/* Images attached by the user: the height is fixed so the scroll position does not shift even when the image loads late */
.msg-imgs { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 100%; margin-bottom: 4px; }
.msg-img { display: block; height: 180px; max-width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid rgba(96,165,250,0.28); background: rgba(15,23,42,.5); }
.msg-img img { display: block; height: 100%; width: auto; max-width: 100%; object-fit: contain; }
@media (max-width: 640px) { .msg-img { height: 140px; } }
html[data-ui-theme-mode="light"] .msg-img { border-color: rgba(37,99,235,.22); background: #e2e8f0; }
.msg-user.pending .msg-body { opacity: .7; border-style: dashed; }
.msg-user.pending .msg-meta { color: #fbbf24; }
.chat-status {
    position: sticky; bottom: 8px; z-index: 2; margin: 4px 12px 10px;
    font-family: 'Inter', 'Pretendard', system-ui, sans-serif;
    border-radius: 14px; border: 1px solid rgba(255,255,255,.10);
    background: rgba(17, 22, 36, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.chat-status.busy { display: block; padding: 9px 10px 9px 14px; color: #93c5fd; font-size: 13px; }
.chat-status.hidden { display: none; }
.chat-status-row { display: flex; align-items: center; gap: 10px; }
.chat-live-toggle { background: rgba(255,255,255,.06) !important; border-color: rgba(255,255,255,.12) !important; color: #cbd5e1 !important; padding: 6px 9px !important; }
.chat-live { margin: 8px 0 2px; padding: 8px 10px; max-height: 38vh; overflow: auto; border-radius: 10px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.06);
    font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; line-height: 1.5; color: #cbd5e1; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-status.busy .chat-status-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #cbd5e1; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.chat-status button { flex-shrink: 0; padding: 6px 12px; border-radius: 10px; font-size: 12px; font-weight: 800; color: #fecaca; background: rgba(239,68,68,.16); border: 1px solid rgba(248,113,113,.3); }
.chat-status.waiting { padding: 12px; border-color: rgba(245,158,11,.4); }
.chat-status-head { font-size: 12px; font-weight: 800; color: #fbbf24; margin-bottom: 6px; }
.chat-status-question { font-size: 13px; line-height: 1.5; color: #e2e8f0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30vh; overflow-y: auto; margin-bottom: 10px; }
.chat-status-options { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-status-options button { color: #e2e8f0; background: rgba(59,130,246,.18); border-color: rgba(96,165,250,.35); text-align: left; font-weight: 600; max-width: 100%; }
.chat-status-options button b { color: #93c5fd; margin-right: 4px; }
.chat-status-options button.muted { color: #94a3b8; background: rgba(148,163,184,.12); border-color: rgba(148,163,184,.25); }

/* ── Explorer (folder tree · file viewer) ─────────────────────────────── */
.ex { display: flex; flex-direction: column; min-height: 0; position: relative; }
.ex-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 6px 12px; flex-shrink: 0; }
.ex-root { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; padding: 6px 8px; border-radius: 10px; font-size: 13px; font-weight: 800; color: rgba(255,255,255,.88); text-align: left; }
@media (hover: hover) { .ex-root:hover { background: rgba(255,255,255,.06); } }
.ex-root .fa-folder-tree { color: #7dd3fc; }
.ex-root-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-tools { display: flex; align-items: center; gap: 1px; flex-shrink: 0; }
.ex-tools button { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 12.5px; color: rgba(255,255,255,.5); }
@media (hover: hover) { .ex-tools button:hover { background: rgba(255,255,255,.08); color: #fff; } }
.ex-search { position: relative; display: block; margin: 0 10px 6px; flex-shrink: 0; }
.ex-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 11px; color: rgba(255,255,255,.35); pointer-events: none; }
.ex-search input { width: 100%; padding: 7px 10px 7px 30px; border-radius: 10px; font-size: 16px; color: #fff; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); outline: none; }
@media (pointer: fine) { .ex-search input { font-size: 13px; } }
.ex-search input:focus { border-color: rgba(96,165,250,.5); }
.ex-status { padding: 0 14px 6px; font-size: 10.5px; color: rgba(255,255,255,.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.ex-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 4px 12px; border-top: 1px solid rgba(255,255,255,.06); position: relative; -webkit-overflow-scrolling: touch; }
.ex-body.drop-root { background: rgba(59,130,246,.07); box-shadow: inset 0 0 0 2px rgba(96,165,250,.45); border-radius: 10px; }
.ex-row { display: flex; align-items: center; gap: 5px; height: 30px; padding-right: 2px; border-radius: 7px; cursor: pointer; font-size: 13px; color: rgba(255,255,255,.82); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
@media (pointer: coarse) { .ex-row { height: 38px; font-size: 14px; } }
@media (hover: hover) { .ex-row:hover { background: rgba(255,255,255,.05); } }
.ex-row.selected { background: rgba(59,130,246,.18); color: #fff; }
.ex-row.dim { opacity: .55; }
.ex-row.cut { opacity: .4; font-style: italic; }
.ex-row.drop { background: rgba(59,130,246,.25); box-shadow: inset 0 0 0 1.5px rgba(96,165,250,.7); }
.ex-chev { width: 14px; flex-shrink: 0; font-size: 9px; text-align: center; color: rgba(255,255,255,.4); transition: transform 120ms; }
.ex-chev.open { transform: rotate(90deg); }
.ex-icon { width: 16px; flex-shrink: 0; text-align: center; font-size: 13px; }
.ex-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-meta { flex-shrink: 0; font-size: 10.5px; color: rgba(255,255,255,.35); font-variant-numeric: tabular-nums; }
.ex-more { width: 28px; height: 26px; flex-shrink: 0; border-radius: 7px; color: rgba(255,255,255,.4); font-size: 12px; opacity: 0; }
.ex-row.selected .ex-more { opacity: 1; }
@media (hover: hover) { .ex-row:hover .ex-more { opacity: 1; } }
@media (pointer: coarse) { .ex-more { opacity: .7; width: 36px; height: 34px; } }
@media (hover: hover) { .ex-more:hover { background: rgba(255,255,255,.1); color: #fff; } }
.ex-note { padding: 6px 12px; font-size: 12px; color: rgba(255,255,255,.35); font-style: italic; }
.ex-note.error { color: #fca5a5; font-style: normal; }
.ex-result { padding-left: 10px; height: auto; min-height: 34px; }
.ex-result-path { display: block; font-size: 10.5px; color: rgba(255,255,255,.35); overflow: hidden; text-overflow: ellipsis; }
.ex-drop-hint { position: sticky; bottom: 4px; margin: 8px 6px 0; padding: 8px 12px; border-radius: 10px; font-size: 12px; color: #dbeafe; background: rgba(37,99,235,.85); box-shadow: 0 6px 20px rgba(0,0,0,.35); pointer-events: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-drop-hint.hidden { display: none; }
.ex-menu { max-height: min(70vh, 560px); overflow-y: auto; z-index: 90; }
.ex-menu .danger, .ex-menu .danger i { color: #fca5a5; }
html[data-ui-theme-mode="light"] .ex-root, html[data-ui-theme-mode="light"] .ex-row { color: #1f2937; }
@media (hover: hover) { html[data-ui-theme-mode="light"] .ex-row:hover { background: rgba(15,23,42,.05); } }
html[data-ui-theme-mode="light"] .ex-row.selected { background: rgba(37,99,235,.13); color: #0f172a; }
html[data-ui-theme-mode="light"] .ex-tools button, html[data-ui-theme-mode="light"] .ex-more, html[data-ui-theme-mode="light"] .ex-chev { color: #64748b; }
html[data-ui-theme-mode="light"] .ex-status, html[data-ui-theme-mode="light"] .ex-meta, html[data-ui-theme-mode="light"] .ex-note, html[data-ui-theme-mode="light"] .ex-result-path { color: #64748b; }
html[data-ui-theme-mode="light"] .ex-search input { color: #0f172a; background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.1); }
html[data-ui-theme-mode="light"] .ex-body { border-top-color: rgba(15,23,42,.08); }

.exv { display: flex; flex-direction: column; min-height: 0; }
.exv-icon .ex-icon { font-size: 15px; width: 20px; }
.exv-body { flex: 1; min-height: 0; overflow: auto; background: #0b0f19; color: #d4d8e1; overscroll-behavior: contain; }
.exv-meta { position: sticky; left: 0; padding: 6px 14px; font-size: 10.5px; color: #64748b; border-bottom: 1px solid rgba(255,255,255,.05); }
.exv-note { position: sticky; left: 0; padding: 8px 14px; font-size: 12px; color: #fbbf24; }
.exv-code { display: flex; align-items: flex-start; min-width: max-content; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: var(--term-font, 12px); line-height: 1.55; }
.exv-code.wrap { min-width: 0; }
.exv-gutter { position: sticky; left: 0; margin: 0; padding: 10px 10px 24px 12px; text-align: right; color: #475569; background: #0b0f19; user-select: none; -webkit-user-select: none; border-right: 1px solid rgba(255,255,255,.05); flex-shrink: 0; }
.exv-pre { margin: 0; padding: 10px 14px 24px; flex: 1; min-width: 0; }
.exv-pre code.hljs { background: transparent; padding: 0; white-space: pre; display: block; }
.exv-code.wrap .exv-pre code.hljs { white-space: pre-wrap; overflow-wrap: anywhere; }
.exv-code.wrap .exv-gutter { display: none; }
.exv-code { position: relative; }
.exv-line-flash { position: absolute; left: 0; right: 0; pointer-events: none; background: rgba(250,204,21,.18); box-shadow: inset 3px 0 0 #facc15; animation: exv-line-flash 2.6s ease-out forwards; }
@keyframes exv-line-flash { 0%, 55% { opacity: 1; } 100% { opacity: 0; } }
html[data-ui-theme-mode="light"] .exv-line-flash { background: rgba(234,179,8,.22); box-shadow: inset 3px 0 0 #ca8a04; }
.exv-image { display: flex; align-items: center; justify-content: center; padding: 16px; min-height: 60%; background: repeating-conic-gradient(#111827 0 25%, #0b0f19 0 50%) 0 0 / 20px 20px; }
.exv-image img { max-width: 100%; max-height: 80vh; object-fit: contain; border-radius: 6px; }
.exv-gallery { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 10px; width: max-content; margin: 8px auto 12px; padding: 4px 6px; border-radius: 999px; background: rgba(15, 23, 42, 0.78); color: #e2e8f0; font-size: 12px; font-variant-numeric: tabular-nums; backdrop-filter: blur(8px); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); }
.exv-gallery button { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 999px; }
.exv-gallery button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.exv-gallery button:disabled { opacity: 0.3; }
.exv-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 48px 16px; text-align: center; font-size: 13px; color: #94a3b8; }

/* Phone · tablet: the viewer is a full-screen panel sliding in from the right (same as the terminal panel) */
@media (max-width: 1023.98px) {
    body .slide-panel {   /* tailwind (.relative · .flex-1) loads later, so selector specificity is raised */
        position: fixed; left: 0; right: 0; top: var(--vv-top); height: var(--app-h);
        z-index: 60; background: var(--shell-bg);
        transform: translateX(100%); visibility: hidden;
        transition: transform 240ms cubic-bezier(.2,.8,.2,1), visibility 0s linear 240ms;
    }
    body.panel-open .slide-panel { transform: none; visibility: visible; transition: transform 240ms cubic-bezier(.2,.8,.2,1); }
    .slide-panel .term-head.glass { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) { body .slide-panel { transition: none !important; } }

/* Landscape phone: keep left/right safe areas clear of the notch · home indicator */
@media (orientation: landscape) and (max-height: 500px) {
    main, #termPane, .slide-panel { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
    .ex-row { height: 34px; }
}

/* ── Workspace view switch (windows · files · organize) ── */
.ws-switch { display: flex; gap: 4px; margin: 10px 12px 0; padding: 3px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); }
.ws-switch button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border-radius: 9px; font-size: 12.5px; font-weight: 800; color: rgba(255,255,255,.5); transition: background 150ms, color 150ms; -webkit-tap-highlight-color: transparent; }
.ws-switch button i { font-size: 11px; }
.ws-switch button.active { background: rgba(59,130,246,.2); color: #bfdbfe; box-shadow: inset 0 0 0 1px rgba(96,165,250,.3); }
html[data-ui-theme-mode="light"] .ws-switch { background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .ws-switch button { color: #64748b; }
html[data-ui-theme-mode="light"] .ws-switch button.active { background: rgba(37,99,235,.12); color: #1d4ed8; }
#fileMode .ex-head { padding-top: 8px; }

/* ── Markdown preview (the viewer background is always dark, so based on dark colours) ── */
.exv-md-toggle { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 10px; flex-shrink: 0; font-size: 12px; font-weight: 800; color: #bfdbfe; background: rgba(59,130,246,.16); border: 1px solid rgba(96,165,250,.3); }
.exv-md-toggle.hidden { display: none; }
.exv-md-toggle i { font-size: 11px; }
.exv-md { max-width: 860px; margin: 0 auto; padding: 18px 20px 48px; font-family: 'Inter', 'Pretendard', system-ui, sans-serif; font-size: 15px; line-height: 1.7; color: #d7dce6; overflow-wrap: anywhere; }
@media (max-width: 640px) { .exv-md { padding: 14px 16px 40px; font-size: 15px; } }
.exv-md > :first-child { margin-top: 0; }
.exv-md h1, .exv-md h2, .exv-md h3, .exv-md h4, .exv-md h5, .exv-md h6 { color: #f1f5f9; font-weight: 800; line-height: 1.3; margin: 1.5em 0 .6em; }
.exv-md h1 { font-size: 1.8em; padding-bottom: .3em; border-bottom: 1px solid rgba(255,255,255,.1); }
.exv-md h2 { font-size: 1.4em; padding-bottom: .25em; border-bottom: 1px solid rgba(255,255,255,.08); }
.exv-md h3 { font-size: 1.17em; }
.exv-md p, .exv-md ul, .exv-md ol, .exv-md blockquote, .exv-md pre, .exv-md .exv-md-table { margin: 0 0 1em; }
.exv-md ul, .exv-md ol { padding-left: 1.6em; }
.exv-md ul { list-style: disc; } .exv-md ol { list-style: decimal; }
.exv-md li + li { margin-top: .25em; }
.exv-md li > input[type="checkbox"] { margin-right: .4em; }
.exv-md a { color: #7dd3fc; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.exv-md strong { color: #f8fafc; }
.exv-md blockquote { padding: .2em 1em; color: #94a3b8; border-left: 3px solid rgba(96,165,250,.5); background: rgba(255,255,255,.02); }
.exv-md code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .86em; padding: .15em .4em; border-radius: 6px; background: rgba(255,255,255,.08); color: #fbcfe8; }
.exv-md pre { padding: 12px 14px; border-radius: 10px; background: #0f1524; border: 1px solid rgba(255,255,255,.07); overflow-x: auto; }
.exv-md pre code { padding: 0; background: transparent; color: #d4d8e1; font-size: 12.5px; line-height: 1.55; white-space: pre; }
.exv-md hr { border: 0; border-top: 1px solid rgba(255,255,255,.1); margin: 1.6em 0; }
.exv-md img { max-width: 100%; height: auto; border-radius: 8px; }
.exv-md-table { overflow-x: auto; }
.exv-md table { border-collapse: collapse; font-size: .92em; }
.exv-md th, .exv-md td { padding: 6px 12px; border: 1px solid rgba(255,255,255,.12); text-align: left; }
.exv-md th { background: rgba(255,255,255,.05); color: #f1f5f9; }
.folder-more { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 24px; margin-left: 2px; border-radius: 7px; opacity: .55; }
@media (hover: hover) { .folder-more:hover { opacity: 1; background: rgba(255,255,255,.08); } }
@media (pointer: coarse) { .folder-more { width: 34px; height: 30px; } }
.hist-btn { width: 26px; height: 22px; flex-shrink: 0; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; color: rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.03); }
@media (hover: hover) { .hist-btn:hover { color: #fff; background: rgba(255,255,255,.08); } }
@media (pointer: coarse) { .hist-btn { width: 32px; height: 26px; } }
html[data-ui-theme-mode="light"] .hist-btn { color: #5a6781; border-color: rgba(15,23,42,.12); }

/* ── Viewer tabs · PDF · media ── */
.exv { position: relative; }
.exv-tabs { display: flex; gap: 2px; overflow-x: auto; padding: 0 6px; height: 36px; align-items: flex-end; border-top: 1px solid rgba(255,255,255,.05); -webkit-overflow-scrolling: touch; }
.exv-tabs.hidden { display: none; }
.exv-tab { display: flex; align-items: center; gap: 6px; flex-shrink: 0; max-width: 220px; height: 32px; padding: 0 4px 0 10px; border-radius: 9px 9px 0 0; font-size: 12px; font-weight: 600; color: rgba(255,255,255,.5); cursor: pointer; border: 1px solid transparent; border-bottom: 0; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
@media (hover: hover) { .exv-tab:hover { color: rgba(255,255,255,.8); background: rgba(255,255,255,.04); } }
.exv-tab.active { color: #fff; background: #0b0f19; border-color: rgba(255,255,255,.09); box-shadow: inset 0 2px 0 #60a5fa; }
.exv-tab .ex-icon { font-size: 11px; width: 13px; }
.exv-tab-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exv-tab-name small { margin-left: 5px; font-size: 10px; opacity: .5; font-weight: 500; }
.exv-tab-close { width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: rgba(255,255,255,.4); }
@media (hover: hover) { .exv-tab-close:hover { background: rgba(255,255,255,.12); color: #fff; } }
@media (pointer: coarse) { .exv-tab { height: 34px; } .exv-tab-close { width: 28px; height: 28px; } }
html[data-ui-theme-mode="light"] .exv-tab { color: #64748b; }
html[data-ui-theme-mode="light"] .exv-tab.active { color: #fff; }
.exv-zoom { display: flex; align-items: center; gap: 2px; flex-shrink: 0; padding: 2px; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); }
.exv-zoom.hidden { display: none; }
.exv-zoom button { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; color: rgba(255,255,255,.6); }
@media (hover: hover) { .exv-zoom button:hover { background: rgba(255,255,255,.08); color: #fff; } }
.exv-zoom-label { min-width: 40px; text-align: center; font-size: 11px; font-weight: 700; color: rgba(255,255,255,.6); font-variant-numeric: tabular-nums; }
html[data-ui-theme-mode="light"] .exv-zoom button, html[data-ui-theme-mode="light"] .exv-zoom-label { color: #47536e; }
.exv-pdf { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 12px 12px 40px; min-width: max-content; }
.exv-pdf-page { margin: 0 auto; }  /* so the left side is not cut off when zoom overflows (auto margins become 0 on overflow) */
.exv-pdf-page { position: relative; max-width: none; background: #fff; box-shadow: 0 4px 18px rgba(0,0,0,.45); border-radius: 2px; overflow: hidden; }
.exv-pdf-page::before { content: attr(data-page); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #cbd5e1; font-size: 28px; font-weight: 800; }
.exv-pdf-page img { position: relative; display: block; width: 100%; height: 100%; }
.exv-pageno { position: absolute; right: 14px; bottom: 16px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #e2e8f0; background: rgba(15,23,42,.88); border: 1px solid rgba(255,255,255,.12); pointer-events: none; font-variant-numeric: tabular-nums; }
.exv-pageno.hidden { display: none; }
.exv-image.actual { display: block; overflow: visible; }
.exv-image.actual img { max-width: none; max-height: none; cursor: zoom-out; }
.exv-image img { cursor: zoom-in; }
.exv-image.zoomed { display: block; overflow: visible; }   /* image zoomed with two fingers: scroll to reach every corner */
.exv-image.zoomed img { display: block; margin: 0 auto; max-width: none; max-height: none; }
.exv-media { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px 12px; min-height: 50%; }
.exv-media video { width: 100%; max-height: 75vh; border-radius: 10px; background: #000; }
.exv-media audio { width: min(100%, 520px); }
.open-files-chip { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; font-size: 13px; font-weight: 800; color: #dbeafe; background: rgba(37,99,235,.92); box-shadow: 0 8px 24px rgba(0,0,0,.4); white-space: nowrap; }
.open-files-chip.hidden { display: none; }


/* ── File editor ── */
.exv-body:has(.exv-editor) { display: flex; flex-direction: column; overflow: hidden; }
.exv-editor { flex: 1; min-height: 0; display: flex; overflow: hidden; background: #0b0f19; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: var(--editor-font, 13px); line-height: 1.55; }
@media (pointer: coarse) { .exv-editor { font-size: max(14px, var(--editor-font, 13px)); } }
.exv-editor .exv-gutter { position: relative; flex-shrink: 0; min-width: 44px; margin: 0; padding: 10px 10px 40vh 12px; overflow: visible; will-change: transform; font: inherit; line-height: inherit; }
.exv-editor.wrap .exv-gutter { display: none; }
.exv-textarea { flex: 1; min-width: 0; height: 100%; margin: 0; padding: 10px 14px 40vh; border: 0; outline: none; resize: none; background: transparent; color: #e2e8f0; caret-color: #60a5fa; font: inherit; line-height: inherit; tab-size: 4; white-space: pre; overflow: auto; -webkit-overflow-scrolling: touch; }
.exv-editor.wrap .exv-textarea { white-space: pre-wrap; overflow-wrap: anywhere; }
.exv-textarea::selection { background: rgba(59,130,246,.35); }
.exv-find { display: flex; align-items: flex-start; gap: 4px; flex: none; padding: 6px 10px 6px 4px; background: #111827; border-bottom: 1px solid #334155; color: #e2e8f0; }
.exv-find[hidden] { display: none; }
.exv-find-rows { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.exv-find-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.exv-find-row[hidden] { display: none; }
.exv-find-field { flex: 1; min-width: 60px; max-width: 420px; display: flex; align-items: center; gap: 1px; padding: 0 3px 0 0; border: 1px solid #475569; border-radius: 6px; background: #0b0f19; }
.exv-find-field:focus-within { border-color: #60a5fa; }
.exv-find-query, .exv-replace-query { flex: 1; min-width: 0; padding: 6px 9px; border: 0; outline: none; background: transparent; color: inherit; font-size: 13px; }
.exv-find button { flex: none; min-width: 28px; height: 28px; border-radius: 5px; font-size: 14px; }
.exv-find .exv-find-opt { min-width: 24px; height: 22px; padding: 0 4px; font-size: 12px; font-family: 'JetBrains Mono', ui-monospace, monospace; color: #94a3b8; border: 1px solid transparent; }
.exv-find .exv-find-opt[aria-pressed="true"] { color: #e2e8f0; background: rgba(59,130,246,.3); border-color: #60a5fa; }
.exv-find .exv-find-expand { min-width: 20px; width: 20px; font-size: 10px; color: #94a3b8; }
.exv-find .exv-find-expand[hidden] { display: none; }
.exv-find-expand i { transition: transform .15s; }
.exv-find-expand.open i { transform: rotate(90deg); }
.exv-find .exv-find-act { font-size: 12px; }
.exv-find button:hover:not(:disabled), .exv-find button[aria-pressed="true"]:not(.exv-find-opt) { background: #334155; }
.exv-find button:disabled { opacity: .35; }
.exv-find-count { min-width: 45px; max-width: 40%; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exv-find-count.none { color: #f87171; }
/* Editor current line: a band behind the textarea (flashes when jumping over from the preview) */
.exv-caretline { position: absolute; z-index: 0; pointer-events: none; background: rgba(148,163,184,.06); box-shadow: inset 3px 0 0 rgba(96,165,250,.35); }
.exv-caretline.focused { background: rgba(96,165,250,.12); box-shadow: inset 3px 0 0 #60a5fa; }
.exv-caretline.flash { animation: exv-caret-flash 1.1s ease-out; }
@keyframes exv-caret-flash { 0%, 25% { background: rgba(96,165,250,.45); box-shadow: inset 4px 0 0 #93c5fd, 0 0 0 1px rgba(96,165,250,.6); } 100% { background: rgba(96,165,250,.12); } }
html[data-ui-theme-mode="light"] .exv-caretline { background: rgba(15,23,42,.035); box-shadow: inset 3px 0 0 rgba(37,99,235,.3); }
html[data-ui-theme-mode="light"] .exv-caretline.focused { background: rgba(37,99,235,.08); box-shadow: inset 3px 0 0 #2563eb; }
/* Editor search highlights: an identically shaped layer laid behind the textarea */
.exv-editor { position: relative; }
.exv-editor .exv-textarea { position: relative; z-index: 1; }
.exv-find-layer { position: absolute; z-index: 0; overflow: hidden; pointer-events: none; }
.exv-find-layer > div { box-sizing: border-box; color: transparent; will-change: transform; }
.exv-find-layer mark { color: transparent; background: rgba(250,204,21,.35); border-radius: 2px; }
.exv-find-layer mark.active { background: rgba(251,146,60,.75); box-shadow: 0 0 0 1px #f97316; }
html[data-ui-theme-mode="light"] .exv-find-field { background: #fff; border-color: #cbd5e1; }
html[data-ui-theme-mode="light"] .exv-find button:hover:not(:disabled) { background: #e2e8f0; }
html[data-ui-theme-mode="light"] .exv-find .exv-find-opt[aria-pressed="true"] { color: #1e3a8a; background: rgba(59,130,246,.18); }
html[data-ui-theme-mode="light"] .exv-find-layer mark { background: rgba(234,179,8,.35); }
html[data-ui-theme-mode="light"] .exv-find-layer mark.active { background: rgba(249,115,22,.5); }
.exv-find-hit { position: absolute; z-index: 1; background: #facc1566; pointer-events: none; }
.exv-find-hit.active { background: #fb923c99; outline: 1px solid #f97316; }
html[data-ui-theme-mode="light"] .exv-find { background: #f1f5f9; border-color: #cbd5e1; color: #0f172a; }
html[data-ui-theme-mode="light"] .exv-find-query { background: white; border-color: #94a3b8; }
html[data-ui-theme-mode="light"] .exv-find button:hover, html[data-ui-theme-mode="light"] .exv-find button[aria-pressed="true"] { background: #cbd5e1; }
/* Markdown editing: editor | live preview (top · bottom on narrow screens) */
.exv-body:has(.exv-split) { display: flex; flex-direction: column; overflow: hidden; }
.exv-split { --split: 50%; flex: 1; min-height: 0; display: flex; overflow: hidden; }
.exv-split > .exv-editor { flex: 0 0 var(--split); min-width: 0; }
.exv-split-bar { flex: 0 0 6px; margin: 0 -2px; z-index: 1; cursor: col-resize; touch-action: none; background: linear-gradient(to right, transparent 2px, rgba(255,255,255,.08) 2px, rgba(255,255,255,.08) 4px, transparent 4px); }
.exv-split-bar:hover, .exv-split.dragging .exv-split-bar { background: linear-gradient(to right, transparent 1px, rgba(96,165,250,.6) 1px, rgba(96,165,250,.6) 5px, transparent 5px); }
.exv-split.dragging { user-select: none; -webkit-user-select: none; }
.exv-live { flex: 1; min-width: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.exv-live .exv-md { padding-bottom: 40vh; }
.exv-live .exv-htmldoc:not(.hv-paper) { min-height: 100%; background: #fff; }
.exv-live-plain { margin: 0; padding: 18px 20px; white-space: pre-wrap; }
/* The block rendering the line the editor cursor is on: blue bar on the left + faint background (via shadow · pseudo-element so nothing shifts) */
.exv-live { --md-cur-bg: rgba(96,165,250,.09); --md-cur-bar: #60a5fa; }
html[data-ui-theme-mode="light"] .exv-live { --md-cur-bg: rgba(37,99,235,.07); --md-cur-bar: #2563eb; }
.exv-live .md-cursor:not(tr) { position: relative; background: var(--md-cur-bg); box-shadow: -8px 0 0 var(--md-cur-bg); border-radius: 0 4px 4px 0; }
.exv-live .md-cursor:not(tr)::before { content: ''; position: absolute; left: -11px; top: 0; bottom: 0; width: 3px; border-radius: 2px; background: var(--md-cur-bar); pointer-events: none; }
.exv-live li.md-cursor { box-shadow: -22px 0 0 var(--md-cur-bg); }
.exv-live li.md-cursor::before { left: -25px; }
.exv-live li.md-cursor::marker { color: var(--md-cur-bar); }
.exv-live tr.md-cursor > * { background: var(--md-cur-bg); }
.exv-live tr.md-cursor > :first-child { box-shadow: inset 3px 0 0 var(--md-cur-bar); }
@media (max-width: 767px) {
  .exv-split { flex-direction: column; }
  .exv-split > .exv-editor { flex-basis: var(--split); min-height: 0; }
  .exv-split-bar { flex-basis: 10px; margin: -3px 0; cursor: row-resize; background: linear-gradient(to bottom, transparent 4px, rgba(255,255,255,.1) 4px, rgba(255,255,255,.1) 6px, transparent 6px); }
  .exv-split-bar:hover, .exv-split.dragging .exv-split-bar { background: linear-gradient(to bottom, transparent 3px, rgba(96,165,250,.6) 3px, rgba(96,165,250,.6) 7px, transparent 7px); }
  .exv-split .exv-textarea, .exv-split .exv-gutter { padding-bottom: 24px; }
  .exv-live .exv-md { padding-bottom: 32px; }
}
.exv-md-toggle.off { color: #94a3b8; background: rgba(148,163,184,.1); border-color: rgba(148,163,184,.25); }
.exv-edit-btn, .exv-save-btn, .exv-done-btn { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 10px; flex-shrink: 0; font-size: 12px; font-weight: 800; }
.exv-edit-btn { color: #e2e8f0; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); }
@media (hover: hover) { .exv-edit-btn:hover { background: rgba(255,255,255,.12); } }
.exv-save-btn { color: #fff; background: linear-gradient(135deg, #2563eb, #7c3aed); opacity: .55; }
.exv-save-btn.dirty { opacity: 1; box-shadow: 0 4px 14px rgba(59,130,246,.35); }
.exv-save-btn:disabled { opacity: .4; }
.exv-done-btn { color: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.12); }
.exv-edit-btn.hidden, .exv-save-btn.hidden { display: none; }
.exv-dirty { color: #fbbf24; font-size: 10px; margin-right: 5px; }
html[data-ui-theme-mode="light"] .exv-edit-btn { color: #1f2937; background: rgba(15,23,42,.05); border-color: rgba(15,23,42,.12); }
html[data-ui-theme-mode="light"] .exv-done-btn { color: #334155; border-color: rgba(15,23,42,.15); }
@media (max-width: 640px) { .exv-edit-btn span, .exv-save-btn span, .exv-md-toggle span { display: none; } .exv-edit-btn, .exv-save-btn, .exv-md-toggle { padding: 0 10px; } }
.ex-row.dragging { opacity: .45; }
.ex-row[draggable="true"] { -webkit-user-drag: element; }
/* Items ignored by .gitignore: dimmed like VS Code */
.ex-row.ignored { opacity: .45; }
.ex-row.ignored .ex-name { color: #94a3b8; }
.ex-row.ignored.selected { opacity: .7; }
html[data-ui-theme-mode="light"] .ex-row.ignored .ex-name { color: #64748b; }

/* ── Hangul (hwpx) preview: like a document on white paper ── */
.hwp-doc { --hwp-font: 'Noto Serif KR', 'Nanum Myeongjo', 'Batang', serif; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 12px 12px 40px; }
.hwp-page { background: #fff; color: #000; box-shadow: 0 4px 18px rgba(0,0,0,.45); border-radius: 2px; font-family: var(--hwp-font); font-size: 10pt; line-height: 1.6; box-sizing: border-box; max-width: none; overflow-wrap: anywhere; }
.hwp-p { margin: 0; min-height: 1em; white-space: pre-wrap; }
.hwp-tab { display: inline-block; width: 2em; }
.hwp-table { border-collapse: collapse; margin: 4px 0; table-layout: fixed; max-width: 100%; }
.hwp-table td { box-sizing: border-box; overflow-wrap: anywhere; }
.hwp-img { max-width: 100%; height: auto; display: inline-block; vertical-align: middle; }
.hwp-box { border: 1px solid #999; padding: 6px 8px; margin: 4px 0; }
.hwp-eq { font-family: 'JetBrains Mono', monospace; background: #f1f5f9; padding: 0 4px; }
.hwp-missing { color: #94a3b8; font-size: 9pt; }

/* ── Table view (CSV · archive listing · SQLite) ── */
.data-wrap { padding: 10px 12px 32px; overflow-x: auto; }
.data-table { border-collapse: collapse; font-size: 12.5px; color: #d7dce6; min-width: 100%; }
.data-table th, .data-table td { padding: 5px 10px; border: 1px solid rgba(255,255,255,.09); text-align: left; white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.data-table th { position: sticky; top: 0; background: #131a2b; color: #f1f5f9; font-weight: 700; z-index: 1; }
.data-table tbody tr:nth-child(even) td { background: rgba(255,255,255,.02); }
@media (hover: hover) { .data-table tbody tr:hover td { background: rgba(59,130,246,.08); } }
.data-table .rn { color: #64748b; text-align: right; font-variant-numeric: tabular-nums; width: 1%; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; color: #94a3b8; }
.data-table tr.dir td { color: #7dd3fc; }
.data-table td.null { color: #64748b; font-style: italic; }
.db-tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px 0; }
.db-tabs button { padding: 5px 10px; border-radius: 9px; font-size: 12px; font-weight: 700; color: #cbd5e1; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); }
.db-tabs button.on { color: #bfdbfe; background: rgba(59,130,246,.2); border-color: rgba(96,165,250,.4); }
.db-tabs small { opacity: .6; margin-left: 3px; }

/* ── Jupyter notebook ── */
.nb { max-width: 980px; margin: 0 auto; padding: 14px 14px 48px; display: flex; flex-direction: column; gap: 12px; }
.nb-cell.nb-md .exv-md { padding: 0; max-width: none; }
.nb-code { border: 1px solid rgba(255,255,255,.08); border-radius: 10px; overflow: hidden; background: #0f1524; }
.nb-prompt { padding: 4px 10px; font-size: 10.5px; font-family: 'JetBrains Mono', monospace; color: #60a5fa; border-bottom: 1px solid rgba(255,255,255,.06); }
.nb-src { margin: 0; padding: 10px 12px; overflow-x: auto; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; line-height: 1.55; }
.nb-src code.hljs { background: transparent; padding: 0; }
.nb-outputs { border-top: 1px dashed rgba(255,255,255,.1); padding: 8px 12px; background: #0b0f19; }
.nb-out { margin: 0; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #cbd5e1; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow: auto; }
.nb-out.err { color: #fca5a5; }
.nb-img { max-width: 100%; background: #fff; border-radius: 6px; margin: 4px 0; }
.nb-html { overflow-x: auto; font-size: 12.5px; color: #d7dce6; }
.nb-html table { border-collapse: collapse; }
.nb-html th, .nb-html td { border: 1px solid rgba(255,255,255,.12); padding: 3px 8px; }
.nb-svg svg { max-width: 100%; height: auto; background: #fff; }

/* ── Hex dump ── */
.exv-hex { margin: 0; padding: 10px 14px 32px; font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.55; color: #cbd5e1; white-space: pre; }
.exv-note-info { color: #93c5fd; position: static; }

/* ── tmux window tabs ── */
.term-tabs { display: flex; gap: 2px; align-items: flex-end; height: 38px; padding: 4px 8px 0; overflow-x: auto; border-bottom: 1px solid rgba(255,255,255,.06); -webkit-overflow-scrolling: touch; }
.term-tabs.hidden { display: none; }
.tt-tab { display: flex; align-items: center; gap: 7px; flex-shrink: 0; max-width: 210px; height: 33px; padding: 0 4px 0 11px; border-radius: 9px 9px 0 0; border: 1px solid transparent; border-bottom: 0;
    font-size: 12.5px; font-weight: 700; color: rgba(255,255,255,.5); cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; position: relative; }
@media (hover: hover) { .tt-tab:hover { color: rgba(255,255,255,.85); background: rgba(255,255,255,.04); } }
.tt-tab.active { color: #fff; background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.1); box-shadow: inset 0 2px 0 #60a5fa; }
.tt-tab .status-dot { flex-shrink: 0; }
.tt-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-unread { width: 6px; height: 6px; border-radius: 50%; background: #60a5fa; flex-shrink: 0; }
.tt-close { width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: rgba(255,255,255,.4); }
@media (hover: hover) { .tt-close:hover { background: rgba(255,255,255,.12); color: #fff; } }
@media (pointer: coarse) { .tt-tab { height: 34px; } .tt-close { width: 28px; height: 28px; } }
html[data-ui-theme-mode="light"] .tt-tab { color: #64748b; }
html[data-ui-theme-mode="light"] .tt-tab.active { color: #0f172a; background: rgba(15,23,42,.05); border-color: rgba(15,23,42,.1); }
html[data-ui-theme-mode="light"] .tt-close { color: #64748b; }
html[data-ui-theme-mode="light"] .term-tabs { border-bottom-color: rgba(15,23,42,.08); }

/* ── Workspace shared tab bar: tmux window tabs + file tabs ── */
.ws-tabbar { display: flex; gap: 2px; align-items: flex-end; flex-shrink: 0; height: 40px; padding: 5px 8px 0; overflow-x: auto; overflow-y: hidden;
    border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(8,11,20,.55); -webkit-overflow-scrolling: touch; }
.ws-tabbar.hidden { display: none; }
.wt { display: flex; align-items: center; gap: 7px; flex-shrink: 0; max-width: 220px; height: 34px; padding: 0 4px 0 10px; border-radius: 9px 9px 0 0;
    border: 1px solid transparent; border-bottom: 0; font-size: 12.5px; font-weight: 700; color: rgba(255,255,255,.5); cursor: pointer;
    user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; position: relative; }
@media (hover: hover) { .wt:hover { color: rgba(255,255,255,.85); background: rgba(255,255,255,.04); } }
.wt.active { color: #fff; background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.1); }
/* Telling kinds apart: tmux tabs have a blue >_ badge · blue top line, file tabs a file icon · non-italic name + amber top line */
.wt-term.active { box-shadow: inset 0 2px 0 #60a5fa; }
.wt-file.active { box-shadow: inset 0 2px 0 #fbbf24; }
.wt-kind { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 5px; flex-shrink: 0;
    font-size: 9px; color: #bfdbfe; background: rgba(59,130,246,.25); border: 1px solid rgba(96,165,250,.35); }
.wt-file .ex-icon { font-size: 12px; width: 14px; }
.wt-file { color: rgba(253,230,138,.6); }
.wt-file.active { color: #fef3c7; }
.wt .status-dot { flex-shrink: 0; }
.wt-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Close all tabs: stays pinned to the right end even when many tabs overflow sideways */
.wt-close-all { position: sticky; right: 0; margin-left: auto; flex-shrink: 0; align-self: center; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; font-size: 11px; font-weight: 700; white-space: nowrap; color: rgba(255,255,255,.6); background: rgba(15,23,42,.92); border: 1px solid rgba(255,255,255,.12); }
@media (hover: hover) { .wt-close-all:hover { color: #fca5a5; border-color: rgba(248,113,113,.45); } }
@media (max-width: 640px) { .wt-close-all span { display: none; } .wt-close-all { padding: 0 8px; } }
html[data-ui-theme-mode="light"] .wt-close-all { color: #5a6781; background: rgba(255,255,255,.95); border-color: rgba(15,23,42,.14); }
.wt-close { width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: rgba(255,255,255,.4); }
@media (hover: hover) { .wt-close:hover { background: rgba(255,255,255,.12); color: #fff; } }
@media (pointer: coarse) { .wt { height: 36px; } .wt-close { width: 28px; height: 28px; } }
html[data-ui-theme-mode="light"] .ws-tabbar { background: rgba(255,255,255,.6); border-bottom-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .wt { color: #64748b; }
html[data-ui-theme-mode="light"] .wt.active { color: #0f172a; background: rgba(15,23,42,.05); border-color: rgba(15,23,42,.1); }
html[data-ui-theme-mode="light"] .wt-file { color: #b45309; }
html[data-ui-theme-mode="light"] .wt-kind { color: #1d4ed8; background: rgba(37,99,235,.12); }
/* Phone: the tab bar is at the very top, so it takes the notch padding and the header below has none */
@media (max-width: 1023.98px) {
    #termPane.has-tabs .ws-tabbar { padding-top: calc(5px + env(safe-area-inset-top)); height: calc(40px + env(safe-area-inset-top)); }
    #termPane.has-tabs .safe-top-term { padding-top: 0 !important; }
}

/* ── Workspace: window list on the left · terminal/file in the centre · file tree on the right ── */
.ws-side-head { align-items: center; justify-content: space-between; gap: 8px; height: 40px; padding: 0 8px 0 14px; flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,.08); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.5); }
#filePane .ws-side-head { padding: 0 14px 0 8px; }
.ws-side-head i { margin-right: 4px; }
.ws-side-btn { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.45); font-size: 12px; }
@media (hover: hover) { .ws-side-btn:hover { background: rgba(255,255,255,.08); color: #fff; } }
.ws-side-btn i { margin: 0; }
.ws-rail { display: none; }
html[data-ui-theme-mode="light"] .ws-side-head { color: #5a6781; border-bottom-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .ws-side-btn { color: #5a6781; }

/* Phone · tablet: no room for three columns, so switch windows ↔ files (the switch buttons on top) */
@media (max-width: 1023.98px) {
    body[data-ws-mode="files"] #listPane { display: none !important; }
    body:not([data-ws-mode="files"]) #filePane { display: none !important; }
}
/* Desktop: both sidebars collapse to a thin rail (clicking the rail expands it again) */
@media (min-width: 1024px) {
    #fileMode .open-files-chip { display: none !important; }   /* open files are in the centre tab bar */
    html.ws-left-collapsed #listPane, html.ws-right-collapsed #filePane { width: 44px !important; min-width: 44px; }
    html.ws-right-collapsed #filePane { flex-basis: 44px !important; }
    html.ws-left-collapsed #listPane > :not(.ws-rail), html.ws-right-collapsed #filePane > :not(.ws-rail) { display: none !important; }
    html.ws-left-collapsed #listPane > .ws-rail, html.ws-right-collapsed #filePane > .ws-rail {
        display: flex; flex-direction: column; align-items: center; gap: 14px; flex: 1; padding-top: 12px; color: rgba(255,255,255,.5); font-size: 12px;
    }
    .ws-rail:hover { background: rgba(255,255,255,.04); color: #fff; }
    .ws-rail-label { writing-mode: vertical-rl; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
    .ws-rail-label i { writing-mode: horizontal-tb; margin-bottom: 6px; }
    html[data-ui-theme-mode="light"] .ws-rail { color: #5a6781; }
}
/* The file explorer width is changed by dragging the divider, and the reset button in the title restores the default width */
@media (min-width: 1024px) {
    #filePane { position: relative; }
    .ws-file-resize { position: absolute; z-index: 30; top: 0; bottom: 0; left: -4px; width: 8px; cursor: col-resize; touch-action: none; }
    .ws-file-resize::after { content: ""; position: absolute; inset: 0 3px; background: transparent; transition: background .12s; }
    .ws-file-resize:hover::after, .ws-file-resize:focus-visible::after { background: rgba(96,165,250,.8); outline: none; }
    html.ws-swapped .ws-file-resize { left: auto; right: -4px; }
    html.ws-right-collapsed .ws-file-resize { display: none; }
    html.ws-resizing-file-pane, html.ws-resizing-file-pane * { cursor: col-resize !important; user-select: none !important; }
}
@media (max-width: 1023.98px) { .ws-file-resize, [data-file-width-reset] { display: none !important; } }
@media (min-width: 1024px) {
    #explorerTreePane { position: relative; }
    .ex-page-resize { position: absolute; z-index: 30; top: 0; bottom: 0; right: -4px; width: 8px; cursor: col-resize; touch-action: none; }
    .ex-page-resize::after { content: ""; position: absolute; inset: 0 3px; background: transparent; transition: background .12s; }
    .ex-page-resize:hover::after, .ex-page-resize:focus-visible::after { background: rgba(96,165,250,.8); outline: none; }
    html.ex-resizing-pane, html.ex-resizing-pane * { cursor: col-resize !important; user-select: none !important; }
}
@media (max-width: 1023.98px) { .ex-page-resize { display: none !important; } }
/* Narrow right file sidebar: smaller tool buttons so the root folder name stays visible */
@media (min-width: 1024px) {
    #filePane .ex-tools button { width: 26px; height: 28px; font-size: 11.5px; }
    #filePane .ex-head { padding: 8px 6px 6px 8px; gap: 2px; }
    #filePane .ex-root { padding: 6px 4px; }
}
.sheet-form [data-mode-field].hidden { display: none; }
/* Nothing selected (clicked on empty space): new items go to the root → the root name is slightly emphasized */
.ex-body.root-target { box-shadow: inset 0 0 0 1px rgba(96,165,250,.18); border-radius: 8px; }

/* ── Auto save ── */
.exv-auto-btn { display: flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border-radius: 10px; flex-shrink: 0; font-size: 11.5px; font-weight: 800;
    color: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.12); }
.exv-auto-btn.on { color: #6ee7b7; border-color: rgba(52,211,153,.35); background: rgba(16,185,129,.12); }
.exv-auto-btn.hidden { display: none; }
@media (max-width: 640px) { .exv-auto-btn span { display: none; } }
.exv-conflict { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 9px 14px; font-size: 12.5px; color: #fde68a;
    background: rgba(245,158,11,.12); border-bottom: 1px solid rgba(245,158,11,.3); flex-shrink: 0; }
.exv-conflict span { flex: 1; min-width: 200px; }
.exv-conflict button { padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 800; color: #fff; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); }
.exv-conflict button[data-act="conflict-overwrite"] { background: rgba(239,68,68,.25); border-color: rgba(248,113,113,.45); }

/* ── Terminal (xterm) ── */
.wt-kind.pty { color: #bbf7d0; background: rgba(34,197,94,.22); border-color: rgba(74,222,128,.4); font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 800; }
.wt-pty { color: rgba(187,247,208,.6); }
.wt-pty.active { color: #dcfce7; box-shadow: inset 0 2px 0 #4ade80; }
.wt-pty.dead .wt-name { text-decoration: line-through; opacity: .6; }
html[data-ui-theme-mode="light"] .wt-pty { color: #15803d; }
html[data-ui-theme-mode="light"] .wt-kind.pty { color: #15803d; background: rgba(34,197,94,.12); }
.pty-host { position: relative; background: #0b0f19; padding: 6px 4px 4px 8px; overflow: hidden; }
.pty-screen { position: absolute; inset: 6px 4px 4px 8px; }
.pty-screen.hidden { display: none; }
.pty-screen .xterm { height: 100%; }
.pty-screen .xterm-viewport { background: #0b0f19 !important; }
.pty-keys { background: rgba(8,11,20,.9); border-top: 1px solid rgba(255,255,255,.08); padding-bottom: 8px; }
html.kb-open .pty-keys.safe-bottom { padding-bottom: 6px !important; }

/* ── Properties window ── */
.sheet-info { padding: 2px 2px 6px; max-height: 60vh; overflow-y: auto; }
.prop-list { display: grid; gap: 0; margin: 0; }
.prop-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; padding: 8px 2px; border-bottom: 1px solid rgba(148,163,184,.12); font-size: 12.5px; }
.prop-row:last-child { border-bottom: 0; }
.prop-row dt { opacity: .55; font-weight: 700; }
.prop-row dd { margin: 0; overflow-wrap: anywhere; }
.prop-row.strong dd { font-weight: 800; }
.prop-row code { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.prop-copy { text-align: left; overflow-wrap: anywhere; }
.prop-copy i { opacity: .5; font-size: 10px; margin-left: 4px; }
@media (hover: hover) { .prop-copy:hover i { opacity: 1; } }
.prop-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; background: rgba(148,163,184,.15); }
.prop-tag.warn { background: rgba(245,158,11,.15); color: #fbbf24; }
@media (max-width: 480px) { .prop-row { grid-template-columns: 92px minmax(0, 1fr); } }

/* ════════ Light mode: chat · terminal screen · file viewer · editor go light too ════════ */
html[data-ui-theme-mode="light"] .terminal { background: #f8fafc; color: #1e293b; border-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .term-screen { color: #1e293b; }
html[data-ui-theme-mode="light"] .term-screen .cur { background: #0f172a; color: #f8fafc; }
html[data-ui-theme-mode="light"] .term-screen .t-rule { background: linear-gradient(90deg, rgba(100,116,139,.35), rgba(100,116,139,.08)); }
html[data-ui-theme-mode="light"] .term-screen ::selection { background: rgba(37,99,235,.2); }
html[data-ui-theme-mode="light"] .term-empty-note { color: #94a3b8; }

/* Chat */
html[data-ui-theme-mode="light"] .chat-list { color: #1e293b; }
html[data-ui-theme-mode="light"] .msg-meta, html[data-ui-theme-mode="light"] .log-older, html[data-ui-theme-mode="light"] .log-empty { color: #64748b; }
html[data-ui-theme-mode="light"] .log-older button { color: #2563eb; }
html[data-ui-theme-mode="light"] .msg-user .msg-body { background: rgba(37,99,235,.1); border-color: rgba(37,99,235,.22); color: #0f172a; }
html[data-ui-theme-mode="light"] .msg-ai .copy-btn, html[data-ui-theme-mode="light"] .msg-user .copy-btn { color: #94a3b8; }
@media (hover: hover) { html[data-ui-theme-mode="light"] :is(.msg-ai, .msg-user) .copy-btn:hover { color: #0f172a; background: rgba(15,23,42,.06); } }
html[data-ui-theme-mode="light"] .msg-system { color: #475569; background: rgba(100,116,139,.12); }
html[data-ui-theme-mode="light"] .msg-body code { background: rgba(15,23,42,.06); color: #b45309; }
html[data-ui-theme-mode="light"] .msg-tool .sub-live { background: rgba(15,23,42,.03); border-top-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .msg-sub { background: rgba(99,102,241,.05); border-color: rgba(79,70,229,.2); }
html[data-ui-theme-mode="light"] .msg-sub .sub-body { border-top-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .msg-tool summary .sub-badge { color: #047857; background: rgba(5,150,105,.1); }
html[data-ui-theme-mode="light"] .msg-tool summary .sub-badge.run { color: #1d4ed8; background: rgba(37,99,235,.1); }
html[data-ui-theme-mode="light"] .msg-tool { background: rgba(15,23,42,.03); border-color: rgba(15,23,42,.1); }
html[data-ui-theme-mode="light"] .msg-tool summary .tool-name { color: #4f46e5; }
html[data-ui-theme-mode="light"] .msg-tool summary .tool-sum { color: #64748b; }
html[data-ui-theme-mode="light"] .msg-tool summary .tool-state { color: #059669; }
html[data-ui-theme-mode="light"] .msg-tool pre { color: #334155; border-top-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .msg-user.pending .msg-meta { color: #b45309; }
html[data-ui-theme-mode="light"] .chat-status { background: rgba(255,255,255,.96); border-color: rgba(15,23,42,.12); box-shadow: 0 8px 24px rgba(15,23,42,.12); }
html[data-ui-theme-mode="light"] .chat-status.busy { color: #2563eb; }
html[data-ui-theme-mode="light"] .chat-status.busy .chat-status-text, html[data-ui-theme-mode="light"] .chat-status-question { color: #1e293b; }
html[data-ui-theme-mode="light"] .chat-status.waiting { border-color: rgba(217,119,6,.45); }
html[data-ui-theme-mode="light"] .chat-status-head { color: #b45309; }
html[data-ui-theme-mode="light"] .chat-status button { color: #b91c1c; background: rgba(239,68,68,.08); border-color: rgba(220,38,38,.3); }
html[data-ui-theme-mode="light"] .chat-status-options button { color: #1e293b; background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.3); }
html[data-ui-theme-mode="light"] .chat-status-options button b { color: #1d4ed8; }
html[data-ui-theme-mode="light"] .chat-status-options button.muted { color: #475569; background: rgba(100,116,139,.1); border-color: rgba(100,116,139,.25); }
html[data-ui-theme-mode="light"] .chat-live-toggle { background: rgba(15,23,42,.05) !important; border-color: rgba(15,23,42,.12) !important; color: #334155 !important; }
html[data-ui-theme-mode="light"] .chat-live { background: #f1f5f9; border-color: rgba(15,23,42,.08); color: #334155; }

/* File viewer · editor */
html[data-ui-theme-mode="light"] .exv-body, html[data-ui-theme-mode="light"] .exv-editor, html[data-ui-theme-mode="light"] .exv-gutter { background: #f8fafc; color: #1e293b; }
html[data-ui-theme-mode="light"] .exv-gutter { color: #94a3b8; border-right-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .exv-meta { color: #64748b; border-bottom-color: rgba(15,23,42,.06); }
html[data-ui-theme-mode="light"] .exv-textarea { color: #0f172a; caret-color: #2563eb; }
@media (min-width: 768px) { html[data-ui-theme-mode="light"] .exv-split-bar { background: linear-gradient(to right, transparent 2px, rgba(15,23,42,.1) 2px, rgba(15,23,42,.1) 4px, transparent 4px); } }
html[data-ui-theme-mode="light"] .exv-md-toggle { color: #1d4ed8; background: rgba(37,99,235,.1); border-color: rgba(37,99,235,.3); }
@media (max-width: 767px) { html[data-ui-theme-mode="light"] .exv-split-bar { background: linear-gradient(to bottom, transparent 4px, rgba(15,23,42,.12) 4px, rgba(15,23,42,.12) 6px, transparent 6px); } }
html[data-ui-theme-mode="light"] .exv-md-toggle.off { color: #64748b; background: rgba(100,116,139,.08); border-color: rgba(100,116,139,.25); }
html[data-ui-theme-mode="light"] .exv-image { background: repeating-conic-gradient(#e2e8f0 0 25%, #f8fafc 0 50%) 0 0 / 20px 20px; }
html[data-ui-theme-mode="light"] .exv-empty { color: #64748b; }
html[data-ui-theme-mode="light"] .exv-tab.active { color: #0f172a; background: #f8fafc; border-color: rgba(15,23,42,.1); }
html[data-ui-theme-mode="light"] .exv-pdf-page, html[data-ui-theme-mode="light"] .hwp-page { box-shadow: 0 2px 12px rgba(15,23,42,.18); }
html[data-ui-theme-mode="light"] .exv-pageno { color: #0f172a; background: rgba(255,255,255,.92); border-color: rgba(15,23,42,.12); }
html[data-ui-theme-mode="light"] .exv-md { color: #1e293b; }
html[data-ui-theme-mode="light"] .exv-md h1, html[data-ui-theme-mode="light"] .exv-md h2, html[data-ui-theme-mode="light"] .exv-md h3,
html[data-ui-theme-mode="light"] .exv-md h4, html[data-ui-theme-mode="light"] .exv-md strong, html[data-ui-theme-mode="light"] .exv-md th { color: #0f172a; }
html[data-ui-theme-mode="light"] .exv-md h1, html[data-ui-theme-mode="light"] .exv-md h2, html[data-ui-theme-mode="light"] .exv-md hr { border-color: rgba(15,23,42,.12); }
html[data-ui-theme-mode="light"] .exv-md a { color: #2563eb; }
html[data-ui-theme-mode="light"] .exv-md blockquote { color: #475569; background: rgba(15,23,42,.03); }
html[data-ui-theme-mode="light"] .exv-md code { background: rgba(15,23,42,.06); color: #be185d; }
html[data-ui-theme-mode="light"] .exv-md pre { background: #f1f5f9; border-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .exv-md pre code { color: #1e293b; background: transparent; padding: 0; }   /* so the inline-code background does not leave stripes in code blocks */
html[data-ui-theme-mode="light"] .exv-md th, html[data-ui-theme-mode="light"] .exv-md td { border-color: rgba(15,23,42,.14); }
html[data-ui-theme-mode="light"] .exv-md th { background: rgba(15,23,42,.04); }
html[data-ui-theme-mode="light"] .exv-hex { color: #334155; }
html[data-ui-theme-mode="light"] .data-table { color: #1e293b; }
html[data-ui-theme-mode="light"] .data-table th { background: #e2e8f0; color: #0f172a; }
html[data-ui-theme-mode="light"] .data-table th, html[data-ui-theme-mode="light"] .data-table td { border-color: rgba(15,23,42,.1); }
html[data-ui-theme-mode="light"] .data-table tbody tr:nth-child(even) td { background: rgba(15,23,42,.025); }
html[data-ui-theme-mode="light"] .db-tabs button { color: #334155; background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.12); }
html[data-ui-theme-mode="light"] .db-tabs button.on { color: #1d4ed8; background: rgba(37,99,235,.1); border-color: rgba(37,99,235,.35); }
html[data-ui-theme-mode="light"] .nb-code { background: #f1f5f9; border-color: rgba(15,23,42,.1); }
html[data-ui-theme-mode="light"] .nb-outputs { background: #f8fafc; border-top-color: rgba(15,23,42,.1); }
html[data-ui-theme-mode="light"] .nb-out { color: #334155; }
html[data-ui-theme-mode="light"] .nb-out.err { color: #b91c1c; }
html[data-ui-theme-mode="light"] .nb-prompt { color: #2563eb; border-bottom-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .exv-conflict { color: #92400e; }

/* Terminal (xterm) */
html[data-ui-theme-mode="light"] .pty-host, html[data-ui-theme-mode="light"] .pty-screen .xterm-viewport { background: #f8fafc !important; }
html[data-ui-theme-mode="light"] .pty-keys { background: rgba(248,250,252,.95); border-top-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .md-table th, html[data-ui-theme-mode="light"] .md-table td { border-color: rgba(15,23,42,.12); }
html[data-ui-theme-mode="light"] .md-table th { color: #0f172a; background: rgba(15,23,42,.05); }
html[data-ui-theme-mode="light"] .md-table tbody tr:nth-child(even) td { background: rgba(15,23,42,.025); }
html[data-ui-theme-mode="light"] .md-code { background: #f1f5f9; border-color: rgba(15,23,42,.1); color: #1e293b; }
@media (min-width: 1280px) { .git-page.safe-bottom { padding-bottom: 0 !important; } }
.ex-copy { font-size: 11.5px; }
.ex-copy.done { color: #34d399 !important; opacity: 1 !important; }
@media (pointer: coarse) { .ex-copy { width: 32px; } }

/* ── Model chip (next to the ⚡ in the composer) ── */
.model-chip { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 11px; border-radius: 14px; flex-shrink: 0; max-width: 150px;
    font-size: 12px; font-weight: 800; color: #c4b5fd; background: rgba(139,92,246,.12); border: 1px solid rgba(167,139,250,.3); }
.model-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .model-chip:hover { background: rgba(139,92,246,.2); } }
.model-chip.pending { color: #fcd34d; border-color: rgba(251,191,36,.4); background: rgba(245,158,11,.12); }
.model-chip.hidden { display: none; }
@media (max-width: 480px) { .model-chip { max-width: 92px; padding: 0 8px; } .model-chip i { display: none; } }
html[data-ui-theme-mode="light"] .model-chip { color: #6d28d9; background: rgba(139,92,246,.08); border-color: rgba(139,92,246,.3); }

/* ── Remaining usage gauge (right side of the header) ── */
.usage-mini { display: none; align-items: center; gap: 12px; flex-shrink: 0; margin-right: 4px; }
.usage-mini:not(.hidden) { display: flex; }
@media (max-width: 639.98px) { .usage-mini { gap: 8px; } .um-label { font-size: 10px; } .um-bar { width: 30px !important; height: 6px; } .um-val { min-width: 26px; font-size: 10.5px; } }
.um-provider { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; color: rgba(255,255,255,.45); white-space: nowrap; }
.um-account { max-width: 190px; overflow: hidden; text-overflow: ellipsis; font-size: 10px; font-weight: 600; letter-spacing: 0; opacity: .85; }
#usageMini, .tp-usage { cursor: pointer; }
.um { display: flex; align-items: center; gap: 6px; }
.um-label { font-size: 11px; font-weight: 700; color: rgba(255,255,255,.55); }
.um-bar { position: relative; width: 64px; height: 7px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; }
.um-bar i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: #34d399; }
.um.mid .um-bar i { background: #fbbf24; }
.um.low .um-bar i { background: #f87171; }
.um-val { font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; color: rgba(255,255,255,.8); min-width: 32px; }
.um-reset { font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; color: rgba(255,255,255,.6); white-space: nowrap; }
.um-reset-label { color: rgba(255,255,255,.4); }
.um-reset-week { display: none; }   /* the weekly reset time only on large desktop screens */
@media (min-width: 1024px) { .um-reset-week { display: inline; } }
@media (max-width: 1279.98px) { .um-provider { display: none; } .um-bar { width: 44px; } }
@media (max-width: 639.98px) { .um-reset-label { display: none; } }
html[data-ui-theme-mode="light"] .um-provider, html[data-ui-theme-mode="light"] .um-label { color: #64748b; }
html[data-ui-theme-mode="light"] .um-bar { background: rgba(15,23,42,.1); }
html[data-ui-theme-mode="light"] .um-val { color: #1e293b; }
html[data-ui-theme-mode="light"] .um-reset { color: #475569; }
html[data-ui-theme-mode="light"] .um-reset-label { color: #94a3b8; }

/* Swap the window list ↔ file sidebar sides (desktop) */
@media (min-width: 1024px) {
    html.ws-swapped #filePane { order: 1; border-left-width: 0; border-right: 1px solid rgba(255,255,255,.1); }
    html.ws-swapped #editorArea { order: 2; }
    html.ws-swapped #listPane { order: 3; border-right-width: 0; border-left: 1px solid rgba(255,255,255,.1); }
    html.ws-swapped .ws-flip i { transform: scaleX(-1); }   /* the collapse arrow direction flips too */
    html.ws-swapped #listPane .ws-side-head { flex-direction: row-reverse; padding: 0 14px 0 8px; }
    html.ws-swapped #filePane .ws-side-head { flex-direction: row-reverse; padding: 0 8px 0 14px; }
    html[data-ui-theme-mode="light"].ws-swapped #filePane, html[data-ui-theme-mode="light"].ws-swapped #listPane { border-color: rgba(15,23,42,.1); }
}


/* ════════ Split view (only inside the centre editor area — never mixed with the left/right sidebars) ════════ */
@media (min-width: 1024px) {
    /* The left/right sidebars always keep their own width at both ends; only the editor area uses the remaining width */
    #workspace > #listPane, #workspace > #filePane { flex-shrink: 0; }
    #editorArea { display: flex; flex: 1 1 0%; min-width: 0; min-height: 0; flex-direction: row; position: relative; overflow: hidden; }
    #editorArea > #termPane { flex: 1 1 0%; min-width: 0; min-height: 0; }
    /* Split: a 2×2 grid (JS sets the cell layout via grid-template-areas) */
    #editorArea.is-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
    #editorArea.is-split > #termPane, #editorArea.is-split > .side-pane { min-width: 0; min-height: 0; box-shadow: inset 1px 0 0 rgba(255,255,255,.09), inset 0 1px 0 rgba(255,255,255,.09); }
}
@media (max-width: 1023.98px) { #editorArea { display: contents; } #editorArea > .side-pane, #dropZones { display: none !important; } }
.side-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: transparent; }
.side-pane.hidden { display: none; }
.side-bar { display: flex; align-items: flex-end; flex-shrink: 0; background: rgba(8,11,20,.55); border-bottom: 1px solid rgba(255,255,255,.08); }
.side-bar .ws-tabbar { flex: 1; border-bottom: 0; background: transparent; }
.side-bar-btn { width: 30px; height: 30px; margin: 0 4px 4px 0; flex-shrink: 0; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: rgba(255,255,255,.5); }
@media (hover: hover) { .side-bar-btn:hover { background: rgba(255,255,255,.08); color: #fff; } }
.side-host { position: relative; flex: 1; min-height: 0; }
.side-view { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; }
.side-view.hidden { display: none; }
.side-empty { align-items: center; justify-content: center; gap: 10px; color: rgba(255,255,255,.35); font-size: 13px; }
.side-empty i { font-size: 26px; }
#sideFileView.exv { position: absolute; }
/* Drop target indicator */
.drop-zones { position: absolute; inset: 0; z-index: 70; pointer-events: none; }
.drop-zones.hidden { display: none; }
.dz-highlight { position: absolute; opacity: 0; border-radius: 10px; background: rgba(59,130,246,.18); border: 2px solid rgba(96,165,250,.65); transition: all 90ms ease-out; }
/* The tmux screen of the second group */
.mirror-head { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px 0 12px; flex-shrink: 0; font-size: 12px; font-weight: 700; color: rgba(255,255,255,.7); border-bottom: 1px solid rgba(255,255,255,.06); }
.mirror-head .side-bar-btn { margin: 0 0 0 auto; }
.mirror-scroll { flex: 1; min-height: 0; overflow: auto; }
.mirror-scroll .term-screen { font-size: 12px; }
.mirror-keys { display: flex; gap: 5px; padding: 6px 8px 0; overflow-x: auto; flex-shrink: 0; }
.mirror-keys .key-chip { min-width: 34px; height: 28px; font-size: 11px; }
.mirror-form { display: flex; gap: 6px; padding: 6px 8px 8px; flex-shrink: 0; }
.mirror-form input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: 12px; font-size: 13px; color: #fff; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); outline: none; }
.mirror-form input:focus { border-color: rgba(96,165,250,.5); }
.mirror-form .send-btn { width: 36px; height: 36px; }
html[data-ui-theme-mode="light"] .side-bar { background: rgba(255,255,255,.6); border-bottom-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .side-bar-btn { color: #5a6781; }
html[data-ui-theme-mode="light"] .mirror-head { color: #334155; border-bottom-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .mirror-form input { color: #0f172a; background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.12); }
html[data-ui-theme-mode="light"] #editorArea.is-split > #termPane, html[data-ui-theme-mode="light"] #editorArea.is-split > .side-pane { box-shadow: inset 1px 0 0 rgba(15,23,42,.1), inset 0 1px 0 rgba(15,23,42,.1); }

/* ── New tmux session: choosing the working folder ── */
.fp { display: grid; gap: 8px; margin-top: -4px; }
.fp-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.fp-toggle, .fp-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.fp-toggle { color: #bfdbfe; background: rgba(59,130,246,.15); border: 1px solid rgba(96,165,250,.35); }
.fp-chip { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(255,255,255,.7); background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); }
.fp-panel { border-radius: 12px; border: 1px solid rgba(255,255,255,.1); background: rgba(0,0,0,.2); overflow: hidden; }
.fp-panel.hidden { display: none; }
.fp-head { display: flex; align-items: center; gap: 4px; padding: 6px; border-bottom: 1px solid rgba(255,255,255,.08); }
.fp-btn { width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: rgba(255,255,255,.6); }
.fp-btn.on { background: rgba(255,255,255,.1); color: #fff; }
@media (hover: hover) { .fp-btn:hover { background: rgba(255,255,255,.1); color: #fff; } }
.fp-btn:disabled { opacity: .3; }
.fp-where { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700; }
.fp-search { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.fp-search > .fa-magnifying-glass { font-size: 12px; opacity: .45; }
.sheet-form .fp-search input { flex: 1; min-width: 0; width: auto; height: 32px; margin: 0; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; outline: none; font-size: 16px; color: inherit; }   /* 16px: so iOS does not zoom while typing */
.sheet-form .fp-search input:focus { border: 0; box-shadow: none; }
.fp-search:focus-within { background: rgba(96,165,250,.06); }
.fp-search input::-webkit-search-cancel-button { display: none; }
.fp-search .fp-btn.hidden { display: none; }
.fp-sub { display: block; font-size: 10.5px; font-weight: 500; opacity: .5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-row:has(.fp-sub) { height: 46px; }
html[data-ui-theme-mode="light"] .fp-search { border-color: rgba(15,23,42,.1); }
.fp-list { max-height: min(38vh, 280px); overflow-y: auto; padding: 4px; }
.fp-row { display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 4px 0 10px; border-radius: 9px; cursor: pointer; font-size: 13.5px; font-weight: 600; }
@media (hover: hover) { .fp-row:hover { background: rgba(255,255,255,.06); } }
.fp-row > .fa-folder { color: #7dd3fc; }
.fp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-use { width: 30px; height: 30px; border-radius: 8px; color: #6ee7b7; font-size: 12px; }
@media (hover: hover) { .fp-use:hover { background: rgba(16,185,129,.18); } }
.fp-go { font-size: 10px; opacity: .4; width: 12px; }
.fp-note { padding: 12px; font-size: 12px; opacity: .6; }
.fp-note.error { color: #fca5a5; opacity: 1; }
.fp-pick { width: 100%; height: 38px; font-size: 12.5px; font-weight: 800; color: #6ee7b7; border-top: 1px solid rgba(255,255,255,.08); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 10px; }
@media (hover: hover) { .fp-pick:hover { background: rgba(16,185,129,.1); } }
html[data-ui-theme-mode="light"] .fp-toggle { color: #1d4ed8; background: rgba(37,99,235,.08); }
html[data-ui-theme-mode="light"] .fp-chip { color: #334155; background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.12); }
html[data-ui-theme-mode="light"] .fp-panel { background: rgba(15,23,42,.03); border-color: rgba(15,23,42,.12); }
html[data-ui-theme-mode="light"] .fp-btn { color: #475569; }
@media (hover: hover) { html[data-ui-theme-mode="light"] .fp-row:hover { background: rgba(15,23,42,.05); } }
html[data-ui-theme-mode="light"] .fp-use, html[data-ui-theme-mode="light"] .fp-pick { color: #059669; }

/* Sheet-form labels are display:grid, so tailwind's .hidden has no effect → stated explicitly */
.sheet-form label.hidden, .sheet-form .hidden { display: none !important; }

/* File explorer multi-select */
.ex-body:focus { outline: none; }
.ex-body:focus-visible { box-shadow: inset 0 0 0 1px rgba(96,165,250,.35); border-radius: 8px; }
.ex-body.multi .ex-row.selected { background: rgba(59,130,246,.22); }
.ex-multi { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; font-weight: 800; color: #bfdbfe; background: rgba(59,130,246,.25); }
html[data-ui-theme-mode="light"] .ex-multi { color: #1d4ed8; background: rgba(37,99,235,.12); }
/* Confirmation dialog: marks the button that Enter will press */
.sheet-buttons [data-yes]:focus { outline: 2px solid rgba(255,255,255,.6); outline-offset: 2px; }
html[data-ui-theme-mode="light"] .sheet-buttons [data-yes]:focus { outline-color: rgba(15,23,42,.45); }

/* ── Split-view tmux panel (same look as the main header) ── */
.tp-head { flex-shrink: 0; background: rgba(12,16,28,.6); border-bottom: 1px solid rgba(255,255,255,.08); }
.tp-row1 { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 8px 0 16px; }   /* same height as the main header (h-14) */
.tp-title { font-size: 13.5px; font-weight: 800; color: rgba(255,255,255,.92); }
.tp-sub { font-size: 11px; color: rgba(255,255,255,.42); margin-top: 1px; }
.tp-row2 { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px; min-height: 8px; overflow-x: auto; }
.tp-row2 .usage-mini { margin-right: 0; }
/* A window narrowed by splitting on desktop: less important things shrink first so the reset time is not cut off */
@media (min-width: 1024px) {
  #termModes, .tp-row2 { container-type: inline-size; }
  @container (max-width: 760px) { .um-provider, .um-reset-label { display: none; } .um-bar { width: 44px; } }
  @container (max-width: 520px) { .usage-mini { flex-wrap: wrap; justify-content: flex-end; flex-shrink: 1; min-width: 0; gap: 2px 10px; margin-right: 0; } .um { gap: 4px; flex-shrink: 0; white-space: nowrap; } .um-bar { display: none; } .um-label, .um-reset { font-size: 10px; } .um-val { min-width: 0; font-size: 10.5px; } }
}
.tp-body { position: relative; flex: 1; min-height: 0; }
.tp-log, .tp-screen { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; }
.tp-log.hidden, .tp-screen.hidden { display: none; }
.tp-list { padding: 10px 12px 16px; }
.tp-screen .term-screen { font-size: 12px; }
html[data-ui-theme-mode="light"] .tp-head, html[data-ui-theme-mode="light"] html[data-ui-theme-mode="light"] .tp-title { color: #0f172a; }
html[data-ui-theme-mode="light"] .tp-sub { color: #64748b; }
html[data-ui-theme-mode="light"] 
.tp-composer { flex-shrink: 0; }
.tp-direct-banner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 16px; pointer-events: none; font-size: 12px; font-weight: 700; color: #fcd34d; background: rgba(245,158,11,.12); border: 1px dashed rgba(251,191,36,.45); }
.tp-direct-banner.hidden { display: none; }
[data-tp-direct].active { color: #fcd34d; background: rgba(245,158,11,.15); }

/* Make the second group's tab bar the same height as the main tab bar (40px, including the bottom border) */
.side-bar .ws-tabbar { height: 39px; }

/* Composer buttons · model chip · input all the same height (desktop 42px · phone 44px) */
.composer form .composer-btn, .composer form .send-btn, .composer form .model-chip { height: 42px; }
.composer form .composer-btn, .composer form .send-btn { width: 42px; }
.composer form .prompt-input { min-height: 42px; padding-top: 9px !important; padding-bottom: 9px !important; }
@media (pointer: coarse) {
    .composer form .composer-btn, .composer form .send-btn, .composer form .model-chip { height: 44px; }
    .composer form .composer-btn, .composer form .send-btn { width: 44px; }
    .composer form .prompt-input { min-height: 44px; padding-top: 10px !important; padding-bottom: 10px !important; }
}
.composer form .model-chip { border-radius: 14px; }
/* Quick phrases: small text on the row below, separated from the previous item by · */
.qs-btn::before { content: '·'; margin: 0 6px 0 2px; opacity: .5; }

/* ============================================================================
   Press feedback like an iPhone app (common.js adds .is-pressed / .press-release)
   - Changes in 0ms the moment it is pressed and returns over 200ms on release (the same asymmetry as iOS UIButton)
   - Buttons · chips: dim + shrink slightly / list rows: background darkens (UITableViewCell highlight)
   - Uses the individual scale property instead of transform so existing transforms (translate etc.) are untouched
   ============================================================================ */
button, a, summary, label, .key-chip, [role="button"], .win-item, .ex-row, .wt, .tt-tab, .exv-tab, .fp-row {
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.is-pressed { transition: none !important; opacity: .5; scale: .96; }
.is-pressed:disabled { opacity: .3; scale: none; }
/* Tabs · tab bar · wide things only dim, without shrinking */
:is(.wt, .tt-tab, .exv-tab, .tab-item, .sheet-form button[type="submit"], .w-full).is-pressed { scale: none; }
/* List rows: only the background darkens, without dimming */
:is(.win-item, .ex-row, .ex-root, .sheet-action, .fp-row, .folder-head, .org-item, .git-file-row, .git-repo-item).is-pressed {
    opacity: 1; scale: none; box-shadow: inset 0 0 0 999px rgba(255,255,255,.08);
}
html[data-ui-theme-mode="light"] :is(.win-item, .ex-row, .ex-root, .sheet-action, .fp-row, .folder-head, .org-item, .git-file-row, .git-repo-item).is-pressed {
    box-shadow: inset 0 0 0 999px rgba(15,23,42,.07);
}
.press-release { transition: opacity .2s ease-out, scale .2s cubic-bezier(.2,.9,.3,1.2), box-shadow .25s ease-out, background-color .2s ease-out !important; }
/* Long-running buttons: react immediately on press and cannot be pressed again until done */
.is-busy { opacity: .55; pointer-events: none; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .is-pressed { scale: none; } .press-release { transition: opacity .15s !important; } }

/* Finger-sized hit area: the visible size stays, only the touch area grows by 8px on every side (≈ 44pt) */
@media (pointer: coarse) {
    .wt-close, .tt-close, .exv-tab-close, .hist-btn, .side-bar-btn, .fp-btn, .ws-side-btn, .folder-more, .ex-copy, .ex-more, .msg-ai .copy-btn, .msg-user .copy-btn { position: relative; }
    :is(.wt-close, .tt-close, .exv-tab-close, .hist-btn, .side-bar-btn, .fp-btn, .ws-side-btn, .folder-more, .ex-copy, .ex-more, .attach-remove, .msg-ai .copy-btn, .msg-user .copy-btn)::after {
        content: ''; position: absolute; inset: -8px;
    }
}

/* Page navigation: the previous screen stays until the new page is ready to render (no white flash).
   The animation is 0 — the look is unchanged, only the flash is removed. (Chrome 126+ · Safari 18.2+) */
@view-transition { navigation: auto; }
::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation-duration: 0s; }

/* List-style picker card (/model etc.): clicking only moves the cursor; the button below confirms */
.chat-picker { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; max-height: 320px; overflow-y: auto; overscroll-behavior: contain; }
.chat-status .chat-picker button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px;
    border: 1px solid transparent; background: rgba(148,163,184,.07); color: #e2e8f0; font-size: 13px; font-weight: 600; }
.chat-status .chat-picker button > b { width: 18px; flex-shrink: 0; text-align: right; font-size: 11px; opacity: .5; font-variant-numeric: tabular-nums; }
.chat-picker .cp-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.chat-picker .cp-label { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-picker .cp-label em { font-style: normal; font-size: 10.5px; font-weight: 700; opacity: .55; margin-left: 4px; }
.chat-picker .cp-desc { font-size: 11px; font-weight: 500; opacity: .55; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-status .chat-picker button.on { background: rgba(59,130,246,.16); border-color: rgba(96,165,250,.5); }
.chat-picker button.on > i { color: #60a5fa; font-size: 12px; }
.chat-picker-effort { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; font-size: 12.5px; font-weight: 700; color: #e2e8f0; }
.chat-status .chat-picker-effort button { width: 36px; height: 32px; padding: 0; color: #e2e8f0; background: rgba(148,163,184,.12); border-color: rgba(148,163,184,.25); }
.chat-picker-actions { margin-top: 10px; justify-content: flex-end; }
.chat-status .chat-picker-actions button.primary { color: #fff; background: #3b82f6; border-color: #3b82f6; }
html[data-ui-theme-mode="light"] .chat-status .chat-picker button { background: rgba(15,23,42,.04); color: #1e293b; border-color: transparent; }
html[data-ui-theme-mode="light"] .chat-status .chat-picker-effort button { background: rgba(100,116,139,.1); border-color: rgba(100,116,139,.25); }
html[data-ui-theme-mode="light"] .chat-status .chat-picker button.on { background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.35); }
html[data-ui-theme-mode="light"] .chat-picker-effort, html[data-ui-theme-mode="light"] .chat-status .chat-picker-effort button { color: #1e293b; }

/* Chat math (KaTeX): bubbles keep line breaks as they are (pre-wrap), so whitespace inside math is handled normally */
.msg-body .katex { white-space: normal; font-size: 1.05em; }
.msg-body .katex-display { margin: .4em 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }

/* AI Usage: switching · adding Codex accounts */
.ai-accounts-btn { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 8px; font-size: 11px; font-weight: 700; color: #93c5fd; background: rgba(59,130,246,.12); border: 1px solid rgba(96,165,250,.28); }
html[data-ui-theme-mode="light"] .ai-accounts-btn { color: #1d4ed8; background: rgba(37,99,235,.07); border-color: rgba(37,99,235,.25); }
.ai-account-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.ai-account-actions:empty { display: none; }
.ai-login-alert { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; padding: 10px 12px; border-radius: 12px; font-size: 12.5px; font-weight: 700; color: #fbbf24; background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.35); }
html[data-ui-theme-mode="light"] .ai-login-alert { color: #92400e; background: rgba(245,158,11,.12); }
.ai-login-alert .btn-glow { padding: 6px 12px; font-size: 12px; }
.cx-code-form { display: flex; gap: 6px; margin-top: 6px; }
.cx-code-form input { flex: 1; min-width: 0; font-size: 16px; }
.cx-code-form .btn-glow, .cx-login > .btn-glow { padding: 8px 14px; white-space: nowrap; }
.cx-login > .btn-glow { align-self: flex-start; }
.cx-login { display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.cx-steps { display: flex; flex-direction: column; gap: 14px; padding-left: 18px; list-style: decimal; }
.cx-steps li > span { display: block; margin-bottom: 6px; font-weight: 600; }
.cx-steps small { opacity: .6; font-weight: 500; }
.cx-link { display: inline-flex; align-items: center; gap: 6px; word-break: break-all; color: #60a5fa; text-decoration: underline; }
.cx-code { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 800; letter-spacing: .08em; background: rgba(148,163,184,.12); border: 1px solid rgba(148,163,184,.3); }
.cx-code i { font-size: 13px; opacity: .6; }
.cx-wait { opacity: .7; }
.cx-note { font-size: 11.5px; opacity: .55; }
.cx-done { color: #34d399; font-weight: 700; }
.cx-error { color: #f87171; font-weight: 600; }

/* Git: AI commit message */
.git-ai-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; font-size: 11px; font-weight: 700;
    color: #c4b5fd; background: rgba(139,92,246,.12); border: 1px solid rgba(167,139,250,.3); }
.git-ai-btn:disabled { opacity: .7; cursor: progress; }
.git-ai-gear { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; color: rgba(255,255,255,.45); border: 1px solid rgba(255,255,255,.1); }
@media (hover: hover) { .git-ai-btn:hover { background: rgba(139,92,246,.2); } .git-ai-gear:hover { color: #fff; background: rgba(255,255,255,.06); } }
html[data-ui-theme-mode="light"] .git-ai-btn { color: #6d28d9; background: rgba(124,58,237,.07); border-color: rgba(124,58,237,.25); }
html[data-ui-theme-mode="light"] .git-ai-gear { color: #64748b; border-color: rgba(15,23,42,.12); }
.sheet-form select { width: 100%; }
.git-ai-fallback { display: grid; gap: 10px; margin-top: 4px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.git-ai-fallback-head { display: grid; gap: 2px; font-size: 12px; }
.git-ai-fallback-head span { font-size: 11px; opacity: .6; }
.git-ai-model-row { display: flex; gap: 8px; align-items: stretch; }
.git-ai-model-row select { flex: 1; min-width: 0; }
.git-ai-model-row button { flex: none; padding: 0 12px; white-space: nowrap; }
html[data-ui-theme-mode="light"] .git-ai-fallback { border-top-color: rgba(15,23,42,.1); }

/* Explorer: drag to reorder (manual order) — a line at the drop position */
.ex-row.drop-before { box-shadow: inset 0 2px 0 #3b82f6; }
.ex-row.drop-after { box-shadow: inset 0 -2px 0 #3b82f6; }

/* Path links inside chat answers (click to open the file · folder) */
.path-link, .md-link { color: #93c5fd; text-decoration: underline; text-decoration-color: rgba(147,197,253,.4); text-underline-offset: 2px; cursor: pointer; overflow-wrap: anywhere; }
@media (hover: hover) { .path-link:hover, .md-link:hover { text-decoration-color: currentColor; } }
html[data-ui-theme-mode="light"] .path-link, html[data-ui-theme-mode="light"] .md-link { color: #1d4ed8; text-decoration-color: rgba(29,78,216,.35); }

/* Explorer: the full name shown right over a truncated name */
.ex-name-tip { position: fixed; z-index: 700; transform: translateY(-50%); padding: 3px 4px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    pointer-events: none; color: #f1f5f9; background: #1e293b; border: 1px solid rgba(148,163,184,.35); box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.ex-name-tip[hidden] { display: none; }
html[data-ui-theme-mode="light"] .ex-name-tip { color: #0f172a; background: #fff; border-color: rgba(15,23,42,.18); box-shadow: 0 6px 18px rgba(15,23,42,.15); }

/* Markdown → PDF preview window */
@media (min-width: 640px) { .tdx-sheet.wide { max-width: min(920px, 94vw); } }
.mdpdf { display: flex; flex-direction: column; gap: 10px; padding: 0 20px 4px; }
.mdpdf-bar { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; }
.mdpdf-bar button { width: 34px; height: 30px; border-radius: 9px; background: rgba(148,163,184,.14); border: 1px solid rgba(148,163,184,.25); }
.mdpdf-zoomctl { display: inline-flex; align-items: center; gap: 8px; }
.mdpdf-zoomctl.hidden { display: none; }
.mdpdf-zoomctl + .mdpdf-zoomctl { margin-left: 10px; }
.mdpdf-bar:has(.mdpdf-zoomctl) { flex-wrap: wrap; row-gap: 8px; }
.mdpdf-zoom { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; }
.mdpdf-info { margin-left: auto; font-weight: 600; opacity: .6; }
.mdpdf-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; height: clamp(200px, calc(100dvh - 380px), 760px); overflow: auto; padding: 12px; border-radius: 12px; background: rgba(15,23,42,.55); }
.mdpdf-pages.busy { opacity: .45; }
.mdpdf-pages:empty::after { content: 'PDF 만드는 중…'; margin: auto; opacity: .6; font-size: 13px; }
.mdpdf-page { width: 100%; height: auto; background: #fff; box-shadow: 0 4px 18px rgba(0,0,0,.35); border-radius: 2px; }
.mdpdf-error { margin: auto; color: #f87171; font-size: 13px; }
.mdpdf-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mdpdf-actions button { flex: 1; min-height: 42px; border-radius: 12px; font-size: 13px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.mdpdf-actions button:disabled { opacity: .5; }
.mdpdf-actions small { font-weight: 600; opacity: .75; }
.mdpdf-secondary { background: rgba(148,163,184,.14); border: 1px solid rgba(148,163,184,.25); }
.mdpdf-layout { flex-wrap: wrap; row-gap: 8px; }
.mdpdf-order { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.mdpdf-order.hidden { display: none; }
.mdpdf-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(148,163,184,.14); border: 1px solid rgba(148,163,184,.22); }
.mdpdf-bar .mdpdf-seg button { width: auto; min-width: 42px; height: 28px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; font-size: 12px; font-weight: 800; opacity: .7; display: inline-flex; align-items: center; justify-content: center; }
.mdpdf-bar .mdpdf-seg.icons button { min-width: 0; width: 34px; padding: 0; }
.mdpdf-bar .mdpdf-seg button.on { background: #3b82f6; color: #fff; opacity: 1; }
.mdpdf-bar .mdpdf-seg button:not(.on):hover { opacity: 1; background: rgba(148,163,184,.18); }
.mdpdf-page.landscape { width: 100%; }
/* On narrow screens, when the orientation row takes one more line, the preview shrinks by that much so the save button stays visible */
@media (max-width: 640px) { .mdpdf:has(.mdpdf-order:not(.hidden)) .mdpdf-pages { height: clamp(180px, calc(100dvh - 430px), 760px); } }
html[data-ui-theme-mode="light"] .mdpdf-pages { background: #e2e8f0; }
.sheet-info:has(.mdpdf) { max-height: none; overflow: visible; padding: 0; }

/* ── Settings window: section sidebar on the left · content on the right (horizontal tabs on top on phones) ──────────── */
.ud-settings-overlay { position: fixed; inset: 0; z-index: 480; display: flex; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); background: rgba(5,7,15,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.ud-settings-overlay[hidden] { display: none; }
.ud-settings-modal { position: relative; width: 100%; max-width: 900px; height: min(640px, 100%); display: flex; overflow: hidden; border-radius: 20px; background: rgba(20,25,40,.95); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border: 1px solid rgba(255,255,255,.12); box-shadow: 0 24px 70px rgba(0,0,0,.5); color: #e8e9ee; animation: ud-set-in 160ms ease-out; }
@keyframes ud-set-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .ud-settings-modal { animation: none; } }
.ud-set-nav { width: 240px; flex-shrink: 0; display: flex; flex-direction: column; padding: 18px 12px; background: rgba(255,255,255,.03); border-right: 1px solid rgba(255,255,255,.08); overflow-y: auto; }
.ud-set-nav h3 { margin: 2px 10px 14px; font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 9px; }
.ud-set-nav h3 i { color: #60a5fa; font-size: 15px; }
.ud-set-tabs { display: flex; flex-direction: column; gap: 3px; }
.ud-set-tabs button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 11px; border-radius: 12px; text-align: left; font: inherit; color: inherit; background: none; border: 1px solid transparent; cursor: pointer; opacity: .72; transition: background 120ms, opacity 120ms; }
.ud-set-tabs button > i { width: 30px; height: 30px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 9px; font-size: 13px; background: rgba(255,255,255,.07); }
.ud-set-tabs button span { min-width: 0; display: flex; flex-direction: column; }
.ud-set-tabs button b { font-size: 13px; font-weight: 700; }
.ud-set-tabs button small { margin-top: 1px; font-size: 11px; opacity: .6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ud-set-tabs button.on { opacity: 1; background: rgba(59,130,246,.14); border-color: rgba(96,165,250,.3); }
.ud-set-tabs button.on > i { color: #fff; background: #3b82f6; }
.ud-set-tabs button:focus-visible { outline: 2px solid #60a5fa; outline-offset: 1px; }
@media (hover: hover) { .ud-set-tabs button:not(.on):hover { opacity: 1; background: rgba(255,255,255,.05); } }
.ud-set-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ud-set-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.ud-set-pane-title { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 800; }
.ud-set-pane-title i { color: #60a5fa; font-size: 14px; }
.ud-set-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 22px 22px; }
.ud-set-badge { margin-left: 4px; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; color: #fcd34d; background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.25); }
.ud-set-badge.local { color: #93c5fd; background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.25); }
.ud-set-text .ud-set-badge.local { vertical-align: 1px; white-space: nowrap; display: inline-block; }
/* Signed-in devices */
.ud-dev-row { justify-content: flex-start; gap: 12px; }
.ud-dev-row .ud-set-text { flex: 1; min-width: 0; }
.ud-dev-icon { flex-shrink: 0; width: 22px; text-align: center; font-size: 18px; opacity: .55; }
.ud-dev-ua { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .5; }
.ud-dev-out { color: #fca5a5; }
.ud-dev-out:disabled { opacity: .4; cursor: default; }
.ud-dev-me { margin-bottom: 6px; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(248,113,113,.22); background: rgba(248,113,113,.06); }
.ud-dev-me .ud-dev-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; flex-shrink: 0; }
@media (max-width: 600px) { .ud-dev-me { flex-wrap: wrap; } .ud-dev-me .ud-dev-btns { flex-basis: 100%; justify-content: flex-start; } }
.ud-dev-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding-top: 14px; border-top: 1px dashed rgba(255,255,255,.07); }
@media (max-width: 600px) { .ud-dev-row { flex-wrap: wrap; } .ud-dev-row .ud-dev-out { margin-left: 34px; } }
html[data-ui-theme-mode="light"] .ud-dev-out { color: #dc2626; }
.ud-set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; }
.ud-set-row + .ud-set-row { border-top: 1px dashed rgba(255,255,255,.07); }
.ud-set-col { flex-direction: column; align-items: stretch; gap: 12px; }
.ud-set-text { min-width: 0; flex: 1; }
.ud-set-title { margin: 0; font-size: 13.5px; font-weight: 700; }
.ud-set-desc { margin: 3px 0 0; font-size: 11.5px; line-height: 1.55; opacity: .6; }
.ud-set-desc b { opacity: 1; font-weight: 800; }
.ud-set-note { margin: 16px 0; font-size: 12px; opacity: .6; }
.ud-settings-modal .pmd-mode-switch { flex-shrink: 0; }
.ud-set-btn, .ud-set-seg button, .ud-set-chips button, .ud-set-stepper button { font: inherit; color: inherit; cursor: pointer; }
.ud-set-btn { flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 10px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); }
.ud-set-seg { flex-shrink: 0; display: inline-flex; padding: 3px; border-radius: 11px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.ud-set-seg button { height: 28px; padding: 0 11px; border-radius: 8px; font-size: 12px; font-weight: 700; opacity: .65; background: none; border: 0; white-space: nowrap; }
.ud-set-seg button.on { opacity: 1; background: #3b82f6; color: #fff; }
.ud-set-stepper { flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px; }
.ud-set-stepper button { width: 32px; height: 32px; border-radius: 10px; font-size: 11px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); }
.ud-set-stepper span { min-width: 46px; text-align: center; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ud-set-select, .ud-set-number select { flex-shrink: 0; height: 34px; padding: 0 30px 0 12px; border-radius: 10px; font: inherit; font-size: 13px; font-weight: 700; color: inherit; background: rgba(255,255,255,.06) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right 11px center; border: 1px solid rgba(255,255,255,.12); appearance: none; -webkit-appearance: none; cursor: pointer; }
.ud-set-select option, .ud-set-number option { color: #0f172a; }
.ud-set-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ud-set-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.ud-set-chips button { height: 32px; padding: 0 13px; border-radius: 999px; font-size: 12px; font-weight: 800; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12); }
.ud-set-chips button.on { color: #fff; background: #3b82f6; border-color: #3b82f6; }
.ud-set-number { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ud-set-number input { width: 96px; height: 34px; padding: 0 10px; text-align: right; font: inherit; font-size: 14px; font-weight: 700; color: inherit; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); outline: none; }
.ud-set-number input:focus { border-color: #60a5fa; }
.ud-set-number select { padding-right: 28px; }
@media (hover: hover) {
  .ud-set-btn:hover, .ud-set-stepper button:hover, .ud-set-chips button:not(.on):hover { border-color: rgba(96,165,250,.5); }
  .ud-set-seg button:not(.on):hover { opacity: 1; }
}
/* Phone · narrow screen: the section sidebar becomes horizontal tabs on top */
@media (max-width: 680px) {
  .ud-settings-modal { flex-direction: column; height: 100%; border-radius: 18px; }
  .ud-set-nav { width: auto; padding: 14px 12px 10px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.08); overflow: visible; }
  .ud-set-nav h3 { margin: 0 4px 10px; font-size: 16px; padding-right: 36px; }
  .ud-set-tabs { flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 6px; margin: 0 -12px; padding: 0 12px; }
  .ud-set-tabs::-webkit-scrollbar { display: none; }
  .ud-set-tabs button { width: auto; flex-shrink: 0; padding: 7px 12px 7px 8px; gap: 7px; border-radius: 999px; border-color: rgba(255,255,255,.1); }
  .ud-set-tabs button > i { width: 24px; height: 24px; font-size: 11px; border-radius: 999px; }
  .ud-set-tabs button small { display: none; }
  .ud-set-tabs button b { font-size: 12.5px; white-space: nowrap; }
  .ud-set-pane { min-height: 0; }
  .ud-set-head { padding: 12px 16px 10px; }
  .ud-set-head .pmd-theme-close { position: absolute; top: 14px; right: 16px; }
  .ud-set-body { padding: 0 16px 18px; }
  .ud-set-row { gap: 12px; }
  .ud-set-chips { flex-basis: 100%; }
  .ud-set-row:has(.ud-set-seg) { flex-wrap: wrap; }
  .ud-set-row:has(.ud-set-seg) .ud-set-text { flex-basis: 100%; }
}
html[data-ui-theme-mode="light"] .ud-settings-modal { background: rgba(255,255,255,.97); color: #1e2233; border-color: rgba(15,23,42,.1); box-shadow: 0 24px 70px rgba(30,41,59,.25); }
html[data-ui-theme-mode="light"] .ud-set-nav { background: #f4f6fa; border-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .ud-set-tabs button > i { background: rgba(15,23,42,.06); }
html[data-ui-theme-mode="light"] .ud-set-tabs button.on { background: rgba(37,99,235,.1); border-color: rgba(37,99,235,.25); }
html[data-ui-theme-mode="light"] .ud-set-tabs button.on > i { background: #2563eb; color: #fff; }
@media (max-width: 680px) { html[data-ui-theme-mode="light"] .ud-set-tabs button:not(.on) { border-color: rgba(15,23,42,.1); } }
html[data-ui-theme-mode="light"] .ud-set-head { border-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .ud-set-row + .ud-set-row { border-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .ud-set-badge { color: #b45309; background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); }
html[data-ui-theme-mode="light"] .ud-set-badge.local { color: #1d4ed8; background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.25); }
html[data-ui-theme-mode="light"] :is(.ud-set-btn, .ud-set-seg, .ud-set-stepper button, .ud-set-select, .ud-set-chips button:not(.on), .ud-set-number input, .ud-set-number select) { background-color: rgba(15,23,42,.04); border-color: rgba(15,23,42,.12); }

/* ── Settings: shortcuts (keys.js · like the VS Code keyboard shortcuts window) ── */
.ud-settings-modal.wide { max-width: 1120px; height: min(760px, 100%); }
.ud-keys-top { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 -22px; padding: 14px 22px 12px; background: rgba(20,25,40,.98); border-bottom: 1px solid rgba(255,255,255,.06); }
.ud-keys-search { flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 12px; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); }
.ud-keys-search:focus-within { border-color: #60a5fa; }
.ud-keys-search i { font-size: 12px; opacity: .5; }
.ud-keys-search input { flex: 1; min-width: 0; height: 100%; font: inherit; font-size: 13px; color: inherit; background: none; border: 0; outline: none; }
.ud-keys-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.ud-keys-help { margin: 12px 0 4px; line-height: 1.7; }
.ud-keys-help kbd, .ud-kb kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 6px; font: 600 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; color: inherit; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); border-bottom-width: 2px; white-space: nowrap; }
.ud-kb-then { margin: 0 3px; font-style: normal; opacity: .45; }
.ud-keys-import { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; font-size: 12.5px; line-height: 1.6; background: rgba(59,130,246,.1); border: 1px solid rgba(96,165,250,.3); }
.ud-keys-import p { margin: 0; }
.ud-keys-import div { display: flex; gap: 6px; margin-top: 10px; }
.ud-set-btn.primary { color: #fff; background: #3b82f6; border-color: #3b82f6; }
.ud-keys-scope { display: flex; align-items: center; gap: 8px; margin: 14px 0 2px; padding: 6px 0; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #93c5fd; }
.ud-keys-scope span { padding: 0 6px; border-radius: 999px; font-size: 10px; letter-spacing: 0; color: inherit; background: rgba(59,130,246,.15); }
.ud-keys-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) auto; align-items: center; gap: 12px; min-height: 42px; padding: 5px 8px; margin: 0 -8px; border-radius: 9px; }
.ud-keys-row + .ud-keys-row { border-top: 1px solid rgba(255,255,255,.04); }
.ud-keys-row.recording { background: rgba(59,130,246,.12); box-shadow: inset 0 0 0 1px rgba(96,165,250,.45); }
.ud-keys-name { min-width: 0; display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.ud-keys-name span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ud-keys-name em { flex-shrink: 0; padding: 1px 6px; border-radius: 999px; font-size: 10px; font-style: normal; font-weight: 700; color: #fcd34d; background: rgba(245,158,11,.12); }
.ud-keys-binds { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ud-kb { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 4px; border-radius: 8px; }
.ud-kb button { width: 20px; height: 20px; margin-left: 1px; border-radius: 6px; font-size: 14px; line-height: 1; color: inherit; background: none; border: 0; cursor: pointer; opacity: 0; }
.ud-keys-row:hover .ud-kb button, .ud-kb button:focus-visible { opacity: .55; }
.ud-kb button:hover { opacity: 1; background: rgba(239,68,68,.2); color: #fca5a5; }
.ud-keys-none { opacity: .3; }
.ud-keys-rec { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; width: 100%; }
.ud-keys-rec small { font-size: 11px; opacity: .7; }
.ud-keys-wait { font-size: 12.5px; font-weight: 700; color: #93c5fd; animation: ud-keys-blink 1.2s ease-in-out infinite; }
@keyframes ud-keys-blink { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .ud-keys-wait { animation: none; } }
.ud-keys-rec-btns { display: inline-flex; gap: 6px; margin-left: auto; }
.ud-keys-rec-btns .ud-set-btn { height: 28px; }
.ud-keys-rec-btns .ud-set-btn:disabled { opacity: .4; cursor: default; }
.ud-keys-acts { display: flex; gap: 2px; }
.ud-keys-acts button { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; color: inherit; background: none; border: 0; cursor: pointer; opacity: .45; }
.ud-keys-acts button:hover:not(:disabled), .ud-keys-acts button:focus-visible { opacity: 1; background: rgba(255,255,255,.08); }
.ud-keys-acts button:disabled { opacity: .12; cursor: default; }
@media (hover: none) { .ud-kb button { opacity: .5; } .ud-keys-acts button { opacity: .7; } }
@media (max-width: 680px) {
  .ud-settings-modal.wide { height: 100%; }
  .ud-keys-top { margin: 0 -16px; padding: 10px 16px; }
  .ud-keys-tools { width: 100%; }
  .ud-keys-tools .ud-set-btn { flex: 1; justify-content: center; padding: 0 8px; }
  .ud-keys-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 8px; }
  .ud-keys-name { grid-column: 1; }
  .ud-keys-acts { grid-column: 2; grid-row: 1; }
  .ud-keys-binds { grid-column: 1 / -1; }
}
html[data-ui-theme-mode="light"] .ud-keys-top { background: rgba(255,255,255,.98); }
html[data-ui-theme-mode="light"] .ud-keys-top { border-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .ud-keys-scope { color: #1d4ed8; }
html[data-ui-theme-mode="light"] .ud-keys-search { background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.14); }
html[data-ui-theme-mode="light"] :is(.ud-keys-help kbd, .ud-kb kbd) { background: #f8fafc; border-color: rgba(15,23,42,.2); }
html[data-ui-theme-mode="light"] .ud-keys-row + .ud-keys-row { border-color: rgba(15,23,42,.06); }
html[data-ui-theme-mode="light"] .ud-keys-row.recording { background: rgba(37,99,235,.08); }
html[data-ui-theme-mode="light"] .ud-keys-name em { color: #b45309; }
html[data-ui-theme-mode="light"] .ud-keys-wait { color: #2563eb; }
html[data-ui-theme-mode="light"] .ud-keys-acts button:hover:not(:disabled) { background: rgba(15,23,42,.06); }
html[data-ui-theme-mode="light"] .ud-keys-import { background: rgba(37,99,235,.06); border-color: rgba(37,99,235,.25); }

/* ── Sidebar server status (sysmon.js) ── */
.sysmon { flex-shrink: 0; }
.sysmon .sm-caption { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.35); }
.sysmon .sm-live { display: inline-flex; align-items: center; gap: 5px; letter-spacing: .02em; text-transform: none; font-weight: 600; color: rgba(255,255,255,.32); }
.sysmon .sm-dot { width: 6px; height: 6px; border-radius: 999px; background: #34d399; box-shadow: 0 0 0 0 rgba(52,211,153,.5); animation: sm-pulse 2s ease-out infinite; }
.sysmon.stale .sm-dot { background: #f59e0b; animation: none; }
@keyframes sm-pulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.45); } 70%, 100% { box-shadow: 0 0 0 5px rgba(52,211,153,0); } }
@media (prefers-reduced-motion: reduce) { .sysmon .sm-dot { animation: none; } }
.sysmon .sm-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.sysmon .sm-item { position: relative; overflow: hidden; padding: 8px 10px 8px; border-radius: 12px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.06); }
.sysmon .sm-spark { position: absolute; inset: auto 0 0 0; width: 100%; height: 30px; pointer-events: none; }
.sysmon .sm-spark polygon { fill: rgba(96,165,250,.10); }
.sysmon .sm-spark polyline { fill: none; stroke: rgba(96,165,250,.35); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sysmon .sm-item[data-item^="gpu"] .sm-spark polygon { fill: rgba(167,139,250,.10); }
.sysmon .sm-item[data-item^="gpu"] .sm-spark polyline { stroke: rgba(167,139,250,.4); }
.sysmon .sm-head { position: relative; display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: rgba(255,255,255,.78); min-width: 0; }
.sysmon .sm-head > i { width: 13px; text-align: center; font-size: 10px; color: rgba(255,255,255,.4); }
.sysmon .sm-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sysmon .sm-extra { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 600; color: rgba(255,255,255,.45); }
.sysmon .sm-line { position: relative; display: grid; grid-template-columns: 38px 1fr 34px; align-items: center; gap: 7px; margin-top: 5px; }
.sysmon .sm-name { font-size: 10px; color: rgba(255,255,255,.45); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sysmon .sm-bar { height: 5px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.sysmon .sm-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: #60a5fa; transition: width .5s ease, background-color .3s; }
.sysmon .sm-item[data-item^="gpu"] .sm-bar i { background: #a78bfa; }
.sysmon .sm-item[data-item="mem"] .sm-bar i { background: #34d399; }
.sysmon .sm-item[data-item="disk"] .sm-bar i { background: #94a3b8; }
.sysmon .sm-line[data-level="warn"] .sm-bar i { background: #f59e0b; }
.sysmon .sm-line[data-level="hot"] .sm-bar i { background: #f87171; }
.sysmon .sm-val { text-align: right; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 700; color: rgba(255,255,255,.88); font-variant-numeric: tabular-nums; }
.sysmon .sm-line[data-level="hot"] .sm-val { color: #fca5a5; }
.sysmon .sm-sub { position: relative; margin-top: 5px; font-size: 10px; line-height: 1.35; color: rgba(255,255,255,.4); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sysmon .sm-net { white-space: pre; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: rgba(255,255,255,.6); }
@media (prefers-reduced-motion: reduce) { .sysmon .sm-bar i { transition: none; } }
html[data-ui-theme-mode="light"] .sysmon .sm-caption, html[data-ui-theme-mode="light"] .sysmon .sm-live { color: #77809a; }
html[data-ui-theme-mode="light"] .sysmon .sm-item { background: rgba(255,255,255,.65); border-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .sysmon .sm-head { color: #1f2937; }
html[data-ui-theme-mode="light"] .sysmon .sm-head > i, html[data-ui-theme-mode="light"] .sysmon .sm-extra, html[data-ui-theme-mode="light"] .sysmon .sm-name, html[data-ui-theme-mode="light"] .sysmon .sm-sub { color: #6b7489; }
html[data-ui-theme-mode="light"] .sysmon .sm-net { color: #475569; }
html[data-ui-theme-mode="light"] .sysmon .sm-bar { background: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .sysmon .sm-val { color: #111827; }
html[data-ui-theme-mode="light"] .sysmon .sm-line[data-level="hot"] .sm-val { color: #dc2626; }
html[data-ui-theme-mode="light"] .sysmon .sm-spark polygon { fill: rgba(37,99,235,.07); }
html[data-ui-theme-mode="light"] .sysmon .sm-spark polyline { stroke: rgba(37,99,235,.3); }
html[data-ui-theme-mode="light"] .sysmon .sm-item[data-item^="gpu"] .sm-spark polygon { fill: rgba(124,58,237,.07); }
html[data-ui-theme-mode="light"] .sysmon .sm-item[data-item^="gpu"] .sm-spark polyline { stroke: rgba(124,58,237,.3); }
.sysmon .sm-tools { display: inline-flex; align-items: center; gap: 8px; }
.sysmon .sm-toggle { font: inherit; font-size: 10px; font-weight: 700; letter-spacing: .02em; text-transform: none; color: rgba(255,255,255,.4); background: none; border: 0; padding: 2px 4px; border-radius: 6px; cursor: pointer; }
.sysmon .sm-toggle:hover, .sysmon .sm-toggle:focus-visible { color: rgba(255,255,255,.85); background: rgba(255,255,255,.06); }
.sysmon .sm-compact { margin-top: 8px; padding: 4px 10px 8px; }
.sysmon .sm-compact .sm-line { margin-top: 4px; }
.sysmon .sm-compact .sm-name { font-weight: 700; font-size: 10px; letter-spacing: .02em; }
.sysmon .sm-netline { grid-template-columns: 38px 1fr; }
.sysmon .sm-netline .sm-net { margin-top: 0; text-align: right; }
html[data-ui-theme-mode="light"] .sysmon .sm-toggle { color: #77809a; }
html[data-ui-theme-mode="light"] .sysmon .sm-toggle:hover { color: #1f2937; background: rgba(15,23,42,.06); }
/* Turning off the OVERVIEW number cards (Settings → Sidebar). Server status is attached to the very bottom of the sidebar (above sign out) and stacked from the bottom up */
html.hide-overview #sbOverviewStats { display: none; }
#sidebar #sysMon { max-height: 62vh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
#sidebar #sysMon::-webkit-scrollbar { display: none; }
html.sidebar-collapsed #sidebar #sysMon { display: none !important; }

/* ── A tab opened in a new window (popup, html.ws-solo): only that tab, without the app menu · window list · file sidebar ── */
html.ws-solo #sidebar, html.ws-solo #sidebarOverlay, html.ws-solo main > header, html.ws-solo .tabbar,
html.ws-solo #listPane, html.ws-solo #filePane, html.ws-solo .ws-switch,
html.ws-solo #termBack, html.ws-solo #ptyBack, html.ws-solo #fileView [data-act="back"] { display: none !important; }
html.ws-solo #termPane { display: flex !important; }
html.ws-solo #termEmpty { display: none !important; }
.wt-solo-return { margin-left: auto; flex-shrink: 0; position: sticky; right: 0; display: inline-flex; align-items: center; gap: 6px; height: 26px; margin-top: auto; margin-bottom: auto; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.06); color: rgba(255,255,255,.75); font-size: 11px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.wt-solo-return:hover, .wt-solo-return:focus-visible { background: rgba(59,130,246,.22); border-color: rgba(96,165,250,.45); color: #fff; }
html[data-ui-theme-mode="light"] .wt-solo-return { border-color: rgba(15,23,42,.12); background: rgba(255,255,255,.85); color: #334155; }
html[data-ui-theme-mode="light"] .wt-solo-return:hover { background: rgba(37,99,235,.1); color: #1d4ed8; }
/* Briefly highlights the status line when a file changed elsewhere (by an agent etc.) has been reloaded */
@keyframes exv-meta-flash { 0% { color: #93c5fd; background: rgba(59,130,246,.16); } 100% { color: #64748b; background: transparent; } }
.exv-meta.exv-meta-flash { animation: exv-meta-flash 1.6s ease-out; }
@media (prefers-reduced-motion: reduce) { .exv-meta.exv-meta-flash { animation: none; } }

/* Drop target for a tab dragged in from another window */
body.xtab-over #wsTabs { box-shadow: inset 0 -2px 0 #60a5fa; background-color: rgba(96,165,250,.08); }
#wsTabs .wt.xdrop-before { box-shadow: inset 3px 0 0 #60a5fa; }
#wsTabs .wt.xdrop-after { box-shadow: inset -3px 0 0 #60a5fa; }

/* Previous-session restore notice (above the session list) */
.restore-banner { display: flex; align-items: center; gap: 10px; margin: 4px 4px 10px; padding: 10px 10px 10px 12px; border-radius: 14px; font-size: 12px; color: #fde68a; background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3); }
.restore-banner > i { flex-shrink: 0; font-size: 15px; }
.restore-banner > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.restore-banner b { font-weight: 700; }
.restore-banner span { opacity: .75; overflow-wrap: anywhere; }
.restore-banner button { flex-shrink: 0; height: 30px; padding: 0 12px; border-radius: 9px; font: inherit; font-weight: 700; color: #1f1300; background: #fbbf24; border: 0; cursor: pointer; }
.restore-banner .restore-x { width: 30px; padding: 0; color: inherit; background: transparent; opacity: .7; }
.restore-banner.busy { color: #bfdbfe; background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.3); }
.restore-empty-btn { margin-top: 16px; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 10px; font-size: 12px; font-weight: 700; color: inherit; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); cursor: pointer; }
html[data-ui-theme-mode="light"] .restore-banner { color: #92400e; background: rgba(245,158,11,.1); }
html[data-ui-theme-mode="light"] .restore-banner.busy { color: #1d4ed8; }
html[data-ui-theme-mode="light"] .restore-empty-btn { background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.14); }

/* Domains page */
.dom-head, .dom-row { grid-template-columns: minmax(0, 2.2fr) minmax(90px, .7fr) 70px minmax(0, 1.4fr) 160px; align-items: center; gap: 12px; }
.dom-group { border-bottom: 1px solid rgb(255 255 255 / .06); }
.dom-group:last-child { border-bottom: 0; }
.dom-group.dom-drop { outline: 2px dashed rgb(245 158 11 / .7); outline-offset: -2px; }
.dom-folder-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; background: rgb(255 255 255 / .03); }
.dom-folder-head:hover { background: rgb(255 255 255 / .05); }
.dom-row { display: grid; padding: 10px 16px; cursor: pointer; border-top: 1px solid rgb(255 255 255 / .04); }
.dom-row:hover { background: rgb(255 255 255 / .03); }
.dom-row.dom-dragging { opacity: .4; }
.dom-in-folder .dom-cell-name { padding-left: 18px; }
.dom-cell-name { display: flex; min-width: 0; align-items: center; gap: 8px; }
.dom-cell-actions { display: flex; justify-content: flex-end; gap: 2px; }
.dom-icon { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border-radius: 8px; font-size: 12px; color: rgb(255 255 255 / .45); }
.dom-icon:hover { background: rgb(255 255 255 / .08); color: #fff; }
.dom-icon-danger:hover { background: rgb(239 68 68 / .15); color: #fca5a5; }
.dom-port { display: inline-block; border: 1px solid rgb(34 211 238 / .25); border-radius: 6px; background: rgb(34 211 238 / .08); padding: 2px 6px; font-family: ui-monospace, monospace; font-size: 11px; font-weight: 700; color: #67e8f9; }
.dom-port-small { font-size: 10px; font-weight: 500; padding: 1px 5px; }
.dom-paths { padding: 6px 16px 12px 34px; font-size: 11px; background: rgb(0 0 0 / .12); }
.dom-path-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px 90px; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid rgb(255 255 255 / .05); }
.dom-path-row:first-child { border-top: 0; }
.dom-text-btn { border-radius: 6px; padding: 3px 8px; color: rgb(255 255 255 / .5); }
.dom-text-btn:hover { background: rgb(255 255 255 / .08); color: #fff; }
.dom-text-danger:hover { background: rgb(239 68 68 / .15); color: #fca5a5; }
.dom-empty { padding: 12px 18px; font-size: 11px; font-style: italic; color: rgb(255 255 255 / .3); }
.dom-field { display: block; }
.dom-field > span { display: block; margin-bottom: 4px; font-size: 10px; font-weight: 700; letter-spacing: .05em; color: rgb(255 255 255 / .45); }
.dom-field input, .dom-field select { width: 100%; border-radius: 8px; padding: 8px 12px; font-size: 16px; color: #fff; }
.dom-field small { display: block; margin-top: 4px; font-size: 11px; line-height: 1.4; color: rgb(255 255 255 / .35); }
.dom-readonly { border: 1px solid rgb(255 255 255 / .08); border-radius: 8px; background: rgb(0 0 0 / .2); padding: 8px 12px; font-family: ui-monospace, monospace; font-size: 11px; color: rgb(255 255 255 / .6); }
.dom-modal-actions { display: flex; gap: 8px; padding-top: 6px; }
.dom-modal-actions button { flex: 1; border-radius: 12px; padding: 10px; font-size: 12px; font-weight: 700; color: rgb(255 255 255 / .7); background: rgb(255 255 255 / .07); }
.dom-modal-actions button:hover { background: rgb(255 255 255 / .12); }
.dom-modal-actions .dom-primary { color: #fff; background: #0891b2; }
.dom-modal-actions .dom-primary:hover { background: #06b6d4; }
.dom-modal-actions .dom-danger { color: #fff; background: #dc2626; }
.dom-modal-actions .dom-danger:hover { background: #ef4444; }
.dom-modal-actions button:disabled { opacity: .35; cursor: not-allowed; }
@media (min-width: 768px) { .dom-field input, .dom-field select { font-size: 12px; } }
@media (max-width: 1023.98px) {
  .dom-row { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 12px 14px; }
  .dom-cell-name { width: 100%; order: -1; }
  .dom-in-folder .dom-cell-name { padding-left: 0; }
  .dom-row > [data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: rgb(255 255 255 / .35); }
  .dom-cell-actions { width: 100%; justify-content: flex-start; order: 99; }
  .dom-folder-head { grid-template-columns: minmax(0, 1fr) auto; }
  .dom-folder-head > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .dom-paths { padding-left: 14px; }
  .dom-path-row { grid-template-columns: minmax(0, 1fr) auto; }
  .dom-path-row > :last-child { grid-column: 1 / -1; justify-content: flex-start; }
}
html[data-ui-theme-mode="light"] .dom-group { border-color: rgba(15,23,42,.08); }
html[data-ui-theme-mode="light"] .dom-folder-head { background: rgba(15,23,42,.03); }
html[data-ui-theme-mode="light"] .dom-row { border-color: rgba(15,23,42,.06); }
html[data-ui-theme-mode="light"] .dom-folder-head:hover, html[data-ui-theme-mode="light"] .dom-row:hover { background: rgba(15,23,42,.05); }
html[data-ui-theme-mode="light"] .dom-icon, html[data-ui-theme-mode="light"] .dom-text-btn { color: #5a6781; }
html[data-ui-theme-mode="light"] .dom-icon:hover, html[data-ui-theme-mode="light"] .dom-text-btn:hover { background: rgba(15,23,42,.07); color: #101828; }
html[data-ui-theme-mode="light"] .dom-icon-danger:hover, html[data-ui-theme-mode="light"] .dom-text-danger:hover { background: rgba(239,68,68,.12); color: #dc2626; }
html[data-ui-theme-mode="light"] .dom-port { color: #0e7490; border-color: rgba(8,145,178,.35); background: rgba(8,145,178,.08); }
html[data-ui-theme-mode="light"] .dom-paths { background: rgba(15,23,42,.03); }
html[data-ui-theme-mode="light"] .dom-path-row { border-color: rgba(15,23,42,.07); }
html[data-ui-theme-mode="light"] .dom-empty, html[data-ui-theme-mode="light"] .dom-field small { color: #77809a; }
html[data-ui-theme-mode="light"] .dom-field > span { color: #5a6781; }
html[data-ui-theme-mode="light"] .dom-field input, html[data-ui-theme-mode="light"] .dom-field select { color: #101828; }
html[data-ui-theme-mode="light"] .dom-readonly { color: #47536e; border-color: rgba(15,23,42,.1); background: rgba(15,23,42,.04); }
html[data-ui-theme-mode="light"] .dom-modal-actions button { color: #34405c; background: rgba(15,23,42,.06); }
html[data-ui-theme-mode="light"] .dom-modal-actions button:hover { background: rgba(15,23,42,.1); }
html[data-ui-theme-mode="light"] .dom-modal-actions .dom-primary, html[data-ui-theme-mode="light"] .dom-modal-actions .dom-danger { color: #fff; }
html[data-ui-theme-mode="light"] .dom-modal-actions .dom-primary { background: #0891b2; }
html[data-ui-theme-mode="light"] .dom-modal-actions .dom-danger { background: #dc2626; }

/* Share links */
.share-box { padding: 4px 18px 8px; }
.share-link { display: flex; gap: 8px; flex-wrap: wrap; }
.share-link input { flex: 1 1 220px; min-width: 0; font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(148,163,184,0.25); background: rgba(148,163,184,0.10); color: inherit; }
.share-link button { flex: 0 0 auto; min-height: 42px; padding: 0 16px; border-radius: 12px; font-size: 13px; font-weight: 800; }
.share-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.share-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; border: 1px solid rgba(148,163,184,0.2); }
.share-row button { flex: 0 0 auto; min-height: 34px; padding: 0 14px; border-radius: 10px; font-size: 12px; font-weight: 800; }
.access-code { padding: 12px; border-radius: 12px; border: 1px solid rgba(245,158,11,0.40); background: rgba(245,158,11,0.10); }
.access-code .ac-label { font-size: 12px; font-weight: 800; }
.access-code .ac-label span { font-weight: 600; opacity: .7; }
.access-code .ac-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.access-code .ac-value { flex: 1 1 auto; font: 700 20px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; user-select: all; }
.access-code button { flex: 0 0 auto; min-height: 38px; padding: 0 14px; border-radius: 10px; font-size: 12px; font-weight: 800; }
.share-tag { display: inline-block; font-size: 10px; font-weight: 800; padding: 0 6px; border-radius: 999px; background: rgba(245,158,11,0.16); color: rgb(217,119,6); margin-left: 4px; vertical-align: 1px; }

/* ── AI page: tabs · OpenAI-compatible API management ── */
.ai-tabs button { color: inherit; opacity: .55; }
.ai-tabs button[aria-selected="true"] { opacity: 1; background: rgba(59,130,246,0.22); }
.llm-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; vertical-align: 1px; }
.llm-badge { font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: rgba(148,163,184,0.18); color: inherit; opacity: .8; white-space: nowrap; }
.llm-badge.on { background: rgba(34,197,94,0.18); color: #22c55e; opacity: 1; }
.llm-badge.off { background: rgba(148,163,184,0.18); }
.llm-badge.warn { background: rgba(245,158,11,0.18); color: rgb(217,119,6); opacity: 1; }
.llm-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 10px; font-size: 11px; font-weight: 800; white-space: nowrap; color: inherit; background: rgba(148,163,184,0.14); border: 1px solid rgba(148,163,184,0.22); cursor: pointer; }
.llm-btn:hover { background: rgba(148,163,184,0.24); }
.llm-btn.primary { background: rgba(59,130,246,0.85); border-color: transparent; color: #fff; }
.llm-btn.danger { color: #f87171; }
.llm-btn:disabled { opacity: .5; cursor: default; }
.llm-input { min-height: 34px; padding: 6px 10px; border-radius: 10px; font-size: 13px; color: inherit; background: rgba(148,163,184,0.10); border: 1px solid rgba(148,163,184,0.25); }
textarea.llm-input { font-family: inherit; line-height: 1.5; resize: vertical; }
.llm-out { margin: 0; padding: 10px 12px; border-radius: 10px; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: auto; max-height: 320px; overflow-y: auto; background: rgba(15,23,42,0.55); border: 1px solid rgba(148,163,184,0.18); color: inherit; }
html[data-ui-theme-mode="light"] .llm-out { background: rgba(15,23,42,0.05); }
.llm-out.error { border-color: rgba(248,113,113,0.5); }
#llmExampleTabs button { opacity: .55; color: inherit; }
#llmExampleTabs button.on { opacity: 1; background: rgba(59,130,246,0.22); }
.llm-prov { border: 1px solid rgba(148,163,184,0.18); border-radius: 12px; padding: 12px; }
.llm-prov-head { display: flex; align-items: center; gap: 10px; }
.llm-prov-head b { font-size: 14px; }
.llm-prov-head .grow, .llm-acc .grow, .llm-token .grow { flex: 1 1 auto; min-width: 0; }
.llm-acc { display: flex; align-items: center; gap: 10px; padding: 8px 0 0; margin-top: 8px; border-top: 1px solid rgba(148,163,184,0.12); font-size: 12px; }
.llm-acc .mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.llm-acc small, .llm-token small, .llm-prov small { display: block; font-size: 10.5px; opacity: .6; font-weight: 500; }
.llm-token { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid rgba(148,163,184,0.12); font-size: 12px; }
.llm-token:first-child { border-top: 0; padding-top: 0; }
.llm-token .name { font-size: 13px; font-weight: 800; }
.llm-token code { font-size: 11px; opacity: .75; }
.llm-token.off .grow { opacity: .5; }
.llm-token .acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.llm-set { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed rgba(148,163,184,0.14); }
.llm-set span:last-child { font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.llm-log { width: 100%; border-collapse: collapse; font-size: 11.5px; white-space: nowrap; }
.llm-log th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; opacity: .5; padding: 4px 10px 6px 0; }
.llm-log td { padding: 5px 10px 5px 0; border-top: 1px solid rgba(148,163,184,0.10); }
.llm-log .ok { color: #22c55e; font-weight: 700; }
.llm-log .bad { color: #f87171; font-weight: 700; }
.llm-empty { font-size: 12px; opacity: .55; padding: 6px 0; }
.llm-content { display: grid; gap: 12px; }
.llm-msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.llm-msg-head span { flex: 1 1 auto; opacity: .55; font-size: 11px; }
.llm-msg .llm-out { max-height: 420px; }

/* Text that lives in CSS (pseudo-elements) cannot go through t(): English overrides. */
html[lang="en"] .org-list:empty::after { content: "Drop a window here"; }
html[lang="en"] .mdpdf-pages:empty::after { content: 'Creating PDF…'; }

/* Two-factor enrolment sheet */
.tfa-qr { display: flex; justify-content: center; margin: 4px 0 14px; }
.tfa-qr svg { width: 190px; height: 190px; border-radius: 12px; background: #fff; padding: 6px; }
.tfa-key { display: block; margin: 8px 0; padding: 9px 12px; border-radius: 10px; font: 600 14px/1.5 'JetBrains Mono', ui-monospace, monospace; letter-spacing: .06em; background: rgba(148,163,184,.12); user-select: all; overflow-wrap: anywhere; }
.tfa-links { display: flex; flex-wrap: wrap; gap: 8px; }
.tfa-links a { text-decoration: none; }
.tfa { min-width: 0; padding: 0 20px; }
.tfa ol { margin: 0; padding-left: 18px; display: grid; gap: 14px; font-size: 13.5px; }
.tfa ol li > span:first-child { display: block; font-weight: 600; }
.tfa-key { box-sizing: border-box; max-width: 100%; font-size: 13px; }
.tfa form { display: flex; gap: 8px; margin-top: 8px; }
.tfa form input { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(148,163,184,.3); background: rgba(15,23,42,.55); color: inherit; font: 600 17px 'JetBrains Mono', ui-monospace, monospace; letter-spacing: .22em; }
.tfa form input:focus { outline: none; border-color: #60a5fa; }
.tfa form button { flex-shrink: 0; height: 42px; padding: 0 18px; border-radius: 10px; }
.tfa > p { margin: 14px 0 0; font-size: 12px; line-height: 1.55; opacity: .65; }
html[data-ui-theme-mode="light"] .tfa form input { background: #fff; border-color: rgba(15,23,42,.2); }
