/* Agentboard UI — tokens and styles lifted from docs/design/Agentboard.dc.html */

:root {
  --ink: oklch(0.141 0.005 285.823);
  --ink-2: oklch(0.25 0.008 285.9);
  --ink-3: oklch(0.35 0.01 285.9);
  --mut: oklch(0.505 0.016 285.938);
  --mut-2: oklch(0.606 0.016 285.938);
  --dark: oklch(0.21 0.006 285.885);
  --surface: oklch(0.988087 0 0);
  --panel: oklch(0.964435 0.001327 286.375);
  --line: oklch(0.92 0.004 286.32);
  --line-soft: oklch(0.945 0.003 286.32);
  --chip-bg: oklch(0.967 0.001 286.375);
  --hover-bg: oklch(0.935 0.003 286.375);
  --brand: oklch(0.55 0.16 255);
  --brand-deep: oklch(0.42 0.14 255);
  --brand-stroke: oklch(0.48 0.15 255);
  --brand-soft: oklch(0.46 0.10 255);
  --amber: oklch(0.75 0.16 85);
  --amber-strong: oklch(0.66 0.16 62);
  --amber-text: oklch(0.40 0.09 62);
  --amber-text-2: oklch(0.44 0.11 62);
  --amber-icon: oklch(0.50 0.13 62);
  --green: oklch(0.55 0.16 145);
  --green-text: oklch(0.40 0.10 145);
  --green-deep: oklch(0.45 0.14 145);
  --green-icon: oklch(0.45 0.13 145);
  --done-check: oklch(0.55 0.18 250);
  --red: oklch(0.577 0.245 27.325);
  --red-text: oklch(0.50 0.20 27);
  --shadow-card: 0 1px 2px rgb(15 23 42 / 0.04), 0 1px 1px rgb(15 23 42 / 0.03);
  --shadow-pop: 0 8px 24px rgb(15 23 42 / 0.08), 0 2px 6px rgb(15 23 42 / 0.05);
  --shadow-modal: 0 16px 40px rgb(15 23 42 / 0.14), 0 3px 10px rgb(15 23 42 / 0.08);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* , *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
a { color: var(--brand); text-decoration: none; }
svg { display: block; flex: none; }
::selection { background: color-mix(in oklch, var(--brand) 22%, transparent); }
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--ink); }
.mono { font-family: var(--mono); }
.mut { color: var(--mut); }
.mut-sm { font-size: 12px; color: var(--mut-2); }

/* ---------- shell ---------- */

#shell { display: flex; height: 100vh; }
#view { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

#sidebar {
  width: 240px; flex: none; display: flex; flex-direction: column; gap: 2px;
  padding: 20px; border-right: 1px solid var(--line); background: var(--surface);
}
.side-logo { display: flex; align-items: center; gap: 8px; padding: 6px 8px 10px; }
.side-logo .mark {
  width: 24px; height: 24px; border-radius: 6px; background: var(--dark); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.side-logo .name { font-size: 14px; font-weight: 600; }
.side-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px;
  font-size: 14px; color: var(--ink-3); text-align: left; width: 100%;
}
.side-item:hover { background: var(--hover-bg); color: var(--ink); text-decoration: none; }
.side-item.active { background: var(--hover-bg); color: var(--ink); font-weight: 500; }
.side-item .count {
  margin-left: auto; font-size: 11px; font-weight: 500; color: var(--brand);
  background: color-mix(in oklch, var(--brand) 10%, #fff); padding: 1px 6px; border-radius: 999px;
}
.side-sep { height: 1px; background: var(--line); margin: 10px 8px; }
.side-heading {
  font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--mut-2); padding: 4px 8px 6px;
}
.side-board { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; font-size: 13px; color: var(--ink-3); }
.side-board:hover { background: var(--hover-bg); text-decoration: none; color: var(--ink); }
.side-board.active { color: var(--ink); font-weight: 500; }
.side-board .dot { width: 8px; height: 8px; border-radius: 999px; }
.side-board .n { margin-left: auto; font-size: 11px; color: var(--mut-2); }

/* mobile bottom nav */
#tabbar { display: none; }

/* ---------- toolbar & tabs ---------- */

.crumb-bar {
  height: 44px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 20px;
  border-bottom: 1px solid var(--line); font-size: 13px; color: var(--mut);
}
.crumb-bar a { color: var(--mut); }
.crumb-bar a:hover { color: var(--ink); }
.crumb-strong { font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.toolbar { flex: none; display: flex; align-items: center; gap: 8px; padding: 20px; flex-wrap: wrap; }
.board-switch {
  height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; font-size: 13px; color: var(--ink-3); cursor: pointer;
}
.board-switch:hover { background: var(--chip-bg); }
.needsme-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border: 1px solid color-mix(in oklch, var(--amber) 45%, #fff); border-radius: 10px;
  background: color-mix(in oklch, var(--amber) 12%, #fff); font-size: 13px; font-weight: 500;
}
.needsme-chip .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--amber-strong); }
.allclear-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mut); }
.btn-new {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border-radius: 10px; background: var(--dark); color: #fff; font-size: 13px; font-weight: 500; margin-left: auto;
}

/* ---------- board columns ---------- */

