/* Nomapay Agents. Calm, spacious, trustworthy. One accent (Nomapay green), status colours that
   always come with a word and an icon, an 8px spacing scale, light and dark themes. */

/* ---------- tokens ---------- */
:root {
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-xl: 20px; --r-pill: 999px;

  --fs-xs: 12px; --fs-sm: 13px; --fs: 15px; --fs-md: 16px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 28px; --fs-3xl: 34px;

  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #f1f3f0;
  --surface-3: #e8ebe7;
  --border: #e2e6e1;
  --border-strong: #cfd5ce;
  --text: #121614;
  --text-2: #4a524d;
  --text-3: #6d756f;
  --shadow-sm: 0 1px 2px rgba(18, 22, 20, .05);
  --shadow: 0 1px 2px rgba(18, 22, 20, .04), 0 4px 16px rgba(18, 22, 20, .06);
  --shadow-lg: 0 12px 40px rgba(18, 22, 20, .16);

  --accent: #0b7a4b;
  --accent-hover: #086a40;
  --accent-text: #0a6b42;
  --accent-soft: #e5f3ec;
  --on-accent: #ffffff;

  --info: #2457c5; --info-soft: #e9effc;
  --ok: #157347; --ok-soft: #e4f3ea;
  --warn: #8a5a00; --warn-soft: #fdf3dc; --warn-border: #f0d595;
  --danger: #b42318; --danger-soft: #fdecea;
  --neutral: #5c645f; --neutral-soft: #eef0ed;
  --discuss: #6b4bb8; --discuss-soft: #f1ecfb;

  --focus: 0 0 0 3px rgba(11, 122, 75, .35);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --sidebar: 248px;
  color-scheme: light;
}

:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1311; --surface: #161b18; --surface-2: #1c221e; --surface-3: #242b26;
    --border: #273029; --border-strong: #354037;
    --text: #e8ece9; --text-2: #b4bdb7; --text-3: #8d978f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35); --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
    --accent: #2fbf7d; --accent-hover: #4fd394; --accent-text: #5ad89c; --accent-soft: #143224; --on-accent: #06140d;
    --info: #8fb0ff; --info-soft: #18243d; --ok: #5ad89c; --ok-soft: #143224;
    --warn: #f2c35b; --warn-soft: #2e2512; --warn-border: #5c4718; --danger: #ff8f84; --danger-soft: #3a1a17;
    --neutral: #aab3ad; --neutral-soft: #222924; --discuss: #c0a8ff; --discuss-soft: #2a2140;
    --focus: 0 0 0 3px rgba(47, 191, 125, .45);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1311; --surface: #161b18; --surface-2: #1c221e; --surface-3: #242b26;
  --border: #273029; --border-strong: #354037;
  --text: #e8ece9; --text-2: #b4bdb7; --text-3: #8d978f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35); --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
  --accent: #2fbf7d; --accent-hover: #4fd394; --accent-text: #5ad89c; --accent-soft: #143224; --on-accent: #06140d;
  --info: #8fb0ff; --info-soft: #18243d; --ok: #5ad89c; --ok-soft: #143224;
  --warn: #f2c35b; --warn-soft: #2e2512; --warn-border: #5c4718; --danger: #ff8f84; --danger-soft: #3a1a17;
  --neutral: #aab3ad; --neutral-soft: #222924; --discuss: #c0a8ff; --discuss-soft: #2a2140;
  --focus: 0 0 0 3px rgba(47, 191, 125, .45);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs)/1.55 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: var(--fs-2xl); font-weight: 680; letter-spacing: -.02em; }
h2 { font-size: var(--fs-lg); font-weight: 640; }
h3 { font-size: var(--fs-md); font-weight: 620; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
code, kbd, pre { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 1px 6px; overflow-wrap: anywhere; }
kbd { display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--text-2); font-size: 11px; line-height: 18px; text-align: center; }
pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
ul, ol { margin: 0; padding: 0; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
::selection { background: var(--accent-soft); }
.icon { flex: none; display: inline-block; vertical-align: -3px; }
.muted { color: var(--text-3); }
.text-warn { color: var(--warn); }
.mono { font-family: var(--mono); font-size: var(--fs-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--s4); top: -60px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: var(--s2) var(--s4); border-radius: var(--r); font-weight: 600; }
.skip-link:focus { top: var(--s4); }
.noscript { padding: var(--s6); text-align: center; }

/* ---------- boot ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); animation: breathe 1.4s var(--ease) infinite; }
@keyframes breathe { 0%, 100% { opacity: .35; transform: scale(.94); } 50% { opacity: 1; transform: scale(1); } }

/* ---------- layout ---------- */
.layout { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 20;
  display: flex; flex-direction: column; gap: var(--s4); padding: var(--s5) var(--s4) var(--s4);
  background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; padding: 0 var(--s2); }
.brand:hover { color: var(--text); }
.brand-mark .brand-bg { fill: var(--accent); }
.brand-mark .brand-fg { stroke: var(--on-accent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: var(--fs-md); letter-spacing: -.01em; }
.brand-text span { font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; letter-spacing: .02em; }
.new-btn { justify-content: flex-start; margin-top: var(--s2); }
.new-btn kbd { margin-left: auto; background: transparent; color: inherit; border-color: color-mix(in srgb, var(--on-accent) 45%, transparent); opacity: .85; }
.side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: var(--s2); }
.side-link {
  display: flex; align-items: center; gap: var(--s3); width: 100%; padding: 9px var(--s3); border-radius: var(--r);
  color: var(--text-2); text-decoration: none; font-weight: 520; border: 0; background: none; cursor: pointer; text-align: left;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 620; }
.badge { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--warn); color: var(--surface); font-size: var(--fs-xs); font-weight: 700; line-height: 20px; text-align: center; }
.badge[hidden] { display: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: var(--s3); border-top: 1px solid var(--border); }
.side-foot .side-link { font-size: var(--fs-sm); padding: 7px var(--s3); }
.me { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s2) 0; min-width: 0; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.me-text strong { font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text span { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar, .tabbar { display: none; }
.layout > main#main { margin-left: var(--sidebar); min-height: 100vh; outline: none; }
.demo-banner {
  position: fixed; z-index: 30; right: var(--s4); bottom: var(--s4); display: flex; align-items: center; gap: var(--s2);
  padding: 6px 12px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: var(--fs-xs); color: var(--text-2);
}

.page { max-width: 1120px; margin: 0 auto; padding: var(--s6) var(--s6) var(--s8); display: flex; flex-direction: column; gap: var(--s5); }
.page-narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); }
.page-sub { margin-top: var(--s2); color: var(--text-2); max-width: 68ch; }
.back { display: inline-flex; align-items: center; gap: var(--s1); color: var(--text-3); text-decoration: none; font-weight: 520; font-size: var(--fs-sm); width: fit-content; margin-bottom: calc(-1 * var(--s3)); }
.back:hover { color: var(--text); }

