:root {
  color-scheme: light;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --bg: #FAFAF9;
  --panel: #FFFFFF;
  --panel-2: #F5F5F4;
  --line: #E7E5E4;
  --line-strong: #D6D3D1;
  --ink: #0C0A09;
  --ink-2: #44403C;
  --muted: #78716C;
  --muted-2: #A8A29E;
  --blue: #1572E8;       /* Knowpeak mountain blue */
  --blue-ink: #0B4FB0;
  --blue-wash: #EBF2FD;
  --red: #D4322C;
  --red-wash: #FBECEB;
  --amber: #B57614;
  --amber-wash: #FBF3E0;
  --orange: #D35400;
  --orange-wash: #FCE8D8;
  --green: #2E7D46;
  --green-wash: #E7F2EC;
  --ansi-blk: #555555;
  --ansi-mag: #B95DBD;
  --ansi-cyn: #0A9396;
  --knob: #FFFFFF;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 0 rgba(0,0,0,0.02), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.05);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  /* spacing scale — snap padding/gap/margin to these. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 48px;
  /* type scale — body 14, scale ratio ~1.2. */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 28px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0B0C;
  --panel: #131315;
  --panel-2: #1A1A1D;
  --line: #26262A;
  --line-strong: #34343A;
  --ink: #F5F5F4;
  --ink-2: #D4D4D8;
  --muted: #8A8A92;
  --muted-2: #60606A;
  --blue: #3B8DFA;
  --blue-ink: #7FB4FF;
  --blue-wash: #112238;
  --red: #F07167;
  --red-wash: #321614;
  --amber: #E0B15A;
  --amber-wash: #2E2311;
  --orange: #ED8A3C;
  --orange-wash: #331D10;
  --green: #5FB77B;
  --green-wash: #11251A;
  --ansi-blk: #8A8A92;
  --ansi-mag: #D58CD8;
  --ansi-cyn: #4FB8BC;
  --knob: var(--ink-2);
  --shadow-sm: 0 1px 0 rgba(0,0,0,0.3);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.5;
  font-feature-settings: "ss01","cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select {
  font: inherit;
  color: inherit;
}

/* native selects get the same visual language as other form controls. */
select {
  -webkit-appearance: none;
  appearance: none;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 4px 28px 4px 10px;
  font-size: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%2371717A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
  transition: border-color 120ms;
}
select:hover { border-color: var(--muted-2); }
[data-theme="dark"] select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%238A8A92' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
}
button { cursor: pointer; background: none; border: none; padding: 0; }

/* focus — visible and consistent across all interactive elements. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 3px;
}
/* buttons/pills already round: match their corner so the ring hugs. */
.btn:focus-visible,
.seg button:focus-visible,
.env-switch button:focus-visible,
.month-pick button:focus-visible,
.tabs button:focus-visible,
.nav-item:focus-visible,
.toggle:focus-visible,
.pstep:focus-visible,
.lvl-chip:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* Calendar day cells (Tid). The global ring above is drawn OUTSIDE the box
   (outline-offset:2px), so on the 7-column grid it painted over the
   neighbouring cell, and the edge columns had it clipped against the calendar
   card's overflow:hidden — the missing left line in bd:knowsalary-idaq.18.
   Draw it INSIDE instead: same 2px blue ring, no overlap, nothing to clip. */
.kt-day:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--blue);
  position: relative;
  z-index: 1;
}

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* utility */
.mono { font-family: var(--font-mono); font-feature-settings: "zero","cv11"; }
.num { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.row { display: flex; align-items: center; }
.hstack { display: flex; align-items: center; gap: 8px; }
.vstack { display: flex; flex-direction: column; gap: 8px; }
.divider { height: 1px; background: var(--line); }

/* app shell */
.app {
  display: grid;
  min-height: 100vh;
  background: var(--bg);
}
.app[data-layout="sidebar"] { grid-template-columns: 220px 1fr; }
.app[data-layout="topnav"] { grid-template-rows: auto 1fr; grid-template-columns: 1fr; }

/* sidebar */
.sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px;
}
.sidebar .brand img { height: 22px; width: auto; }
.sidebar .brand .wordmark { font-weight: 700; letter-spacing: -0.01em; font-size: 15px; }
.sidebar .brand .tag { font-size: 10.5px; color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; margin-left: auto; }

