/* ── Button ── */
.btn {
  background: var(--surface-raised); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-6); cursor: pointer;
  font-size: var(--fs-md); font-weight: var(--fw-semi);
  display: inline-flex; align-items: center; gap: var(--sp-2);
  justify-content: center; transition: all var(--t-fast) ease;
}
/* Flat and exact: depth comes from hairlines, not glows or gradients. */
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.danger { color: var(--status-danger); border-color: var(--status-danger); background: var(--status-danger-soft); }
.btn.sm { padding: var(--sp-1) var(--sp-4); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn.icon { width: 30px; height: 30px; padding: 0; border-radius: var(--r-md); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
/* Icon slot for Button({icon}) — no current caller passes one (grep
   confirms), but the class is real, reachable code, same reasoning as
   views.css's .combo block. */
.btn-ico { display: inline-flex; }
/* :hover rules come AFTER the variant rules on purpose: .btn:hover and
   .btn.primary/.btn.danger are equal specificity (0,2,0), so source order
   decides the winner on a tie. Putting the states last means hovering a
   primary/danger button actually changes it instead of losing silently to
   the variant rule that happens to sit below it. */
.btn:hover { background: var(--border-soft); border-color: var(--text-mute); }
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn.danger:hover { background: var(--status-danger); color: var(--on-status); border-color: var(--status-danger); }

/* ── Tag: one implementation for every chip/pill/badge in the app ── */
.tag {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: 0.2px;
  padding: 2px var(--sp-2); border-radius: var(--r-xs);
  border: 1px solid var(--border); background: var(--surface-raised);
  color: var(--text-dim); white-space: nowrap;
}
.tag.chip { border-radius: var(--r-full); padding: 2px var(--sp-3); font-size: var(--fs-xs); font-weight: var(--fw-semi); }
.tag.mono span:last-child { font-family: var(--mono); }
.tag b { color: var(--text-mute); font-weight: var(--fw-bold); text-transform: uppercase; font-size: var(--fs-2xs); }
.tag.act { cursor: pointer; }
.tag.act:hover { border-color: var(--accent); color: var(--accent); }
.tag.t-ok { color: var(--status-ok); background: var(--status-ok-soft); }
.tag.t-warn { color: var(--status-warn); background: var(--status-warn-soft); }
.tag.t-danger { color: var(--status-danger); background: var(--status-danger-soft); }
.tag.t-opus { color: var(--model-opus); background: var(--model-opus-soft); }
.tag.t-sonnet { color: var(--model-sonnet); background: var(--model-sonnet-soft); }
.tag.t-haiku { color: var(--model-haiku); background: var(--model-haiku-soft); }
.tag.t-fable { color: var(--model-fable); background: var(--model-fable-soft); }

/* ── Dot ── */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot.active { background: var(--status-ok); box-shadow: 0 0 6px var(--status-ok); }
.dot.idle { background: var(--text-mute); }
.dot.error { background: var(--status-danger); box-shadow: 0 0 6px var(--status-danger); }

/* ── Utility ── */
.mt-block { margin-top: var(--sp-6); }

/* ── Card ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-sm);
}
.card .head {
  padding: var(--sp-6) var(--sp-8); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
}
.card .head h2 { font-size: var(--fs-xl); margin: 0; font-weight: var(--fw-bold); color: var(--text); }
.card .head .head-right { display: flex; align-items: center; gap: var(--sp-4); }
.card .head .count { font-size: var(--fs-sm); color: var(--text-dim); }
.card .body.tight { padding: 0; }

/* ── Empty / Spinner ── */
.empty { padding: 40px var(--sp-7); text-align: center; color: var(--text-mute); font-size: var(--fs-md); }
.loading-row { display: flex; align-items: center; justify-content: center; gap: var(--sp-5); padding: 32px var(--sp-7); color: var(--text-mute); font-size: var(--fs-md); }
.spinner {
  width: 16px; height: 16px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Menu ── */
.menu-wrap { position: relative; flex: 0 0 auto; }
.menu {
  position: absolute; right: 0; bottom: calc(100% + var(--sp-3)); width: 214px;
  z-index: var(--z-menu); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow); padding: var(--sp-1); display: none;
}
.menu-wrap.open .menu { display: block; }
.menu-item {
  width: 100%; text-align: left; font: inherit; font-size: var(--fs-sm);
  font-weight: var(--fw-semi); padding: var(--sp-2) var(--sp-4); border-radius: var(--r-sm);
  border: none; background: transparent; color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; gap: var(--sp-3);
}
.menu-item:hover { background: var(--surface-raised); color: var(--text); }
.menu-item.danger { color: var(--status-danger); }
.menu-item.danger:hover { background: var(--status-danger-soft); }
.menu-item .k { width: 15px; text-align: center; opacity: 0.85; }
.menu hr { border: none; border-top: 1px solid var(--border); margin: var(--sp-1) 2px; }

/* ── Segmented / Field ── */
.seg { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.seg-label { font-size: var(--fs-sm); color: var(--text-mute); min-width: 60px; text-transform: uppercase; letter-spacing: 0.4px; }
.seg-options { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field-label { font-size: var(--fs-sm); color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.4px; }
.field-input {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--text); padding: var(--sp-3) var(--sp-5); font: inherit; font-size: var(--fs-md);
}
.field-input:focus { outline: none; border-color: var(--accent); }

/* ── Pager ── */
.pager { display: flex; align-items: center; justify-content: center; gap: var(--sp-6); padding: var(--sp-5) var(--sp-7); border-top: 1px solid var(--border); }
.pager-info { font-family: var(--mono); font-size: var(--fs-sm); color: var(--text-mute); min-width: 90px; text-align: center; }
.pager-size { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text-dim); font: inherit; font-size: var(--fs-sm); padding: var(--sp-1) var(--sp-3); cursor: pointer; }

/* ── Tabs ── */
.tabs { display: flex; gap: var(--sp-1); overflow-x: auto; border-bottom: 1px solid var(--border); }
.tab {
  font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semi); cursor: pointer;
  white-space: nowrap; display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-5); background: transparent; color: var(--text-mute);
  border: 1px solid transparent; border-bottom: none;
  border-radius: var(--r-lg) var(--r-lg) 0 0; margin-bottom: -1px;
}
.tab:hover { color: var(--text-dim); background: var(--surface-raised); }
/* The selected tab wears the TERMINAL's background, which is now the session's
   theme rather than one global colour: the tab is both a preview of the theme
   and the visual continuation of the pane below it. The bar between them is
   mixed off the same colour, so the three read as one object. */
