/* styles.css — Supervisor Agent prototype */

:root {
  --bg: #0c0d10;
  --bg-elev: #14161a;
  --bg-card: #181a1f;
  --bg-input: #1c1f25;
  --line: #23272e;
  --line-strong: #2d3239;
  --fg: #e7e6e3;
  --fg-mute: #9aa0a8;
  --fg-dim: #6b7079;
  --accent: oklch(0.78 0.14 86);   /* warm amber */
  --accent-dim: oklch(0.78 0.14 86 / 0.18);
  --good: oklch(0.78 0.14 155);
  --bad: oklch(0.7 0.18 25);
  --info: oklch(0.78 0.1 235);
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", system-ui, sans-serif;

  /* density */
  --pad: 14px;
  --gap: 12px;
  --row-h: 36px;
  --fs-body: 13.5px;
  --fs-small: 12px;
}

[data-density="compact"] {
  --pad: 9px;
  --gap: 8px;
  --row-h: 28px;
  --fs-body: 12.5px;
  --fs-small: 11px;
}

[data-theme="light"] {
  --bg: #f7f6f2;
  --bg-elev: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --line: #e7e3da;
  --line-strong: #d6d1c4;
  --fg: #1c1b18;
  --fg-mute: #5f5d56;
  --fg-dim: #8b887f;
  --accent: oklch(0.55 0.15 60);
  --accent-dim: oklch(0.55 0.15 60 / 0.12);
}

[data-theme="console"] {
  --bg: #050608;
  --bg-elev: #0a0c0f;
  --bg-card: #0b0e12;
  --bg-input: #0f1318;
  --line: #1c2026;
  --line-strong: #262c33;
  --fg: #c9f0d8;
  --fg-mute: #6da084;
  --fg-dim: #4a6f5a;
  --accent: oklch(0.85 0.18 145);
  --accent-dim: oklch(0.85 0.18 145 / 0.15);
  --sans: var(--mono);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg); }
body {
  font-family: var(--sans);
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font-family: inherit; }

/* ── Layout ──────────────────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: 320px 1fr 380px;
  grid-template-rows: 48px 1fr;
  grid-template-areas:
    "topbar topbar topbar"
    "sidebar main activity";
  height: 100vh;
  width: 100vw;
}

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-dim);
}
.brand-name { font-size: 13.5px; }
.brand-sub { color: var(--fg-dim); font-size: 11.5px; margin-left: 4px; font-weight: 400; }

.topbar-status {
  display: flex; align-items: center; gap: 14px;
  font-size: var(--fs-small);
  color: var(--fg-mute);
  font-family: var(--mono);
}
.topbar-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.topbar-status .dot.idle { background: var(--fg-dim); }
.topbar-status .dot.running { background: var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:.35 } }

.sidebar {
  grid-area: sidebar;
  border-right: 1px solid var(--line);
  background: var(--bg-elev);
  display: flex; flex-direction: column;
  min-height: 0;
}
.main {
  grid-area: main;
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--bg);
}
.activity {
  grid-area: activity;
  border-left: 1px solid var(--line);
  background: var(--bg-elev);
  display: flex; flex-direction: column;
  min-height: 0;
}

/* ── Section headers (used everywhere) ───────────────────────────────────── */

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--pad);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
}
.section-head .label { display: flex; align-items: center; gap: 8px; }
.section-head .count { color: var(--fg-mute); font-variant-numeric: tabular-nums; }

/* ── Sidebar: folder ─────────────────────────────────────────────────────── */

.folder-path {
  padding: 10px var(--pad);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-path .seg { color: var(--fg); }

.file-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 6px;
}
.file-list-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--fg-dim);
  font-size: var(--fs-small);
}

.file-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: default;
  position: relative;
}
.file-row:hover { background: var(--bg-card); }
.file-row[data-selected="1"] { background: var(--accent-dim); }
.file-row[data-selected="1"]::before {
  content: ''; position: absolute; left: 2px; top: 8px; bottom: 8px;
  width: 2px; background: var(--accent); border-radius: 1px;
}

.file-icon {
  width: 26px; height: 30px; border-radius: 3px;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  display: flex; align-items: flex-end; justify-content: center;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  color: var(--fg-mute);
  padding-bottom: 3px;
  position: relative;
  flex-shrink: 0;
}
.file-icon::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 7px; height: 7px;
  background: var(--bg);
  border-left: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}