.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 12px 10px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.nav-item:hover { background: var(--panel-2); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--panel-2); color: var(--ink); }
.nav-item .kbd { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); }
.nav-item .count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted); background: var(--bg); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); }
.nav-item[aria-current="page"] .count { background: var(--panel); }
.nav-icon { width: 14px; height: 14px; flex-shrink: 0; color: var(--muted); }
.nav-item[aria-current="page"] .nav-icon { color: var(--ink); }

/* topnav layout */
.topnav {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  display: flex; align-items: center;
  padding: 10px 20px;
  gap: 20px;
  position: sticky; top: 0; z-index: 10;
}
.topnav .brand { display: flex; align-items: center; gap: 10px; }
.topnav .brand img { height: 22px; }
.topnav .brand .wordmark { font-weight: 700; }
.topnav-nav { display: flex; gap: 2px; margin-left: 20px; }
.topnav-nav .nav-item { padding: 6px 10px; }

/* main content */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  display: flex; align-items: center;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  gap: 16px;
  position: sticky; top: 0; z-index: 5;
}
.app[data-layout="topnav"] .topbar { display: none; }

.topbar .crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.topbar .crumbs strong { color: var(--ink); font-weight: 600; }
.topbar .crumbs .sep { color: var(--muted-2); }
.topbar .env-chip {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.content {
  padding: 22px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}
.app[data-density="compact"] .content { padding: 16px; }

/* balance multi-line headings and long labels so they don't go orphan-width. */
h1, h2, h3, .page-head p, .card-h h3 { text-wrap: balance; }

/* page header */
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.015em; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--muted); font-size: 12.5px; }

/* page-level section header (h2 inside .content) */
.content h2 {
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.page-head .meta { display: flex; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 11.5px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; }
.page-head .meta span::before { content: "·"; margin-right: 10px; color: var(--muted-2); }
.page-head .meta span:first-child::before { content: none; margin-right: 0; }

/* dots */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.dot.g { background: var(--green); }
.dot.y { background: var(--amber); }
.dot.r { background: var(--red); }
.dot.b { background: var(--muted-2); }
.dot.run { background: var(--blue); box-shadow: 0 0 0 3px color-mix(in oklab, var(--blue) 20%, transparent); animation: pulse 1.4s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--blue) 40%, transparent); }
  100% { box-shadow: 0 0 0 6px color-mix(in oklab, var(--blue) 0%, transparent); }
}

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; line-height: 1.5; font-family: var(--font-mono); letter-spacing: 0.01em; }
.pill.g { background: var(--green-wash); color: var(--green); }
.pill.y { background: var(--amber-wash); color: var(--amber); }
.pill.r { background: var(--red-wash); color: var(--red); }
.pill.b { background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); }
.pill.run { background: var(--blue-wash); color: var(--blue-ink); }
.pill .dot { width: 6px; height: 6px; }

/* cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-h {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.card-h h3 { margin: 0; font-size: 12.5px; font-weight: 600; letter-spacing: 0; }
.card-h .spacer { flex: 1; }
.card-h .actions { display: flex; gap: 2px; }
.card-body { padding: 14px; }
.card-body.nopad { padding: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  min-height: 32px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: background 100ms ease;
}
.btn:hover { background: var(--panel-2); }
.btn:disabled { color: var(--muted-2); cursor: not-allowed; background: var(--panel-2); }
.btn.sm { padding: 4px 10px; min-height: 28px; font-size: 11.5px; }
.btn.icon { padding: 4px; width: 32px; height: 32px; min-height: 32px; justify-content: center; }
.btn.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
[data-theme="dark"] .btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { background: color-mix(in oklab, var(--ink) 88%, var(--bg)); }
.btn.blue {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
.btn.blue:hover { background: var(--blue-ink); }
.btn.danger {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.btn.warn {
  background: var(--orange);
  color: white;
  border-color: var(--orange);
}
.btn.warn:hover { background: color-mix(in oklab, var(--orange) 88%, var(--bg)); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-2); }

/* segmented */
.seg {
  display: inline-flex;
  padding: 2px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  gap: 1px;
}
.seg button {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.seg button[aria-pressed="true"] {
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* toggle */
.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  font-size: 12px;
  color: var(--muted);
  min-height: 32px;
  padding: 2px 0;
}
.toggle-sw {
  width: 34px; height: 20px; border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  transition: background 120ms ease;
  flex-shrink: 0;
}
.toggle-sw::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 999px;
  background: var(--knob);
  transition: transform 120ms ease;
  box-shadow: var(--shadow-sm);
}
.toggle[aria-checked="true"] .toggle-sw { background: var(--ink); }
.toggle[aria-checked="true"] .toggle-sw::after { transform: translateX(14px); }
.toggle[aria-checked="true"] { color: var(--ink); }