.tab.on { background: var(--term-bg); color: var(--text); border-color: var(--border); border-bottom-color: var(--term-bg); cursor: default; }

/* Eight-square palette preview: background, three accents, foreground, three more. */
.term-chip {
  width: 34px; height: 22px; border-radius: var(--r-sm); overflow: hidden; flex: none;
  display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr 1fr;
  border: 1px solid var(--border);
}
.term-chip i { display: block; }

/* A menu whose toggle carries a chip and a name needs room; the icon-only
   variant stays square. */
/* Quiet by default, like the buttons beside it. The filled look it had read as
   a pressed toggle rather than a menu waiting to be opened. */
.btn.menu-btn.wide {
  width: auto; padding: var(--sp-2) var(--sp-4);
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
}
.btn.menu-btn.wide:hover { background: var(--surface-raised); color: var(--text); }
.menu-wrap.open .btn.menu-btn.wide { background: var(--surface-raised); color: var(--text); }
.term-theme-toggle {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); font-weight: var(--fw-semi);
}
.term-theme-toggle .tt-label { letter-spacing: .02em; }
.term-theme-toggle .term-chip { width: 22px; height: 15px; border-radius: var(--r-xs); }
.term-theme-toggle .own-dot {
  width: 5px; height: 5px; border-radius: var(--r-full); background: var(--accent); flex: none;
}
.menu-item .term-chip { width: 24px; height: 16px; border-radius: var(--r-xs); }
/* The tick sits at the end of the row, so the labels stay aligned whether or
   not a row is the selected one. */
