@font-face {
  font-family: "Inter Var";
  src: url("/fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Surfaces */
  --page: #eef0f4;
  --surface: #fff;
  --surface-sunken: #f7f8fa;
  --surface-raised: #fdfdfe;
  --chip: #f1f2f5;
  --track-solid: #edf0f6;
  /* The Tool usage card. In dark it becomes the LIGHTEST surface, not the
     darkest, because a near-black card on a dark page disappears. */
  --contrast: #333;
  --on-contrast: #fff;
  --on-contrast-muted: #a8aaad;
  /* Text */
  --ink: #0e1013;
  --text: #2d3136;
  --text-strong: #3b4047;
  --text-soft: #4b5058;
  /* Secondary text, solved for 4.5:1 against the worst surface it sits on
     rather than chosen by eye. --muted keeps more headroom than --faint so
     the two stay distinguishable instead of collapsing onto one grey. */
  --muted: #5b5f64;
  --chip-ink: #5b616a;
  --faint: #666c76;
  --faint-cool: #5f6d80;
  /* Lines and fills */
  --line: rgba(20, 26, 40, .13);
  --line-strong: rgba(20, 26, 40, .1);
  --line-soft: rgba(20, 26, 40, .07);
  --track: rgba(20, 26, 40, .05);
  --swatch-ring: rgba(20, 26, 40, .12);
  /* Accents */
  --accent: #8a63d2;
  --accent-soft: #c07fd8;
  --positive: #35b45c;
  --positive-ink: #2e7b46; /* was #2f7d47 — 4.48 in .live-pill on --ok-bg, below AA */
  --danger: #b0453f;
  /* Dialog heights, so a dialog keeps one size whatever tab is open inside
     it. Manage users was tall on People and a strip on Groups. */
  /* The close button in a wide dialog's header, which needs more contrast
     than a plain chip to read against the header itself. */
  --round-close-bg: #e4e6eb;
  --round-close-line: rgba(22, 29, 45, .28);
  --dialog-h: min(820px, calc(100vh - 56px));
  --dialog-h-compose: min(620px, calc(100vh - 72px));
  /* Elevation */
  --shadow: 0 1px 2px rgba(22, 29, 45, .04), 0 8px 24px rgba(22, 29, 45, .05);
  --card-shadow: 0 1px 2px rgba(22, 29, 45, .06), 0 8px 22px rgba(22, 29, 45, .08);
  --modal-shadow: 0 30px 90px rgba(18, 24, 38, .26);
  /* Status badge pairs. Light uses pastel fills; dark uses low-alpha washes of
     the same hue, because a pastel block glows against a dark surface. */
  --ok-bg: #e8f4ec;        --ok-ink: #2e7b46; /* was #2f7d47 — 4.48 on --ok-bg, below AA */
  --warn-bg: #faf0e3;      --warn-ink: #966327; /* was #b3762f — 3.36 on --warn-bg, below AA */
  --amber-bg: #f2efe1;     --amber-ink: #6a5c2c;
  --info-bg: #e9eefb;      --info-ink: #4360c9;
  --bad-bg: rgba(252, 235, 232, .9); --bad-ink: #b0453f;
  --neutral-bg: rgba(240, 242, 245, .9); --neutral-ink: #696e77;
  --stale-bg: rgba(250, 240, 220, .9);   --stale-ink: #9a6a1f; --stale-dot: #d79a28;
  --segment-bg: #f4f5f8;
  --glass: rgba(255, 255, 255, .8);
  --glass-strong: rgba(255, 255, 255, .92);
  --tint-a: linear-gradient(155deg, #fdf3f8 0%, #fbe9f2 100%); --tint-a-line: rgba(221, 120, 180, .3); --tint-a-ink: #b4457f;
  --tint-b: linear-gradient(155deg, #f6f3fe 0%, #efeafc 100%); --tint-b-line: rgba(155, 141, 232, .3); --tint-b-ink: #6a56c8;
  --tint-c: linear-gradient(155deg, #f1f5fe 0%, #e8eefc 100%); --tint-c-line: rgba(125, 148, 234, .3); --tint-c-ink: #3f5fc4;
  --tint-d: linear-gradient(155deg, #fdf4ec 0%, #fbeade 100%); --tint-d-line: rgba(226, 150, 110, .3); --tint-d-ink: #b96a30;
  --tint-e: linear-gradient(155deg, #edfaf5 0%, #e1f5ee 100%); --tint-e-line: rgba(84, 182, 150, .3); --tint-e-ink: #2d7f64;
  --hover: #f2f4f9;
  --menu-bg: rgba(255, 255, 255, .96);
  --grid: #d8dbe2;
  --grid-soft: #e8edf8;
  --dot-grid: #e5eaf4;
  --ring-track: #e9eaee;
  --act-track: repeating-linear-gradient(-45deg, #eef0f1 0 1.5px, #f8f9fa 1.5px 9px);
  --meter-track: #ececef;
  --meter-ink: #c44f95;
  --meter-line: #e86fb4;
  --quote-bg: rgba(243, 240, 250, .7);
  --quote-ink: #585e66;
  --avatar-bg: #e9f0ff;
  --focus-ring: #c9b6ec;
  --scrollbar: #d7dae1;
  /* Text on a background that is the SAME colour in both themes (avatars,
     the dark pill, chart markers) must stay white; --on-contrast flips. */
  --on-fixed: #fff;
  color-scheme: light;
}

/* GitHub Dark Dimmed. Lifted off true black so cards separate from the page
   and long sessions stay comfortable; borders are solid rather than
   translucent, which is how this palette gets its structure. */
:root[data-theme="dark"] {
  --round-close-bg: #343b45;
  --round-close-line: #586069;
  --page: #1c2128;
  --surface: #22272e;
  --surface-sunken: #1c2128;
  --surface-raised: #2d333b;
  --chip: #2d333b;
  --track-solid: #2d333b;
  --contrast: #2d333b;
  --on-contrast: #adbac7;
  --on-contrast-muted: #929da7;
  --ink: #cdd9e5;
  --text: #adbac7;
  --text-strong: #cdd9e5;
  --text-soft: #adbac7;
  --muted: #a4adb6;
  --chip-ink: #adbac7;
  --faint: #939da8;
  --faint-cool: #939da8;
  --line: #444c56;
  --line-strong: #373e47;
  --line-soft: #2d333b;
  --track: #2d333b;
  --swatch-ring: rgba(255, 255, 255, .14);
  --accent: #b083f0;
  --accent-soft: #c09ef5;
  --positive: #57ab5a;
  --positive-ink: #6bc46d;
  --danger: #e5534b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, .32), 0 8px 22px rgba(0, 0, 0, .3);
  --modal-shadow: 0 30px 90px rgba(0, 0, 0, .6);
  --ok-bg: rgba(87, 171, 90, .16);   --ok-ink: #6bc46d;
  --warn-bg: rgba(204, 153, 70, .16); --warn-ink: #daa15f;
  --amber-bg: rgba(187, 168, 80, .14); --amber-ink: #c9bb72;
  --info-bg: rgba(83, 155, 245, .16); --info-ink: #6cb0f7;
  --bad-bg: rgba(229, 83, 75, .16);  --bad-ink: #f0837c;
  --neutral-bg: rgba(255, 255, 255, .07); --neutral-ink: #97a1ab;
  --stale-bg: rgba(215, 154, 40, .16);    --stale-ink: #d8a759; --stale-dot: #d79a28;
  --segment-bg: #1c2128;
  --glass: rgba(255, 255, 255, .06);
  --glass-strong: rgba(255, 255, 255, .09);
  /* Dark keeps the hue as a wash over the card surface rather than a pastel
     block, so --ink text stays readable on top. */
  --tint-a: linear-gradient(155deg, rgba(221, 120, 180, .16) 0%, rgba(221, 120, 180, .07) 100%); --tint-a-line: rgba(221, 120, 180, .28); --tint-a-ink: #e089b8;
  --tint-b: linear-gradient(155deg, rgba(155, 141, 232, .18) 0%, rgba(155, 141, 232, .08) 100%); --tint-b-line: rgba(155, 141, 232, .3); --tint-b-ink: #a99af0;
  --tint-c: linear-gradient(155deg, rgba(125, 148, 234, .18) 0%, rgba(125, 148, 234, .08) 100%); --tint-c-line: rgba(125, 148, 234, .3); --tint-c-ink: #8fa6f2;
  --tint-d: linear-gradient(155deg, rgba(226, 150, 110, .16) 0%, rgba(226, 150, 110, .07) 100%); --tint-d-line: rgba(226, 150, 110, .28); --tint-d-ink: #e0a075;
  --tint-e: linear-gradient(155deg, rgba(84, 182, 150, .18) 0%, rgba(84, 182, 150, .08) 100%); --tint-e-line: rgba(84, 182, 150, .3); --tint-e-ink: #6cc9a6;
  --hover: #2d333b;
  --menu-bg: rgba(45, 51, 59, .98);
  --grid: #39404a;
  --grid-soft: #2f3640;
  --dot-grid: #333b45;
  --ring-track: #343b45;
  --act-track: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .05) 0 1.5px, rgba(255, 255, 255, .02) 1.5px 9px);
  --meter-track: #2d333b;
  --meter-ink: #e78fc4;
  --meter-line: #c4669c;
  --quote-bg: rgba(255, 255, 255, .05);
  --quote-ink: #9aa3ad;
  --avatar-bg: #2b3340;
  --focus-ring: #8f6fd4;
  --scrollbar: #444c56;
  --on-fixed: #fff;
  color-scheme: dark;
}

.ws-shell {
  position: fixed;
  inset: 0;
  display: flex;
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  font-family: "Inter Var", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.rail-wrap, .canvas { position: relative; z-index: 1; }
.ws-shell h1, .ws-shell h2, .ws-shell p { margin: 0; }
.ws-shell a { color: inherit; text-decoration: none; }
.ws-shell button, .ws-shell input, .ws-shell select { font: inherit; color: inherit; }
.ws-shell button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { display: inline-grid; place-items: center; width: 17px; height: 17px; flex: none; }
.ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Rail */
/* Centred with flexbox: no overflow container, so the capsules keep their corners and shadows. */
.rail-wrap { position: fixed; z-index: 40; top: 0; bottom: 0; left: 22px; display: flex; flex-direction: column; justify-content: center; gap: 13px; padding: 14px 0; pointer-events: none; }
.rail-wrap > * { pointer-events: auto; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px; border: 1px solid var(--line-soft); border-radius: 32px; background: var(--surface); box-shadow: 0 2px 6px rgba(22, 29, 45, .05), 0 16px 34px rgba(22, 29, 45, .07); backdrop-filter: blur(12px); }
.rail-item { position: relative; display: grid; place-items: center; width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; color: var(--text-strong); background: transparent; transition: background .16s, color .16s; }
.rail-item:hover { background: var(--hover); }
.rail-item.active { color: var(--on-fixed); background: #17191c; }
.rail-item .ico { width: 18px; height: 18px; }
.rail-item::after { position: absolute; left: calc(100% + 11px); z-index: 2; padding: 6px 10px; border-radius: 8px; color: var(--on-fixed); background: #17191c; box-shadow: 0 6px 18px rgba(22, 29, 45, .18); content: attr(data-label); font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transform: translateX(-4px); transition: opacity .15s, transform .15s; }
.rail-item:hover::after, .rail-item:focus-visible::after { opacity: 1; transform: translateX(0); }

/* Canvas */
.canvas { display: flex; flex: 1; flex-direction: column; min-width: 0; max-width: 2560px; margin: 0 auto; padding: 16px 28px 18px 112px; }
.top { display: flex; flex: none; align-items: center; gap: 10px; margin-bottom: 16px; }
.crumb { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 15px; white-space: nowrap; }
.crumb .ico { width: 14px; height: 14px; }
.crumb strong { color: var(--ink); font-weight: 500; }
.search { position: relative; display: flex; align-items: center; gap: 8px; height: 48px; flex: 1; min-width: 0; max-width: 420px; margin-left: auto; padding: 0 14px; border: 1px solid var(--line-soft); border-radius: 24px; background: var(--surface); box-shadow: 0 1px 3px rgba(22, 29, 45, .04), 0 10px 26px rgba(22, 29, 45, .05); }
.search > .ico { color: var(--text-soft); }
.search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { flex: none; padding: 3px 6px; border-radius: 7px; color: var(--chip-ink); background: var(--chip); font-family: inherit; font-size: 11px; font-weight: 500; line-height: 1; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 48px; flex: none; padding: 0 17px; border: 1px solid var(--line-soft); border-radius: 24px; color: var(--ink); background: var(--surface); box-shadow: 0 1px 3px rgba(22, 29, 45, .04), 0 10px 26px rgba(22, 29, 45, .05); font-size: 14px; white-space: nowrap; }
.pill.round { width: 48px; padding: 0; justify-content: center; }
.pill.wide { height: 44px; padding: 0 20px; }
.pill.dark { color: var(--on-fixed); background: #111316; box-shadow: 0 8px 18px rgba(5, 7, 9, .2); }
.pill.dark:hover { background: #22262c; }
.select { position: relative; flex: none; }
.select-native { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; pointer-events: none; }
.select-trigger { gap: 9px; padding: 0 14px 0 15px; }
.select-trigger .caret { width: 15px; height: 15px; transition: transform .18s; }
.select-trigger[aria-expanded="true"] .caret { transform: rotate(180deg); }
.select-trigger:hover { background: var(--surface); }
.select-trigger:focus-visible { outline: 2px solid #a9bcf7; outline-offset: 2px; border-radius: 24px; }
.select-value { font-size: 14px; white-space: nowrap; }
.select-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 2px;
  min-width: 184px;
  max-height: 320px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--menu-bg);
  box-shadow: 0 2px 6px rgba(22, 29, 45, .06), 0 18px 44px rgba(22, 29, 45, .16);
  backdrop-filter: blur(14px);
  scrollbar-width: thin;
  animation: select-in .14s ease-out;
}
.select-menu[hidden] { display: none; }
.select-menu.wide { min-width: 236px; }
.select-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 11px;
  color: var(--text);
  background: transparent;
  font-size: 13.5px;
  text-align: left;
}
.select-option:hover, .select-option.focused { background: var(--hover); }
.select-option[aria-selected="true"] { color: var(--ink); font-weight: 500; }
.select-option .tick { display: grid; place-items: center; width: 16px; height: 16px; flex: none; color: var(--accent); opacity: 0; }
.select-option[aria-selected="true"] .tick { opacity: 1; }
.select-option .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-option .dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--positive); }
@keyframes select-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

#refreshButton.is-loading .ico#refreshButton.is-loading .ico { animation: ws-spin 1s linear infinite; }
#refreshButton:disabled { cursor: wait; opacity: .6; }
.live-pill { gap: 7px; padding: 0 15px; color: var(--positive-ink); background: var(--ok-bg); font-size: 13px; }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--positive); box-shadow: 0 0 0 3px rgba(53, 180, 92, .18); }
.live-pill.stale { color: var(--stale-ink); background: var(--stale-bg); }
.live-pill.stale i { background: var(--stale-dot); box-shadow: 0 0 0 3px rgba(215, 154, 40, .18); }
.live-pill.off { color: var(--bad-ink); background: var(--bad-bg); }
.live-pill.off i { background: #d2544c; box-shadow: 0 0 0 3px rgba(210, 84, 76, .18); }
.profile { display: flex; align-items: center; gap: 10px; height: 54px; flex: none; padding: 0 18px 0 5px; border: 1px solid var(--line-soft); border-radius: 28px; background: var(--surface); box-shadow: 0 1px 3px rgba(22, 29, 45, .04), 0 10px 26px rgba(22, 29, 45, .05); }
.face { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; color: var(--on-fixed); background: linear-gradient(145deg, #8f9bb3, #434f66); font-size: 14px; font-weight: 600; }
.profile strong { display: block; color: var(--ink); font-size: 14px; font-weight: 600; }
.profile small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }

/* Welcome */
.hello { display: flex; flex: none; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; padding-left: 4px; }
.hello h1 { color: var(--ink); font-size: 29px; font-weight: 650; letter-spacing: -.02em; }
.hello p { margin-top: 7px; color: var(--muted); font-size: 14.5px; }
.hello-actions { display: flex; gap: 10px; }

/* Views */
/* [hidden] only sets display:none at the lowest priority, so any rule giving
   an element a display silently beats it and the element stays on screen.
   That has caught me four times in this file -- most recently when a flex
   rule added for centring stopped the summary panel from ever hiding. One
   rule for everything, rather than chasing it element by element. */
[hidden] { display: none !important; }
.view[hidden] { display: none !important; }
.view.single { display: flex; flex: 1; min-height: 0; }
.view.single > .card { flex: 1; min-height: 0; }
.view.duo { display: grid; flex: 1; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px; min-height: 0; }
.view.duo > .card { min-height: 0; }

/* Stats */
.stats { display: grid; flex: none; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat { position: relative; min-width: 0; padding: 15px 18px 16px; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.stat.tint-a { border-color: var(--tint-a-line); background: var(--tint-a); }
.stat.tint-b { border-color: var(--tint-b-line); background: var(--tint-b); }
.stat.tint-c { border-color: var(--tint-c-line); background: var(--tint-c); }
.stat.tint-d { border-color: var(--tint-d-line); background: var(--tint-d); }
.stat.tint-e { border-color: var(--tint-e-line); background: var(--tint-e); }
.stat.tint-a .stat-ico { color: var(--tint-a-ink); }
.stat.tint-b .stat-ico { color: var(--tint-b-ink); }
.stat.tint-c .stat-ico { color: var(--tint-c-ink); }
.stat.tint-d .stat-ico { color: var(--tint-d-ink); }
.stat.tint-e .stat-ico { color: var(--tint-e-ink); }
.stat-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #16181c; background: var(--glass-strong); box-shadow: var(--shadow); }
.stat-ico .ico { width: 19px; height: 19px; }
.spark { position: absolute; top: 18px; right: 16px; width: 140px; height: 46px; }
.spark svg { width: 100%; height: 100%; }
.stat p { margin-top: 20px; color: var(--muted); font-size: 14.5px; }
.stat-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.stat-row strong { color: var(--ink); font-size: 27px; font-weight: 650; letter-spacing: -.02em; }
.delta { padding: 4px 8px; border-radius: 8px; color: var(--neutral-ink); background: var(--neutral-bg); font-size: 12px; font-weight: 500; white-space: nowrap; }
.delta.up { color: var(--ok-ink); background: var(--ok-bg); }
.delta.down { color: var(--bad-ink); background: var(--bad-bg); }

/* Cards */
.card { min-width: 0; padding: 18px 20px; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface); box-shadow: var(--card-shadow); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.card h2 { color: var(--ink); font-size: 18.5px; font-weight: 600; letter-spacing: -.012em; }
.card-top p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.mid { display: grid; flex: 1; grid-template-columns: minmax(0, 1.5fr) minmax(286px, .8fr) minmax(272px, .74fr); gap: 14px; min-height: 0; }
.mid > .card { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

/* Chart */
.tabs { display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 22px; background: var(--segment-bg); box-shadow: inset 0 0 0 1px var(--line-soft); }
.tab { height: 34px; padding: 0 14px; border: 0; border-radius: 18px; color: var(--muted); background: transparent; font-size: 13.5px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); background: var(--surface); box-shadow: 0 1px 3px rgba(22, 29, 45, .09); font-weight: 500; }
.chart { position: relative; flex: 1; min-height: 0; margin-top: 12px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.grid-line { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 2 5; }
.y-label, .x-label { fill: var(--muted); font-size: 12.5px; }
.area-line { fill: none; stroke: url(#lineGrad); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.dot { fill: var(--on-fixed); stroke: #c07fd8; stroke-width: 2.4; }
.bubble { position: absolute; padding: 8px 14px; border-radius: 12px; color: var(--on-fixed); background: #141414; box-shadow: 0 10px 24px rgba(20, 20, 20, .22); font-size: 14.5px; font-weight: 500; white-space: nowrap; transform: translate(-50%, -168%); pointer-events: none; }
.bubble small { display: block; margin-bottom: 2px; color: var(--on-contrast-muted); font-size: 10px; font-weight: 400; }
.bubble::after { position: absolute; bottom: -5px; left: 50%; width: 11px; height: 11px; border-radius: 2px; background: #141414; content: ""; transform: translateX(-50%) rotate(45deg); }
.bubble.below { transform: translate(-50%, 22px); }
.bubble.below::after { top: -5px; bottom: auto; }

/* Dark panel */
.card.dark { border-color: rgba(0, 0, 0, .3); background: var(--contrast); box-shadow: 0 2px 6px rgba(20, 20, 20, .12), 0 18px 40px rgba(20, 20, 20, .16); }
.card.dark h2 { color: var(--on-contrast); font-size: 19px; }
.card.dark .card-top p { color: var(--on-contrast-muted); }
.round-btn { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; color: var(--on-fixed); background: #434343; }
/* Superseded by the global [hidden] rule near the top of this file. */
.round-btn:hover { background: #4e4e4e; }
.round-btn.light { color: var(--ink); background: var(--chip); border: 1px solid rgba(22, 29, 45, .18); }
.round-btn .ico { width: 18px; height: 18px; }
.ticks { display: flex; flex: 1; flex-direction: column; justify-content: flex-start; min-height: 0; margin-top: 10px; overflow-y: auto; scrollbar-width: thin; }
.tick-row { display: flex; flex: 1 1 auto; flex-direction: column; justify-content: center; min-height: 56px; max-height: 92px; padding: 7px 0; }
.tick-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.tick-head span { overflow: hidden; color: var(--on-contrast); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.tick-head strong { color: var(--on-contrast); font-size: 14px; font-weight: 500; }
.tick-bar { display: flex; gap: 2px; height: 14px; }
.tick-bar i { flex: 1; border-radius: 1.5px; background: #535353; }
.dark-foot { display: grid; flex: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; padding-top: 15px; border-top: 1px solid #4a4a4a; }
.dark-foot small { display: block; color: var(--on-contrast-muted); font-size: 11.5px; }
.dark-foot strong { display: block; margin-top: 4px; overflow: hidden; color: var(--on-contrast); font-size: 16px; font-weight: 500; text-overflow: ellipsis; }
.dark .ws-empty { color: var(--on-contrast-muted); }

/* Top employees */
.live { display: inline-flex; align-items: center; gap: 6px; margin-top: 9px; padding: 4px 10px 4px 8px; border-radius: 20px; color: var(--ok-ink); background: var(--ok-bg); font-size: 12px; font-weight: 500; white-space: nowrap; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); box-shadow: 0 0 0 3px rgba(53, 180, 92, .18); }
.live.none { color: var(--neutral-ink); background: var(--neutral-bg); }
.live.none i { background: #a7adb5; box-shadow: none; }
/* scrollbar-color keeps the thumb visible; macOS would otherwise hide the
   overlay scrollbar and the list would not look scrollable. Note ::-webkit-scrollbar
   is ignored by Chrome whenever scrollbar-width is set, so it is not usable here. */
.rank { display: flex; flex: 1; flex-direction: column; justify-content: flex-start; min-height: 0; margin-top: 4px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.rank-row { display: grid; flex: 1 1 auto; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 11px; width: 100%; min-height: 58px; max-height: 84px; padding: 11px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.rank-row:last-child { border-bottom: 0; }
.rank-row:hover strong { color: var(--accent); }
.ring { --v: 0; --c: #c07fd8; position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--v) * 1%), var(--ring-track) 0); }
.ring::before { position: absolute; inset: 3.5px; border-radius: 50%; background: var(--surface); content: ""; }
.ring span { position: relative; color: var(--ink); font-size: 12.5px; font-weight: 600; }
.ring.online::after { position: absolute; right: -1px; bottom: -1px; z-index: 2; width: 11px; height: 11px; border: 2px solid var(--surface-raised); border-radius: 50%; background: var(--positive); box-shadow: 0 0 0 3px rgba(53, 180, 92, .16); content: ""; }
.rank-row strong { display: block; overflow: hidden; color: var(--ink); font-size: 14.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; transition: color .15s; }
.rank-row small { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.level { padding: 5px 9px; border-radius: 8px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.level.heavy { color: var(--ok-ink); background: var(--ok-bg); }
.level.high { color: var(--amber-ink); background: var(--amber-bg); }
.level.moderate { color: var(--info-ink); background: var(--info-bg); }
.level.light { color: var(--warn-ink); background: var(--warn-bg); }
.level.idle { color: var(--neutral-ink); background: var(--neutral-bg); }
.rank-foot { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 10px; margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line); }
.rank-foot span { color: var(--muted); font-size: 12.5px; }
.rank-foot strong { color: var(--ink); font-size: 17px; font-weight: 600; }

/* Table view */
.table-card { display: flex; flex-direction: column; overflow: hidden; }
.table-card .card-top { align-items: center; }
.search.inline { height: 44px; max-width: 360px; margin-left: auto; }
.table-wrap { flex: 1; min-height: 0; margin-top: 14px; overflow: auto; }
.table-card table, .wd-table table { width: 100%; border-collapse: separate; border-spacing: 0 2px; font-size: 14px; }
.table-card thead th, .wd-table thead th { position: sticky; top: 0; z-index: 1; padding: 14px 16px; color: var(--ink); background: var(--surface-sunken); font-weight: 500; text-align: left; white-space: nowrap; }
.table-card thead th:first-child, .wd-table thead th:first-child { border-radius: 14px 0 0 14px; }
.table-card thead th:last-child, .wd-table thead th:last-child { border-radius: 0 14px 14px 0; }
.table-card tbody td, .wd-table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--text-soft); white-space: nowrap; }
.table-card tbody tr:last-child td, .wd-table tbody tr:last-child td { border-bottom: 0; }
.table-card tbody tr:hover td, .wd-table tbody tr:hover td { background: var(--hover); }
.right { text-align: right; }
.employee-row { cursor: pointer; }
.ws-person { display: inline-flex; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.ws-person .face { width: 36px; height: 36px; font-size: 12.5px; }
.ws-person .face-wrap { position: relative; }
.ws-person .face-wrap.online::after { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border: 2px solid var(--surface-raised); border-radius: 50%; background: var(--positive); content: ""; }
.ws-person strong { display: block; color: var(--ink); font-size: 13.5px; font-weight: 500; }
.ws-person small { display: block; margin-top: 2px; color: var(--faint); font-size: 11.5px; }
.meter { position: relative; display: flex; align-items: center; width: 180px; height: 8px; border-radius: 6px; background: var(--meter-track); }
.meter i { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--meter-line), var(--accent-soft)); }
.meter b { position: absolute; top: 50%; padding: 3px 8px; border: 1.5px solid var(--meter-line); border-radius: 12px; color: var(--meter-ink); background: var(--surface); font-size: 11px; font-weight: 500; transform: translate(-55%, -50%); }
.row-actions { display: inline-flex; gap: 6px; }
.row-actions button { height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--text-soft); background: var(--glass); font-size: 12px; }
.row-actions button:hover { background: var(--surface); }

/* Lists */
.list-card { display: flex; flex-direction: column; overflow: hidden; }
.scroll-area { flex: 1; min-height: 0; margin-top: 12px; overflow-y: auto; scrollbar-width: thin; }
.feed { display: grid; gap: 10px; padding-right: 4px; }
/* The work feed's meta line had no layout rule at all, so its three spans
   butted together and read "Dana Herath49m ago". */
.feed-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; color: var(--faint); font-size: 11.5px; }
.feed-meta strong { color: var(--text-strong); }
.feed-author { padding: 0; border: 0; color: var(--text-strong); background: transparent; font-size: 12px; font-weight: 600; cursor: pointer; }
.feed-author:hover { color: var(--accent); text-decoration: underline; }
/* The prompt feed is an accordion. Closed, an exchange is one line, so a day's
   work scans in a screen or two. Open, nothing is clamped and nothing is cut —
   reading and scanning are different jobs and a fixed-height card served
   neither. */
/* min-width:0 because #promptList is a grid, and a grid item defaults to
   min-width:auto — the one-line summary would otherwise refuse to shrink
   below its own nowrap text and push the timestamps off screen. */
.feed-item { min-width: 0; padding: 0; border: none; border-radius: 0; background: none; box-shadow: none; }
.feed-item + .feed-item { border-top: 1px solid var(--line-soft); }

.feed-head { display: flex; align-items: baseline; gap: 12px; padding: 10px 2px; cursor: pointer; list-style: none; }
.feed-head::-webkit-details-marker { display: none; }
.feed-head::before { content: "\25B8"; flex: none; color: var(--accent); font-size: 10px; line-height: 1.6; transition: transform .15s; }
.feed-item[open] .feed-head::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .feed-head::before { transition: none; } }
.feed-head:hover { background: var(--surface-sunken); border-radius: 8px; }
.feed-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }

/* The ask is the one thing worth reading at a glance, so it takes the room and
   everything else is pushed to the right at a smaller weight. */
.feed-head-ask { flex: 1; min-width: 0; color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Open, the summary carries the prompt in full. The row header stops being a
   preview and becomes the prompt itself, so the body needs only the reply. */
.feed-item[open] .feed-head { align-items: flex-start; }
.feed-item[open] .feed-head-ask { overflow: visible; text-overflow: clip; white-space: pre-wrap; word-break: break-word; font-weight: 500; line-height: 1.55; }
.feed-head-meta { flex: none; display: flex; align-items: baseline; gap: 9px; color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.feed-head-repo { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }

.feed-body { padding: 2px 2px 14px 20px; }
.feed-block + .feed-block { margin-top: 10px; }
.feed-block-label { display: block; margin-bottom: 4px; color: var(--faint); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.feed-block-text { margin: 0; color: var(--text); font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.feed-block-reply .feed-block-text { padding: 10px 13px; border-radius: 11px; background: var(--quote-bg); color: var(--quote-ink); font-size: 12.5px; }
.feed-block-empty { color: var(--faint); font-style: italic; }

@media (max-width: 620px) { .feed-head-repo { display: none; } }
.acts { display: grid; flex: 1; align-content: space-evenly; gap: 10px; min-height: 0; margin-top: 14px; }
.act { position: relative; min-height: 60px; overflow: hidden; border-radius: 13px; background: var(--act-track); }
.act > div { position: absolute; inset: 0 auto 0 0; display: flex; flex-direction: column; justify-content: center; padding: 0 18px; border-radius: 13px; }
.act strong { color: var(--ink); font-size: 15px; font-weight: 500; white-space: nowrap; }
.act small { margin-top: 4px; color: var(--text-soft); font-size: 12.5px; white-space: nowrap; }

/* Token activity */
.legend { display: flex; flex-wrap: wrap; gap: 14px; }
.legend span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; }
.bars { display: grid; flex: 1; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 14px; min-height: 0; margin-top: 18px; }
.bar-col { display: flex; flex-direction: column; justify-content: flex-end; gap: 9px; min-height: 0; }
.bar-stack { display: flex; flex-direction: column-reverse; gap: 3px; }
.bar-stack i { border-radius: 4px; }
.bar-col span { color: var(--muted); font-size: 12px; text-align: center; }

/* Users */
.users { display: grid; gap: 2px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.form-message { flex: none; min-height: 1.2em; margin-top: 10px !important; color: #3c7a52; font-size: 12.5px; }
.ws-empty { padding: 28px 10px; color: var(--faint); font-size: 13px; text-align: center; }

/* Infinite-scroll sentinel. Sits where the next page will appear, so the feed
   reads as continuous rather than as a list that stopped. */
.feed-sentinel { padding: 18px 10px; color: var(--faint); font-size: 12px; text-align: center; }
.feed-sentinel-error { color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 8px; }
.dark .feed-sentinel { color: var(--on-contrast-muted); }

/* Modal */
dialog.modal { width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 22px; color: var(--text); background: var(--surface); box-shadow: var(--modal-shadow); font-family: "Inter Var", Inter, ui-sans-serif, -apple-system, sans-serif; }
dialog.modal::backdrop { background: rgba(22, 27, 38, .38); backdrop-filter: blur(5px); }
dialog.modal h2, dialog.modal p { margin: 0; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 0; }
.modal-head h2 { color: var(--ink); font-size: 20px; font-weight: 600; }
.modal-head p { margin-top: 6px; color: var(--muted); font-size: 13px; }
.modal-close { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; color: var(--text-soft); background: var(--surface); box-shadow: 0 1px 3px rgba(22, 29, 45, .08); font-size: 18px; cursor: pointer; }
.modal-body { padding: 4px 24px 24px; }
.about-body p { margin-top: 14px; color: var(--text-soft); font-size: 13.5px; line-height: 1.6; }
.about-body strong { color: var(--ink); }
/* Empty-state text over a chart. There were two of these: the later one
   overrode the first with a light-only #9ba6b6. One themed rule now. */
.chart-empty { position: absolute; inset: 42% 0 auto; color: var(--faint);
  font-size: 13px; text-align: center; }

/* Was #5c6169 on rgba(240,242,246,.85): one pair of literals for both
   themes, so in dark this was a pale box with grey text inside a dark
   dialog. */
.modal-note { display: flex; gap: 10px; margin-top: 16px; padding: 12px 14px; border-radius: 13px; color: var(--soft); background: var(--surface-sunken); font-size: 12.5px; line-height: 1.5; }
.modal-note .ico { flex: none; margin-top: 1px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal .form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin-top: 16px; }
.modal .form label { display: grid; gap: 6px; color: var(--text-soft); font-size: 12.5px; }
.modal .form .full { grid-column: 1 / -1; }
.modal .form input { height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface); font-family: inherit; font-size: 14px; }
.modal .form input:focus { border-color: var(--focus-ring); outline: 0; box-shadow: 0 0 0 3px rgba(183, 139, 240, .14); }
.modal .error { margin-top: 10px; color: var(--danger); font-size: 12.5px; }

@keyframes ws-spin { to { transform: rotate(360deg); } }
@keyframes ws-grow { from { opacity: 0; transform: scaleX(.65); transform-origin: left; } to { opacity: 1; transform: scaleX(1); transform-origin: left; } }

@media (max-width: 1500px) {
  .canvas { padding-right: 20px; padding-left: 102px; }
  .crumb { display: none; }
  .search { max-width: 300px; }
  .tab { padding: 0 11px; font-size: 13px; }
  .rank-row { grid-template-columns: 36px minmax(0, 1fr) auto; min-height: 52px; }
  .ring { width: 36px; height: 36px; }
}
@media (max-width: 1280px) {
  .search kbd, .select-pill .ico:first-child { display: none; }
  .live-pill span { display: none; }
  .live-pill { padding: 0 14px; }
}
@media (max-height: 900px) {
  .hello h1 { font-size: 26px; }
  .stat-row strong { font-size: 24px; }
  .spark { width: 116px; height: 38px; }
  .stat p { margin-top: 14px; font-size: 13.5px; }
  .stat-ico { width: 36px; height: 36px; }
  .search, .pill { height: 44px; }
  .profile { height: 48px; }
  .face { width: 40px; height: 40px; }
}
@media (max-height: 760px) {
  .hello p { display: none; }
  .rank-foot:last-of-type { display: none; }
}
/* Below this a single screen cannot hold the layout; scroll normally. */
@media (max-width: 1180px) {
  .ws-shell { position: static; display: block; min-height: 100vh; overflow: visible; }
  .rail-wrap { position: sticky; top: 0; bottom: auto; z-index: 50; flex-direction: row; justify-content: flex-start; padding: 10px 14px; overflow-x: auto; background: rgba(250, 250, 252, .9); backdrop-filter: blur(10px); pointer-events: auto; }
  .rail { flex-direction: row; overflow-x: auto; }
  .rail-item::after { display: none; }
  .canvas { padding: 14px 16px 24px; }
  .top { flex-wrap: wrap; }
  .search { order: 5; max-width: none; margin-left: 0; }
  .hello { flex-direction: column; align-items: stretch; }
  .hello-actions { flex-wrap: wrap; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .mid, .view.duo { grid-template-columns: minmax(0, 1fr); }
  .mid > .card, .view.duo > .card { min-height: 340px; }
  .view.single > .card { min-height: 420px; }
  .modal .form { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .bars { gap: 6px; }
  .profile strong, .profile small { display: none; }
  .profile { padding: 0 5px; }
}
@media (prefers-reduced-motion: reduce) {
  .ws-shell *, .ws-shell *::before, .ws-shell *::after { animation: none !important; transition: none !important; }
}
/* Carried over: profile trend chart, donut, search results, password dialog */
.token-donut { position: relative; display: grid; place-items: center; width: 108px; aspect-ratio: 1; flex: none; border-radius: 50%; background: var(--track-solid); animation: dashboard-pop .7s .3s ease-out both; }
.token-donut::before { position: absolute; inset: 12px; border-radius: 50%; background: var(--surface); box-shadow: 0 2px 8px rgba(36, 50, 79, .06); content: ""; }
.token-donut > span { position: relative; z-index: 1; text-align: center; }
.token-donut small { display: block; color: var(--faint-cool); font-size: .43rem; font-weight: 800; letter-spacing: .08em; }
.token-donut strong { display: block; margin-top: 3px; color: #223047; font-size: .83rem; }
.password-dialog { border-color: var(--line); border-radius: 15px; }
.password-dialog h3 { color: #1f2c40; }
.password-dialog .primary { color: var(--on-fixed); background: #3972ee; }
.password-dialog .secondary { color: #536a94; background: var(--info-bg); }
.search-results { position: absolute; z-index: 35; top: calc(100% + 7px); left: 0; width: min(345px, 85vw); padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 16px 42px rgba(28,42,74,.16); }
.search-results[hidden] { display: none; }
.search-result { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.search-result:hover, .search-result:focus-visible { background: var(--hover); }
.search-result > span:nth-child(2) { flex: 1; min-width: 0; }
.search-result strong, .search-result small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result strong { color: #243148; font-size: .71rem; }
.search-result small { color: #91a0b3; font-size: .62rem; }
.search-empty { margin: 0; padding: 13px; color: #7e8ba1; font-size: .72rem; }
.feed-author { padding: 0; border: 0; color: var(--text-strong); background: transparent; font-size: .69rem; font-weight: 750; cursor: pointer; }
.feed-author:hover { color: #3f71e8; text-decoration: underline; }

/* ---------- Employee profile dialog (tabbed) ---------- */
.profile-dialog {
  flex-direction: column;
  width: min(1180px, calc(100vw - 48px));
  max-width: none;
  height: var(--dialog-h);
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 24px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 34px 100px rgba(18, 24, 38, .3);
  font-family: "Inter Var", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.profile-dialog[open] { display: flex; }
.profile-dialog::backdrop { background: rgba(22, 27, 38, .4); backdrop-filter: blur(6px); }
.profile-dialog h2, .profile-dialog p { margin: 0; }
.profile-dialog button { font: inherit; color: inherit; cursor: pointer; }

.dlg-head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 20px; background: var(--surface); }
.dlg-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.dlg-face { position: relative; display: grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 50%; color: var(--on-fixed); background: linear-gradient(145deg, #b78bf0, #e984c0); font-size: 17px; font-weight: 600; }
.dlg-face.online::after { position: absolute; right: 1px; bottom: 1px; width: 13px; height: 13px; border: 2.5px solid var(--surface); border-radius: 50%; background: var(--positive); content: ""; }
.dlg-id h2 { color: var(--ink); font-size: 21px; font-weight: 650; letter-spacing: -.015em; }
.dlg-id p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.dlg-head-right { display: flex; align-items: center; gap: 12px; }
.tabs.small .tab { height: 32px; padding: 0 13px; font-size: 13px; }

.dlg-tabs { display: flex; flex: none; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--line-strong); background: var(--surface); }
.dlg-tab { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 0; color: var(--muted); background: transparent; font-size: 14px; white-space: nowrap; }
.dlg-tab .ico { width: 16px; height: 16px; }
.dlg-tab:hover { color: var(--ink); }
.dlg-tab.active { color: var(--ink); font-weight: 500; }
.dlg-tab.active::after { position: absolute; right: 10px; bottom: -1px; left: 10px; height: 2px; border-radius: 2px 2px 0 0; background: linear-gradient(90deg, #e37fb8, #b98ce0, #7f93ea); content: ""; }
.tab-count { padding: 2px 7px; border-radius: 7px; color: var(--chip-ink); background: rgba(20, 26, 40, .06); font-size: 11px; }
.tab-count:empty { display: none; }
.dlg-tab.active .tab-count { color: var(--info-ink); background: var(--info-bg); }

.dlg-body-area { flex: 1; min-height: 0; padding: 16px 20px; background: var(--surface-sunken); }
.dlg-panels { height: 100%; }
.dlg-panels[hidden] { display: none; }
.dlg-panel { display: none; flex-direction: column; gap: 13px; height: 100%; }
.dlg-panel.active { display: flex; }
.profile-status { display: flex; align-items: center; justify-content: center; gap: 12px; height: 100%; color: var(--muted); font-size: 14px; }
.profile-status[hidden] { display: none; }
.detail-spinner { width: 17px; height: 17px; border: 2px solid rgba(20, 26, 40, .14); border-top-color: #b78bf0; border-radius: 50%; animation: ws-spin .9s linear infinite; }
.employee-retry { height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); background: var(--surface); font-size: 13px; }

.dlg-stats { display: grid; flex: none; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.dlg-stats .stat { padding: 14px 16px 15px; }
.dlg-stats .stat p { margin-top: 16px; font-size: 13.5px; }
.dlg-stats .stat-row strong { font-size: 23px; }
.dlg-stats .spark { top: 16px; right: 14px; width: 104px; height: 38px; }
.dlg-split { display: grid; flex: 1; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 13px; min-height: 0; }
.dlg-split.work { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.dlg-split > .card { display: flex; flex-direction: column; min-height: 0; padding: 16px 18px; border-color: rgba(20, 26, 40, .11); }
.dlg-split .card h2 { font-size: 16.5px; }
.dlg-chart-card .card-top { flex-wrap: wrap; gap: 10px; }
.dlg-chart-card .chart { flex: 1; min-height: 0; margin-top: 10px; }
.profile-dialog .bubble { white-space: nowrap; }
.profile-dialog .bubble small, .profile-dialog .bubble span { display: block; white-space: nowrap; }

.token-layout { display: flex; flex: 1; align-items: stretch; gap: 18px; min-height: 0; margin-top: 14px; }
.profile-dialog .token-donut { position: relative; display: grid; place-items: center; width: 128px; aspect-ratio: 1; flex: none; align-self: center; border-radius: 50%; }
.profile-dialog .token-donut::before { position: absolute; inset: 13px; border-radius: 50%; background: var(--surface); content: ""; }
.profile-dialog .token-donut > span { position: relative; text-align: center; }
.profile-dialog .token-donut small { display: block; color: var(--faint-cool); font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.profile-dialog .token-donut strong { display: block; margin-top: 3px; color: var(--ink); font-size: 19px; font-weight: 600; }
.token-breakdown { display: grid; flex: 1; align-content: space-evenly; gap: 14px; min-width: 0; }
.token-breakdown .row-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: var(--text-soft); font-size: 12.5px; }
.token-breakdown .row-label > span { display: flex; align-items: center; gap: 8px; }
.token-breakdown .swatch { width: 10px; height: 10px; flex: none; border-radius: 3px; box-shadow: 0 0 0 1px rgba(20, 26, 40, .12); }
.token-breakdown .row-share { color: var(--faint); font-size: 11.5px; }
.token-breakdown .row-label strong { color: var(--ink); font-weight: 500; }
.token-breakdown .track { height: 8px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--track); }
.token-breakdown .track i { display: block; height: 100%; min-width: 6px; border-radius: 5px; }

.signal-grid { display: grid; flex: 1; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(78px, 104px); align-content: start; gap: 11px; min-height: 0; margin-top: 14px; }
.signal { display: flex; flex-direction: column; justify-content: center; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: 0 1px 2px rgba(22, 29, 45, .04); }
.signal span { color: var(--muted); font-size: 11.5px; }
.signal strong { margin-top: 5px; color: var(--ink); font-size: 19px; font-weight: 600; }
.dlg-tools .ticks { flex: 1; justify-content: space-evenly; min-height: 0; margin-top: 12px; overflow: hidden; }
.dlg-tools .tick-row { min-height: 0; max-height: none; padding: 5px 0; }

.profile-dialog .list-card { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 16px 18px; }
.profile-dialog .list-card .card-top { align-items: center; }
.profile-dialog .search.inline { height: 40px; max-width: 280px; margin-left: auto; }

.dlg-foot { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px 14px; border-top: 1px solid var(--line-strong); background: var(--surface); color: var(--faint); font-size: 11.5px; }
.dlg-foot-actions { display: flex; flex: none; gap: 9px; }
.dlg-foot .pill { height: 38px; padding: 0 16px; font-size: 13px; }

@media (max-width: 1100px) {
  .profile-dialog { width: calc(100vw - 20px); height: calc(100vh - 24px); border-radius: 18px; }
  .dlg-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dlg-split, .dlg-split.work { grid-template-columns: minmax(0, 1fr); }
  .signal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dlg-tabs { overflow-x: auto; }
  .dlg-head { flex-wrap: wrap; }
  .dlg-foot { flex-direction: column; align-items: flex-start; }
}

/* ---------- Reset password dialog (self-contained) ---------- */
.password-dialog {
  width: min(430px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(18, 24, 38, .26);
  font-family: "Inter Var", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.password-dialog::backdrop { background: rgba(22, 27, 38, .38); backdrop-filter: blur(5px); }
.password-dialog form { display: grid; gap: 14px; }
.password-dialog h3 { margin: 0; color: var(--ink); font-size: 18px; font-weight: 600; }
.password-dialog .muted { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.password-dialog label { display: grid; gap: 6px; color: var(--text-soft); font-size: 12.5px; }
.password-dialog input { height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 13px; color: var(--ink); background: var(--surface); font-family: inherit; font-size: 14px; }
.password-dialog input:focus { border-color: var(--focus-ring); outline: 0; box-shadow: 0 0 0 3px rgba(183, 139, 240, .14); }
.password-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.password-dialog button { height: 44px; padding: 0 20px; border: 0; border-radius: 22px; font-family: inherit; font-size: 14px; cursor: pointer; }
.password-dialog .primary { color: var(--on-fixed); background: #111316; }
.password-dialog .secondary { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px rgba(20, 26, 40, .1); }
.password-dialog .error { margin: 0; min-height: 1em; color: var(--danger); font-size: 12.5px; }

/* Models tab */
.model-card { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.model-pill { flex: none; padding: 5px 11px; border-radius: 999px; color: var(--chip-ink); background: var(--chip); font-size: 12px; white-space: nowrap; }
.model-hero { display: flex; flex: 1; flex-direction: column; align-items: center; min-height: 0; margin-top: 16px; }
.model-donut { position: relative; display: grid; place-items: center; width: 300px; aspect-ratio: 1; flex: none; border-radius: 50%; background: var(--track-solid); }
.model-donut::before { position: absolute; inset: 40px; border-radius: 50%; background: var(--surface); content: ""; }
.model-donut > span { position: relative; z-index: 1; text-align: center; }
.model-donut small { display: block; color: var(--faint-cool); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.model-donut strong { display: block; color: var(--ink); font-size: 42px; font-weight: 600; letter-spacing: -.02em; }
.model-donut em { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-style: normal; }
.model-legend { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 9px 26px; min-height: 0; margin-top: 26px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.model-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; background: var(--surface-sunken); }
.model-item .model-name { overflow: hidden; color: var(--text); font-size: 13.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.model-item b { color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 600; }
.model-item .model-sub { grid-column: 2 / -1; margin-top: -2px; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.model-empty { margin-top: 18px; color: var(--muted); font-size: 13px; }

/* The page background lived nowhere; styles.css only reset the margin. */
html { background: var(--page); }
body { background: var(--page); color: var(--text); }

/* Wide dialogs: tool usage and manage users */
dialog.wide-dialog { width: min(1120px, calc(100vw - 48px)); height: var(--dialog-h); max-height: none; padding: 0; border: 1px solid var(--line); border-radius: 22px; color: var(--text); background: var(--surface); box-shadow: var(--modal-shadow); font-family: inherit; }
dialog.wide-dialog::backdrop { background: rgba(10, 14, 20, .5); backdrop-filter: blur(2px); }
.wd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
/* Was a bare #e4e6eb with no dark counterpart, so in dark mode this was a
   near-white disc carrying a near-white icon: the close button vanished. */
.wd-head .round-btn.light { background: var(--round-close-bg); border-color: var(--round-close-line); }
.wd-head .round-btn.light:hover { border-color: var(--muted); }
.wd-head h2 { color: var(--ink); font-size: 18.5px; font-weight: 600; letter-spacing: -.012em; }
.wd-head p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.wd-head-actions { display: flex; align-items: center; gap: 9px; }
.wd-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 24px; border-top: 1px solid var(--line); background: var(--surface-sunken); }
.wd-foot span { color: var(--muted); font-size: 12.5px; }
.btn-ghost { padding: 8px 14px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--surface); font: inherit; font-size: 13px; cursor: pointer; }
.btn-ghost:hover { background: var(--hover); }

/* Tool usage rows */
.tool-rows { padding: 6px 0; }
.tool-row { display: grid; grid-template-columns: minmax(0, 1fr) 118px 96px; align-items: center; gap: 18px; padding: 12px 24px; }
.tool-row:hover { background: var(--hover); }
.tool-row code { color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 500; }
.tool-bar { height: 7px; margin-top: 7px; overflow: hidden; border-radius: 4px; background: var(--track); }
.tool-bar i { display: block; height: 100%; min-width: 3px; border-radius: 4px; }
.tool-count { color: var(--ink); font-size: 13.5px; font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.tool-count small { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.tool-people { display: flex; justify-content: flex-end; }
.tool-av { display: grid; place-items: center; width: 24px; height: 24px; margin-left: -7px; border: 2px solid var(--surface); border-radius: 50%; color: var(--on-fixed); font-size: 10px; font-weight: 600; }

/* Manage users master-detail */
.wd-split { display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: 0; flex: 1 1 auto; }
/* An explicit display beats the UA's [hidden] rule, so the inactive tab needs
   its own: without this both panes render on top of each other. */
.wd-split[hidden] { display: none; }
.wd-side { overflow: auto; border-right: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.wd-detail { padding: 22px 26px; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.u-item { display: grid; width: 100%; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 11px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; font: inherit; text-align: left; cursor: pointer; }
.u-item:hover { background: var(--hover); }
.u-item.selected { background: var(--hover); box-shadow: inset 3px 0 0 var(--accent); }
.u-item strong { display: block; overflow: hidden; color: var(--ink); font-size: 13.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.u-item small { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; }
.u-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; }
.u-head { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.u-head h3 { color: var(--ink); font-size: 19px; font-weight: 600; }
.u-head p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.u-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0 4px; }
.u-stat { padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface-sunken); }
.u-stat p { color: var(--muted); font-size: 11.5px; }
.u-stat strong { display: block; margin-top: 4px; color: var(--ink); font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
.u-sect h4 { margin: 20px 0 2px; color: var(--ink); font-size: 13px; font-weight: 600; }
.u-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.u-row:last-child { border-bottom: 0; }
.u-row p { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.u-row p.t { color: var(--ink); font-size: 13.5px; }
.u-empty { padding: 40px 0; color: var(--muted); font-size: 13.5px; text-align: center; }

/* ---------- team chat ---------- */
.rail-item { position: relative; }
.rail-badge {
  position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--surface);
}
/* A class with display:grid outranks the [hidden] attribute's UA rule. */
.rail-badge[hidden] { display: none; }
.chat-card { padding: 0; overflow: hidden; }
.chat-grid { display: grid; grid-template-columns: 248px 1fr; flex: 1; min-height: 0; height: 100%; }
.chat-roster { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface-sunken); }
.chat-roster-head, .rp-side-head {
  /* Title and action on top, search beneath — the shape the ticket queue
     already uses, and the only way the search keeps a usable width. */
  display: flex; flex-direction: column; gap: 9px; padding: 12px; border-bottom: 1px solid var(--line);
}
.side-head-top { display: flex; align-items: center; gap: 10px; }
.side-head-top strong { flex: 1; min-width: 0; color: var(--ink); font-size: 13px; font-weight: 600; }
.chat-search {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px;
  font: 13px var(--font); color: var(--text); background: var(--surface); outline: 0;
}
.chat-search:focus { border-color: var(--accent-soft); box-shadow: 0 0 0 3px rgba(138, 99, 210, .1); }
.chat-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 0; }
.chat-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; cursor: pointer; border: 0; width: 100%; background: none; text-align: left; }
.chat-row:hover { background: var(--chip); }
.chat-row.active { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
.chat-ava { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 600; }
.chat-ava.hash { border-radius: 9px; background: var(--chip); color: var(--muted); font-size: 15px; }
.chat-row-main { flex: 1; min-width: 0; }
.chat-row-top { display: flex; gap: 8px; align-items: baseline; }
.chat-row-top strong { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row-top time { flex: none; font-size: 11px; color: var(--faint); }
.chat-snippet { font-size: 12px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chat-unread { flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.chat-new-tag { flex: none; font-size: 10px; font-weight: 700; letter-spacing: .04em; color: var(--accent); }
.chat-group { padding: 10px 12px 4px; font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }

.chat-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-thread-head { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); min-height: 61px; }
.chat-thread-head h3 { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.chat-thread-head p { font-size: 12px; color: var(--faint); margin-top: 2px; }
.chat-messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.chat-msg { display: flex; gap: 11px; }
.chat-msg-body { min-width: 0; flex: 1; }
.chat-msg-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; }
.chat-msg-head strong { font-size: 13px; font-weight: 600; color: var(--ink); }
.chat-msg-head time { font-size: 11px; color: var(--faint); }
.chat-msg-text { font-size: 13.5px; line-height: 1.6; color: var(--text); white-space: pre-wrap; word-wrap: break-word; }
.chat-day { display: flex; align-items: center; gap: 10px; }
.chat-day i { flex: 1; height: 1px; background: var(--line); }
.chat-day span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.chat-empty { margin: auto; padding: 30px 20px; text-align: center; font-size: 13px; color: var(--faint); line-height: 1.6; }
.chat-composer { display: flex; gap: 9px; align-items: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); }
.chat-composer textarea {
  flex: 1; resize: none; min-height: 40px; max-height: 140px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 11px; font: 13.5px/1.55 var(--font);
  color: var(--text); background: var(--surface); outline: 0;
}
.chat-composer textarea:focus { border-color: var(--accent-soft); box-shadow: 0 0 0 3px rgba(138, 99, 210, .1); }
.chat-composer[hidden] { display: none; }

/* ---------- tickets ---------- */
/* The two dark controls below reuse the chrome literal that .pill.dark and
   .rail-item.active already use: it is the one fill that stays put across
   themes, which is what --on-fixed exists for. */
.tk-card { padding: 0; overflow: hidden; }
.tk-grid { display: grid; grid-template-columns: 320px 1fr; flex: 1; min-height: 0; height: 100%; }

.tk-queue { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface-sunken); }
.tk-queue-head { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.tk-queue-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tk-queue-top strong { color: var(--ink); font-size: 13px; font-weight: 600; }
/* One segmented bar, glyphs only — the same grammar as the period and
   metric switchers elsewhere in the dashboard. */
.tk-chips {
  display: flex; gap: 2px; padding: 3px; min-width: 0;
  border-radius: 15px; background: var(--segment-bg);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}
.tk-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  flex: 1; min-width: 0; height: 28px; padding: 0 6px; border: 0; border-radius: 12px;
  color: var(--muted); background: transparent; font-size: 12px;
}
.tk-chip:hover { color: var(--ink); background: var(--glass); }
.tk-chip.active {
  color: var(--ink); background: var(--surface); font-weight: 500;
  box-shadow: 0 1px 3px rgba(22, 29, 45, .09);
}
.tk-chip .ico { width: 14px; height: 14px; flex: none; opacity: .7; }
.tk-chip.active .ico { opacity: 1; }
.tk-chip b {
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}
.tk-chip b.zero { color: var(--faint-cool); font-weight: 500; }
.tk-chip.active b { color: var(--ink); }
button.tk-new, .tk-new { display: inline-flex; align-items: center; gap: 6px; height: 28px; flex: none; padding: 0 12px; border: 0; border-radius: 15px; color: var(--on-fixed); background: #17191c; font-size: 12.5px; font-weight: 500; }
.tk-new:hover { background: #22262c; }
.tk-new .ico { width: 13px; height: 13px; }

.tk-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.tk-row { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 11px 12px; border: 0; border-bottom: 1px solid var(--line-soft); background: none; text-align: left; cursor: pointer; }
.tk-row:hover { background: var(--chip); }
.tk-row.active { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
.tk-row-top { display: flex; align-items: center; gap: 7px; }
.tk-row-top time { margin-left: auto; flex: none; font-size: 11px; color: var(--faint); }
.tk-badge { flex: none; padding: 2px 7px; border-radius: 6px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.tk-badge.review { color: var(--info-ink); background: var(--info-bg); }
.tk-badge.guidance { color: var(--amber-ink); background: var(--amber-bg); }
.tk-id { flex: none; color: var(--faint); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tk-row-title { color: var(--ink); font-size: 13.5px; font-weight: 500; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tk-row-foot { display: flex; align-items: center; gap: 7px; min-width: 0; }
.tk-row-who { min-width: 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-row-step { margin-left: auto; flex: none; color: var(--faint); font-size: 11px; }
.tk-ava { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: var(--on-fixed); font-size: 10px; font-weight: 600; }
.tk-ava.none { color: var(--faint); background: var(--chip); border: 1px dashed var(--line); }

.tk-track { display: flex; gap: 3px; }
.tk-track i { flex: 1; height: 3px; border-radius: 2px; background: var(--ring-track); }
.tk-track i.on { background: var(--accent); }
.tk-track i.on.closed { background: var(--positive); }

.tk-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tk-thread-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.tk-thread-head[hidden] { display: none; }
.tk-head-main { display: flex; flex: 1; flex-direction: column; gap: 7px; min-width: 0; }
.tk-head-main .tk-track { max-width: 280px; }
.tk-head-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tk-head-line h3 { color: var(--ink); font-size: 15.5px; font-weight: 600; letter-spacing: -.012em; }
.tk-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.tk-status { padding: 2px 8px; border-radius: 7px; color: var(--neutral-ink); background: var(--neutral-bg); font-size: 11.5px; font-weight: 600; }
.tk-status.s3 { color: var(--info-ink); background: var(--info-bg); }
.tk-status.s4 { color: var(--ok-ink); background: var(--ok-bg); }
.tk-route { display: inline-flex; align-items: baseline; gap: 5px; }
.tk-route b { color: var(--text-strong); font-weight: 600; }
.tk-route em { color: var(--faint); font-style: normal; }
.tk-tag { padding: 2px 7px; border-radius: 6px; color: var(--chip-ink); background: var(--chip); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.tk-when { color: var(--faint); }
.tk-head-side { display: flex; flex: none; flex-direction: column; align-items: flex-end; gap: 8px; }
button.tk-action, .tk-action { height: 36px; padding: 0 18px; border: 0; border-radius: 18px; color: var(--on-fixed); background: #111316; font-size: 13.5px; font-weight: 500; }
.tk-action:hover { background: #22262c; }
.tk-action:disabled { opacity: .55; cursor: default; }
.tk-await { color: var(--faint); font-size: 12px; }
.tk-report-link { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--surface); font-size: 12px; }
.tk-report-link:hover { background: var(--hover); }
.tk-report-link .ico { width: 14px; height: 14px; }
.tk-msg .tk-report-link { margin-top: 7px; }

.tk-entries { display: flex; flex: 1 1 auto; flex-direction: column; gap: 13px; min-height: 0; overflow-y: auto; padding: 16px; }
.tk-entries[hidden] { display: none; }
.tk-msg { display: flex; gap: 11px; }
.tk-event { display: flex; align-items: center; gap: 9px; padding-left: 4px; color: var(--muted); font-size: 12.5px; }
.tk-event-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-soft); box-shadow: 0 0 0 3px var(--track); }
.tk-event-text { flex: 1; min-width: 0; }
.tk-event time { flex: none; color: var(--faint); font-size: 11px; }
.tk-empty { margin: auto; max-width: 340px; padding: 30px 20px; color: var(--faint); font-size: 13px; line-height: 1.6; text-align: center; }
.tk-error { color: var(--danger); font-size: 12px; line-height: 1.5; }
.tk-error:empty { display: none; }

.tk-reply { display: flex; gap: 9px; align-items: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); }
.tk-reply[hidden] { display: none; }
.tk-reply textarea {
  flex: 1; resize: none; min-height: 40px; max-height: 140px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 11px; font-family: inherit; font-size: 13.5px;
  line-height: 1.55; color: var(--text); background: var(--surface); outline: 0;
}
button.tk-send, .tk-send { flex: none; height: 40px; padding: 0 18px; border: 0; border-radius: 11px; color: var(--on-fixed); background: #111316; font-size: 13.5px; font-weight: 500; }
.tk-send:hover { background: #22262c; }
.tk-send:disabled { opacity: .55; cursor: default; }

/* Compose reads as a message, not a form: a kind, a recipient, a subject line
   and a body. Everything else the contract allows is optional and tucked away. */
.tk-compose { display: flex; flex: 1; flex-direction: column; gap: 11px; min-height: 0; padding: 16px; overflow-y: auto; }
.tk-compose[hidden] { display: none; }
.tk-compose-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tk-kinds { display: inline-flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--segment-bg); }
.tk-kind { height: 30px; padding: 0 13px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 13px; }
.tk-kind:hover { color: var(--ink); }
.tk-kind.active { color: var(--ink); background: var(--surface); font-weight: 500; }
.tk-field { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.tk-select { height: 34px; max-width: 210px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface); font-size: 13px; outline: 0; }
.tk-close { margin-left: auto; display: grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: 50%; color: var(--muted); background: transparent; }
.tk-close:hover { color: var(--ink); background: var(--hover); }
.tk-close .ico { width: 16px; height: 16px; }
.tk-subject {
  padding: 6px 2px 10px; border: 0; border-bottom: 1px solid var(--line); outline: 0;
  color: var(--ink); background: transparent; font-size: 19px; font-weight: 600; letter-spacing: -.015em;
}
.tk-subject::placeholder { color: var(--faint); font-weight: 400; }
.tk-subject:focus { border-bottom-color: var(--accent-soft); }
.tk-body {
  /* Sized to its content, not to the pane: a tall empty box reads as
     something gone wrong rather than as room to write. */
  flex: none; resize: none; min-height: 112px; max-height: 320px; padding: 2px;
  border: 0; outline: 0; overflow-y: auto;
  color: var(--text); background: transparent; font-family: inherit; font-size: 14px; line-height: 1.65;
}
.tk-body::placeholder, .tk-reply textarea::placeholder { color: var(--faint); }
.tk-compose-foot { display: flex; align-items: center; gap: 12px; padding-top: 11px; border-top: 1px solid var(--line-soft); }
.tk-compose-foot .tk-error { flex: 1; }
.tk-compose-foot .tk-send { margin-left: auto; }
.tk-branch {
  width: 220px; height: 34px; flex: none; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px;
  outline: 0; color: var(--text); background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
}

/* ---------- reports ---------- */
.rp-card { padding: 0; overflow: hidden; }
.rp-grid { display: grid; grid-template-columns: 300px 1fr; flex: 1; min-height: 0; height: 100%; }
.rp-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface-sunken); }
.rp-search {
  flex: 1; min-width: 0; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; outline: 0;
  color: var(--text); background: var(--surface); font-family: inherit; font-size: 13px;
}
.rp-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 0; scrollbar-width: thin; }
.rp-row { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 10px 12px; border: 0; background: none; text-align: left; cursor: pointer; }
.rp-row:hover { background: var(--chip); }
.rp-row.active { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
.rp-name { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-row-meta { margin-top: 2px; color: var(--faint); font-size: 11px; }

.rp-doc { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.rp-doc-head { flex: none; padding: 16px 20px 14px; border-bottom: 1px solid var(--line); }
.rp-doc-head[hidden] { display: none; }
.rp-doc-head h3 { color: var(--ink); font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
.rp-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 7px; color: var(--muted); font-size: 12px; }
.rp-meta time { color: var(--faint); }
.rp-doc-body { display: flex; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 24px 28px; scrollbar-width: thin; }
.rp-doc-body[hidden] { display: none; }

.md { max-width: 74ch; color: var(--text); font-size: 14px; line-height: 1.7; }
.md h2, .md h3, .md h4, .md h5 { color: var(--ink); font-weight: 600; letter-spacing: -.01em; }
.md h2 { margin: 24px 0 9px; font-size: 17px; }
.md h3 { margin: 20px 0 7px; font-size: 15.5px; }
.md h4 { margin: 18px 0 6px; font-size: 14px; }
.md h5 { margin: 16px 0 5px; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.md > :first-child { margin-top: 0; }
.md p { margin: 0 0 13px; }
.md ul, .md ol { margin: 0 0 13px; padding-left: 21px; }
.md li { margin-bottom: 5px; }
.md strong { color: var(--ink); font-weight: 600; }
.md code { padding: 1.5px 5px; border-radius: 5px; color: var(--ink); background: var(--chip); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

.rp-compose { display: flex; flex: 1; flex-direction: column; gap: 11px; min-height: 0; padding: 16px 20px; overflow-y: auto; }
.rp-compose[hidden] { display: none; }
.rp-compose-top { display: flex; align-items: center; gap: 10px; }
.rp-compose-top h3 { color: var(--ink); font-size: 15px; font-weight: 600; }
.rp-name-input {
  height: 34px; flex: none; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; outline: 0;
  color: var(--text); background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
}
.rp-markdown {
  flex: none; resize: none; min-height: 168px; max-height: 420px; overflow-y: auto;
  padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; outline: 0; color: var(--text); background: var(--surface-sunken);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.65;
}
.rp-name-input::placeholder, .rp-markdown::placeholder, .rp-search::placeholder, .tk-branch::placeholder { color: var(--faint); }
.rp-compose-foot { display: flex; align-items: center; gap: 12px; }
.rp-compose-foot .tk-error { flex: 1; }
.rp-compose-foot .tk-send { margin-left: auto; }

/* One accent ring for every field these two views own, mixed from the theme's
   accent so it follows light and dark without a second token. */
.tk-reply textarea:focus, .tk-select:focus, .tk-branch:focus,
.rp-search:focus, .rp-name-input:focus, .rp-markdown:focus {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

@media (max-width: 1180px) {
  .tk-grid, .rp-grid { grid-template-columns: minmax(0, 1fr); height: auto; }
  .tk-queue, .rp-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .tk-list, .rp-list { max-height: 280px; }
  .tk-entries, .rp-doc-body { max-height: 440px; }
  .tk-head-side { flex-direction: row; align-items: center; }
}

.tk-empty strong { display: block; margin-bottom: 5px; color: var(--text-strong); font-size: 13.5px; font-weight: 600; }
.tk-empty p { color: var(--faint); font-size: 12px; line-height: 1.5; }

.tk-handover {
  border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px;
  font: 12px var(--font); color: var(--text); background: var(--surface);
  cursor: pointer; outline: 0; max-width: 160px;
}
.tk-handover:hover { background: var(--surface-sunken); }
.tk-handover:focus { border-color: var(--accent-soft); box-shadow: 0 0 0 3px rgba(138, 99, 210, .1); }
.tk-handover:disabled { opacity: .6; cursor: default; }

/* ---------- profile dialog: collaboration overflow menu ---------- */
.dlg-tabs-spacer { flex: 1; }
.dlg-more { position: relative; display: flex; align-items: center; }
.dlg-more-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 12px;
  border: 0; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer;
}
.dlg-more-btn:hover { color: var(--text-strong); }
.dlg-more-btn[aria-expanded="true"], .dlg-more-btn.active { color: var(--ink); font-weight: 500; }
.dlg-more-btn .ico { width: 13px; height: 13px; }
.dlg-menu {
  position: absolute; top: 46px; right: 0; z-index: 30; min-width: 212px; padding: 6px;
  border: 1px solid var(--line); border-radius: 13px;
  background: var(--surface); box-shadow: var(--modal-shadow);
}
.dlg-menu[hidden] { display: none; }
.dlg-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  border: 0; border-radius: 9px; background: transparent;
  color: var(--text); font-size: 13.5px; text-align: left; cursor: pointer;
}
.dlg-menu button:hover { background: var(--surface-sunken); }
.dlg-menu button.active { background: var(--chip); color: var(--ink); font-weight: 500; }
.dlg-menu .ico { width: 16px; height: 16px; flex: none; }
.dlg-menu .n { margin-left: auto; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }

.dlg-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 13px; height: 100%; min-height: 0; }
.dlg-split > .card { min-height: 0; }
.dlg-privacy {
  display: flex; align-items: flex-start; gap: 8px; flex: none;
  padding: 10px 15px; border-top: 1px solid var(--line-soft);
  font-size: 11.5px; color: var(--faint); line-height: 1.5;
}
.dlg-privacy .ico { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.thread-kind { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.thread-kind .ico { width: 15px; height: 15px; }
.thread-kind.review { background: rgba(138, 99, 210, .14); color: var(--accent); }
.thread-kind.guidance { background: var(--warn-bg); color: var(--warn-ink); }
.md-reader { padding: 16px 18px; font-size: 13px; line-height: 1.7; color: var(--text); }
.md-reader h4 { margin: 14px 0 5px; color: var(--ink); font-size: 14px; font-weight: 600; }
.md-reader h4:first-child { margin-top: 0; }
.md-reader ul { margin: 4px 0; padding-left: 18px; }
.md-reader li { margin-bottom: 3px; }
.md-reader p { margin-bottom: 7px; }
.md-reader code { padding: 1px 5px; border-radius: 4px; background: var(--chip); font-family: var(--mono, ui-monospace), Menlo, monospace; font-size: 11.5px; }

/* ---------- compose dialogs ---------- */
.compose-modal { width: min(680px, calc(100vw - 48px)); height: var(--dialog-h-compose); }
.compose-modal[open] { display: flex; flex-direction: column; }
.compose-modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.compose-modal .modal-head { flex: none; }
.compose-modal .modal-body { display: flex; flex-direction: column; gap: 11px; flex: 1 1 auto;
  min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
/* The writing area takes the room that is left instead of setting the height. */
.compose-modal .tk-body, .compose-modal .rp-markdown { flex: 1 1 auto; min-height: 96px; max-height: none; }
.compose-modal .modal-actions { flex: none; }
.compose-modal .tk-compose-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.compose-modal .tk-subject { font-size: 18px; }
.compose-modal .modal-actions { align-items: center; }
.compose-modal .tk-branch { margin-right: auto; max-width: 200px; }
.compose-modal .tk-error:empty { display: none; }

/* ── groups ───────────────────────────────────────────────────────────
   A group's colour is a palette slot, not a stored hex value, so each
   tone is declared once per theme. A pastel that reads well on white
   glows on a dark card, which is why the dark values are washes. */
:root {
  --g1-bg: #ede4fb; --g1-fg: #6a3fb0;
  --g2-bg: #dde9fb; --g2-fg: #2c5f9e;
  --g3-bg: #d6f0ec; --g3-fg: #1f7268;
  --g4-bg: #ddf0de; --g4-fg: #2f7d47;
  --g5-bg: #faeccd; --g5-fg: #8a6420;
  --g6-bg: #fbe3d6; --g6-fg: #9c5527;
  --g7-bg: #fbdde4; --g7-fg: #a23a5b;
  --g8-bg: #e2e5ea; --g8-fg: #4b5563;
}
:root[data-theme="dark"] {
  --g1-bg: rgba(176, 131, 240, .18); --g1-fg: #c4a2f5;
  --g2-bg: rgba( 88, 150, 224, .18); --g2-fg: #8ab6ea;
  --g3-bg: rgba( 60, 178, 164, .18); --g3-fg: #6fc9bc;
  --g4-bg: rgba( 87, 171,  90, .18); --g4-fg: #7cc67f;
  --g5-bg: rgba(204, 153,  70, .18); --g5-fg: #daa15f;
  --g6-bg: rgba(214, 126,  74, .18); --g6-fg: #e0a079;
  --g7-bg: rgba(214,  88, 124, .18); --g7-fg: #e58fa8;
  --g8-bg: rgba(150, 160, 175, .18); --g8-fg: #a9b4c2;
}

.gchips { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-top: 3px; }
.gchip {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 6px;
  border-radius: 99px; background: var(--cbg); color: var(--cfg);
  font-size: 10.5px; font-weight: 500; line-height: 1.5; white-space: nowrap;
}
.gchip .gdot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.gchip.more { background: var(--chip); color: var(--muted); }
.gchip.none { background: transparent; color: var(--faint); }

/* The pool badge on a ticket row and in its header. */
.tk-pool {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px;
  border-radius: 99px; background: var(--cbg); color: var(--cfg);
  font-size: 10.5px; font-weight: 500; white-space: nowrap;
}

/* Membership editing: a chip that is also a switch. */
.g-toggles { display: flex; gap: 6px; flex-wrap: wrap; }
.g-toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--surface);
  color: var(--muted); font-family: inherit; font-size: 12px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .12s cubic-bezier(.23,1,.32,1);
}
.g-toggle .gdot { width: 6px; height: 6px; border-radius: 50%; background: var(--cfg); flex: none; }
.g-toggle:hover { border-color: var(--muted); color: var(--text); }
.g-toggle:active { transform: scale(.96); }
.g-toggle[aria-pressed="true"] { background: var(--cbg); color: var(--cfg); border-color: transparent; font-weight: 500; }
.g-empty { color: var(--faint); font-size: 12.5px; }

/* Groups administration: a second tab in Manage users, with the same two-pane
   geometry as the people tab, so it reads as part of the same dialog. */
.wd-tabs { display: flex; gap: 22px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.wd-tab { position: relative; padding: 11px 0; border: 0; background: none; color: var(--muted);
  font-family: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.wd-tab:hover { color: var(--text); }
.wd-tab.active { color: var(--ink); }
.wd-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px 2px 0 0; }
.wd-tab-count { margin-left: 7px; padding: 1px 7px; border-radius: 99px; background: var(--chip);
  color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }

/* Left: the groups themselves. */
.g-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center;
  width: 100%; padding: 9px 11px; border: 1px solid transparent; border-radius: 11px;
  background: transparent; font-family: inherit; cursor: pointer; text-align: left; }
.g-item:hover { background: var(--surface-sunken); }
.g-item.selected { background: var(--accent-wash); }
.g-item .g-swatch { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  background: var(--cbg); color: var(--cfg); font-size: 11px; font-weight: 700; }
.g-item .g-name { display: block; color: var(--ink); font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-item .g-meta { color: var(--muted); font-size: 11.5px; }
.g-item .g-pool { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
/* Faces rather than a bare count: a group is recognised by who is in it. */
/* faceFor() wraps each face, so the overlap belongs on the wrapper. */
.g-faces { display: flex; align-items: center; margin-top: 4px; }
.g-faces .face-wrap { margin-left: -6px; }
.g-faces .face-wrap:first-child { margin-left: 0; }
.g-faces .face { width: 18px; height: 18px; font-size: 8px; border: 2px solid var(--surface); }
.g-item.selected .g-faces .face { border-color: var(--surface-raised); }
.g-faces .g-more { margin-left: 5px; color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.g-new { margin-top: 4px; padding: 9px 11px; border: 1px dashed var(--line); border-radius: 11px;
  background: transparent; color: var(--muted); font-family: inherit; font-size: 12.5px;
  cursor: pointer; text-align: left; width: 100%; }
.g-new:hover { color: var(--ink); border-color: var(--muted); }

/* Right: the selected group. */
.g-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.g-head .g-swatch { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--cbg); color: var(--cfg); font-size: 14px; font-weight: 700; }
.g-head h3 { margin: 0; color: var(--ink); font-size: 17px; font-weight: 650; letter-spacing: -.015em; }
.g-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.g-head .g-spacer { flex: 1 1 auto; }
.g-sect { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.g-sect-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 11px; }
.g-sect-head h4 { margin: 0; color: var(--muted); font-size: 11.5px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; }
.g-sect-head .g-count { color: var(--faint); font-size: 12px; }
.g-sect-head .g-spacer { flex: 1 1 auto; }
.g-search { width: 170px; height: 30px; padding: 0 11px; border: 1px solid var(--line-strong);
  border-radius: 9px; background: var(--surface); color: var(--ink); font-family: inherit; font-size: 12.5px; }
.g-tones { display: flex; gap: 5px; }
.g-tone { width: 22px; height: 22px; padding: 0; border: 2px solid transparent; border-radius: 50%;
  background: var(--cbg); cursor: pointer; }
.g-tone[aria-pressed="true"] { border-color: var(--cfg); }

/* The member picker: ticking someone in or out of this group. */
.g-members { display: grid; grid-template-columns: repeat(auto-fill, minmax(188px, 1fr)); gap: 5px; }
.g-member { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 9px;
  border: 1px solid transparent; border-radius: 10px; background: transparent;
  font-family: inherit; cursor: pointer; text-align: left; }
.g-member:hover { background: var(--surface-sunken); }
.g-member.on { background: var(--surface-sunken); border-color: var(--line-soft); }
.g-member:disabled { opacity: .55; cursor: default; }
.g-box { width: 16px; height: 16px; flex: none; border: 1.5px solid var(--line); border-radius: 5px;
  display: grid; place-items: center; color: transparent; }
.g-member.on .g-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.g-box svg { width: 10px; height: 10px; }
.g-member .face { width: 24px; height: 24px; font-size: 9.5px; }
.g-member .g-who { display: block; color: var(--ink); font-size: 12.5px; font-weight: 500; }
.g-member .g-at { color: var(--muted); font-size: 11px; }
/* The other groups this person is in, so membership elsewhere is visible here. */
.g-else { display: flex; gap: 3px; margin-left: auto; flex: none; }
.g-else i { width: 7px; height: 7px; border-radius: 50%; background: var(--cfg); }
.g-danger { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.g-danger p { margin: 0; color: var(--muted); font-size: 12px; max-width: 50ch; }
.g-danger .g-spacer { flex: 1 1 auto; }
.g-del { padding: 6px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  color: var(--muted); font-family: inherit; font-size: 12.5px; cursor: pointer; }
.g-del:hover { color: var(--danger); border-color: var(--danger); }
.g-empty { color: var(--faint); font-size: 12.5px; }

/* The dialog is a flex column so the tabbed body can shrink between the
   header and the footer instead of pushing the footer off the bottom. */
dialog.wide-dialog[open] { display: flex; flex-direction: column; }
.wd-head, .wd-tabs, .wd-foot { flex: none; }
/* The tools dialog shares wide-dialog, so its body flexes for the same reason
   the user split does: the dialog's height is fixed, the content is not. */
.wd-body { flex: 1 1 auto; min-height: 0; overflow: auto;
  scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.g-name-input { width: 100%; height: 34px; padding: 0 11px; border: 1px solid var(--accent);
  border-radius: 10px; background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 13px; font-weight: 600; }
.g-head .g-name-input { max-width: 260px; font-size: 16px; }
/* A disabled employee can still be in a group, but must not look active. */
.g-member.off .face { filter: grayscale(1); opacity: .7; }
.g-member.off .g-who { color: var(--muted); }
.g-member.off .g-at { color: var(--faint); }
/* A group room's avatar carries its group colour, matching the chips. */
.chat-ava.room { background: var(--cbg); color: var(--cfg); font-weight: 700; }
.g-note { margin: 12px 0 0; padding: 9px 12px; border-radius: 10px; background: var(--surface-sunken);
  color: var(--muted); font-size: 12px; }
/* Was a style="cursor:pointer" attribute, which the page's own CSP blocked,
   so the one clickable stat tile never showed it was clickable. */
.stat[data-view-link] { cursor: pointer; }

/* Audit trail, the third tab of Manage users. */
.wd-audit { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px 24px 20px;
  scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.wd-audit[hidden] { display: none; }
.wd-audit-note { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; }
.au-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.au-row:last-child { border-bottom: 0; }
.au-act { padding: 1px 8px; border-radius: 6px; background: var(--chip); color: var(--chip-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; white-space: nowrap; }
.au-act.destructive { background: rgba(176, 69, 63, .12); color: var(--danger); }
.au-what { color: var(--text); font-size: 13px; }
.au-what b { color: var(--ink); font-weight: 600; }
.au-what small { display: block; color: var(--muted); font-size: 11.5px; }
.au-when { color: var(--faint); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }


/* Removal is destructive, so the control that starts it reads as destructive
   rather than sitting in the same grey as Reset password. */
.pill.danger { color: var(--danger); border-color: rgba(176, 69, 63, .3); }
.pill.danger:hover { background: rgba(176, 69, 63, .08); border-color: rgba(176, 69, 63, .5); }
.pill.danger-strong { color: #fff; background: var(--danger); border-color: var(--danger); }
.pill.danger-strong:hover { background: #99352f; border-color: #99352f; }
button.primary.danger { background: var(--danger); border-color: var(--danger); }
button.primary.danger:hover { background: #99352f; border-color: #99352f; }

/* The consequences, listed plainly. A destructive confirmation that only says
   "are you sure" tells the reader nothing they did not already know. */
.remove-effects { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.65; }
.remove-effects li { margin-bottom: 3px; }

/* The hidden attribute only sets display:none at the lowest priority, so any
   layout rule that gives this label a display wins and the confirmation field
   shows on the step that does not use it. */
#removeConfirmLabel[hidden] { display: none; }

/* Removed people appear only behind the toggle, and read as inactive rather
   than as another account somebody might try to act on. */
.card-top-actions { display: flex; align-items: center; gap: 12px; }
.show-removed { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; cursor: pointer; }
.user-row.is-removed { opacity: .62; }
.user-row.is-removed .ws-person strong { font-style: italic; }
.removed-tag { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); align-self: center; }

/* ── output signals ──────────────────────────────────────────────────── */
.out-warn { flex: none; padding: 5px 11px; border-radius: 20px; color: var(--warn-ink); background: var(--warn-bg); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.out-grid { margin-top: 12px; }
.out-row { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(5, minmax(0, 1fr)); gap: 12px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line-soft); }
.out-row:last-child { border-bottom: 0; }
.out-row .num { color: var(--text); font-size: 13.5px; font-variant-numeric: tabular-nums; text-align: right; }
.out-head { padding-bottom: 7px; color: var(--faint); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.out-head .num { color: var(--faint); font-size: 11px; }
.out-who { min-width: 0; padding: 0; border: 0; color: var(--text-strong); background: none; font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.out-who:hover { color: var(--accent); text-decoration: underline; }
.out-total { margin-top: 2px; padding-top: 11px; border-top: 1px solid var(--line); border-bottom: 0; color: var(--ink); font-size: 13.5px; font-weight: 600; }
.out-total .num { color: var(--ink); font-weight: 600; }
.churn { display: flex; gap: 8px; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.churn .plus { color: var(--positive-ink); font-weight: 500; }
.churn .minus { color: var(--danger); font-weight: 500; }

.qbar { display: flex; align-items: center; gap: 11px; margin-top: 14px; padding: 7px 7px 7px 16px; border: 1px solid var(--line-strong); border-radius: 28px; background: var(--surface-sunken); }
.qbar .ico { flex: none; color: var(--faint); }
.qbar input { min-width: 0; flex: 1; border: none; color: var(--ink); background: none; font: inherit; font-size: 15px; }
.qbar input:focus { outline: none; }
.qbar input::placeholder { color: var(--faint); }
.qscope { margin-top: 13px; color: var(--faint); font-size: 12.5px; }

.hit { min-width: 0; padding: 13px 2px; border-bottom: 1px solid var(--line-soft); }
.hit:last-child { border-bottom: 0; }
.hit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; color: var(--faint); font-size: 11.5px; }
.hit-meta strong { color: var(--text-strong); font-weight: 600; }
.hit-kind { padding: 3px 9px; border-radius: 20px; font-weight: 500; }
.hit-kind.ask { color: var(--accent); background: rgba(138, 99, 210, .12); }
.hit-kind.reply { color: var(--chip-ink); background: var(--chip); }
.hit-repo { font-size: 11px; opacity: .85; }
.hit-snippet { margin-top: 7px; color: var(--text); font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.hit-snippet mark { padding: 0 2px; border-radius: 3px; color: var(--warn-ink); background: var(--warn-bg); font-weight: 600; }
.hit-full { margin-top: 8px; }
.hit-full summary { color: var(--accent); cursor: pointer; font-size: 12px; list-style: none; }
.hit-full summary::-webkit-details-marker { display: none; }
.hit-text { margin-top: 8px; padding: 11px 13px; border-radius: 12px; color: var(--text); background: var(--surface-sunken); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }

/* ── repositories ─────────────────────────────────────────────────────── */
/* 1fr tracks so the cards share the dialog's width evenly; a max-width keeps
   a lone repository from becoming one enormous card. */
.repo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 13px; padding-bottom: 4px; }
.repo { max-width: 460px; }
.repo { min-width: 0; padding: 15px 16px; border: 1px solid var(--line-soft); border-radius: 16px; background: var(--surface-sunken); }
.repo-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.repo-head h4 { min-width: 0; color: var(--ink); font-size: 14.5px; font-weight: 600; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-share { flex: none; color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.repo-sub { margin-top: 3px; color: var(--muted); font-size: 12px; }
.repo-track { height: 6px; margin-top: 11px; border-radius: 4px; background: var(--track-solid); overflow: hidden; }
.repo-track i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-soft)); }
.repo-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.repo-stat { min-width: 0; }
.repo-stat b { display: block; color: var(--ink); font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.repo-stat span { color: var(--faint); font-size: 10.5px; }
.repo-note { margin-top: 10px; color: var(--faint); font-size: 11.5px; }

/* ── cost and budget ──────────────────────────────────────────────────── */
/* The burn-down is capped rather than given every spare pixel: stretched to
   1,200px the percentage label ends up a screen away from the bar it labels. */
.cost-hero { display: grid; grid-template-columns: minmax(0, auto) minmax(240px, 540px) minmax(0, auto); gap: 28px; align-items: center; justify-content: space-between; padding-bottom: 20px; border-bottom: 1px solid var(--line-soft); }
.cost-hero > div > strong { display: block; color: var(--ink); font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.04em; line-height: 1.05; }
.cost-hero > div > small { display: block; margin-top: 5px; color: var(--muted); font-size: 12.5px; }
.cost-window { text-align: right; }
.cost-window strong { font-size: 27px !important; }
.cost-burn { min-width: 0; }
.cost-burn[hidden] { display: none; }
.cost-nobudget { align-self: center; padding: 13px 16px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); font-size: 12.5px; }
.cost-nobudget[hidden] { display: none; }
.burn-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: var(--muted); font-size: 12.5px; }
.burn-top b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.burn-track { position: relative; height: 10px; border-radius: 6px; background: var(--track-solid); overflow: hidden; }
.burn-track i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-soft)); transition: width .3s; }
.burn-track i.warn { background: linear-gradient(90deg, #d79a4a, #e0b36f); }
.burn-track i.over { background: linear-gradient(90deg, #b0453f, #cc6a5f); }
/* Where spend would be if the month were burning evenly. */
.burn-pace { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .45; }
.burn-pace[hidden] { display: none; }
#burnNote { display: block; margin-top: 8px; color: var(--faint); font-size: 12px; }

.cost-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; padding-top: 20px; }
.cost-cols h3 { margin-bottom: 11px; color: var(--ink); font-size: 14px; font-weight: 600; }
.cost-rows { display: flex; flex-direction: column; gap: 3px; }
.cost-row { display: grid; grid-template-columns: minmax(0, 120px) minmax(0, 1fr) minmax(0, auto); gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.cost-row:last-child { border-bottom: 0; }
.cost-name { min-width: 0; color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-track { height: 8px; border-radius: 5px; background: var(--track-solid); overflow: hidden; }
.cost-track i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent), var(--accent-soft)); }
.cost-row b { color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
.cost-aside { grid-column: 2 / 4; color: var(--faint); font-size: 11px; }
.cost-aside:empty { display: none; }

@media (max-width: 1180px) {
  .out-row { grid-template-columns: minmax(0, 1.3fr) repeat(5, minmax(0, 1fr)); gap: 8px; font-size: 12.5px; }
  .cost-hero { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .cost-window { text-align: left; }
}

/* ── the six overview dialogs ─────────────────────────────────────────────
   They share wide-dialog with the two that were here first; only the padding
   and the few sub-rows below are new. */
#promptsDialog .wd-body, #searchDialog .wd-body, #reposDialog .wd-body,
#costDialog .wd-body, #activityDialog .wd-body { padding: 16px 24px 20px; }
#employeesDialog .wd-body { padding: 0 24px 16px; }
.wd-head .search.inline { width: min(280px, 32vw); }
/* A row between the header and the scrolling body: the search bar must stay
   put while results move under it. */
.wd-sub { flex: none; padding: 14px 24px 12px; border-bottom: 1px solid var(--line-soft); }
.wd-sub .qbar { margin-top: 0; }
.wd-duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 22px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.wd-duo h3 { margin-bottom: 11px; color: var(--ink); font-size: 14px; font-weight: 600; }
.wd-duo .acts { display: grid; gap: 10px; margin-top: 0; }

/* ── the repositories tile ────────────────────────────────────────────────
   The spark slot holds one bar per repository, scaled to the busiest, since
   there is no daily series to draw a line from. */
.repo-spark { display: flex; align-items: flex-end; justify-content: flex-end; gap: 4px; }
.repo-spark i { width: 9px; min-height: 4px; border-radius: 3px 3px 1px 1px; background: var(--tint-e-ink); opacity: .55; }
.repo-spark i:first-child { opacity: .9; }
/* A repository name can be long, and the chip is nowrap by default. */
.delta-name { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }

/* ── affordances that used to be plain text ───────────────────────────── */
.stat[data-opens] { cursor: pointer; }
/* A button next to a div: it must match the div's box exactly, or the two
   values stop sharing a right edge. Chrome gives buttons their own
   horizontal padding, and the border has to be the same line as its sibling. */
button.rank-foot { width: 100%; padding: 11px 0 0; border: 0; border-top: 1px solid var(--line); background: none; font: inherit; text-align: left; cursor: pointer; }
button.rank-foot:hover { color: var(--accent); }
button.rank-foot:hover .rank-foot-go { opacity: 1; }
/* The arrow sits beside the label, not beside the figure. A hidden icon still
   takes its width, and on the right it was pushing the value out of line. */
.rank-foot-label { display: inline-flex; align-items: center; gap: 6px; }
.rank-foot-go { color: var(--accent); opacity: 0; transition: opacity .15s; }
.rank-foot-go svg { width: 13px; height: 13px; }
/* The row that hands the typed term to the server, above the name matches it
   could resolve in the browser. */
.search-result-all { border-bottom: 1px solid var(--line-soft); }
.search-result-ico { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--chip); }
.search-result-all .search-result-ico::before { color: var(--accent); content: "\2315"; font-size: 15px; }
.search-result-all strong { color: var(--ink); }

/* Every content dialog is the same height, so moving between them does not
   resize the window under the pointer. Short content sits at the top and the
   rest is empty, which is the trade: consistency over snugness.
   (Sizing to content needs height:fit-content, not auto -- a modal dialog is
   absolutely positioned with inset:0 and margin:auto by the UA sheet, so an
   auto height stretches to fill rather than shrink.) */

@media (max-width: 900px) {
  .wd-duo { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .wd-head { flex-wrap: wrap; }
  .wd-head .search.inline { width: 100%; }
}

/* ── time against an eight-hour day ───────────────────────────────────── */
#focusDialog .wd-body { padding: 8px 24px 18px; }
.focus-target { flex: none; padding: 5px 11px; border-radius: 20px; color: var(--accent); background: rgba(138, 99, 210, .12); font-size: 11.5px; font-weight: 500; white-space: nowrap; }

.focus-team-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 9px; }
.focus-team-head strong { color: var(--ink); font-size: 27px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.focus-team-head span { color: var(--muted); font-size: 13px; }
.focus-team-met { margin-left: auto; padding: 4px 10px; border-radius: 20px; color: var(--chip-ink); background: var(--chip); font-size: 12px; font-weight: 500; }

/* The three bands are the whole point: a row should read without arithmetic. */
.focus-track { position: relative; height: 10px; border-radius: 6px; background: var(--track-solid); overflow: hidden; }
.focus-track i { display: block; height: 100%; border-radius: 6px; transition: width .3s; }
.focus-track i.at { background: linear-gradient(90deg, #35b45c, #62c986); }
.focus-track i.near { background: linear-gradient(90deg, #d79a4a, #e0b36f); }
.focus-track i.under { background: linear-gradient(90deg, #b0453f, #cc6a5f); }

.focus-rows { display: flex; flex-direction: column; }
.focus-row { display: grid; grid-template-columns: minmax(0, 210px) minmax(180px, 1fr) minmax(0, 240px) minmax(0, auto); gap: 18px; align-items: center; padding: 14px 2px; border-bottom: 1px solid var(--line-soft); }
.focus-row:last-child { border-bottom: 0; }
.focus-who { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.focus-name { min-width: 0; color: var(--text-strong); font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-who:hover .focus-name { color: var(--accent); text-decoration: underline; }
.focus-who .face-wrap { flex: none; }
.focus-who .face { width: 32px; height: 32px; font-size: 11px; }
.focus-who-text { min-width: 0; }
/* The day's spend belongs to the person, so it sits under their name rather
   than becoming another column to read across. */
.focus-cost { display: block; margin-top: 1px; color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }

.focus-tail { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
/* The same five bands the rest of the dashboard uses, so "Heavy" means the
   same thing here as it does on the overview. */
.focus-rating { padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.focus-rating.heavy { color: var(--ok-ink); background: var(--ok-bg); }
.focus-rating.high { color: #3f5fc4; background: rgba(125, 148, 234, .16); }
.focus-rating.moderate { color: var(--warn-ink); background: var(--warn-bg); }
.focus-rating.light { color: var(--chip-ink); background: var(--chip); }
.focus-rating.minimal, .focus-rating.idle { color: var(--faint); background: var(--track-solid); }
.focus-main { min-width: 0; }
.focus-figure { display: flex; align-items: baseline; gap: 6px; margin-bottom: 7px; }
.focus-figure b { color: var(--ink); font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.focus-figure > span { color: var(--faint); font-size: 12.5px; }
.focus-pct { margin-left: auto; padding: 2px 8px; border-radius: 8px; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.focus-pct.at { color: var(--ok-ink); background: var(--ok-bg); }
.focus-pct.near { color: var(--warn-ink); background: var(--warn-bg); }
.focus-pct.under { color: var(--bad-ink); background: var(--bad-bg); }

/* One column per day (or hour), so the shape of the period is visible. */
.focus-days { display: flex; align-self: stretch; align-items: flex-end; gap: 2px; height: 38px; min-width: 0; }
/* 1px, not 2px: ninety bars at a 2px floor need 360px and the column is 240,
   so they overflowed it and pushed into the next column. */
.focus-days i { flex: 1 1 0; min-width: 1px; border-radius: 2px 2px 1px 1px; background: var(--accent); }
/* A long period needs the gaps back as well as the bars. */
.focus-days.dense { gap: 1px; }
.focus-days.dense i { border-radius: 1px; }
.focus-days i.at { background: #35b45c; }
.focus-days i.near { background: #d79a4a; }
.focus-days i.under { background: #cc6a5f; opacity: .75; }
.focus-days i.none { background: var(--track-solid); }
/* Bars, then the count they describe, stacked rather than side by side:
   at 90 days there was no room beside them and the text ran over the chart. */
/* overflow:hidden is a backstop: whatever the bar count, nothing from this
   column may bleed into the rating beside it. */
.focus-chart { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 6px; overflow: hidden; }
.focus-days-met { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (max-width: 900px) {
  .focus-row { grid-template-columns: minmax(0, 1fr) minmax(0, auto); gap: 10px 14px; }
  .focus-tail { flex-direction: row; align-items: center; gap: 10px; }
  .focus-chart { grid-column: 1 / -1; }
}
.focus-avg { display: block; margin-top: 6px; color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
/* A weekend column is drawn, but muted: no target was expected of it. */
.focus-days i.off { opacity: .4; }
.focus-days i.none.off { background: var(--track); }

/* ── copy and summarise, in the profile's prompt pane ─────────────────── */
.prompt-tools { display: flex; align-items: center; gap: 8px; }
.prompt-tools .round-btn.light { background: var(--round-close-bg); border-color: var(--round-close-line); }
.prompt-tools .pill.wide { height: 36px; padding: 0 15px; font-size: 13px; }
/* The confirmation is a change of icon and colour only: the geometry stays
   put so nothing beside it moves. */
.round-btn.is-ok { color: var(--ok-ink); background: var(--ok-bg); border-color: transparent; }
.round-btn.is-bad { color: var(--danger); background: var(--bad-bg); border-color: transparent; }

.summary-area { display: flex; flex-direction: column; padding-right: 4px; }
.summary-area > .summary { flex: 1 0 auto; }
.summary { max-width: 78ch; padding: 4px 2px 8px; }
/* While waiting there is no reading column and the block fills the panel, so
   the spinner lands in the middle of it both ways. A fixed min-height put it
   160px from the top of a 900px panel, which is not the middle of anything. */
.summary.is-waiting { display: flex; max-width: none; min-height: 100%; padding: 0; }
.summary-heading { margin: 22px 0 10px; color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
/* A numbered list of the distinct pieces of work: the title carries the
   scanning, the sentence under it carries the detail. */
.summary-items { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; counter-reset: work; }
.summary-items li { position: relative; padding: 10px 0 10px 34px; border-bottom: 1px solid var(--line-soft); counter-increment: work; }
.summary-items li:last-child { border-bottom: 0; }
.summary-items li::before { position: absolute; top: 11px; left: 0; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--accent); background: rgba(138, 99, 210, .12); content: counter(work); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-items b { display: block; color: var(--ink); font-size: 13.5px; font-weight: 600; }
.summary-items span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.summary-text { margin-bottom: 14px; color: var(--text); font-size: 14.5px; line-height: 1.65; }
/* The waiting state sits in the middle of the panel rather than at the top
   left, so it reads as "working" instead of "here is a very short summary". */
.summary-wait { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 260px; padding: 28px 2px; text-align: center; }
.summary-spinner { width: 30px; height: 30px; border: 2.5px solid var(--track-solid); border-top-color: var(--accent); border-radius: 50%; animation: summary-spin .8s linear infinite; }
@keyframes summary-spin { to { transform: rotate(360deg); } }
.summary-wait-text { color: var(--text); font-size: 14.5px; font-weight: 500; }
/* Empty until the request is slow enough to be worth explaining, and faded
   in so it does not arrive as a jolt. */
.summary-wait-more { max-width: 44ch; color: var(--faint); font-size: 12.5px; line-height: 1.55; opacity: 0; transition: opacity .4s ease; }
.summary-wait-more.is-on { opacity: 1; }
/* Before the patience line has anything to say it must not contribute a gap,
   or the group it belongs to sits off centre by half of one. */
.summary-wait-more:empty { display: none; }
@media (prefers-reduced-motion: reduce) {
  /* No rotation and no fade: the ring and the words still say "working". */
  .summary-spinner { animation: none; border-top-color: var(--accent); opacity: .7; }
  .summary-wait-more { transition: none; }
}
.summary-error { padding: 18px 2px; color: var(--danger); font-size: 13.5px; line-height: 1.6; }
.summary-error + .summary-retry { display: inline-block; margin: 0 0 18px 2px; padding: 7px 14px;
  border: 1px solid var(--line-soft); border-radius: 7px; background: transparent;
  color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.summary-error + .summary-retry:hover { border-color: var(--line); background: var(--chip); }
.summary-error + .summary-retry:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.summary-note { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); color: var(--faint); font-size: 12px; }

/* ── Agents ───────────────────────────────────────────────────────────────
   One screen — the decision queue — and five dialogs. Everything here is
   `ag-` prefixed; the handful of compound rules only adjust this file's own
   components (`.card`, `.pill`, `.ico`) inside the agent surfaces, and
   nothing redefines one.

   The page is a grid whose last row flexes. Only the three panes inside that
   row scroll, so the screen itself never moves: a card's action row stays
   where it was between one decision and the next. */

.ag-page { display: grid; flex: 1; grid-template-rows: auto minmax(0, 1fr); gap: 12px; min-width: 0; min-height: 0; overflow: hidden; }
.ag-top { display: flex; min-width: 0; flex-direction: column; gap: 12px; }
.ag-head { display: flex; flex: none; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.ag-head h2 { color: var(--ink); font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.ag-head p { margin-top: 3px; color: var(--muted); font-size: 12.5px; }
.ag-head-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.ag-head-actions .pill { height: 40px; padding: 0 15px; font-size: 13px; }
.ag-head-actions .pill .ico { width: 16px; height: 16px; }
.ag-pill-warn { border-color: transparent; color: var(--warn-ink); background: var(--warn-bg); font-weight: 500; }
.ag-pill-warn.is-calm { color: var(--ok-ink); background: var(--ok-bg); }
.ag-pill-warn[hidden] { display: none; }

.ag-alert { flex: none; padding: 11px 14px; border: 1px solid var(--bad-bg); border-radius: 13px; color: var(--bad-ink); background: var(--bad-bg); font-size: 13px; line-height: 1.5; }
.ag-alert[hidden] { display: none; }

/* ── the number strip ─────────────────────────────────────────────────── */

.ag-numbers { display: flex; flex: none; min-width: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.ag-num { flex: 1 1 0; min-width: 0; padding: 10px 15px; border-right: 1px solid var(--line-soft); }
.ag-num:last-child { border-right: 0; }
.ag-num-lab { overflow: hidden; color: var(--faint); font-size: 10px; font-weight: 600; letter-spacing: .07em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.ag-num-big { margin-top: 1px; color: var(--ink); font-size: 21px; font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }
.ag-num-sub { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.ag-num.hot { background: var(--warn-bg); }
.ag-num.hot .ag-num-lab, .ag-num.hot .ag-num-big { color: var(--warn-ink); }
.ag-num.bad .ag-num-big { color: var(--bad-ink); }

/* Solid is the agent working, hatched is the run waiting on a person. Drawn
   against one axis, because that comparison is the whole argument. */
.ag-split { display: flex; height: 9px; overflow: hidden; margin: 7px 0 4px; border-radius: 5px; background: var(--track-solid); }
.ag-split i { display: block; height: 100%; }
.ag-split i.sol { background: linear-gradient(90deg, var(--meter-line), var(--accent)); }
.ag-split i.hat { background: repeating-linear-gradient(-45deg, var(--warn-ink) 0 3px, transparent 3px 7px), var(--warn-bg); }
.ag-split i.none { width: 100%; background: var(--track-solid); }

/* ── the three panes ──────────────────────────────────────────────────── */

.ag-panes { display: grid; grid-template-columns: minmax(0, 1fr) 288px 216px; gap: 12px; min-width: 0; min-height: 0; }
.ag-pane { min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.ag-pane::-webkit-scrollbar { width: 9px; }
.ag-pane::-webkit-scrollbar-thumb { border: 2px solid var(--surface); border-radius: 5px; background: var(--scrollbar); }
.ag-panes > .ag-side, .ag-tilecol { display: flex; flex-direction: column; gap: 10px; }
/* A column flex child shrinks by default, so the first card in a scrolling
   rail was squeezed and clipped instead of the rail scrolling past it. */
.ag-panes > .ag-side > *, .ag-tiles > *, .ag-flow-panes > .ag-side > * { flex: none; }
.ag-sticky { position: sticky; top: 0; z-index: 3; padding: 1px 0 7px; color: var(--faint); background: var(--surface); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

/* ── a card in the queue ──────────────────────────────────────────────── */

.ag-more { display: flex; align-items: center; gap: 9px; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 13px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.card.ag-mini { padding: 13px 15px; border-radius: 16px; }
.ag-mini-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.ag-mini-top h4 { margin: 0; color: var(--ink); font-size: 13.5px; font-weight: 600; }
.ag-mini-top p { margin: 2px 0 0; color: var(--faint); font-size: 11px; }
.ag-mini-lead { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ag-mini-lead b { color: var(--warn-ink); font-weight: 600; }
.ag-mini-why { margin: 5px 0 0; color: var(--muted); line-height: 1.45; }
.card.ag-mini .ag-empty { padding: 2px 0 0; }
.card.ag-mini .ag-split { margin: 0 0 8px; }

.card.ag-q-card { overflow: hidden; margin-bottom: 10px; padding: 0; }
.ag-pane > .card.ag-q-card:last-child { margin-bottom: 0; }
.card.ag-q-card.is-warn { border-color: color-mix(in srgb, var(--warn-ink) 45%, transparent); box-shadow: inset 3px 0 0 var(--warn-ink), var(--card-shadow); }
.card.ag-q-card.is-bad { border-color: color-mix(in srgb, var(--danger) 45%, transparent); box-shadow: inset 3px 0 0 var(--bad-ink), var(--card-shadow); }
.ag-q-open { display: block; width: 100%; padding: 13px 16px 12px; border: 0; color: inherit; background: none; font: inherit; text-align: left; cursor: pointer; }
.ag-q-open:hover { background: var(--hover); }
.ag-q-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ag-q-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ag-q-top h4 { margin: 0; color: var(--ink); font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.ag-q-top p { margin: 2px 0 0; color: var(--faint); font-size: 11.5px; }
.ag-q-why { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.ag-q-why b { color: var(--ink); font-weight: 600; }
.ag-q-why b::before { color: var(--faint); content: " — "; font-weight: 400; }
.ag-q-acts { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 0 16px 13px; }
.card.ag-mini .ag-q-open { padding: 13px 15px 11px; }
.card.ag-mini .ag-q-acts { padding: 0 15px 13px; }

/* The eight-phase mini pipeline: all eight, always, so the shape of a run is
   the same shape in every card. */
.ag-tl { display: flex; gap: 0; margin: 9px 0; }
.ag-tl-step { position: relative; flex: 1 1 0; min-width: 0; padding-top: 15px; }
.ag-tl-step::before { position: absolute; top: 4px; right: 0; left: 0; height: 2px; background: var(--track-solid); content: ""; }
.ag-tl-step.done::before { background: color-mix(in srgb, var(--positive) 45%, transparent); }
.ag-tl-step.now::before { background: var(--warn-ink); }
.ag-tl-step.gate::before { background: var(--danger); }
.ag-tl-step i { position: absolute; top: 0; left: 0; width: 10px; height: 10px; border: 2px solid var(--line); border-radius: 50%; background: var(--surface); }
.ag-tl-step.done i { border-color: var(--positive); background: var(--ok-bg); }
.ag-tl-step.now i { border-color: var(--warn-ink); background: var(--warn-bg); box-shadow: 0 0 0 3px var(--warn-bg); }
.ag-tl-step.gate i { border-color: var(--danger); background: var(--bad-bg); box-shadow: 0 0 0 3px var(--bad-bg); }
.ag-tl-step b { display: block; overflow: hidden; color: var(--faint); font-size: 9.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.ag-tl-step.now b, .ag-tl-step.gate b { color: var(--ink); font-weight: 600; }

.ag-kvrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.ag-kvrow:last-child { border-bottom: 0; padding-bottom: 0; }
.ag-kvrow > span { display: inline-flex; min-width: 0; align-items: center; gap: 6px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.ag-kvrow b { flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ag-kvrow b.is-ok { color: var(--ok-ink); }
.ag-kvrow b.is-bad { color: var(--bad-ink); }

/* ── the four navigation tiles ────────────────────────────────────────────
   They open modals. There is no tab strip: a tab strip asks you to remember
   where you were, and this screen only has one answer. */

.ag-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; min-width: 0; }
.ag-tile { display: block; width: 100%; padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 14px; color: inherit; background: var(--surface); box-shadow: var(--shadow); font: inherit; text-align: left; cursor: pointer; transition: border-color .14s, transform .14s; }
.ag-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.ag-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ag-tile-ico { display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 6px; border-radius: 10px; background: var(--glass-strong); box-shadow: var(--shadow); }
.ag-tile-ico .ico { width: 17px; height: 17px; }
.ag-tile.a { border-color: var(--tint-b-line); background: var(--tint-b); } .ag-tile.a .ag-tile-ico { color: var(--tint-b-ink); }
.ag-tile.b { border-color: var(--tint-c-line); background: var(--tint-c); } .ag-tile.b .ag-tile-ico { color: var(--tint-c-ink); }
.ag-tile.c { border-color: var(--tint-e-line); background: var(--tint-e); } .ag-tile.c .ag-tile-ico { color: var(--tint-e-ink); }
.ag-tile.d { border-color: var(--tint-d-line); background: var(--tint-d); } .ag-tile.d .ag-tile-ico { color: var(--tint-d-ink); }
.ag-tile-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ag-tile-name h5 { margin: 0; color: var(--ink); font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.ag-tile-arw { display: grid; place-items: center; color: var(--faint); }
.ag-tile-arw .ico { width: 15px; height: 15px; }
.ag-tile:hover .ag-tile-arw { color: var(--accent); }
.ag-tile-big { margin-top: 4px; color: var(--ink); font-size: 20px; font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.ag-tile-big.is-bad { color: var(--bad-ink); }
.ag-tile-sub { margin: 3px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.ag-tile.e { border-color: var(--tint-a-line); background: var(--tint-a); grid-column: 1 / -1; } .ag-tile.e .ag-tile-ico { color: var(--tint-a-ink); }

.ag-usage-bars { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ag-usage-row { display: flex; flex-direction: column; gap: 2px; }
.ag-usage-head { display: flex; justify-content: space-between; align-items: baseline; }
.ag-usage-label { color: var(--muted); font-size: 11px; font-weight: 500; }
.ag-usage-pct { color: var(--ink); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ag-usage-track { height: 6px; border-radius: 3px; background: var(--glass-strong); overflow: hidden; }
.ag-usage-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width .3s ease; }
.ag-usage-fill.is-warn { background: var(--warn-ink, #c5880e); }
.ag-usage-fill.is-bad { background: var(--bad-ink); }
.ag-usage-sub { margin: 0; color: var(--faint); font-size: 10px; font-variant-numeric: tabular-nums; }

/* ── the board, inside its dialog ─────────────────────────────────────── */

.ag-board { display: flex; flex: 1 1 auto; align-items: stretch; gap: 10px; min-width: 0; min-height: 0; max-width: 100%; padding-bottom: 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.ag-col { display: flex; width: 190px; flex: 0 0 190px; flex-direction: column; min-height: 0; padding: 9px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--surface-sunken); }
.ag-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 1px 3px 9px; }
.ag-col-head strong { color: var(--text-strong); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.ag-col-count { padding: 1px 7px; border-radius: 7px; color: var(--chip-ink); background: var(--chip); font-size: 11px; font-variant-numeric: tabular-nums; }
.ag-col-body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.ag-col-empty { margin: 0; padding: 10px 4px; color: var(--faint); font-size: 11.5px; line-height: 1.5; }
.ag-card { display: block; width: 100%; padding: 10px 11px; border: 1px solid var(--line-soft); border-radius: 12px; color: inherit; background: var(--surface); box-shadow: var(--card-shadow); font: inherit; text-align: left; cursor: pointer; }
.ag-card:hover { border-color: var(--accent); background: var(--surface-raised); }
.ag-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ag-card.is-warn { border-color: color-mix(in srgb, var(--warn-ink) 50%, transparent); }
.ag-card.is-bad { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.ag-card-title { display: -webkit-box; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 500; line-height: 1.35; text-overflow: ellipsis; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ag-card-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.ag-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; color: var(--faint); font-size: 10.5px; font-variant-numeric: tabular-nums; }

/* ── one task's flow, inside its dialog ───────────────────────────────── */

.ag-view-body { min-width: 0; min-height: 0; }
.ag-flow-panes { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: 12px; align-items: start; min-width: 0; }
.ag-flow-panes > .ag-pane { overflow: visible; padding-right: 0; }
.ag-flow-panes > .ag-side { display: flex; flex-direction: column; gap: 10px; }
.ag-flow { padding: 15px; border: 1px solid var(--line-soft); border-radius: 14px; background: radial-gradient(var(--dot-grid) .9px, transparent .9px) 0 0 / 16px 16px, var(--surface-sunken); overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.ag-fgrid { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 18px 26px; min-width: 580px; }
.ag-node { display: block; width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 12px; color: inherit; background: var(--surface); font: inherit; text-align: left; cursor: pointer; }
.ag-node:hover { border-color: var(--accent); }
.ag-node:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ag-node.done { border-color: color-mix(in srgb, var(--positive) 45%, transparent); }
.ag-node.now { border-color: var(--warn-ink); box-shadow: 0 0 0 3px var(--warn-bg); }
.ag-node.gate { border-color: var(--danger); box-shadow: 0 0 0 3px var(--bad-bg); }
.ag-node-head { display: flex; align-items: flex-start; gap: 8px; }
.ag-node-ic { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 8px; color: var(--muted); background: var(--quote-bg); font-size: 11.5px; font-variant-numeric: tabular-nums; font-weight: 600; }
.ag-node-ic .ico { width: 12px; height: 12px; }
.ag-node.done .ag-node-ic { color: var(--ok-ink); background: var(--ok-bg); }
.ag-node.now .ag-node-ic { color: var(--warn-ink); background: var(--warn-bg); }
.ag-node.gate .ag-node-ic { color: var(--bad-ink); background: var(--bad-bg); }
.ag-node-tt { color: var(--ink); font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.ag-node-st { display: -webkit-box; overflow: hidden; margin-top: 1px; color: var(--faint); font-size: 10px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ag-node-ft { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; color: var(--faint); font-size: 10px; font-variant-numeric: tabular-nums; }
.ag-node-ft .is-bad { color: var(--bad-ink); font-weight: 600; }
.ag-switch { display: flex; flex-direction: column; gap: 6px; }
.ag-switch-row { display: block; width: 100%; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 10px; color: inherit; background: var(--surface-sunken); font: inherit; text-align: left; cursor: pointer; }
.ag-switch-row:hover { border-color: var(--accent); }
.ag-switch-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ag-switch-row strong { display: block; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.ag-switch-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; }

/* ── shared pieces ────────────────────────────────────────────────────── */

.ag-badge { padding: 2px 7px; border-radius: 7px; color: var(--neutral-ink); background: var(--neutral-bg); font-size: 10.5px; font-weight: 500; white-space: nowrap; }
.ag-badge.ok { color: var(--ok-ink); background: var(--ok-bg); }
.ag-badge.warn { color: var(--warn-ink); background: var(--warn-bg); }
.ag-badge.info { color: var(--info-ink); background: var(--info-bg); }
.ag-badge.bad { color: var(--bad-ink); background: var(--bad-bg); }
.ag-badge[hidden] { display: none; }
.ag-chip { padding: 5px 11px; border-radius: 20px; color: var(--chip-ink); background: var(--chip); font-size: 12px; font-weight: 500; white-space: nowrap; }
.ag-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.ag-bars { display: flex; align-items: flex-end; gap: 4px; height: 86px; max-width: 100%; }
.ag-bar { position: relative; display: flex; flex: 1 1 0; min-width: 2px; flex-direction: column; justify-content: flex-end; height: 100%; border: 0; padding: 0; background: none; cursor: default; }
.ag-bar i { display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, var(--accent-soft), var(--accent)); }
.ag-bar.is-zero i { background: var(--track-solid); }
.ag-empty { padding: 20px 4px; color: var(--faint); font-size: 12.5px; line-height: 1.6; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 260px; }
.ag-empty strong { display: block; margin-bottom: 4px; color: var(--text-strong); font-size: 13px; font-weight: 600; }
/* A dialog waiting on the server (agentLoading): the block fills the body it
   is put in, so its own centring lands it in the middle both ways, rather
   than a 260px block stuck to the top. The bodies become flex columns only
   while it is there; the rendered content keeps its own layout. */
.ag-empty.is-loading { flex: 1 1 auto; }
.wd-body:has(> .ag-empty.is-loading, > * > .ag-empty.is-loading),
.piex-drawer-body:has(> .ag-empty.is-loading) { display: flex; flex-direction: column; }
.wd-body > :has(> .ag-empty.is-loading:only-child) { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
.ag-ring { width: 22px; height: 22px; margin-bottom: 12px; border: 2px solid var(--line-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: ag-spin .9s linear infinite; }
.ag-ring.sm { flex: none; width: 13px; height: 13px; margin: 0; border-width: 1.75px; }
@keyframes ag-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ag-ring { animation: none; border-top-color: var(--line-strong); } }
/* Part of a dialog still on its way (agentInlineLoading): the small ring beside the line. */
.ag-inline-load { display: flex; align-items: center; gap: 8px; }

/* ── the dialogs ──────────────────────────────────────────────────────────
   Every one of them is the same height, whatever it holds. A dialog that
   sizes to its content moves the action row between one decision and the
   next, and the verbs not moving is the point of the whole screen. The wide
   ones differ in width only; the body is what scrolls. */

/* The Agents screen has its own heading ("5 decisions waiting") and its own
   actions, so the dashboard's welcome block would be a second header stacked
   on top of it — and the layout does not scroll, so that space is expensive. */
/* ---- phase detail as a popover over the canvas, not a side column ---- */
/* With a phase open, the graph behind it is pushed back: blurred and dimmed,
   so the popover reads as being in front rather than sitting among the cards.
   Only the stage is blurred — the toolbar, the status strip and the popover
   itself are siblings of it and stay sharp. */
.ag-gx-canvas.is-detail .ag-gx-stage { filter: blur(3px); opacity: .5;
  transition: filter .16s ease, opacity .16s ease; }
.ag-gx-canvas .ag-gx-stage { transition: filter .16s ease, opacity .16s ease; }
.ag-gx-canvas.is-detail::after { content: ""; position: absolute; inset: 0; z-index: 5;
  background: var(--surface); opacity: .28; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .ag-gx-canvas .ag-gx-stage { transition: none; }
}

.ag-gx-pop { position: absolute; z-index: 6; width: 470px; max-width: calc(100% - 16px);
  /* The popover carries the phase's facts, its artifact, the note and seven
     verbs, so it is taller than it was and laid out as a column: the heading
     and the verb row are fixed, and only the middle scrolls. That is what
     keeps the verbs reachable without hunting on a long plan. Still capped
     inside the canvas, because it is a popover over a graph and not a second
     dialog; it is only as tall as its content needs up to that cap. */
  display: flex; flex-direction: column; gap: 10px;
  max-height: min(560px, calc(100% - 20px)); overflow: hidden; overscroll-behavior: contain;
  padding: 12px 13px; border: 1px solid var(--line); border-radius: 13px;
  background: var(--surface); box-shadow: var(--modal-shadow);
  opacity: 0; transform: translateY(-4px); transition: opacity .13s ease, transform .13s ease; }
.ag-gx-pop.is-open { opacity: 1; transform: translateY(0); }
.ag-gx-pop > .ag-gx-side-head { flex: none; }
/* Focus moves onto the box itself when it opens, so it has to say so. */
.ag-gx-pop:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.ag-gx-pop-scroll { display: flex; flex-direction: column; gap: 10px; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
@media (prefers-reduced-motion: reduce) { .ag-gx-pop { transition: none; } }

/* ---- the roadmap board: three columns of task cards ---- */
.ag-roadmap { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.ag-rm-col { min-width: 0; }
.ag-rm-head { display: flex; align-items: center; gap: 8px; padding: 0 2px 10px; }
.ag-rm-ico { display: grid; place-items: center; width: 20px; height: 20px; color: var(--faint); }
.ag-rm-ico .ico { width: 15px; height: 15px; }
.ag-rm-head b { color: var(--ink); font-size: 14px; font-weight: 650; }
.ag-rm-count { color: var(--faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.is-needs .ag-rm-ico { color: var(--warn-ink); }
.is-running .ag-rm-ico { color: var(--accent); }
.is-done .ag-rm-ico { color: var(--ok-ink); }
.ag-rm-body { display: flex; flex-direction: column; gap: 10px; }

.ag-rm-card { display: block; width: 100%; text-align: left; padding: 13px 14px; border: 1px solid var(--line-strong);
  border-radius: 14px; background: var(--surface); cursor: pointer; position: relative;
  transition: border-color .14s, background .14s, transform .14s; }
.ag-rm-card:hover { border-color: var(--accent); background: var(--hover); transform: translateY(-1px); }
.ag-rm-card.is-warn { border-color: color-mix(in srgb, var(--warn-ink) 80%, transparent); }
.ag-rm-card.is-bad { border-color: color-mix(in srgb, var(--danger) 80%, transparent); }
.ag-rm-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ag-rm-chip { padding: 3px 8px; border-radius: 7px; background: var(--chip); color: var(--chip-ink);
  font-size: 10.5px; font-weight: 500; }
.ag-rm-chip.is-mode { background: var(--neutral-bg); color: var(--neutral-ink); }
.ag-rm-card h5 { margin: 0 0 5px; color: var(--ink); font-size: 14px; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; }
.ag-rm-card p { margin: 0 0 11px; color: var(--muted); font-size: 12px; line-height: 1.45;
  /* Three lines keeps the columns level without hiding the reason entirely. */
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ag-rm-foot { display: flex; align-items: center; gap: 9px; }
.ag-rm-bar { flex: 1; height: 5px; border-radius: 3px; background: var(--track-solid); overflow: hidden; }
.ag-rm-bar i { display: block; height: 100%; border-radius: 3px; background: var(--positive-ink); }
.ag-rm-bar i.is-gate { background: linear-gradient(90deg, var(--positive-ink) 0 78%, var(--danger) 78% 100%); }
.ag-rm-bar i.is-bad { background: var(--danger); }
.ag-rm-pct { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.ag-rm-done { display: inline-flex; align-items: center; gap: 6px; color: var(--ok-ink); font-size: 12px; font-weight: 600; }
.ag-rm-done .ico { width: 13px; height: 13px; }
.ag-rm-when { margin-left: auto; color: var(--faint); font-size: 11.5px; }
.ag-rm-flag { display: inline-block; margin-top: 9px; padding: 3px 8px; border-radius: 7px; font-size: 10.5px; font-weight: 600; }
.ag-rm-flag.is-warn { color: var(--warn-ink); background: var(--warn-bg); }
.ag-rm-flag.is-bad { color: var(--bad-ink); background: var(--bad-bg); }
/* Two columns, then one, before the cards get narrower than their own text. */
@media (max-width: 1380px) { .ag-roadmap { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .ag-roadmap { grid-template-columns: minmax(0, 1fr); } }

/* ---- "N of 8" + bar on a queue card (compact form of the stepper head) ---- */
.ag-q-progress { margin: 8px 0 2px; }
.ag-q-progress .ag-step-head { margin-bottom: 4px; }
.ag-q-progress .ag-step-head b { font-size: 12px; }
.ag-q-progress .ag-step-head span { font-size: 11px; }
/* Thinner than the dialog's: on a card this sits directly above the rail and
   two heavy horizontals in a row read as a double underline. */
.ag-q-bar { height: 4px; margin-bottom: 0; }

/* ---- the "N of 8 phases" header and bar: the queue card and the
   progress dialog share them ---- */
.ag-step-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ag-step-head b { color: var(--ink); font-size: 13px; font-weight: 650; }
.ag-step-head span { color: var(--faint); font-size: 11.5px; }
.ag-step-bar { height: 6px; border-radius: 4px; background: var(--track-solid); overflow: hidden; margin-bottom: 11px; }
.ag-step-bar i { display: block; height: 100%; border-radius: 4px; background: var(--positive-ink); }
/* A gate is not "almost finished" — the tail says why it stopped. */
.ag-step-bar i.is-gate { background: linear-gradient(90deg, var(--positive-ink) 0 82%, var(--danger) 82% 100%); }
/* ── the pipeline canvas (task progress dialog) ───────────────────────────
   The eight phases as a node graph: a dotted surface, thick flowing
   connectors drawn behind the nodes, a staggered left-to-right chain, a
   floating view toolbar, a status strip, and a panel that fills from
   whichever node is selected.

   A node can be dragged and the view can be panned and zoomed, because a
   reader untangling a long run wants the nodes where their own eye needs
   them. That is all dragging does: it repositions a node on the canvas for
   readability. The pipeline order is fixed — eight phases, this order,
   enforced server-side — so this is NOT an editor: nodes are not connectable
   or disconnectable, and the handle dots on a node's left and right edges are
   decorative affordances showing where its connectors arrive and leave, not
   connection points. "Fit all" restores the layout and the view. */

/* Wider than its siblings because the canvas needs the room; the height is
   dialog.ag-dlg's and is deliberately untouched, so the set does not resize
   as you move between them. */
dialog.ag-dlg.ag-gx-wide { width: min(1180px, calc(100vw - 32px)); }

/* The split is laid out under #agentProgressSlot further down, where the
   dialog's height chain is: canvas on the left, chat column on the right.
   The two rules that used to live here — a grid with a 300px side panel, and
   a `display: block` overriding it — both described layouts that no longer
   exist, and the first of them is what once collapsed the canvas to 2px. */

/* The viewport. It clips: the stage inside it is panned and scaled rather
   than scrolled, so there are no scrollbars to fight the drag. */
/* The task form's "also change these repositories" checklist. */
.ag-task-repos { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 10px; margin: 0; }
.ag-task-repos legend { padding: 0 4px; font-size: 12px; font-weight: 600; }
.ag-task-repos legend small { color: var(--muted); font-weight: 400; }
.ag-task-repo-list { display: flex; flex-direction: column; gap: 6px; }
.ag-task-repo { display: grid; grid-template-columns: auto minmax(0, 1fr) 150px; align-items: center; gap: 8px; font-size: 12.5px; }
.ag-task-repo input[type="text"] { min-width: 0; }
.ag-task-repo input[type="text"]:disabled { opacity: .45; }
/* The task page's list of repositories, one line each. */
.ag-repos-block { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 0; padding: 0; list-style: none; font-size: 12px; }
.ag-repos-block li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.ag-repos-block b { font-weight: 600; }
.ag-repos-block span { color: var(--muted); }
.ag-gx-canvas { position: relative; flex: 1 1 auto; min-height: 320px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 14px;
  background-color: var(--surface-sunken);
  background-image: radial-gradient(var(--dot-grid) 1.3px, transparent 1.3px);
  background-size: 16px 16px; background-position: -9px -9px;
  cursor: grab; touch-action: none; }
.ag-gx-canvas.is-panning { cursor: grabbing; }
/* Full screen: the browser's own, or — where it refuses — the canvas laid
   over the whole window. Same look either way, no frame. */
.agr-canvas:fullscreen { border: 0; border-radius: 0; width: 100vw; height: 100vh; }
.agr-canvas.agr-full { position: fixed; inset: 0; z-index: 2147483000; border: 0; border-radius: 0;
  width: 100vw; height: 100vh; }

/* One transform for zoom and pan, on the box that holds both the edge layer
   and the nodes, so the two can never drift apart. */
.ag-gx-stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; }

/* The edge layer sits behind the nodes and carries no text: every word is on
   a node, so this is decorative and hidden from the reader. */
.ag-gx-edges { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.ag-gx-edge { fill: none; stroke: var(--faint); stroke-width: 2.4; stroke-linecap: round; }
.ag-gx-edge.is-done { stroke: var(--positive-ink); }
/* The flowing overlay, drawn on top of its own base stroke. The dash marches
   along the curve, which is the "current flows this way" signal; the colour
   says whether that stretch is behind the run, at it, or barred. */
.ag-gx-edge.is-flow { stroke-width: 3.4; stroke-dasharray: 8 12;
  animation: ag-gx-march 1.1s linear infinite; }
.ag-gx-edge.is-flow.is-done { stroke: var(--positive-ink); }
.ag-gx-edge.is-flow.is-now { stroke: var(--warn-ink); }
.ag-gx-edge.is-flow.is-gate { stroke: var(--danger); }
@keyframes ag-gx-march { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -40; } }

/* A fork is drawn thinner and dashed: it is where the reader interrupted, not
   a step the run took on its own, and it must not read as part of the spine. */
.ag-gx-edge.is-fork { stroke-width: 1.6; stroke-dasharray: 3 7; opacity: .75; }
.ag-gx-edge.is-flow.is-fork { stroke-width: 2.4; opacity: .9; }

/* No overflow clip on the card itself: the selected ring and the handle dots
   are drawn outside its border box and would be cut off. The text lines clip
   themselves. touch-action keeps a finger-drag on the node rather than
   handing it to the dialog's scroll. */
.ag-gx-card { position: absolute; display: flex; flex-direction: column; gap: 6px;
  padding: 10px 11px; border: 1.4px solid var(--faint); border-radius: 14px;
  color: var(--text); background: var(--surface); font: inherit; text-align: left;
  cursor: grab; touch-action: none; }
.ag-gx-card:hover { box-shadow: var(--card-shadow); }
/* Branch nodes carry a left edge in the accent so a glance separates the work
   the reader asked for mid-run from the task's own spine. */
.ag-gx-card.is-branch { border-left-width: 3px; border-left-color: var(--accent); }
.ag-gx-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* A node under the pointer is lifted above its neighbours and above the edge
   layer, so it never slides under a card it is being dragged past. */
.ag-gx-card.is-dragging { z-index: 3; cursor: grabbing; box-shadow: var(--modal-shadow); }
/* The selected ring is drawn as a pseudo-element so it never has to fight the
   gate's ring or the live phase's pulse for the box-shadow. */
.ag-gx-card.is-sel { z-index: 2; }
.ag-gx-card.is-sel::after { position: absolute; inset: -5px; border: 2px solid var(--accent);
  border-radius: 18px; content: ""; pointer-events: none; }

.ag-gx-top { display: flex; align-items: flex-start; gap: 7px; }
/* The icon tile: the phase's own icon, from the house ICONS map. */
.ag-gx-tile { display: grid; place-items: center; width: 26px; height: 26px; flex: none;
  border-radius: 9px; color: var(--faint);
  background: color-mix(in srgb, currentColor 16%, var(--surface)); }
.ag-gx-tile .ico { width: 14px; height: 14px; }
.ag-gx-titles { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.ag-gx-name { overflow: hidden; color: var(--ink); font-size: 12.5px; font-weight: 650;
  line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
/* The category label: what the phase IS, in one word. */
.ag-gx-kind { overflow: hidden; color: var(--muted); font-size: 9px; font-weight: 600;
  letter-spacing: .06em; line-height: 1.5; text-overflow: ellipsis; text-transform: uppercase;
  white-space: nowrap; }
/* The state mark. Colour is never the only carrier: done is a tick, a gate a
   padlock, a block an exclamation, the live phase a dot, and anything not yet
   run its position in the order. It is taken out of the title row's flow and
   pinned to the corner so the category label gets the card's full width —
   "VERIFICATION" and "PULL REQUEST" were both being clipped by it. */
.ag-gx-mark { position: absolute; top: 9px; right: 9px; display: grid; place-items: center;
  width: 19px; height: 19px; flex: none;
  border: 1.4px solid currentColor; border-radius: 50%; color: var(--faint);
  background: inherit;
  font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 600; line-height: 1; }
.ag-gx-mark .ico { width: 10px; height: 10px; }

/* The description line: the phase's real outcome once it has one, and what it
   is going to do until then. Two lines, then it clips. */
.ag-gx-out { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; flex: 1 1 auto; color: var(--text); font-size: 10.5px;
  line-height: 1.4; }
/* The tag chip: how long the phase took, or that it has not started. */
.ag-gx-chip { display: inline-flex; align-self: flex-start; align-items: center; gap: 5px;
  max-width: 100%; overflow: hidden; padding: 1px 8px; border: 1px solid var(--line);
  border-radius: 99px; color: var(--text-strong); background: var(--surface-sunken);
  font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 600; line-height: 1.6;
  text-overflow: ellipsis; white-space: nowrap; }
.ag-gx-chip i { width: 5px; height: 5px; flex: none; border-radius: 50%; background: currentColor; }

/* Decorative handles. Pointer-events are off: there is nothing to click,
   because there is nothing to connect. They borrow the card's own border
   colour so a done node's handles are green and a gate's are red. */
.ag-gx-hand { position: absolute; width: 9px; height: 9px;
  border: 1.5px solid; border-color: inherit; border-radius: 50%;
  background: var(--surface); pointer-events: none; }
/* Four per card, one on each edge. The east and west pair carry the real
   connectors; north and south complete the shape so a card reads as a node
   that could be joined from any side. All four are decoration — the pipeline
   order is fixed, so none of them is a drop target. */
/* The two handles actually carrying an edge are filled; the other two stay
   as outlines. Driven by data-out / data-in, which the router rewrites on
   every drag frame, so the connection point is obvious while you move a card. */
.ag-gx-card[data-out="w"] .ag-gx-hand.is-w, .ag-gx-card[data-in="w"] .ag-gx-hand.is-w,
.ag-gx-card[data-out="e"] .ag-gx-hand.is-e, .ag-gx-card[data-in="e"] .ag-gx-hand.is-e,
.ag-gx-card[data-out="n"] .ag-gx-hand.is-n, .ag-gx-card[data-in="n"] .ag-gx-hand.is-n,
.ag-gx-card[data-out="s"] .ag-gx-hand.is-s, .ag-gx-card[data-in="s"] .ag-gx-hand.is-s {
  background: currentColor; transform: var(--ag-hand-t, none) scale(1.18); }
.ag-gx-hand.is-w, .ag-gx-hand.is-e { --ag-hand-t: translateY(-50%); }
.ag-gx-hand.is-n, .ag-gx-hand.is-s { --ag-hand-t: translateX(-50%); }

.ag-gx-hand.is-w { left: -5px; top: 50%; transform: translateY(-50%); }
.ag-gx-hand.is-e { right: -5px; top: 50%; transform: translateY(-50%); }
.ag-gx-hand.is-n { top: -5px; left: 50%; transform: translateX(-50%); }
.ag-gx-hand.is-s { bottom: -5px; left: 50%; transform: translateX(-50%); }

.ag-gx-card.is-done { border-color: var(--positive-ink); background: var(--ok-bg); }
.ag-gx-card.is-done .ag-gx-mark, .ag-gx-card.is-done .ag-gx-tile { color: var(--ok-ink); }
.ag-gx-card.is-now { border-color: var(--warn-ink); background: var(--warn-bg);
  animation: ag-gx-pulse 2.6s ease-in-out infinite; }
.ag-gx-card.is-now .ag-gx-mark, .ag-gx-card.is-now .ag-gx-tile { color: var(--warn-ink); }
/* A gate gets a thicker, redder ring than the live phase: it is not a phase
   that is merely taking a while, and no mode can waive it. */
.ag-gx-card.is-gate { border-color: var(--danger); background: var(--bad-bg);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 24%, transparent); }
.ag-gx-card.is-blocked { border-color: var(--danger); background: var(--bad-bg);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 24%, transparent); }
.ag-gx-card.is-gate .ag-gx-mark, .ag-gx-card.is-gate .ag-gx-tile,
.ag-gx-card.is-blocked .ag-gx-mark, .ag-gx-card.is-blocked .ag-gx-tile { color: var(--bad-ink); }
.ag-gx-card.is-pending { border-color: var(--faint); background: var(--surface); }
.ag-gx-card.is-pending .ag-gx-name { color: var(--text); font-weight: 600; }
@keyframes ag-gx-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn-ink) 36%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--warn-ink) 0%, transparent); }
}

/* The floating view toolbar, bottom-left, above the status strip. Real
   buttons: it is reachable by Tab and operable from the keyboard. */
.ag-gx-tools { position: absolute; left: 12px; bottom: 12px; z-index: 4;
  display: flex; align-items: center; gap: 2px; padding: 4px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  box-shadow: var(--card-shadow); }
.ag-gx-tool { min-width: 28px; height: 26px; padding: 0 8px; border: 0; border-radius: 8px;
  color: var(--text-strong); background: transparent; font: inherit; font-size: 11.5px;
  font-weight: 600; line-height: 1; cursor: pointer; }
.ag-gx-tool.is-wide { padding: 0 10px; }
.ag-gx-tool:hover { background: var(--hover); }
.ag-gx-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ag-gx-tool[aria-pressed="true"] { color: var(--ink); background: var(--chip); }


.ag-gx-side { display: flex; flex-direction: column; gap: 11px; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface-sunken); }
.ag-gx-side-head b { display: block; color: var(--ink); font-size: 14px; font-weight: 650; }
.ag-gx-side-head span { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.ag-gx-rows { display: flex; flex-direction: column; gap: 1px; overflow: hidden;
  border-radius: 10px; background: var(--line); }
.ag-gx-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 7px 10px; background: var(--surface); }
.ag-gx-row small { flex: none; color: var(--muted); font-size: 11px; }
.ag-gx-row strong { color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums;
  font-weight: 600; overflow-wrap: anywhere; text-align: right; }
.ag-gx-note { margin: 0; color: var(--text); font-size: 12px; line-height: 1.55; }
.ag-gx-side .ag-act { width: 100%; text-align: center; }

/* The canvas wants 780px and the panel 300px; with the gap and the body's
   padding that is 1144px, which the dialog only has while the viewport is
   wider than 1176px. Below that the panel goes under the canvas, and the
   canvas simply shows less of the stage — pan and "Fit all" are how a reader
   gets to the rest, which is what they are for. */
@media (max-width: 1195px) {
  .ag-gx { grid-template-columns: minmax(0, 1fr); }
}

/* Nothing moves on a settled run. The node where it stopped keeps its colour,
   because that is still where it stopped, but a flowing edge on a cancelled
   task would claim work is still happening. The same switch is thrown by the
   toolbar's Pause motion, which is a session preference. */
.ag-gx-stage.is-settled .ag-gx-edge.is-flow,
.ag-gx-stage.is-settled .ag-gx-card.is-now,
.ag-gx-stage.is-paused .ag-gx-edge.is-flow,
.ag-gx-stage.is-paused .ag-gx-card.is-now { animation: none; }
/* Paused is a state a reader chose, so it is drawn rather than merely felt:
   the flowing overlay becomes a solid stroke that still carries its colour. */
.ag-gx-stage.is-paused .ag-gx-edge.is-flow { stroke-dasharray: none; }
.ag-gx-stage.is-paused .ag-gx-card.is-now {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn-ink) 30%, transparent); }

/* A flowing edge and a pulsing node are both "look here" signals, not
   information: with reduced motion asked for, the colours still say it, and
   the canvas opens paused. The toggle still works from there — a reader who
   presses "Resume motion" has asked for this canvas specifically, which is
   what `is-motion` records, so the blanket rule below steps aside for them.
   Without that class the canvas stands still on CSS alone, even if the
   script never ran. */
@media (prefers-reduced-motion: reduce) {
  .ag-gx-stage:not(.is-motion) .ag-gx-edge.is-flow { animation: none; }
  .ag-gx-stage:not(.is-motion) .ag-gx-card.is-now { animation: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn-ink) 30%, transparent); }
  .ag-gx-card:hover { box-shadow: none; border-color: var(--ink); }
}

body[data-view="agents"] .hello { display: none; }

dialog.ag-dlg { height: min(760px, 86vh); }
.ag-frame .wd-sub { padding: 12px 24px; }
.ag-frame .wd-body { padding: 18px 24px 20px; }
.ag-foot { flex-direction: column; align-items: stretch; gap: 10px; }

/* The artifact slot: the only region of the frame that varies. */
.ag-slot { display: flex; flex-direction: column; gap: 16px; }
/* The canvas takes whatever height the dialog body has left, instead of a
   fixed box with dead space beneath it. A free canvas is only as useful as
   the room it gives you to move things. */
#agentProgressSlot { height: 100%; }
/* Full bleed. The canvas is the body of this dialog, so it meets the dialog's
   own edges: no inset, no second border, no second set of rounded corners
   inside the rounded corners of the dialog itself. */
#agentProgressDialog .wd-body { padding: 0; }
#agentProgressDialog .ag-gx-canvas { border: 0; border-radius: 0;
  border-bottom: 1px solid var(--line); }
/* The facts row keeps the inset the body no longer supplies. */
#agentProgressSlot > .ag-kv, #agentProgressSlot > .ag-callout,
#agentProgressSlot > .ag-reply { margin: 0 24px; }
#agentProgressSlot { gap: 14px; padding-bottom: 0; }
#agentProgressSlot > .ag-section { display: flex; flex-direction: column; flex: 1 1 auto;
  min-height: 0; padding: 0; }
/* The canvas and the chat column, side by side, each taking the body's full
   height. align-items:stretch is explicit: the grid version of this rule
   inherited align-items:start, and in a flex row that stops the canvas
   stretching down to the body's height. min-width:0 on the canvas is what
   lets it give way to the fixed chat column instead of overflowing. */
#agentProgressSlot .ag-gx { display: flex; flex-direction: row; flex: 1 1 auto;
  min-height: 0; align-items: stretch; gap: 0; }
#agentProgressSlot .ag-gx > .ag-gx-canvas { flex: 1 1 auto; min-width: 0; }

/* ---- the chat column ---------------------------------------------------
   One task's conversation, standing beside its pipeline: the prompt that
   opened it, the questions the agent asked, the reasons it stopped, the
   notes left on decisions, and a box to answer with. Full bleed on the
   right, like the canvas on the left, with one hairline between them. */
/* ---- Resize handle between graph and chat ---- */
.ag-ch-resize { flex: none; width: 6px; cursor: col-resize; position: relative;
  background: transparent; z-index: 2; margin: 0 -3px;
  touch-action: none; user-select: none; -webkit-user-select: none; }
.ag-ch-resize::before { content: ''; position: absolute; inset: 0;
  width: 1px; margin: auto; background: var(--line); }
.ag-ch-resize::after { content: ''; position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 4px; height: 32px; border-radius: 2px;
  background: var(--faint); opacity: 0; transition: opacity .15s; }
.ag-ch-resize:hover::after, .ag-ch-resize.is-dragging::after { opacity: 1; }
.ag-ch-resize.is-dragging::before { background: var(--accent); }

.ag-ch { display: flex; flex-direction: column; flex: 0 0 var(--ag-ch-w, 326px);
  min-width: 220px; max-width: 70vw; min-height: 0;
  border-left: none; border-bottom: 1px solid var(--line);
  background: var(--surface); }

/* The transcript. It scrolls on its own and contains its overscroll, so
   reaching the top of it does not start scrolling the dialog behind it. */
.ag-ch-log { display: flex; flex-direction: column; flex: 1 1 auto; gap: 10px;
  min-height: 0; padding: 14px 16px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.ag-ch-empty { margin: 0; color: var(--faint); font-size: 12px; }

.ag-ch-msg { max-width: 94%; padding: 9px 11px; border: 1px solid var(--line);
  background: var(--surface-sunken); animation: ag-ch-up .35s ease both; }
.ag-ch-msg.is-you { align-self: flex-end; border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-radius: 16px 16px 6px 16px; }
.ag-ch-msg.is-agent { align-self: flex-start; padding: 2px 2px;
  border: none; background: none; }
.ag-ch-msg.is-agent .ag-ch-msg-head strong { color: var(--muted); font-size: 10.5px; font-weight: 600; }
.ag-ch-msg.is-agent .ag-ch-msg-text { color: var(--text-soft, var(--text)); }
.ag-ch-msg.is-warn { border-color: color-mix(in srgb, var(--warn-ink) 55%, var(--line));
  background: var(--warn-bg); }
.ag-ch-msg.is-bad { border-color: color-mix(in srgb, var(--danger) 55%, var(--line));
  background: var(--bad-bg); }
.ag-ch-msg.is-warn.is-agent, .ag-ch-msg.is-bad.is-agent {
  padding: 9px 11px; border-width: 1px; border-style: solid;
  border-radius: 6px 16px 16px 16px; }
.ag-ch-msg-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 4px; }
.ag-ch-msg-head strong { overflow: hidden; color: var(--ink); font-size: 11.5px; font-weight: 650;
  text-overflow: ellipsis; white-space: nowrap; }
.ag-ch-msg-head time { flex: none; color: var(--faint); font-size: 10.5px;
  font-variant-numeric: tabular-nums; }
/* pre-wrap: a numbered list of questions and a multi-line prompt are kept as
   they were written. break-word stops a pasted URL widening the column. */
.ag-ch-msg-text { margin: 0; color: var(--text); font-size: 12px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.ag-ch-tag { display: inline-block; margin-top: 6px; color: var(--muted); font-size: 10.5px;
  font-weight: 600; letter-spacing: .02em; }

/* Legacy thin-line note — kept for non-phase events that don't need a block. */
.ag-ch-note { display: flex; align-items: baseline; gap: 7px; padding: 0 2px;
  animation: ag-ch-up .35s ease both; }
.ag-ch-note i { width: 5px; height: 5px; flex: none; border-radius: 50%;
  background: var(--faint); transform: translateY(-2px); }
.ag-ch-note span { flex: 1 1 auto; color: var(--muted); font-size: 11px; line-height: 1.45; }
.ag-ch-note time { flex: none; color: var(--faint); font-size: 10.5px;
  font-variant-numeric: tabular-nums; }

/* The chat column had a header — an icon, the word "Chat", the task id and a
   state pill. It restated what the panel around it already shows, so it was
   removed and the transcript now starts at the top.

   Only the base rule below survives, and not for the pill: the composer's
   status line under the message box shares this class name. Its own rule
   lives further down and overrides what it needs. */
.ag-ch-status { display: inline-flex; align-items: center; margin-left: auto;
  padding: 2px 10px; border-radius: 999px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }

/* ---- Collapsible thinking / tool blocks (21st.dev style) ---- */
.ag-ch-block { align-self: flex-start; max-width: 94%;
  animation: ag-ch-up .35s ease both; }
.ag-ch-block-toggle { display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 12px;
  border: 1px solid var(--line-soft, var(--line));
  border-radius: 10px; background: var(--surface-raised, var(--chip));
  cursor: pointer; color: inherit; font: inherit; text-align: left;
  transition: background .15s, border-color .15s; }
.ag-ch-block-toggle:hover { background: var(--chip); border-color: var(--line); }
.ag-ch-block-ico { width: 18px; height: 18px; flex: none;
  display: grid; place-items: center; }
.ag-ch-block-ico svg { width: 14px; height: 14px; }
.ag-ch-block.is-think .ag-ch-block-ico { color: var(--accent); }
.ag-ch-block.is-tool .ag-ch-block-ico { color: var(--positive, #57ab5a); }
.ag-ch-block.is-done .ag-ch-block-ico { color: var(--positive, #57ab5a); }
.ag-ch-block.is-think .ag-ch-block-toggle:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent); }
.ag-ch-block.is-tool .ag-ch-block-toggle:hover {
  background: color-mix(in srgb, var(--positive, #57ab5a) 8%, transparent); }
.ag-ch-block-label { flex: 1; font-size: 12px; font-weight: 550;
  color: var(--muted); }
.ag-ch-block-dur { font-size: 10px; color: var(--faint);
  font-variant-numeric: tabular-nums; white-space: nowrap;
  padding: 1px 7px; border-radius: 6px;
  background: var(--chip, #21262d); }
.ag-ch-block-time { font-size: 10px; color: var(--faint);
  font-variant-numeric: tabular-nums; }
.ag-ch-block-chev { width: 14px; height: 14px; color: var(--faint); flex: none;
  transition: transform .2s ease; }
.ag-ch-block-chev svg { width: 100%; height: 100%; }
.ag-ch-block.open .ag-ch-block-chev { transform: rotate(180deg); }
.ag-ch-block-body { display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .3s cubic-bezier(.4,0,.2,1), opacity .2s;
  opacity: 0; }
.ag-ch-block-body > div { overflow: hidden; }
.ag-ch-block.open .ag-ch-block-body { grid-template-rows: 1fr; opacity: 1; }
.ag-ch-block-inner { padding: 10px 14px; margin: 4px 0 0 20px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.ag-ch-block.is-tool .ag-ch-block-inner {
  border-left-color: color-mix(in srgb, var(--positive, #57ab5a) 30%, transparent); }
.ag-ch-block-inner code { font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px; padding: 1px 5px; border-radius: 4px;
  background: var(--chip); color: var(--text); }

/* Spinner ring for in-progress blocks */
.ag-ch-block-spinner { width: 18px; height: 18px; flex: none; }
.ag-ch-block-spinner svg { width: 18px; height: 18px; }
.ag-ch-spinner-ring {
  stroke-dasharray: 36 64; stroke-dashoffset: 0;
  animation: ag-ch-spin 1.1s cubic-bezier(.4,.15,.6,.85) infinite;
  transform-origin: center; }
@keyframes ag-ch-spin { to { transform: rotate(360deg); } }
.ag-ch-block.is-active.is-think .ag-ch-spinner-ring { stroke: var(--accent); }
.ag-ch-block.is-active.is-tool .ag-ch-spinner-ring { stroke: var(--positive, #57ab5a); }
.ag-ch-block.is-active .ag-ch-block-dur {
  animation: ag-ch-pulse 2s ease-in-out infinite; }
@keyframes ag-ch-pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }

/* Shimmer label for in-progress blocks */
.ag-ch-block.is-active.is-think .ag-ch-block-label {
  background: linear-gradient(90deg,
    var(--accent) 0%, color-mix(in srgb, var(--accent) 45%, transparent) 35%,
    var(--ink, #e6edf3) 50%,
    color-mix(in srgb, var(--accent) 45%, transparent) 65%, var(--accent) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ag-ch-shimmer 2.4s ease-in-out infinite; }
.ag-ch-block.is-active.is-tool .ag-ch-block-label {
  background: linear-gradient(90deg,
    var(--positive, #57ab5a) 0%, color-mix(in srgb, var(--positive, #57ab5a) 45%, transparent) 35%,
    var(--ink, #e6edf3) 50%,
    color-mix(in srgb, var(--positive, #57ab5a) 45%, transparent) 65%, var(--positive, #57ab5a) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ag-ch-shimmer 2.4s ease-in-out infinite; }
@keyframes ag-ch-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---- Grouped thinking block (consolidated phases) ---- */
.ag-ch-thinking { align-self: flex-start; max-width: 94%;
  animation: ag-ch-up .35s ease both; }
.ag-ch-thinking-toggle { display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 12px;
  border: 1px solid var(--line-soft, var(--line));
  border-radius: 10px; background: var(--surface-raised, var(--chip));
  cursor: pointer; color: inherit; font: inherit; text-align: left;
  transition: background .15s, border-color .15s; }
.ag-ch-thinking-toggle:hover { background: var(--chip); border-color: var(--line); }
.ag-ch-thinking-spinner { width: 18px; height: 18px; flex: none; }
.ag-ch-thinking-spinner svg { width: 18px; height: 18px; }
.ag-ch-thinking-ico { width: 18px; height: 18px; flex: none;
  display: grid; place-items: center; color: var(--accent); }
.ag-ch-thinking-ico svg { width: 14px; height: 14px; }
.ag-ch-thinking-label { flex: 1; font-size: 12px; font-weight: 550;
  color: var(--muted); }
.ag-ch-thinking.is-active .ag-ch-thinking-label {
  background: linear-gradient(90deg,
    var(--accent) 0%, color-mix(in srgb, var(--accent) 45%, transparent) 35%,
    var(--ink, #e6edf3) 50%,
    color-mix(in srgb, var(--accent) 45%, transparent) 65%, var(--accent) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ag-ch-shimmer 2.4s ease-in-out infinite; }
.ag-ch-thinking-chev { width: 14px; height: 14px; color: var(--faint); flex: none;
  transition: transform .2s ease; }
.ag-ch-thinking-chev svg { width: 100%; height: 100%; }
.ag-ch-thinking.open .ag-ch-thinking-chev { transform: rotate(180deg); }
.ag-ch-thinking-body { display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .3s cubic-bezier(.4,0,.2,1), opacity .2s;
  opacity: 0; }
.ag-ch-thinking-body > div { overflow: hidden; }
.ag-ch-thinking.open .ag-ch-thinking-body { grid-template-rows: 1fr; opacity: 1; }
.ag-ch-thinking-steps { margin: 4px 0 0 20px; padding: 6px 0;
  border-left: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.ag-ch-thinking-step { display: flex; align-items: center; gap: 8px;
  padding: 4px 12px; font-size: 11.5px; }
.ag-ch-step-ico { width: 14px; height: 14px; flex: none; }
.ag-ch-step-ico svg { width: 100%; height: 100%; }
.ag-ch-step-name { color: var(--text-soft, var(--muted)); font-weight: 500; }
.ag-ch-step-dur { color: var(--faint); font-size: 10px; margin-left: auto;
  font-variant-numeric: tabular-nums; }
.ag-ch-thinking-step.is-failed .ag-ch-step-name { color: var(--danger, #f85149); }
.ag-ch-thinking-step.is-running .ag-ch-step-name { color: var(--accent); }
.ag-ch-step-ico.is-spinning svg { animation: ag-ch-spin .8s linear infinite; }

/* Failed block variant */
.ag-ch-block.is-failed .ag-ch-block-ico { color: var(--danger, #f85149); }
.ag-ch-block.is-failed .ag-ch-block-toggle {
  border-color: color-mix(in srgb, var(--danger, #f85149) 20%, transparent); }
.ag-ch-block.is-failed .ag-ch-block-inner {
  border-left-color: color-mix(in srgb, var(--danger, #f85149) 30%, transparent); }

/* Phase divider — a centered label between horizontal rules */
.ag-ch-divider { display: flex; align-items: center; gap: 10px;
  padding: 2px 0; animation: ag-ch-up .35s ease both; }
.ag-ch-divider .ag-ch-divider-line { flex: 1; height: 1px;
  background: var(--line-soft, var(--line)); }
.ag-ch-divider .ag-ch-divider-label { font-size: 10px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; color: var(--faint);
  display: flex; align-items: center; gap: 5px; }
.ag-ch-divider .ag-ch-divider-label svg { width: 12px; height: 12px;
  color: var(--positive, #57ab5a); }

/* Output tag pill (green) */
.ag-ch-tag-output { display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px; font-size: 10px; font-weight: 600;
  color: var(--positive-ink, var(--positive, #57ab5a));
  background: var(--ok-bg, rgba(87, 171, 90, .16));
  padding: 2px 8px; border-radius: 10px; }
.ag-ch-tag-output::before { content: ''; width: 4px; height: 4px;
  border-radius: 50%; background: currentColor; }

/* Richer file card */
.ag-ch-file-rich { margin-top: 10px; border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden;
  background: var(--surface-raised, var(--chip)); max-width: 240px; }
.ag-ch-file-rich-top { display: flex; align-items: center; justify-content: center;
  height: 48px; border-bottom: 1px solid var(--line-soft, var(--line));
  background: color-mix(in srgb, var(--accent) 6%, transparent); }
.ag-ch-file-rich-top svg { width: 24px; height: 24px; color: var(--accent); opacity: .7; }
.ag-ch-file-rich-meta { display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; }
.ag-ch-file-rich-info { flex: 1; min-width: 0; }
.ag-ch-file-rich-name { font-size: 11.5px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-ch-file-rich-detail { font-size: 10px; color: var(--muted); margin-top: 1px; }
.ag-ch-file-rich-actions { display: flex; gap: 2px; }
.ag-ch-file-rich-btn { display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: 6px; color: var(--muted); background: none; border: none;
  cursor: pointer; transition: background .12s, color .12s; }
.ag-ch-file-rich-btn:hover { background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent); }
.ag-ch-file-rich-btn svg { width: 14px; height: 14px; }

.ag-ch-form { display: flex; flex-direction: column; flex: none; gap: 0;
  padding: 8px 14px 11px; border-top: none; background: var(--surface); }
.ag-ch-compose { display: flex; align-items: center; gap: 9px;
  background: var(--surface-sunken); border: 1.5px solid var(--line);
  border-radius: 20px; padding: 7px 8px 7px 14px;
  transition: border-color .18s, box-shadow .18s; }
.ag-ch-compose:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent); }
.ag-ch-input { flex: 1; border: none; outline: none; resize: none;
  font: inherit; font-size: 13px; line-height: 1.45; max-height: 92px;
  background: transparent; color: var(--ink); min-width: 0; padding: 4px 0; }
.ag-ch-input::placeholder { color: var(--muted); }
.ag-ch-input:disabled { color: var(--faint); cursor: not-allowed; }
.ag-ch-bar { display: none; }
.ag-ch-send { border: none; cursor: pointer; width: 34px; height: 34px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none;
  transition: transform .12s, background .15s, color .15s;
  padding: 0; font-size: 0; line-height: 0; }
.ag-ch-send.ready { background: var(--accent); color: #fff; }
.ag-ch-send.idle { background: var(--surface-sunken); color: var(--muted); }
.ag-ch-send:hover:not(:disabled) { transform: scale(1.05); }
.ag-ch-send:disabled { background: var(--surface-sunken); color: var(--faint); cursor: not-allowed; }
.ag-ch-send .ico { display: none; }
.ag-ch-send svg { width: 16px; height: 16px; flex: none; }
.ag-ch-status { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; text-align: center; }
.ag-ch-status:empty { display: none; }
.ag-ch-status.is-bad { color: var(--bad-ink); }

/* Attach button */
.ag-ch-attach { border: none; cursor: pointer; width: 34px; height: 34px; flex: none;
  display: grid; place-items: center; border-radius: 50%;
  background: transparent; color: var(--muted); transition: color .15s, background .15s; }
.ag-ch-attach:hover:not(:disabled) { color: var(--ink); background: var(--surface-sunken); }
.ag-ch-attach:disabled { color: var(--faint); cursor: not-allowed; }
.ag-ch-attach svg { width: 16px; height: 16px; flex: none; }

/* Drop zone highlight on the chat log */
.ag-ch-log.ag-ch-drop {
  outline: 2px dashed var(--accent); outline-offset: -2px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

/* Pending file chips — sits above the compose bar, aligned to its edges */
.ag-ch-previews { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 14px 8px; }
.ag-ch-previews:empty { display: none; }
.ag-ch-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px;
  padding: 0 7px 0 4px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-sunken); font-size: 11.5px; color: var(--ink);
  max-width: 210px; animation: ag-ch-fadein .2s ease; }
.ag-ch-chip-thumb { width: 22px; height: 22px; min-width: 22px; min-height: 22px;
  object-fit: cover; object-position: center; border-radius: 4px; flex: none;
  display: block; background: var(--line); }
.ag-ch-chip-ico { width: 22px; height: 22px; flex: none; display: grid; place-items: center;
  border-radius: 4px; background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent); }
.ag-ch-chip-ico svg { width: 12px; height: 12px; }
.ag-ch-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500; line-height: 1; }
.ag-ch-chip-rm { border: none; cursor: pointer; background: transparent; color: var(--faint);
  width: 16px; height: 16px; flex: none; padding: 0; display: grid; place-items: center;
  border-radius: 50%; transition: background .15s, color .15s; line-height: 0; margin-left: -1px; }
.ag-ch-chip-rm:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.ag-ch-chip-rm svg { width: 10px; height: 10px; }
@keyframes ag-ch-fadein { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@keyframes ag-ch-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* File card — shared by previews, chat attachments, file entries */
.ag-ch-file { display: flex; align-items: center; gap: 7px; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface-sunken);
  max-width: 200px; min-width: 0; }
.ag-ch-file-thumb { width: 36px; height: 36px; flex: none; object-fit: cover;
  border-radius: 4px; background: var(--line); }
.ag-ch-file-ico { width: 20px; height: 20px; flex: none; color: var(--muted); }
.ag-ch-file-ico svg { width: 100%; height: 100%; }
.ag-ch-file-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ag-ch-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; font-weight: 550; color: var(--ink); line-height: 1.3; }
.ag-ch-file-size { font-size: 10px; color: var(--muted); line-height: 1.3; }

/* Remove button on pending preview cards */
.ag-ch-file-rm { border: none; cursor: pointer; background: transparent; color: var(--muted);
  width: 18px; height: 18px; flex: none; padding: 0; display: grid; place-items: center;
  border-radius: 50%; transition: background .15s, color .15s; }
.ag-ch-file-rm:hover { background: var(--danger-bg, color-mix(in srgb, var(--danger) 12%, transparent));
  color: var(--danger, #d32f2f); }
.ag-ch-file-rm svg { width: 12px; height: 12px; }

/* Download button on chat file cards */
.ag-ch-file-dl { display: grid; place-items: center; width: 22px; height: 22px; flex: none;
  border-radius: 4px; color: var(--muted); transition: color .15s, background .15s; }
.ag-ch-file-dl:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.ag-ch-file-dl svg { width: 14px; height: 14px; }
.ag-ch-file-open { display: grid; place-items: center; width: 22px; height: 22px; flex: none;
  border-radius: 4px; color: var(--muted); transition: color .15s, background .15s; }
.ag-ch-file-open:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.ag-ch-file-open svg { width: 14px; height: 14px; }

/* Attachment strip inside a chat bubble */
.ag-ch-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }


/* File cards list in chat messages */
.ag-ch-files { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }

/* Inline image preview in chat */
.ag-ch-img-preview { margin-top: 6px; border-radius: 8px; overflow: hidden; max-width: 200px; }
.ag-ch-img-preview img { display: block; width: 100%; height: auto; cursor: pointer; }
.ag-ch-img-preview img:hover { opacity: .85; }

/* Upload progress */
.ag-ch-uploading { display: flex; align-items: center; gap: 6px; padding: 4px 0;
  font-size: 11px; color: var(--muted); }
.ag-ch-uploading::before { content: ''; width: 14px; height: 14px; border: 2px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%; animation: ag-ch-spin .7s linear infinite; }
@keyframes ag-ch-spin { to { transform: rotate(360deg); } }
@keyframes ag-ch-fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Under about 980px the dialog is too narrow to carry both at once, so the
   chat goes below the canvas rather than squeezing it. It is never hidden:
   it is the only way to speak to the agent from this dialog. */
@media (max-width: 980px) {
  #agentProgressSlot .ag-gx { flex-direction: column; }
  /* Shares, not minimums, on both halves. A min-height on each is what made
     the body overflow at 900px: the two floors added up to more than the
     dialog had, and the composer was squeezed until the transcript was 28px
     tall. The log is the part that gives way instead — it has no floor of
     its own, so the head and the composer always fit and the canvas, which
     pans and zooms, takes the rest. */
  #agentProgressSlot .ag-gx > .ag-gx-canvas { flex: 1 1 38%; min-height: 110px; }
  .ag-ch { flex: 1 1 62%; min-height: 0;
    border-left: 0; border-top: 1px solid var(--line); }
  .ag-ch-log { min-height: 0; padding: 10px 14px; }
  .ag-ch-form { padding: 8px 14px 10px; }
}

@media (max-width: 980px) and (max-height: 720px) {
  #agentProgressSlot .ag-gx > .ag-gx-canvas { flex: 1 1 auto; min-height: 78px; }
  .ag-ch { flex: 0 1 auto; }
  .ag-ch-log { padding: 8px 14px; }
  .ag-ch-form { padding: 7px 14px 9px; }
}
#agentProgressDialog .wd-body { display: flex; min-height: 0; }
#agentProgressDialog .wd-body > .ag-slot { flex: 1 1 auto; min-width: 0; }
.ag-slot h3 { color: var(--ink); font-size: 14px; font-weight: 600; }
.ag-slot-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ag-slot-head h3 { margin: 0; }
.ag-slot-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.ag-prose { max-width: 80ch; margin: 0; color: var(--text); font-size: 13.5px; line-height: 1.6; }
.ag-prose.pre { white-space: pre-wrap; font-family: inherit; }
.ag-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ag-list li { position: relative; padding-left: 16px; color: var(--text); font-size: 13px; line-height: 1.55; }
.ag-list li::before { position: absolute; top: .58em; left: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); content: ""; }
.ag-table { width: 100%; border-collapse: collapse; }
.ag-table th { padding: 7px 10px; border-bottom: 1px solid var(--line); color: var(--faint); font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.ag-table td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); color: var(--text); font-size: 12.5px; vertical-align: middle; }
.ag-table tr:last-child td { border-bottom: 0; }
.ag-table td.num, .ag-table th.num { font-variant-numeric: tabular-nums; text-align: right; }
.ag-table .ag-mono { color: var(--ink); }
.ag-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.ag-kv > div { padding: 10px 12px; border-radius: 11px; background: var(--surface-sunken); }
.ag-kv small { display: block; color: var(--muted); font-size: 11px; }
.ag-kv strong { display: block; margin-top: 3px; overflow-wrap: anywhere; color: var(--ink); font-size: 13px; font-weight: 600; }
.ag-callout { padding: 12px 14px; border: 1px solid var(--warn-bg); border-radius: 12px; color: var(--warn-ink); background: var(--warn-bg); font-size: 12.5px; line-height: 1.55; }
.ag-callout.info { border-color: var(--info-bg); color: var(--info-ink); background: var(--info-bg); }
.ag-callout.bad { border-color: var(--bad-bg); color: var(--bad-ink); background: var(--bad-bg); }
.ag-callout strong { display: block; margin-bottom: 3px; font-size: 13px; }

/* The guards block. New tests that do not fail against the old code are not
   tests of the change, and a green suite beside them is worth nothing — so
   it is rendered first, large, and it names the guard that failed. */
.ag-guards { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-sunken); }
.ag-guards.is-bad { border-color: var(--bad-ink); background: var(--bad-bg); }
.ag-guards.is-ok { border-color: var(--ok-ink); background: var(--ok-bg); }
.ag-guards-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.ag-guards-top strong { color: var(--ink); font-size: 13.5px; font-weight: 600; letter-spacing: .02em; }
.ag-guard { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-top: 1px solid var(--line-soft); }
.ag-guards-top + .ag-guard { border-top: 0; }
.ag-guard-text { flex: 1 1 auto; color: var(--text); font-size: 12.5px; line-height: 1.45; }
.ag-guard-dot { display: grid; place-items: center; width: 18px; height: 18px; flex: none; border-radius: 50%; }
.ag-guard-dot.ok { color: var(--ok-ink); background: var(--ok-bg); }
.ag-guard-dot.bad { color: var(--bad-ink); background: var(--bad-bg); }
.ag-guard-dot .ico { width: 11px; height: 11px; }

.ag-gantt { display: flex; flex-direction: column; gap: 7px; }
.ag-gantt-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.ag-gantt-row > span:first-child { overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ag-gantt-track { display: flex; height: 14px; overflow: hidden; border-radius: 5px; background: var(--track-solid); }
.ag-gantt-track i { display: block; height: 100%; }
.ag-gantt-track i.work { background: linear-gradient(180deg, var(--accent-soft), var(--accent)); }
.ag-gantt-track i.wait { background: repeating-linear-gradient(45deg, var(--meter-line) 0 3px, transparent 3px 7px), var(--neutral-bg); }
.ag-gantt-row b { color: var(--ink); font-size: 11.5px; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.ag-legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 2px; }
.ag-legend span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11.5px; }
.ag-legend i { width: 15px; height: 10px; flex: none; border-radius: 3px; }
.ag-legend i.work { background: linear-gradient(180deg, var(--accent-soft), var(--accent)); }
.ag-legend i.wait { background: repeating-linear-gradient(45deg, var(--meter-line) 0 3px, transparent 3px 7px), var(--neutral-bg); }
.ag-legend i.none { background: var(--track-solid); }

/* The meta strip, identical on every checkpoint. */
.ag-meta { display: grid; flex: none; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 1px; border-top: 1px solid var(--line); background: var(--line); }
.ag-meta > div { padding: 11px 16px; background: var(--surface); }
.ag-meta small { display: block; color: var(--muted); font-size: 11px; }
.ag-meta strong { display: block; margin-top: 2px; color: var(--ink); font-size: 13.5px; font-variant-numeric: tabular-nums; font-weight: 600; }

/* The action row. The same verbs, in the same order, every time: a verb the
   gate does not offer is disabled and says why, never hidden. */
.ag-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ag-act { padding: 9px 15px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--surface); font: inherit; font-size: 13px; cursor: pointer; }
.ag-act:hover:not(:disabled) { background: var(--hover); }
.ag-act:disabled { color: var(--faint); background: var(--surface-sunken); cursor: not-allowed; opacity: .6; }
.ag-act.primary { border-color: #111316; color: var(--on-fixed); background: #111316; }
.ag-act.primary:hover:not(:disabled) { border-color: #22262c; background: #22262c; }
.ag-act.primary:disabled { border-color: var(--line); color: var(--faint); background: var(--surface-sunken); }
.ag-act.danger { border-color: color-mix(in srgb, var(--danger) 32%, transparent); color: var(--danger); }
.ag-act.danger:hover:not(:disabled) { background: var(--bad-bg); }
.ag-act.is-busy { color: var(--faint); cursor: progress; }
.ag-note { display: flex; flex-direction: column; gap: 5px; }
.ag-note[hidden] { display: none; }
.ag-note label { display: flex; align-items: baseline; gap: 8px; color: var(--text-strong); font-size: 12px; font-weight: 600; }
.ag-note label small { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.ag-note textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--surface); font: inherit; font-size: 13px; resize: vertical; }
.ag-note textarea:focus { border-color: var(--focus-ring); outline: 0; }
.ag-foot-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ag-foot-note:empty { display: none; }
.ag-foot-note.is-bad { color: var(--bad-ink); }
.ag-foot-actions { display: flex; align-items: center; gap: 9px; }
.ag-edit { width: 100%; padding: 9px 11px; border: 1px solid var(--accent); border-radius: 11px; color: var(--ink); background: var(--surface); font: inherit; font-size: 13px; line-height: 1.55; resize: vertical; }
.ag-edit:focus { border-color: var(--focus-ring); outline: 0; }

/* ── the composer ─────────────────────────────────────────────────────── */

.ag-compose { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 300px); gap: 20px; align-items: start; }
.ag-compose-main { display: flex; min-width: 0; flex-direction: column; gap: 15px; }
.ag-field { display: flex; min-width: 0; flex-direction: column; gap: 5px; color: var(--text-strong); font-size: 12px; font-weight: 600; }
.ag-field textarea, .ag-field input, .ag-field select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--surface); font: inherit; font-size: 13px; font-weight: 400; }
.ag-field textarea { resize: vertical; line-height: 1.55; }
.ag-field textarea:focus, .ag-field input:focus, .ag-field select:focus { border-color: var(--focus-ring); outline: 0; }
.ag-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ag-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; border: 0; padding: 0; }
.ag-modes legend { margin-bottom: 7px; color: var(--text-strong); font-size: 12px; font-weight: 600; }
.ag-mode { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); cursor: pointer; }
.ag-mode:has(input:checked) { border-color: var(--accent); background: var(--quote-bg); }
.ag-mode input { margin-top: 2px; flex: none; accent-color: var(--accent); }
.ag-mode strong { display: block; color: var(--ink); font-size: 13px; font-weight: 600; }
.ag-mode small { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.ag-strip-wrap { padding: 12px 13px; border: 1px solid var(--line-soft); border-radius: 13px; background: var(--surface-sunken); }
.ag-strip-caption { margin: 0 0 9px; color: var(--muted); font-size: 11.5px; }
.ag-strip { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; flex-wrap: wrap; list-style: none; }
.ag-strip li { display: flex; align-items: center; gap: 4px; }
.ag-strip-ph { padding: 4px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface); font-size: 11.5px; white-space: nowrap; }
.ag-strip-gate { display: grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 6px; font-size: 11px; font-weight: 700; }
.ag-strip-gate.mode { color: var(--warn-ink); background: var(--warn-bg); }
.ag-strip-gate.env { color: var(--bad-ink); background: var(--bad-bg); }
.ag-estimate { padding: 15px 16px; border: 1px solid var(--line-soft); border-radius: 15px; background: var(--surface-sunken); }
.ag-estimate-head strong { display: block; color: var(--ink); font-size: 13.5px; font-weight: 600; }
.ag-estimate-head small { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.ag-estimate-rows { display: flex; flex-direction: column; gap: 1px; margin-top: 13px; }
.ag-estimate-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.ag-estimate-row:last-child { border-bottom: 0; }
.ag-estimate-row span { color: var(--muted); font-size: 12px; }
.ag-estimate-row b { color: var(--ink); font-size: 12.5px; font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.ag-estimate-notes { display: flex; flex-direction: column; gap: 9px; margin-top: 13px; }
.ag-estimate-notes:empty { display: none; }

/* ── projects and costs ───────────────────────────────────────────────── */

.ag-open { padding: 6px 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); font: inherit; font-size: 12.5px; cursor: pointer; }
.ag-open:hover:not(:disabled) { background: var(--hover); }
.ag-open:disabled { color: var(--faint); background: var(--surface-sunken); cursor: not-allowed; opacity: .6; }
/* The run is stopped and it is the reader's move. Worth saying in colour:
   this line used to read as ordinary metadata next to an agent that was
   promising to carry on by itself. */
.ag-sub.is-waiting, #agentProgressSub.is-waiting { color: var(--warn-ink); font-weight: 600; }

.ag-reprepare { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-left: 6px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer; vertical-align: middle; transition: color .15s, background .15s; }
.ag-reprepare:hover:not(:disabled) { background: var(--hover); color: var(--accent); }
.ag-reprepare:disabled { opacity: .4; cursor: not-allowed; }
.ag-connect { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, .8fr) auto; gap: 12px; align-items: end; }
.ag-connect .pill.wide { height: 40px; font-size: 13px; }
.ag-section { padding: 18px 24px; border-bottom: 1px solid var(--line); }
.ag-section:last-child { border-bottom: 0; }
.ag-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ag-section-head h3 { margin: 0; color: var(--ink); font-size: 14.5px; font-weight: 600; }
.ag-section-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.ag-section .ag-callout { margin-top: 12px; }

/* Per-dialog padding, since each of these dialogs sets its own. The board
   must not let its dialog body scroll: the columns scroll instead, which is
   why the dialog is a fixed height in the first place. */
#agentTaskDialog .wd-body { padding: 18px 24px 22px; }
#agentProjectsDialog .wd-body, #agentCostsDialog .wd-body { padding: 0; }
#agentFlowDialog .wd-body { padding: 16px 20px 20px; }
#agentBoardDialog .wd-body { display: flex; padding: 16px 20px; overflow: hidden; }
#agentBoardDialog .ag-view-body { display: flex; flex: 1 1 auto; min-width: 0; min-height: 0; }

/* ── collapse order ──────────────────────────────────────────────────────
   The tiles go first, then the context rail: the queue is the one thing this
   screen cannot do without. */

@media (max-width: 1280px) {
  /* The tiles are the ONLY way into Board, Flow, Projects and Costs, so they
     are relocated rather than hidden: a full-width row above the panes, laid
     out horizontally. Hiding them stranded four views at narrow widths. */
  .ag-panes {
    grid-template-columns: minmax(0, 1fr) 288px;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .ag-tilecol {
    grid-column: 1 / -1; grid-row: 1;
    overflow: visible; padding-right: 0; margin-bottom: 2px;
  }
  .ag-pane.ag-side { grid-column: 2; grid-row: 2; }
  .ag-tiles {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; overflow-x: auto;
    scrollbar-width: thin; padding-bottom: 2px;
  }
  .ag-tiles .ag-tile { padding: 10px 12px; }
  .ag-tiles .ag-tile .ag-tile-ico { width: 28px; height: 28px; font-size: 14px; margin-bottom: 5px; }
  .ag-tiles .ag-tile .ag-tile-big { font-size: 17px; margin-top: 3px; }
  .ag-tiles .ag-tile .ag-tile-sub { font-size: 10px; }
  .ag-tiles .ag-tile.e { grid-column: auto; }
}
@media (max-width: 1180px) {
  /* Below this the shell itself scrolls the document — that is this
     dashboard's own rule for every view — so the panes stop being
     independently scrolling boxes and simply flow. */
  .ag-page { display: flex; flex-direction: column; overflow: visible; }
  .ag-panes { display: flex; flex-direction: column; }
  .ag-pane { overflow: visible; padding-right: 0; }
  .ag-sticky { position: static; }
  .ag-compose, .ag-connect, .ag-flow-panes { grid-template-columns: minmax(0, 1fr); }
  .ag-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #agentBoardDialog .wd-body { overflow: auto; }
  .ag-board { flex: 0 0 auto; min-height: 320px; }
}
@media (max-width: 1040px) {
  .ag-panes { grid-template-columns: minmax(0, 1fr); }
  .ag-panes > .ag-side { display: none; }
}
@media (max-width: 900px) {
  .ag-numbers { flex-wrap: wrap; }
  .ag-num { flex: 1 1 42%; border-bottom: 1px solid var(--line-soft); }
  .ag-num:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 680px) {
  .ag-head-actions { width: 100%; }
  .ag-head-actions .pill.wide { flex: 1 1 auto; justify-content: center; }
  .ag-field-row, .ag-modes { grid-template-columns: minmax(0, 1fr); }
  .ag-gantt-row { grid-template-columns: 72px minmax(0, 1fr) auto; gap: 8px; }
  .ag-num { flex: 1 1 100%; }
  .ag-num:nth-last-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .ag-num:last-child { border-bottom: 0; }
}
@media (max-width: 560px) {
  /* Eight labels in three hundred pixels are eight three-letter stubs. The
     dots and the rails still say which phase stopped the run. */
  .ag-tl-step b { display: none; }
  .ag-tl { margin: 10px 0 11px; }
}

/* Eight cells in the width that held four, so a long branch name truncates
   rather than wrapping the whole strip onto a second line. The full value is
   on the title attribute. */
.ag-meta > div { min-width: 0; }
.ag-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) { .ag-meta { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* The artifact inside the popover. It is the checkpoint dialog's own renderer,
   so the type scale is dialled down here rather than in the shared styles. */
.ag-gx-pop-art { margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line-soft); }
.ag-gx-pop-art .ag-section { padding: 0; }
.ag-gx-pop-art h3 { font-size: 12.5px; }
.ag-gx-pop-art .ag-table { font-size: 11.5px; }
.ag-gx-pop-art .ag-prose { font-size: 12px; }
.ag-gx-pop-art .ag-callout { font-size: 11.5px; }

/* Tighter inside the popover than in the dialog — the same content, read at a
   glance over the canvas rather than studied. */
.ag-gx-pop .ag-kvrow { padding: 5px 0; }
.ag-gx-pop-art { margin-top: 9px; padding-top: 9px; }
.ag-gx-pop-art .ag-section + .ag-section { margin-top: 9px; }
.ag-gx-pop-art h3 { margin-bottom: 4px; }
.ag-gx-pop-art li { margin: 2px 0; }
.ag-gx-pop-art p { margin: 4px 0; }
/* The decision surface, pinned under the scrolling region: the note, the
   seven verbs and the status line. It never scrolls, so the row a reader
   came here to press is always on screen. Scaled down a step from the
   dialog's own row, because it sits over a canvas. */
.ag-gx-decide { flex: none; display: flex; flex-direction: column; gap: 9px;
  padding-top: 10px; border-top: 1px solid var(--line); }
/* A popover carrying a decision gives the reading region a floor, so a long
   note and seven verbs cannot squeeze the artifact down to a sliver. */
.ag-gx-pop.has-decide .ag-gx-pop-scroll { min-height: 88px; }
.ag-gx-decide .ag-note label { font-size: 11.5px; }
.ag-gx-decide .ag-note label small { font-size: 11px; }
.ag-gx-decide .ag-note textarea { font-size: 12.5px; }
.ag-gx-decide .ag-actions { gap: 6px; }
.ag-gx-decide .ag-act { padding: 7px 11px; border-radius: 9px; font-size: 12.5px; }
.ag-gx-decide .ag-callout { font-size: 11.5px; }
.ag-gx-decide .ag-foot-note { font-size: 11.5px; }
.ag-gx-pending { margin: 0; color: var(--text); font-size: 12px; }

/* The artifact folds away, because on a gate it shares the box with the
   verbs. It opens by default: nothing a decision rests on is hidden. */
.ag-gx-fold > summary { padding: 2px 0; color: var(--text); cursor: pointer;
  font-size: 11.5px; font-weight: 600; list-style: none; }
.ag-gx-fold > summary::-webkit-details-marker { display: none; }
.ag-gx-fold > summary::before { content: '\25B8'; display: inline-block; width: 13px;
  color: var(--muted); font-weight: 400; }
.ag-gx-fold[open] > summary::before { content: '\25BE'; }
.ag-gx-fold > summary:hover { color: var(--ink); }
.ag-gx-fold > summary:focus-visible { outline: 2px solid var(--focus-ring);
  outline-offset: 2px; border-radius: 6px; }

/* ── settings dialog ─────────────────────────────────────────── */
#agentSettingsBody { padding: 20px 24px 28px; }
#agentSettingsBody h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
#agentSettingsBody section + section { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line-soft); }
.stg-hint { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; }
.stg-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; }
.stg-row:hover { background: var(--hover, var(--surface-sunken)); }
.stg-label { flex: 0 0 190px; min-width: 0; }
.stg-label b { display: block; font-size: 13px; font-weight: 550; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stg-label code { display: block; margin-top: 1px; font-size: 10.5px; color: var(--faint, var(--muted)); font-family: var(--mono, ui-monospace, Menlo, monospace); }
.stg-field { flex: 1; display: flex; gap: 6px; align-items: center; min-width: 0; }
.stg-input { flex: 1; min-width: 0; height: 34px; padding: 0 11px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); color: var(--ink);
  font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 13px; outline: 0; transition: border-color .15s; }
.stg-input:focus { border-color: var(--accent); }
.stg-input::placeholder { color: var(--muted); font-family: inherit; opacity: .55; }
.stg-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.stg-btn { padding: 6px 14px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.stg-btn:hover { background: var(--hover, var(--surface-sunken)); }
.stg-btn.primary { color: var(--on-fixed); background: #111316; border-color: #111316; }
.stg-btn.primary:hover { background: #22262c; }
.stg-btn.danger { color: var(--danger, #c4403a); border-color: rgba(176, 69, 63, .3); }
.stg-btn.danger:hover { background: rgba(176, 69, 63, .08); border-color: rgba(176, 69, 63, .5); }
.stg-toggle { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; display: grid; place-items: center; }
.stg-toggle:hover { background: var(--chip); color: var(--ink); }
.stg-status { flex: none; padding: 3px 9px; border-radius: 8px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.stg-status.ok { color: var(--ok-ink); background: var(--ok-bg); }
.stg-custom .stg-field { flex-wrap: wrap; }
.stg-custom .stg-row { background: var(--surface-sunken); }
@media (max-width: 700px) {
  .stg-row { flex-wrap: wrap; }
  .stg-label { flex: 1 0 100%; }
}

/* ---------------------------------------------------------------------------
   A message that is still in the air.

   The chat round trip classifies the message, may release a gate and may
   restart the run — two minutes is an ordinary wait. Before this, the typed
   text stayed in the composer for the whole of it and the only sign of life
   was a status line underneath, so the honest reading of the screen was that
   nothing had happened. The sent message now moves into the transcript at
   once, greyed, with the agent thinking directly beneath it.
   --------------------------------------------------------------------------- */
.ag-ch-msg.is-pending { opacity: 0.6; }
.ag-ch-msg.is-pending .ag-ch-msg-head time { font-style: italic; }

.ag-ch-msg.is-thinking { align-self: flex-start; }
.ag-ch-thinking-note {
  display: block; margin-top: 3px;
  color: var(--muted); font-size: 10.5px; line-height: 1.45;
}

.ag-ch-dots { display: flex; gap: 4px; align-items: center; min-height: 16px; }
.ag-ch-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent, currentColor);
  animation: ag-ch-blink 1.25s infinite ease-in-out both;
}
.ag-ch-dot:nth-child(2) { animation-delay: 0.16s; }
.ag-ch-dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes ag-ch-blink {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40%           { opacity: 1;    transform: scale(1); }
}

/* A reader who has asked for less motion gets a steady row, not a pulse. */
@media (prefers-reduced-motion: reduce) {
  .ag-ch-dot { animation: none; opacity: 0.6; }
}

/* These two rows always sort to the bottom of the transcript.

   They used to be kept last by removing and re-appending them whenever a new
   message arrived. Re-inserting a node restarts its CSS animation, so on a
   busy run — where the log updates several times a second — the dots flickered
   continuously. The log is already a flex column, so `order` puts them last
   without the DOM ever being touched. */
.ag-ch-log > .ag-ch-msg.is-pending,
.ag-ch-log > .ag-ch-msg.is-thinking { order: 1; }

/* A row the reader has already been looking at does not animate in again.

   Bubbles, notes, blocks, thinking rows and dividers each fade and rise over
   .35s on arrival. The chat column is replaced wholesale whenever the
   transcript changes shape — constantly, while a run is moving — so every one
   of them replayed that animation several times a second and the column
   flickered. `suppressEntryFx` marks the rows that already existed before a
   rebuild; rows appended afterwards carry no mark and still animate in. */
.ag-ch-seen { animation: none !important; }

/* ---------------------------------------------------------------------------
   The agent's transcript, inside the thinking block.

   The platform used to run the CLI with `--output-format json`, which returns
   the final answer and the cost and nothing else — so the only thing this
   block could show was how long a phase took. These rows are the real record:
   the prose the agent wrote and each tool it ran, in order.
   --------------------------------------------------------------------------- */
.ag-ch-thinking-step.is-agent-step { align-items: baseline; gap: 7px; }

/* The tool's name set apart from its argument, so a column of calls scans as
   "what it did" rather than as a paragraph. */
.ag-ch-step-tool {
  flex: none; color: var(--accent); font-size: 11px; font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.ag-ch-step-arg {
  overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.5;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  text-overflow: ellipsis; white-space: nowrap;
}
/* Prose wraps — it is the part worth reading in full. */
.ag-ch-step-say {
  color: var(--text-soft, var(--text)); font-size: 11.5px; line-height: 1.5;
  overflow-wrap: anywhere;
}
.ag-ch-thinking-step.is-error .ag-ch-step-say { color: var(--bad-ink, var(--danger)); }

/* A node that is asking the reader something.

   `.is-gate` and `.is-blocked` are both danger-coloured, which is right for a
   production deploy gate — a hard stop — and wrong for "shall I change a line
   of agent.yaml?". A proposal awaiting an answer is an open item, not a
   casualty: a finished task with every phase green should not carry a red
   tile because a question went unanswered. */
.ag-gx-card.is-asks { border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border-style: dashed; }
.ag-gx-card.is-asks .ag-gx-mark, .ag-gx-card.is-asks .ag-gx-tile { color: var(--accent); }

/* The connector into a node that is asking something. Accent, not danger:
   a finished pipeline should not be crossed by a red line because one
   question has gone unanswered. */
.ag-gx-edge.is-asks { stroke: var(--accent); opacity: .65; stroke-dasharray: 4 4; }

/* Answering the question a node is asking, from the node itself.
   The proposal mechanism shipped with an API route and no control, so the
   only way to answer was curl. */
.ag-gx-asks { display: flex; gap: 6px; margin-top: 6px; }
.ag-gx-asks-btn {
  padding: 2px 10px; border-radius: 999px; font: inherit; font-size: 10.5px;
  font-weight: 650; cursor: pointer; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
}
.ag-gx-asks-btn.is-approve { border-color: var(--accent); color: var(--accent); }
.ag-gx-asks-btn:hover:not(:disabled) { background: var(--chip); }
.ag-gx-asks-btn:disabled { opacity: .5; cursor: default; }

/* ==========================================================================
   PIE READINESS AND HEALTH (phase 10a)

   The two readiness tracks on the project card, and the knowledge health
   panel. Built on the existing tokens and on .ag-section / .ag-kv /
   .ag-callout / .ag-table / .ag-badge, so a theme change reaches it and a
   reader meets no new vocabulary.

   Everything here works at 320px: .ag-kv is already an auto-fit grid, the
   action row wraps, and the health table scrolls in its own box rather than
   widening the dialog and giving the whole page a horizontal scrollbar.

   Focus is visible on every control, because .ag-open ships without a
   :focus-visible rule and the browser default outline is invisible against
   --surface in the dark theme.
   ========================================================================== */

/* Both tracks on the project card, under the derived badge. They wrap rather
   than squeezing the Repository column: two labels that read are worth more
   than one row that fits. */
.pie-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.pie-chips .ag-badge { font-size: 10px; }

.pie-section .ag-kv { margin-bottom: 2px; }
.pie-section .ag-kv > div { display: flex; flex-direction: column; gap: 3px; }
.pie-section .ag-kv strong { margin-top: 0; }

/* The sentence under a tile's value: what the state means for the reader,
   not a restatement of the label. It is small, and it is not optional - the
   word "degraded" on its own is what this exists to replace. */
.pie-tile-note { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.45; }

/* Reason codes as sentences, with the machine-readable code kept visible at
   the end so an operator can still grep for it in a log. */
.pie-reasons { margin: 6px 0 0; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 6px; }
.pie-reasons li { font-size: 12px; line-height: 1.5; }
.pie-code {
  margin-left: 6px; padding: 1px 6px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface); font-size: 10.5px;
  white-space: nowrap;
}

.pie-progress { margin: 12px 0 0; color: var(--text); font-size: 12.5px; line-height: 1.55; }
.pie-progress strong { color: var(--ink); }
.pie-inline-btn { margin-left: 4px; padding: 2px 9px; font-size: 11.5px; }

.pie-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.pie-actions .ag-open { display: inline-flex; align-items: center; gap: 6px; }
.pie-actions .ag-open .ico { width: 13px; height: 13px; }

/* A control nobody can use stays in place, disabled, carrying its reason -
   a control that disappears teaches the reader the feature does not exist.
   `not-allowed` plus the reason on the title and the accessible name is what
   makes the difference legible without a hover. */
.pie-actions .ag-open:disabled { cursor: not-allowed; }
.pie-actions .ag-open:focus-visible,
.pie-inline-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Force reindex is a separate administrator operation (specification section
   5), so it does not look like the refresh next to it. */
.pie-danger { border-color: var(--bad-bg); color: var(--bad-ink); }
.pie-danger:hover:not(:disabled) { background: var(--bad-bg); }

.pie-action-note { margin: 7px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.pie-action-msg { margin: 6px 0 0; color: var(--text); font-size: 12px; line-height: 1.5; min-height: 0; }
.pie-action-msg:empty { display: none; }
.pie-action-msg.is-bad { color: var(--bad-ink); }

/* The health panel. */
.pie-health { display: flex; flex-direction: column; gap: 12px; }
.pie-loading { margin: 0; color: var(--muted); font-size: 12.5px; }
.pie-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

/* Four components, four rows, each with its own status. On a narrow screen
   the table scrolls inside this box; it never widens the dialog. */
.pie-health .ag-table { display: block; overflow-x: auto; white-space: normal; }
.pie-health .ag-table thead, .pie-health .ag-table tbody { display: table; width: 100%; }
.pie-detail { font-size: 11.5px; line-height: 1.5; }
.pie-detail > div { color: var(--muted); }

/* The probe's own words. Run through pieScrubDetail() first, because a driver
   error carries a socket path and a remote client must not learn the
   server's directory layout. */
.pie-probe-detail {
  margin-top: 3px; padding-left: 8px; border-left: 2px solid var(--line);
  color: var(--text-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px; overflow-wrap: anywhere;
}

.pie-sub { padding-top: 4px; border-top: 1px solid var(--line-soft); }
.pie-sub h4 { margin: 10px 0 10px; color: var(--ink); font-size: 12.5px; font-weight: 600; }

@media (max-width: 680px) {
  /* One tile per row rather than two half-legible ones, and a full-width
     action so the destructive one cannot be hit by aiming at the refresh. */
  .pie-section .ag-kv { grid-template-columns: minmax(0, 1fr); }
  .pie-actions { flex-direction: column; align-items: stretch; }
  .pie-actions .ag-open { justify-content: center; }
  .pie-chips { gap: 3px; }

  /* Four columns inside 280 pixels gives four unreadable ones, and the
     column that matters most - what the component's status MEANS - is the
     one that loses. Each component becomes a block instead: name and status
     on one line, then the explanation at full width. */
  .pie-health .ag-table, .pie-health .ag-table tbody,
  .pie-health .ag-table tr, .pie-health .ag-table td { display: block; width: auto; }
  .pie-health .ag-table thead { display: none; }
  .pie-health .ag-table tr {
    padding: 10px 0; border-bottom: 1px solid var(--line-soft);
  }
  .pie-health .ag-table tr:last-child { border-bottom: 0; }
  .pie-health .ag-table td { padding: 2px 0; border-bottom: 0; }
  .pie-health .ag-table td:first-child { color: var(--ink); font-weight: 600; }
  /* The probe duration keeps its own line but stops being right-aligned
     against nothing. */
  .pie-health .ag-table td.num { text-align: left; color: var(--muted); font-size: 11px; }
}

/* ---------- New task form: describe · repositories · rail (agent-task-form.js) ---------- */
/* Three columns that fit the dialog without scrolling. Each column scrolls
   only as a last resort, on a window too short for the dialog's own height. */
dialog.ag-nt { width: min(1160px, calc(100vw - 48px)); }
.ag-nt { --nt-acc-bg: color-mix(in srgb, var(--accent) 13%, transparent); --nt-acc-line: color-mix(in srgb, var(--accent) 45%, transparent); }
.ag-nt-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 340px; }
.ag-nt-col, .ag-nt-rail { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 16px 20px; overflow: auto; }
.ag-nt-col + .ag-nt-col, .ag-nt-rail { border-left: 1px solid var(--line); }
.ag-nt-rail { gap: 12px; background: var(--surface-sunken); }
.ag-nt-i { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.ag-nt-step { display: flex; align-items: center; gap: 10px; }
.ag-nt-n { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; color: var(--on-fixed); background: var(--positive); font-size: 12px; font-weight: 700; }
.ag-nt-step h3 { margin: 0; color: var(--ink); font-size: 15.5px; font-weight: 650; }
.ag-nt-step p { margin: 1px 0 0; color: var(--muted); font-size: 12px; }

#agentTaskPrompt { flex: 1 1 auto; min-height: 90px; width: 100%; resize: none; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface-sunken); font: inherit; font-size: 13.5px; line-height: 1.55; outline: none; }
#agentTaskPrompt:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--nt-acc-bg); }

.ag-nt-files { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ag-nt-files[hidden] { display: none; }
.ag-nt-file { display: flex; align-items: center; gap: 8px; min-width: 0; height: 32px; padding: 0 3px 0 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 12.5px; }
.ag-nt-ft { display: grid; place-items: center; flex: none; width: 24px; height: 22px; border-radius: 6px; color: var(--chip-ink); background: var(--chip); font-size: 9px; font-weight: 750; }
.ag-nt-ft[data-type="IMG"] { color: var(--ok-ink); background: var(--ok-bg); }
.ag-nt-ft[data-type="PDF"] { color: var(--bad-ink); background: var(--bad-bg); }
.ag-nt-ft[data-type="CSV"], .ag-nt-ft[data-type="XLS"] { color: var(--info-ink); background: var(--info-bg); }
.ag-nt-ft[data-type="{ }"], .ag-nt-ft[data-type="YML"] { color: var(--warn-ink); background: var(--warn-bg); }
.ag-nt-fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-strong); }
.ag-nt-file small { color: var(--muted); white-space: nowrap; }
.ag-nt-x { display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 7px; color: var(--muted); background: none; cursor: pointer; }
.ag-nt-x:hover { color: var(--ink); background: var(--hover); }
.ag-nt-drop { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 12px; transition: background .12s, border-color .12s; }
.ag-nt-drop.over { border-color: var(--accent); color: var(--accent); background: var(--nt-acc-bg); }
.ag-nt-link { padding: 0; border: 0; color: var(--accent); background: none; font: inherit; font-weight: 600; cursor: pointer; }
.ag-nt-aside { margin-left: auto; white-space: nowrap; }
.ag-nt .bad { color: var(--bad-ink); }
.ag-nt-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 12px; }
.ag-nt-checks li { display: inline-flex; align-items: center; gap: 6px; }
.ag-nt-checks li.ok { color: var(--ok-ink); }

.ag-nt-field { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--surface); }
.ag-nt-field[hidden] { display: none; }
.ag-nt-field input { flex: 1; min-width: 0; border: 0; outline: none; color: var(--text); background: none; font: inherit; font-size: 12.5px; }
.ag-nt-field:focus-within, .ag-nt-field.open { border-color: var(--accent); }
.ag-nt-combo input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.ag-nt-combo .chev { transition: transform .12s; }
.ag-nt-combo.open .chev { transform: rotate(180deg); }
.ag-nt-field.bad { border-color: var(--bad-ink); color: var(--bad-ink); }
.ag-nt-repos { display: flex; flex-direction: column; gap: 6px; }
.ag-nt-repo { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.ag-nt-repo:hover { background: var(--hover); }
.ag-nt-repo.on { border-color: var(--nt-acc-line); background: var(--nt-acc-bg); cursor: default; }
.ag-nt-box { display: grid; place-items: center; width: 18px; height: 18px; border: 1.5px solid var(--line); border-radius: 5px; color: var(--on-fixed); cursor: pointer; }
.ag-nt-repo.on .ag-nt-box { border-color: var(--accent); background: var(--accent); }
.ag-nt-box:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.ag-nt-box .ag-nt-i { width: 13px; height: 13px; stroke-width: 2.4; }
.ag-nt-name { overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ag-nt-status { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11px; white-space: nowrap; }
.ag-nt-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ag-nt-status.ready { color: var(--ok-ink); background: var(--ok-bg); }
.ag-nt-status.preparing { color: var(--warn-ink); background: var(--warn-bg); }
.ag-nt-sub { grid-column: 2 / 4; display: flex; align-items: center; gap: 8px; }
.ag-nt-sub { min-width: 0; }
.ag-nt-sub .ag-nt-field { flex: 1; min-width: 0; height: 30px; }
.ag-nt-sub .ag-nt-star { flex: none; }
.ag-nt-star { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 7px; border: 0; border-radius: 7px; color: var(--muted); background: none; font: inherit; font-size: 11.5px; cursor: pointer; }
.ag-nt-star:hover { color: var(--accent); }
.ag-nt-star.on { color: var(--accent); background: var(--nt-acc-bg); cursor: default; }
.ag-nt-more { margin: 2px 2px 0; color: var(--muted); font-size: 12px; }

.ag-nt-branches { position: absolute; z-index: 20; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--menu-bg); box-shadow: var(--modal-shadow); backdrop-filter: blur(8px); }
.ag-nt-branches[hidden] { display: none; }
.ag-nt-bgrp { margin: 0; padding: 7px 10px 3px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.ag-nt-bopt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px; border: 0; border-radius: 7px; color: var(--muted); background: none; text-align: left; cursor: pointer; }
.ag-nt-bopt.is-act, .ag-nt-bopt:hover { background: var(--hover); }
.ag-nt-bopt .bn { overflow: hidden; color: var(--text); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ag-nt-bopt mark { color: var(--accent); background: none; font-weight: 700; }
.ag-nt-bopt .def { padding: 1px 6px; border-radius: 5px; color: var(--ok-ink); background: var(--ok-bg); font-size: 11px; }
.ag-nt-bopt .age { margin-left: auto; font-size: 11px; white-space: nowrap; }
.ag-nt-bhint, .ag-nt-bnone { margin: 0; padding: 7px 10px; color: var(--muted); font-size: 12px; }
.ag-nt-bnone b { color: var(--bad-ink); font-weight: 600; }

.ag-nt-lbl { display: flex; align-items: center; gap: 7px; margin: 0 0 7px; color: var(--text-soft); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.ag-nt-lbl span { margin-left: auto; color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; }
.ag-nt-seg { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--segment-bg); }
.ag-nt-seg.wrap { flex-wrap: wrap; }
.ag-nt-seg button { display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px; border: 0; border-radius: 8px; color: var(--muted); background: none; font: inherit; font-size: 12.5px; white-space: nowrap; cursor: pointer; }
.ag-nt-seg button:hover { color: var(--text); }
.ag-nt-seg button[aria-pressed="true"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.ag-nt-seg button.acc[aria-pressed="true"] { color: var(--accent); background: var(--nt-acc-bg); box-shadow: inset 0 0 0 1px var(--nt-acc-line); }
.ag-nt-seg button.warn[aria-pressed="true"] { color: var(--warn-ink); background: var(--warn-bg); }
.ag-nt-help, .ag-nt-where { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.ag-nt-where b { color: var(--warn-ink); font-weight: 600; }
.ag-nt-pipe { display: flex; align-items: center; justify-content: space-between; margin: 0; padding: 0 4px 0 0; list-style: none; background: linear-gradient(var(--line), var(--line)) center / 100% 2px no-repeat; }
.ag-nt-pipe li { position: relative; display: grid; flex: none; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--surface); }
.ag-nt-pipe li.mode { border-color: color-mix(in srgb, var(--warn-ink) 55%, transparent); color: var(--warn-ink); background: var(--warn-bg); }
.ag-nt-pipe li.env { border-color: color-mix(in srgb, var(--info-ink) 55%, transparent); color: var(--info-ink); background: var(--info-bg); }
.ag-nt-pipe li.mode::after, .ag-nt-pipe li.env::after { content: ""; position: absolute; top: -5px; right: -5px; width: 12px; height: 12px; border: 2px solid var(--surface-sunken); border-radius: 50%; background: var(--warn-ink); }
.ag-nt-pipe li.env::after { background: var(--info-ink); }
.ag-nt-stepper { display: flex; align-items: center; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.ag-nt-stepper button { display: grid; place-items: center; width: 36px; height: 100%; border: 0; color: var(--muted); background: none; cursor: pointer; }
.ag-nt-stepper button:hover { color: var(--ink); }
.ag-nt-stepper input { flex: 1; min-width: 0; border: 0; outline: none; color: var(--ink); background: none; font: inherit; font-size: 14px; font-weight: 650; text-align: center; font-variant-numeric: tabular-nums; }
.ag-nt-quick { display: flex; gap: 5px; margin-top: 6px; }
.ag-nt-quick button { flex: 1; padding: 3px 0; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: none; font: inherit; font-size: 11.5px; cursor: pointer; }
.ag-nt-quick button[aria-pressed="true"] { color: var(--ink); background: var(--surface); }
.ag-nt-est-wrap { margin-top: auto; }
.ag-nt-est { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ag-nt-est div { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); white-space: nowrap; }
.ag-nt-est span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; }
.ag-nt-est b { display: block; margin-top: 2px; color: var(--ink); font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ag-nt-est .warn b { color: var(--warn-ink); }
.ag-nt-note { margin: 7px 0 0; color: var(--warn-ink); font-size: 11.5px; line-height: 1.4; }
/* "No limit": a fifth budget chip, an amber field, and a note on what still stops the run. */
.ag-nt-quick button.nl { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex: 1.7; white-space: nowrap; }
.ag-nt-quick button.nl .ag-nt-i { width: 14px; height: 14px; }
.ag-nt-stepper.is-unlimited { border-color: color-mix(in srgb, var(--warn-ink) 45%, var(--line)); }
.ag-nt-stepper.is-unlimited input { color: var(--warn-ink); }
.ag-nt-note.warn { display: flex; gap: 7px; margin-top: 8px; padding: 7px 9px; border: 1px solid color-mix(in srgb, var(--warn-ink) 40%, var(--line)); border-radius: 9px;
  background: color-mix(in srgb, var(--warn-bg) 60%, transparent); line-height: 1.45; }
.ag-nt-note.warn .ag-nt-i { width: 14px; height: 14px; margin-top: 1px; }

@media (max-width: 980px) {
  .ag-nt-body { grid-template-columns: minmax(0, 1fr); overflow: auto; }
  .ag-nt-col, .ag-nt-rail { overflow: visible; }
  .ag-nt-col + .ag-nt-col, .ag-nt-rail { border-left: 0; border-top: 1px solid var(--line); }
  #agentTaskPrompt { min-height: 140px; }
}

/* ---------- Projects dialog: cards → workspace (agent-projects.js) ---------- */
.agp { --agp-acc-bg: color-mix(in srgb, var(--accent) 13%, transparent); --agp-acc-line: color-mix(in srgb, var(--accent) 45%, transparent); }
.agp .wd-head-actions { display: flex; align-items: center; gap: 10px; }
.agp-body { position: relative; display: flex; flex: 1 1 auto; min-height: 0; padding: 0; overflow: hidden; }
#agentProjectsBody { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 0; }
.agp-i { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.agp-mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.agp-muted { color: var(--muted); font-size: 12px; }
.agp-grow { flex: 1; }

.agp-field { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--surface-sunken); }
.agp-field input, .agp-field select { flex: 1; min-width: 0; border: 0; outline: none; color: var(--text); background: none; font: inherit; font-size: 13px; }
.agp-field:focus-within { border-color: var(--accent); }
.agp-field.grow { flex: 1; }
.agp-filter { width: 240px; }
.agp-filter[hidden] { display: none; }
.agp-ib { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; color: var(--muted); background: none; cursor: pointer; }
.agp-ib:hover { color: var(--ink); background: var(--hover); }
.agp-ib:disabled { opacity: .35; cursor: not-allowed; background: none; }
.agp-btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--surface); font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; }
.agp-btn:hover { background: var(--hover); }
.agp-btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.agp-btn.pri { border-color: var(--accent); color: var(--on-fixed); background: var(--accent); font-weight: 600; }
.agp-btn.pri:hover { filter: brightness(1.06); }
.agp-btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.agp-btn.danger { color: var(--bad-ink); }
.agp-btn.danger.armed { border-color: color-mix(in srgb, var(--bad-ink) 50%, transparent); background: var(--bad-bg); }
.agp-btn:disabled { opacity: .45; cursor: not-allowed; }
.agp-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; color: var(--neutral-ink); background: var(--neutral-bg); font-size: 11px; font-weight: 550; white-space: nowrap; }
.agp-pill .agp-i { width: 12px; height: 12px; }
.agp-pill.t-ok { color: var(--ok-ink); background: var(--ok-bg); }
.agp-pill.t-warn { color: var(--warn-ink); background: var(--warn-bg); }
.agp-pill.t-info { color: var(--info-ink); background: var(--info-bg); }
.agp-pill.t-bad { color: var(--bad-ink); background: var(--bad-bg); }

/* cards */
.agp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: min-content; align-content: start; gap: 12px; padding: 18px 22px; overflow: auto; }
.agp-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; }
.agp-card:hover { border-color: var(--agp-acc-line); }
.agp-card:focus-visible { border-color: var(--agp-acc-line); outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.agp-card-top { display: flex; align-items: center; gap: 10px; }
.agp-av { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 9px; color: var(--muted); background: var(--chip); }
.agp-card-name { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.agp-card-name b { overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.agp-card-name span { overflow: hidden; color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.agp-track { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: 10px; color: var(--text-soft); font-size: 12px; }
.agp-track > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.agp-bar { display: flex; gap: 3px; }
.agp-bar i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.agp-bar[data-tone="ok"] i.on { background: var(--ok-ink); }
.agp-bar[data-tone="info"] i.on { background: var(--info-ink); }
.agp-bar[data-tone="warn"] i.on { background: var(--warn-ink); }
.agp-bar[data-tone="bad"] i.on { background: var(--bad-ink); }
.agp-card-note { margin: 0; color: var(--warn-ink); font-size: 11.5px; }
.agp-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.agp-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 6px; color: var(--chip-ink); background: var(--chip); font-size: 11px; }
.agp-chip .agp-i { width: 12px; height: 12px; }
.agp-connect { border-style: dashed; cursor: default; }
.agp-connect:hover { border-color: var(--agp-acc-line); }
.agp-connect-cta { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-height: 150px; padding: 8px; border: 0; color: var(--muted); background: none; font: inherit; text-align: center; cursor: pointer; }
.agp-connect-cta b { color: var(--ink); }
.agp-connect-cta span:last-child { font-size: 12px; }
.agp-plus { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--accent); background: var(--agp-acc-bg); }
.agp-connect-form { display: flex; flex-direction: column; gap: 9px; }
.agp-connect-form[hidden] { display: none; }
.agp-connect-form label, .agp-drawer label, .agp-addvar label { display: flex; flex-direction: column; gap: 5px; color: var(--text-soft); font-size: 12px; font-weight: 550; }
.agp-connect-actions { display: flex; justify-content: flex-end; gap: 8px; }
.agp-connect-msg { margin: 0; color: var(--muted); font-size: 12px; }
.agp-connect-msg:empty { display: none; }
.agp-connect-msg.is-bad { color: var(--bad-ink); }
.agp-empty { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 22px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 12.5px; text-align: center; }
.agp-empty b { color: var(--ink); font-size: 13.5px; }
.agp-empty.wide { grid-column: 1 / -1; }

/* workspace */
.agp-ws { display: flex; flex: 1; min-height: 0; }
.agp-side { display: flex; flex-direction: column; gap: 2px; width: 230px; flex: none; padding: 14px 10px; border-right: 1px solid var(--line); background: var(--surface-sunken); }
.agp-side > .agp-btn { align-self: flex-start; margin: 0 4px 10px; }
.agp-navlist { display: flex; flex: 1; flex-direction: column; gap: 2px; min-height: 0; overflow: auto; }
.agp-nav { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; color: var(--text-soft); background: none; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.agp-nav:hover { background: var(--hover); }
.agp-nav[aria-current="true"] { color: var(--accent); background: var(--agp-acc-bg); }
.agp-nav.sub { padding: 5px 10px 5px 34px; font-size: 12.5px; }
.agp-count { margin-left: auto; color: var(--muted); font-size: 11px; }
.agp-subnav { display: flex; flex-direction: column; gap: 1px; }
.agp-switch { display: flex; flex-direction: column; gap: 6px; padding: 10px 4px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; }
.agp-main { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.agp-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px 12px; border-bottom: 1px solid var(--line); }
.agp-head-name { display: flex; flex-direction: column; min-width: 0; }
.agp-head-name h3 { margin: 0; color: var(--ink); font-size: 16px; }
.agp-head-name span { overflow: hidden; color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.agp-head-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.agp-pane { display: flex; flex: 1; flex-direction: column; gap: 14px; min-height: 0; padding: 16px 20px; overflow: auto; }
.agp-pane > .ag-section { padding: 0; }
.agp-block { padding-top: 12px; border-top: 1px solid var(--line); }
.agp-lbl { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--text-soft); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.agp-lbl span { margin-left: auto; color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; }
.agp-lbl .agp-btn { margin-left: 10px; letter-spacing: 0; text-transform: none; }
.agp-row { display: flex; gap: 8px; }
.agp-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.agp-tbl th { padding: 0 10px 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .05em; text-align: left; text-transform: uppercase; }
.agp-tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); color: var(--text); vertical-align: middle; }
.agp-tbl tr:last-child td { border-bottom: 0; }
.agp-tbl td b { color: var(--ink); }
.agp-sub { display: flex; align-items: center; gap: 5px; margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.agp-sub .agp-i { width: 13px; height: 13px; }
.agp-acts { text-align: right; white-space: nowrap; }
.agp-callout { display: flex; align-items: flex-start; gap: 9px; margin: auto 0 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--info-ink) 30%, transparent); border-radius: 10px; color: var(--info-ink); background: var(--info-bg); font-size: 12.5px; }
.agp-val { display: flex; align-items: center; gap: 6px; }
.agp-val input { width: 100%; height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; outline: none; color: var(--text); background: var(--surface-sunken); font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.agp-val input:focus { border-color: var(--accent); }
.agp-pager { display: flex; align-items: center; justify-content: flex-end; gap: 6px; color: var(--muted); font-size: 12px; }
.agp-addvar { display: grid; grid-template-columns: 1fr 1.6fr auto; align-items: end; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.agp-pane[data-know="service"] .pie-retrieval { display: none; }
.agp-pane[data-know="retrieval"] .pie-section > :not(.ag-section-head) > :not(.pie-retrieval) { display: none; }
.agp-know .piex-stack > [data-piex-panel] { display: none; }
.agp-know[data-show="readiness"] [data-piex-panel="readiness"], .agp-know[data-show="health"] [data-piex-panel="health"],
.agp-know[data-show="coverage"] [data-piex-panel="coverage"], .agp-know[data-show="edges"] [data-piex-panel="edges"],
.agp-know[data-show="inventory"] [data-piex-panel="inventory"], .agp-know[data-show="documents"] [data-piex-panel="documents"],
.agp-know[data-show="rules"] [data-piex-panel="rules"], .agp-know[data-show="explorer"] [data-piex-panel="explorer"],
.agp-know[data-show="packets"] [data-piex-panel="packets"], .agp-know[data-show="candidates"] [data-piex-panel="candidates"],
.agp-know[data-show="stale"] [data-piex-panel="stale"], .agp-know[data-show="jobs"] [data-piex-panel="jobs"] { display: block; }

/* drawer, toast */
.agp-scrim { position: absolute; inset: 0; z-index: 30; background: rgba(10, 14, 20, .42); }
.agp-scrim[hidden], .agp-drawer[hidden], .agp-toast[hidden] { display: none; }
.agp-drawer { position: absolute; top: 0; right: 0; bottom: 0; z-index: 31; display: flex; flex-direction: column; width: min(440px, 92%); border-left: 1px solid var(--line); background: var(--surface); box-shadow: -20px 0 50px rgba(0, 0, 0, .25); animation: agp-in .16s ease; }
@keyframes agp-in { from { transform: translateX(24px); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .agp-drawer { animation: none; } }
.agp-drawer > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.agp-drawer > header h3 { margin: 0; color: var(--ink); font-size: 15px; }
.agp-drawer > header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.agp-dbody { display: flex; flex: 1; flex-direction: column; gap: 13px; min-height: 0; padding: 16px 18px; overflow: auto; color: var(--text); font-size: 13px; }
.agp-dbody p { margin: 0; }
.agp-dbody small { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.agp-drawer > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.agp-flabel { display: block; margin-bottom: 5px; color: var(--text-soft); font-size: 12px; font-weight: 550; }
.agp-kinds { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--segment-bg); }
.agp-kinds button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 4px; border: 0; border-radius: 8px; color: var(--muted); background: none; font: inherit; font-size: 12px; cursor: pointer; }
.agp-kinds button[aria-checked="true"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
/* minmax(0, …): a bare fr track never shrinks below its field's natural
   width, so in the 440px drawer Health path ran past the drawer's edge. */
.agp-two { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 10px; }
.agp-switchrow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.agp-switchrow b { display: block; color: var(--ink); font-size: 13px; }
.agp-toggle { position: relative; flex: none; width: 34px; height: 20px; padding: 0; border: 0; border-radius: 999px; background: var(--line); cursor: pointer; }
.agp-toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; }
.agp-toggle[aria-checked="true"] { background: var(--accent); }
.agp-toggle[aria-checked="true"]::after { left: 17px; }
.agp-err { margin: 0; color: var(--bad-ink); font-size: 12px; }
.agp-err:empty { display: none; }
.agp-grp { margin: 4px 0 0; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.agp-chk { display: grid !important; grid-template-columns: 18px 140px minmax(0, 1fr) auto; align-items: center; gap: 10px !important; font-weight: 400 !important; }
.agp-chk.dim { opacity: .5; }
.agp-chk input { accent-color: var(--accent); }
.agp-chk .ok { color: var(--ok-ink); }
.agp-legend { display: flex; align-items: flex-start; gap: 10px; color: var(--text-soft); font-size: 12px; }
.agp-toast { position: absolute; left: 50%; bottom: 16px; z-index: 40; max-width: 80%; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--menu-bg); box-shadow: var(--card-shadow); font-size: 13px; transform: translateX(-50%); }
.agp-toast.is-bad { border-color: color-mix(in srgb, var(--bad-ink) 50%, transparent); color: var(--bad-ink); }

@media (max-width: 980px) {
  .agp-grid { grid-template-columns: minmax(0, 1fr); }
  .agp-ws { flex-direction: column; }
  .agp-side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .agp-filter { width: 150px; }
}


/* ---------- Agents page: status bar · three lanes · bento (agent-overview.js) ---------- */
/* One screen: the status bar and the body share the view's height; only a
   lane's list scrolls, and only when it outgrows its column. */
.ag-ov { display: flex; flex-direction: column; gap: 14px; }
.ag-grow { flex: 1; }
.ag-status { --tone: var(--ok-ink); --tone-bg: var(--ok-bg); display: flex; flex: none; align-items: center; gap: 18px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(110deg, var(--tone-bg), var(--surface) 42%); box-shadow: var(--shadow); }
.ag-status[data-tone="red"] { --tone: var(--bad-ink); --tone-bg: var(--bad-bg); }
.ag-status[data-tone="blue"] { --tone: var(--info-ink); --tone-bg: var(--info-bg); }
.ag-status-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 5px var(--tone-bg); }
.ag-status[data-live="off"] .ag-status-dot, .ag-status[data-live="stale"] .ag-status-dot { background: var(--faint); box-shadow: 0 0 0 5px var(--chip); }
.ag-status-text { min-width: 0; }
.ag-status-text h2 { margin: 0; color: var(--ink); font-size: 21px; font-weight: 650; letter-spacing: -.02em; white-space: nowrap; }
.ag-status-text p { margin: 3px 0 0; overflow: hidden; color: var(--muted); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.ag-status-phases { display: flex; flex: 1; align-items: center; justify-content: center; min-width: 0; padding: 4px 8px; border: 0; border-radius: 12px; background: none; color: inherit; font: inherit; cursor: pointer; }
.ag-status-phases:hover { background: var(--hover); }
.ag-status-phases:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.ag-ph { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 56px; }
.ag-ph i { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 50%; color: var(--faint); background: var(--surface-sunken); font-size: 12px; font-style: normal; font-weight: 700; }
.ag-ph span { color: var(--faint); font-size: 11px; white-space: nowrap; }
.ag-ph.is-running i { border-color: var(--info-ink); color: var(--surface); background: var(--info-ink); }
.ag-ph.is-running span { color: var(--info-ink); }
.ag-ph.is-needs i { border-color: var(--bad-ink); color: var(--surface); background: var(--bad-ink); }
.ag-ph.is-needs span { color: var(--bad-ink); }
.ag-ph-link { flex: 1; max-width: 46px; height: 2px; margin-bottom: 17px; background: var(--line); }
.ag-status .pill { height: 42px; }
.ag-status .ag-new { padding: 0 18px; font-weight: 600; }

.ag-ov-body { display: grid; flex: 1; grid-template-columns: minmax(0, 1fr) clamp(380px, 33vw, 640px); gap: 16px; min-height: 0; }
.ag-ov-board { min-width: 0; min-height: 0; }
.ag-lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; height: 100%; min-height: 0; }
.ag-lane { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-sunken); }
.ag-lane-head { display: flex; flex: none; align-items: center; gap: 9px; padding: 0 2px 6px; color: var(--ink); font-size: 14px; }
.ag-lane-ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; }
.ag-lane-ico .ico { width: 15px; height: 15px; }
.ag-lane.is-needs .ag-lane-ico { color: var(--bad-ink); background: var(--bad-bg); }
.ag-lane.is-running .ag-lane-ico { color: var(--info-ink); background: var(--info-bg); }
.ag-lane.is-done .ag-lane-ico { color: var(--ok-ink); background: var(--ok-bg); }
.ag-lane-count { color: var(--faint); font-weight: 500; }
.ag-lane-body { display: flex; flex: 1; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; padding: 1px; scrollbar-width: thin; }
.ag-lane-empty { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 1px dashed var(--line); border-radius: 12px; color: var(--faint); font-size: 12.5px; }
.ag-lane-empty .ico { width: 16px; height: 16px; flex: none; }
.ag-lane-empty b { display: block; color: var(--text-soft); font-weight: 600; }

.ag-lc { display: flex; flex-direction: column; gap: 7px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: var(--surface); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, transform .15s; }
.ag-lc:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.ag-lc:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.ag-lc.is-needs { border-color: color-mix(in srgb, var(--bad-ink) 45%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--bad-ink) 8%, var(--surface)), var(--surface) 60%); }
.ag-lc h5 { margin: 0; color: var(--ink); font-size: 13.5px; font-weight: 650; line-height: 1.35; }
.ag-lc p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.ag-lc-top, .ag-lc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; row-gap: 7px; }
.ag-lc-foot { justify-content: space-between; }
.ag-lc-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; color: var(--neutral-ink); background: var(--neutral-bg); font-size: 11px; font-weight: 600; white-space: nowrap; }
.ag-lc-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ag-lc-pill.is-needs { color: var(--bad-ink); background: var(--bad-bg); }
.ag-lc-pill.is-running { color: var(--info-ink); background: var(--info-bg); }
.ag-lc-pill.is-done { color: var(--ok-ink); background: var(--ok-bg); }
.ag-lc-id { color: var(--faint); font-family: var(--mono, ui-monospace, monospace); font-size: 11px; }
.ag-lc-muted { color: var(--faint); font-size: 12px; }
.ag-lc-live { color: var(--ink); font-variant-numeric: tabular-nums; }
/* A step is often one long path with no spaces; it ran out of the card.
   Break it anywhere and stop at three lines — the whole step is the title. */
.ag-lc-step { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow-wrap: anywhere;
  font-family: var(--mono, ui-monospace, monospace); font-size: 11.5px !important; }
.ag-lc-segs { display: flex; gap: 3px; }
.ag-lc-segs i { flex: 1; height: 5px; border-radius: 3px; background: var(--track-solid); }
.ag-lc-segs.is-needs i.is-done, .ag-lc-segs.is-needs i.is-stop { background: var(--bad-ink); }
.ag-lc-segs.is-running i.is-done { background: var(--info-ink); }
.ag-lc-segs.is-running i.is-now { background: color-mix(in srgb, var(--info-ink) 55%, transparent); }
.ag-lc-tags { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.ag-lc-tag { padding: 2px 7px; border-radius: 6px; color: var(--chip-ink); background: var(--chip); font-size: 11px; white-space: nowrap; }
.ag-lc-act { margin-left: auto; padding: 5px 11px; border-radius: 8px; color: var(--surface); background: var(--ink); font-size: 12px; font-weight: 650; white-space: nowrap; }
.ag-lc-cost { display: inline-flex; align-items: center; gap: 5px; color: var(--ok-ink); }
.ag-lc-cost .ico { width: 14px; height: 14px; }

.ag-ov-bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(5, minmax(0, 1fr)); gap: 12px; min-width: 0; min-height: 0; }
.ag-bt { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; overflow: hidden; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); font: inherit; text-align: left; }
button.ag-bt { cursor: pointer; transition: border-color .15s, transform .15s; }
button.ag-bt:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.ag-bt:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.ag-bt.is-spend { grid-column: 1 / -1; grid-row: 1; }
.ag-bt.is-board { grid-column: 1 / span 2; grid-row: 2 / span 2; }
.ag-bt.is-limits { grid-column: 3 / span 2; grid-row: 2; }
.ag-bt.is-projects { grid-column: 3 / span 2; grid-row: 3; }
.ag-bt.is-commits { grid-column: 1 / -1; grid-row: 4 / span 2; gap: 10px; }
.ag-bt-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ag-bt-ico { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 10px; color: var(--muted); background: var(--chip); }
.ag-bt-ico .ico { width: 16px; height: 16px; }
.ag-bt.is-spend .ag-bt-ico { color: var(--warn-ink); background: var(--warn-bg); }
.ag-bt.is-board .ag-bt-ico { color: var(--info-ink); background: var(--info-bg); }
/* The Projects card: the same violet gradient in both themes, so its text is white in both. */
.ag-bt.ag-pj { position: relative; isolation: isolate; display: block; padding: 0; border: 0; color: #fff; background: linear-gradient(180deg, #d4aaff 0%, #ab80ec 36%, #7a4fc8 68%, #55299b 100%); box-shadow: 0 10px 30px -14px rgba(90, 46, 160, .7); }
.ag-pj-art { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.ag-pj-deco { position: absolute; inset: 0; width: 100%; height: 100%; }
.ag-pj-deco line, .ag-pj-deco circle { fill: none; stroke: rgba(255, 255, 255, .26); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ag-pj-deco circle.is-inner { stroke: rgba(255, 255, 255, .2); }
.ag-pj-deco circle.is-ripple { display: none; stroke: rgba(255, 255, 255, .6); transform-box: fill-box; transform-origin: center; animation: ag-pj-ripple 9s cubic-bezier(.25, .6, .35, 1) infinite; opacity: 0; }
.ag-pj-deco circle.is-ripple:nth-of-type(4) { animation-delay: -3s; }
.ag-pj-deco circle.is-ripple:nth-of-type(5) { animation-delay: -6s; }
@keyframes ag-pj-ripple { 0% { opacity: 0; transform: scale(.35); } 15% { opacity: .8; } 100% { opacity: 0; transform: scale(1.9); } }
@media (prefers-reduced-motion: no-preference) {
  .ag-pj-deco circle.is-ring { display: none; }
  .ag-pj-deco circle.is-ripple { display: inline; }
}
.ag-pj-word { position: absolute; top: 14px; left: 18px; max-width: 52%; overflow: hidden; color: #fff; font-size: 21px; font-style: italic; font-synthesis: style; font-weight: 800; letter-spacing: -.035em; line-height: 1.05; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 10px rgba(80, 30, 160, .35); }
.ag-pj-chip { position: absolute; top: 14px; right: 16px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid rgba(255, 255, 255, .34); border-radius: 999px; color: #fff; background: rgba(74, 38, 150, .32); font-size: 11px; font-weight: 600; white-space: nowrap; }
.ag-pj-chip i { width: 6px; height: 6px; border-radius: 50%; background: #7dffb0; }
.ag-pj-chip i.is-busy { background: #ffd27a; }
.ag-pj-fig { position: absolute; bottom: 16px; left: 18px; display: flex; flex-direction: column; gap: 4px; max-width: 46%; }
.ag-pj-num { color: #fff; font-size: 50px; font-variant-numeric: tabular-nums; font-weight: 500; letter-spacing: -.03em; line-height: .9; }
.ag-pj-label { overflow: hidden; color: rgba(255, 255, 255, .92); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.ag-pj-pill { position: absolute; right: 16px; bottom: 16px; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; color: #4a2696; background: #fff; font-size: 12.5px; font-weight: 550; white-space: nowrap; box-shadow: 0 6px 16px -8px rgba(40, 10, 90, .6); transition: gap .2s; }
button.ag-pj:hover .ag-pj-pill { gap: 11px; }
@media (prefers-reduced-motion: reduce) {
  .ag-pj-pill { transition: none; }
}
.ag-bt.is-limits .ag-bt-ico, .ag-bt.is-commits .ag-bt-ico { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.ag-bt-names { min-width: 0; }
.ag-bt-names h4 { margin: 0; color: var(--ink); font-size: 14px; font-weight: 650; }
.ag-bt-names p { margin: 1px 0 0; overflow: hidden; color: var(--faint); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.ag-bt-go { flex: none; color: var(--faint); font-size: 14px; }
button.ag-bt:hover .ag-bt-go { color: var(--ink); }
.ag-bt-tg { display: inline-flex; flex: none; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-sunken); }
.ag-bt-tg button { padding: 2px 8px; border: 0; border-radius: 6px; color: var(--faint); background: none; font: inherit; font-size: 11px; cursor: pointer; }
.ag-bt-tg button[aria-pressed="true"] { color: var(--ink); background: var(--surface); }
.ag-bt-fig { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.ag-bt-fig.is-end { margin-top: auto; }
.ag-bt-big { color: var(--ink); font-size: 30px; font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.ag-bt-big.is-xl { font-size: 32px; }
.ag-bt-sub { color: var(--muted); font-size: 12px; }
/* Spend: a wide, short card — the figure on the left, the chart beside it at
   the card's full height. Stacked, the chart's baseline and axis were cut off. */
.ag-bt.is-spend { display: grid; grid-template-columns: minmax(210px, 36%) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 6px 18px; }
.ag-sp-left { display: flex; flex-direction: column; gap: 8px; grid-row: 1 / span 2; min-width: 0; }
.ag-sp-left .ag-bt-fig { flex-direction: column; align-items: flex-start; gap: 4px; margin-top: auto; }
.ag-sp-tools { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.ag-sp-plot { display: flex; flex-direction: column; gap: 3px; min-height: 0; }
.ag-bt-chart { position: relative; flex: 1 1 auto; min-height: 0; }
.ag-bt-chart svg { display: block; width: 100%; height: 100%; overflow: hidden; }
.ag-bt-chart rect { fill: color-mix(in srgb, var(--warn-ink) 45%, transparent); }
.ag-bt-chart rect.is-today { fill: var(--warn-ink); }
.ag-sp-line { fill: none; stroke: var(--warn-ink); stroke-width: 2.2; stroke-linecap: round; }
/* Today's dot: a real circle over the stretched chart, so it stays round. */
.ag-sp-pt { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border: 2px solid var(--surface); border-radius: 50%;
  background: var(--warn-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn-ink) 22%, transparent); pointer-events: none; }
.ag-stop-a { stop-color: var(--warn-ink); stop-opacity: .3; }
.ag-stop-b { stop-color: var(--warn-ink); stop-opacity: 0; }
.ag-bt-axis { display: flex; flex: none; justify-content: space-between; color: var(--faint); font-size: 10.5px; }
@media (max-width: 560px) {
  .ag-bt.is-spend { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(90px, 1fr); }
  .ag-sp-left { grid-row: auto; }
}
.ag-bt-phases { display: flex; flex: 1; align-items: flex-end; gap: 4px; min-height: 40px; }
.ag-bt-phases div { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; min-width: 0; }
.ag-bt-phases i { width: 100%; border-radius: 4px 4px 2px 2px; background: var(--track-solid); }
.ag-bt-phases i.is-running { background: var(--info-ink); }
.ag-bt-phases i.is-needs { background: var(--bad-ink); }
.ag-bt-phases span { color: var(--faint); font-size: 9.5px; }
.ag-lim-chip { flex: none; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; white-space: nowrap; }
.ag-lim-chip.is-ok { color: var(--ok-ink); background: var(--ok-bg); }
.ag-lim-chip.is-warn { color: var(--warn-ink); background: var(--warn-bg); }
.ag-lim-chip.is-bad { color: var(--bad-ink); background: var(--bad-bg); }
/* Limits: the ring at the card's full height on the left (it stands in for
   the icon), title, chip and legend beside it. Under a full-width head it
   shrank to ~62px and "free now" ran into the inner ring. */
.ag-lim { display: flex; flex: 1; align-items: center; gap: 12px; min-height: 0; }
.ag-lim-dual { position: relative; flex: none; height: min(100%, 94px); aspect-ratio: 1; }
.ag-lim-dual svg { display: block; width: 100%; height: 100%; overflow: visible; transform: rotate(-90deg); }
.ag-lim-track { fill: none; stroke: var(--track-solid); stroke-width: 7; }
.ag-lim-arc { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; }
.ag-lim-arc.is-warn { stroke: var(--warn-ink); }
.ag-lim-arc.is-bad { stroke: var(--bad-ink); }
/* The week (outer ring) in a lighter shade of its tone, so the two rings read apart. */
.ag-lim-arc.is-week { stroke: color-mix(in srgb, var(--accent) 52%, var(--surface)); }
.ag-lim-arc.is-week.is-warn { stroke: color-mix(in srgb, var(--warn-ink) 52%, var(--surface)); }
.ag-lim-arc.is-week.is-bad { stroke: color-mix(in srgb, var(--bad-ink) 52%, var(--surface)); }
.ag-lim-ctr { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ag-lim-ctr b { color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ag-lim-ctr small { color: var(--faint); font-size: 9.5px; line-height: 1.2; }
.ag-lim-side { display: flex; flex-direction: column; flex: 1; gap: 8px; min-width: 0; }
.ag-lim-side .ag-bt-head { gap: 8px; }
.ag-lim-leg { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ag-lim-leg div { display: grid; grid-template-columns: 10px minmax(0, 1fr); align-items: center; gap: 2px 8px; }
/* A filled dot for the last 5 hours (inner ring), an outlined one for the week (outer ring). */
.ag-lim-leg i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.ag-lim-leg i.is-warn { background: var(--warn-ink); }
.ag-lim-leg i.is-bad { background: var(--bad-ink); }
.ag-lim-leg i.is-week { border: 2.5px solid color-mix(in srgb, var(--accent) 52%, var(--surface)); background: none; }
.ag-lim-leg i.is-week.is-warn { border-color: color-mix(in srgb, var(--warn-ink) 52%, var(--surface)); }
.ag-lim-leg i.is-week.is-bad { border-color: color-mix(in srgb, var(--bad-ink) 52%, var(--surface)); }
.ag-lim-leg b { overflow: hidden; color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.ag-lim-leg span { grid-column: 2; overflow: hidden; color: var(--faint); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
/* Limits unknown: Anthropic's figure could not be read. Deliberately grey and
   dashed rather than green — a reassuring badge over an unknown is the bug
   this tile had. */
.ag-lim-chip.is-unknown { color: var(--faint); background: var(--track-solid); }
.ag-lim-arc.is-unknown { stroke: var(--track-solid); }
.ag-lim-leg i.is-unknown { background: var(--track-solid); }
.ag-lim-leg i.is-week.is-unknown { border-color: var(--track-solid); background: none; }
/* Agent wall-clock hours: real, useful, and explicitly not a quota. */
.ag-lim-agent { margin-top: 2px; padding-top: 6px; border-top: 1px solid var(--track-solid); }
.ag-lim-agent span { grid-column: 1 / -1; color: var(--faint); font-size: 11px; }
.ag-lim-stale span { grid-column: 1 / -1; color: var(--warn-ink); font-size: 10.5px; }
/* The Commits skyline (agent-overview.js commitsTile). */
.ag-sky-empty { display: grid; flex: 1; place-items: center; padding: 16px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); font-size: 12.5px; text-align: center; }
.ag-sky-none { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12.5px; pointer-events: none; }
.ag-sky-warn { flex: none; padding: 3px 9px; border-radius: 999px; color: var(--warn-ink); background: var(--warn-bg); font-size: 11px; cursor: help; }
.ag-sky-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ag-sky-stats div { min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-sunken); }
.ag-sky-stats span { display: block; overflow: hidden; color: var(--faint); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.ag-sky-stats b { display: block; overflow: hidden; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.ag-sky-stats b small { color: var(--muted); font-size: 11px; font-weight: 500; }

.ag-sky-stage { position: relative; flex: 1; min-height: 0; border-radius: 12px; cursor: grab; touch-action: none; }
.ag-sky-stage.is-dragging { cursor: grabbing; }
.ag-sky-stage svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ag-sky-stage svg:focus { outline: none; }
.ag-sky-stage:focus-within { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.ag-sky-hint { position: absolute; top: 0; right: 2px; color: var(--faint); font-size: 10.5px; pointer-events: none; }

/* Faces. --c is the base colour; sides are the same colour in shade. */
.ag-sky-stage polygon { stroke: none; }
.ag-sky-stage .f-top { fill: var(--c); }
.ag-sky-stage .f-l { fill: color-mix(in srgb, var(--c) 78%, #000); }
.ag-sky-stage .f-r { fill: color-mix(in srgb, var(--c) 62%, #000); }
.ag-sky-stage .is-empty { --c: var(--track-solid); }
.ag-sky-stage .l1 { --c: color-mix(in srgb, var(--accent) 38%, var(--surface)); }
.ag-sky-stage .l2 { --c: color-mix(in srgb, var(--accent) 58%, var(--surface)); }
.ag-sky-stage .l3 { --c: color-mix(in srgb, var(--accent) 80%, var(--surface)); }
.ag-sky-stage .l4 { --c: var(--accent); }
.ag-sky-stage .p0, .ag-sky-leg .p0 { --c: #8b7cf6; }
.ag-sky-stage .p1, .ag-sky-leg .p1 { --c: #2bb3a3; }
.ag-sky-stage .p2, .ag-sky-leg .p2 { --c: #e0a243; }
.ag-sky-stage .p3, .ag-sky-leg .p3 { --c: #e06c9f; }
.ag-sky-stage .p4, .ag-sky-leg .p4 { --c: #4f97e8; }
.ag-sky-stage .p5, .ag-sky-leg .p5 { --c: #7fb64f; }
.ag-sky-stage g.is-cur .f-top { stroke: var(--ink); stroke-width: 1.4px; vector-effect: non-scaling-stroke; }
.ag-sky-stage .is-today .f-top { stroke: var(--ink); stroke-width: 1px; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.ag-sky-stage text { fill: var(--faint); font-size: 10.5px; }

.ag-sky-tip { position: absolute; z-index: 3; min-width: 168px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); background: var(--menu-bg, var(--surface)); box-shadow: var(--shadow); font-size: 11.5px; pointer-events: none; transform: translate(-50%, calc(-100% - 10px)); }
.ag-sky-tip[hidden] { display: none; }
.ag-sky-tip b { display: block; white-space: nowrap; margin-bottom: 4px; color: var(--ink); font-size: 12px; }
.ag-sky-tip div { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.ag-sky-tip i, .ag-sky-leg i { width: 8px; height: 8px; border-radius: 3px; background: var(--c); }
.ag-sky-tip span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.ag-sky-tip em { color: var(--ink); font-style: normal; font-variant-numeric: tabular-nums; }

.ag-sky-leg { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.ag-sky-leg button { display: inline-flex; flex: 0 1 auto; align-items: center; gap: 6px; min-width: 0; padding: 3px 9px 3px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: transparent; font: inherit; font-size: 11px; cursor: pointer; }
.ag-sky-leg button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-sky-leg button em { color: var(--faint); font-style: normal; font-variant-numeric: tabular-nums; }
.ag-sky-leg button:hover, .ag-sky-leg button[aria-pressed="true"] { border-color: var(--line-strong); color: var(--ink); background: var(--surface-sunken); }
.ag-sky-leg button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.ag-sky-leg .ag-sky-scale { display: inline-flex; flex: none; align-items: center; gap: 3px; margin-left: auto; color: var(--faint); font-size: 10.5px; }
.ag-sky-leg .ag-sky-scale[hidden] { display: none; }
.ag-sky-scale i { width: 9px; height: 9px; }
.ag-sky-scale .l0 { --c: var(--track-solid); }
.ag-sky-scale .l1 { --c: color-mix(in srgb, var(--accent) 38%, var(--surface)); }
.ag-sky-scale .l2 { --c: color-mix(in srgb, var(--accent) 58%, var(--surface)); }
.ag-sky-scale .l3 { --c: color-mix(in srgb, var(--accent) 80%, var(--surface)); }
.ag-sky-scale .l4 { --c: var(--accent); }

@media (max-width: 1280px) {
  .ag-status-phases .ag-ph span { display: none; }
  .ag-ph { min-width: 30px; }
  .ag-ov-body { grid-template-columns: minmax(0, 1fr) 360px; }
  .ag-ov-bento { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; grid-auto-rows: minmax(0, 1fr); overflow-y: auto; }
  .ag-bt.is-spend, .ag-bt.is-board, .ag-bt.is-limits, .ag-bt.is-projects, .ag-bt.is-commits { grid-column: auto; grid-row: auto; min-height: 120px; }
  .ag-bt.is-spend { grid-column: 1 / -1; min-height: 220px; }
  .ag-bt.is-commits { grid-column: 1 / -1; min-height: 360px; }
}
@media (max-width: 1040px) {
  .ag-ov-body { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .ag-lanes { height: auto; }
  .ag-lane-body { max-height: 420px; }
  .ag-status { flex-wrap: wrap; }
  .ag-status-phases { order: 3; flex-basis: 100%; }
}
@media (max-width: 760px) {
  .ag-lanes { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   PIE EXPLORER, CITATIONS AND REVIEW (phase 10b)

   The project knowledge view, the citation drawer and candidate review.

   Everything here is built on the existing tokens and on .ag-section /
   .ag-kv / .ag-table / .ag-badge / .ag-open, so a theme change reaches it
   and a reader meets no new vocabulary. The classes are prefixed `piex-`
   rather than `pie-` because phase 10a already owns `pie-` in this file and
   two agents sharing one stylesheet should not share one namespace.

   TWO THINGS HERE ARE ACCEPTANCE CRITERIA, NOT POLISH.

   1. FOCUS IS VISIBLE ON EVERY CONTROL. `.ag-open` ships without a
      :focus-visible rule and the browser default outline is invisible
      against --surface in the dark theme, so every button, textarea and
      scrollable region this section adds gets one explicitly.

   2. AN UNVERIFIED CITATION LOOKS DIFFERENT FROM A VERIFIED ONE. The dashed
      border and the warn-tinted rail on `.piex-cite.is-unverified` are the
      whole point: the compiler distinguishes a content-hash match from a
      symbol match, and that distinction is the reader's only defence
      against a stale citation. It must survive the stylesheet.

   It all works at 320px: the drawer becomes the full viewport, the badge row
   and the action rows wrap, and every table scrolls inside its own box
   rather than widening the dialog and giving the page a horizontal
   scrollbar.
   ========================================================================== */

.piex-section { display: flex; flex-direction: column; gap: 10px; }
.piex-section > .ag-section-head { flex-wrap: wrap; gap: 8px; }

/* Both tracks beside the section heading, so the two questions are answered
   in the same glance. They wrap rather than squeezing the heading. */
.piex-track-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: flex-start; }

.piex-toggle { align-self: flex-start; }
.piex-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.piex-body { display: block; }
.piex-body[hidden] { display: none; }
.piex-stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- a sub-panel ---------- */

.piex-panel {
  display: flex; flex-direction: column; gap: 9px;
  padding: 13px 14px; border: 1px solid var(--line-soft); border-radius: 13px;
  background: var(--surface-sunken);
}
.piex-panel-head { display: flex; flex-direction: column; gap: 3px; }
.piex-panel-head h4 { margin: 0; color: var(--ink); font-size: 13px; font-weight: 600; }
.piex-panel-head p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.piex-panel .ag-open { align-self: flex-start; }
.piex-panel .ag-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* A table never widens its container: it scrolls inside this box, which is
   what keeps a seven-column job history off a 320px page's horizontal
   scrollbar.

   The scroll lives on a WRAPPER, not on the table. Putting `display: block`
   on the table turns its thead and tbody into two independent tables that
   size their columns independently, and the headings then sit over the wrong
   columns — which is exactly what the first render of this panel did. */
.piex-scroll { max-width: 100%; overflow-x: auto; }
.piex-scroll > .ag-table { min-width: 100%; white-space: normal; }
.piex-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.piex-sub { display: flex; flex-direction: column; gap: 7px; padding-top: 9px; border-top: 1px solid var(--line-soft); }
.piex-sub h5 { margin: 0; color: var(--text-strong); font-size: 11.5px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; }

.piex-dim { color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.piex-detail { font-size: 11.5px; line-height: 1.5; overflow-wrap: anywhere; }

/* ---------- a labelled badge row ---------- */

.piex-badges { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.piex-badge-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.piex-badge-cell small {
  color: var(--faint); font-size: 9.5px; font-weight: 650;
  letter-spacing: .06em; text-transform: uppercase;
}
.piex-badge-cell .ag-badge { align-self: flex-start; max-width: 100%; white-space: normal; }

/* Shas, ids and hashes. Monospace and allowed to break, because a packet
   hash that overflows its box takes the layout with it. */
.piex-pins { gap: 10px 14px; }
.piex-pins > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.piex-pins small {
  color: var(--faint); font-size: 9.5px; font-weight: 650;
  letter-spacing: .06em; text-transform: uppercase;
}
.piex-pins strong { color: var(--ink); font-size: 11.5px; font-weight: 600; overflow-wrap: anywhere; }

/* ---------- a notice: a refusal or an absence, said plainly ---------- */

/* Deliberately NOT styled like a loading state. A panel with no data has to
   look like a statement, because an empty box that might still be filling
   is how a 403 gets mistaken for a slow network. */
.piex-notice {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px; border: 1px solid var(--line); border-left-width: 2px;
  border-radius: 10px; background: var(--surface);
  color: var(--text); font-size: 12px; line-height: 1.55;
}
.piex-notice strong { color: var(--ink); font-size: 12.5px; font-weight: 600; }
.piex-notice.is-warn { border-left-color: color-mix(in srgb, var(--warn-ink) 55%, transparent); background: var(--warn-bg); color: var(--warn-ink); }
.piex-notice.is-warn strong { color: var(--warn-ink); }
.piex-notice.is-bad { border-left-color: color-mix(in srgb, var(--bad-ink) 55%, transparent); background: var(--bad-bg); color: var(--bad-ink); }
.piex-notice.is-bad strong { color: var(--bad-ink); }
.piex-retryable { font-size: 11px; font-style: italic; opacity: .85; }

/* ---------- findings: warnings and unknowns are content ---------- */

.piex-findings { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.piex-finding {
  display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline;
  padding: 7px 10px; border-radius: 9px; border-left: 2px solid var(--line);
  background: var(--surface); font-size: 12px; line-height: 1.5;
}
.piex-finding-label {
  flex: 0 0 auto; color: var(--faint); font-size: 9.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
}
.piex-finding-text { min-width: 0; overflow-wrap: anywhere; }
/* Four silences, four rails. A thing looked for and not found is not the
   same as a capability this deployment does not have. */
.piex-finding.is-unknown { border-left-color: color-mix(in srgb, var(--info-ink) 55%, transparent); }
.piex-finding.is-warning { border-left-color: color-mix(in srgb, var(--warn-ink) 55%, transparent); }
.piex-finding.is-missing_capability { border-left-color: color-mix(in srgb, var(--bad-ink) 55%, transparent); }
.piex-finding.is-degraded { border-left-color: color-mix(in srgb, var(--warn-ink) 55%, transparent); }
.piex-finding.is-reason { border-left-color: color-mix(in srgb, var(--accent) 55%, transparent); }

/* ---------- conflicts and duplicates, which are different things ---------- */

.piex-group {
  display: flex; flex-direction: column; gap: 6px;
  padding: 9px 11px; border-radius: 10px; border-left: 2px solid var(--line);
  background: var(--surface);
}
.piex-group-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.piex-group-head .piex-dim { flex: 1 1 220px; min-width: 0; }
/* A contradiction needs a person; a duplicate does not. Phase 08 separated
   them on purpose (D-09), so they are never the same colour. */
.piex-group.is-contradiction { border-left-color: color-mix(in srgb, var(--bad-ink) 55%, transparent); }
.piex-group.is-duplicate { border-left-color: color-mix(in srgb, var(--info-ink) 55%, transparent); }
.piex-group.is-related { border-left-color: color-mix(in srgb, var(--line-strong) 55%, transparent); }
.piex-group.is-unclassified { border-left-color: color-mix(in srgb, var(--warn-ink) 55%, transparent); }

/* ---------- forms ---------- */

.piex-search-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.piex-search-form .ag-field { flex: 1 1 200px; min-width: 0; }
.piex-search-form .ag-open { flex: 0 0 auto; }
.piex-search-form .ag-field input:focus-visible,
.piex-panel textarea:focus-visible,
.piex-drawer textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.piex-search-results { display: block; }

.piex-form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.piex-form-actions .ag-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.piex-form-message { margin: 0; color: var(--text); font-size: 12px; line-height: 1.5; }
.piex-form-message:empty { display: none; }
.piex-form-message.is-bad { color: var(--bad-ink); }

.piex-open { white-space: nowrap; }
.piex-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- the drawer ---------- */

/* A native <dialog>, so showModal() supplies the focus trap, the Escape
   handler, the inert background and the focus restoration rather than this
   file reimplementing four accessibility behaviours by hand. */
.piex-drawer {
  width: min(680px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  margin: 0 0 0 auto; padding: 0;
  border: 0; border-left: 1px solid var(--line); border-radius: 0;
  background: var(--surface); color: var(--text);
  box-shadow: -18px 0 48px rgba(12, 16, 26, .18);
}
.piex-drawer::backdrop { background: rgba(12, 16, 26, .42); }
.piex-drawer[open] { display: flex; flex-direction: column; }

.piex-drawer-head {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--line-soft);
  background: var(--surface-raised);
}
.piex-drawer-head h3 { margin: 0; color: var(--ink); font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.piex-drawer-sub { margin: 3px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; overflow-wrap: anywhere; }
.piex-drawer-head > div { flex: 1 1 auto; min-width: 0; }

.piex-drawer-close {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.piex-drawer-close:hover { background: var(--hover); }
.piex-drawer-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.piex-drawer-close .ico { width: 15px; height: 15px; }

.piex-drawer-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 18px 24px; }
.piex-drawer-stack { display: flex; flex-direction: column; gap: 14px; }
.piex-drawer-top { display: flex; flex-direction: column; gap: 11px; }
.piex-drawer .ag-empty { min-height: 180px; }

/* ---------- a citation ---------- */

.piex-cite-list { display: flex; flex-direction: column; gap: 10px; }
.piex-cite {
  display: flex; flex-direction: column; gap: 7px;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface);
}

/* THE DISTINCTION THIS SECTION EXISTS FOR.

   A fact whose citation is not content-hash matched must not look like one
   that is. Dashed, warn-tinted and rail-marked: three signals, because
   colour alone fails for a reader who cannot see it and a border alone
   fails on a small screen. */
.piex-cite.is-unverified {
  border-style: dashed; border-color: var(--warn-ink);
  border-left-width: 3px; border-left-style: solid;
  background: color-mix(in srgb, var(--warn-bg) 55%, var(--surface));
}

.piex-cite-text { margin: 0; color: var(--text); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.piex-cite-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.piex-cite-where {
  margin: 0; color: var(--text-soft); font-size: 11px; line-height: 1.5;
  overflow-wrap: anywhere;
}
.piex-cite-why { margin: 0; color: var(--warn-ink); font-size: 11px; line-height: 1.5; }
.piex-cite-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* The cited lines themselves. Focusable, because a scrollable region a
   keyboard cannot reach is a region a keyboard reader cannot read. */
.piex-code {
  margin: 0; padding: 11px 13px; max-height: 420px; overflow: auto;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-sunken); color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; line-height: 1.6; tab-size: 2;
  white-space: pre; overflow-wrap: normal;
}
.piex-code:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.piex-claim {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font-size: 13px; line-height: 1.6;
}

/* ---------- the task room panel ---------- */

.piex-taskroom { gap: 12px; }
.piex-taskroom .piex-panel { background: var(--surface); }

/* ---------- narrow screens ---------- */

@media (max-width: 680px) {
  /* The drawer becomes the viewport. A 680px panel sliding over a 360px
     page is a panel with no page left beside it, so there is no point
     pretending it is a drawer. */
  .piex-drawer { width: 100vw; margin: 0; border-left: 0; }
  .piex-drawer-head { padding: 13px 14px 10px; }
  .piex-drawer-body { padding: 12px 14px 20px; }
  .piex-badges { gap: 9px 12px; }
  .piex-search-form { flex-direction: column; align-items: stretch; }
  .piex-search-form .ag-open { width: 100%; justify-content: center; }
  .piex-form-actions { flex-direction: column; align-items: stretch; }
  .piex-form-actions .ag-open { width: 100%; }
  .piex-cite-actions .piex-open { width: 100%; }
  .piex-panel { padding: 11px 11px; border-radius: 11px; }
  .piex-pins { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .piex-drawer { transition: none; animation: none; }
}

/* ---------- R11: the consolidated chain and coverage per source ----------

   THE CHAIN IS AN ORDERED LIST AND IS STYLED AS ONE. `list-style: none`
   removes the marker because each step paints its own number in
   `.piex-link-step`, which is inside the step's heading row and therefore
   stays beside the title when the row wraps — a native marker sits outside
   the item and separates from its heading the moment the text wraps to a
   second line.

   AN EMPTY STEP IS DRAWN AS A STATEMENT, NOT AS A GAP. `.piex-link.is-empty`
   keeps its border and its full padding: a step that collapsed to a thin line
   would read as "nothing here", which is the one reading this view exists to
   prevent. The tone classes tint the rail only, so "served and empty" (warn)
   and "never served" (bad) are distinguishable without relying on colour
   alone — the badge in the heading says which in words.

   EVERYTHING IS REACHABLE AND VISIBLE BY KEYBOARD. The provenance line and
   the long notes are plain text, but every table in a step scrolls inside
   `.piex-scroll`, which is focusable and gets the same explicit focus ring as
   the rest of this section, because a scrollable region a keyboard cannot
   reach is a region a keyboard reader cannot read. */

.piex-chain {
  display: flex; flex-direction: column; gap: 10px;
  margin: 0; padding: 0; list-style: none;
  /* Reset the UA's indent as well as the marker: a left padding of 40px
     costs a 320px screen an eighth of its width for nothing. */
}
.piex-chain-item { display: block; min-width: 0; }

.piex-link {
  display: flex; flex-direction: column; gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line-soft); border-left-width: 3px;
  border-radius: 11px; background: var(--surface);
  min-width: 0;
}
.piex-link.is-ok { border-left-color: color-mix(in srgb, var(--ok-ink) 55%, transparent); }
.piex-link.is-warn { border-left-color: color-mix(in srgb, var(--warn-ink) 55%, transparent); }
.piex-link.is-bad { border-left-color: color-mix(in srgb, var(--bad-ink) 55%, transparent); }
/* Deliberately NOT dimmed or collapsed. See the note above. */
.piex-link.is-empty { background: var(--surface-sunken); }

.piex-link-head { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-start; }

/* The step number. A fixed square so six of them line up down the left edge
   however long the titles are. */
.piex-link-step {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 6px;
  background: var(--surface-raised); border: 1px solid var(--line);
  color: var(--text-strong); font-size: 10.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.piex-link-title { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.piex-link-title h5 { margin: 0; color: var(--ink); font-size: 12.5px; font-weight: 650; }
.piex-link-title p { margin: 0; }
.piex-link-state { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 4px; }

.piex-link-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.piex-link-body > .ag-table,
.piex-link-body > .piex-scroll { min-width: 0; }
.piex-link-note { margin: 0; }

/* Where a step's data came from, down to the payload field and the table.
   Monospace and small because it is a reference, not prose — but it is never
   hidden behind a tooltip: "where did this come from" is the first question
   anyone asks of a consolidated view. */
.piex-provenance {
  margin: 0; padding-top: 7px; border-top: 1px dashed var(--line-soft);
  color: var(--faint); font-size: 10.5px; line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

/* The candidates panel now loads from /pie/candidates, so it has a loading
   state and a refusal state where it used to have neither. */
.piex-candidate-slot { display: block; min-width: 0; }
.piex-candidate-slot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- the chain at narrow width ----------

   Checked in a real browser at 1440px and at 360px. At 360 the step heading
   stacks — number and title on one line, the count badge beneath — because
   keeping the badge on the right squeezes a six-word title into a column two
   words wide. The tables keep scrolling inside their own box, so the page
   itself never gains a horizontal scrollbar. */

@media (max-width: 680px) {
  .piex-link { padding: 10px 10px; border-radius: 10px; }
  .piex-link-head { gap: 6px 8px; }
  /* The title takes the row beside the number; the state badge drops below
     both rather than compressing the title. */
  .piex-link-title { flex: 1 1 auto; }
  .piex-link-state { flex: 1 1 100%; }
  .piex-chain { gap: 8px; }
  .piex-provenance { font-size: 10px; }
}

/* ==================================================================
   The multi-repo task canvas (public/agent-repos.js). Ported from the
   approved mockup; built on the .ag-gx-* canvas so it reads as one system.
   ================================================================== */
.agr-canvas { --agr-you: #e8914a; --agr-reply: #8ddb8c; --agr-handoff: #39c5bb; --agr-branch: #c297ff; min-height: 520px; }
.agr-stage .ag-gx-card { cursor: pointer; }
.ag-gx-card.agr-lane { border-left-width: 3px; border-left-color: var(--lane); }
.ag-gx-card.agr-hidden, .agr-lanelabel.agr-hidden { opacity: 0; pointer-events: none; }
.ag-gx-card.is-skipped { border-style: dashed; opacity: .55; }
.agr-tiles { display: flex; flex-direction: column; margin-top: 2px; }
.agr-tl { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 7px; height: 26px; padding: 0 8px 0 4px;
  border: 1.2px solid var(--faint); border-radius: 9px; background: var(--surface); font-size: 10.5px; color: var(--muted); }
.agr-tl:hover { border-color: var(--text); }
.agr-tl .ti { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 6px; color: var(--faint); background: color-mix(in srgb, currentColor 16%, var(--surface)); }
.agr-tl .ti svg { width: 11px; height: 11px; }
.agr-tl b { min-width: 0; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agr-tl b span { color: var(--muted); font-weight: 400; }
.agr-tl small { font-size: 9.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.agr-tl.done { border-color: var(--positive-ink); background: var(--ok-bg); color: var(--text); } .agr-tl.done .ti { color: var(--ok-ink); }
.agr-tl.now { border-color: var(--warn-ink); background: var(--warn-bg); color: var(--ink); animation: ag-gx-pulse 2.6s ease-in-out infinite; }
.agr-tl.now b { font-weight: 650; } .agr-tl.now .ti, .agr-tl.now small { color: var(--warn-ink); }
.agr-tl.warn { border-color: var(--warn-ink); color: var(--text); } .agr-tl.warn .ti, .agr-tl.warn small { color: var(--warn-ink); }
.agr-tl.fail { border-color: var(--danger); background: var(--bad-bg); color: var(--bad-ink); } .agr-tl.fail .ti { color: var(--bad-ink); }
.agr-tl.skip { border-style: dashed; opacity: .5; }
.agr-tl.call .ti { color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.agr-att { font-style: normal; font-size: 9px; font-weight: 700; color: var(--accent); margin-right: 4px; }
.agr-lk { width: 2px; height: 10px; margin-left: 13px; background: var(--faint); opacity: .6; }
.agr-lk.done { background: var(--positive-ink); opacity: 1; }
.agr-lk.flow { width: 3px; margin-left: 12.5px; opacity: 1; background: repeating-linear-gradient(to bottom, var(--c) 0 4px, transparent 4px 8px); background-size: 100% 8px; animation: agr-drip .6s linear infinite; }
@keyframes agr-drip { to { background-position: 0 8px; } }
.agr-steps { display: flex; flex-direction: column; gap: 1px; padding: 4px; border-radius: 8px; background: var(--surface-sunken); }
.agr-st { display: grid; grid-template-columns: 13px 1fr; gap: 6px; height: 16px; font-size: 10.5px; color: var(--muted); }
.agr-st .ic { width: 11px; height: 11px; border-radius: 50%; border: 1.3px solid var(--faint); }
.agr-st.done .ic { border-color: var(--ok-ink); background: var(--ok-ink); } .agr-st.now .ic { border-color: var(--warn-ink); }
.agr-st.fail { color: var(--bad-ink); } .agr-st.fail .ic { border-color: var(--danger); background: var(--danger); }
.agr-moves { display: flex; flex-direction: column; gap: 1px; margin: 4px -4px 0; padding: 4px 6px; border-radius: 8px; background: var(--surface-sunken); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9.5px; }
.agr-moves .cnt { color: var(--muted); font: 600 9px/1.4 inherit; letter-spacing: .05em; text-transform: uppercase; }
.agr-mv { display: grid; grid-template-columns: 6px 32px minmax(0, 1fr); align-items: center; gap: 6px; height: 14px; color: var(--text); }
.agr-mv i { width: 6px; height: 6px; border-radius: 50%; }
/*
 * The lane palette lives in BOTH places on purpose.
 *
 * The page is served under `style-src 'self'`, so a style attribute written
 * into innerHTML is discarded by the browser — silently, which is how these
 * dots came to be invisible and the flowing link came to be the wrong colour
 * with nothing in the UI to show for it. The script therefore sends the lane's
 * INDEX and the stylesheet holds the colours; `agent-repos.js` keeps the same
 * list in LANE_COLOURS for the canvas, which sets its colours through the
 * CSSOM (`el.style`) where CSP does not interfere.
 */
.agr-mv i[data-lane="0"], .agr-rrow i[data-lane="0"] { background: #6cb6ff; }
.agr-mv i[data-lane="1"], .agr-rrow i[data-lane="1"] { background: #b083f0; }
.agr-mv i[data-lane="2"], .agr-rrow i[data-lane="2"] { background: #e0823d; }
.agr-mv i[data-lane="3"], .agr-rrow i[data-lane="3"] { background: #57ab5a; }
.agr-mv i[data-lane="4"], .agr-rrow i[data-lane="4"] { background: #dcbdfb; }
.agr-mv i[data-lane="5"], .agr-rrow i[data-lane="5"] { background: #f69d50; }
.agr-mv i[data-lane="none"], .agr-rrow i[data-lane="none"] { background: var(--muted); }
.agr-mv.is-empty span { color: var(--muted); }
.agr-lk.is-warn { --c: var(--warn-ink); }
.agr-lk.is-fail { --c: var(--danger); }
.agr-mv b { color: var(--accent); font-weight: 600; }
.agr-mv span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agr-lanelabel { position: absolute; display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 7px; border: 1px solid color-mix(in srgb, var(--lane) 55%, var(--line)); border-radius: 99px;
  background: color-mix(in srgb, var(--lane) 12%, var(--surface-sunken)); color: var(--ink); font-size: 10.5px; font-weight: 650; white-space: nowrap; }
.agr-lanelabel i { width: 7px; height: 7px; border-radius: 50%; background: var(--lane); flex: none; }
.agr-lanelabel em { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-style: normal; font-weight: 600; padding: 0 7px; border-radius: 99px; font-size: 10px; background: var(--surface-raised); color: var(--text-strong); }
.agr-lanelabel em.now { background: var(--warn-bg); color: var(--warn-ink); }
.agr-lanelabel em.done { background: var(--ok-bg); color: var(--ok-ink); }
.agr-lanelabel em.bad { background: var(--bad-bg); color: var(--bad-ink); }
.agr-lanelabel.dim { opacity: .55; }
.ag-gx-card.agr-actor { z-index: 2; }
.agr-actor .agr-avatar { color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.agr-actor.you .agr-avatar { color: var(--agr-you); background: color-mix(in srgb, var(--agr-you) 18%, var(--surface)); }
.agr-say { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: 11px; font-weight: 600; }
.agr-say i { width: 6px; height: 6px; flex: none; border-radius: 50%; background: currentColor; }
.agr-say span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agr-say.now { color: var(--warn-ink); } .agr-say.gate { color: var(--bad-ink); } .agr-say.done { color: var(--ok-ink); }
.agr-more { margin: 0 0 -2px 2px; color: var(--muted); font-size: 9.5px; }
.agr-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.agr-talk { position: absolute; top: 0; left: 0; z-index: 3; overflow: visible; pointer-events: none; }
/* Lines keep their width at any zoom, so an answered line still shows at Fit all. */
.agr-tk { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.agr-tk.active { stroke-width: 2.4; stroke-dasharray: 2 7; animation: ag-gx-march .9s linear infinite; }
.agr-tk.ask { stroke: var(--accent); } .agr-tk.reply { stroke: var(--agr-reply); } .agr-tk.human { stroke: var(--agr-you); } .agr-tk.handoff { stroke: var(--agr-handoff); }
.agr-tk.past { stroke-width: 1.5; stroke-dasharray: 2 6; opacity: .45; }
.agr-pk.ask { fill: var(--accent); } .agr-pk.reply { fill: var(--agr-reply); } .agr-pk.human { fill: var(--agr-you); } .agr-pk.handoff { fill: var(--agr-handoff); }
.agr-bubble { position: absolute; z-index: 4; width: max-content; max-width: 250px; padding: 6px 9px; border: 1px solid; border-radius: 10px; background: var(--surface-raised); color: var(--ink);
  font-size: 10.5px; line-height: 1.4; transform: translate(-50%, -112%); pointer-events: none; box-shadow: var(--card-shadow); }
.agr-bubble small { display: block; margin-bottom: 2px; font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.agr-bubble.ask { border-color: var(--accent); } .agr-bubble.ask small { color: var(--accent); }
.agr-bubble.reply { border-color: var(--agr-reply); } .agr-bubble.reply small { color: var(--agr-reply); }
.agr-bubble.handoff { border-color: var(--agr-handoff); } .agr-bubble.handoff small { color: var(--agr-handoff); }
/* A card that already ran and will run again: the work went back past it. */
.agr-stage .ag-gx-card.is-again { border-style: dashed; border-color: var(--warn-ink); background: color-mix(in srgb, var(--warn-bg) 45%, var(--surface)); }
.agr-again { position: absolute; right: 10px; bottom: 8px; padding: 1px 8px; border: 1px solid var(--warn-ink); border-radius: 99px; color: var(--warn-ink); background: var(--surface); font-size: 10px; font-weight: 600; }
/* A repair branch: dashed violet, entered from the phase that failed, rejoining the work after it. */
.agr-stage .ag-gx-card.is-branch { border-style: dashed; border-color: var(--agr-branch); }
.agr-stage .ag-gx-card.is-branch .ag-gx-kind { color: var(--agr-branch); }
.ag-gx-edge.agr-branch-edge { stroke: var(--agr-branch); stroke-dasharray: 7 7; }
.ag-gx-edge.agr-branch-edge.is-done { stroke: var(--positive-ink); }
.ag-gx-edge.is-flow.agr-branch-flow { stroke: var(--agr-branch); }
/* The work sent back to an earlier phase: an arc under the work, flowing while it is live. */
.ag-gx-edge.agr-back { stroke: var(--agr-reply); stroke-width: 2.2; stroke-dasharray: 6 8; opacity: .75; }
.ag-gx-edge.agr-back.is-live { stroke-width: 3.4; opacity: 1; animation: ag-gx-march 1.1s linear infinite; }
.agr-back-head { fill: var(--agr-reply); }
.agr-back-label { fill: var(--agr-reply); font-size: 11px; font-weight: 600; }
/* Cards can be dragged; one lifts while it moves, and keeps a small grip once moved. */
.agr-stage .ag-gx-card { cursor: grab; touch-action: none; }
.agr-stage .ag-gx-card.is-dragging { z-index: 6; cursor: grabbing; transition: none; box-shadow: 0 14px 36px rgba(0, 0, 0, .45); }
.agr-stage .ag-gx-card.agr-moved::after { content: ''; position: absolute; top: 5px; left: 50%; width: 18px; height: 3px; border-radius: 2px; background: var(--faint); opacity: .6; transform: translateX(-50%); }
/* The canvas toolbar: icons in groups; each names itself on hover, above the bar. */
.agr-tools { align-items: center; gap: 2px; padding: 4px; }
.agr-tool-sep { flex: none; width: 1px; height: 20px; margin: 0 3px; background: var(--line); }
.agr-tools .ag-gx-tool.agr-ico { position: relative; display: grid; place-items: center; width: 32px; min-width: 32px; height: 30px; padding: 0; color: var(--muted); }
.agr-tools .ag-gx-tool.agr-ico svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.agr-tools .ag-gx-tool.agr-ico:hover, .agr-tools .ag-gx-tool.agr-ico[aria-pressed="true"] { color: var(--ink); }
.agr-tools .ag-gx-tool.agr-ico[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--line-strong); }
.agr-tools .ag-gx-tool.agr-ico::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; padding: 4px 8px; border: 1px solid var(--line);
  border-radius: 7px; color: var(--ink); background: var(--surface-raised, var(--surface)); box-shadow: var(--card-shadow); font-size: 11px; font-weight: 600;
  white-space: nowrap; pointer-events: none; opacity: 0; transform: translate(-50%, 3px); transition: opacity .12s, transform .12s; }
.agr-tools .ag-gx-tool.agr-ico:hover::after, .agr-tools .ag-gx-tool.agr-ico:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .agr-tools .ag-gx-tool.agr-ico::after { transition: none; } }
.agr-bubble.human { border-color: var(--agr-you); } .agr-bubble.human small { color: var(--agr-you); }
.agr-pop { width: 300px; max-height: calc(100% - 50px); overflow: auto; }
.agr-pop h3 { margin: 0 0 4px; font-size: 14px; }
.agr-lead { margin: 0 0 6px; color: var(--muted); font-size: 11.5px; }
.agr-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.agr-rows { display: flex; flex-direction: column; gap: 1px; border-radius: 10px; overflow: hidden; background: var(--line); }
.agr-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; background: var(--surface); }
.agr-row small { color: var(--muted); font-size: 11px; } .agr-row strong { font-size: 12px; text-align: right; }
.agr-talklog { display: flex; flex-direction: column; gap: 6px; }
.agr-talklog div { padding: 6px 8px; border-left: 2px solid; border-radius: 4px; background: var(--surface); font-size: 11px; line-height: 1.45; }
.agr-talklog small { display: block; color: var(--muted); font-size: 9.5px; font-weight: 600; }
.agr-tl.ask { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.agr-rrows { display: flex; flex-direction: column; gap: 2px; margin: 1px -4px 0; padding: 4px; border-radius: 8px; background: color-mix(in srgb, var(--surface-sunken) 70%, transparent); }
.agr-rrow { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 6px; height: 16px; color: var(--ink); font-size: 10.5px; }
.agr-rrow i { width: 7px; height: 7px; border-radius: 50%; }
.agr-rrow b { min-width: 0; overflow: hidden; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.agr-rrow small { color: var(--muted); font-size: 9.5px; white-space: nowrap; }
.agr-rrow small.now { color: var(--warn-ink); font-weight: 600; } .agr-rrow small.ok { color: var(--ok-ink); } .agr-rrow small.bad { color: var(--bad-ink); }
.agr-live-file { display: flex; align-items: center; min-width: 0; height: 14px; color: var(--warn-ink); font-family: var(--mono); font-size: 9.5px; }
.agr-live-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.agr-log { max-height: 220px; margin: 0; overflow: auto; padding: 8px 10px; border-radius: 8px; background: var(--surface-sunken); color: var(--text); font-family: var(--mono); font-size: 10.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.ag-gx-edge.is-draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: agr-draw .7s ease-out forwards; }
@keyframes agr-draw { to { stroke-dashoffset: 0; } }
.agr-stage.is-paused .agr-tk.active, .agr-stage.is-paused .agr-lk.flow, .agr-stage.is-paused .agr-tl.now, .agr-stage.is-paused .ag-gx-edge.agr-back.is-live { animation: none; }
.agr-stage.is-paused .agr-pk, .agr-stage.is-settled .agr-pk { display: none; }
@media (prefers-reduced-motion: reduce) {
  .agr-tk.active, .agr-lk.flow, .agr-tl.now { animation: none; }
  .ag-gx-edge.is-draw, .ag-gx-edge.agr-back.is-live { animation: none; stroke-dashoffset: 0; }
  .agr-pk { display: none; }
}

.agr-phase-ico svg, .agr-avatar svg { width: 14px; height: 14px; }

/*
 * The secrets sign-in form. These rules were style attributes inside the
 * form's markup until the CSP (`style-src 'self'`) was found to be dropping
 * every one of them, which left the form with no widths and no spacing.
 */
.stg-login-note { margin: 0 0 16px; color: var(--muted); }
.stg-login-field { width: 100%; margin-bottom: 10px; }
.stg-login-field.is-last { margin-bottom: 14px; }
.stg-login-row { display: flex; gap: 10px; align-items: center; }
.stg-login-error { color: var(--danger, #c4403a); font-size: 13px; }
