:root {
  --bg-app: #ffffff;
  --bg: #fafafa;
  --bg-hover: #f6f6f7;
  --bg-raised: #ffffff;
  --line: #e9ebed;
  --line-strong: #d1d5da;
  --ink: #353a3e;
  --ink-strong: #181a1c;
  --ink-dim: #545a61;
  --ink-faint: #626c75;
  --accent: #02807d;
  --accent-strong: #014847;
  --accent-button: #8efbf7;
  --accent-hover: #32e6e2;
  --accent-soft: #defffe;
  --accent-pale: rgba(2, 128, 125, .055);
  --green: #228240;
  --green-soft: #e7fce9;
  --red: #d62740;
  --red-soft: #fbeeed;
  --violet: #6b4bc4;
  --slate: #181a1c;
  --brand-teal: #05bdba;
  --brand-ink: #0c3f3e;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --shadow: 0 1px 10px rgba(53, 58, 62, .06), 0 2px 4px rgba(53, 58, 62, .08);
}

* { box-sizing: border-box; }
html, body, #root { min-height: 100%; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-app);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, .log-stream:focus-visible {
  outline: 3px solid rgba(50, 230, 226, .5);
  outline-offset: 2px;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--ink-strong);
  color: white;
  text-decoration: none;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.brand-lockup { display: inline-flex; align-items: center; gap: 9px; color: var(--brand-ink); }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-ray { fill: var(--brand-teal); }
.brand-ray-diagonal { stroke: var(--brand-teal); stroke-width: 5.5; }
.brand-n { fill: var(--brand-ink); }
/* translate: sit the word on the same baseline as the "n" inside the mark. */
.brand-name { font-size: 19px; font-weight: 650; letter-spacing: -.02em; transform: translateY(-1.5px); }
.topbar {
  display: none;
  min-height: 58px;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-app);
}
.signed-out .topbar { display: flex; }