.menu-item { position: relative; }
.menu-item .menu-tick { margin-left: auto; color: var(--accent); font-size: var(--fs-xs); }
.menu-item.on { color: var(--text); }
/* Reordering: the dragged tab follows the pointer while the strip reflows
   under it, so the arrangement is visible before it is dropped. */
.tab { user-select: none; -webkit-user-select: none; }
.tab.dragging { opacity: 0.7; cursor: grabbing; box-shadow: var(--shadow); }
/* Only while a drag is live, so the strip still scrolls under a finger. */
.tabs.reordering { touch-action: none; cursor: grabbing; }

/* ── Modal ── */
#modal-root {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
#modal-root > * { pointer-events: auto; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal); display: flex; align-items: center; justify-content: center;
  padding: var(--sp-8);
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  width: 480px; max-width: 100%; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column; box-shadow: var(--shadow);
  z-index: var(--z-modal); animation: modal-zoom var(--t-med) cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
@keyframes modal-zoom { 0% { transform: scale(0.95); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.modal .head { padding: var(--sp-6) var(--sp-7); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal .head h2 { font-size: var(--fs-xl); margin: 0; font-weight: var(--fw-bold); }
.modal .body { padding: var(--sp-7); overflow-y: auto; }
.modal .body > h3 { margin: 0 0 var(--sp-6); font-size: var(--fs-xl); font-weight: var(--fw-bold); }
.modal .body > p { margin: 0 0 var(--sp-5); color: var(--text-dim); font-size: var(--fs-md); }
.modal .actions { display: flex; justify-content: flex-end; gap: var(--sp-4); margin-top: var(--sp-6); padding-top: var(--sp-6); border-top: 1px solid var(--border-soft); }

@media (max-width: 720px) {
  .modal { min-width: 280px; max-width: calc(100vw - 24px); }
  /* 24px of backdrop on every side is a tenth of a phone's height spent on
     nothing; and 100vh there is measured behind the browser's bars. */
  .modal-backdrop { padding: var(--sp-3); }
  .modal { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
}

/* ── Update banner ──
   Bottom-centre so it never covers the topbar or the mobile drawer button, and
   above the modal layer's backdrop but below a modal itself. */
.update-banner {
  position: fixed; left: 50%; bottom: var(--sp-7); transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex; align-items: center; gap: var(--sp-4);
  max-width: calc(100vw - var(--sp-8));
  padding: var(--sp-4) var(--sp-5) var(--sp-4) var(--sp-6);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-full);
  box-shadow: var(--shadow);
  font-size: var(--fs-sm);
  animation: update-rise var(--t-med) cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes update-rise { 0% { transform: translate(-50%, 12px); opacity: 0; }
                       100% { transform: translate(-50%, 0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .update-banner { animation: none; } }
.update-banner .update-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.update-banner .update-text { min-width: 0; }
.update-banner .update-text strong { font-weight: var(--fw-semi); }
.update-banner .btn { flex: none; }
.update-banner .update-x {
  flex: none; background: none; border: none; cursor: pointer;
  color: var(--text-mute); font: inherit; font-size: var(--fs-sm);
  padding: 0 var(--sp-2);
}
.update-banner .update-x:hover { color: var(--text); }
.update-banner .update-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 560px) {
  .update-banner { left: var(--sp-5); right: var(--sp-5); transform: none; max-width: none; }
  @keyframes update-rise { 0% { transform: translateY(12px); opacity: 0; }
                         100% { transform: translateY(0); opacity: 1; } }
}

/* ── Toast ── */
#toast-root {
  position: fixed; top: var(--sp-8); left: 50%; transform: translateX(-50%);
  z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--sp-3);
}
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--blue); color: var(--text);
  padding: var(--sp-5) var(--sp-8); border-radius: var(--r-md);
  font-weight: var(--fw-semi); font-size: var(--fs-md); box-shadow: var(--shadow);
  animation: toast-in 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  display: flex; align-items: center; gap: var(--sp-4);
}
.toast.err { border-left-color: var(--status-danger); }
@keyframes toast-in { 0% { transform: translateY(-20px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }

/* ── Table ── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); text-align: left; border-bottom: 1px solid var(--border-soft); }
.table th { color: var(--text-mute); font-weight: var(--fw-bold); text-transform: uppercase; font-size: var(--fs-2xs); cursor: pointer; }
.table th.sorted { color: var(--accent); }
.table td.right, .table th.right { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover td { background: var(--surface-raised); }

/* ── Composite: AgentIcon ──
   Own styling for the moved agentIcon() component. Not in the Step-2 list of
   selectors to cut, but it's the moved component's own visual identity, so it
   travels with it rather than sitting orphaned in style.css. The dark chip
   background/border are deliberately NOT theme tokens — the brand logos carry
   white fills and need a fixed dark backdrop to read in the light theme too. */
.agent-chip { font-size: var(--fs-lg); line-height: 1; text-align: center; }
.agent-logo-chip {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: #0f1320;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-sm);
  vertical-align: middle;
}
.agent-logo-chip .agent-logo { width: 64%; height: 64%; display: block; }
.agent-emoji { display: inline-flex; align-items: center; justify-content: center; line-height: 1; vertical-align: middle; }

/* ── Composite: MetricCard ── */
.metrics-grid {
  display: grid;
  /* auto-fit with a floor sized so the widest card this grid lives in (the
     dashboard's System card) lands on four across, and the System
     page's narrower cards on three (measured: 828px of content fits four
     180px tracks, 588px fits three). A fixed column count was tried and rejected: a card with a single
     tile (Storage, one disk) then left three empty quarters, whereas auto-fit
     collapses the unused tracks and the lone tile takes the width. */
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
}
.metric {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-1);
  transition: all var(--t-fast) ease;
}
.metric:hover { border-color: var(--blue); transform: translateY(-2px); }
.metric .label { font-size: var(--fs-2xs); font-weight: var(--fw-bold); text-transform: uppercase; color: var(--text-dim); }
.metric .value { font-size: var(--fs-xl); font-weight: var(--fw-black); letter-spacing: -0.5px; }
.metric .sub { font-size: var(--fs-2xs); color: var(--text-mute); }
/* .bar's own track/fill radius (2px) has no matching step below --r-xs (4px);
   doubling a 4px-tall bar's rounding would visibly distort it, so it stays a
   literal exception. Same for the track's translucent tint: no status/model
   token fits a "faint divider line" role, so it borrows --border-soft, which
   already flips correctly per theme (the old rgba(255,255,255,0.03) did not). */
.metric .bar { height: var(--sp-1); background: var(--border-soft); border-radius: 2px; overflow: hidden; margin-top: var(--sp-1); }
.metric .bar i { display: block; height: 100%; background: linear-gradient(to right, var(--blue), #00bcff); border-radius: 2px; transition: width 0.6s ease; }
.metric .bar i.hot { background: linear-gradient(to right, var(--status-danger), #ff6b6b); }
.metric .bar i.warm { background: linear-gradient(to right, var(--status-warn), #ffc83d); }

/* ── Composite: SessionRow ──
   .dot styling is NOT redeclared here — Dot's own global rule above already
   covers it byte-for-byte (8px circle, active=green+glow, idle=mute).
   SessionRow renders the model through Tag's tone (.tag.t-<model>); the old
   .session-row .badge* per-model-colour rules were deleted with style.css
   (Task 17). */
.session-row {
  display: grid;
  /* The status dot and the agent icon read as one unit, so they sit tight
     together; the name column is the one that should absorb the width, and
     minmax(0,1fr) lets it actually shrink-and-grow instead of being pushed
     out by the metadata columns' content. */
  grid-template-columns: 14px auto minmax(0, 1fr) auto auto auto auto auto;
  column-gap: var(--sp-4); row-gap: var(--sp-1); align-items: center;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--t-fast) ease;
}
.session-row .agent-chip { margin-left: calc(var(--sp-4) * -1 + var(--sp-2)); }
.session-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-row .dir { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-row:hover { background: var(--surface-raised); transform: translateX(4px); }
.session-row:last-child { border-bottom: none; }
.session-row .name { font-weight: var(--fw-semi); font-size: var(--fs-md); }
.session-row .dir { color: var(--text-dim); font-size: var(--fs-sm); font-family: var(--mono); }
.session-row .uptime { color: var(--text-dim); font-size: var(--fs-sm); text-align: right; }
.session-row .ctx { font-family: var(--mono); font-size: var(--fs-sm); font-weight: var(--fw-semi); text-align: right; }
.session-row .ctx.warn { color: var(--status-warn); }
.session-row .ctx.high { color: var(--status-danger); }

/* ── Composite: AlertRow ── */
.alert {
  padding: var(--sp-5) var(--sp-7);
  border-bottom: 1px solid var(--border);
  display: flex; gap: var(--sp-5); align-items: flex-start;
  transition: background var(--t-fast) ease;
}
.alert:hover { background: var(--surface-raised); }
/* Unread: everything that landed after the last visit to this screen. An inset
   bar rather than a border, so flagging a row never shifts the list. */
.alert.unread { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.alert.unread:hover { background: var(--accent-soft); }
.alert .time { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-mute); white-space: nowrap; padding-top: var(--sp-1); }
.alert .body { font-size: var(--fs-md); line-height: 1.5; flex: 1; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.alert .kind {
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); text-transform: uppercase;
  border-radius: var(--r-xs); padding: 1px var(--sp-2); margin-right: var(--sp-3);
  display: inline-block; font-family: var(--mono);
}
.alert .kind.crash, .alert .kind.disk { background: var(--status-danger-soft); color: var(--status-danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.alert .kind.restart { background: var(--status-warn-soft); color: var(--status-warn); border: 1px solid rgba(245, 158, 11, 0.2); }
.alert .kind.question { background: var(--accent-soft); color: var(--accent-deep); border: 1px solid var(--accent); }
.alert .kind.finished { background: var(--status-ok-soft); color: var(--status-ok); border: 1px solid rgba(16, 185, 129, 0.2); }
.alert .kind.boot { background: var(--blue-soft); color: var(--blue); border: 1px solid var(--blue-soft); }
.alert .name { font-weight: var(--fw-semi); color: var(--blue); margin-right: var(--sp-1); }
.alert .msg { color: var(--text); }

/* ── Composite: ResumableRow ──
   ResumableRow renders the model through Tag's tone, same as SessionRow; the
   old .resumable-row .rsm-tag* per-model-colour rules were deleted with
   style.css (Task 17). */
.resumable-row { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-6); align-items: start; padding: var(--sp-6) var(--sp-7); border-bottom: 1px solid var(--border); }
.resumable-row:last-child { border-bottom: none; }
/* The grid's first column (folder tag + title + preview + meta line) —
   min-width:0 so a long title/preview can ellipsis/wrap instead of
   overflowing the 1fr track (a plain grid item defaults to its content's
   intrinsic width, not the track width). */
.resumable-row .rsm-main { min-width: 0; }
.resumable-row .title { font-weight: var(--fw-bold); font-size: var(--fs-lg); }
.resumable-row .preview { color: var(--text-dim); font-size: var(--fs-sm); margin-top: var(--sp-1); line-height: 1.5; }
.resumable-row .rsm-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); margin-top: var(--sp-4); }
.resumable-row .rsm-meta-item { font-size: var(--fs-xs); color: var(--text-mute); display: inline-flex; gap: var(--sp-2); }
.resumable-row .rsm-meta-item .rsm-meta-k { text-transform: uppercase; font-size: var(--fs-2xs); font-weight: var(--fw-bold); opacity: 0.7; }
.resumable-row .rsm-meta-item .rsm-meta-v { font-family: var(--mono); color: var(--text-dim); }
.resumable-row .rsm-meta-item .rsm-meta-v.warn { color: var(--status-warn); }
.resumable-row .rsm-meta-item .rsm-meta-v.high { color: var(--status-danger); }
.resumable-row .rsm-actions { display: flex; gap: var(--sp-3); align-items: center; }
.resumable-row .icon-btn { background: transparent; border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; padding: var(--sp-2) var(--sp-5); border-radius: var(--r-md); font-size: var(--fs-md); font-weight: var(--fw-semi); transition: all var(--t-fast) ease; }
.resumable-row .icon-btn:hover { background: var(--status-danger-soft); color: var(--status-danger); border-color: var(--status-danger); }
.resumable-row .rsm-folder { font-family: var(--mono); font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--accent); background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--r-xs); padding: 1px var(--sp-2); display: inline-block; margin-bottom: var(--sp-2); }

/* ── Composite: MetaStrip ──
   MetaStrip's model chip renders through Tag's tone; the old .mtag.model
   hardcoded-purple rule was deleted with style.css (Task 17). Every other
   chip (ctx/effort/mode/up/last/turn/wd/id/status) still uses .mtag. */
.mtags { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.mtag {
  font-family: var(--mono); font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: 0.2px;
  padding: 2px var(--sp-2); border-radius: var(--r-xs); border: 1px solid var(--border);
  background: var(--surface-raised); color: var(--text-dim);
  display: inline-flex; gap: var(--sp-1); align-items: center;
}
.mtag b { color: var(--text-mute); font-weight: var(--fw-bold); text-transform: uppercase; font-size: var(--fs-2xs); }
.mtag.ok { color: var(--status-ok); background: var(--status-ok-soft); }
.mtag.warn { color: var(--status-warn); background: var(--status-warn-soft); }
.mtag.high { color: var(--status-danger); background: var(--status-danger-soft); }
.mtag.act { cursor: pointer; }
.mtag.act:hover { border-color: var(--accent); color: var(--accent); }

/* ── Composite: Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-6); margin-bottom: var(--sp-8);
  border-bottom: 1px solid var(--border-soft); padding-bottom: var(--sp-6);
  flex-wrap: wrap;
}
.topbar h1 {
  font-size: var(--fs-3xl); font-weight: var(--fw-black); margin: 0; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text) 50%, var(--text-dim));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.topbar .subtitle { color: var(--text-dim); font-size: var(--fs-md); margin-top: var(--sp-1); }
/* Actions render inside their own flex row now (Topbar wraps them in
   .topbar-actions instead of spreading them as direct .topbar children), so
   they need their own gap here to keep multiple actions from sitting flush.
   This also makes align-self:center below apply again (it targets the
   nearest flex ancestor, which is now .topbar-actions, not .topbar). */
.topbar-actions { display: flex; align-items: center; gap: var(--sp-6); }
.topbar .btn, .topbar a.btn { align-self: center; }

/* ── Composite: SearchBar ──
   Same class names the Resume screen's search bar used when it was still
   built inline in webui/app.js renderResume() (pre-Task-14), so adopting the
   component in webui/js/views/resume.js was a relocation, not a behaviour
   change. */
.rsm-searchbar { padding: var(--sp-5) var(--sp-6); margin-bottom: var(--sp-6); }
.rsm-search-row { display: flex; align-items: center; gap: var(--sp-4); }
.rsm-search-icon { font-size: var(--fs-lg); opacity: 0.7; flex: 0 0 auto; }
.rsm-search { flex: 1 1 auto; min-width: 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text); padding: var(--sp-3) var(--sp-5); font: inherit; font-size: var(--fs-md); }
.rsm-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rsm-search::placeholder { color: var(--text-mute); }
.rsm-clear { flex: 0 0 auto; background: transparent; border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; padding: var(--sp-2) var(--sp-4); border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: var(--fw-semi); transition: all var(--t-fast) ease; }
.rsm-clear:hover { background: var(--surface-raised); color: var(--text); }
.rsm-filters { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-8); align-items: center; margin-top: var(--sp-5); }
.rsm-filters > * { margin-bottom: 0 !important; }
@media (max-width: 720px) {
  /* A barra fica ancorada no topo enquanto os resultados rolam, então tudo
     que ela ocupa é tela perdida para sempre. Quebrando linha, os cinco
     agentes mais os quatro prazos empilham em três fileiras e a barra come
     um quarto de um celular. Numa fileira só, que rola para o lado, ela
     ocupa pouco mais que o campo de busca. */
  .rsm-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* O respiro lateral do card, para o último chip não colar na borda. */
    padding-bottom: var(--sp-1);
  }
  .rsm-filters::-webkit-scrollbar { display: none; }
  .rsm-filters > * { flex: 0 0 auto; }
}

/* A column of Fields, e.g. inside a modal. */
.field-stack { display: flex; flex-direction: column; gap: var(--sp-5); margin-bottom: var(--sp-5); }

/* On a phone the floor drops so two still fit side by side. */
@media (max-width: 720px) { .metrics-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); } }

/* ── Command palette (js/views/palette.js) ──
   Top-anchored like every palette, so the list grows down and the field never
   moves under the cursor while the results change. Above a modal: it can be
   opened from inside one. */
.pal-open {
  height: 32px; padding: 0 var(--sp-3) 0 var(--sp-4); border-radius: var(--r-md);
  display: inline-flex; align-items: center; gap: var(--sp-3);
  background: transparent; border: 1px solid var(--border); color: var(--fg-dim);
  font: inherit; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap;
}
.pal-open svg { width: 14px; height: 14px; }
/* The label only earns its width in the phone drawer; the top bar is full. */
.pal-open-label { display: none; }
.pal-open:hover { color: var(--fg); border-color: var(--border-strong); }
.pal-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pal-open kbd, .pal-card kbd {
  font-family: var(--mono); font-size: var(--fs-xs); color: var(--fg-mute);
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 var(--sp-2);
  background: var(--bg-elev-2);
}
.pal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-toast);
  background: rgba(0, 0, 0, 0.55);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh var(--sp-6) var(--sp-6);
}
.pal-card {
  width: 600px; max-width: 100%; max-height: 70vh;
  display: flex; flex-direction: column;
  background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  box-shadow: var(--shadow); overflow: hidden;
}
.pal-search {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
}
.pal-icon { color: var(--fg-mute); font-size: var(--fs-lg); line-height: 1; }
.pal-search .pal-field {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: var(--sp-2) 0;
  font-family: var(--font-sans); font-size: var(--fs-lg); color: var(--fg);
}
.pal-search .pal-field:focus, .pal-search .pal-field:focus-visible { outline: none; box-shadow: none; }
.pal-list { overflow-y: auto; padding: var(--sp-2); }
.pal-group {
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
  font-size: var(--fs-xs); color: var(--fg-mute);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.pal-item {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  cursor: pointer; color: var(--fg);
}
.pal-item.active { background: var(--bg-elev-2); }
.pal-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-hint {
  max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--fs-sm); color: var(--fg-mute);
}
.pal-hint.attention { color: var(--attention); }
.pal-empty { padding: var(--sp-6) var(--sp-4); color: var(--fg-mute); font-size: var(--fs-sm); }
.pal-foot {
  display: flex; gap: var(--sp-6); padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--fg-mute);
}
.pal-foot kbd { margin-right: 2px; }
@media (max-width: 720px) {
  .pal-backdrop { padding: var(--sp-6) var(--sp-3); }
  .pal-card { max-height: 80vh; max-height: 80dvh; }
  .pal-foot { display: none; }
  .pal-open { width: 100%; justify-content: flex-start; }
  .pal-open-label { display: inline; }
  .pal-open kbd { margin-left: auto; }
}