.file-icon[data-ext="pdf"] { color: oklch(0.7 0.18 25); }
.file-icon[data-ext="docx"] { color: oklch(0.72 0.13 235); }

.file-meta { min-width: 0; }
.file-name {
  font-size: var(--fs-body);
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-name .summary-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  margin-left: 6px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
}
.file-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-dim);
  margin-top: 1px;
}
.file-action {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-dim);
  opacity: 0;
  transition: opacity 0.1s;
}
.file-row:hover .file-action { opacity: 1; }

/* ── Sidebar: scheduler ──────────────────────────────────────────────────── */

.scheduler {
  border-top: 1px solid var(--line);
  padding: var(--pad);
  background: var(--bg-elev);
}
.sched-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.sched-title {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
}
.sched-toggle {
  display: flex; align-items: center; gap: 8px;
  cursor: default;
}
.toggle-pill {
  width: 28px; height: 16px; border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  transition: background 0.15s;
}
.toggle-pill[data-on="1"] { background: var(--accent); }
.toggle-pill::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.toggle-pill[data-on="1"]::after { transform: translateX(12px); }
.sched-toggle-label { font-size: var(--fs-small); color: var(--fg-mute); }

.sched-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sched-row label { font-size: var(--fs-small); color: var(--fg-mute); flex: 0 0 70px; }

.sched-select, .sched-input {
  flex: 1;
  height: 30px;
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--fg);
  padding: 0 10px;
  font-family: inherit;
  font-size: var(--fs-small);
  outline: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-dim) 50%),
                    linear-gradient(135deg, var(--fg-dim) 50%, transparent 50%);
  background-position: calc(100% - 14px) 13px, calc(100% - 9px) 13px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.sched-input { background-image: none; padding-right: 10px; }
.sched-select:focus, .sched-input:focus { border-color: var(--accent); }

.sched-status {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sched-status .next-label { color: var(--fg-dim); }
.sched-status .next-value { color: var(--accent); font-variant-numeric: tabular-nums; }
.sched-status[data-disabled="1"] .next-value { color: var(--fg-dim); }

.sched-run-now {
  margin-top: 10px;
  width: 100%;
  height: 32px;
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  color: var(--fg);
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 11px;
  cursor: default;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sched-run-now:hover { border-color: var(--accent); color: var(--accent); }
.sched-run-now:disabled { opacity: 0.4; }

/* ── Main: hero input ────────────────────────────────────────────────────── */

.hero {
  flex: 0 0 auto;
  padding: 32px 48px 20px;
  border-bottom: 1px solid var(--line);
}
[data-density="compact"] .hero { padding: 18px 32px 14px; }

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 8px;
}
.hero-title {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--fg);
}
[data-density="compact"] .hero-title { font-size: 20px; margin-bottom: 10px; }

.topic-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.topic-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.topic-input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--fg);
  padding: 14px 16px;
  font-family: inherit;
  font-size: 15px;
  outline: none;
}
.topic-input::placeholder { color: var(--fg-dim); }
.topic-submit {
  margin: 6px;
  height: 36px;
  padding: 0 16px;
  background: var(--accent);
  color: #1c1b18;
  border: 0;
  border-radius: 7px;
  font-weight: 600;
  font-size: 13px;
  cursor: default;
  font-family: inherit;
  display: flex; align-items: center; gap: 6px;
}
.topic-submit:disabled { opacity: 0.5; }
.topic-submit:hover:not(:disabled) { filter: brightness(1.05); }

.suggestions {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 14px;
}
.suggestion-chip {
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--fg-mute);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--mono);
  cursor: default;
}
.suggestion-chip:hover { border-color: var(--accent); color: var(--accent); }

/* ── Main: live run + preview ────────────────────────────────────────────── */

.main-content {
  flex: 1;
  overflow: auto;
  padding: 20px 48px 32px;
  min-height: 0;
}
[data-density="compact"] .main-content { padding: 14px 32px 20px; }

.run-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
}
.run-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.run-card-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
}
.run-card-title .spinner {
  width: 12px; height: 12px;
  border: 1.5px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.run-card-title .check {
  width: 14px; height: 14px;
  background: var(--good);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #0a0c0f; font-size: 9px; font-weight: 700;
}
.run-card-title .x {
  width: 14px; height: 14px;
  background: var(--bad);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 9px; font-weight: 700;
}
@keyframes spin { to { transform: rotate(360deg); } }

.run-card-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
}
.run-card-cancel {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--fg-mute);
  padding: 4px 10px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  cursor: default;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.run-card-cancel:hover { border-color: var(--bad); color: var(--bad); }

