/* ── Manthem UI — style.css (Phase 11) ──────────────────────────── */
/* Design tokens */
:root {
    --bg:          #0D0D0D;
    --surface:     #141414;
    --surface2:    #1A1A1A;
    --surface3:    #222222;
    --border:      #2A2A2A;
    --border2:     #333333;
    --text:        #E8E8E8;
    --text-dim:    #888888;
    --text-muted:  #555555;
    --gold:        #C9A84C;
    --gold-dim:    #8A6E2A;
    --gold-glow:   rgba(201,168,76,0.15);
    --green:       #3FB950;
    --red:         #F85149;
    --orange:      #DB6D28;
    --yellow:      #D29922;
    --sidebar-w:   260px;
    --right-w:     300px;
    --radius:      6px;
    --radius-lg:   10px;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
}

/* ── Scrollbars ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Three-column shell ─────────────────────────────────────────── */
.shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr var(--right-w);
    grid-template-rows: 100vh;
    height: 100vh;
    overflow: hidden;
}

/* ── Left sidebar ───────────────────────────────────────────────── */
.sidebar-left {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar-logo {
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-logo .logo-mark {
    width: 32px; height: 32px;
    background: var(--gold);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: #0D0D0D;
    flex-shrink: 0;
    letter-spacing: -1px;
}
.sidebar-logo .logo-text { flex: 1; min-width: 0; }
.sidebar-logo .logo-title {
    font-size: 14px; font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-logo .logo-sub { font-size: 10px; color: var(--text-dim); margin-top: 1px; }
.sidebar-logo .status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted); flex-shrink: 0; transition: background 0.3s;
}
.sidebar-logo .status-dot.active { background: var(--green); box-shadow: 0 0 6px var(--green); }
.sidebar-logo .status-dot.error  { background: var(--red);   box-shadow: 0 0 6px var(--red); }

.sidebar-section {
    border-bottom: 1px solid var(--border);
    display: flex; flex-direction: column; min-height: 0;
}
.sidebar-section.grow { flex: 1; min-height: 0; }

.section-header {
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 1.2px; color: var(--text-muted);
    padding: 10px 16px 6px; flex-shrink: 0;
    display: flex; align-items: center; gap: 6px;
}
.section-header .badge {
    background: var(--surface3); border: 1px solid var(--border2);
    border-radius: 10px; padding: 1px 6px; font-size: 9px;
    color: var(--text-dim); font-weight: 500; letter-spacing: 0; text-transform: none;
}

.task-list { overflow-y: auto; flex: 1; }
.task-item {
    padding: 8px 16px; cursor: pointer;
    border-left: 2px solid transparent;
    transition: background 0.12s, border-color 0.12s;
}
.task-item:hover { background: var(--surface2); }
.task-item.active { background: var(--surface2); border-left-color: var(--gold); }
.task-item .task-text {
    font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: var(--text); display: flex; align-items: center; gap: 6px;
}
.task-item .task-meta {
    font-size: 10px; color: var(--text-muted); margin-top: 2px;
    font-family: 'JetBrains Mono', monospace;
}
.task-status {
    display: inline-block; width: 6px; height: 6px;
    border-radius: 50%; flex-shrink: 0;
}
.task-status.complete { background: var(--green); }
.task-status.running  { background: var(--yellow); animation: pulse 1s infinite; }
.task-status.failed   { background: var(--red); }
.task-status.pending  { background: var(--text-muted); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.pwa-install-btn {
    margin: 10px 16px; padding: 6px 12px;
    background: var(--gold-glow); border: 1px solid var(--gold-dim);
    border-radius: var(--radius); color: var(--gold);
    font-size: 11px; font-weight: 600; cursor: pointer;
    display: none; width: calc(100% - 32px); text-align: center;
    transition: background 0.15s;
}
.pwa-install-btn:hover { background: rgba(201,168,76,0.25); }

/* ── Center panel ───────────────────────────────────────────────── */
.center-panel {
    display: flex; flex-direction: column;
    overflow: hidden; background: var(--bg);
}

/* ── Mode toggle bar ────────────────────────────────────────────── */
.mode-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 20px 0;
    flex-shrink: 0;
}
.mode-toggle {
    display: flex;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
}
.mode-toggle button {
    background: none; border: none; color: var(--text-muted);
    font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600;
    padding: 5px 14px; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.mode-toggle button.active {
    background: var(--gold); color: #0D0D0D;
}

/* Model selector */
.model-select-wrap {
    flex: 1; display: flex; align-items: center; gap: 6px;
    min-width: 0;
}
.model-select {
    flex: 1; min-width: 0;
    background: var(--surface2); border: 1px solid var(--border2);
    border-radius: var(--radius); color: var(--text);
    font-family: 'Inter', sans-serif; font-size: 11px;
    padding: 5px 10px; outline: none; cursor: pointer;
    transition: border-color 0.2s;
}
.model-select:focus { border-color: var(--gold); }
.model-select option[disabled] { color: var(--text-muted); }
.model-badge {
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.8px; padding: 2px 6px; border-radius: 3px;
    flex-shrink: 0;
}
.model-badge.anthropic { background: rgba(201,168,76,0.15); color: var(--gold); }
.model-badge.openai    { background: rgba(63,185,80,0.12);  color: var(--green); }
.model-badge.google    { background: rgba(66,133,244,0.12); color: #4285F4; }
.model-badge.deepseek  { background: rgba(219,109,40,0.12); color: var(--orange); }
.model-badge.auto      { background: var(--surface3);       color: var(--text-dim); }

/* Input area */
.input-area {
    padding: 10px 20px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0; background: var(--surface);
}
.input-row { display: flex; gap: 8px; align-items: flex-end; }
.input-row textarea {
    flex: 1; background: var(--surface2); border: 1px solid var(--border2);
    border-radius: var(--radius); color: var(--text);
    font-family: 'Inter', sans-serif; font-size: 13px;
    padding: 10px 14px; resize: none; min-height: 42px; max-height: 120px;
    outline: none; transition: border-color 0.2s, box-shadow 0.2s; line-height: 1.5;
}
.input-row textarea:focus {
    border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-glow);
}
.input-row textarea::placeholder { color: var(--text-muted); }

.btn-icon {
    background: var(--surface2); color: var(--text-dim);
    border: 1px solid var(--border2); border-radius: var(--radius);
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 16px; flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-icon:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }
.btn-icon.recording { background: var(--red); color: #fff; border-color: var(--red); animation: pulse 0.8s infinite; }
.btn-icon.hidden { display: none; }

.btn-run {
    background: var(--gold); color: #0D0D0D; border: none;
    border-radius: var(--radius); padding: 0 20px; height: 42px;
    font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 700;
    cursor: pointer; flex-shrink: 0; transition: opacity 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}
.steps-select {
    background: var(--surface2); border: 1px solid var(--border2);
    border-radius: var(--radius); color: var(--text);
    font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600;
    height: 42px; padding: 0 8px; outline: none; cursor: pointer;
    flex-shrink: 0; transition: border-color 0.2s;
}
.steps-select:hover  { border-color: var(--gold-dim); }
.steps-select:focus  { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-glow); }
.chat-mode .steps-select { display: none; }
.btn-run:hover { opacity: 0.88; box-shadow: 0 0 12px var(--gold-glow); }
.btn-run:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }

/* New conversation button (chat mode) */
.btn-new-chat {
    background: var(--surface2); color: var(--text-dim);
    border: 1px solid var(--border2); border-radius: var(--radius);
    padding: 0 14px; height: 42px;
    font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600;
    cursor: pointer; flex-shrink: 0; transition: background 0.15s, color 0.15s;
    white-space: nowrap; display: none;
}
.btn-new-chat:hover { background: var(--surface3); color: var(--text); }
.chat-mode .btn-new-chat { display: flex; align-items: center; }
.chat-mode .btn-run { display: none; }

/* Interrupt row */
.interrupt-row {
    display: none; gap: 8px; margin-top: 8px; padding: 8px 12px;
    background: rgba(219,109,40,0.07); border: 1px solid rgba(219,109,40,0.4);
    border-radius: var(--radius); align-items: center;
}
.interrupt-row.visible { display: flex; }
.interrupt-label { font-size: 10px; font-weight: 700; color: var(--orange); white-space: nowrap; letter-spacing: 0.5px; }
.interrupt-row input {
    flex: 1; background: var(--surface2); border: 1px solid var(--border2);
    border-radius: 4px; color: var(--text); font-family: 'Inter', sans-serif;
    font-size: 12px; padding: 5px 10px; outline: none;
}
.interrupt-row input:focus { border-color: var(--orange); }
.interrupt-row button {
    background: var(--orange); color: #fff; border: none; border-radius: 4px;
    padding: 5px 14px; font-family: 'Inter', sans-serif; font-size: 12px;
    font-weight: 600; cursor: pointer; white-space: nowrap;
}
.interrupt-row button:hover { opacity: 0.85; }

/* Thinking panel */
.thinking-panel {
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 8px 20px; font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-dim); font-style: italic;
    min-height: 34px; max-height: 90px; overflow-y: auto;
    white-space: pre-wrap; word-break: break-word;
    display: none; flex-shrink: 0; transition: max-height 0.3s ease;
}
.thinking-panel.active { display: block; }
.thinking-panel.rendered { max-height: 200px; white-space: normal; }
.thinking-label {
    font-size: 9px; text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--gold); margin-bottom: 3px; font-style: normal; font-weight: 600;
}
.thinking-cursor {
    display: inline-block; width: 5px; height: 10px; background: var(--gold);
    animation: blink 0.8s step-end infinite; vertical-align: text-bottom; margin-left: 1px;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Step log */
.log-area { flex: 1; overflow-y: auto; padding: 16px 20px; }

.empty-state { text-align: center; color: var(--text-muted); padding: 60px 20px; }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 14px; opacity: 0.4; }
.empty-state .empty-text { font-size: 13px; color: var(--text-dim); }
.empty-state .empty-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.step-entry {
    margin-bottom: 14px; border-left: 2px solid var(--border2);
    padding-left: 14px; transition: border-color 0.2s;
}
.step-entry.error         { border-left-color: var(--red); }
.step-entry.complete-step { border-left-color: var(--green); }
.step-entry.replan-entry  { border-left-color: var(--gold); }