/* ---------- buttons, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 40px; padding: 0 var(--s4); border-radius: var(--r); border: 1px solid transparent;
  font-weight: 600; font-size: var(--fs); line-height: 1; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-sm { min-height: 32px; padding: 0 var(--s3); font-size: var(--fs-sm); }
.btn-lg { min-height: 48px; padding: 0 var(--s5); font-size: var(--fs-md); }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--on-accent); border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.input {
  width: 100%; min-height: 42px; padding: 9px var(--s3); border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); color: var(--text); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input::placeholder { color: var(--text-3); opacity: 1; }
.input:hover { border-color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
textarea.input { resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field-label { font-weight: 620; font-size: var(--fs-sm); color: var(--text); padding: 0; }
.optional { color: var(--text-3); font-weight: 400; }
.help { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.5; }
.help .icon { vertical-align: -2px; margin-right: 4px; }
.field-foot { display: flex; justify-content: space-between; gap: var(--s3); }
.counter { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.check-row { display: flex; gap: var(--s3); align-items: flex-start; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check-row > span { display: flex; flex-direction: column; gap: 2px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.align-start { align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack-lg { display: flex; flex-direction: column; gap: var(--s5); }
.form-actions { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.chips-label { font-size: var(--fs-sm); color: var(--text-3); margin-right: 2px; }
.chip {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); border-radius: var(--r-pill);
  padding: 5px 12px; font-size: var(--fs-sm); font-weight: 520; cursor: pointer; transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent-text); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); font-weight: 620; }

/* pills: status words with an icon, never colour alone */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 650; line-height: 1.4; white-space: nowrap; border: 1px solid transparent;
}
.tone-info { --tone: var(--info); --tone-soft: var(--info-soft); }
.tone-ok { --tone: var(--ok); --tone-soft: var(--ok-soft); }
.tone-warn { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.tone-danger { --tone: var(--danger); --tone-soft: var(--danger-soft); }
.tone-neutral { --tone: var(--neutral); --tone-soft: var(--neutral-soft); }
.tone-accent { --tone: var(--accent-text); --tone-soft: var(--accent-soft); }
.tone-agent { --tone: var(--accent-text); --tone-soft: var(--accent-soft); }
.pill { color: var(--tone); background: var(--tone-soft); }

/* ---------- panels, cards ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: var(--s4); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.panel-head h2 { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-md); }
.panel-head h2 .icon { color: var(--text-3); }
.panel-sub { flex-basis: 100%; color: var(--text-3); font-size: var(--fs-sm); }
.callout { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--tone-soft); color: var(--text); font-size: var(--fs-sm); line-height: 1.5; }
.callout .icon { color: var(--tone); margin-top: 1px; }
.callout.tone-warn { border: 1px solid var(--warn-border); }

/* ---------- sessions home ---------- */
.toolbar { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.toolbar > .select { width: auto; min-width: 200px; }
.search { position: relative; flex: 1 1 320px; display: flex; align-items: center; }
.search > .icon { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.search-input { padding-left: 38px; padding-right: 40px; }
.search-kbd { position: absolute; right: 10px; }
.search-input:focus + .search-kbd { display: none; }
.groups { display: flex; flex-direction: column; gap: var(--s6); }
.group { display: flex; flex-direction: column; gap: var(--s3); }
.group-head { display: flex; align-items: center; gap: var(--s2); }
.group-head h2 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); font-weight: 700; }
.count { min-width: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); font-weight: 700; line-height: 20px; text-align: center; }
.group-needs_you .group-head h2 { color: var(--warn); }
.group-needs_you .count { background: var(--warn-soft); color: var(--warn); }
.group-empty { display: flex; gap: var(--s2); align-items: center; padding: var(--s4); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); color: var(--text-3); font-size: var(--fs-sm); }
.group-empty .icon { color: var(--ok); }
details.group-stopped > summary { list-style: none; cursor: pointer; width: fit-content; }
details.group-stopped > summary::-webkit-details-marker { display: none; }
details.group-stopped > summary .icon { color: var(--text-3); transition: transform .2s var(--ease); }
details.group-stopped[open] > summary .icon { transform: rotate(180deg); }
.cards { list-style: none; display: flex; flex-direction: column; gap: var(--s2); }
.card {
  display: flex; align-items: flex-start; gap: var(--s4); padding: var(--s4) var(--s5); border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}