.toggle.danger[aria-checked="true"] .toggle-sw { background: var(--orange); }
.toggle.danger[aria-checked="true"] { color: var(--orange); font-weight: 600; }

/* apply toggle big */
.apply-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.apply-bar.armed {
  background: var(--orange-wash);
  border-color: color-mix(in oklab, var(--orange) 40%, var(--line));
}
.apply-bar .main-label { font-weight: 600; font-size: 13px; }
.apply-bar .summary { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }
.apply-bar.armed .summary { color: var(--orange); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th { text-align: left; font-weight: 500; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); position: sticky; top: 0; }
.tbl td { padding: 8px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--panel-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.tbl td.mono { font-family: var(--font-mono); }

/* module pipeline summary */
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.app[data-density="compact"] .pipeline-grid { gap: 6px; }
@media (max-width: 1100px) {
  .pipeline-grid { grid-template-columns: repeat(4, 1fr); }
}

.pstep {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer;
  transition: border-color 120ms, box-shadow 120ms;
  position: relative;
}
.pstep:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.pstep.active { border-color: var(--ink); }
.pstep .step-num { font-size: 10.5px; color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
.pstep .step-name { font-weight: 600; font-size: 12.5px; letter-spacing: -0.01em; }
.pstep .step-foot { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); font-family: var(--font-mono); margin-top: 2px; }

/* bars for pipeline */
.connector-row {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px;
  padding: 0 20px; margin-top: -6px; margin-bottom: 14px;
  height: 2px;
}
.connector-row span { height: 2px; background: var(--line); border-radius: 1px; }
.connector-row span.ok { background: var(--green); }
.connector-row span.warn { background: var(--amber); }
.connector-row span.fail { background: var(--red); }
.connector-row span.run { background: linear-gradient(90deg, var(--blue) 50%, var(--line) 50%); background-size: 12px 2px; animation: march 1.2s linear infinite; }
@keyframes march { to { background-position: 12px 0; } }

/* module card */
.module-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  transition: border-color 120ms;
}
.module-card:hover { border-color: var(--line-strong); }
.module-card.dense { padding: 10px 12px; gap: 8px; }

.mc-head { display: flex; align-items: flex-start; gap: 10px; }
.mc-head .mc-step-badge {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--muted);
  padding: 2px 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  flex-shrink: 0;
}
.mc-head .mc-title { font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; }
.mc-head .mc-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.mc-head .mc-status { margin-left: auto; text-align: right; }

.mc-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.module-card.dense .mc-controls { padding: 6px 10px; }

/* Read-only context chip rendered next to the run button. The interactive
   env/month controls live in the page header (dashboard.jsx); this chip
   reinforces 'this run will use prod / Apr 2026' right at the trigger
   without re-introducing the per-module duplication FINDING-006 flagged. */