.floor { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 10px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}
.sidebar-brand {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.local-nav { display: grid; gap: 4px; margin-top: 28px; }
.platform-item {
  position: relative;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.platform-item svg { width: 18px; height: 18px; flex: 0 0 auto; }
.platform-item:hover { background: var(--accent-pale); color: var(--accent); }
.platform-item.current { background: var(--accent-pale); color: var(--accent); font-weight: 600; }
.platform-item.current::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 10px;
  width: 4px;
  height: 16px;
  border-radius: 999px;
  background: var(--accent);
}
.nav-count { min-width: 22px; margin-left: auto; color: var(--ink-faint); font-size: 12px; font-weight: 500; text-align: right; }
.platform-item.current .nav-count { color: var(--accent); }
.sidebar-actions { margin-top: 18px; }
.sidebar-run {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  border-color: var(--accent-button);
  background: var(--accent-button);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.sidebar-run svg, .sidebar-new svg { width: 16px; height: 16px; }
.sidebar-run:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.sidebar-new { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 8px; padding: 5px; border: 0; background: transparent; color: var(--accent); font-size: 12px; cursor: pointer; }
.sidebar-new:hover { text-decoration: underline; }
.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
@keyframes status-pulse { 50% { box-shadow: 0 0 0 7px rgba(2, 128, 125, 0); } }
.user-block { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 5px 0 0 8px; }
.user-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
}
.user-copy { min-width: 0; display: grid; line-height: 1.15; }
.user-copy strong { max-width: 104px; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.user-copy span { margin-top: 3px; color: var(--ink-faint); font-size: 11px; }
.logout {
  min-height: 32px;
  margin-left: auto;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.logout:hover { color: var(--accent); background: var(--accent-pale); }

main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 30px 36px 80px; }
.signed-out main { max-width: 760px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-header h1 { margin: 0; color: var(--ink); font-size: 28px; font-weight: 600; line-height: 1.2; letter-spacing: -.015em; }
.page-header p { margin: 7px 0 0; color: var(--ink-dim); font-size: 14px; }
.page-actions { display: flex; align-items: center; gap: 10px; }
.page-actions .btn { display: inline-flex; align-items: center; gap: 7px; }
.page-actions svg { width: 16px; height: 16px; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.summary-stat { min-width: 0; display: grid; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-raised); }
.summary-stat > span { color: var(--ink-faint); font-size: 12px; font-weight: 500; }
.summary-stat strong { margin-top: 8px; color: var(--ink); font-size: 28px; font-weight: 600; line-height: 1; }
.summary-stat strong.summary-status { overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.summary-stat small { margin-top: 9px; color: var(--ink-faint); font-size: 12px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
.overview-grid .row-main { grid-template-columns: minmax(0, 1fr) auto; }
.overview-grid .row-main .index-detail { display: none; }
.overview-grid .type-row { flex-wrap: wrap; }
.overview-grid .row-main { flex-basis: 100%; }
.index-card { margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-raised); }
.card-header { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.card-header h2 { margin: 0; color: var(--ink); font-size: 16px; font-weight: 600; }
.card-header p { margin: 3px 0 0; color: var(--ink-faint); font-size: 12px; }
.text-button, .inline-link {
  padding: 3px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.text-button:hover, .inline-link:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
.inline-link { padding: 0; }
.index-list { min-width: 0; }
.index-row {
  min-height: 64px;
  display: grid;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 11px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.index-row:last-child { border-bottom: 0; }
.index-row:hover { background: var(--bg-hover); }
.type-row { display: flex; align-items: stretch; gap: 10px; }
/* Fixed tracks and a fixed-width action, so the schedule, status and button line up down the list
   whatever each row's button says. */
.row-main { min-width: 0; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 150px 96px; align-items: center; gap: 14px; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.row-main .status-tag { justify-self: start; }
.type-row .row-action { flex: 0 0 156px; width: 156px; align-self: center; justify-content: center; min-height: 32px; padding: 5px 10px; font-size: 12px; white-space: nowrap; }
.run-row { grid-template-columns: 48px minmax(0, 1fr) 76px auto; }
/* Fixed tracks, so a long description cannot squeeze the branch down to "m." */
.site-row { grid-template-columns: minmax(0, 1fr) 88px 96px; }
.site-row .status-tag { justify-self: start; }
.index-primary { min-width: 0; display: grid; }
.index-primary strong { overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.index-primary small { margin-top: 3px; overflow: hidden; color: var(--ink-faint); font-size: 12px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.index-detail { overflow: hidden; color: var(--ink-dim); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.run-id { color: var(--ink-faint); font: 11px/1 var(--mono); }
.index-empty { margin: 0; padding: 24px 18px; color: var(--ink-faint); }
.full-index { width: 100%; }
.full-index .index-row { min-height: 68px; }

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}
.status-tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.status-tag.running, .status-tag.starting, .status-tag.scheduled { border-color: #8efbf7; background: var(--accent-soft); color: var(--accent-strong); }
.status-tag.running::before, .status-tag.starting::before { animation: status-pulse 2s infinite; }
.status-tag.done { border-color: #bef9c6; background: var(--green-soft); color: var(--green); }
.status-tag.error, .status-tag.failed, .status-tag.timed_out { border-color: #fbd3d0; background: var(--red-soft); color: var(--red); }
.status-tag.cancelled, .status-tag.no_action, .status-tag.paused, .status-tag.manual, .status-tag.disabled { color: var(--ink-faint); }
.status-tag.available { border-color: #bef9c6; background: var(--green-soft); color: var(--green); }

.hero { margin-bottom: 28px; }
.hero .kicker { margin-bottom: 10px; color: var(--ink-faint); font-size: 13px; }
.hero .kicker code { color: var(--accent-strong); font-family: var(--mono); }
.hero h1 { max-width: 900px; margin: 0 0 12px; color: var(--ink); font-size: 28px; font-weight: 600; line-height: 1.2; letter-spacing: -.015em; text-wrap: balance; }
.hero .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; color: var(--ink-dim); font-size: 14px; }
.hero .meta > span:not(.status-tag) { padding-left: 12px; border-left: 1px solid var(--line); }
.hero .meta code { font-family: var(--mono); font-size: 12px; }
.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 24px; padding: 20px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-raised); }
.metric { min-width: 0; padding: 0 14px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label { margin-bottom: 5px; color: var(--ink-faint); font-size: 12px; font-weight: 500; }
.metric-value { overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 24px; }
.btn {
  min-height: 36px;
  padding: 7px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg-raised);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
}
.btn:hover:not(:disabled) { background: var(--bg-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { border-color: var(--accent-button); background: var(--accent-button); color: var(--accent-strong); }
.btn.primary:hover:not(:disabled) { border-color: var(--accent-hover); background: var(--accent-hover); }
.btn.danger { border-color: #fbd3d0; color: var(--red); }
.btn.danger:hover:not(:disabled) { background: var(--red-soft); }
.action-status { color: var(--ink-faint); font-size: 12px; }
.action-status.bad { color: var(--red); }

section:not(.index-card) { margin-bottom: 24px; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-raised); }
section:not(.index-card) > h3 { margin: -24px -24px 22px; padding: 16px 24px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 16px; font-weight: 600; }
.lead { max-width: 76ch; margin: 0; color: var(--ink-dim); white-space: pre-wrap; font-size: 14px; line-height: 1.6; }
.report { padding: 20px 22px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-hover); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.report.prompt { max-height: 60vh; overflow: auto; border-color: var(--ink-strong); background: var(--slate); color: #f6f6f7; font: 12px/1.7 var(--mono); }
.report + .lead { margin-top: 16px; }
/* A report or task rendered as Markdown blocks rather than preformatted text. */
.report.rendered { white-space: normal; }
.report.rendered > *:first-child { margin-top: 0; }
.report.rendered > *:last-child { margin-bottom: 0; }
.report.rendered p { margin: 0 0 14px; max-width: 74ch; line-height: 1.65; }
.report.rendered .prompt-code { background: var(--bg-raised); }
details summary { cursor: pointer; color: var(--ink-dim); font-size: 13px; font-weight: 500; }
details[open] summary { margin-bottom: 14px; color: var(--accent-strong); }
.task-dialog { width: min(560px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-raised); color: var(--ink); box-shadow: var(--shadow); }
.task-dialog::backdrop { background: rgba(24, 26, 28, .35); }
.task-dialog h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.task-dialog p { margin: 0 0 14px; color: var(--ink-dim); font-size: 13px; line-height: 1.6; }
.task-dialog textarea { width: 100%; min-height: 132px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg-raised); color: var(--ink); font: 13px/1.6 var(--sans); resize: vertical; }
.task-dialog textarea:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
.task-dialog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.task-dialog-actions .hint { margin-left: auto; color: var(--ink-faint); font: 11px/1 var(--mono); }

.error-band { margin-bottom: 24px; padding: 16px 18px; border: 1px solid #fbd3d0; border-radius: 6px; background: var(--red-soft); color: var(--red); font-size: 13px; white-space: pre-wrap; }
.form-note { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--ink-faint); font-size: 12px; }
.link-button { padding: 0; border: 0; background: none; color: var(--accent-strong); font: inherit; text-decoration: underline; cursor: pointer; }

.skeleton { padding-top: 4px; }
.skeleton .bone { margin-bottom: 16px; border-radius: 7px; background: linear-gradient(90deg, var(--line), var(--bg-raised), var(--line)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.settings-costs { max-width: 920px; margin-top: 24px; }
.costs-top { margin-top: 24px; }
.costs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.unit-toggle { display: inline-flex; flex: 0 0 auto; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-hover); }
.unit-toggle button { padding: 4px 10px; border: 0; border-radius: 4px; background: transparent; color: var(--ink-dim); font: inherit; font-size: 12px; cursor: pointer; }
.unit-toggle button.current { background: var(--bg-raised); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.form { display: grid; gap: 22px; max-width: 920px; padding: clamp(16px, 2.4vw, 26px); border: 1px solid var(--line); border-radius: 8px; background: var(--bg-raised); }
/* Hints sit under the field, so a field with a hint still lines up with one
   without across a row. `order` drives grid auto-placement here. */
.form label { display: grid; align-content: start; gap: 8px; color: var(--ink); font-size: 14px; font-weight: 500; }
.form label > input, .form label > select, .form label > textarea, .form label > .paired-inputs { order: 1; }
.form label > .hint { order: 2; margin-top: -2px; }
.form label.inline > .hint { order: 0; margin-top: 0; }
.form label.inline > input, .form .site-picker label > input { order: 0; }
.form input[type="checkbox"] { accent-color: var(--accent-strong); }
/* The route change focuses #main for keyboard users; it must not draw a ring. */
#main:focus { outline: none; }
.form label.inline { grid-template-columns: auto auto 1fr; align-items: center; justify-content: start; gap: 10px; }
/* Fields share a row while each can hold 240px, and stack once they cannot,
   without leaving an empty grid track behind. */
.form .two { display: flex; flex-wrap: wrap; gap: 18px 20px; }
.form .two > * { flex: 1 1 240px; min-width: 0; }
.form input[type="text"], .form select, .form textarea, .auth-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg-raised);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}
/* Draw the arrow so a select matches the inputs beside it in every browser. */
.form select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23545a61' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 11px;
  cursor: pointer;
}
/* A free-text model id sits directly under the select it replaces. */
.form label > select + input[type="text"] { order: 1; margin-top: 8px; }
.form textarea { min-height: 120px; resize: vertical; }
.form textarea.prompt { min-height: 380px; font-family: var(--mono); font-size: 12px; line-height: 1.65; }
.form input:focus, .form select:focus, .form textarea:focus, .auth-form input:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
.form input[readonly] { background: var(--bg-hover); color: var(--ink-dim); }
.form .hint { color: var(--ink-faint); font-size: 12px; font-weight: 400; }
.paired-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.site-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.site-picker label { grid-template-columns: auto 1fr; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); font-size: 12px; font-weight: 400; cursor: pointer; transition: border-color .15s ease, background .15s ease, color .15s ease; }
.site-picker label:hover { border-color: var(--accent); }
.site-picker label:has(:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }
/* The loop form runs long; keep its actions in reach without scrolling back. */
.form-actions { position: sticky; bottom: -1px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 0 2px; background: linear-gradient(to top, var(--bg-raised) 72%, transparent); }
.form-error { min-height: 20px; color: var(--red); font-size: 12px; }

.log-section h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.log-count { color: var(--ink-faint); font-size: 12px; font-weight: 400; }
/* Its own panel, not a step: it sits outside the stream and must not read as
   the entry the stream happens to be scrolled to. */
.log-current { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 4px 9px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-hover); }
.log-current::before { content: "Current task"; grid-column: 2; color: var(--ink-faint); font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
/* A task can be a whole heredoc; two lines is enough to say what it is doing. */
.log-current span:last-child { grid-column: 2; display: -webkit-box; overflow: hidden; color: var(--ink); font: 12px/1.6 var(--mono); -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.log-spinner { grid-row: 1 / span 2; margin-top: 4px; }
.log-spinner { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: status-pulse 1.6s infinite; }
/* An execution trace: one rail, a marker per step, and the agent's own words
   set apart from the commands it ran. */
/* Left padding has to clear the step markers: a scroll container clips whatever
   sits at a negative offset, which sliced the circles in half. */
.log-stream { display: grid; gap: 4px; max-height: 68vh; margin: 0; overflow: auto; padding: 18px 18px 18px 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-raised); list-style: none; }
/* minmax(0, 1fr) and min-width: 0 keep a wide command wrapping inside the
   stream instead of widening it into a horizontal scrollbar. */
.log-stream { grid-template-columns: minmax(0, 1fr); }
.log-step { position: relative; min-width: 0; display: grid; gap: 7px; padding: 4px 0 18px 26px; border-left: 1px solid var(--line); }
.log-step:last-of-type { border-left-color: transparent; }
/* The marker hangs off the label row over the rail. top/bottom 0 with auto
   vertical margins centres it on that row whatever its height, so it needs no
   guessed offset. */
.log-dot { position: absolute; top: 0; bottom: 0; left: -32px; margin: auto 0; width: 9px; height: 9px; border: 2px solid var(--bg-raised); border-radius: 50%; background: var(--ink-faint); }
.log-step.kind-agent-message .log-dot, .log-step.kind-user-message .log-dot { background: var(--accent-strong); }
.log-step.kind-run-command .log-dot, .log-step.kind-tool .log-dot { background: var(--ink-dim); }
.log-step.live .log-dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: status-pulse 1.6s infinite; }
.log-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.log-kind { color: var(--ink-faint); font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.log-step.kind-agent-message .log-kind { color: var(--accent-strong); }
.log-stamp { display: inline-flex; align-items: baseline; gap: 8px; color: var(--ink-faint); font: 10px/1 var(--mono); }
.log-stamp time { font-variant-numeric: tabular-nums; }
.log-index { color: var(--ink-faint); font: 10px/1 var(--mono); }
.log-command { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-hover); color: var(--ink); font: 12px/1.6 var(--mono); }
.log-command > code { min-width: 0; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-prompt { color: var(--accent-strong); user-select: none; }
/* An environment or task title is prose, not something that was typed at a shell. */
.log-command.is-text { grid-template-columns: minmax(0, 1fr); color: var(--ink-dim); font-family: var(--sans); }

/* Shell tokens. Bounded palette: the command and its data carry colour, the
   punctuation between them stays quiet. */
.sh-command { color: var(--ink); font-weight: 600; }
.sh-assignment { color: var(--violet); }
.sh-flag { color: var(--ink-dim); }
.sh-string { color: var(--green); }
.sh-variable { color: var(--accent-strong); }
.sh-operator { color: var(--ink-faint); }
.sh-comment { color: var(--ink-faint); font-style: italic; }
.sh-plain { color: var(--ink-dim); }
/* A folded heredoc is a block inside the command line, not another token. */
.log-details-inline { grid-column: 1 / -1; margin-top: 6px; }
/* No inner scroller: the stream is the only scroll container, and a second
   scrollbar beside it made the steps read as broken nesting. Output is capped
   server-side, so it can simply run to its full height here. */
.log-output { margin: 0; overflow: visible; padding: 10px 12px; border-radius: 6px; background: var(--slate); color: #e6e7ea; font: 11px/1.7 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
/* A flex summary drops the native marker, so draw the chevron: without it
   nothing says the line is a control. */
.log-details > summary { display: flex; align-items: baseline; gap: 8px; padding: 5px 8px; border-radius: 6px; color: var(--ink-faint); font: 11px/1.6 var(--mono); cursor: pointer; list-style: none; }
.log-details > summary::-webkit-details-marker { display: none; }
.log-details > summary::before { content: "▸"; flex: 0 0 auto; display: inline-block; transition: transform .15s ease; }
.log-details[open] > summary::before { transform: rotate(90deg); }
.log-details > summary:hover { background: var(--bg-hover); color: var(--ink-dim); }
.log-details[open] > summary { margin-bottom: 6px; }
.log-lines { flex: 0 0 auto; }
.log-peek { min-width: 0; overflow: hidden; color: var(--ink-dim); text-overflow: ellipsis; white-space: nowrap; }
.log-details[open] .log-peek { display: none; }
.log-say { margin: 0; max-width: 76ch; color: var(--ink); font-size: 13.5px; line-height: 1.65; overflow-wrap: anywhere; }
.inline-code { padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-hover); color: var(--ink); font: 12px/1.5 var(--mono); overflow-wrap: anywhere; }
.report .inline-code { background: var(--bg-raised); }
.log-end { padding: 0; border: 0; }
.log-end { min-height: 0; }

.auth-panel { max-width: 460px; margin: 8vh auto 0; padding: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-raised); box-shadow: var(--shadow); }
.auth-panel h1 { margin: 0 0 12px; color: var(--ink); font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -.015em; }
.auth-panel p { margin: 0 0 10px; color: var(--ink-dim); }
.auth-form { display: grid; gap: 18px; margin-top: 32px; }
.auth-form label { display: grid; gap: 7px; color: var(--ink); font-size: 14px; font-weight: 500; }
.auth-form button, .auth-oauth { min-height: 40px; padding: 0 16px; border: 1px solid var(--accent-button); border-radius: 6px; background: var(--accent-button); color: var(--accent-strong); font-size: 14px; font-weight: 500; cursor: pointer; }
.auth-form button { justify-self: start; }
.auth-form button:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.auth-error { min-height: 20px; color: var(--red); font-size: 12px; }
.auth-links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 20px; }
.auth-link { padding: 0; border: 0; background: none; color: var(--ink-dim); font-size: 13px; font-weight: 500; cursor: pointer; }
.auth-link:hover { color: var(--accent); }
.auth-divider { display: flex; align-items: center; gap: 14px; margin: 28px 0 18px; color: var(--ink-faint); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-oauth { width: 100%; border-color: var(--line-strong); background: var(--bg-raised); color: var(--ink); }
.auth-oauth:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-pale); }

@media (max-width: 980px) {
  .floor { grid-template-columns: 220px minmax(0, 1fr); }
  main { padding-right: 24px; padding-left: 24px; }
  .overview-grid { grid-template-columns: 1fr; }
  .run-row { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .run-row .index-detail { display: none; }
  .user-copy { display: none; }
}

@media (max-width: 720px) {
  .signed-out .topbar, .topbar { display: flex; }
  .floor { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 10px 16px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { display: none; }
  .sidebar-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 8px; }
  .sidebar-footer .user-block { padding: 0; }
  .sidebar-footer .user-avatar { display: none; }
  .local-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; }
  .platform-item { flex-direction: column; gap: 4px; justify-content: center; padding: 8px 2px; font-size: 12px; }
  .platform-item.current::before { left: 20%; right: 20%; top: auto; bottom: 0; width: auto; height: 3px; }
  .platform-item .nav-count { display: none; }
  .sidebar-actions { display: none; }
  main { padding: 24px 16px 64px; }
  .page-header { align-items: flex-start; flex-wrap: wrap; gap: 16px; }
  .page-header h1, .hero h1 { font-size: 24px; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-stat { grid-template-columns: 1fr auto; align-items: center; }
  .summary-stat strong { grid-column: 2; grid-row: 1 / 3; margin: 0; }
  .summary-stat small { margin-top: 3px; }
  .metric-strip { grid-template-columns: 1fr 1fr; row-gap: 18px; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(3), .metric:nth-child(4) { padding-top: 16px; border-top: 1px solid var(--line); }
  .row-main { grid-template-columns: minmax(0, 1fr) auto; }
  .row-main .index-detail { display: none; }
  .type-row .row-action { padding: 5px 8px; }
  .type-row { flex-wrap: wrap; }
  .type-row .row-main { flex-basis: 100%; }
  .site-row { grid-template-columns: minmax(0, 1fr) auto; }
  .site-row .index-detail { display: none; }
  .hero .meta { overflow-wrap: anywhere; }
  .btn, .logout, .row-action { min-height: 44px; }
  .form label.inline { grid-template-columns: auto 1fr; }
  .form label.inline .hint { grid-column: 2; }
  .form input[type="text"], .form textarea, .auth-form input, .task-dialog textarea { font-size: 16px; }
  .run-row { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .form .two { grid-template-columns: 1fr; }
  .page-actions .btn { padding-right: 12px; padding-left: 12px; }
  section:not(.index-card), .form { padding: 20px; }
  section:not(.index-card) > h3 { margin: -20px -20px 18px; padding: 14px 20px; }
  .auth-panel { margin-top: 3vh; padding: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Context explorer */
.tabs { display: flex; gap: 2px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 10px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--ink-dim);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.current { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
.panel-bar { display: flex; align-items: center; gap: 12px; margin: 16px 0 20px; }
.panel-bar .index-detail { white-space: normal; }
.panel-bar .btn { margin-left: auto; flex: 0 0 auto; }
.panel-bar-actions { display: flex; flex: 0 0 auto; gap: 8px; margin-left: auto; }
.panel-bar-actions .btn { margin-left: 0; }
.panel-form { margin-bottom: 24px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip, .chip-button, .chip.static {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--ink-dim);
  font-size: 12px;
}
.chip { cursor: pointer; }
.chip-button { cursor: pointer; font: inherit; font-size: 12px; }
.chip-button:hover, .chip:hover { background: var(--bg-hover); }
.chip-button.current { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.chip.static { cursor: default; font: 11px/1.5 var(--mono); }
/* Two tracks, so a snippet wraps instead of squeezing the status out of the row. */
.context-row { grid-template-columns: minmax(0, 1fr) auto; align-items: start; text-decoration: none; }
.context-row .snippet {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--ink-faint);
  white-space: normal;
}
.ticket-comment { padding: 16px 0; border-top: 1px solid var(--line); }
.ticket-comment:first-of-type { border-top: 0; }
.ticket-comment .report { margin-top: 8px; }
.ticket-comment.internal .report { border-style: dashed; }
.notice-band { margin-bottom: 24px; padding: 16px 18px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg-hover); color: var(--ink-dim); font-size: 13px; }
.next-run-notes { margin: 0; padding-left: 20px; color: var(--ink); }
.next-run-notes li { margin-bottom: 6px; }
.next-run-notes li:last-child { margin-bottom: 0; }
.learning-text { white-space: normal; overflow: visible; font-weight: 400; }
.context-row .learning-text + small { margin-top: 5px; }
.context-row .btn { flex: 0 0 auto; align-self: start; min-height: 30px; padding: 4px 10px; font-size: 12px; }
/* Prompt view: the document a loop runs on, long enough to need real structure. */
/* A div, not a section: the generic `section > h3` rule turns a heading into a
   full-bleed card title, which is wrong for a document's own subheadings. */
.prompt-view {
  margin-bottom: 24px;
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-raised);
}
.prompt-view > *:first-child { margin-top: 0; }
.prompt-view > *:last-child { margin-bottom: 0; }
.prompt-h1 { margin: 0 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 19px; font-weight: 600; }
.prompt-h2 { margin: 34px 0 12px; color: var(--ink); font-size: 16px; font-weight: 600; }
.prompt-h3 { margin: 24px 0 10px; color: var(--ink-dim); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.prompt-view p { margin: 0 0 14px; max-width: 74ch; color: var(--ink); line-height: 1.65; }
.prompt-list { margin: 0 0 16px; padding-left: 22px; max-width: 74ch; }
ol.prompt-list li { padding-left: 2px; }
.prompt-list li { margin-bottom: 9px; line-height: 1.6; }
.prompt-list li:last-child { margin-bottom: 0; }
.prompt-code {
  margin: 0 0 16px;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-hover);
  font: 12px/1.6 var(--mono);
}
/* Settings lives with the identity block, not in the main nav. */
.sidebar-settings {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink-dim);
  text-decoration: none;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.sidebar-settings svg { width: 17px; height: 17px; flex: 0 0 auto; }
.sidebar-settings:hover { background: var(--bg-hover); color: var(--ink); }
.sidebar-settings.current { color: var(--ink); font-weight: 600; }