a.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); color: var(--text); }
a.card:active { transform: scale(.997); }
.card-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone); margin-top: 2px; }
.session-card[data-tone="info"] { --tone: var(--info); --tone-soft: var(--info-soft); }
.session-card[data-tone="ok"] { --tone: var(--ok); --tone-soft: var(--ok-soft); }
.session-card[data-tone="warn"] { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.session-card[data-tone="danger"] { --tone: var(--danger); --tone-soft: var(--danger-soft); }
.session-card[data-tone="neutral"] { --tone: var(--neutral); --tone-soft: var(--neutral-soft); }
.session-card[data-tone="accent"] { --tone: var(--accent-text); --tone-soft: var(--accent-soft); }
.group-needs_you .card { border-color: var(--warn-border); box-shadow: 0 0 0 1px var(--warn-soft), var(--shadow-sm); }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.card-title { font-size: var(--fs-md); font-weight: 620; line-height: 1.35; }
.card-cta { display: flex; align-items: center; gap: 4px; font-size: var(--fs-sm); font-weight: 600; color: var(--warn); }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: var(--fs-sm); color: var(--text-3); }
.meta-item { display: inline-flex; align-items: center; gap: 5px; }
.meta-item.repo { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.inline-person { display: inline-flex; align-items: center; gap: 6px; }
.card-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cost { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* avatars */
.avatar { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.avatar[data-size="16"] { width: 16px; height: 16px; font-size: 7px; }
.avatar[data-size="20"] { width: 20px; height: 20px; font-size: 8px; }
.avatar[data-size="22"] { width: 22px; height: 22px; font-size: 9px; }
.avatar[data-size="24"] { width: 24px; height: 24px; font-size: 9px; }
.avatar[data-size="32"] { width: 32px; height: 32px; font-size: 12px; }
.avatar[data-size="56"] { width: 56px; height: 56px; font-size: 20px; }
.avatar[data-hue="0"] { background: #e8eefc; color: #2f4e96; } .avatar[data-hue="1"] { background: #e6f4ee; color: #1d6a45; }
.avatar[data-hue="2"] { background: #fbeee4; color: #9a4b16; } .avatar[data-hue="3"] { background: #f3e9fb; color: #6c3b98; }
.avatar[data-hue="4"] { background: #fde9ee; color: #a2304f; } .avatar[data-hue="5"] { background: #e6f3f6; color: #1d6577; }
.avatar[data-hue="6"] { background: #f6f1df; color: #7a6012; } .avatar[data-hue="7"] { background: #ecebfc; color: #4b45a8; }
.avatar[data-hue="8"] { background: #e7f2e4; color: #3a6b2c; } .avatar[data-hue="9"] { background: #f9e8e4; color: #93402c; }
.avatar[data-hue="10"] { background: #e8f0f4; color: #34596d; } .avatar[data-hue="11"] { background: #f4e7f2; color: #8a3878; }
:root[data-theme="dark"] .avatar[data-hue] { background: var(--surface-3); color: var(--text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar[data-hue] { background: var(--surface-3); color: var(--text); } }
.avatar-agent { background: var(--accent); color: var(--on-accent); }

/* empty, error, skeleton */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s3); padding: var(--s8) var(--s5); border: 1px dashed var(--border-strong); border-radius: var(--r-xl); background: var(--surface); }
.empty-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: var(--s2); }
.empty p { color: var(--text-2); max-width: 46ch; }
.empty .btn { margin-top: var(--s3); }
.error-state { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s4); border-radius: var(--r-lg); background: var(--danger-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.error-state > .icon { color: var(--danger); margin-top: 2px; }
.error-state > div { flex: 1; }
.error-state p { color: var(--text-2); font-size: var(--fs-sm); }
.skeleton-group { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton.w1 { width: 90%; } .skeleton.w2 { width: 60%; } .skeleton.w3 { width: 75%; }
.skeleton-head { height: 14px; width: 120px; }
.skeleton-title { height: 28px; margin-top: var(--s4); }
.skeleton-stepper { height: 64px; border-radius: var(--r-lg); background: var(--surface-2); }
.skeleton-card { min-height: 84px; align-items: center; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- new session ---------- */
.new-form { display: flex; flex-direction: column; gap: var(--s5); }
.prompt-input { min-height: 156px; font-size: var(--fs-md); padding: var(--s4); border-radius: var(--r-lg); }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.seg {
  text-align: left; display: flex; flex-direction: column; gap: 2px; padding: var(--s3) var(--s4); border-radius: var(--r);
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; transition: all .15s var(--ease);
}
.seg strong { font-size: var(--fs); }
.seg span { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.4; }
.seg:hover { border-color: var(--text-3); }
.seg[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.seg[aria-pressed="true"] strong { color: var(--accent-text); }
.advanced { border-top: 1px solid var(--border); padding-top: var(--s4); }
.advanced > summary { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; color: var(--text-2); font-weight: 600; list-style: none; }
.advanced > summary::-webkit-details-marker { display: none; }
.advanced-body { display: flex; flex-direction: column; gap: var(--s4); margin-top: var(--s4); }
.after-submit { display: flex; align-items: center; }

/* ---------- session page ---------- */
.page-session { max-width: 1240px; gap: var(--s4); }
.session-head { display: flex; justify-content: space-between; gap: var(--s4); align-items: flex-start; }
.head-main { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.head-pills { display: flex; gap: var(--s2); flex-wrap: wrap; }
.session-title { font-size: var(--fs-2xl); max-width: 44ch; }
.head-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-3); font-size: var(--fs-sm); }
.head-meta a { color: var(--text-2); }
.head-actions { display: flex; gap: var(--s2); flex: none; }

.flow { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4) var(--s5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.stepper { list-style: none; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); counter-reset: s; }
.stepper li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.stepper li:not(:first-child)::before {
  content: ""; position: absolute; top: 14px; right: calc(50% + 18px); left: calc(-50% + 18px); height: 2px; border-radius: 2px; background: var(--border-strong);
}
.stepper li.step-done::before, .stepper li.step-current::before, .stepper li.step-stopped::before { background: var(--accent); }
.step-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 700; border: 2px solid var(--border-strong); color: var(--text-3); background: var(--surface); position: relative; z-index: 1; }
.step-label { font-size: var(--fs-sm); color: var(--text-3); font-weight: 560; }
.step-done .step-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.step-done .step-label { color: var(--text-2); }
.step-current .step-dot { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 5px var(--accent-soft); }
.step-current .step-label { color: var(--text); font-weight: 700; }
.step-unchecked .step-dot { border-style: dashed; color: var(--text-3); background: var(--surface-2); }
.step-unchecked .step-label { color: var(--text-3); font-style: italic; }
.stepper li.step-unchecked::before { background: repeating-linear-gradient(90deg, var(--border-strong) 0 4px, transparent 4px 8px); }
.step-stopped .step-dot { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.step-stopped .step-label { color: var(--danger); font-weight: 700; }
.now { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--tone-soft); }
.now-icon { color: var(--tone); margin-top: 1px; }
.now-text { color: var(--text); }
.next-text { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.run-clock { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; font-variant-numeric: tabular-nums; }

.session-top { display: flex; flex-direction: column; gap: var(--s4); }
.session-top:empty { display: none; }
.session-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s5); align-items: start; }
.session-main { min-width: 0; display: flex; flex-direction: column; gap: var(--s3); }
.session-side { display: flex; flex-direction: column; gap: var(--s4); position: sticky; top: var(--s4); max-height: calc(100vh - 32px); overflow: auto; overscroll-behavior: contain; padding-bottom: var(--s2); scrollbar-width: thin; }
.section-head { display: flex; align-items: center; justify-content: space-between; }
.section-head h2 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); font-weight: 700; }
.live-state { font-size: var(--fs-xs); font-weight: 650; }
.live-on { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); }
.live-off { display: inline-flex; align-items: center; gap: 6px; color: var(--warn); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* transcript */
.transcript { list-style: none; display: flex; flex-direction: column; gap: var(--s2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s4); box-shadow: var(--shadow-sm); scrollbar-width: thin; }
@media (min-width: 961px) { .transcript { max-height: min(64vh, 760px); overflow-y: auto; overscroll-behavior: contain; scroll-padding-bottom: var(--s4); } }
.t-inline-detail { font-size: var(--fs-xs); color: var(--text-3); }
.t-inline-detail::before { content: "· "; }
.t-item { display: flex; gap: var(--s3); align-items: flex-start; padding: 6px var(--s1); }
.t-item.is-new { animation: enter .35s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } }
.t-icon { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone); }
.t-item.quiet { padding-top: 0; padding-bottom: 0; }
.t-item.quiet .t-icon { width: 28px; height: 22px; background: transparent; color: var(--text-3); }
.t-item.quiet .t-title { font-size: var(--fs-sm); color: var(--text-3); }
.t-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.t-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.t-time { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.t-detail { color: var(--text-2); font-size: var(--fs-sm); }
.t-quote { margin: 0; padding: var(--s2) var(--s3); border-left: 3px solid var(--warn-border); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--text); font-size: var(--fs-sm); }
.t-link { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-sm); font-weight: 600; text-decoration: none; }
.t-empty { color: var(--text-3); text-align: center; padding: var(--s5); }
.t-plan { padding: var(--s3); border-radius: var(--r); background: var(--info-soft); }
.t-plan .t-icon { background: var(--surface); }
.t-alert { padding: var(--s3); border-radius: var(--r); background: var(--tone-soft); }
.t-alert .t-icon { background: var(--surface); }
.t-question { padding: var(--s3); border-radius: var(--r); background: var(--warn-soft); border: 1px solid var(--warn-border); }
.t-question .t-icon { background: var(--surface); }
.question-text { font-size: var(--fs); }
.output { font-size: var(--fs-sm); }
.output summary { cursor: pointer; color: var(--text-2); font-weight: 560; }
.output pre { margin-top: var(--s2); padding: var(--s3); border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; line-height: 1.55; max-height: 280px; overflow: auto; }
.live-checks { list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); }
.live-checks li { display: flex; gap: var(--s2); align-items: center; }
.live-checks li.ok .icon { color: var(--ok); } .live-checks li.bad .icon { color: var(--danger); }

.t-steps { padding: 0; }
.steps-box { flex: 1; min-width: 0; border-radius: var(--r); }
.steps-box > summary { display: flex; align-items: center; gap: var(--s3); padding: 6px var(--s1); cursor: pointer; list-style: none; border-radius: var(--r); color: var(--text-2); }
.steps-box > summary::-webkit-details-marker { display: none; }
.steps-box > summary:hover { background: var(--surface-2); }
.steps-box > summary > .icon:last-child { margin-left: auto; color: var(--text-3); transition: transform .2s var(--ease); }
.steps-box[open] > summary > .icon:last-child { transform: rotate(180deg); }
.steps-who { font-weight: 650; color: var(--text); }
.steps-summary { font-size: var(--fs-sm); }
.steps-live { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.transcript.is-working .t-steps:last-child .steps-live { background: var(--accent); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.steps { list-style: none; display: flex; flex-direction: column; gap: 4px; padding: var(--s2) 0 var(--s2) 44px; font-size: var(--fs-sm); color: var(--text-2); }
.step { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.step .icon { color: var(--text-3); }
.step-verb { flex: none; width: 64px; color: var(--text-3); }
.step-target { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.step-text { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.t-bubble { gap: var(--s3); }
.bubble-wrap { display: flex; flex-direction: column; gap: 4px; max-width: min(560px, 85%); min-width: 0; }
.bubble-meta { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-xs); color: var(--text-3); flex-wrap: wrap; }
.bubble-meta strong { color: var(--text-2); font-size: var(--fs-sm); }
.bubble-meta .t-time { margin-left: 0; }
.bubble { padding: 10px 14px; border-radius: 4px 16px 16px 16px; background: var(--surface-2); border: 1px solid var(--border); overflow-wrap: anywhere; }
.t-bubble.mine { flex-direction: row-reverse; }
.t-bubble.mine .bubble-wrap { align-items: flex-end; }
.t-bubble.mine .bubble { border-radius: 16px 4px 16px 16px; background: var(--accent-soft); border-color: transparent; }
.t-bubble.agent .bubble { background: var(--surface); border-color: var(--border-strong); }
.t-bubble.discuss .bubble { background: var(--discuss-soft); border-color: transparent; }
.t-bubble.is-pending { opacity: .6; }
.t-bubble.is-failed .bubble { border: 1px dashed var(--danger); }
.tag { display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-text); font-weight: 650; font-size: 11px; line-height: 18px; }
.tag-discuss { background: var(--discuss-soft); color: var(--discuss); }

/* standup digest */
.bubble.digest { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); min-width: min(520px, 100%); }
.digest-head { font-size: var(--fs); }
.digest-intro { color: var(--text-2); font-size: var(--fs-sm); }
.digest-groups { display: flex; flex-direction: column; gap: var(--s3); }
.digest-group h4 { font-size: var(--fs-sm); font-weight: 600; margin-bottom: 6px; }
.digest-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.digest-list li { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: var(--s2); align-items: baseline; font-size: var(--fs-sm); }
.digest-pr { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--accent-text); text-decoration: none; }
.digest-title { color: var(--text); }
.digest-author { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }

/* error card: calm, clear, one action */
.t-error { padding: var(--s3); border-radius: var(--r); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); }
.t-error .t-icon { background: var(--surface); }
.t-error .t-detail { color: var(--text); font-family: var(--mono); font-size: 12.5px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--s2) var(--s3); overflow-wrap: anywhere; }
.error-actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: 4px; }