.run-stream {
  padding: 14px 18px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  max-height: 320px;
  overflow-y: auto;
}
.run-line {
  display: flex; align-items: flex-start; gap: 10px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.run-line .ts {
  color: var(--fg-dim);
  flex-shrink: 0;
  width: 56px;
}
.run-line .tag {
  flex-shrink: 0;
  width: 64px;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.06em;
  padding-top: 1px;
}
.run-line .tag-step { color: var(--fg-mute); }
.run-line .tag-query { color: var(--info); }
.run-line .tag-source { color: var(--accent); }
.run-line .tag-thought { color: var(--fg-dim); font-style: italic; }
.run-line .tag-error { color: var(--bad); }
.run-line .tag-done { color: var(--good); }
.run-line .body { color: var(--fg); flex: 1; }
.run-line .body .meta-inline {
  color: var(--fg-dim);
  margin-left: 8px;
  font-size: 11px;
}
.run-line .body .src-domain { color: var(--accent); }
.run-line .body .src-score {
  background: var(--accent-dim);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  margin-left: 8px;
  color: var(--accent);
}

.run-result {
  border-top: 1px solid var(--line);
  padding: 14px 18px;
  background: linear-gradient(to bottom, var(--accent-dim), transparent 80%);
}
.run-result-head {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--fg);
  margin-bottom: 10px;
}
.run-result-head code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-mute);
  background: var(--bg-input);
  padding: 1px 6px;
  border-radius: 4px;
}
.run-result-icon {
  width: 18px; height: 18px;
  background: var(--good);
  color: #0a0c0f;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.run-result-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.run-result-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  cursor: default;
  font-family: inherit;
  color: var(--fg);
  font-size: 12.5px;
  transition: border-color 0.15s;
}
.run-result-file:hover { border-color: var(--accent); }
.run-result-ext {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}
.run-result-ext-pdf  { background: rgba(220, 38, 38, 0.18); color: oklch(0.78 0.18 25); }
.run-result-ext-docx { background: rgba(37, 99, 235, 0.18); color: oklch(0.8 0.13 235); }
.run-result-name { color: var(--fg); }
.run-result-size {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-dim);
  margin-left: auto;
}