.mc-context {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.mc-stats { display: flex; gap: 18px; font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }
.mc-stats b { color: var(--ink); font-weight: 600; }

.mc-cli {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  overflow-x: auto;
  white-space: nowrap;
}
.mc-cli .flag { color: var(--blue-ink); }
.mc-cli .apply { color: var(--orange); font-weight: 600; }

/* month picker */
.month-pick {
  display: inline-flex; align-items: center;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.month-pick button { padding: 4px 8px; min-height: 30px; color: var(--muted); }
.month-pick button:hover { color: var(--ink); background: var(--panel-2); }
.month-pick .label { padding: 4px 10px; font-family: var(--font-mono); font-size: 12px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }

/* env switch */
.env-switch {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: var(--panel);
}
.env-switch button {
  padding: 5px 12px;
  min-height: 30px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.env-switch button[aria-pressed="true"] { color: var(--ink); background: var(--panel-2); }
.env-switch button.prod[aria-pressed="true"] { color: var(--red); background: var(--red-wash); }
.env-switch button.test[aria-pressed="true"] { color: var(--blue-ink); background: var(--blue-wash); }

/* log drawer */
.log-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.25);
  z-index: 50;
  animation: fadein 140ms ease-out;
}
[data-theme="dark"] .log-overlay { background: rgba(0,0,0,0.55); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: min(780px, 80vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  z-index: 51;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 24px rgba(0,0,0,0.12);
  animation: slidein 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-h {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.drawer-h h3 { margin: 0; font-size: 13px; font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; }
.drawer-footer { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }

.logview {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  padding: 14px 16px;
  background: var(--bg);
  min-height: 100%;
}
.log-line { display: grid; grid-template-columns: 80px 12px 1fr; gap: 10px; padding: 1px 0; }
.log-line .ts { color: var(--muted-2); }
.log-line .lvl.i { color: var(--muted); }
.log-line .lvl.w { color: var(--amber); }
.log-line .lvl.e { color: var(--red); }
.log-line .lvl.s { color: var(--green); }
.log-line .msg.dim { color: var(--muted); }
.log-line .msg .tok { color: var(--blue-ink); }

/* wider drawer for the upgraded log view */
.drawer.wide { width: 680px; max-width: 92vw; }

/* drawer toolbar (filter + level chips) */
.drawer-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.log-levels { display: flex; gap: 4px; flex-wrap: wrap; }
.lvl-chip {
  font-family: var(--font-mono); font-size: 10.5px;
  padding: 2px 7px; border: 1px solid var(--line); border-radius: 3px;
  background: var(--panel); color: var(--muted-2); cursor: pointer;
  transition: all 120ms;
}
.lvl-chip.on { color: var(--ink); border-color: var(--line-strong); }
.lvl-chip.info.on   { border-color: var(--line-strong); }
.lvl-chip.warn.on   { color: var(--amber); border-color: var(--amber); background: color-mix(in srgb, var(--amber) 8%, transparent); }
.lvl-chip.error.on  { color: var(--red);   border-color: var(--red);   background: color-mix(in srgb, var(--red) 8%, transparent); }
.lvl-chip.success.on{ color: var(--green); border-color: var(--green); background: color-mix(in srgb, var(--green) 8%, transparent); }
.lvl-chip.stderr.on { color: var(--red);   border-color: var(--red);   background: color-mix(in srgb, var(--red) 6%, transparent); }

/* current-step + progress strip */
.drawer-step {
  display: flex; align-items: center; gap: 14px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font-family: var(--font-mono); font-size: 11px;
}
.drawer-step .step-name { display: flex; align-items: center; gap: 6px; color: var(--ink); }
.step-spinner {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  border: 1.5px solid var(--blue-ink); border-top-color: transparent;
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.drawer-step .step-progress { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.progress-bar { width: 120px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--blue-ink); transition: width 200ms ease-out; }

/* step/metric/start/end meta rows in the logview */
.logview .log-step {
  display: grid; grid-template-columns: 88px auto 1fr; gap: 10px;
  padding: 4px 0 3px; margin-top: 4px;
  font-family: var(--font-mono); font-size: 11.5px;
  border-top: 1px dashed color-mix(in srgb, var(--line-strong) 60%, transparent);
}
.logview .log-step:first-child { border-top: 0; margin-top: 0; }
.logview .log-step .ts { color: var(--muted-2); }
.logview .log-step .phase { color: var(--muted); }
.logview .log-step .name { color: var(--ink); font-weight: 600; }
.logview .log-step .summary { color: var(--muted); }
.logview .log-step.finished .phase { color: var(--green); }
.logview .log-step.failed   .phase { color: var(--red);   }
.logview .log-step.failed   .name  { color: var(--red);   }

.logview .log-meta {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; margin: 4px 0;
  font-family: var(--font-mono); font-size: 11.5px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}
.logview .log-meta.start { color: var(--muted); }
.logview .log-meta.start .tag { color: var(--blue-ink); font-weight: 600; }
.logview .log-meta.end.ok   .tag { color: var(--green); font-weight: 600; }
.logview .log-meta.end.fail .tag { color: var(--red);   font-weight: 600; }
.logview .log-meta .summary { color: var(--muted); }

.logview .log-metric {
  display: grid; grid-template-columns: 88px 1fr; gap: 10px;
  padding: 1px 0; color: var(--muted);
  font-family: var(--font-mono); font-size: 11px;
}
.logview .log-metric .ts { color: var(--muted-2); }

/* stderr line highlight — neutral tint. Severity comes from the level glyph,
 * not the stream: Python logging defaults to stderr, so INFO/WARN routinely
 * land here (e.g. idempotency skips, googleapiclient notices). Red would
 * wrongly scream "error" at every benign library log. */
.logview .log-line.stderr { background: color-mix(in srgb, var(--muted) 8%, transparent); }
.stderr-tag {
  display: inline-block; font-size: 9.5px; font-weight: 600;
  padding: 0 4px; margin-right: 6px;
  background: var(--muted); color: #fff; border-radius: 2px;
  letter-spacing: 0.04em;
}

/* blinking cursor at the tail of a live stream */
.cursor {
  display: inline-block; width: 7px; height: 12px;
  background: var(--ink); vertical-align: text-bottom;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Knowtime sheet / overlay animations */
@keyframes kt-sheet { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes kt-fade  { from { opacity: 0; } to { opacity: 1; } }

/* "jump to latest" pill */
.jump-latest {
  position: absolute; bottom: 12px; right: 16px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font-size: 11px; border: 0; cursor: pointer;
  box-shadow: var(--shadow-md); font-family: var(--font-mono);
}
.drawer-body { position: relative; }

/* ANSI colors (for parsed stream) */
.ansi-blk { color: var(--ansi-blk); }
.ansi-red { color: var(--red); }
.ansi-grn { color: var(--green); }
.ansi-yel { color: var(--amber); }
.ansi-blu { color: var(--blue-ink); }
.ansi-mag { color: var(--ansi-mag); }
.ansi-cyn { color: var(--ansi-cyn); }
.ansi-wht { color: var(--ink); }
.ansi-gry { color: var(--muted); }

/* report */
.report { padding: 22px 26px; max-width: 820px; margin: 0 auto; }
.report h1 { font-size: 22px; letter-spacing: -0.02em; margin: 0 0 6px; }
.report h2 { font-size: 15px; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.report h3 { font-size: 13px; margin: 16px 0 6px; color: var(--ink-2); }
.report p { margin: 6px 0; }
.report .report-meta { color: var(--muted); font-size: 11.5px; font-family: var(--font-mono); margin-bottom: 14px; }

.callout { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid; margin: 10px 0; font-size: 12px; }
.callout.g { background: var(--green-wash); border-color: color-mix(in oklab, var(--green) 30%, var(--line)); }
.callout.y { background: var(--amber-wash); border-color: color-mix(in oklab, var(--amber) 30%, var(--line)); }
.callout.r { background: var(--red-wash); border-color: color-mix(in oklab, var(--red) 30%, var(--line)); }

/* tabs */
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 22px; background: var(--panel); }
.tabs button {
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs button:hover { color: var(--ink-2); }
.tabs button .count { margin-left: 6px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); padding: 1px 5px; background: var(--panel-2); border-radius: 3px; }

/* Tweaks panel */
.tweaks-panel {
  position: fixed; right: 16px; bottom: 16px; z-index: 80;
  width: 260px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.tweaks-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tweaks-head .title { font-weight: 600; font-size: 12px; letter-spacing: 0; }
.tweaks-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 12px; }
.tweak-row { display: flex; flex-direction: column; gap: 6px; }
.tweak-row > label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

/* incident */
.incident {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.incident:last-child { border-bottom: none; }
.incident .i-title { font-weight: 600; font-size: 13px; }
.incident .i-meta { font-size: 11px; color: var(--muted); font-family: var(--font-mono); margin-top: 2px; }
.incident .i-body { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.incident .i-action { text-align: right; }
.sev-dot { width: 8px; height: 8px; border-radius: 999px; margin-top: 5px; }
.sev-dot.p0 { background: var(--red); }
.sev-dot.p1 { background: var(--amber); }
.sev-dot.p2 { background: var(--muted-2); }

/* kv */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; font-size: 12px; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; font-family: var(--font-mono); }

/* fullrun visualizations */
.fr-stepper { display: flex; gap: 0; align-items: stretch; }
.fr-stepper .step {
  flex: 1;
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 12px;
  border: 1px solid var(--line);
  border-right: none;
  background: var(--panel);
  position: relative;
}
.fr-stepper .step:first-child { border-top-left-radius: var(--radius); border-bottom-left-radius: var(--radius); }
.fr-stepper .step:last-child { border-right: 1px solid var(--line); border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.fr-stepper .step.done { background: color-mix(in oklab, var(--green-wash) 40%, var(--panel)); }
.fr-stepper .step.active { background: color-mix(in oklab, var(--blue-wash) 60%, var(--panel)); border-color: var(--blue); z-index: 1; }
.fr-stepper .step.warn { background: color-mix(in oklab, var(--amber-wash) 40%, var(--panel)); }
.fr-stepper .step .n { font-size: 10px; color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; }
.fr-stepper .step .t { font-weight: 600; font-size: 12px; }

.fr-flow {
  display: flex; flex-direction: column; gap: 8px;
}
.fr-flow .fnode {
  display: grid;
  grid-template-columns: 22px 28px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.fr-flow .fnode .idx { font-family: var(--font-mono); color: var(--muted); font-size: 11px; }
.fr-flow .fnode .arrow { display: flex; justify-content: center; color: var(--muted-2); }
.fr-flow .fnode.done { border-color: color-mix(in oklab, var(--green) 30%, var(--line)); }
.fr-flow .fnode.active { border-color: var(--blue); background: color-mix(in oklab, var(--blue-wash) 50%, var(--panel)); }

.fr-timeline {
  position: relative;
  padding: 14px 0 14px 28px;
}
.fr-timeline::before {
  content: ""; position: absolute; left: 10px; top: 14px; bottom: 14px;
  width: 2px; background: var(--line);
}
.fr-timeline .tnode { position: relative; padding: 8px 0; }
.fr-timeline .tnode::before {
  content: ""; position: absolute;
  left: -22px; top: 12px;
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--panel); border: 2px solid var(--line-strong);
}
.fr-timeline .tnode.done::before { background: var(--green); border-color: var(--green); }
.fr-timeline .tnode.active::before { background: var(--blue); border-color: var(--blue); box-shadow: 0 0 0 4px color-mix(in oklab, var(--blue) 25%, transparent); }
.fr-timeline .tnode.failed::before { background: var(--red); border-color: var(--red); }
.fr-timeline .tnode .thead { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13px; }
.fr-timeline .tnode .tsub { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); margin-top: 2px; }

/* trend sparkline */
.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 18px; }
.spark > span { width: 4px; background: var(--muted-2); border-radius: 1px; }
.spark > span.g { background: var(--green); }
.spark > span.y { background: var(--amber); }
.spark > span.r { background: var(--red); }

/* small icon buttons in corner */
.corner-actions { position: fixed; top: 14px; right: 16px; display: flex; gap: 6px; z-index: 40; }

/* empty */
.empty { text-align: center; padding: 40px; color: var(--muted); font-size: 12.5px; }
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 48px 20px; color: var(--muted); font-size: 12.5px; text-align: center;
}
.empty-state .empty-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted-2);
}
.empty-state .empty-title { color: var(--ink-2); font-weight: 600; font-size: 13px; }
.empty-state .empty-hint { color: var(--muted); max-width: 340px; }

/* progress ring */
.ring { width: 14px; height: 14px; flex-shrink: 0; }

/* respect users who ask for reduced motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