/* composer */
.composer { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.composer[data-channel="discuss"] { border-color: color-mix(in srgb, var(--discuss) 40%, var(--border)); }
.tabs { display: flex; gap: 4px; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r-sm); border: 0; background: none; color: var(--text-3); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); }
.composer[data-channel="discuss"] .tab[aria-selected="true"] { background: var(--discuss-soft); color: var(--discuss); }
.tab:disabled { opacity: .45; cursor: not-allowed; }
.composer-row { display: flex; gap: var(--s2); align-items: flex-end; }
.composer-input { min-height: 44px; max-height: 220px; border-radius: var(--r); }
.composer-help { font-size: var(--fs-xs); color: var(--text-3); padding: 0 2px; }

/* question box */
.question-box { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s5); border-radius: var(--r-lg); background: var(--warn-soft); border: 1px solid var(--warn-border); box-shadow: var(--shadow); }
.q-head { display: flex; gap: var(--s3); align-items: flex-start; }
.q-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--warn); flex: none; }
.q-text { margin: 0; padding: var(--s3) var(--s4); background: var(--surface); border-radius: var(--r); border: 1px solid var(--warn-border); font-size: var(--fs-md); line-height: 1.55; }
.q-form { display: flex; flex-direction: column; gap: var(--s3); }
.q-actions { display: flex; justify-content: flex-end; }

/* plan */
.plan-card { gap: var(--s3); scroll-margin-top: var(--s4); }
.plan-body { display: flex; flex-direction: column; gap: var(--s2); }
.plan-summary { font-size: var(--fs); line-height: 1.6; color: var(--text); }
.plan-sec { border-top: 1px solid var(--border); padding-top: var(--s2); }
.plan-sec > summary { display: flex; align-items: center; gap: var(--s2); cursor: pointer; list-style: none; font-weight: 620; font-size: var(--fs-sm); padding: 4px 0; }
.plan-sec > summary::-webkit-details-marker { display: none; }
.plan-sec > summary > .icon:first-child { color: var(--text-3); }
.plan-sec > summary > .icon:last-child { margin-left: auto; color: var(--text-3); transition: transform .2s var(--ease); }
.plan-sec[open] > summary > .icon:last-child { transform: rotate(180deg); }
.plan-sec > :not(summary) { margin: var(--s2) 0 var(--s2); }
.sec-person > summary, .sec-person > summary > .icon:first-child { color: var(--warn); }
.sec-questions > summary, .sec-questions > summary > .icon:first-child { color: var(--info); }
.plan-steps { padding-left: 22px; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.plan-steps li::marker { color: var(--text-3); font-weight: 600; }
.plan-list { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--text-2); }
.plan-files { list-style: none; display: flex; flex-direction: column; gap: var(--s2); font-size: var(--fs-sm); }
.plan-files li { display: flex; flex-direction: column; gap: 2px; }
.plan-files li > span { color: var(--text-2); }
.plan-files code { width: fit-content; font-size: 12px; }
.mini-title { font-size: var(--fs-xs); font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin: 4px 0; }
.plan-estimate { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); padding-top: var(--s2); border-top: 1px solid var(--border); }
.plan-pending { display: flex; gap: var(--s3); align-items: flex-start; color: var(--text-2); font-size: var(--fs-sm); }
.spinner { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; margin-top: 2px; }
.approval { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4); border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.approval.deciding { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.approval-head { display: flex; gap: var(--s3); align-items: center; }
.approval-dots { display: flex; gap: 4px; flex: none; }
.approval-dots .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); background: transparent; }
.approval-dots .dot.on { background: var(--accent); }
.approval-text { font-size: var(--fs-sm); color: var(--text-2); }
.approval-text strong { color: var(--text); }
.approvers { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s2); }
.approvers li { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 2px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-sm); }
.approvers .icon { color: var(--ok); }
.approval-actions { display: flex; flex-direction: column; gap: var(--s2); }
.approval-actions .btn { width: 100%; }

