/* Arah: buku catatan lab yang tenang. Netral dingin kehijauan, satu aksen teal, laporan dalam serif. */
:root {
  --bg: #f2f5f4;
  --surface: #ffffff;
  --ink: #15211f;
  --muted: #566764;
  --line: #d5dedb;
  --accent: #0a6b66;
  --accent-ink: #ffffff;
  --good: #1f7a4d;
  --bad: #b3261e;
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-read: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1615;
    --surface: #162120;
    --ink: #e6efed;
    --muted: #9fb2ae;
    --line: #27403c;
    --accent: #4fc3b8;
    --accent-ink: #06211e;
    --good: #5fd39a;
    --bad: #ff8a80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 40px 16px 80px; display: grid; gap: 20px; }

.masthead h1 { margin: 0 0 6px; font: 600 2rem/1.1 var(--font-ui); letter-spacing: -0.02em; text-wrap: balance; }
.masthead p { margin: 0; color: var(--muted); max-width: 56ch; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: grid; gap: 10px; }
.panel[hidden], [hidden] { display: none !important; }

label, legend { font-weight: 500; font-size: 0.95rem; }
.opt { font-weight: 400; color: var(--muted); font-size: 0.8rem; margin-left: 6px; }

textarea, input[type="text"], input[type="password"] {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
textarea { resize: vertical; min-height: 110px; }
textarea:focus-visible, input:focus-visible, button:focus-visible, .depth:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

fieldset { border: 0; padding: 0; margin: 4px 0 0; display: grid; gap: 8px; }
legend { padding: 0; margin-bottom: 8px; }
.depths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.depth { position: relative; display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; background: var(--bg); }
.depth input { position: absolute; opacity: 0; pointer-events: none; }
.depth:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.d-name { font-weight: 600; }
.d-meta { font-size: 0.8rem; color: var(--muted); line-height: 1.35; }

.actions { display: flex; align-items: center; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.note { color: var(--muted); font-size: 0.85rem; }

button { font: inherit; cursor: pointer; border-radius: 8px; }
button.primary { background: var(--accent); color: var(--accent-ink); border: 0; padding: 10px 18px; font-weight: 600; }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); padding: 7px 12px; font-size: 0.9rem; }
button.ghost:hover { border-color: var(--accent); }

.prog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.prog-head h2 { margin: 0; font-size: 1.1rem; }
.stage { margin: 0; color: var(--muted); font-size: 0.92rem; }

.topics { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 10px; }
.topic { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 6px; background: var(--bg); }
.topic-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.topic-title { font-weight: 500; }
.pill { font: 500 0.75rem var(--font-mono); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.topic[data-status="running"] .pill { color: var(--accent); border-color: var(--accent); }
.topic[data-status="done"] .pill { color: var(--good); border-color: var(--good); }
.topic[data-status="failed"] .pill { color: var(--bad); border-color: var(--bad); }
.queries { margin: 0; padding: 0; list-style: none; font: 400 0.8rem var(--font-mono); color: var(--muted); display: grid; gap: 2px; }
.queries li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queries li::before { content: "cari  "; color: var(--accent); }

.error { border: 1px solid var(--bad); color: var(--bad); border-radius: 8px; padding: 12px 14px; background: var(--surface); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .note { margin-left: auto; }

.report { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px 24px; font: 400 1.08rem/1.7 var(--font-read); }
.report h1 { font: 600 1.7rem/1.2 var(--font-read); margin: 0 0 14px; text-wrap: balance; }
.report h2 { font: 600 1.25rem/1.3 var(--font-read); margin: 30px 0 8px; text-wrap: balance; }
.report h3 { font: 600 1.05rem/1.3 var(--font-read); margin: 22px 0 6px; }
.report p { margin: 0 0 14px; max-width: 68ch; }
.report a { color: var(--accent); text-underline-offset: 2px; }
.report ol, .report ul { padding-left: 1.3em; max-width: 68ch; }
.report li { margin-bottom: 6px; }
.report table { border-collapse: collapse; width: 100%; font: 400 0.92rem var(--font-ui); display: block; overflow-x: auto; margin: 0 0 16px; }
.report th, .report td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.report th { background: var(--bg); }
.report.streaming::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.disclaimer { color: var(--muted); font-size: 0.82rem; margin: 12px 0 0; }

@media (max-width: 560px) {
  .depths { grid-template-columns: 1fr; }
  .report { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .report.streaming::after { animation: none; }
}