/* Empty state */
.empty-main {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.empty-main-inner {
  max-width: 480px;
  text-align: center;
  color: var(--fg-mute);
}
.empty-main-inner .ascii {
  font-family: var(--mono);
  font-size: 11px;
  white-space: pre;
  color: var(--fg-dim);
  margin-bottom: 18px;
  line-height: 1.4;
}
.empty-main-inner h3 {
  font-size: 14px; font-weight: 500;
  color: var(--fg); margin: 0 0 6px;
}

/* ── Document preview ────────────────────────────────────────────────────── */

.dp-wrap {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.dp-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.dp-toolbar-left { display: flex; align-items: center; gap: 10px; }
.dp-ext-pill {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}
.dp-ext-pdf  { background: rgba(220, 38, 38, 0.15); color: oklch(0.75 0.18 25); }
.dp-ext-docx { background: rgba(37, 99, 235, 0.15); color: oklch(0.78 0.13 235); }
.dp-toolbar-name { font-size: 13px; color: var(--fg); }
.dp-toolbar-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
}
.dp-stage {
  padding: 24px;
  background: repeating-linear-gradient(45deg, transparent 0 14px, rgba(255,255,255,0.012) 14px 15px);
  display: flex;
  justify-content: center;
}
.dp-paper {
  background: #fdfcf8;
  color: #1c1b18;
  width: 100%;
  max-width: 680px;
  padding: 56px 64px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.7;
  position: relative;
}
.dp-paper-pdf { background: #fafafa; padding-top: 64px; padding-bottom: 64px; }
.dp-paper-docx { background: #fdfcf8; }

.dp-pdf-header {
  position: absolute; top: 18px; left: 64px; right: 64px;
  display: flex; justify-content: space-between;
  font-family: var(--mono);
  font-size: 9.5px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 0.5px solid #ddd;
  padding-bottom: 8px;
}
.dp-pdf-footer {
  position: absolute; bottom: 18px; left: 64px; right: 64px;
  display: flex; justify-content: space-between;
  font-family: var(--mono);
  font-size: 9.5px;
  color: #888;
  border-top: 0.5px solid #ddd;
  padding-top: 8px;
}
.dp-pdf-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  color: #1c1b18;
  font-family: Georgia, serif;
}
.dp-pdf-subtitle {
  font-family: var(--sans);
  font-size: 11px;
  color: #888;
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}

.dp-docx-ruler {
  position: absolute; top: 32px; left: 64px; right: 64px;
  height: 12px;
  border-bottom: 0.5px solid #d8d2c0;
}
.dp-docx-ruler span {
  position: absolute;
  top: -2px;
  font-family: var(--mono);
  font-size: 8px;
  color: #b0a890;
  transform: translateX(-50%);
}
.dp-docx-pageinner { padding-top: 28px; }
.dp-docx-title {
  font-size: 20px; font-weight: 700;
  margin: 0 0 4px;
  color: #1c1b18;
  font-family: "Calibri", Arial, sans-serif;
}
.dp-docx-subtitle {
  font-family: "Calibri", Arial, sans-serif;
  color: #666; font-size: 11px;
  margin-bottom: 22px;
}
.dp-paper-docx .dp-h2,
.dp-paper-docx .dp-p,
.dp-paper-docx .dp-ul,
.dp-paper-docx .dp-source-list {
  font-family: "Calibri", Arial, sans-serif;
}

.dp-section { margin-bottom: 18px; }
.dp-h2 {
  font-size: 13.5px; font-weight: 700;
  margin: 0 0 8px;
  color: #1c1b18;
  letter-spacing: -0.005em;
}
.dp-p { margin: 0 0 10px; color: #2c2b27; }
.dp-ul { margin: 0 0 10px; padding-left: 18px; }
.dp-ul li { margin-bottom: 4px; color: #2c2b27; }
.dp-cites { white-space: nowrap; }
.dp-cite { color: #c87a3e; font-family: var(--mono); font-size: 9px; }
.dp-source-list { padding-left: 18px; font-size: 11.5px; }
.dp-source-list li { margin-bottom: 5px; }
.dp-source-title { font-style: italic; }
.dp-source-meta { font-family: var(--mono); font-size: 10.5px; color: #888; }

/* ── Activity panel ──────────────────────────────────────────────────────── */

.activity-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 6px;
}
.activity-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--fg-dim);
  font-size: var(--fs-small);
  font-family: var(--mono);
}

.activity-row {
  padding: 10px 12px;
  border-radius: 6px;
  cursor: default;
  border-left: 2px solid transparent;
  margin-bottom: 2px;
}
.activity-row:hover { background: var(--bg-card); }
.activity-row[data-status="running"] { border-left-color: var(--accent); }
.activity-row[data-status="done"] { border-left-color: var(--good); }
.activity-row[data-status="error"] { border-left-color: var(--bad); }

.activity-row-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.activity-kind {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-card);
  color: var(--fg-mute);
}
.activity-kind[data-trigger="scheduled"] { color: var(--info); background: oklch(0.78 0.1 235 / 0.12); }
.activity-kind[data-trigger="manual"] { color: var(--accent); background: var(--accent-dim); }
.activity-status {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-dim);
  display: flex; align-items: center; gap: 6px;
}
.activity-status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fg-dim);
}
.activity-status[data-status="running"] .dot { background: var(--accent); animation: pulse 1.4s infinite; }
.activity-status[data-status="done"] .dot { background: var(--good); }
.activity-status[data-status="error"] .dot { background: var(--bad); }

.activity-title {
  font-size: 13px;
  margin-top: 4px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-time {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-dim);
  margin-top: 2px;
}

.activity-row-detail {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-mute);
  line-height: 1.6;
}
.activity-row-detail .detail-line { display: flex; gap: 8px; }
.activity-row-detail .detail-line .k { color: var(--fg-dim); width: 60px; flex-shrink: 0; }
.activity-row-detail .detail-line .v { color: var(--fg); flex: 1; }

/* ── Settings button + modal (real Claude API key) ───────────────────────── */

.settings-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--fg-mute);
  width: 26px; height: 26px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 6px;
  transition: background .12s, color .12s, border-color .12s;
}
.settings-btn:hover {
  background: var(--bg-card);
  color: var(--fg);
  border-color: var(--accent);
}