/* bake-off */
.bakeoff { gap: var(--s4); scroll-margin-top: var(--s4); border-color: color-mix(in srgb, var(--info) 30%, var(--border)); }
.bakeoff-done { padding: var(--s3) var(--s5); gap: 0; }
.bakeoff-done[open] { gap: var(--s4); padding-bottom: var(--s5); }
.bake-summary { display: flex; align-items: center; gap: var(--s3); cursor: pointer; list-style: none; padding: var(--s1) 0; }
.bake-summary::-webkit-details-marker { display: none; }
.bake-summary > .icon { color: var(--info); }
.bake-show { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); color: var(--text-3); font-weight: 600; white-space: nowrap; }
.bakeoff-done[open] .bake-show .icon { transform: rotate(180deg); }
.bake-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.bake-side { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4); border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--bg); }
.bake-side.picked { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bake-side > .btn { margin-top: auto; }
.bake-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); }
.bake-head h3 { display: flex; align-items: center; gap: var(--s2); }
.bake-letter { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--info-soft); color: var(--info); font-weight: 800; }

.pr-link { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-2); text-decoration: none; color: var(--text); }
.pr-link:hover { border-color: var(--accent); color: var(--text); }
.pr-num { font-weight: 750; font-size: var(--fs-md); color: var(--accent-text); }
.pr-repo { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.pr-link .icon { margin-left: auto; color: var(--text-3); }
.review-line { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s2) var(--s3); border-radius: var(--r); background: var(--tone-soft); color: var(--text); font-size: var(--fs-sm); font-weight: 560; }
.review-line .icon { color: var(--tone); margin-top: 1px; }
.details { display: flex; flex-direction: column; gap: var(--s3); margin: 0; }
.details > div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: var(--s3); align-items: baseline; }
.details dt { font-size: var(--fs-xs); font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.details dd { margin: 0; font-size: var(--fs-sm); color: var(--text); min-width: 0; }
.details dd.asked { color: var(--text-2); font-style: italic; }
.ticket-dd a { text-decoration: none; }
.people { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.people li { display: flex; align-items: center; gap: var(--s2); }

/* ---------- automations ---------- */
.trigger-list { display: flex; flex-direction: column; gap: var(--s3); }
.trigger { gap: var(--s3); transition: opacity .2s var(--ease); }
.trigger.is-off { opacity: .7; }
.trigger-head { display: flex; gap: var(--s4); align-items: flex-start; }
.trigger-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.trigger.is-off .trigger-icon { background: var(--surface-2); color: var(--text-3); }
.trigger-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.trigger-title h2 { font-size: var(--fs-md); }
.sentence { color: var(--text-2); }
.trigger-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--fs-sm); color: var(--text-3); padding-left: 56px; }
.tevents-box { margin-left: 56px; border-top: 1px solid var(--border); padding-top: var(--s2); }
.tevents-box > summary { display: flex; align-items: center; gap: var(--s2); cursor: pointer; list-style: none; font-size: var(--fs-sm); font-weight: 620; color: var(--text-2); }
.tevents-box > summary::-webkit-details-marker { display: none; }
.tevents { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: var(--s2); font-size: var(--fs-sm); }
.tevents li { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; }
.tevents li.muted { display: block; }
.tevent-detail { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trigger-actions { display: flex; gap: var(--s1); padding-left: 48px; }
.switch-wrap { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; font-size: var(--fs-sm); color: var(--text-2); font-weight: 600; }
.switch { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .2s var(--ease); margin: 0; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.switch:disabled { cursor: not-allowed; opacity: .6; }
.switch-label { min-width: 46px; }
.trigger-form { border-color: var(--accent); box-shadow: var(--shadow); }
.preview-sentence { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--accent-soft); color: var(--text); font-weight: 520; line-height: 1.5; }
.preview-sentence .icon { color: var(--accent-text); margin-top: 3px; }

/* ---------- spend ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.stat { padding: var(--s5); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: var(--fs-sm); color: var(--text-3); font-weight: 600; }
.stat-value { font-size: var(--fs-3xl); font-weight: 720; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-sub { font-size: var(--fs-sm); color: var(--text-3); }
.stat .meter { margin-top: var(--s3); }
.meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: var(--w, 0%); border-radius: 4px; background: var(--accent); transition: width .6s var(--ease); }
.meter.near .meter-fill { background: var(--warn); }
.meter.relative .meter-fill { background: color-mix(in srgb, var(--accent) 70%, var(--surface-3)); }
.meter.over .meter-fill { background: var(--danger); }
.bars { list-style: none; display: flex; flex-direction: column; gap: var(--s3); }
.bar-row { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto; gap: var(--s3); align-items: center; font-size: var(--fs-sm); }
.bar-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.chart-wrap { overflow-x: auto; }
.day-chart { width: 100%; height: auto; display: block; min-width: 480px; }
.day-chart .bar { fill: color-mix(in srgb, var(--accent) 55%, var(--surface-3)); }
.day-chart .bar:hover { fill: var(--accent); }
.day-chart .bar.today { fill: var(--accent); }
.day-chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.day-chart .axis-label { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.limit-list { list-style: none; display: flex; flex-direction: column; }
.limit-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 240px) auto; gap: var(--s4); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.limit-list li:first-child { border-top: 0; }
.limit-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.limit-buttons { display: flex; gap: 2px; }

/* ---------- audit ---------- */
.audit { list-style: none; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.audit-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.audit-row:first-child { border-top: 0; }
.audit-row .avatar { margin-top: 1px; }
.audit-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.audit-detail { font-size: var(--fs-xs); overflow-wrap: anywhere; }
.audit-row time { white-space: nowrap; font-size: var(--fs-xs); }

/* ---------- settings ---------- */
.profile { display: flex; gap: var(--s4); align-items: center; }
.profile > div { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.profile-name { font-size: var(--fs-lg); font-weight: 650; }
.token-list, .repo-list { list-style: none; display: flex; flex-direction: column; }
.token-list li { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--border); }
.token-list li:first-child { border-top: 0; }
.token-list li > div { flex: 1; }
.token-list .icon { color: var(--text-3); }
.repo-row { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr) auto; gap: var(--s4); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--border); }
.repo-row:first-child { border-top: 0; }
.repo-main { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.repo-facts { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: var(--fs-sm); min-width: 0; }
.repo-facts > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--s2); }
.repo-facts dt { color: var(--text-3); }
.repo-facts dd { margin: 0; min-width: 0; }
.repo-facts code { background: none; border: 0; padding: 0; font-size: 12.5px; color: var(--text); }
.repo-actions { display: flex; flex-direction: column; gap: var(--s1); align-items: stretch; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.steps-howto { padding-left: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--text-2); margin-top: var(--s2); }
.cmd { padding: var(--s3); border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.token-box { display: flex; gap: var(--s2); align-items: center; }
.token-value { flex: 1; padding: 10px; font-size: 12px; overflow-wrap: anywhere; }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s5); margin: var(--s4) 0; font-size: var(--fs-sm); }
.shortcuts dt { white-space: nowrap; color: var(--text-3); }
.shortcuts dd { margin: 0; }