.columns { flex: 1; min-height: 0; display: flex; gap: 8px; padding: 0 16px 16px; overflow-x: auto; }
.column {
  width: 280px; flex: none; display: flex; flex-direction: column;
  border-radius: 14px; background: color-mix(in oklch, var(--chip-bg) 60%, #fff); padding: 8px;
  max-height: 100%;
}
.column.doing { background: color-mix(in oklch, var(--brand) 4%, #fff); }
.column.needs_input { background: color-mix(in oklch, var(--amber) 9%, #fff); border: 1px solid color-mix(in oklch, var(--amber) 30%, #fff); }
.column.review { background: color-mix(in oklch, var(--green) 7%, #fff); border: 1px solid color-mix(in oklch, var(--green) 26%, #fff); }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; margin-bottom: 8px; height: 24px; flex: none; }
.col-head .left { display: flex; align-items: center; gap: 8px; }
.col-count { font-size: 12px; color: var(--mut-2); }
.column.needs_input .col-count { color: var(--amber-text); font-weight: 500; }
.column.review .col-count { color: var(--green-text); font-weight: 500; }
.col-cards { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
/* Room for the "just moved here" badge's negative top offset, which otherwise
   clips against the scroll box when its tile sits at the top of the column (#47). */
.column .col-cards { padding-top: 8px; }
.col-empty-msg { margin: 0; padding: 0 6px 8px; font-size: 13px; color: var(--mut); }
.col-plus { display: inline-flex; padding: 2px; border-radius: 6px; }
.col-plus:hover { background: var(--hover-bg); }
.col-actions { display: flex; align-items: center; gap: 2px; }
/* Accordion chevron: only meaningful on mobile, where the header doubles
   as a collapse toggle (#54) — desktop always shows every column. */
.col-chevron { display: none; }
.col-caption { font-size: 11px; color: var(--mut-2); padding: 0 6px 6px; flex: none; }
.done-cards { opacity: 0.72; }
.show-all-done {
  display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 7px 9px; border-radius: 8px;
  border: 1px dashed var(--line); font-size: 12px; color: var(--mut); width: 100%; flex: none;
}
.show-all-done:hover { background: #fff; }
.archived-link { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 0 9px 2px; font-size: 12px; color: var(--brand-deep); flex: none; }
.archived-link:hover { text-decoration: underline; }

/* status pill */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  color: var(--ink-3); background: var(--chip-bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.status-pill.doing { color: #fff; background: var(--brand); border: none; padding: 3px 9px; }
.status-pill.needs_input { color: #fff; background: var(--amber-strong); border: none; padding: 3px 9px; }
.status-pill.review { color: #fff; background: var(--green); border: none; padding: 3px 9px; }
.status-pill.clickable { cursor: pointer; }

/* card tile */
.card-tile {
  display: flex; flex-direction: column; gap: 5px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 15px; box-shadow: var(--shadow-card); color: inherit; flex: none;
}
.card-tile:hover { text-decoration: none; border-color: color-mix(in oklch, var(--ink) 18%, var(--line)); }
.tile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-id { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.id-chip { font-family: var(--mono); font-size: 12px; color: var(--mut); display: inline-flex; align-items: center; gap: 5px; }
.id-chip.sm { font-size: 11px; }
.id-chip.ops {
  color: var(--brand-deep); background: color-mix(in oklch, var(--brand) 9%, #fff);
  border-radius: 6px; padding: 1px 6px;
}
.done-tile .id-chip.ops { color: var(--brand-soft); background: color-mix(in oklch, var(--brand) 7%, #fff); }
.agent-chip {
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 11px; font-weight: 500;
  color: var(--brand-deep); background: color-mix(in oklch, var(--brand) 8%, #fff); border-radius: 999px; padding: 1px 7px;
}
.age-chip { font-size: 11px; font-weight: 500; border-radius: 999px; padding: 1px 6px; }
.age-chip.amber { color: var(--amber-text-2); background: color-mix(in oklch, var(--amber) 16%, #fff); }
.age-chip.green { color: var(--green-text); background: color-mix(in oklch, var(--green) 12%, #fff); }
.blocked-chip {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px;
  font-family: var(--mono); font-size: 11px; color: var(--brand-deep);
  background: color-mix(in oklch, var(--brand) 7%, #fff); border: 1px solid color-mix(in oklch, var(--brand) 28%, #fff);
}
.routine-chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 999px; font-size: 11px; color: var(--mut); background: var(--chip-bg); }
.routine-chip.lg { font-size: 12px; padding: 2px 9px; }
.wait-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: var(--mut);
  background: var(--chip-bg, #f4f4f5);
  border: 1px solid var(--line, #e5e7eb);
}
.req-chip { display:inline-flex; align-items:center; gap:3px; font-size:10px; font-weight:600; color:oklch(0.44 0.13 45); background:color-mix(in oklch, oklch(0.44 0.13 45) 10%, transparent); border-radius:999px; padding:1px 7px; }
.tile-title { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.35; text-wrap: pretty; color: var(--ink); }
.done-tile .tile-title { color: var(--ink-3); }
.tile-status-line { font-size: 10px; line-height: 1.4; }
.waiting-line { margin: 0; display: flex; align-items: flex-start; gap: 5px; color: var(--amber-text); }
.waiting-line svg { margin-top: 2px; }
.review-line { margin: 0; color: var(--mut); }
.tile-foot { display: flex; align-items: center; gap: 6px; margin-top: 0; flex-wrap: wrap; }
.label-chip { font-size: 11px; color: var(--mut); background: var(--chip-bg); border-radius: 999px; padding: 1px 8px; }
.tile-link { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 11px; color: var(--mut); margin-left: auto; }

/* doing-column heartbeat: live vs dormant agent session (design 2a) */
.presence { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--mut); margin: 0; }
.presence.live { color: var(--brand-deep); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: ab-pulse 1.6s infinite; }
@keyframes ab-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* empty board hero */
.board-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.board-empty .big { font-size: 18px; font-weight: 600; }
.board-empty .sub { font-size: 14px; color: var(--mut); }
.board-empty .last { font-family: var(--mono); font-size: 12px; color: var(--mut-2); }

/* ---------- all boards ---------- */

.ab-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.ab-board { padding: 14px 16px 18px; border-bottom: 1px solid var(--line); }
.ab-head { display: flex; align-items: center; gap: 10px; padding: 0 2px 10px; flex-wrap: wrap; }
.ab-head .dot { width: 8px; height: 8px; border-radius: 999px; }
.ab-head .bname { font-size: 15px; font-weight: 600; color: var(--ink); }
.ab-head .bname:hover { text-decoration: underline; }
.ab-head .slug { font-family: var(--mono); font-size: 11px; color: var(--mut-2); }
.ab-head .open { font-size: 12px; color: var(--mut); }
.ab-head .needyou { font-size: 12px; font-weight: 500; color: var(--amber-text); }
.ab-cols { display: flex; gap: 8px; overflow-x: auto; align-items: stretch; min-height: 280px; }
.ab-col { width: 244px; flex: none; border-radius: 12px; background: color-mix(in oklch, var(--chip-bg) 60%, #fff); padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.ab-col .col-head { margin-bottom: 0; }
.ab-col.doing { background: color-mix(in oklch, var(--brand) 4%, #fff); }
.ab-col.needs_input { background: color-mix(in oklch, var(--amber) 9%, #fff); border: 1px solid color-mix(in oklch, var(--amber) 30%, #fff); }
.ab-col.review { background: color-mix(in oklch, var(--green) 7%, #fff); border: 1px solid color-mix(in oklch, var(--green) 26%, #fff); }
.ab-col.needs_input .col-count { color: var(--amber-text); font-weight: 500; }
.ab-col.review .col-count { color: var(--green-text); font-weight: 500; }
.ab-more { display: block; padding: 0 4px 2px; font-size: 11px; color: var(--mut-2); }
.ab-col.needs_input .ab-more { color: var(--amber-text-2); }
.ab-col.review .ab-more { color: var(--green-text); }
.ab-empty { padding: 2px 6px 6px; font-size: 12px; color: var(--mut-2); }
.comment-card.flash { animation: comment-flash 1.8s ease-out; }
@keyframes comment-flash {
  0%, 35% { background: color-mix(in oklch, var(--brand) 9%, #fff); border-color: color-mix(in oklch, var(--brand) 35%, #fff); }
  100% { background: #fff; }
}
.card-tile.tile-flash { animation: tile-arrive 0.5s ease-out 1, tile-ring 1.2s ease-out 1; position: relative; }
@keyframes tile-arrive { 0% { opacity: 0; transform: translateY(-8px); } 100% { opacity: 1; transform: none; } }
@keyframes tile-ring { 0% { box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand) 45%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.card-tile.tile-flash::after { content: 'just moved here'; position: absolute; top: -8px; right: 8px; font-size: 9.5px; font-weight: 600; color: oklch(0.55 0.16 255); background: var(--surface); padding: 0 6px; border-radius: 6px; animation: label-fade 3s ease-out forwards; }
@keyframes label-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
/* mobile all-boards + board header (hidden on desktop) */
.m-head { display: none; }
.ab-columns { display: none; }

/* ---------- card detail ---------- */

.detail { flex: 1; min-height: 0; display: flex; }
.detail-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.detail-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 40px 0; }
/* shared scroll wrapper for simpler views (sessions overview, session detail) — same pattern as .detail-scroll */
.page-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 40px 0; }
.detail-inner { max-width: 880px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; }
/* floats over the pane, clear of the 300px .props column on desktop; the
   long-timeline case this exists for (#scroll-down jumps to #tl-end). */
.scroll-down-btn {
  position: fixed; right: 324px; bottom: 24px; z-index: 20;
  width: 40px; height: 40px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  background: var(--dark); box-shadow: var(--shadow-pop);
}
.scroll-down-btn[hidden] { display: none; }
.detail h1 { margin: 0; font-size: 24px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; text-wrap: pretty; }
.detail-body { margin: 10px 0 0; font-size: 15px; line-height: 1.55; color: var(--ink-3); overflow-wrap: anywhere; }
.detail-body p { margin: 10px 0 0; }
.detail-body p:first-child { margin-top: 0; }
.detail-body code { font-family: var(--mono); font-size: 13px; background: var(--chip-bg); border-radius: 4px; padding: 1px 5px; }
.detail-body pre { background: var(--chip-bg); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.detail-body pre code { background: none; padding: 0; font-size: 12.5px; }
.detail-body ul { margin: 10px 0 0; padding-left: 22px; }
.ops-line { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ops-line .ops-badge {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--brand-deep);
  background: color-mix(in oklch, var(--brand) 9%, #fff); border: 1px solid color-mix(in oklch, var(--brand) 22%, #fff);
  border-radius: 6px; padding: 2px 8px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; align-items: center; }
.ctx-chip {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--ink-3);
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px;
}
.ctx-chip:hover { border-color: var(--mut-2); text-decoration: none; color: var(--ink); }
.cardref-chip {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--brand-deep);
  background: color-mix(in oklch, var(--brand) 8%, #fff); border: 1px solid color-mix(in oklch, var(--brand) 24%, #fff);
  border-radius: 999px; padding: 3px 10px;
}
.cardref-chip:hover { text-decoration: none; border-color: color-mix(in oklch, var(--brand) 45%, #fff); }
.blocker-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-family: var(--mono); font-size: 12px; text-decoration: none; color: var(--brand-deep);
  background: color-mix(in oklch, var(--brand) 7%, #fff); border: 1px solid color-mix(in oklch, var(--brand) 28%, #fff);
}
.blocker-wrap { display: inline-flex; align-items: center; gap: 2px; }
.blocker-x {
  border: 0; background: transparent; color: var(--mut); font-size: 15px; line-height: 1; padding: 2px 5px;
  border-radius: 999px; cursor: pointer;
}
.blocker-x:hover { color: var(--brand-deep); background: color-mix(in oklch, var(--brand) 10%, #fff); }
.blocker-chip.resolved { color: var(--mut); background: transparent; border-color: var(--line); text-decoration: line-through; }
.openreq-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 8px 0; background: var(--surface); }
.openreq-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: oklch(0.44 0.13 45); background: color-mix(in oklch, oklch(0.44 0.13 45) 9%, transparent); border: 1px solid color-mix(in oklch, oklch(0.44 0.13 45) 30%, transparent); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.filter-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mut); padding: 10px 2px; }
.filter-hint .show-all-link { color: oklch(0.55 0.16 255); background: none; border: none; padding: 0; font-size: 12px; cursor: pointer; }
.blocked-age { font-size: 10px; color: oklch(0.5 0.16 25); margin-left: 4px; }
.age-chip.old { font-weight: 700; background: color-mix(in oklch, oklch(0.44 0.13 45) 18%, transparent); }
.refs-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.refs-label { font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--mut-2); margin-right: 2px; }
.ext-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--brand-deep);
  background: #fff; border: 1px solid color-mix(in oklch, var(--brand) 30%, #fff); border-radius: 6px; padding: 3px 9px;
}
.ext-chip:hover { text-decoration: none; border-color: color-mix(in oklch, var(--brand) 50%, #fff); }
.refs-note { font-size: 12px; color: var(--mut-2); }

/* written-files block (ops review) */
.written-block { margin-top: 20px; background: #fff; border: 1px solid color-mix(in oklch, var(--green) 30%, #fff); border-radius: 12px; padding: 14px 16px; }
.written-block .wb-head { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.written-block .wb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.written-file {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 13px; color: var(--ink-2);
  background: var(--chip-bg); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px;
}
.written-file:hover { text-decoration: none; border-color: var(--mut-2); }
.written-file .new { font-size: 11px; color: var(--green-icon); font-weight: 500; }
.secret-chip {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--mut);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px;
}

/* files: uploads (in) + artifacts (out) */
.files-wrap { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.files-wrap .artifacts { margin-top: 0; }
.artifacts { margin-top: 16px; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 2px rgb(15 23 42 / 0.04); }
.art-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); }
.art-headwrap { padding: 9px 12px 8px; border-bottom: 1px solid var(--line-soft); }
.art-headwrap .art-head { padding: 0; border-bottom: none; }
.art-cap { margin: 3px 0 0 22px; font-size: 11px; color: var(--mut-2); }
.art-head .t { font-size: 13px; font-weight: 600; }
.art-head .p { font-family: var(--mono); font-size: 11px; color: var(--mut-2); }
.art-head .n { margin-left: auto; font-size: 12px; color: var(--mut-2); }
.art-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); }
.art-row:last-child { border-bottom: none; }
.art-row a { font-family: var(--mono); font-size: 12px; }
.art-row .size { font-size: 12px; color: var(--mut-2); }
.art-row .when { margin-left: auto; font-size: 12px; color: var(--mut-2); }

/* uploads dropzone + staged batch */
.dropzone {
  margin: 10px 12px; border: 1.5px dashed color-mix(in oklch, var(--brand) 35%, var(--line));
  border-radius: 10px; background: color-mix(in oklch, var(--brand) 3%, #fff);
  padding: 14px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer;
}
.dropzone .dz-text { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dropzone.compact { flex-direction: row; align-items: center; padding: 12px; gap: 10px; }
.dropzone.compact .dz-text { align-items: flex-start; }
.dropzone.over { border-color: var(--brand); background: color-mix(in oklch, var(--brand) 8%, #fff); }
.dz-main { font-size: 13px; font-weight: 500; }
.dropzone.compact .dz-main { font-size: 12px; }
.dz-sub { font-size: 11px; color: var(--mut); }
.dz-browse {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; height: 28px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 12px; font-weight: 500;
}
.dropzone.compact .dz-browse { margin: 0 0 0 auto; height: 26px; }
.staged {
  margin: 0 12px 10px; border: 1px solid color-mix(in oklch, var(--brand) 24%, #fff); border-radius: 10px;
  background: color-mix(in oklch, var(--brand) 3%, #fff); overflow: hidden;
}
.staged-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12px; }
.staged-head .t { font-weight: 600; }
.staged-head .sz, .staged-row .sz { font-size: 11px; color: var(--mut); }
.staged-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 12px;
  border-top: 1px solid color-mix(in oklch, var(--brand) 12%, #fff);
}
.staged-row .nm { font-family: var(--mono); font-size: 11px; overflow-wrap: anywhere; }
.staged-actions { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid color-mix(in oklch, var(--brand) 12%, #fff); }
.staged-actions .btn-dark.sm { height: 26px; padding: 0 10px; border-radius: 7px; font-size: 12px; font-weight: 600; }
.staged-actions .hint { font-size: 11px; color: var(--mut); }
.staged-error { margin: 0; padding: 0 10px 8px; }
.staged-row .rm { margin-left: auto; display: inline-flex; padding: 2px; }
.create-dialog .dropzone, .create-dialog .staged { margin: 0; }

/* secret intake: write-only */
.secret-box {
  background: #fff; border: 1px solid color-mix(in oklch, var(--amber-strong) 34%, #fff); border-radius: 10px;
  overflow: hidden; box-shadow: 0 1px 2px rgb(15 23 42 / 0.04); margin-bottom: 4px;
}
.sb-head {
  display: flex; align-items: center; gap: 8px; padding: 11px 14px;
  background: color-mix(in oklch, var(--amber) 9%, #fff); border-bottom: 1px solid color-mix(in oklch, var(--amber-strong) 20%, #fff);
}
.sb-head .t { font-size: 13px; font-weight: 600; }
.sb-req {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  color: var(--amber-text); background: color-mix(in oklch, var(--amber) 18%, #fff); border-radius: 999px; padding: 2px 8px;
}
.sb-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px 0; }
.sb-prefill {
  font-family: var(--mono); font-size: 11px; color: var(--ink-2); background: var(--chip-bg);
  border: 1px dashed var(--line); border-radius: 999px; padding: 2px 8px;
}
.sb-prefill:hover { border-color: var(--mut-2); }
.sb-stored {
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  background: var(--chip-bg); border-radius: 999px; padding: 2px 8px;
}
.sb-stored .ok { font-family: Inter, sans-serif; color: var(--green-icon); }
.sb-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px 14px 4px; }
.sb-f { display: flex; flex-direction: column; gap: 5px; min-width: 200px; }
.sb-f.value { flex: 1; min-width: 220px; }
.sb-f > span { font-size: 12px; color: var(--mut); }
.sb-f input {
  min-height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 13px; outline: none; background: #fff;
}
.sb-f input.mono { font-family: var(--mono); font-size: 13px; background: var(--surface); }
.sb-f input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand) 12%, transparent); }
.sb-f input:disabled { background: var(--chip-bg); }
.sb-keyfile {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px;
  border: 1px dashed var(--line); border-radius: 8px; font-size: 12px; color: var(--mut);
}
.sb-keyfile:hover { border-color: var(--mut-2); color: var(--ink); }
.sb-actions { display: flex; align-items: center; gap: 8px; padding: 12px 14px 14px; flex-wrap: wrap; }
.sb-note { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--mut); }
.sb-scope-note { margin: 0; padding: 6px 14px 0; }
.secret-box.nested {
  margin: 6px 0 14px 34px;
  border-left: 3px solid var(--line, #e5e7eb);
}
.sb-prefill.sb-needed {
  font-weight: 700;
  color: oklch(0.4 0.13 45);
  background: color-mix(in oklch, oklch(0.6 0.17 45) 9%, #fff);
  border: 1px solid color-mix(in oklch, oklch(0.6 0.17 45) 34%, #fff);
}
.sb-needed .again {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 4px;
}

/* secrets in the properties panel: names only */
.secret-name-chip {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  background: var(--chip-bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; align-self: flex-start;
}
.secrets-sub { font-size: 11px; color: var(--mut-2); font-weight: 400; letter-spacing: 0; }

.detail-sep { height: 1px; background: var(--line); margin: 24px 0 0; }

/* timeline */
.tl-head { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 14px; }
.tl-tabs { display: inline-flex; gap: 2px; background: var(--chip-bg); border-radius: 8px; padding: 2px; }
.tl-tab { font-size: 12px; padding: 3px 10px; border-radius: 6px; color: var(--mut); }
.tl-tab.active { font-weight: 600; color: var(--ink); background: #fff; box-shadow: var(--shadow-card); }
.tl-filters { display: flex; align-items: center; gap: 6px; }
.tl-filters[hidden] { display: none; }
.tl-filter { font-size: 12px; color: var(--mut); padding: 3px 9px; border-radius: 999px; }
.tl-filter:hover { color: var(--ink); }
.tl-filter.active { font-weight: 500; color: var(--dark); background: var(--chip-bg); }
.timeline { display: flex; flex-direction: column; gap: 20px; padding-bottom: 8px; }
.timeline[hidden] { display: none; }
.comment-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 20px; box-shadow: var(--shadow-card); }
.comment-card.agent { border-color: color-mix(in oklch, var(--brand) 20%, var(--line)); }
.cc-head { display: flex; align-items: center; gap: 8px; }
.cc-avatar { width: 20px; height: 20px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 9px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.cc-avatar.agent { background: color-mix(in oklch, var(--brand) 12%, #fff); }
.cc-name { font-size: 13px; font-weight: 600; }
.cc-when { font-size: 12px; color: var(--mut-2); }
.cc-body { margin: 8px 0 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.cc-edited { font-size: 11px; color: var(--mut-2); }
.cc-edit { margin-left: auto; display: inline-flex; padding: 3px; border-radius: 6px; opacity: 0; }
.comment-card:hover .cc-edit, .cc-edit:focus-visible { opacity: 1; }
.cc-edit:hover { background: var(--chip-bg); }
.cc-editor textarea {
  width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font-size: 14px; line-height: 1.55; resize: vertical; outline: none;
}
.cc-editor-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.cc-editor-actions .btn-dark, .cc-editor-actions .btn-ghost { height: 26px; padding: 0 10px; border-radius: 7px; font-size: 12px; font-weight: 600; }
.choice-box { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.choice-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink);
  background: #fff;
}
.choice-btn:hover:not(:disabled) { border-color: var(--brand); background: color-mix(in oklch, var(--brand) 6%, #fff); }
.choice-btn:disabled { cursor: default; opacity: 0.5; }
.choice-btn.selected {
  opacity: 1; font-weight: 600; color: var(--brand); border-color: var(--brand);
  background: color-mix(in oklch, var(--brand) 10%, #fff);
}
.event-row { display: flex; align-items: flex-start; gap: 10px; padding: 0 4px; }
.event-row svg { margin-top: 3px; }
.event-row p { margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.7; color: var(--mut); overflow-wrap: anywhere; }
.event-row .kind { color: var(--ink-3); }
.event-row .soft { color: var(--mut-2); }
.event-row .waiting { color: var(--amber-text-2); font-weight: 500; }
.diff-block { margin: 4px 0 4px 28px; padding: 10px 12px; font-family: var(--mono); font-size: 11px; line-height: 1.6; color: var(--mut); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.diff-block .add { color: var(--green-text); }
.diff-block .del { color: var(--red-text); }
/* fact line, quieter than events; deliberately no animation */
.queued-line { margin-top: 14px; }
.queued-line p { color: var(--mut-2); }
.queued-line.agent-live, .queued-line.agent-dormant { align-items: center; }
.queued-line.agent-live p { font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--brand-deep); font-weight: 500; }

/* agent activity tab (design 2g) + session detail (design 2f, minimal) */
.act-session { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.act-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.act-step { font-size: 12px; margin: 3px 0; color: var(--mut); font-family: var(--mono); }
.session-head { display: flex; align-items: center; gap: 8px; margin: 10px 0 14px; flex-wrap: wrap; }
.session-steps .step { border-bottom: 1px solid var(--line); padding: 4px 2px; }
.session-steps summary { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.session-steps .step-type { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; color: var(--mut); }
.session-steps pre { white-space: pre-wrap; font-size: 12px; background: var(--chip-bg); border-radius: 8px; padding: 8px; margin: 6px 0 4px; overflow-x: auto; }
.session-steps .reasoning summary em { color: var(--mut); font-style: italic; }
.follow-btn { margin-left: auto; font-size: 11px; border: 1px solid var(--line); border-radius: 7px; padding: 3px 10px; background: var(--card); color: var(--mut); cursor: pointer; }
.follow-btn.on { border-color: oklch(0.5 0.11 155); color: oklch(0.5 0.11 155); font-weight: 600; }
.observation { margin-top: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.observation h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--mut); }
.observation pre { margin: 0; white-space: pre-wrap; font-size: 12.5px; }

/* agent log overview (design 2f left) */
.al-head { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 2px; }
.al-summary { margin: 2px 0 12px; font-size: 13px; color: var(--mut); max-width: 60ch; }
.al-tiles { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.al-tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; min-width: 92px; }
.al-tile .n { display: block; font-size: 20px; font-weight: 700; }
.al-tile .lbl { font-size: 11px; color: var(--mut); }
.al-list { display: flex; flex-direction: column; gap: 6px; }
.al-row { position: relative; display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; color: inherit; text-decoration: none; }
.al-row:hover { border-color: var(--mut-2); }
.al-row-link { position: absolute; inset: 0; z-index: 1; } /* stretched-link: row's base click target, below the card-id chips */
.al-id { font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 600; }
.al-cards { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mut); }
.al-cards .cardref-chip { position: relative; z-index: 2; } /* above .al-row-link so a card id stays independently clickable */
.al-handed { font-size: 11px; color: oklch(0.44 0.13 45); }
.al-outcome.ok { color: oklch(0.5 0.11 155); }
.al-outcome.crash { color: oklch(0.5 0.16 25); }
.al-outcome.live, .al-live { color: oklch(0.5 0.11 155); font-weight: 600; font-size: 11px; display: inline-flex; align-items: center; gap: 5px; }

/* comment input + quick actions */
/* 40px padding each side + 880px content = flush with the timeline column */
.composer-wrap { flex: none; padding: 20px 0; max-width: 880px; width: 100%; margin: 0 auto; }
.composer { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: 0 1px 2px rgb(15 23 42 / 0.04); }
.composer textarea {
  width: 100%; border: none; outline: none; resize: none; max-height: 40vh; padding: 0;
  font-size: 14px; background: transparent;
}
.composer textarea::placeholder { color: var(--mut-2); }
.composer-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.composer-actions .spacer { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reason-hint { margin: 8px 2px 0; font-size: 12px; color: var(--mut-2); }

.btn-dark, .btn-green, .btn-ghost, .btn-amber { white-space: nowrap; flex: none; }
.btn-dark { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; background: var(--dark); color: #fff; font-size: 13px; font-weight: 500; }
.btn-dark:disabled { opacity: 0.45; cursor: default; }
.btn-green { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; background: var(--green-deep); color: #fff; font-size: 13px; font-weight: 600; }
.btn-ghost { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 13px; font-weight: 500; }
.btn-ghost:hover { background: var(--chip-bg); }
.btn-amber {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px;
  border: 1px solid color-mix(in oklch, var(--amber-strong) 40%, #fff);
  background: color-mix(in oklch, var(--amber-strong) 10%, #fff); font-size: 13px; font-weight: 500; color: var(--amber-text);
}

/* properties panel */
.props { width: 300px; flex: none; border-left: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 14px; background: var(--surface); overflow-y: auto; }
.props .p-title { font-size: 14px; font-weight: 600; }
.prop-row { display: flex; align-items: center; gap: 12px; }
.prop-row.top { align-items: flex-start; }
.prop-row .k { width: 76px; flex: none; font-size: 13px; color: var(--mut); }
.prop-row .v { font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.prop-row .v.plain { font-weight: 400; color: var(--ink-3); }
.prop-row .v.clickable { cursor: pointer; }
.props .sep { height: 1px; background: var(--line); }
.props .rel-heading { font-size: 12px; font-weight: 600; color: var(--mut); letter-spacing: 0.02em; }
.rel-card { display: block; background: #fff; border: 1px solid color-mix(in oklch, var(--brand) 24%, #fff); border-radius: 10px; padding: 10px; color: inherit; }
.rel-card:hover { text-decoration: none; border-color: color-mix(in oklch, var(--brand) 45%, #fff); }
.rel-card .rt { margin: 6px 0 0; font-size: 13px; font-weight: 500; line-height: 1.35; }
.rel-card .rs { margin: 4px 0 0; font-size: 12px; color: var(--mut); }
.rel-card .rs.review { color: var(--green-text); }
.rel-card .rs.needs_input { color: var(--amber-text); }

/* mobile card header + action bar */
.m-cardhead { display: none; }
.m-actionbar { display: none; }

/* ---------- dialogs & sheets ---------- */

#overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: color-mix(in oklch, var(--ink) 34%, transparent); padding: 20px;
}
#overlay[hidden] { display: none; }
#overlay.sheet-mode { align-items: flex-end; padding: 0; }
#overlay.anchored { background: transparent; }
.dialog { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-modal); width: 440px; max-width: 100%; max-height: 90vh; overflow-y: auto; }
.reason-dialog { width: 360px; padding: 20px; }
.dialog-title { font-size: 14px; font-weight: 600; }
.dialog-sub { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--mut); }
.dialog-warning { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: oklch(0.44 0.13 45); margin: 2px 0 0; }
.reason-dialog input {
  margin-top: 10px; width: 100%; border: 1px solid var(--brand); border-radius: 8px; padding: 7px 10px; font-size: 13px; outline: none;
}
.reason-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.reason-suggest button { font-size: 11px; color: var(--mut); background: var(--chip-bg); border-radius: 999px; padding: 2px 8px; }
.reason-suggest button:hover { background: var(--hover-bg); color: var(--ink); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dialog:not(.create-dialog):not(.status-menu) { padding: 20px; }

.open-cards-dialog { width: 480px; }
.open-cards-list { max-height: 320px; overflow-y: auto; margin-top: 12px; border: 1px solid var(--line-soft); border-radius: 8px; }
.open-cards-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.open-cards-row:last-child { border-bottom: none; }
.open-cards-row a { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.open-cards-row .btn-ghost { height: 26px; padding: 0 8px; font-size: 12px; }

.status-menu { width: 196px; padding: 4px; }
.status-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; width: 100%; font-size: 13px; text-align: left; }
.status-item:hover { background: var(--chip-bg); }
.status-item.active { background: var(--chip-bg); font-weight: 600; }
.status-item .item-check { margin-left: auto; display: inline-flex; }
.menu-hint { margin: 6px 8px 4px; font-size: 11px; line-height: 1.4; color: var(--mut-2); }
.status-item.exception { border: 1px dashed var(--mut-2); border-radius: 8px; }
.status-item .agent-tag { margin-left: auto; font-size: 9.5px; font-weight: 600; color: var(--mut); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }
.doing-note { margin: 2px 8px 6px; font-size: 11px; color: var(--mut); }
.exception-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600; color: oklch(0.44 0.13 45); margin-bottom: 2px; }

.sheet { width: 100%; background: #fff; border-radius: 20px 20px 0 0; padding: 10px 0 26px; box-shadow: 0 -12px 40px rgb(15 23 42 / 0.2); }
.sheet-handle { width: 40px; height: 4px; border-radius: 999px; background: var(--line); margin: 0 auto 10px; }
.sheet-head { padding: 0 18px 10px; display: flex; align-items: baseline; gap: 8px; }
.sheet-head span:first-child { font-size: 16px; font-weight: 600; }
.status-item.sheet-item { height: 48px; padding: 0 18px; border-radius: 0; font-size: 16px; gap: 12px; }
.status-item.sheet-item.active { font-weight: 600; }

/* create dialog */
.create-dialog { width: min(560px, 92vw); }
.create-head { display: flex; align-items: center; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.create-title { font-size: 15px; font-weight: 600; }
.create-body { padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; color: var(--mut); }
.field-hint { font-size: 11px; color: var(--mut-2); }
.field-hint-inline { color: var(--mut-2); }
.req-note { color: var(--red-text); }
/* Direct-child combinator so this doesn't also reach the label-entry input
   nested inside .labels-input, which used to stack a second border on top
   of the one .labels-input already draws around itself (#50). */
.field > input[type='text'], .field > select, .field > textarea {
  min-height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 14px; outline: none; background: #fff; width: 100%;
}
.field > textarea { min-height: 64px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }
.field input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in oklch, var(--red) 14%, transparent); }
.field select:disabled { color: var(--ink); background: var(--chip-bg); opacity: 1; }
.field-error { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--red-text); margin-top: 2px; }
.field-error[hidden] { display: none; }

/* type: template-picker cards instead of a plain two-way toggle, so task vs.
   ops reads as a real decision instead of a segmented switch */
.type-cards { display: flex; gap: 8px; }
.type-card {
  flex: 1; display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: left;
}
.type-card:hover { border-color: var(--mut-2); background: var(--chip-bg); }
.type-card.active { border-color: var(--brand); background: color-mix(in oklch, var(--brand) 6%, #fff); box-shadow: 0 0 0 1px var(--brand) inset; }
.tc-icon { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex: none; margin-top: 1px; }
.tc-icon.task { background: color-mix(in oklch, var(--brand) 12%, #fff); color: var(--brand-deep); }
.tc-icon.ops { background: color-mix(in oklch, var(--amber) 18%, #fff); color: var(--amber-text); }
.tc-text { min-width: 0; }
.tc-title { display: block; font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.tc-sub { display: block; font-size: 11px; color: var(--mut); line-height: 1.35; margin-top: 1px; }

/* title: the field every card needs gets the most visual weight */
.field > input.nc-title-input {
  font-size: 16px; font-weight: 500; min-height: 40px; padding: 8px 12px; border-radius: 9px;
}
.field > input.nc-title-input:focus { box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand) 14%, transparent); }

/* body: genuinely auto-grows (JS) instead of a fixed-height box, with a
   Trello/GitHub-style formatting toolbar tucked away until focused so a
   field that's often left blank doesn't carry permanent chrome */
.body-field { display: flex; flex-direction: column; }
.nc-body-input {
  box-sizing: border-box; width: 100%; min-height: 64px; max-height: 40vh; overflow-y: auto; resize: none;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 14px; line-height: 1.5; outline: none; background: #fff;
}
.nc-body-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand) 12%, transparent); }
.body-field.focused .nc-body-input { border-radius: 8px 8px 0 0; }
.body-toolbar {
  display: flex; align-items: center; gap: 2px; padding: 5px 6px;
  border: 1px solid var(--line); border-top: none; border-radius: 0 0 8px 8px;
  background: var(--chip-bg); max-height: 0; opacity: 0; overflow: hidden;
  transition: max-height 0.14s ease, opacity 0.1s ease;
}
.body-field.focused .body-toolbar { max-height: 34px; opacity: 1; }
.tb-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; color: var(--ink-3); font-size: 13px; }
.tb-btn.mono { font-family: var(--mono); font-size: 10px; }
.tb-btn:hover { background: #fff; color: var(--ink); }
.tb-sep { width: 1px; height: 15px; background: var(--line); margin: 0 4px; flex: none; }
.tb-hint { margin-left: auto; font-size: 11px; color: var(--mut-2); }

/* labels: fixed double-border (see .field > input above), a focus ring on
   the whole chip row, and a hover-reveal remove (×) on each chip */
.labels-input { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }
.labels-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand) 12%, transparent); }
.labels-input input { border: none; outline: none; flex: 1; min-width: 90px; font-size: 13px; padding: 2px; }
.label-chip.removable { display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 8px; font-size: 11px; color: var(--ink-3); }
.label-chip.removable .rm { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 999px; opacity: 0.6; }
.label-chip.removable .rm:hover { background: var(--hover-bg); opacity: 1; }

/* footer: a top divider anchors the actions to the dialog instead of
   floating in whitespace, only once it's genuinely the trailing footer
   (board settings reuses .create-actions mid-form, and stays plain) */
.create-actions { display: flex; align-items: center; gap: 8px; padding-top: 2px; }
.create-actions .btn-dark, .create-actions .btn-ghost { height: 32px; padding: 0 12px; font-weight: 600; }
.create-note { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--mut-2); }
.create-body > .create-actions:last-child {
  padding: 14px 20px 16px; margin: 0 -20px -20px; border-top: 1px solid var(--line);
  background: var(--panel); border-radius: 0 0 12px 12px;
}

/* mobile: full-width bottom sheet (same pattern "move to" and "new" already
   use) with a sticky header + real close, instead of a small centered card
   that never adapts to the format the rest of the app uses on mobile */
.sheet.create-dialog { display: flex; flex-direction: column; max-height: 88vh; }
.sheet.create-dialog .sheet-head { position: relative; padding: 2px 20px 10px; }
.sheet.create-dialog .sheet-close {
  position: absolute; right: 16px; top: -2px; width: 30px; height: 30px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; color: var(--mut);
}
.sheet.create-dialog .sheet-close:hover { background: var(--hover-bg); color: var(--ink); }
.sheet.create-dialog .create-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 20px 16px; gap: 18px; }
.sheet.create-dialog .create-actions { flex: none; padding: 12px 20px 24px; border-top: 1px solid var(--line); }
.sheet.create-dialog .create-actions .btn-dark { flex: 1; justify-content: center; height: 48px; font-size: 15px; border-radius: 10px; }
.sheet.create-dialog .type-card { padding: 12px; }
.sheet.create-dialog .field > input.nc-title-input { min-height: 46px; padding: 10px 12px; border-radius: 10px; }
.sheet.create-dialog .nc-body-input { min-height: 56px; border-radius: 10px 10px 0 0; }
.sheet.create-dialog .body-field:not(.focused) .nc-body-input { border-radius: 10px; }
.sheet.create-dialog .body-toolbar { border-radius: 0 0 10px 10px; padding: 7px 8px; }
.sheet.create-dialog .tb-btn { width: 30px; height: 30px; }
.sheet.create-dialog .tb-hint { display: none; }

/* routines modal */
.routines-dialog { width: min(560px, 92vw); }
.rt-group { margin-top: 10px; }
.rt-board { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--mut); }
.rt-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); align-items: center; }
.rt-row.paused { background: var(--chip-bg); opacity: 0.75; }
.rt-main { grid-column: 1; display: flex; align-items: center; gap: 8px; }
.rt-name { font-weight: 600; font-size: 13px; }
.rt-sched { font-family: var(--mono); font-size: 11px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--mut); }
.rt-meta { grid-column: 1; font-size: 12px; color: var(--mut); }
.rt-toggle { grid-column: 2; grid-row: 1 / span 2; width: 34px; height: 20px; border-radius: 999px; background: oklch(0.87 0.005 286.3); position: relative; }
.rt-toggle .knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.rt-toggle.on { background: oklch(0.42 0.13 145); }
.rt-toggle.on .knob { left: 16px; }
.rt-paused-tag { margin-left: 6px; font-size: 11px; color: var(--mut); }
.rt-overdue { color: oklch(0.44 0.13 45); font-weight: 600; }
.rt-footer { margin-top: 10px; font-size: 11.5px; color: var(--mut); }

/* ---------- archive ---------- */

.archive-wrap { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; }
.archive-box { max-width: 760px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 1px 2px rgb(15 23 42 / 0.04); }
.archive-head { height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.archive-head .t { font-size: 13px; font-weight: 600; }
.archive-head .n { font-size: 12px; color: var(--mut-2); }
.archive-head a { margin-left: auto; font-size: 12px; color: var(--brand-deep); }
.archive-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); color: inherit; }
.archive-row:last-child { border-bottom: none; }
.archive-row:hover { background: #fff; text-decoration: none; }
.archive-row .id { font-family: var(--mono); font-size: 12px; color: var(--mut); width: 78px; flex: none; }
.archive-row .id.ops { color: var(--brand-deep); }
.archive-row .t { font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-row .r { font-size: 12px; color: var(--mut); width: 190px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-row .d { font-size: 12px; color: var(--mut-2); }
.archive-empty { padding: 24px 14px; font-size: 13px; color: var(--mut); }

/* ---------- context viewer ---------- */

.ctx { flex: 1; min-height: 0; display: flex; }
.ctx-tree { width: 260px; flex: none; border-right: 1px solid var(--line); background: var(--panel); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden; }
.ctx-tree .heading { font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--mut-2); padding: 4px 8px 8px; }
.ctx-search { position: relative; margin: 0 2px 8px; flex: none; }
.ctx-search svg { position: absolute; left: 8px; top: 8px; pointer-events: none; }
.ctx-search input { width: 100%; height: 30px; padding: 0 26px 0 28px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 12.5px; outline: none; }
.ctx-search input:focus { border-color: var(--brand-stroke); }
.ctx-search .clear { position: absolute; right: 6px; top: 6px; padding: 2px; border-radius: 5px; color: var(--mut); }
.ctx-search .clear:hover { background: var(--hover-bg); }
.ctx-search .clear[hidden] { display: none; }
.ctx-empty { padding: 10px 8px; font-size: 12px; color: var(--mut-2); }
.ctx-dir { display: flex; align-items: center; gap: 6px; padding: 5px 8px; font-family: var(--mono); font-size: 12px; color: var(--ink); width: 100%; min-width: 0; border-radius: 8px; text-align: left; }
.ctx-dir:hover { background: var(--hover-bg); }
.ctx-dir svg { flex: none; transition: transform 0.12s ease; }
.ctx-dir.collapsed svg { transform: rotate(-90deg); }
.ctx-dir .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ctx-dir .n { margin-left: auto; flex: none; font-size: 10.5px; color: var(--mut-2); }
.ctx-file { display: block; padding: 5px 8px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); border-radius: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ctx-file:hover { background: var(--hover-bg); text-decoration: none; }
.ctx-file.active { background: var(--hover-bg); color: var(--ink); font-weight: 500; }
.ctx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ctx-head { height: 44px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.ctx-head .path { display: flex; align-items: center; min-width: 0; flex: 1; font-family: var(--mono); font-size: 13px; overflow: hidden; white-space: nowrap; }
.ctx-head .seg { color: var(--mut); border-radius: 6px; padding: 2px 4px; flex: none; }
.ctx-head .seg:hover { background: var(--hover-bg); color: var(--ink); }
.ctx-head .sep { color: var(--mut-2); flex: none; }
.ctx-head .cur { font-weight: 500; color: var(--ink); padding: 2px 4px; overflow: hidden; text-overflow: ellipsis; }
.ctx-head .ro { font-size: 11px; color: var(--mut); background: var(--chip-bg); border-radius: 999px; padding: 2px 8px; flex: none; }
.ctx-content { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px; }
.fm-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: grid; grid-template-columns: 120px 1fr; gap: 8px 16px; box-shadow: 0 1px 2px rgb(15 23 42 / 0.04); max-width: 720px; }
.fm-card .k { font-size: 12px; color: var(--mut); }
.fm-card .v { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.fm-card .v.kind { font-weight: 500; }
.fm-card .v .secret-ref { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-3); background: var(--chip-bg); border-radius: 999px; padding: 2px 8px; margin: 0 6px 4px 0; }
.ctx-md { margin-top: 20px; max-width: 720px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.ctx-md h3, .ctx-md h4, .ctx-md h5, .ctx-md h6 { margin: 18px 0 0; font-weight: 600; color: var(--ink); }
.ctx-md h3 { font-size: 16px; margin-top: 0; }
.ctx-md p { margin: 10px 0 0; }
.ctx-md code { font-family: var(--mono); font-size: 13px; background: var(--chip-bg); border-radius: 4px; padding: 1px 5px; }
.ctx-md pre { background: var(--chip-bg); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.ctx-md ul { margin: 10px 0 0; padding-left: 22px; }
.ctx-placeholder { padding: 40px; font-size: 14px; color: var(--mut); }

/* ---------- error state ---------- */

.view-error { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.view-error .big { font-size: 16px; font-weight: 600; }
.view-error .msg { font-size: 13px; color: var(--mut); }

/* ---------- mobile ---------- */

@media (max-width: 720px) {
  /* iOS/Android auto-zoom on focus triggers below a 16px font-size; bump
     every text entry point to 16px here (desktop keeps the denser sizes). */
  .sb-f input, .sb-f input.mono { font-size: 16px; }
  .cc-editor textarea { font-size: 16px; }
  .composer textarea { font-size: 16px; }
  .reason-dialog input { font-size: 16px; }
  .field input[type='text'], .field select, .field textarea { font-size: 16px; }
  .labels-input input { font-size: 16px; }
  .nc-body-input { font-size: 16px; }

  #shell { height: auto; min-height: 100vh; }
  #sidebar { display: none; }
  #view { overflow: visible; padding-bottom: 84px; }
  #tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    align-items: center; justify-content: space-around; padding: 10px 12px 22px;
    border-top: 1px solid var(--line); background: #fff;
  }
  #tabbar:empty { display: none; }
  .tab-item { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 44px; font-size: 11px; color: var(--mut); }
  .tab-item.active { color: var(--ink); font-weight: 600; }
  .tab-item:hover { text-decoration: none; }
  .tab-item { position: relative; }
  .tab-badge { position: absolute; top: 4px; right: 18%; min-width: 15px; height: 15px; border-radius: 999px; background: oklch(0.5 0.16 25); color: #fff; font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
  .tab-badge[hidden] { display: none; }
  .more-sheet { padding-bottom: 18px; }
  .more-sheet .sheet-head { margin-top: 14px; }
  .more-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; background: none; border: none; font-size: 14.5px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
  .more-row .t { font-weight: 500; }
  .more-row .meta { margin-left: auto; font-size: 11.5px; color: var(--mut); }
  .more-row .dot { width: 9px; height: 9px; border-radius: 999px; }

  .al-tiles { display: grid; grid-template-columns: 1fr 1fr; }
  .al-row { flex-wrap: wrap; row-gap: 4px; }
  .al-cards { flex-basis: 100%; order: 9; }

  .crumb-bar { display: none; }
  .toolbar { display: none; }

  .m-head { display: block; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .m-head .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .m-head .title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
  .row-actions { display: flex; align-items: center; gap: 8px; }
  .m-need {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--amber-text);
    background: color-mix(in oklch, var(--amber) 14%, #fff); border-radius: 999px; padding: 4px 10px; white-space: nowrap;
  }
  .m-need .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--amber-strong); }
  .m-sub { margin: 4px 0 0; font-size: 13px; color: var(--mut); }
  .m-new { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: #fff; background: var(--dark); border-radius: 999px; padding: 6px 12px; white-space: nowrap; }

  /* board columns become a collapsible accordion, one section open at a
     time. Previously every column stayed permanently expanded with only
     an 8px gap between them, so an empty stage (0 cards, ~32px tall)
     nearly fused with the next header (#54). Now each section is a fixed
     divider-separated row (pill + count + chevron) whether it has cards
     or not, closed by default; tapping opens it and closes the other. */
  .columns { flex-direction: column; overflow: visible; padding: 0 16px 16px; gap: 0; }
  .column { width: 100%; background: none !important; border: none !important; border-bottom: 1px solid var(--line) !important; border-radius: 0; padding: 0; max-height: none; }
  .column:last-child { border-bottom: none !important; }
  .col-head { padding: 15px 2px; margin-bottom: 0; height: auto; cursor: pointer; }
  .col-chevron { display: inline-flex; margin-left: 2px; color: var(--mut-2); transition: transform 0.2s ease; }
  .column.open .col-chevron { transform: rotate(180deg); color: var(--ink-3); }
  .column.empty .col-head .status-pill, .column.empty .col-head .col-count { opacity: 0.55; }
  .column:not(.open) .col-cards, .column:not(.open) .col-caption, .column:not(.open) .show-all-done, .column:not(.open) .archived-link {
    display: none;
  }
  .col-cards { overflow: visible; padding: 2px 2px 16px; }
  .col-empty-msg { font-size: 13px; color: var(--mut); margin: 0; padding: 0 2px 16px; }
  .card-tile { border-radius: 12px; padding: 14px; }
  .tile-title { font-size: 15px; }
  .waiting-line { font-size: 13px; }
  .column.needs_input { order: 1; }
  .column.review { order: 2; }
  .column.doing { order: 3; }
  .column.inbox { order: 4; }
  .column.ready { order: 5; }
  .column.done { order: 6; }

  /* all boards: same collapsed-stage columns as the single-board view */
  .ab-cols { display: none; }
  .ab-board { padding: 14px 16px 18px; }
  .ab-columns { display: flex; flex-direction: column; gap: 0; }

  /* card detail */
  .detail { flex-direction: column; }
  .props { display: none; }
  .detail-scroll, .page-scroll { padding: 16px 16px 0; overflow: visible; }
  .detail h1 { font-size: 19px; line-height: 1.3; }
  .detail-body { font-size: 14px; }
  .composer-wrap { padding: 16px; }
  .m-cardhead { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 10; }
  .m-cardhead .cid { font-family: var(--mono); font-size: 13px; color: var(--mut); }
  .m-cardhead .status-pill { margin-left: auto; }
  .m-actionbar {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    padding: 12px 16px 26px; border-top: 1px solid var(--line); background: #fff; box-shadow: 0 -8px 24px rgb(15 23 42 / 0.06);
  }
  .m-primary { display: flex; align-items: center; justify-content: center; gap: 8px; height: 48px; width: 100%; border-radius: 12px; background: var(--green-deep); color: #fff; font-size: 16px; font-weight: 600; }
  .m-primary.dark { background: var(--dark); }
  .m-primary.amber { background: var(--amber-strong); }
  .m-secondary { display: flex; gap: 8px; margin-top: 8px; }
  .m-secondary button { flex: 1; display: flex; align-items: center; justify-content: center; height: 44px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; font-weight: 500; background: #fff; }
  .detail-page-with-bar { padding-bottom: 150px; }
  /* no .props column to clear on mobile, but .m-actionbar is fixed over the
     bottom ~138px instead — same clearance .detail-page-with-bar already reserves. */
  .scroll-down-btn { right: 16px; bottom: 160px; }

  /* context viewer stacks */
  .ctx { flex-direction: column; }
  .ctx-tree { width: 100%; border-right: none; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .archive-wrap { padding: 12px; }
  .archive-row .r { width: auto; flex: 1; }
}

/* ---------- auth: login + enrol views ---------- */
.auth-view { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }
.auth-view .side-logo { margin-bottom: 4px; }
.auth-view .field { width: 280px; max-width: 100%; text-align: left; }
.auth-view .mut-sm code { font-family: 'JetBrains Mono', monospace; font-size: 11px; }

/* ---------- version + update notice ---------- */
.side-foot { margin-top: auto; padding: 8px; font-size: 11px; color: var(--mut-2); }
.side-foot .link { color: var(--brand); font-size: 11px; font-weight: 500; }
.more-row .side-foot { padding: 0; margin: 0; }
.side-foot .icon-btn { background: none; border: none; padding: 2px; cursor: pointer; vertical-align: -2px; opacity: 0.7; }
.side-foot .icon-btn:hover { opacity: 1; }
.side-foot .icon-btn:disabled { opacity: 0.4; cursor: default; }