.settings-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.settings-modal {
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  width: 480px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.settings-head h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.settings-close {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--fg-dim);
  font-size: 14px;
  cursor: pointer;
  width: 24px; height: 24px;
  border-radius: 4px;
}
.settings-close:hover { background: var(--bg-card); color: var(--fg); }

.settings-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.settings-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
}
.settings-row { display: flex; gap: 6px; }
.settings-input {
  flex: 1;
  height: 32px;
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--fg);
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
.settings-input:focus { border-color: var(--accent); }
.settings-show, .settings-save, .settings-cancel, .settings-clear {
  appearance: none;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
}
.settings-show:hover, .settings-cancel:hover, .settings-clear:hover { background: var(--bg-input); }
.settings-save {
  background: var(--accent);
  color: #1a1300;
  border-color: var(--accent);
  font-weight: 600;
}
.settings-save:hover { filter: brightness(1.05); }
.settings-help {
  font-size: 11px;
  color: var(--fg-dim);
  line-height: 1.5;
}
.settings-help code {
  font-family: var(--mono);
  background: var(--bg-input);
  border: 1px solid var(--line);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10.5px;
  color: var(--fg-mute);
}
.settings-actions { display: flex; gap: 6px; margin-top: 4px; }

/* ── Editable folder path ─────────────────────────────────────────────────── */

.folder-path {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}
.folder-path:hover { background: var(--bg-card); }
.folder-path-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
}
.folder-path-edit {
  font-size: 10px;
  color: var(--fg-dim);
  opacity: 0;
  transition: opacity 0.12s;
  flex-shrink: 0;
}
.folder-path:hover .folder-path-edit { opacity: 1; }
.folder-path-editing { padding: 6px var(--pad); }
.folder-path-input {
  width: 100%;
  height: 24px;
  background: var(--bg-input);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--fg);
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  outline: none;
}

/* ── Folder picker (FSA) ──────────────────────────────────────────────────── */

.folder-picker {
  border-bottom: 1px solid var(--line);
  padding: 8px var(--pad) 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.folder-picker .folder-path {
  display: flex; align-items: center; gap: 8px;
  padding: 0;
  border-bottom: 0;
  cursor: default;
}
.folder-picker .folder-path:hover { background: transparent; }
.folder-picker .folder-path-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 11px;
}
.folder-btn {
  appearance: none;
  flex-shrink: 0;
  height: 24px;
  padding: 0 8px;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 10.5px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.folder-btn:hover { background: var(--bg-input); border-color: var(--accent); }
.folder-btn-choose { color: var(--fg); }
.folder-btn-disconnect { color: var(--fg-mute); }
.folder-btn-disconnect:hover { color: var(--bad); border-color: var(--bad); }

.folder-msg {
  font-family: var(--sans);
  font-size: 11px;
  line-height: 1.45;
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.folder-msg-trust {
  color: var(--fg-mute);
  background: var(--bg-card);
}
.folder-msg-hint {
  color: var(--fg-dim);
  background: transparent;
  border-color: transparent;
  padding: 2px 4px;
  font-size: 10.5px;
}
.folder-msg-locked {
  color: var(--good);
  background: oklch(0.78 0.14 155 / 0.08);
  border-color: oklch(0.78 0.14 155 / 0.3);
}
.folder-msg-error {
  color: var(--bad);
  background: oklch(0.7 0.18 25 / 0.08);
  border-color: oklch(0.7 0.18 25 / 0.3);
}

/* ── Real local-write confirmation on RunCard ─────────────────────────────── */

.run-local-write {
  margin: 0 var(--pad) var(--pad);
  padding: 10px 12px;
  border-radius: 7px;
  background: oklch(0.78 0.14 155 / 0.10);
  border: 1px solid oklch(0.78 0.14 155 / 0.35);
  color: var(--good);
  font-size: 12.5px;
  display: flex; flex-direction: column; gap: 4px;
}
.run-local-write code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: oklch(0.78 0.14 155 / 0.15);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--good);
}
.run-local-write-names {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-mute);
}
.run-local-write-error {
  color: var(--bad);
  background: oklch(0.7 0.18 25 / 0.10);
  border-color: oklch(0.7 0.18 25 / 0.35);
}