/* ---------- AI models ---------- */
.model-list { list-style: none; display: flex; flex-direction: column; }
.model-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: var(--s4); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--border); }
.model-row:first-child { border-top: 0; }
.model-job { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.model-job p { font-size: var(--fs-sm); }
.model-row[data-job="money"] .model-job strong::after { content: " · two approvals"; font-weight: 500; color: var(--warn); font-size: var(--fs-xs); }
.model-pick { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.model-select { font-size: var(--fs-sm); }
.model-chosen { font-size: var(--fs-sm); padding: 9px 0; }
.model-cost { font-size: var(--fs-xs); color: var(--text-3); }
.models-card .callout[hidden] { display: none; }
.token-list li.is-expired strong { color: var(--text-3); text-decoration: line-through; }
.token-list li > div > .pill { margin-left: var(--s2); }

/* ---------- settings tabs ---------- */
.settings-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); }
.settings-tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: var(--r); color: var(--text-2); text-decoration: none; font-weight: 600; font-size: var(--fs-sm); }
.settings-tab:hover { color: var(--text); background: var(--surface); }
.settings-tab[aria-current="page"] { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-sm); }
.admin-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.settings-body { display: flex; flex-direction: column; gap: var(--s5); }
.field-error { color: var(--danger); }
.field-error[hidden] { display: none; }

/* ---------- connections ---------- */
.conn-points { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.conn-points li { display: flex; gap: var(--s2); align-items: flex-start; }
.conn-points .icon { color: var(--accent-text); margin-top: 3px; }
.conn-cards, .cx-list { list-style: none; display: flex; flex-direction: column; }
.conn-card, .cx-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--border); }
.conn-card:first-child, .cx-row:first-child { border-top: 0; }
.conn-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); flex: none; }
.conn-body, .cx-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.conn-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.conn-body p, .cx-body p { font-size: var(--fs-sm); }
.cx-actions { display: flex; gap: 2px; }
.mono-sm { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.cx-tools { color: var(--text-2); }
.cx-writes { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--warn); font-size: var(--fs-xs); }
.callout.tone-ok { border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.preset { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: var(--s3); border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; text-align: left; }
.preset:hover { border-color: var(--accent); }
.preset .muted { font-size: var(--fs-xs); }
.ro-toggle { align-items: flex-start; }

/* ---------- security ---------- */
.sec-list { display: flex; flex-direction: column; margin: 0; }
.sec-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--s3); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--border); }
.sec-row:first-child { border-top: 0; }
.sec-row dt { font-size: var(--fs-sm); color: var(--text-3); font-weight: 600; }
.sec-row dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); justify-content: space-between; }
.appr-list { list-style: none; display: flex; flex-direction: column; }
.appr-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--border); }
.appr-row:first-child { border-top: 0; }
.appr-body p { font-size: var(--fs-sm); }
.appr-actions { display: flex; gap: var(--s2); }

/* ---------- sign-in steps ---------- */
.signin-steps { list-style: none; display: flex; gap: var(--s4); font-size: var(--fs-sm); color: var(--text-3); }
.signin-steps li { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.ss-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; border: 2px solid var(--border-strong); }
.signin-steps .done .ss-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.signin-steps .current { color: var(--text); }
.signin-steps .current .ss-dot { border-color: var(--accent); color: var(--accent-text); }
.signin-state { display: flex; gap: var(--s3); align-items: flex-start; }
.signin-state h1 { font-size: var(--fs-xl); margin-bottom: var(--s2); }
.ss-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone); flex: none; }