.step-header { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.step-number {
    font-size: 10px; font-family: 'JetBrains Mono', monospace;
    background: var(--surface2); padding: 1px 6px; border-radius: 3px; color: var(--text-muted);
}
.step-tool { font-size: 12px; font-weight: 600; color: var(--gold); font-family: 'JetBrains Mono', monospace; }
.step-time { font-size: 10px; color: var(--text-muted); margin-left: auto; font-family: 'JetBrains Mono', monospace; }
.step-thinking { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; font-style: italic; }
.step-input {
    font-size: 11px; font-family: 'JetBrains Mono', monospace;
    background: var(--surface2); padding: 7px 10px; border-radius: 4px;
    margin-bottom: 4px; max-height: 110px; overflow-y: auto;
    white-space: pre-wrap; word-break: break-all; color: var(--text-dim);
}
.step-result {
    font-size: 11px; font-family: 'JetBrains Mono', monospace;
    background: var(--surface); border: 1px solid var(--border);
    padding: 7px 10px; border-radius: 4px;
    max-height: 300px; overflow-y: auto;
    white-space: pre-wrap; word-break: break-all;
}
.step-result:has(.md-render) { white-space: normal; word-break: normal; font-family: 'Inter', sans-serif; }
.step-result.error-result { border-color: var(--red); color: var(--red); }

/* Subtask panel */
.subtask-panel {
    background: var(--surface2); border: 1px solid var(--border2);
    border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; font-size: 11px;
}
.subtask-panel .subtask-header { color: var(--gold); font-weight: 600; margin-bottom: 6px; }
.subtask-panel .subtask-item { color: var(--text-dim); padding: 2px 0; padding-left: 12px; font-family: 'JetBrains Mono', monospace; }
.subtask-panel .subtask-item::before { content: "└─ "; }

/* Approval panel */
.approval-panel {
    background: var(--surface2); border: 1px solid var(--yellow);
    border-radius: var(--radius); padding: 12px 16px; margin-bottom: 12px;
}
.approval-panel .approval-header { color: var(--yellow); font-weight: 600; margin-bottom: 6px; font-size: 12px; }
.approval-panel .approval-desc { font-size: 11px; margin-bottom: 10px; }
.approval-panel .approval-btns { display: flex; gap: 8px; }
.approval-panel .approval-btns button {
    font-size: 11px; padding: 5px 16px; border-radius: 4px; border: none;
    cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 600;
}
.approval-panel .btn-approve { background: var(--green); color: #000; }
.approval-panel .btn-deny    { background: var(--red);   color: #fff; }

/* ── Chat mode UI ───────────────────────────────────────────────── */
.chat-area { flex: 1; overflow-y: auto; padding: 16px 20px; display: none; flex-direction: column; gap: 12px; }
.chat-area.active { display: flex; }
.log-area.chat-hidden { display: none; }

.chat-bubble-wrap {
    display: flex; align-items: flex-start; gap: 10px;
}
.chat-bubble-wrap.user { flex-direction: row-reverse; }

.chat-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--gold); color: #0D0D0D;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0; margin-top: 2px;
}
.chat-avatar.user-av { background: var(--surface3); color: var(--text-dim); }

.chat-bubble {
    max-width: 80%; padding: 10px 14px;
    border-radius: var(--radius-lg); font-size: 12px; line-height: 1.6;
    position: relative;
}
.chat-bubble.user-bubble {
    background: var(--surface3); color: var(--text);
    border-bottom-right-radius: 3px;
}
.chat-bubble.agent-bubble {
    background: var(--surface2); color: var(--text);
    border-bottom-left-radius: 3px;
    border: 1px solid var(--border2);
}
.chat-bubble.thinking-bubble {
    background: var(--surface); color: var(--text-dim);
    border: 1px dashed var(--border2); font-style: italic; font-size: 11px;
}

/* Tool use block inside chat bubble */
.chat-tool-block {
    margin-top: 8px; border-top: 1px solid var(--border);
    padding-top: 6px;
}
.chat-tool-summary {
    display: flex; align-items: center; gap: 6px;
    font-size: 10px; color: var(--text-muted); cursor: pointer;
}
.chat-tool-summary:hover { color: var(--text-dim); }
.chat-tool-name { color: var(--gold); font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.chat-tool-detail {
    display: none; margin-top: 6px; padding: 6px 8px;
    background: var(--surface); border-radius: 4px;
    font-size: 10px; font-family: 'JetBrains Mono', monospace;
    color: var(--text-dim); white-space: pre-wrap; max-height: 120px; overflow-y: auto;
}
.chat-tool-detail.open { display: block; }

.chat-time { font-size: 9px; color: var(--text-muted); margin-top: 4px; text-align: right; }

/* ── Right sidebar ──────────────────────────────────────────────── */
.sidebar-right {
    background: var(--surface); border-left: 1px solid var(--border);
    display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-right .sidebar-section { border-bottom: 1px solid var(--border); }
.sidebar-right .sidebar-section.grow {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
}

/* Plan checklist */
.plan-panel { overflow-y: auto; padding: 0 14px 12px; flex: 1; }
.plan-progress { height: 2px; background: var(--border2); border-radius: 2px; margin: 8px 0 6px; }
.plan-progress-bar { height: 100%; background: var(--gold); border-radius: 2px; transition: width 0.4s ease; }
.plan-counter { font-size: 10px; font-family: 'JetBrains Mono', monospace; color: var(--text-muted); margin-bottom: 8px; }
.plan-step { font-size: 11px; padding: 4px 0; display: flex; align-items: flex-start; gap: 7px; line-height: 1.4; }
.plan-step .marker { flex-shrink: 0; width: 14px; text-align: center; margin-top: 1px; }
.plan-step.done    { color: var(--green); }
.plan-step.done    .marker::before { content: "✓"; }
.plan-step.pending { color: var(--text-dim); }
.plan-step.pending .marker::before { content: "○"; }
.plan-step.skipped { color: var(--text-muted); text-decoration: line-through; }
.plan-step.skipped .marker::before { content: "—"; }

/* Replan history */
.replan-list { overflow-y: auto; padding: 0 14px 8px; max-height: 140px; }
.replan-item { font-size: 10px; font-family: 'JetBrains Mono', monospace; color: var(--text-dim); padding: 4px 0; border-bottom: 1px solid var(--border); }
.replan-item:last-child { border-bottom: none; }
.replan-item .replan-reason { color: var(--gold); font-weight: 500; }

/* File browser */
.file-path {
    font-size: 11px; font-family: 'JetBrains Mono', monospace; color: var(--text-dim);
    padding: 6px 14px; display: flex; align-items: center; gap: 3px; flex-wrap: wrap; flex-shrink: 0;
}
.file-path a { color: var(--gold); cursor: pointer; text-decoration: none; }
.file-path a:hover { text-decoration: underline; }
.file-browser { overflow-y: auto; flex: 1; padding: 0 8px 8px; }
.file-entry {
    display: flex; align-items: center; padding: 4px 8px;
    font-size: 11px; border-radius: 4px; cursor: pointer; gap: 7px; transition: background 0.12s;
}
.file-entry:hover { background: var(--surface2); }
.file-icon { font-size: 13px; flex-shrink: 0; }
.file-name {
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}
.file-size { font-size: 10px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.file-actions { display: flex; gap: 3px; }
.file-actions a {
    font-size: 10px; color: var(--gold); text-decoration: none;
    padding: 1px 6px; border-radius: 3px; background: var(--surface2);
}
.file-actions a:hover { background: var(--surface3); }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.75); z-index: 200;
    align-items: center; justify-content: center;
}
.modal-overlay.visible { display: flex; }
.modal {
    background: var(--surface); border: 1px solid var(--border2);
    border-radius: var(--radius-lg); width: 82%; max-width: 860px; max-height: 88vh;
    display: flex; flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.modal-header {
    display: flex; align-items: center; padding: 12px 16px;
    border-bottom: 1px solid var(--border); gap: 8px;
}
.modal-header h3 { font-size: 13px; flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-close {
    background: none; border: none; color: var(--text-dim);
    font-size: 20px; cursor: pointer; line-height: 1; flex-shrink: 0;
}
.modal-close:hover { color: var(--text); }
.modal-body {
    flex: 1; overflow-y: auto; padding: 16px;
    font-size: 12px; font-family: 'JetBrains Mono', monospace;
    white-space: pre-wrap; word-break: break-all;
}
/* Modal body overrides for rich preview types */
.modal-body.md-preview { font-family: 'Inter', sans-serif; white-space: normal; word-break: normal; }
.modal-body.img-preview { display: flex; align-items: center; justify-content: center; background: #000; }
.modal-body.img-preview img { max-width: 100%; max-height: 70vh; object-fit: contain; }
.modal-body.csv-preview { white-space: normal; word-break: normal; }
.modal-body.csv-preview table { width: 100%; border-collapse: collapse; font-size: 11px; }
.modal-body.csv-preview th { background: var(--gold-glow); color: var(--gold); font-weight: 700; padding: 5px 10px; border: 1px solid var(--gold-dim); }
.modal-body.csv-preview td { padding: 4px 10px; border: 1px solid var(--border2); }
.modal-body.csv-preview tr:nth-child(even) td { background: var(--surface2); }

/* Edit mode in modal */
.modal-edit-area {
    flex: 1; width: 100%; background: var(--surface2); border: none;
    color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 12px;
    padding: 16px; resize: none; outline: none; line-height: 1.6;
}
.modal-footer {
    display: flex; gap: 8px; padding: 10px 16px;
    border-top: 1px solid var(--border); flex-shrink: 0;
}
.modal-footer button {
    padding: 6px 16px; border-radius: var(--radius); border: none;
    font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600; cursor: pointer;
}
.btn-edit-file  { background: var(--surface3); color: var(--text); border: 1px solid var(--border2) !important; }
.btn-save-file  { background: var(--gold); color: #0D0D0D; }
.btn-cancel-edit { background: var(--surface2); color: var(--text-dim); border: 1px solid var(--border2) !important; }
.btn-edit-file:hover  { background: var(--surface2); }
.btn-save-file:hover  { opacity: 0.88; }
.btn-cancel-edit:hover { color: var(--text); }

/* PDF preview */
.pdf-preview-wrap {
    display: flex; flex-direction: column; align-items: center;
    gap: 12px; padding: 20px;
}
.pdf-info { font-size: 12px; color: var(--text-dim); text-align: center; }
.btn-download-pdf {
    padding: 8px 20px; background: var(--gold); color: #0D0D0D;
    border: none; border-radius: var(--radius); font-family: 'Inter', sans-serif;
    font-size: 12px; font-weight: 700; cursor: pointer; text-decoration: none;
    display: inline-block;
}
.btn-download-pdf:hover { opacity: 0.88; }

/* ── highlight.js overrides (atom-one-dark base) ────────────────── */
.hljs { background: var(--surface2) !important; border-radius: 4px; padding: 10px 12px !important; }
.md-render pre .hljs { border-left: 3px solid var(--gold-dim); border-radius: 0 4px 4px 0; }
.step-input .hljs, .step-result .hljs { font-size: 11px !important; }

/* ── Toast ──────────────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 28px; right: 28px;
    background: var(--surface2); border: 1px solid var(--border2);
    border-radius: var(--radius); padding: 10px 16px;
    font-size: 12px; color: var(--text); z-index: 300;
    opacity: 0; transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none; max-width: 340px;
}
.toast.visible  { opacity: 1; transform: translateY(0); }
.toast.success  { border-color: var(--green); color: var(--green); }
.toast.info     { border-color: var(--gold);  color: var(--gold); }
.toast.error    { border-color: var(--red);   color: var(--red); }

/* ── Reconnect banner ───────────────────────────────────────────── */
.reconnect-banner {
    display: none; position: fixed; top: 0; left: 0; right: 0;
    background: var(--orange); color: #fff; text-align: center;
    padding: 6px 16px; font-size: 12px; font-weight: 600;
    font-family: 'Inter', sans-serif; z-index: 400;
}
.reconnect-banner.visible { display: block; }

/* ── Mobile bottom nav ──────────────────────────────────────────── */
.bottom-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    height: 56px; background: var(--surface); border-top: 1px solid var(--border);
    z-index: 100; flex-direction: row;
}
.bottom-nav button {
    flex: 1; background: none; border: none; color: var(--text-muted);
    font-size: 9px; font-family: 'Inter', sans-serif; font-weight: 500;
    cursor: pointer; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px; transition: color 0.15s;
}
.bottom-nav button .nav-icon { font-size: 17px; }
.bottom-nav button.active { color: var(--gold); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .shell { display: block; height: 100vh; overflow: hidden; }
    .sidebar-left  { display: none; }
    .sidebar-right { display: none; }
    .center-panel  { height: calc(100vh - 56px); display: flex; flex-direction: column; }
    .bottom-nav { display: flex; }
    .toast { bottom: 68px; right: 16px; }
    .mobile-panel { display: none; flex: 1; overflow-y: auto; padding: 12px 16px; }
    .mobile-panel.active { display: block; }
    .log-area.mobile-panel.active { display: flex; flex-direction: column; }
    .chat-area.mobile-panel.active { display: flex; }
    .mode-bar { padding: 6px 12px 0; }
}
@media (min-width: 769px) {
    .mobile-panel { display: contents; }
}

/* ── Markdown rendered output ───────────────────────────────────── */
.md-render {
    font-size: 12px; line-height: 1.65; color: var(--text); font-family: 'Inter', sans-serif;
}
.md-render h1, .md-render h2, .md-render h3,
.md-render h4, .md-render h5, .md-render h6 {
    color: var(--gold); font-family: 'Inter', sans-serif; font-weight: 700;
    margin: 10px 0 4px; line-height: 1.3;
}
.md-render h1 { font-size: 15px; }
.md-render h2 { font-size: 13px; }
.md-render h3 { font-size: 12px; }
.md-render h4, .md-render h5, .md-render h6 { font-size: 11px; }
.md-render p  { margin: 4px 0 8px; }
.md-render ul, .md-render ol { margin: 4px 0 8px; padding-left: 20px; }
.md-render li { margin: 2px 0; }
.md-render strong { color: var(--text); font-weight: 700; }
.md-render em    { color: var(--text-dim); font-style: italic; }
.md-render a     { color: var(--gold); text-decoration: underline; }
.md-render a:hover { opacity: 0.8; }
.md-render hr { border: none; border-top: 1px solid var(--border2); margin: 10px 0; }
.md-render code {
    font-family: 'JetBrains Mono', monospace; font-size: 11px;
    background: var(--surface3); color: var(--gold); padding: 1px 5px; border-radius: 3px;
}
.md-render pre {
    background: var(--surface2); border-left: 3px solid var(--gold-dim);
    border-radius: 0 4px 4px 0; padding: 10px 12px; margin: 6px 0 10px;
    overflow-x: auto; max-height: 260px;
}
.md-render pre code { background: none; color: var(--text); padding: 0; font-size: 11px; }
.md-render blockquote {
    border-left: 3px solid var(--gold-dim); margin: 6px 0; padding: 4px 12px;
    color: var(--text-dim); font-style: italic;
}
.md-render table { width: 100%; border-collapse: collapse; font-size: 11px; margin: 8px 0; }
.md-render th {
    background: var(--gold-glow); color: var(--gold); font-weight: 700;
    padding: 5px 10px; border: 1px solid var(--gold-dim); text-align: left;
}
.md-render td { padding: 4px 10px; border: 1px solid var(--border2); color: var(--text); }
.md-render tr:nth-child(even) td { background: var(--surface2); }

/* Thinking panel markdown — dimmer */
.thinking-panel .md-render { color: var(--text-dim); font-style: normal; font-size: 11px; }
.thinking-panel .md-render h1,
.thinking-panel .md-render h2,
.thinking-panel .md-render h3 { font-size: 11px; color: var(--gold-dim); }