/* ---------- epics, parts, coordination ---------- */
.segmented-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.plan-parts { display: flex; flex-direction: column; gap: var(--s2); }
.parts-list { list-style: none; display: flex; flex-direction: column; gap: var(--s2); }
.part-plan { display: flex; gap: var(--s3); align-items: flex-start; }
.part-num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--info-soft); color: var(--info); font-size: var(--fs-xs); font-weight: 800; flex: none; }
.part-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: var(--fs-sm); }
.part-deps { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: var(--fs-xs); }
.parts-panel { gap: var(--s3); }
.parts-count { font-size: var(--fs-sm); color: var(--text-2); font-weight: 600; }
.parts-check { list-style: none; display: flex; flex-direction: column; }
.part-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--border); }
.part-row:first-child { border-top: 0; }
.part-check { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; border: 2px solid var(--border-strong); color: var(--text-3); font-size: var(--fs-xs); font-weight: 700; }
.part-row.is-done .part-check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.part-row.is-done .part-title { color: var(--text-2); }
.part-title { font-weight: 620; color: var(--text); text-decoration: none; }
.part-title:hover { color: var(--accent-text); text-decoration: underline; }
.parent-link { display: inline-flex; align-items: center; gap: 6px; width: fit-content; font-size: var(--fs-sm); font-weight: 600; color: var(--info); text-decoration: none; padding: 2px 10px 2px 8px; border-radius: var(--r-pill); background: var(--info-soft); }
.coord { display: flex; flex-direction: column; gap: var(--s2); }
.coord-panel { gap: var(--s3); }
.coord-panel.needs-you { border-color: var(--warn-border); box-shadow: 0 0 0 1px var(--warn-soft), var(--shadow); }
.coord-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.coord-item { display: flex; gap: var(--s2); align-items: flex-start; font-size: var(--fs-sm); line-height: 1.5; }
.coord-item > .icon { color: var(--tone); margin-top: 3px; flex: none; }
.coord-request { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); border-radius: var(--r); background: var(--surface); border: 1px solid var(--border-strong); font-size: var(--fs-sm); }
.coord-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.t-agentmsg { padding: var(--s3); border-radius: var(--r); background: var(--info-soft); }
.t-agentmsg .t-icon { background: var(--surface); }
.agentmsg-text { margin: 0; padding: var(--s2) var(--s3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.agentmsg-note { display: flex; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--text-3); }
.step-mcp .icon { color: var(--accent-text); }
.step-mcp-text { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- link Slack ---------- */
.link-card { gap: var(--s5); }
.link-who { display: flex; align-items: center; justify-content: center; gap: var(--s5); padding: var(--s4); border-radius: var(--r-lg); background: var(--surface-2); }
.link-side { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.link-side strong { overflow-wrap: anywhere; }
.link-badge { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); margin-bottom: 4px; }
.link-arrow { color: var(--accent-text); }
.link-question { font-size: var(--fs-md); line-height: 1.6; }
.link-state { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s4); border-radius: var(--r); background: var(--tone-soft); }
.link-state h2 { font-size: var(--fs-md); margin-bottom: 4px; }
.link-state p { color: var(--text-2); }
.link-icon { color: var(--tone); margin-top: 2px; }

/* ---------- dialogs, toasts ---------- */
.dialog { border: 0; padding: 0; border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.dialog::backdrop { background: rgba(10, 14, 12, .45); backdrop-filter: blur(2px); }
.dialog[open] { animation: pop .2s var(--ease); }
@keyframes pop { from { transform: translateY(8px) scale(.98); } }
.dialog form { display: flex; flex-direction: column; gap: var(--s4); padding: var(--s5); }
.dialog h2 { font-size: var(--fs-lg); }
.dialog-body { color: var(--text-2); display: flex; flex-direction: column; gap: var(--s3); }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s2); }
.toasts { position: fixed; z-index: 60; left: 50%; bottom: var(--s5); transform: translateX(-50%); display: flex; flex-direction: column; gap: var(--s2); align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: var(--s2); padding: 10px 16px; border-radius: var(--r-pill); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: var(--fs-sm); font-weight: 560; animation: toastin .25s var(--ease); max-width: calc(100vw - 32px); }
.toast.tone-ok .icon { color: var(--ok); } .toast.tone-danger .icon { color: var(--danger); }
:root:not([data-theme="dark"]) .toast.tone-ok .icon { color: #6ee7a8; }
:root:not([data-theme="dark"]) .toast.tone-danger .icon { color: #ffb4ab; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: all .3s var(--ease); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- sign-in ---------- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.signin-card { outline: none; width: min(480px, 100%); display: flex; flex-direction: column; gap: var(--s4); padding: var(--s7) var(--s6); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow); text-align: left; }
.signin-brand { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s3); }
.signin-card h1 { font-size: var(--fs-xl); }
.lead { color: var(--text-2); font-size: var(--fs-md); }
.signin-btn { margin-top: var(--s3); width: 100%; }
.fine { font-size: var(--fs-xs); color: var(--text-3); text-align: center; }
.signin-points { list-style: none; display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s3); padding-top: var(--s4); border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); }
.signin-points li { display: flex; gap: var(--s2); align-items: flex-start; }
.signin-points .icon { color: var(--accent-text); margin-top: 2px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .session-grid { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 960px) {
  .session-grid { grid-template-columns: minmax(0, 1fr); }
  .session-side { position: static; max-height: none; overflow: visible; }
  .page-session.decision-first .session-grid { display: flex; flex-direction: column; }
  .page-session.decision-first .session-side { order: -1; }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .layout > main#main { margin-left: 0; padding-bottom: 76px; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between;
    padding: 10px var(--s4); padding-top: max(10px, env(safe-area-inset-top));
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border);
  }
  .tabbar {
    display: grid; grid-template-columns: repeat(var(--tabs, 6), minmax(0, 1fr)); position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
    padding: 6px 4px max(6px, env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(12px); border-top: 1px solid var(--border);
  }
  .tab-link { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; color: var(--text-3); text-decoration: none; font-size: 10.5px; font-weight: 600; border-radius: var(--r); min-width: 0; }
  .tab-link > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab-link[aria-current="page"] { color: var(--accent-text); }
  .tab-icon { position: relative; display: grid; place-items: center; width: 40px; height: 28px; border-radius: var(--r-pill); }
  .tab-link[aria-current="page"] .tab-icon { background: var(--accent-soft); }
  .badge-dot { position: absolute; top: -2px; right: 4px; min-width: 16px; padding: 0 4px; line-height: 16px; font-size: 10px; margin: 0; }
  .demo-banner { bottom: 84px; }
  .toasts { bottom: 92px; }
  .page { padding: var(--s5) var(--s4) var(--s7); gap: var(--s4); }
  h1 { font-size: var(--fs-xl); }
  .session-title { font-size: var(--fs-xl); }
  .hide-mobile { display: none; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .stat-row, .segmented, .bake-grid { grid-template-columns: minmax(0, 1fr); }
  .card { padding: var(--s3) var(--s4); gap: var(--s3); flex-wrap: wrap; }
  .card-icon { width: 32px; height: 32px; }
  .card-body { flex-basis: calc(100% - 48px); }
  .card-side { flex-direction: row; align-items: center; width: 100%; padding-left: 44px; justify-content: space-between; }
  .toolbar > .select { width: 100%; }
  .session-head { flex-direction: column; }
  .flow { padding: var(--s3); }
  .step-label { font-size: 11px; }
  .step-dot { width: 26px; height: 26px; }
  .stepper li:not(:first-child)::before { top: 12px; right: calc(50% + 15px); left: calc(-50% + 15px); }
  .panel { padding: var(--s4); }
  .trigger-meta, .tevents-box, .trigger-actions { padding-left: 0; margin-left: 0; }
  .tevents li { grid-template-columns: minmax(0, 1fr) auto; }
  .tevents li .pill { grid-column: 1 / -1; width: fit-content; }
  .bar-row { grid-template-columns: minmax(0, 1fr) auto; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .limit-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .limit-action { grid-column: 1 / -1; }
  .repo-row { grid-template-columns: minmax(0, 1fr) auto; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .model-row { grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
  .segmented-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .conn-card, .cx-row { grid-template-columns: auto minmax(0, 1fr); }
  .conn-actions, .cx-actions { grid-column: 2; }
  .appr-row { grid-template-columns: auto minmax(0, 1fr); }
  .appr-actions { grid-column: 2; }
  .sec-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .part-row { grid-template-columns: auto minmax(0, 1fr); }
  .part-row > .pill { grid-column: 2; width: fit-content; }
  .settings-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .settings-tab { white-space: nowrap; }
  .repo-facts { grid-column: 1 / -1; }
  .bubble-wrap { max-width: 88%; }
  .digest-list li { grid-template-columns: 48px minmax(0, 1fr); }
  .digest-author { grid-column: 2; }
  .steps { padding-left: 8px; }
  .step-verb { width: auto; }
  .t-time { margin-left: 0; }
  .signin-card { padding: var(--s6) var(--s5); }
}


/* ---------- first run: welcome ---------- */
.welcome { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; width: 100vw; height: 100vh; display: grid; place-items: center; }
.welcome:not([open]) { display: none; }
.welcome::backdrop { background: radial-gradient(1200px 700px at 50% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%), rgba(10, 14, 12, .62); backdrop-filter: blur(3px); }
.welcome-card { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; gap: var(--s4); padding: var(--s7) var(--s6) var(--s6); background: var(--surface); color: var(--text); border-radius: var(--r-xl); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.welcome[open] .welcome-card { animation: welcome-in .3s var(--ease) both; }
@keyframes welcome-in { from { transform: translateY(10px) scale(.985); } }
.welcome-kicker { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 3px 10px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-text); font-weight: 650; font-size: var(--fs-sm); }
.welcome-card h1 { font-size: var(--fs-3xl); letter-spacing: -.025em; }
.welcome-text { font-size: var(--fs-md); color: var(--text-2); line-height: 1.6; }
.flow-mini { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; padding: var(--s3) var(--s4); border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); }
.flow-mini li { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: var(--fs-sm); }
.fm-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 800; }
.fm-arrow { color: var(--text-3); display: inline-flex; margin: 0 2px; }
.welcome-points { list-style: none; display: flex; flex-direction: column; gap: var(--s2); font-size: var(--fs-sm); color: var(--text-2); }
.welcome-points li { display: flex; gap: var(--s2); align-items: flex-start; }
.welcome-points .icon { color: var(--accent-text); margin-top: 2px; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.welcome-foot { margin-top: calc(-1 * var(--s2)); }

/* ---------- first run: the tour ---------- */
body.touring { overflow: hidden; }
/* during the tour the side panel is part of the page, so anything in it can be scrolled to and spotlit */
body.touring .session-side { position: static; max-height: none; overflow: visible; }
.tour-shield { position: fixed; inset: 0; z-index: 70; }
.tour-spot { position: fixed; z-index: 71; left: var(--x, 50%); top: var(--y, 50%); width: var(--w, 0); height: var(--h, 0); border-radius: 14px; box-shadow: 0 0 0 4px var(--accent), 0 0 0 9999px rgba(10, 14, 12, .58); pointer-events: none; }
.tour-spot.is-placed { transition: left .3s var(--ease), top .3s var(--ease), width .3s var(--ease), height .3s var(--ease); }
.tour-spot[hidden] { display: none; }
.tour-pop { position: fixed; z-index: 72; left: var(--px, 50%); top: var(--py, 50%); width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: var(--s3); padding: var(--s5); background: var(--surface); color: var(--text); border-radius: var(--r-lg); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.tour-pop.is-placed { transition: left .3s var(--ease), top .3s var(--ease), opacity .2s; }
.tour-pop.is-placed.is-moving { opacity: .55; }
.tour-pop[data-place="center"] { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.tour-pop[data-place="sheet"] { left: 12px; right: 12px; top: auto; bottom: max(12px, env(safe-area-inset-bottom)); width: auto; }
.tour-head { display: flex; align-items: center; gap: var(--s2); }
.tour-count { font-size: var(--fs-xs); font-weight: 700; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; }
.tour-example[hidden] { display: none; }
.tour-skip { margin-left: auto; border: 0; background: none; color: var(--text-3); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: var(--r-sm); }
.tour-skip:hover { color: var(--text); background: var(--surface-2); }
.tour-pop h2 { font-size: var(--fs-lg); }
.tour-text { color: var(--text-2); line-height: 1.6; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.tour-dots { list-style: none; display: flex; gap: 5px; }
.tour-dots li { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); transition: background .2s, width .2s; }
.tour-dots li.on { background: var(--accent); }
.tour-buttons { display: flex; gap: var(--s2); }

/* ---------- help ---------- */
.help-dialog { width: min(560px, calc(100vw - 32px)); }
.help-actions { display: flex; flex-direction: column; gap: var(--s2); }
.help-item { display: flex; align-items: center; gap: var(--s3); width: 100%; padding: var(--s3); border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: left; text-decoration: none; cursor: pointer; font: inherit; }
.help-item:hover { border-color: var(--accent); color: var(--text); }
.help-item > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.help-item .muted { font-size: var(--fs-sm); }
.help-item > .icon:last-child { color: var(--text-3); }
.help-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.help-sub { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin-top: var(--s2); }
.side-kbd { margin-left: auto; }
.topbar-actions { display: flex; align-items: center; gap: var(--s1); }
.icon-only { padding: 0 8px; min-width: 36px; }

/* ---------- getting started ---------- */
.checklist-host:empty { display: none; }
.checklist { gap: var(--s3); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.cl-head { display: flex; align-items: center; gap: var(--s3); }
.cl-count { font-size: var(--fs-sm); color: var(--text-2); font-weight: 600; }
.cl-list { list-style: none; display: flex; flex-direction: column; }
.cl-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--border); }
.cl-item:first-child { border-top: 0; }
.cl-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; color: var(--on-accent); }
.cl-item.is-done .cl-check { background: var(--accent); border-color: var(--accent); }
.cl-item.is-done .cl-label span:first-child { color: var(--text-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.cl-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cl-label { font-weight: 620; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.cl-opt { font-size: 11px; font-weight: 600; color: var(--text-3); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 0 7px; }
.cl-hint { font-size: var(--fs-sm); color: var(--text-3); }
.empty-actions { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; margin-top: var(--s3); }

/* ---------- new session tips ---------- */
.tips { gap: var(--s3); }
.tips-list { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.tips-list li { display: flex; gap: var(--s2); align-items: flex-start; }
.tips-list .icon { color: var(--accent-text); margin-top: 3px; }
.example-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.example-card { display: flex; flex-direction: column; gap: 6px; padding: var(--s3); border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.example-card:hover { border-color: var(--accent); }
.example-card strong { font-size: var(--fs-sm); }
.example-card > span:nth-of-type(1) { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.5; }
.example-use { margin-top: auto; display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-xs); font-weight: 700; color: var(--accent-text); }
.example-banner { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s2) var(--s3); border-radius: var(--r); background: var(--info-soft); color: var(--text); font-size: var(--fs-sm); max-width: 72ch; }
.example-banner .icon { color: var(--info); margin-top: 2px; }

@media (max-width: 640px) {
  .welcome-card { padding: var(--s6) var(--s4) var(--s5); }
  .welcome-card h1 { font-size: var(--fs-2xl); }
  .welcome-actions .btn { width: 100%; }
  .example-cards { grid-template-columns: minmax(0, 1fr); }
  .cl-item { grid-template-columns: auto minmax(0, 1fr); }
  .cl-item > .btn, .cl-item > a.btn { grid-column: 2; width: fit-content; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print { .sidebar, .topbar, .tabbar, .composer, .head-actions, .demo-banner { display: none !important; } .layout > main#main { margin: 0; } }

/* Settings → Connectors: setting a connector up (connect, choose tools, switch on) */
.cx-setup { margin-bottom: var(--s3); }
.cx-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.cx-step { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s2); align-items: start; }
.cx-step-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border-strong); font-size: var(--fs-xs); font-weight: 600; }
.cx-tools-list { display: grid; gap: 2px; max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r); padding: var(--s2); }
.cx-tool { align-items: flex-start; padding: 6px 4px; }
.cx-tool .muted { font-size: var(--fs-xs); }
.stack-xs { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* Local sign-in (served by the server at /auth/dev) */
.dev-who { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); }
.dev-who div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dev-who span { font-size: var(--fs-sm); color: var(--text-3); }
.dev-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; }

/* §19 Approvals queue and ClickUp sprint */
.kbd-hint { font-size: var(--fs-sm); color: var(--text-3); align-self: flex-end; }
.aq-list { list-style: none; display: flex; flex-direction: column; gap: var(--s3); padding: 0; margin: 0; }
.aq-card { gap: var(--s3); outline: none; border-left: 3px solid transparent; }
.aq-card.is-money { border-left-color: var(--warn); }
.aq-card.is-selected { box-shadow: 0 0 0 2px var(--accent); }
.aq-card:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.aq-head { display: flex; justify-content: space-between; gap: var(--s3); align-items: flex-start; flex-wrap: wrap; }
.aq-title { font-weight: 600; font-size: var(--fs-lg, 1.05rem); color: var(--text); text-decoration: none; }
.aq-title:hover { text-decoration: underline; }
.aq-meta { margin: 2px 0 0; font-size: var(--fs-sm); }
.aq-pills { display: flex; gap: var(--s2); flex-wrap: wrap; }
.aq-files { list-style: none; display: flex; flex-wrap: wrap; gap: 4px var(--s3); padding: 0; margin: var(--s2) 0 0; font-size: var(--fs-sm); }
.aq-actions { display: flex; flex-direction: row; gap: var(--s2); flex-wrap: wrap; }
.task-pick { list-style: none; display: flex; flex-direction: column; padding: 0; margin: 0; }
.task-pick li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px) auto; gap: var(--s3); align-items: center; padding: var(--s2) 0; border-top: 1px solid var(--border); }
.task-pick li:first-child { border-top: 0; }
.task-name { display: inline-flex; gap: var(--s2); align-items: baseline; flex-wrap: wrap; min-width: 0; }
@media (max-width: 720px) {
  .task-pick li { grid-template-columns: minmax(0, 1fr); }
  .kbd-hint { display: none; }
}
/* §21 PR preview */
.preview-line { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); margin: 0; }
.preview-line a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.preview-help summary { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; font-size: var(--fs-sm); color: var(--text-3); }
.preview-help .help { margin-top: var(--s2); }
/* §22 Playbooks */
.repo-actions { display: flex; flex-direction: column; gap: var(--s1); align-items: stretch; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
@media (max-width: 720px) { .field-row { grid-template-columns: minmax(0, 1fr); } }
.playbook-cards .example-use { display: inline-flex; align-items: center; gap: var(--s2); }
