/* Qorteck — design tokens, then layout, then components, then pages. */

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --bg: #fbfbfc; --panel: #ffffff; --side: #f5f5f7; --raised: #ffffff;
  --ink: #1b1c20; --ink-2: #3c3e45; --muted: #73767f; --faint: #a3a6ad;
  --line: #e6e7ea; --line-2: #eff0f2; --hover: #f0f1f4; --active: #e8e9ee;
  --accent: #5b5bd6; --accent-2: #4a4ac4; --accent-soft: #ededfc; --accent-ink: #ffffff;
  --ok: #1f8a4c; --ok-soft: #e5f5ec; --err: #d1343b; --err-soft: #fdecec; --warn: #a86500; --warn-soft: #fdf3e1;
  --shadow-1: 0 1px 2px rgba(16, 17, 24, .05);
  --shadow-2: 0 1px 2px rgba(16, 17, 24, .06), 0 4px 12px rgba(16, 17, 24, .06);
  --shadow-3: 0 8px 30px rgba(16, 17, 24, .14), 0 2px 6px rgba(16, 17, 24, .06);
  --r-1: 5px; --r-2: 7px; --r-3: 10px; --r-4: 14px;
  --ctl: 30px; --field: #ffffff; --field-line: #dcdde2;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1013; --panel: #16171b; --side: #121316; --raised: #1c1d22;
    --ink: #ececef; --ink-2: #c9cad0; --muted: #8e919a; --faint: #5f626b;
    --line: #26272d; --line-2: #1f2025; --hover: #1e1f24; --active: #26272e;
    --field: #0c0d10; --field-line: #34363e; --accent: #8c8cf4; --accent-2: #a3a3f7; --accent-soft: #23233d; --accent-ink: #0f1013;
    --ok: #4cc583; --ok-soft: #15291e; --err: #f2777c; --err-soft: #321a1c; --warn: #f0b45a; --warn-soft: #2f2414;
    --shadow-1: none; --shadow-2: 0 0 0 1px var(--line); --shadow-3: 0 10px 40px rgba(0, 0, 0, .55), 0 0 0 1px var(--line);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1013; --panel: #16171b; --side: #121316; --raised: #1c1d22;
  --ink: #ececef; --ink-2: #c9cad0; --muted: #8e919a; --faint: #5f626b;
  --line: #26272d; --line-2: #1f2025; --hover: #1e1f24; --active: #26272e;
  --field: #0c0d10; --field-line: #34363e; --accent: #8c8cf4; --accent-2: #a3a3f7; --accent-soft: #23233d; --accent-ink: #0f1013;
  --ok: #4cc583; --ok-soft: #15291e; --err: #f2777c; --err-soft: #321a1c; --warn: #f0b45a; --warn-soft: #2f2414;
  --shadow-1: none; --shadow-2: 0 0 0 1px var(--line); --shadow-3: 0 10px 40px rgba(0, 0, 0, .55), 0 0 0 1px var(--line);
  color-scheme: dark;
}

/* ───────── base ───────── */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { min-height: 100vh; }
body { font: 13.5px/1.5 var(--font); color: var(--ink); background: var(--bg); display: flex; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1 { font-size: 21px; font-weight: 650; letter-spacing: -.015em; margin: 0; line-height: 1.25; }
h2 { font-size: 14px; font-weight: 600; margin: 28px 0 10px; letter-spacing: -.005em; }
h3 { font-size: 12px; font-weight: 600; margin: 18px 0 8px; color: var(--muted); }
p { margin: 0 0 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.count { color: var(--muted); font-weight: 500; font-size: 12px; font-variant-numeric: tabular-nums; }
ul.plain { list-style: none; padding: 0; margin: 0; }
kbd { font: 500 11px var(--font); background: var(--panel); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--muted); white-space: nowrap; }
.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
.si, .pi { flex: none; vertical-align: -2px; }
.pi { color: var(--muted); } .pi-urgent { color: #e5484d; } .pi-high, .pi-medium, .pi-low { color: var(--ink-2); }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--panel); padding: 6px 10px; }

/* ───────── shell ───────── */
.side { width: 244px; flex: none; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 10px 8px; gap: 2px; scrollbar-width: thin; }
.side-top { padding: 2px 6px 8px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 650; color: var(--ink); font-size: 15px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.logo { display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 6px; background: #a47ffb; color: #fff; }
.logo svg { width: 100%; height: 100%; display: block; }
.search-btn { display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 8px; margin: 0 0 8px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--panel); color: var(--muted); cursor: pointer; font: inherit; text-align: left; box-shadow: var(--shadow-1); }
.search-btn span { flex: 1; }
.search-btn:hover { border-color: var(--faint); }
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.nav { display: flex; align-items: center; gap: 9px; height: 28px; padding: 0 8px; border-radius: var(--r-1); color: var(--ink-2); font-weight: 500; cursor: pointer; list-style: none; user-select: none; }
.nav::-webkit-details-marker { display: none; }
.nav .i { color: var(--muted); }
.nav:hover { background: var(--hover); text-decoration: none; color: var(--ink); }
.nav.on { background: var(--active); color: var(--ink); }
.nav.on .i { color: var(--accent); }
.side-h { margin: 16px 8px 4px; color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.proj > summary .caret { margin-left: auto; width: 14px; height: 14px; transition: transform .15s; opacity: .6; }
.proj:not([open]) > summary .caret { transform: rotate(-90deg); }
.proj-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-badge { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; font-size: 10px; font-weight: 700; flex: none;
  background: hsl(var(--h) 70% 92%); color: hsl(var(--h) 55% 32%); }
:root[data-theme="dark"] .proj-badge { background: hsl(var(--h) 35% 22%); color: hsl(var(--h) 70% 78%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .proj-badge { background: hsl(var(--h) 35% 22%); color: hsl(var(--h) 70% 78%); } }
.proj .sub { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 6px 17px; padding-left: 9px; border-left: 1px solid var(--line); }
.proj .sub .nav { height: 26px; font-size: 13px; }
.side-foot { margin-top: auto; padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.user-menu > summary { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--r-2); cursor: pointer; }
.user-menu > summary:hover { background: var(--hover); }
.user-menu .who { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.user-menu .who b { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .who small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad { padding: 4px 8px; }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.top { display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 20px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; flex: none; }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--ink-2); font-weight: 500; }
.crumbs .sep { color: var(--faint); }
.crumbs b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.burger { display: none; cursor: pointer; color: var(--ink-2); }
.scrim { display: none; }
.content { padding: 28px 32px 64px; max-width: 1180px; width: 100%; }
.content.wide { max-width: none; }
.content.flush { padding: 0; max-width: none; flex: 1; }
.banner { display: flex; align-items: center; gap: 8px; padding: 8px 20px; background: var(--warn-soft); color: var(--warn); font-size: 13px; border-bottom: 1px solid var(--line); }
.banner a { font-weight: 600; color: inherit; text-decoration: underline; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; max-width: 720px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ───────── controls ───────── */
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), select, textarea {
  height: var(--ctl); background: var(--field); border: 1px solid var(--field-line); border-radius: var(--r-2); padding: 0 10px; min-width: 0; max-width: 100%; color: var(--ink); transition: border-color .12s, box-shadow .12s; }
textarea { height: auto; padding: 8px 10px; width: 100%; resize: vertical; line-height: 1.55; }
select { padding-right: 26px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2373767f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; }
select[multiple] { height: auto; padding: 4px; background-image: none; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--faint) 70%, var(--line)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
input[type=color] { width: 34px; height: 26px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: var(--panel); }
::placeholder { color: var(--faint); }
.btn, button.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--ctl); padding: 0 12px; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-1); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.12); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--err); }
.btn.danger.solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12.5px; }
.btn .i { width: 15px; height: 15px; }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-1); border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
label { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
label > input:not([type=checkbox]):not([type=radio]), label > select, label > textarea { display: block; width: 100%; margin-top: 5px; font-size: 13.5px; }
label.check { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.field-hint { font-weight: 400; color: var(--faint); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline > input, .inline > select { width: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.span2 { grid-column: span 2; }
.w-xs { width: 72px !important; } .w-sm { width: 150px !important; } .w-md { width: 260px !important; }

/* ───────── menus, dialogs, toasts ───────── */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 210px; max-width: 320px; max-height: 360px; overflow-y: auto; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-3); padding: 4px; animation: pop .12s ease-out; }
.menu.right .menu-pop { left: auto; right: 0; }
.menu.up .menu-pop { top: auto; bottom: calc(100% + 4px); }
.menu-pop > a, .menu-pop > button, .menu-pop form > button, .menu-pop .opt { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border: 0; background: none; border-radius: var(--r-1); color: var(--ink); font: inherit; text-align: left; cursor: pointer; white-space: nowrap; }
.menu-pop > a:hover, .menu-pop > button:hover, .menu-pop form > button:hover, .menu-pop .opt:hover, .menu-pop .opt.active { background: var(--hover); text-decoration: none; }
.menu-pop .i { color: var(--muted); }
.menu-pop .sel-mark { margin-left: auto; color: var(--accent); }
.menu-pop .menu-h { padding: 6px 8px 2px; font-size: 11px; color: var(--faint); font-weight: 600; }
.menu-pop .menu-search { width: 100%; margin: 2px 0 4px; height: 28px; }
.menu-pop label.opt { font-size: 13.5px; color: var(--ink); font-weight: 400; }
.menu-pop .menu-actions { display: flex; justify-content: flex-end; gap: 6px; padding: 6px 4px 2px; border-top: 1px solid var(--line); margin-top: 4px; position: sticky; bottom: -4px; background: var(--raised); }
@keyframes pop { from { opacity: 0; transform: translateY(-3px) scale(.98); } }

dialog { border: 0; padding: 0; background: var(--raised); color: var(--ink); border-radius: var(--r-4); box-shadow: var(--shadow-3); max-width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(10, 10, 15, .35); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .14s ease-out; }
.modal { width: 560px; }
.modal.small-modal { width: 440px; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
.modal header h2 { margin: 0; font-size: 15px; }
.modal .modal-body { padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.modal footer { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 18px 16px; }
.modal footer .grow { flex: 1; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; padding: 14px 18px 18px; margin: 0; }
.keys dt { white-space: nowrap; } .keys dd { margin: 0; color: var(--ink-2); }

.palette { width: 620px; margin-top: 12vh; padding: 0; }
.palette-in { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.palette-in .i { width: 18px; height: 18px; color: var(--muted); }
.palette-in input { flex: 1; border: 0 !important; box-shadow: none !important; height: 32px !important; font-size: 15px !important; padding: 0 !important; background: transparent !important; }
.palette-list { max-height: 380px; overflow-y: auto; padding: 6px; }
.palette-list .p-h { font-size: 11px; color: var(--faint); font-weight: 600; padding: 8px 10px 4px; }
.palette-list .p-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-2); color: var(--ink); cursor: pointer; }
.palette-list .p-item .ref { font: 500 12px var(--mono); color: var(--muted); width: 74px; flex: none; }
.palette-list .p-item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-list .p-item.active, .palette-list .p-item:hover { background: var(--accent-soft); text-decoration: none; }
.palette-list .p-empty { padding: 18px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(440px, calc(100vw - 36px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: var(--r-3); background: var(--raised); box-shadow: var(--shadow-3); font-size: 13px; animation: toast-in .2s ease-out; }
.toast .i { margin-top: 1px; }
.toast.ok .i { color: var(--ok); }
.toast.err { border-left: 3px solid var(--err); }
.toast.err .i { color: var(--err); }
.toast span { flex: 1; }
.toast.ok { animation: toast-in .2s ease-out, toast-out .3s ease-in 3.6s forwards; }
.toast-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); visibility: hidden; } }

/* ───────── badges ───────── */
.state { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-weight: 500; }
.label { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px 0 7px; border: 1px solid var(--line); border-radius: 999px; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; background: var(--panel); font-weight: 500; }
.label i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.avatar { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 9px; font-weight: 700; flex: none; letter-spacing: .02em;
  background: hsl(var(--h, 250) 65% 88%); color: hsl(var(--h, 250) 50% 28%); box-shadow: 0 0 0 1.5px var(--panel); }
:root[data-theme="dark"] .avatar { background: hsl(var(--h, 250) 30% 28%); color: hsl(var(--h, 250) 70% 85%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { background: hsl(var(--h, 250) 30% 28%); color: hsl(var(--h, 250) 70% 85%); } }
.avatar.lg { width: 28px; height: 28px; font-size: 11px; }
.avatar.more { background: var(--line); color: var(--muted); }
.avatars { display: inline-flex; flex: none; }
.avatars .avatar + .avatar { margin-left: -5px; }
.avatars.none { width: 20px; height: 20px; border-radius: 50%; border: 1px dashed var(--faint); display: inline-grid; place-items: center; color: var(--faint); }
.avatars.none .i { width: 11px; height: 11px; }
.mod { font: 500 11px var(--mono); color: var(--muted); white-space: nowrap; }
.due { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.due .i { width: 13px; height: 13px; }
.due.is-late { color: var(--err); font-weight: 600; }
.est { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 4px; background: var(--line-2); border: 1px solid var(--line); font-size: 11px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.ko { font-size: 11px; color: var(--err); font-weight: 700; background: var(--err-soft); padding: 0 6px; border-radius: 4px; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; height: 20px; font-size: 11.5px; padding: 0 8px; border-radius: 999px; background: var(--line-2); color: var(--muted); white-space: nowrap; font-weight: 500; }
.pill.current, .pill.in_progress, .pill.open, .pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.closed, .pill.completed, .pill.accepted, .pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.declined, .pill.cancelled, .pill.err { background: var(--err-soft); color: var(--err); }
.pill.paused, .pill.warn { background: var(--warn-soft); color: var(--warn); }

/* ───────── lists ───────── */
.list { display: flex; flex-direction: column; gap: 14px; }
.group > summary { list-style: none; }
.group > summary::-webkit-details-marker { display: none; }
.group-head { display: flex; align-items: center; gap: 8px; padding: 6px 4px; cursor: pointer; font-weight: 600; font-size: 13px; position: sticky; top: 46px; z-index: 2; background: var(--bg); user-select: none; }
.group-head .caret { width: 14px; height: 14px; color: var(--faint); transition: transform .15s; }
.group:not([open]) .caret { transform: rotate(-90deg); }
.rows { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; box-shadow: var(--shadow-1); }
.rows:empty { display: none; }
.row { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; border-bottom: 1px solid var(--line-2); min-width: 0; position: relative; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--hover); }
.row .ref { font: 500 12px var(--mono); color: var(--muted); flex: none; min-width: 64px; }
.row .row-state { display: inline-flex; flex: none; }
.row .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
.row .title::after { content: ""; position: absolute; inset: 0; }
.row .title:hover { text-decoration: none; }
.row .meta { display: flex; align-items: center; gap: 8px; flex: none; max-width: 58%; overflow: hidden; }
.row .sel { position: relative; z-index: 1; display: inline-flex; padding: 4px; margin: -4px; }
.row .row-act { position: relative; z-index: 1; flex: none; }
.row.done-row .title { color: var(--muted); }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 48px 24px; border: 1px dashed var(--line); border-radius: var(--r-3); color: var(--muted); background: var(--panel); }
.empty-state > .i { width: 28px; height: 28px; color: var(--faint); margin-bottom: 4px; stroke-width: 1.5; }
.empty-state b { color: var(--ink); font-size: 14px; font-weight: 600; }
.empty-state p { max-width: 420px; margin: 0; }
.empty-state .btn { margin-top: 10px; }
.bulk { position: sticky; bottom: 16px; z-index: 20; margin: 16px auto 0; width: fit-content; display: none; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-3); }
.bulk.on { display: flex; }
.bulk select { height: 28px; }

/* ───────── views toolbar ───────── */
.view-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.view-bar .grow { flex: 1; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 18px 0 0; border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; margin-bottom: -1px; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.tab .count { font-size: 11px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 9px; border-radius: var(--r-2); background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.chip b { font-weight: 600; }
.chip a { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; color: inherit; }
.chip a:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.chip .i { width: 13px; height: 13px; }
.chip.fixed { background: var(--line-2); color: var(--muted); padding-right: 9px; }
.filter-search { height: 28px !important; width: 190px; }
.seg { display: inline-flex; background: var(--line-2); border: 1px solid var(--line); border-radius: var(--r-2); padding: 2px; gap: 2px; }
.seg a { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 5px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.seg a:hover { color: var(--ink); text-decoration: none; }
.seg a.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-1); }
.seg .i { width: 14px; height: 14px; }

/* ───────── board ───────── */
.board { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 16px; align-items: flex-start; scrollbar-width: thin; }
.col { flex: 0 0 290px; background: var(--side); border: 1px solid var(--line-2); border-radius: var(--r-3); display: flex; flex-direction: column; max-height: calc(100vh - 230px); transition: background .12s, border-color .12s; }
.col header { display: flex; align-items: center; gap: 7px; padding: 10px 12px 8px; font-size: 13px; }
.col header b { font-weight: 600; }
.col-est { margin-left: auto; font-size: 11px; color: var(--faint); }
.cards { padding: 2px 8px 8px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 40px; scrollbar-width: thin; }
.card { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-2); padding: 9px 11px 10px; box-shadow: var(--shadow-1); position: relative; transition: border-color .12s, box-shadow .12s, opacity .12s; }
.card:hover { border-color: color-mix(in srgb, var(--faint) 80%, var(--line)); box-shadow: var(--shadow-2); }
.card[draggable="true"] { cursor: grab; }
.card.dragging { opacity: .45; }
.card.late { box-shadow: inset 3px 0 0 var(--err), var(--shadow-1); }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.card-top .ref { font: 500 11.5px var(--mono); color: var(--muted); }
.card-title { color: var(--ink); font-weight: 500; line-height: 1.4; font-size: 13px; }
.card-title::after { content: ""; position: absolute; inset: 0; }
.card-title:hover { text-decoration: none; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.drop-hint { display: none; border: 1.5px dashed var(--accent); border-radius: var(--r-2); color: var(--accent); text-align: center; font-size: 12px; padding: 10px; }
.board.dragging .col { border-color: var(--line); }
.col.over { background: var(--accent-soft); border-color: var(--accent); }
.col.over .drop-hint { display: block; }

/* ───────── ticket page ───────── */
.item-page { display: grid; grid-template-columns: minmax(0, 1fr) 300px; flex: 1; min-height: 0; }
.item-main { padding: 28px 40px 80px; min-width: 0; max-width: 940px; width: 100%; justify-self: center; }
.item-side { border-left: 1px solid var(--line); background: var(--side); padding: 16px 14px 32px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 46px; height: calc(100vh - 46px); overflow-y: auto; scrollbar-width: thin; }
.item-ref { font: 500 12px var(--mono); color: var(--muted); display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.item-title { font-size: 24px; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; margin: 0 0 16px; }
.item-title-input { field-sizing: content; resize: none; min-height: 0; line-height: 1.25; overflow: hidden; }
input.item-title-input, textarea.item-title-input { font-size: 24px !important; font-weight: 650; letter-spacing: -.02em; height: auto !important; padding: 2px 6px !important; margin: 0 0 12px -7px; width: calc(100% + 7px); border-color: transparent !important; background: transparent !important; }
.item-title-input:hover { border-color: var(--line) !important; }
.item-title-input:focus { border-color: var(--accent) !important; background: var(--panel) !important; }
.desc { position: relative; }
.desc-edit-btn { position: absolute; right: 0; top: -36px; }
.next-step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); border-radius: var(--r-3); margin: 0 0 18px; }
.next-step > .i { color: var(--accent); width: 18px; height: 18px; }
.next-step .txt { flex: 1; font-size: 13px; color: var(--ink-2); }
.next-step .txt b { color: var(--ink); }
.next-step .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.notice { display: flex; gap: 10px; padding: 10px 14px; border-radius: var(--r-3); font-size: 13px; margin: 0 0 16px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.err { background: var(--err-soft); color: var(--err); }
.notice ul { margin: 4px 0 0; padding-left: 18px; }
.section { margin-top: 28px; }
.section-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.section-h h2 { margin: 0; font-size: 13px; }
.section-h .i { color: var(--muted); }
.section-h .grow { flex: 1; }
.subprog { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.subprog .bar { width: 70px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.subprog .bar i { display: block; height: 100%; background: var(--ok); }
.add-inline { display: flex; gap: 8px; margin-top: 8px; }
.add-inline input { flex: 1; }
.rel-list .row { padding-left: 10px; }
.rel-kind { font-size: 11.5px; color: var(--muted); width: 80px; flex: none; position: relative; z-index: 1; }
.resolved { font-size: 11.5px; color: var(--ok); font-weight: 600; white-space: nowrap; }
.link-list { display: flex; flex-direction: column; gap: 4px; }
.link-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--panel); }
.link-item .i { color: var(--muted); }
.link-item a.u { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
.link-item small { color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.file { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-2); overflow: hidden; background: var(--panel); color: var(--ink); }
.file:hover { text-decoration: none; border-color: var(--faint); }
.file .thumb { height: 90px; background: var(--line-2) center/cover no-repeat; display: grid; place-items: center; color: var(--faint); }
.file .thumb .i { width: 26px; height: 26px; }
.file .thumb.vid .i { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: rgb(0 0 0 / .55); color: #fff; }
.file span { padding: 6px 8px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file small { padding: 0 8px 6px; font-size: 11px; color: var(--muted); }

.props { display: flex; flex-direction: column; }
.prop { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; min-height: 32px; gap: 6px; }
.prop > .k { color: var(--muted); font-size: 12.5px; }
.prop .v { min-width: 0; }
.prop .v > .menu { width: 100%; }
.prop .v > .menu > summary, .prop .v > .ro { display: flex; align-items: center; gap: 7px; min-height: 28px; padding: 2px 7px; border-radius: var(--r-1); color: var(--ink); overflow: hidden; }
.prop .v > .menu > summary:hover { background: var(--hover); }
.prop .v > .menu > summary .ph, .prop .ro .ph { color: var(--faint); }
.prop .v > .menu > summary > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop .v input[type=date] { height: 28px; border-color: transparent !important; background: transparent !important; box-shadow: none; padding: 0 6px; width: 100%; color: var(--ink); }
.prop .v input[type=date]:focus { border-color: var(--accent) !important; }
.prop .v input[type=date]:hover { background: var(--hover); }
.prop .v input.parent-in { height: 28px; border-color: transparent !important; background: transparent !important; padding: 0 7px; width: 100%; font-family: var(--mono); font-size: 12.5px; }
.prop .v input.parent-in:focus { border-color: var(--accent) !important; }
.prop .v input.parent-in:hover { background: var(--hover); }
.side-sep { border-top: 1px solid var(--line); margin: 10px 0 8px; }
.side-h2 { font-size: 11.5px; font-weight: 600; color: var(--muted); margin: 4px 0 6px; display: flex; align-items: center; justify-content: space-between; }
.state-btn > summary { display: flex !important; align-items: center; gap: 8px; height: 34px; padding: 0 10px !important; border: 1px solid var(--line); border-radius: var(--r-2) !important; background: var(--panel); box-shadow: var(--shadow-1); font-weight: 600; }
.state-btn > summary .caret { margin-left: auto; color: var(--faint); width: 14px; height: 14px; }
.state-btn .menu-pop { width: 100%; }
.labels-box { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.label-x { display: inline-flex; align-items: center; }
.label-x button { border: 0; background: none; padding: 0 2px; margin-left: -4px; color: var(--faint); cursor: pointer; line-height: 1; }
.label-x button:hover { color: var(--err); }
.add-label > summary { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border: 1px dashed var(--line); border-radius: 999px; font-size: 11.5px; color: var(--muted); }
.add-label > summary:hover { color: var(--ink); border-color: var(--faint); }
.add-label .menu-pop { width: 260px; }
.add-label .opt { font-size: 12.5px; }
.timebar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 4px 0 6px; }
.timebar i { display: block; height: 100%; background: var(--accent); }
.timebar i.over { background: var(--err); }
.side-meta { font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.worklogs li { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 0; color: var(--ink-2); }
.worklogs li .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

.timeline { position: relative; }
.timeline-filter { margin-left: auto; }
.tl { display: flex; flex-direction: column; gap: 2px; }
.ev { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 5px 0 5px 4px; }
.ev .dot { width: 20px; display: grid; place-items: center; flex: none; }
.ev .dot .i { width: 14px; height: 14px; color: var(--faint); }
.ev b { color: var(--ink-2); font-weight: 600; }
.ev s { color: var(--faint); }
.ev .note { color: var(--faint); }
.ev time { margin-left: auto; color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.comment { border: 1px solid var(--line); border-radius: var(--r-3); background: var(--panel); margin: 8px 0; box-shadow: var(--shadow-1); }
.comment > header { display: flex; align-items: center; gap: 8px; padding: 9px 14px 0; font-size: 13px; }
.comment > header b { font-weight: 600; }
.comment > header time { color: var(--muted); font-size: 12px; }
.comment > header .grow { flex: 1; }
.comment .md { padding: 4px 14px 12px; }
.comment .kind { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.comment.k-proof { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.comment.k-proof .kind { background: var(--accent-soft); color: var(--accent); }
.comment.k-validation { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.comment.k-validation .kind { background: var(--ok-soft); color: var(--ok); }
.comment.k-ko { border-color: color-mix(in srgb, var(--err) 45%, var(--line)); }
.comment.k-ko .kind { background: var(--err-soft); color: var(--err); }
.comment.k-blocked .kind { background: var(--warn-soft); color: var(--warn); }
.comment.k-system { background: var(--side); box-shadow: none; }
.comment.k-system .kind { background: var(--line-2); color: var(--muted); }
.comment form { padding: 8px 14px 12px; }
.tl.only-comments .ev { display: none; }
.composer { border: 1px solid var(--line); border-radius: var(--r-3); background: var(--panel); margin-top: 14px; box-shadow: var(--shadow-1); transition: border-color .12s, box-shadow .12s; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.composer textarea { border: 0 !important; box-shadow: none !important; background: transparent !important; min-height: 90px; padding: 12px 14px; }
.composer .preview { display: none; padding: 12px 14px; min-height: 90px; }
.composer.previewing textarea { display: none; }
.composer.previewing .preview { display: block; }
.composer footer { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line-2); }
.composer footer .grow { flex: 1; }
.composer .hint { font-size: 11.5px; color: var(--faint); }
.composer .drop-note { padding: 0 14px 8px; font-size: 11.5px; color: var(--faint); }
.composer.previewing .drop-note { display: none; }
.composer.dropping { border-color: var(--accent); border-style: dashed; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.composer.dropping .drop-note { color: var(--accent); font-weight: 500; }
.editor-tabs { display: flex; gap: 2px; }
.editor-tabs button { border: 0; background: none; padding: 3px 8px; border-radius: 5px; color: var(--muted); cursor: pointer; font-size: 12.5px; font-weight: 500; }
.editor-tabs button.on { background: var(--hover); color: var(--ink); }

/* ───────── markdown ───────── */
.md { overflow-wrap: anywhere; line-height: 1.65; color: var(--ink); }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md img, .md video { max-width: 100%; border-radius: var(--r-2); border: 1px solid var(--line); display: block; margin: 8px 0; }
/* Captures in comments: thumbnails that open the full image; videos at a readable width (UX.md section 12). */
.md a.capture { display: inline-block; vertical-align: top; margin: 4px 8px 4px 0; max-width: 100%; }
.md a.capture img { margin: 0; max-height: 260px; max-width: min(100%, 460px); width: auto; object-fit: contain; background: var(--line-2); transition: border-color .12s; }
.md a.capture:hover img { border-color: var(--accent); }
.md video.capture { width: min(100%, 640px); background: #000; }
.md pre { background: var(--side); border: 1px solid var(--line); padding: 12px 14px; border-radius: var(--r-2); overflow-x: auto; font-size: 12.5px; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--line-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }
.md pre code { background: none; padding: 0; border: 0; }
.md table { border-collapse: collapse; margin: 8px 0 14px; font-size: 13px; }
.md td, .md th { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.md th { background: var(--side); font-weight: 600; }
.md h1 { font-size: 20px; margin: 22px 0 10px; } .md h2 { font-size: 16px; margin: 22px 0 8px; } .md h3 { font-size: 14px; color: var(--ink); margin: 18px 0 6px; }
.md ul, .md ol { padding-left: 22px; margin: 0 0 12px; }
.md li { margin: 3px 0; }
.md li:has(> input[type=checkbox]) { list-style: none; margin-left: -20px; }
.md li > input[type=checkbox] { margin-right: 8px; vertical-align: -2px; }
.md blockquote { margin: 0 0 12px; padding: 2px 14px; border-left: 3px solid var(--line); color: var(--muted); }
.md hr { margin: 18px 0; }

/* ───────── boxes, tables, stats ───────── */
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); padding: 18px 20px; margin: 0 0 16px; box-shadow: var(--shadow-1); }
.box > h2:first-child, .box > .section-h:first-child { margin-top: 0; }
.box-desc { color: var(--muted); font-size: 12.5px; margin: -4px 0 14px; }
details.box > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.box > summary::-webkit-details-marker { display: none; }
details.box[open] > summary { margin-bottom: 14px; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); font-size: 13px; overflow: hidden; box-shadow: var(--shadow-1); }
.tbl th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; background: var(--side); }
.tbl th, .tbl td { padding: 9px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.dim td { color: var(--muted); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl a.strong { color: var(--ink); font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin: 0 0 22px; }
.stat { display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); padding: 12px 16px; color: var(--ink); box-shadow: var(--shadow-1); }
a.stat:hover { text-decoration: none; border-color: var(--faint); }
.stat b { font-size: 22px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12px; }
.stat.err b { color: var(--err); } .stat.warn b { color: var(--warn); } .stat.ok b { color: var(--ok); } .stat.accent b { color: var(--accent); }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; display: flex; min-width: 80px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter i.over { background: var(--err); }
.meter i.done { background: var(--ok); }

/* ───────── project, cycle, close ───────── */
.proj-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.proj-head .proj-badge { width: 32px; height: 32px; font-size: 15px; border-radius: 9px; }
.cycle-pill { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink-2); font-size: 12.5px; font-weight: 500; box-shadow: var(--shadow-1); }
.cycle-pill:hover { text-decoration: none; border-color: var(--faint); }
.cycle-pill .meter { width: 60px; height: 5px; }
.goal { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 12px 16px; border-radius: var(--r-2); margin: 0 0 18px; }
.goal .i { color: var(--accent); margin-top: 2px; }
.progress { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line-2); margin: 6px 0 10px; gap: 2px; }
.progress span { background: var(--c); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); padding: 16px 18px 10px; box-shadow: var(--shadow-1); }
.chart-box svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-box .ax { stroke: var(--line); }
.chart-box .tick { fill: var(--muted); font-size: 10.5px; font-family: var(--font); }
.chart-box .scope { stroke: var(--faint); stroke-width: 1.5; fill: none; }
.chart-box .ideal { stroke: var(--faint); stroke-width: 1.2; stroke-dasharray: 4 4; fill: none; }
.chart-box .done-line { stroke: var(--accent); stroke-width: 2.2; fill: none; stroke-linejoin: round; }
.chart-box .done-area { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.chart-box .today { stroke: var(--err); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-box .dot { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart-legend i { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 6px; background: var(--accent); }
.chart-legend i.sc { background: var(--faint); } .chart-legend i.id { background: repeating-linear-gradient(90deg, var(--faint) 0 4px, transparent 4px 8px); }
.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.steps { display: flex; flex-direction: column; gap: 16px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); overflow: hidden; }
.step > header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.step-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; flex: none; }
.step > header h2 { margin: 0; font-size: 14px; }
.step > header p { margin: 0; color: var(--muted); font-size: 12.5px; }
.step .rows { border: 0; border-radius: 0; box-shadow: none; }
.step .row input[type=text] { height: 28px; width: 320px; flex: none; position: relative; z-index: 1; }
.step-foot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--side); }

/* ───────── home ───────── */
.greet { font-size: 23px; }
.queue-h { display: flex; align-items: center; gap: 8px; margin: 22px 0 8px; font-size: 13px; font-weight: 600; }
.queue-h .i { color: var(--muted); }
.queue-h.urgent { color: var(--err); } .queue-h.urgent .i { color: var(--err); }
.queue-h .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }

/* ───────── daily, intake, pages, settings ───────── */
.daily-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.daily-grid .box { padding: 14px 16px; margin: 0; }
.daily-grid .rows { box-shadow: none; }
.feed { display: flex; flex-direction: column; gap: 10px; }
.feed-item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; }
.feed-item .rows { border: 0; border-radius: 0; box-shadow: none; }
.feed-item ul { padding: 4px 14px 10px 46px; margin: 0; font-size: 12.5px; color: var(--muted); }
.feed-item li { list-style: none; padding: 2px 0; }
.feed-item li b { color: var(--ink-2); font-weight: 600; }
.asked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.asked li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); padding: 10px 14px; min-width: 0; }
.asked-h { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.asked-h a, .asked-h b { font-weight: 600; overflow-wrap: anywhere; }
.asked p { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.asked-send { margin-top: 10px; }
.inbox-files ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.inbox-files li { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; min-width: 0; }
.inbox-files a { overflow-wrap: anywhere; }
.source-col .inbox-files { border: 0; padding: 0; margin: 0 0 10px; box-shadow: none; }
.intake-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); padding: 14px 18px; margin: 0 0 10px; box-shadow: var(--shadow-1); }
.intake-card header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.intake-card header b { font-size: 14px; }
.intake-card .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 28px; align-items: start; }
.doc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); padding: 32px 40px; box-shadow: var(--shadow-1); min-height: 300px; }
.doc h1.doc-title { font-size: 26px; margin-bottom: 18px; }
.versions { position: sticky; top: 70px; font-size: 12.5px; }
.versions li { padding: 4px 0; display: flex; gap: 6px; }
.versions li.on a { font-weight: 600; color: var(--ink); }
.page-list .row .title { font-weight: 600; }
.settings-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-nav { position: sticky; top: 70px; display: flex; flex-direction: column; gap: 1px; }
.settings-nav a { display: block; padding: 6px 10px; border-radius: var(--r-1); color: var(--ink-2); font-weight: 500; }
.settings-nav a:hover { background: var(--hover); text-decoration: none; }
.label-fam { display: grid; grid-template-columns: 90px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-2); align-items: start; }
.label-fam:last-of-type { border-bottom: 0; }
.label-fam > b { font: 600 12px var(--mono); color: var(--muted); padding-top: 2px; }
.label-fam > div { display: flex; flex-wrap: wrap; gap: 5px; }

/* ───────── new ticket ───────── */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0 0 22px; }
.tpl { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--panel); color: var(--ink); box-shadow: var(--shadow-1); transition: border-color .12s; }
.tpl:hover { text-decoration: none; border-color: var(--faint); }
.tpl .i { color: var(--muted); margin-bottom: 6px; width: 18px; height: 18px; }
.tpl b { font-weight: 600; font-size: 13px; }
.tpl span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.tpl.on .i { color: var(--accent); }
.new-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.new-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 64px; }
.new-side .btn { width: 100%; }
input.title-big { height: 40px !important; font-size: 16px !important; font-weight: 600; }
.filter-menu .menu-pop { width: 280px; max-height: 70vh; }
.menu-pop label.opt input { flex: none; }
@media (max-width: 860px) { .new-layout { grid-template-columns: 1fr; } .new-side { position: static; } }

/* ───────── auth ───────── */
body.bare { display: block; background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%), var(--bg); min-height: 100vh; }
.auth { max-width: 380px; margin: 0 auto; padding: 14vh 16px 40px; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-4); padding: 28px; box-shadow: var(--shadow-3); }
.auth .brand { font-size: 20px; margin-bottom: 6px; }
.auth .brand .logo { width: 32px; height: 32px; border-radius: 7px; }
.auth h1 { font-size: 18px; margin: 18px 0 4px; }
.auth .sub { color: var(--muted); margin-bottom: 20px; }
.auth .btn { width: 100%; height: 36px; }
.auth input { height: 36px !important; }
.auth .err-box { background: var(--err-soft); color: var(--err); padding: 8px 12px; border-radius: var(--r-2); font-size: 13px; margin-bottom: 14px; }
.auth-foot { text-align: center; color: var(--faint); font-size: 12px; margin-top: 18px; }

/* ───────── responsive ───────── */
@media (max-width: 1100px) {
  .item-page { grid-template-columns: minmax(0, 1fr) 270px; }
  .item-main { padding: 24px 24px 64px; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .item-page { grid-template-columns: 1fr; }
  .item-side { position: static; height: auto; border-left: 0; border-top: 1px solid var(--line); }
  .doc-layout, .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .versions { position: static; }
  .row .meta .label, .row .meta .mod { display: none; }
  .step .row input[type=text] { width: 180px; }
}
@media (max-width: 720px) {
  .side { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-105%); transition: transform .18s ease; box-shadow: var(--shadow-3); }
  #navtoggle:checked ~ .side { transform: none; }
  #navtoggle:checked ~ .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.3); }
  .burger { display: inline-grid; }
  .top { padding: 0 14px; }
  .content { padding: 18px 16px 56px; }
  .item-main { padding: 18px 16px 56px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .row { padding: 0 10px; gap: 8px; }
  .row .meta .est, .row .meta .due { display: none; }
  .row .ref { min-width: 0; }
  .col { flex-basis: 260px; }
  .doc { padding: 20px; }
  .tbl { display: block; overflow-x: auto; }
  .filter-search { width: 140px; }
  .palette { margin-top: 6vh; }
  .step .row input[type=text] { display: none; }
  .desc-edit-btn { position: static; margin-bottom: 8px; }
  .item-title, .item-title-input { font-size: 20px !important; }
  .search-btn kbd { display: none; }
}

/* ═════════ third pass ═════════ */

/* shell: sidebar badges */
.nav-badge { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--line); color: var(--ink-2); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.nav-badge.err { background: var(--err-soft); color: var(--err); }
.nav.on .nav-badge { background: var(--accent-soft); color: var(--accent); }
.icon-btn.sm { width: 24px; height: 24px; }
.icon-btn.sm .i { width: 14px; height: 14px; }
.is-late { color: var(--err) !important; font-weight: 600; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }

/* rows adapt to their container, not the window */
.rows { container-type: inline-size; }
@container (max-width: 720px) { .row .meta .mod { display: none; } .row .meta .label:nth-of-type(n+2) { display: none; } }
@container (max-width: 520px) { .row .meta .label, .row .meta .est, .row .meta .ko { display: none; } .row .ref { min-width: 0; } }
@container (max-width: 380px) { .row .meta .due { display: none; } .row .prio { display: none; } }

/* panels and blocks */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); margin: 0 0 16px; }
.panel-h { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--line-2); min-height: 44px; }
.panel-h h2 { margin: 0; font-size: 13px; font-weight: 600; }
.panel-h > .i { color: var(--muted); }
.panel-h .grow, .block-h .grow, .activity-h .grow { flex: 1; }
.panel-b { padding: 16px 20px; }
.panel .md { font-size: 14px; }
.block { border-top: 1px solid var(--line-2); }
.block:first-child { border-top: 0; }
.block-h { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 16px; min-height: 42px; }
.block-h h3 { margin: 0; font-size: 13px; color: var(--ink); font-weight: 600; }
.block-h > .i { color: var(--muted); }
.block-b { padding: 0 12px 12px 16px; }
.rows.flat { box-shadow: none; border-radius: var(--r-2); }
.rel-kind { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--line-2); color: var(--muted); width: auto !important; white-space: nowrap; }
.rel-kind.k-blocked_by { background: var(--err-soft); color: var(--err); }
.rel-kind.k-blocks { background: var(--warn-soft); color: var(--warn); }
.add-menu .menu-pop { width: 290px; }
.pop-form { padding: 10px; }
.menu-foot { padding: 6px 4px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.menu-foot input { width: 100%; height: 28px !important; }

/* ticket header */
.item-head { margin: 0 0 18px; }
.item-ref { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.ref-key { font: 600 12px var(--mono); color: var(--muted); background: var(--line-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; flex: none; }
.item-ref a { color: var(--muted); display: inline-flex; align-items: center; gap: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.item-ref a:hover { color: var(--ink); }
.item-main .item-title, .item-main .item-title-input { margin-bottom: 4px !important; }
.meta-strip { display: none; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.meta-strip .i { width: 13px; height: 13px; }
.item-main { max-width: 860px; }

/* next step */
.next-step { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)), var(--panel); border-radius: var(--r-3); margin: 0 0 16px; }
.next-step .ns-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--panel); color: var(--accent); flex: none; box-shadow: var(--shadow-1); }
.next-step .ns-ic .i { width: 17px; height: 17px; }
.next-step .txt { flex: 1; display: flex; flex-direction: column; gap: 1px; font-size: 13px; color: var(--ink-2); }
.next-step .txt b { color: var(--ink); font-size: 13.5px; }
.next-step.err { border-color: color-mix(in srgb, var(--err) 35%, var(--line)); background: linear-gradient(0deg, var(--err-soft), var(--err-soft)), var(--panel); }
.next-step.err .ns-ic { color: var(--err); }

/* activity: its own band, a rail with avatars and event glyphs */
.activity { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.activity-h { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; }
.activity-h h2 { margin: 0; font-size: 15px; }
.activity-h > .i { color: var(--muted); }
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 13px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 1px; }
.tl > li, .tl-more ul > li { position: relative; }
.tl-e { display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 3px 0; font-size: 12.5px; color: var(--muted); }
.rail-ic { width: 28px; height: 22px; display: grid; place-items: center; flex: none; position: relative; z-index: 1; }
.rail-ic::before { content: ""; position: absolute; inset: 1px 3px; background: var(--bg); border-radius: 50%; z-index: -1; }
.rail-ic .i { width: 14px; height: 14px; color: var(--faint); }
.tl-e .ev-t { flex: 1; min-width: 0; }
.tl-e b { color: var(--ink-2); font-weight: 600; }
.tl-e s { color: var(--faint); }
.tl-e .note, .tl-e .ev-d { color: var(--faint); }
.tl-e time { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.tl-more summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 28px; font-size: 12.5px; color: var(--accent); cursor: pointer; font-weight: 500; }
.tl-more summary::-webkit-details-marker { display: none; }
.tl-more ul { list-style: none; padding: 0; margin: 0; }
.tl-more details[open] > summary { display: none; }
.tl-c { display: flex; gap: 10px; padding: 8px 0; }
.rail-av { width: 28px; flex: none; display: flex; justify-content: center; position: relative; z-index: 1; padding-top: 8px; }
.rail-av .avatar { width: 26px; height: 26px; font-size: 10px; box-shadow: 0 0 0 3px var(--bg); }
.tl-c .comment { flex: 1; min-width: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--panel); box-shadow: var(--shadow-1); }
.tl-c .comment > header { display: flex; align-items: center; gap: 8px; padding: 8px 10px 0 14px; font-size: 13px; }
.tl-c .comment > header time { color: var(--muted); font-size: 12px; }
.tl-c .c-body { padding: 4px 14px 12px; }
.tl-c .c-edit { padding: 8px 10px 10px; }
.tl-c.k-proof .comment { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.tl-c.k-validation .comment { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.tl-c.k-ko .comment { border-color: color-mix(in srgb, var(--err) 45%, var(--line)); }
.tl-c.k-system .comment { background: var(--side); box-shadow: none; }
.tl-c .kind { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.tl-c.k-proof .kind { background: var(--accent-soft); color: var(--accent); }
.tl-c.k-validation .kind { background: var(--ok-soft); color: var(--ok); }
.tl-c.k-ko .kind { background: var(--err-soft); color: var(--err); }
.tl-c.k-blocked .kind { background: var(--warn-soft); color: var(--warn); }
.tl-c.k-system .kind { background: var(--line-2); color: var(--muted); }
.tl.only-comments > .tl-e, .tl.only-comments > .tl-more { display: none; }
.tl-compose { display: flex; gap: 10px; margin-top: 12px; }
.grow-1 { flex: 1; min-width: 0; }

/* editor */
.toolbar { display: flex; align-items: center; gap: 2px; padding: 5px 6px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.tb { display: inline-grid; place-items: center; width: 28px; height: 26px; border: 0; background: none; border-radius: 5px; color: var(--muted); cursor: pointer; }
.tb:hover { background: var(--hover); color: var(--ink); }
.tb .i { width: 15px; height: 15px; }
.tb-sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }
.composer.previewing .toolbar .tb:not([data-attach]) { visibility: hidden; }
.composer textarea.mono { font-size: 12.5px; }

/* pickers */
.picker { display: block; width: 100%; }
.picker-btn { display: flex !important; align-items: center; gap: 8px; min-height: var(--ctl); padding: 3px 8px 3px 10px; border: 1px solid var(--field-line); border-radius: var(--r-2); background: var(--field); color: var(--ink); cursor: pointer; }
.picker-btn:hover { border-color: var(--faint); }
.picker[open] > .picker-btn { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.picker-btn > .i:not(.caret) { color: var(--muted); }
.picker-btn .caret { margin-left: auto; width: 14px; height: 14px; color: var(--faint); flex: none; }
.picker-val { display: inline-flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.picker-chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 0; }
.picker .menu-pop { width: 100%; min-width: 240px; }
.picker:not([data-multi]) .opt input { position: absolute; opacity: 0; pointer-events: none; }
.picker .opt .sel-mark { visibility: hidden; }
.picker .opt:has(input:checked) { background: var(--accent-soft); }
.picker .opt:has(input:checked) .sel-mark { visibility: visible; }
.opt-body { display: inline-flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ph { color: var(--faint); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-l { font-size: 12px; color: var(--muted); font-weight: 500; }

/* side panel */
.item-side { gap: 0; padding: 14px 14px 32px; }
.item-side > .state-btn { margin-bottom: 12px; }
.side-group { padding: 12px 2px 10px; border-top: 1px solid var(--line); }
.side-group .side-h2 { margin: 0 0 6px; }
.state-ro { display: flex; gap: 8px; align-items: center; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--panel); font-weight: 600; }
.prop-menu { width: 100%; }
.prop-menu .menu-pop { min-width: 240px; }
.prop .v .ro { display: flex; align-items: center; gap: 7px; min-height: 28px; padding: 2px 7px; }
.prop .v > .menu > summary .i, .prop .v .ro .i { color: var(--muted); width: 14px; height: 14px; }
.prop .v > .menu > summary .caret { display: none; }
.prop .v > .menu > summary a { color: var(--ink); }
.date-pop { min-width: 230px; }
.date-pop input[type=date] { width: 100%; }
.add-label > summary { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border: 1px dashed var(--line); border-radius: 999px; font-size: 11.5px; color: var(--muted); }
.add-label > summary .i { width: 12px; height: 12px; }
.add-label .menu-pop { width: 280px; }
.label-x { display: inline-flex; align-items: center; position: relative; }
.label-x button { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); display: inline-grid; place-items: center; width: 15px; height: 15px; margin: 0; padding: 0; border-radius: 50%; opacity: 0; transition: opacity .1s; background: var(--hover); }
.label-x:hover button, .label-x button:focus-visible { opacity: 1; }
.label-x:hover .label { padding-right: 22px; }
.label-x button .i { width: 9px; height: 9px; }
.time-sum { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; }
.time-sum b { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.log-menu .menu-pop { width: 300px; }
.log-pop { padding: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; }
.chip-opt { position: relative; }
.chip-opt input { position: absolute; opacity: 0; }
.chip-opt span { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; cursor: pointer; color: var(--ink-2); background: var(--panel); }
.chip-opt input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.side-details li { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 3px 0; }
.side-details .i { width: 13px; height: 13px; color: var(--faint); }

/* new ticket */
.new-main, .new-side { margin: 0; }
.new-side .panel-b { padding: 16px; }
.new-main input.title-big { border-color: transparent !important; background: transparent !important; font-size: 19px !important; padding: 0 !important; height: 34px !important; box-shadow: none !important; }

@media (max-width: 860px) {
  .meta-strip { display: flex; }
}
@media (max-width: 720px) {
  .panel-b { padding: 14px; }
  .tl::before { left: 11px; }
  .rail-av, .rail-ic { width: 24px; }
  .rail-av .avatar { width: 22px; height: 22px; }
}

/* swatches */
.swatch { display: inline-block; width: 22px; height: 22px; border-radius: 6px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); cursor: pointer; vertical-align: middle; }
.swatch-menu .menu-pop { min-width: 0; width: auto; }
.swatch-grid { display: grid; grid-template-columns: repeat(6, 22px); gap: 6px; padding: 6px; }
.swatch-grid input { position: absolute; opacity: 0; }
.swatch-grid input:checked + .swatch { box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px var(--accent); }

/* side panel: full-height column, sticky content that never clips its menus */
.item-page .item-side { position: static; height: auto; overflow: visible; padding: 0; }
.side-in { position: sticky; top: 46px; padding: 14px 14px 32px; display: flex; flex-direction: column; }
.side-in > .state-btn { margin-bottom: 12px; }
.item-side .prop-menu .menu-pop, .item-side .add-label .menu-pop { left: auto; right: 0; }
@media (max-width: 860px) { .side-in { position: static; } }

/* compact template cards */
.tpl-grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 6px; margin-bottom: 18px; }
.tpl { display: grid; grid-template-columns: 18px 1fr; column-gap: 10px; row-gap: 0; align-items: center; padding: 8px 12px; }
.tpl .i { margin: 0; grid-row: span 2; }
.tpl b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl span { font-size: 11px; }

.inline.nowrap { flex-wrap: nowrap; }
.inline.nowrap input { min-width: 160px; }

@media (max-width: 720px) {
  .next-step { flex-wrap: wrap; align-items: flex-start; }
  .next-step .txt { flex: 1 1 calc(100% - 46px); }
  .next-step .acts { width: 100%; padding-left: 46px; }
  .item-ref a { display: none; }
}

/* ═════════ workspace layout (views) and scrollbars ═════════ */

/* Scrollbars: thin, and only visible while the pointer is over the scrolling area. */
:root { --scroll: color-mix(in srgb, var(--muted) 40%, transparent); --scroll-h: color-mix(in srgb, var(--muted) 70%, transparent); }
* { scrollbar-width: thin; scrollbar-color: transparent transparent; }
*:hover, *:focus-within { scrollbar-color: var(--scroll) transparent; }
html { scrollbar-color: var(--scroll) transparent; }
@supports not (scrollbar-color: red blue) {
  ::-webkit-scrollbar { width: 9px; height: 9px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: transparent; border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
  :hover::-webkit-scrollbar-thumb { background-color: var(--scroll); }
  ::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-h); }
}

/* App pages fill the window: a fixed header area and a body that scrolls on its own. */
main:has(> .content.app) { height: 100vh; height: 100dvh; min-height: 0; }
.content.app { flex: 1; min-height: 0; padding: 0; max-width: none; display: flex; flex-direction: column; }
.ws { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ws-head { display: flex; align-items: center; gap: 12px; padding: 8px 16px 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; flex: none; }
.ws-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.ws-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ws-chips { display: flex; align-items: center; gap: 6px; padding: 6px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; min-height: 40px; flex: none; }
.ws-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 20px 24px; position: relative; }
.ws-body .group-head { top: 0; }
.ws-body.is-board { overflow: hidden; padding: 0; display: flex; }
.ws-body.is-board > .empty-state { margin: 16px 20px; flex: 1; align-self: flex-start; }
.ws-body.is-board .board { flex: 1; min-width: 0; height: 100%; padding: 12px 16px 12px 16px; align-items: stretch; gap: 10px; }
.ws-body.is-board .col { max-height: none; }
.ws-body.is-board .cards { flex: 1; }

/* Search inside the header */
.ws-search { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border: 1px solid var(--field-line); border-radius: var(--r-2); background: var(--field); width: 190px; }
.ws-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.ws-search .i { width: 14px; height: 14px; color: var(--faint); }
.ws-search input { border: 0 !important; box-shadow: none !important; background: transparent !important; height: 26px !important; padding: 0 !important; flex: 1; min-width: 0; font-size: 13px; }

/* View switcher */
.view-switch > summary { display: flex; align-items: center; gap: 10px; padding: 3px 10px 3px 6px; border-radius: var(--r-2); }
.view-switch > summary:hover { background: var(--hover); }
.view-switch > summary > .i:first-child { width: 28px; height: 28px; padding: 6px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.view-switch > summary .caret { width: 14px; height: 14px; color: var(--faint); }
.vs-cur { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.vs-cur b { font-size: 15px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vs-group { font-size: 11px; color: var(--muted); font-weight: 500; }
.view-switch .menu-pop { width: 340px; max-height: 72vh; }
.menu-pop .vs-item { align-items: flex-start; white-space: normal; padding: 7px 8px; }
.vs-item .i { margin-top: 2px; }
.vs-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.vs-name { font-weight: 500; }
.vs-desc { font-size: 11.5px; color: var(--muted); }
.vs-item.on { background: var(--accent-soft); }

/* Board columns share the width; empty ones collapse into slim strips that still accept drops. */
.board .col { flex: 1 0 272px; max-width: 460px; }
.board .col.empty { flex: 0 0 42px; min-width: 42px; max-width: 42px; cursor: default; transition: flex-basis .15s, max-width .15s; }
.board .col.empty > header { flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; writing-mode: vertical-rl; }
.board .col.empty > header .si { transform: rotate(90deg); }
.board .col.empty > header .col-est { display: none; }
.board .col.empty .cards { display: none; }
.board.dragging .col.empty { flex-basis: 160px; max-width: 160px; }
.board.dragging .col.empty > header { writing-mode: horizontal-tb; flex-direction: row; padding: 10px 12px 8px; }
.board.dragging .col.empty > header .si { transform: none; }
.board.dragging .col.empty .cards { display: flex; }
.col { background: color-mix(in srgb, var(--side) 70%, transparent); }
.col > header { position: sticky; top: 0; }
.cards { padding: 2px 6px 8px; }

@media (max-width: 720px) {
  .ws-head { padding: 8px 12px; }
  .ws-tools { width: 100%; }
  .ws-search { flex: 1; width: auto; }
  .ws-chips { padding: 6px 12px; }
  .ws-body { padding: 12px; }
  .ws-body.is-board .board { padding: 10px 12px; }
  .board .col { flex-basis: 82vw; }
}

.cycle-pill { flex: none; white-space: nowrap; }
.ws-title .cycle-pill { height: 26px; font-size: 12px; }
@media (max-width: 1100px) { .ws-title .cycle-pill .muted { display: none; } }
@media (max-width: 720px) { .ws-title .cycle-pill .meter { display: none; } }

/* ═════════ polish pass ═════════ */

/* Collapsed (empty) column: icon on top, the name written vertically, the count under it — all inside the strip. */
.board .col.empty > header { writing-mode: horizontal-tb; flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px; padding: 12px 0 10px; overflow: hidden; }
.board .col.empty > header .si { transform: none; flex: none; }
.board .col.empty > header b { writing-mode: vertical-rl; white-space: nowrap; line-height: 1; }
.board .col.empty > header .count { margin: 0; }
.board.dragging .col.empty > header { flex-direction: row; padding: 10px 12px 8px; }
.board.dragging .col.empty > header b { writing-mode: horizontal-tb; }

/* Cards: priority and estimate up top, so the footer never leaves a lone badge on its own line. */
.card-top { gap: 6px; }
.card-top .grow { flex: 1; }
.card-top .prio { display: inline-flex; }
.card-foot:not(:has(*)) { display: none; }

/* Rows: the title keeps room; actions shrink to icons when the row is narrow. */
.row .meta { max-width: 46%; }
.row-act { display: inline-flex; gap: 6px; align-items: center; }
@container (max-width: 900px) { .row:has(.row-act) .meta .label, .row:has(.row-act) .meta .mod { display: none; } }
@container (max-width: 780px) { .row-act .bt { display: none; } .row-act .btn.sm { width: 28px; padding: 0; } }

/* Properties: placeholders readable, every value lined up behind its icon. */
.ph { color: var(--muted); opacity: .75; }
.prop .v .ro, .prop .v > .menu > summary { min-height: 30px; }

/* Stat tiles: zero is quiet, whatever its colour would be. */
.stat.zero b { color: var(--faint) !important; }

/* Small things */
.card .avatars.none { width: 18px; height: 18px; }
.board .col > header .count { margin-left: 2px; }

/* ═════════ buttons ═════════
   One system for every clickable control: primary (the main action), secondary (default .btn),
   ghost (low emphasis), danger (destructive: outline, or .solid), ok (validate). Sizes: .sm 26px, default 30px, .lg 36px. */

:root {
  --btn-primary: #5b5bd6; --btn-primary-h: #4e4ec9; --btn-primary-a: #4545b8; --btn-primary-ink: #ffffff; --btn-primary-ring: rgba(91, 91, 214, .35);
  --btn-bg: #ffffff; --btn-bg-h: #f4f4f6; --btn-bg-a: #ebebef; --btn-line: #dcdde2; --btn-line-h: #c8c9d0; --btn-ink: var(--ink);
  --btn-shadow: 0 1px 2px rgba(16, 17, 24, .06);
  --btn-danger: #d1343b; --btn-danger-h: #bd2b32; --btn-ok: #1f8a4c; --btn-ok-h: #1a7a43;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --btn-primary: #5d5ce6; --btn-primary-h: #6b6af0; --btn-primary-a: #5352d4; --btn-primary-ink: #ffffff; --btn-primary-ring: rgba(120, 119, 245, .45);
    --btn-bg: #1d1e23; --btn-bg-h: #24252b; --btn-bg-a: #2a2b32; --btn-line: #30323a; --btn-line-h: #3d3f48; --btn-ink: #e6e7ea;
    --btn-shadow: 0 1px 0 rgba(0, 0, 0, .4);
    --btn-danger: #e5484d; --btn-danger-h: #ec5d61; --btn-ok: #23a45a; --btn-ok-h: #2cb565;
  }
}
:root[data-theme="dark"] {
  --btn-primary: #5d5ce6; --btn-primary-h: #6b6af0; --btn-primary-a: #5352d4; --btn-primary-ink: #ffffff; --btn-primary-ring: rgba(120, 119, 245, .45);
  --btn-bg: #1d1e23; --btn-bg-h: #24252b; --btn-bg-a: #2a2b32; --btn-line: #30323a; --btn-line-h: #3d3f48; --btn-ink: #e6e7ea;
  --btn-shadow: 0 1px 0 rgba(0, 0, 0, .4);
  --btn-danger: #e5484d; --btn-danger-h: #ec5d61; --btn-ok: #23a45a; --btn-ok-h: #2cb565;
}

.btn, button.btn, a.btn, label.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--btn-line);
  background: var(--btn-bg); color: var(--btn-ink); box-shadow: var(--btn-shadow);
  font: 500 13px/1 var(--font); letter-spacing: -.005em; white-space: nowrap; cursor: pointer; user-select: none; text-decoration: none;
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, color .12s ease, transform .06s ease;
}
.btn:hover { background: var(--btn-bg-h); border-color: var(--btn-line-h); text-decoration: none; color: var(--btn-ink); }
.btn:active { background: var(--btn-bg-a); transform: translateY(.5px); box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--btn-primary-ring); }
.btn .i { width: 15px; height: 15px; stroke-width: 2; flex: none; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

/* sizes */
.btn.sm { height: 26px; padding: 0 9px; font-size: 12.5px; border-radius: 6px; gap: 5px; }
.btn.sm .i { width: 14px; height: 14px; }
.btn.lg { height: 36px; padding: 0 16px; font-size: 14px; border-radius: 8px; }
.btn.icon-only, .row-act .btn.sm:has(> .bt[style*="none"]) { padding: 0; width: 30px; }
.btn.sm.icon-only { width: 26px; }

/* primary: solid, white text, a subtle top highlight; the one main action of a view */
.btn.primary {
  background: var(--btn-primary); border-color: transparent; color: var(--btn-primary-ink); font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 17, 24, .18), inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 0 0 1px rgba(0, 0, 0, .08);
}
.btn.primary:hover { background: var(--btn-primary-h); color: var(--btn-primary-ink); border-color: transparent; }
.btn.primary:active { background: var(--btn-primary-a); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2); }
.btn.primary .i { color: inherit; }

/* ghost: no frame until hovered; for Cancel, secondary actions in toolbars */
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); border-color: transparent; color: var(--ink); }
.btn.ghost:active { background: var(--active); }

/* danger: outline by default (KO Fallback, Remove), solid when it's the confirming action */
.btn.danger { color: var(--btn-danger); }
.btn.danger:not(.ghost) { border-color: color-mix(in srgb, var(--btn-danger) 35%, var(--btn-line)); }
.btn.danger:hover { color: var(--btn-danger-h); background: color-mix(in srgb, var(--btn-danger) 9%, var(--btn-bg)); border-color: color-mix(in srgb, var(--btn-danger) 55%, var(--btn-line)); }
.btn.danger.ghost:hover { background: color-mix(in srgb, var(--btn-danger) 10%, transparent); border-color: transparent; }
.btn.danger.solid { background: var(--btn-danger); border-color: transparent; color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 17, 24, .18), inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn.danger.solid:hover { background: var(--btn-danger-h); color: #fff; }

/* ok: validating actions (QA OK, Done) */
.btn.ok { background: var(--btn-ok); border-color: transparent; color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 17, 24, .18), inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn.ok:hover { background: var(--btn-ok-h); color: #fff; border-color: transparent; }

/* Buttons used as menu triggers look pressed while their menu is open */
details[open] > summary > .btn:not(.primary) { background: var(--btn-bg-a); border-color: var(--btn-line-h); }
details[open] > summary > .btn.ghost { background: var(--active); }

/* Icon buttons, toolbar buttons, segmented controls: same radius, hover and focus language */
.icon-btn { border-radius: 6px; transition: background-color .12s, color .12s; }
.icon-btn:focus-visible, .tb:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--btn-primary-ring); }
.tb { border-radius: 6px; transition: background-color .12s, color .12s; }
.seg { background: var(--btn-bg-a); border-color: var(--btn-line); border-radius: 8px; }
.seg a { border-radius: 6px; transition: background-color .12s, color .12s; }
.seg a.on { background: var(--btn-bg); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 1px var(--btn-line); }
.editor-tabs button { border-radius: 6px; }
.chip-opt input:checked + span { background: var(--btn-primary); border-color: transparent; color: #fff; }
.picker[open] > .picker-btn, .ws-search:focus-within, input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px var(--btn-primary-ring) !important; }

/* Footers: shortcut hint on the left, actions on the right, same height */
.composer footer, .modal footer, .menu-actions { gap: 8px; }
.composer footer .hint, .modal .hint { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
kbd { height: 20px; display: inline-flex; align-items: center; font-weight: 600; background: var(--btn-bg); border-color: var(--btn-line); }

/* Full-width buttons where the layout asks for it */
.auth .btn, .new-side .btn.primary { width: 100%; height: 36px; font-size: 14px; }

/* workspace header: nothing overlaps; the pill and search compact by the header width, tools wrap last */
.ws-head { container-type: inline-size; container-name: wshead; }
.ws-title { flex: 1 0 auto; min-width: 0; }
.ws-tools { margin-left: auto; }
.ws-search { flex: 0 1 190px; min-width: 120px; width: auto; }
@container wshead (max-width: 1050px) { .ws-title .cycle-pill .muted { display: none; } }
@container wshead (max-width: 900px) { .ws-title .cycle-pill .meter { display: none; } .ws-tools .seg a { padding: 0 7px; } }
@container wshead (max-width: 780px) { .ws-tools .seg a { font-size: 0; gap: 0; } .ws-tools .seg a .i { width: 15px; height: 15px; } }

/* ═════════ polish 2 ═════════ */

/* Checkboxes and radios drawn in the theme (the browser's light squares looked foreign in dark mode). */
input[type=checkbox], input[type=radio] {
  appearance: none; -webkit-appearance: none; margin: 0; width: 16px; height: 16px; flex: none; cursor: pointer;
  display: inline-grid; place-items: center; vertical-align: -3px;
  border: 1.5px solid var(--btn-line-h); background: var(--field); border-radius: 4px;
  transition: background-color .12s, border-color .12s, box-shadow .12s;
}
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--btn-primary); }
input[type=checkbox]:checked { background: var(--btn-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3.5 8.3 3 3 6-6.3'/%3E%3C/svg%3E") center / 12px no-repeat; border-color: var(--btn-primary); }
input[type=radio]:checked { border-color: var(--btn-primary); background: var(--btn-primary); box-shadow: inset 0 0 0 3px var(--field); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--btn-primary-ring); }
input[type=radio]:checked:focus-visible { box-shadow: inset 0 0 0 3px var(--field), 0 0 0 3px var(--btn-primary-ring); }
input[type=checkbox]:disabled, input[type=radio]:disabled { cursor: default; opacity: .7; }
.md li > input[type=checkbox] { width: 15px; height: 15px; vertical-align: -3px; margin-right: 8px; }

/* Cycle close: the status field goes under its ticket, so the title stays readable. */
.carry-item { border-bottom: 1px solid var(--line-2); }
.carry-item:last-child { border-bottom: 0; }
.carry-item .row { border-bottom: 0; }
.carry-status { display: flex; align-items: center; gap: 8px; padding: 0 14px 10px 50px; }
.carry-status .i { width: 14px; height: 14px; color: var(--faint); flex: none; }
.carry-status input { flex: 1; height: 30px !important; font-size: 13px; }
.step .carry-status input[type=text] { display: block !important; width: auto; }

/* Load: an empty track when no capacity is set, so every row reads the same */
.meter.no-cap { background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 10px); }
.load .meter, .tbl .meter { margin-bottom: 4px; }

@media (max-width: 720px) { .carry-status { padding-left: 14px; } }

/* ═════════ settings surfaces ═════════ */

/* Fields: values in regular weight (they inherited the label's weight), a touch more air. */
input, select, textarea { font-weight: 400; }
label > input:not([type=checkbox]):not([type=radio]), label > select, label > textarea { margin-top: 6px; }
label { color: var(--ink-2); font-size: 12.5px; }
textarea { min-height: 72px; }
code { font-family: var(--mono); font-size: 12px; background: var(--line-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }

/* The card */
.set { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin: 0 0 20px; box-shadow: var(--shadow-1); overflow: hidden; scroll-margin-top: 64px; }
.set-h { padding: 18px 24px 16px; border-bottom: 1px solid var(--line-2); }
.set-h h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.set-h p { margin: 4px 0 0; color: var(--muted); font-size: 13px; max-width: 640px; line-height: 1.5; }
.set-b { padding: 4px 24px; }
.set-b:empty { display: none; }
.set-b.flush { padding: 0; }
.set-b.flush .tbl { border: 0; border-radius: 0; box-shadow: none; }
.set-b.flush .tbl th:first-child, .set-b.flush .tbl td:first-child { padding-left: 24px; }
.set-b.flush .tbl th:last-child, .set-b.flush .tbl td:last-child { padding-right: 24px; }
.set-b > .label-fam:first-child { padding-top: 16px; }
.set-b > .label-fam:last-child { padding-bottom: 16px; }
.set-b > .link-list { padding: 16px 0; }
.set-b > p { padding: 16px 0; }
.set-f { display: flex; align-items: center; gap: 12px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 24px; background: var(--side); border-top: 1px solid var(--line); }
.set-f .note { margin-right: auto; color: var(--muted); font-size: 12.5px; }
.set-f form.inline { margin: 0; flex-wrap: wrap; justify-content: flex-end; }
.set-f form.inline input, .set-f form.inline select { height: 28px; }

/* Rows: label and hint on the left, control on the right */
.set-row { display: grid; grid-template-columns: minmax(170px, 36%) minmax(0, 1fr); gap: 28px; padding: 18px 0; border-bottom: 1px solid var(--line-2); align-items: start; }
.set-row:last-child { border-bottom: 0; }
.set-l b { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.set-l span { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.5; }
.set-c { min-width: 0; padding-top: 1px; }
.set-c > input:not([type=checkbox]):not([type=radio]), .set-c > select, .set-c > textarea { width: 100%; max-width: 460px; }
.ctl-pair { display: flex; gap: 8px; flex-wrap: wrap; max-width: 460px; }
.ctl-pair > * { flex: 1 1 160px; }

/* Locked field: reads as information, not as a disabled input */
.locked-field { display: inline-flex; align-items: center; gap: 8px; height: var(--ctl); padding: 0 12px; border: 1px dashed var(--line); border-radius: var(--r-2); color: var(--ink); font: 600 13px var(--mono); max-width: 460px; }
.locked-field .i { width: 14px; height: 14px; color: var(--faint); }
.locked-field small { font: 400 12px var(--font); color: var(--muted); margin-left: 4px; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; width: 34px; height: 20px; flex: none; border-radius: 999px; background: var(--btn-line-h); transition: background-color .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s ease; }
.switch input:checked + .track { background: var(--btn-primary); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--btn-primary-ring); }

/* Danger card */
.danger-card { border-color: color-mix(in srgb, var(--btn-danger) 30%, var(--line)); }
.danger-card .set-h h2 { color: var(--btn-danger); }
.danger-card .set-h { border-bottom: 0; }
.danger-card .set-f { background: color-mix(in srgb, var(--btn-danger) 5%, var(--side)); }

/* Settings navigation */
.settings-layout { grid-template-columns: 196px minmax(0, 1fr); gap: 32px; }
.settings-nav { gap: 2px; }
.settings-nav a { display: flex; align-items: center; gap: 9px; padding: 7px 10px; font-size: 13.5px; }
.settings-nav a .i { width: 15px; height: 15px; color: var(--muted); }
.settings-nav a:hover .i { color: var(--ink); }

@media (max-width: 860px) {
  .set-row { grid-template-columns: 1fr; gap: 10px; }
  .settings-nav a { padding: 5px 9px; }
}
@media (max-width: 720px) {
  .set-h, .set-f { padding-left: 16px; padding-right: 16px; }
  .set-b { padding: 4px 16px; }
  .set-b.flush .tbl th:first-child, .set-b.flush .tbl td:first-child { padding-left: 16px; }
}

.person { align-items: center; gap: 10px; }
.person b { font-weight: 600; }
.locked-field { border-color: var(--btn-line-h); background: color-mix(in srgb, var(--field) 50%, transparent); }

.avatar.xl { width: 44px; height: 44px; font-size: 15px; }
.theme-seg a { cursor: pointer; }
.page-head .person h1 { margin: 0; }

/* ───────── PM screens (command center, overview) ───────── */
.hbar { position: relative; height: 8px; border-radius: 4px; background: var(--line-2); min-width: 90px; }
.hbar.wide { height: 10px; margin: 2px 0 8px; }
.hbar i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--accent); }
.hbar i.ok { background: var(--ok); } .hbar i.warn { background: var(--warn); } .hbar i.err { background: var(--err); }
.hbar b { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.hbar.empty { background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 10px); }
.health-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); padding: 14px 18px; margin: 0 0 22px; box-shadow: var(--shadow-1); }
.health-card .goal { margin: 10px 0 0; }
.tbl-wrap { overflow-x: auto; }
.team-tbl th, .team-tbl td { padding: 7px 10px; white-space: nowrap; }
.team-tbl .heat { display: inline-block; min-width: 24px; padding: 1px 6px; border-radius: 10px; text-align: center; font-weight: 600; background: var(--side); color: var(--ink-2); }
.team-tbl .heat.zero { background: none; color: var(--faint); font-weight: 400; }
.team-tbl .heat.info { background: var(--accent-soft, var(--side)); color: var(--accent); }
.team-tbl .heat.err { background: var(--err-soft, var(--side)); color: var(--err); }
.team-tbl .heat.ok { background: var(--ok-soft, var(--side)); color: var(--ok); }
.team-tbl .load-mini { display: inline-flex; align-items: center; gap: 8px; }
.team-tbl .load-mini .meter { width: 80px; height: 6px; }
.avatar.none { background: var(--line); color: var(--muted); }
.status-board td.num, .status-board th.num { text-align: right; width: 1%; white-space: nowrap; }
.status-board .hcell { min-width: 120px; }
.status-board .n { display: inline-block; min-width: 22px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.status-board .n.err { color: var(--err); } .status-board .n.warn { color: var(--warn); } .status-board .n.zero { color: var(--faint); font-weight: 400; }
.proj-cell { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.proj-cell small { display: block; color: var(--muted); font-size: 11.5px; }
.attn { list-style: none; margin: 0 0 16px; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; box-shadow: var(--shadow-1); }
.attn li + li { border-top: 1px solid var(--line-2); }
.attn a { display: flex; align-items: center; gap: 12px; padding: 10px 14px; color: var(--ink); }
.attn a:hover { background: var(--hover); text-decoration: none; }
.attn-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--line-2); color: var(--muted); flex: none; }
.tone-danger .attn-ic { background: var(--err-soft); color: var(--err); }
.tone-warn .attn-ic { background: var(--warn-soft); color: var(--warn); }
.tone-info .attn-ic { background: var(--accent-soft); color: var(--accent); }
.attn-t { flex: 1; min-width: 0; }
.attn-t small { display: block; color: var(--muted); font-size: 12px; }
.attn-p { margin-left: 8px; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.attn-n { font-weight: 650; font-variant-numeric: tabular-nums; }
.attn a > .i:last-child { color: var(--faint); }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; }
@media (max-width: 900px) { .ov-grid { grid-template-columns: 1fr; } }
.ready { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.ready li { display: flex; gap: 10px; align-items: flex-start; }
.ready li > .i { color: var(--err); margin-top: 2px; }
.ready li.ok > .i { color: var(--ok); }
.ready small { display: block; color: var(--muted); font-size: 12px; }
details.q { padding: 10px 14px; margin-bottom: 10px; }
details.q > summary { font-size: 13px; flex-wrap: wrap; }
details.q > summary .muted { font-weight: 400; }
details.q[open] > summary { margin-bottom: 8px; }
.refine-item p { margin: 0 0 6px 36px; }

/* ───────── cycles: history, days off, scope changes ───────── */
.vbars { display: flex; align-items: flex-end; gap: 14px; height: 150px; padding: 4px 4px 0; }
.vbar { flex: 1; max-width: 64px; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; color: var(--ink); }
.vbar:hover { text-decoration: none; }
.vbar b { font-size: 12px; font-variant-numeric: tabular-nums; }
.stackb { position: relative; flex: 1; width: 100%; display: flex; align-items: flex-end; }
.stackb i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 4px 4px 0 0; background: var(--accent); }
.stackb i.ghost { background: var(--accent-soft); }
.vbar-label { font-size: 11.5px; color: var(--muted); }
.off-days { display: flex; flex-wrap: wrap; gap: 3px; }
.day-chip { position: relative; }
.day-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-chip span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line); font-size: 10px; line-height: 1.05; color: var(--muted); cursor: pointer; background: var(--panel); user-select: none; }
.day-chip span b { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.day-chip input:checked + span { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.day-chip input:checked + span b { color: var(--warn); }
.day-chip input:disabled + span { cursor: default; opacity: .75; }
.day-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.scope-list { list-style: none; margin: 0; padding: 0; }
.scope-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.scope-list li a { font-weight: 600; white-space: nowrap; }
.scope-list .grow-1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ───────── calendar ───────── */
.i.flip { transform: scaleX(-1); }
.cal-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-bar .month { margin: 0 6px; font-size: 16px; }
.cal-bar .grow-1 { flex: 1; }
.pdot { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--h) 60% 55%); }
.cal-legend { margin-bottom: 10px; }
.cal-legend i.ev { display: inline-block; width: 12px; height: 10px; padding: 0; margin-right: 5px; vertical-align: -1px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; }
.dow { background: var(--side); font-size: 12px; font-weight: 600; color: var(--muted); padding: 7px 10px; }
.cal-day { min-height: 112px; background: var(--panel); padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.weekend { background: color-mix(in srgb, var(--side) 60%, var(--panel)); }
.cal-day.other { background: var(--side); }
.cal-day.other .date { opacity: .45; }
.cal-day .date { font-size: 12px; font-weight: 600; color: var(--ink-2); display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; }
.cal-day.today .date { background: var(--accent); color: var(--accent-ink); }
.stripes { display: flex; gap: 2px; height: 3px; margin: -2px -2px 1px; }
.stripes span { flex: 1; border-radius: 2px; background: hsl(var(--h) 60% 55%); opacity: .8; }
.ev { display: block; font-size: 11.5px; line-height: 1.35; padding: 1px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); border-left: 3px solid hsl(var(--h, 240) 55% 55%); background: var(--line-2); }
a.ev:hover { text-decoration: none; filter: brightness(.97); }
.ev.cycle { font-weight: 600; color: var(--ink); background: transparent; }
.ev.module { background: var(--accent-soft); color: var(--accent); }
.ev.module.done { opacity: .6; }
.ev.late { background: var(--err-soft); color: var(--err); }
.ev.off { background: repeating-linear-gradient(135deg, var(--line-2) 0 4px, transparent 4px 8px); color: var(--muted); }
.ev.more { border: 0; background: none; color: var(--muted); }
@media (max-width: 720px) {
  .cal { grid-template-columns: 1fr; }
  .dow, .cal-day.other { display: none; }
  .cal-day { min-height: 0; }
}

/* ───────── timeline ───────── */
.gantt-box { padding: 14px 16px; }
.gantt { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.gl { padding: 8px 12px 8px 0; font-size: 13px; display: grid; align-content: center; min-height: 44px; border-top: 1px solid var(--line-2); min-width: 0; }
.gl.head { border-top: 0; min-height: 0; padding: 0; }
.gl a { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl small { color: var(--muted); font-size: 11.5px; }
.gt { position: relative; min-height: 44px; border-top: 1px solid var(--line-2); background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(100% / 8 - 1px), var(--line-2) calc(100% / 8 - 1px), var(--line-2) calc(100% / 8)); }
.gweeks { position: relative; height: 24px; }
.gweeks span { position: absolute; font-size: 11px; color: var(--muted); top: 4px; padding-left: 4px; }
.todayline { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); z-index: 2; }
.seg-bar { position: absolute; top: 10px; height: 24px; border-radius: 6px; background: hsl(var(--h) 60% 55% / .18); border: 1px solid hsl(var(--h) 55% 50% / .5); color: var(--ink); font-size: 11.5px; font-weight: 600; padding: 3px 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.seg-bar.closed { opacity: .55; }
.seg-bar:hover { text-decoration: none; filter: brightness(1.05); }
.mbar { position: absolute; top: 12px; height: 20px; border-radius: 6px; background: hsl(var(--h) 55% 55% / .22); overflow: hidden; }
.mbar span { display: block; height: 100%; background: hsl(var(--h) 55% 50%); }
.mbar.late { background: var(--err-soft); box-shadow: inset 0 0 0 1px var(--err); }
.mbar.late span { background: var(--err); }
.mslip { position: absolute; top: 12px; height: 20px; border: 1.5px dashed var(--err); border-left: 0; border-radius: 0 6px 6px 0; }
.mend { position: absolute; top: 8px; height: 28px; width: 2px; background: var(--ok); }
.t-err { color: var(--err); } .t-warn { color: var(--warn); }
.more-mods { margin-top: 10px; }
.more-mods summary { cursor: pointer; color: var(--muted); }
@media (max-width: 720px) {
  .gantt { grid-template-columns: 1fr; }
  .gl { border-top: 0; min-height: 0; padding-bottom: 0; }
  .gweeks, .gl.head { display: none; }
}

/* ───────── daily run sheet ───────── */
.daily-progress { font-size: 12.5px; color: var(--muted); margin-right: 6px; }
.daily-progress b { color: var(--ink); }
.run-sheet { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.run-step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); overflow: hidden; }
.run-step > header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.run-step h2 { margin: 0; font-size: 14px; }
.run-step header p { margin: 0; color: var(--muted); font-size: 12.5px; }
.run-step .grow-1 { flex: 1; min-width: 0; }
.run-body { padding: 0 16px 14px; }
.run-body .rows { box-shadow: none; }
.run-step.covered { opacity: .6; }
.run-step.covered .run-body { display: none; }
.run-step.covered .step-n { background: var(--ok-soft); color: var(--ok); }
.count.c-err { color: var(--err); font-weight: 650; } .count.c-warn { color: var(--warn); font-weight: 650; } .count.c-accent { color: var(--accent); font-weight: 650; }
label.covered { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.step-clear { margin: 0; color: var(--ok); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.person-block { border: 1px solid var(--line); border-radius: var(--r-2); padding: 10px 12px; }
.pb-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pb-line { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; padding: 4px 0; font-size: 12.5px; border-top: 1px solid var(--line-2); }
.pb-label { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.pb-label.info { color: var(--accent); } .pb-label.ok { color: var(--ok); }
.keylist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.keylist a { display: flex; gap: 6px; color: var(--ink); min-width: 0; }
.keylist a span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keylist .ref { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.person-block { min-width: 0; overflow: hidden; }
.pb-line > * { min-width: 0; }
.keylist li { min-width: 0; }
.keylist a span:last-child { flex: 1; min-width: 0; }

/* ───────── settings rows (code, environments, people) ───────── */
.rows-tbl td { padding: 6px 8px; }
.rows-tbl td input, .rows-tbl td select { width: 100%; min-width: 0; }
.rows-tbl td input.w-xs { min-width: 64px; }
.rows-tbl td input.w-sm { min-width: 96px; }
.rows-tbl td:first-child input { min-width: 220px; }
.phase-history { margin-top: 10px; }
.phase-history summary { cursor: pointer; }
.phase-history ul { margin-top: 6px; display: grid; gap: 4px; }
.rows-tbl td select { min-width: 120px; }

/* ───────── spec, briefs, decisions, documents ───────── */
.spec-doc .spec-sec { padding: 4px 0 14px; border-bottom: 1px solid var(--line-2); }
.spec-doc .spec-sec:last-child { border-bottom: 0; }
.spec-doc .spec-sec h2 { margin: 14px 0 6px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.spec-doc .faint, .faint { color: var(--faint); }
.spec-form { gap: 14px; }
.spec-field { display: flex; flex-direction: column; gap: 4px; }
.spec-field > span { font-size: 13px; }
.spec-field textarea { width: 100%; font-size: 13px; }
.draft-box { border-style: dashed; }
.draft-box .section-h { flex-wrap: wrap; }
.draft-box details summary { cursor: pointer; margin-top: 6px; }
.versions li .faint { display: block; font-size: 11.5px; }
.brief-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.brief-acts form { margin: 0; }
.would { display: grid; gap: 4px; margin: 6px 0 0; }
.would li { display: flex; gap: 6px; align-items: flex-start; }
.brief-side textarea { width: 100%; margin-bottom: 6px; }
.brief-side .hist li { padding: 4px 0; border-top: 1px solid var(--line-2); }
.decision { margin-bottom: 12px; }
.decision.old .rows { border-color: var(--warn); }
.dec-note { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0 0 36px; }
.dec-note textarea { flex: 1; min-width: 0; font-size: 13px; }
.print-doc { max-width: 780px; margin: 24px auto; background: var(--panel); padding: 32px 40px; border-radius: var(--r-3); }
@media print {
  body.bare { background: #fff; color: #000; display: block; }
  .print-doc { margin: 0; padding: 0; max-width: none; box-shadow: none; }
}
@media (max-width: 720px) { .dec-note { margin-left: 0; flex-direction: column; } .dec-note textarea { width: 100%; } }

/* ───────── Inbox: proposals, facts, questions ───────── */
.prop-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); margin: 0 0 12px; box-shadow: var(--shadow-1); overflow: hidden; }
.prop-card > header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.prop-card > header .grow { flex: 1; }
.prop-card.applied, .prop-card.rejected { box-shadow: none; }
.prop-card.applied > header, .prop-card.rejected > header { border-bottom: 0; }
.prop-card.rejected { opacity: .7; }
.prop-card details { padding: 0 14px 10px; }
.prop-card details summary { cursor: pointer; }
.prop-form { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.prop-form footer { display: flex; gap: 8px; align-items: center; }
.pfs { display: grid; gap: 8px; }
.pf { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 13px; }
.pf-l { color: var(--muted); font-size: 12px; padding-top: 4px; }
.pf-v input, .pf-v textarea, .pf-v select { width: 100%; }
.pf-v .md > :first-child { margin-top: 0; }
.pf-sec { border-left: 3px solid var(--accent-soft); padding-left: 10px; }
.reason { margin: 0; font-size: 13px; color: var(--ink-2); display: flex; gap: 6px; align-items: flex-start; }
.evidence { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.evidence li { display: flex; gap: 6px; align-items: flex-start; }
.evidence q { font-style: italic; color: var(--ink-2); }
.facts table { margin-top: 10px; }
.facts tr.lost td { background: var(--err-soft); }
.question.answered, .question.dropped { opacity: .7; }
.question form .grow-1 { flex: 1; min-width: 160px; }
.msg-card textarea { width: 100%; }
.msg-card .section-h { flex-wrap: wrap; }
pre.source { white-space: pre-wrap; font-size: 12.5px; max-height: 420px; overflow: auto; margin: 10px 0 0; }
@media (max-width: 720px) { .pf { grid-template-columns: 1fr; gap: 2px; } }

/* ───────── UX pass (UX.md): shell, project workspace, shared components ───────── */
.side-h { display: flex; align-items: center; justify-content: space-between; }
.side-add { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: var(--r-1); color: var(--muted); }
.side-add:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.side-add .i { width: 14px; height: 14px; }
.proj-link .proj-name { flex: 1; min-width: 0; }
.proj-phase { font-size: 10.5px; color: var(--faint); font-weight: 600; white-space: nowrap; }
.nav.proj-link .nav-badge { margin-left: 4px; }

/* project workspace header and tabs */
.phead { padding: 14px 32px 0; border-bottom: 1px solid var(--line); background: var(--bg); }
.phead-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 32px; }
.phead-row .proj-badge { width: 26px; height: 26px; font-size: 13px; border-radius: 7px; }
.phead-name { font-size: 17px; font-weight: 650; color: var(--ink); letter-spacing: -.01em; margin-right: 4px; }
.phead-name:hover { text-decoration: none; color: var(--accent); }
.chip-s { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
a.chip-s:hover { text-decoration: none; border-color: var(--faint); color: var(--ink); }
.chip-s .i { width: 13px; height: 13px; color: var(--muted); }
.chip-s.role { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip-s.role .i { color: var(--accent); }
.chip-s.phase-scoping, .chip-s.phase-ready { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip-s.phase-paused { background: var(--line-2); color: var(--muted); }
.chip-s.phase-maintenance { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.grow { flex: 1; }
.ptabs { display: flex; gap: 2px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.ptabs::-webkit-scrollbar { display: none; }
.ptabs a { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.ptabs a .i { width: 15px; height: 15px; }
.ptabs a:hover { color: var(--ink); text-decoration: none; }
.ptabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.ptabs a.on .i { color: var(--accent); }
.ptabs a.ptab-gear { margin-left: auto; }
.tab-n { min-width: 18px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 700; display: inline-grid; place-items: center; }
.subtabs { display: flex; gap: 4px; padding: 10px 32px 0; overflow-x: auto; }
.subtabs a { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.subtabs a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.subtabs a.on { background: var(--active); color: var(--ink); }
@media (max-width: 760px) {
  .phead, .subtabs { padding-left: 16px; padding-right: 16px; }
  .chip-s.role { display: none; }
}

/* page header: title, one line on what the page is for, the primary action */
.page-head .sub { max-width: 760px; }
.info:not(.notice) { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--faint); color: var(--muted); font-size: 10px; font-weight: 700; cursor: help; vertical-align: 1px; font-style: normal; }

/* the agent's buttons: always labelled as the agent's */
.btn.agent .i { color: var(--accent); }
.agent-tag { font-size: 10.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }

/* welcome card per role */
.welcome { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--panel); margin-bottom: 22px; box-shadow: var(--shadow-1); }
.welcome > .i { width: 22px; height: 22px; color: var(--accent); margin-top: 2px; }
.welcome h2 { margin: 0 0 4px; font-size: 14px; }
.welcome p { margin: 0 0 4px; color: var(--ink-2); }
.welcome ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); }
.welcome .welcome-x { margin-left: auto; }

/* sections that hold nothing fold to one line */
.quiet-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; padding: 8px 0; }
.quiet-line .i { width: 14px; height: 14px; color: var(--ok); }

/* helpers */
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-err { color: var(--err); }
.wide-modal { width: 760px; }
.section-h { margin-top: 26px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 12px; margin: 0 0 14px; }
.legend i { display: inline-block; width: 18px; height: 8px; border-radius: 3px; vertical-align: 0; margin-right: 6px; }
.lg-bar { background: hsl(200 60% 55% / .45); } .lg-late { background: var(--err); } .lg-slip { border: 1px dashed var(--muted); } .lg-end { width: 2px !important; background: var(--ink-2); }

/* tabs inside a page (a cycle's Summary, Tickets…; Admin) */
.itabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 6px 0 20px; overflow-x: auto; }
.itabs a { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.itabs a:hover { color: var(--ink); text-decoration: none; }
.itabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.toolbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

/* a footer that stays in view while its form scrolls: the close, capacity, the wizard */
.sticky-foot { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-top: 16px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-2); }
.sticky-foot .grow { flex: 1; }

/* cycles and batches */
.cycle-card { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--panel); box-shadow: var(--shadow-1); color: var(--ink); margin-bottom: 8px; }
.cycle-card:hover { text-decoration: none; border-color: var(--faint); }
.cc-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cc-top b { font-size: 15px; }
.cycle-card .goal { margin: 12px 0 0; }
.more-people { margin-top: 10px; }
.batch-progress .meter { height: 8px; }

/* Home and Overview */
.daily-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 8px; }
.daily-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-3); border: 1px solid var(--line); background: var(--accent-soft); color: var(--ink); }
.daily-card:hover { text-decoration: none; border-color: var(--accent); }
.daily-card > .i:first-child { color: var(--accent); width: 20px; height: 20px; }
.daily-card span { flex: 1; display: flex; flex-direction: column; }
.daily-card small { color: var(--muted); font-size: 12px; }
.cycle-strip { padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--panel); box-shadow: var(--shadow-1); margin-bottom: 6px; }
.cs-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cs-top a b { color: var(--ink); font-size: 15px; }
.cycle-strip .goal { margin: 10px 0 0; }
.load-list { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; margin: 0 0 16px; list-style: none; }
.load-list li { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.lp-name { display: inline-flex; align-items: center; gap: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.attn li { position: relative; }
.attn li.has-extra { position: relative; }
.attn li.has-extra .attn-t { padding-right: 150px; }
.attn-agent { position: absolute; right: 58px; top: 50%; transform: translateY(-50%); }
@media (max-width: 700px) { .attn li.has-extra .attn-t { padding-right: 0; } .attn-agent { position: static; transform: none; padding: 0 14px 12px 54px; margin-top: -4px; } }
.setup-box .ready a { color: var(--ink); }
.you-list { display: flex; flex-direction: column; gap: 8px; }
.you-list li { display: flex; gap: 8px; color: var(--ink-2); font-size: 13px; }
.you-list .i { color: var(--ok); margin-top: 2px; }
.follow-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.follow-card { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--panel); color: var(--ink); }
.follow-card:hover { text-decoration: none; border-color: var(--faint); }
.follow-card p { margin: 8px 0 0; }

/* Daily mode: a stepper */
.stepper-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.stepper-head .sub { margin: 4px 0 0; color: var(--muted); }
.stepper-dots { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; }
.stepper-dots button, .wz-dots button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font: 500 12px var(--font); cursor: pointer; }
.stepper-dots button span, .wz-dots button span { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--line-2); color: var(--ink-2); font-size: 11px; font-weight: 700; }
.stepper-dots button b { color: var(--ink); }
.stepper-dots button.c-err b { color: var(--err); } .stepper-dots button.c-warn b { color: var(--warn); }
.stepper-dots button.on, .wz-dots button.on { border-color: var(--accent); color: var(--ink); }
.stepper-dots button.on span, .wz-dots button.on span { background: var(--accent); color: var(--accent-ink); }
.stepper-dots button.past span, .wz-dots button.past span { background: var(--ok-soft); color: var(--ok); }
.stepper-step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); min-height: 240px; }
.stepper-step > header { display: flex; gap: 12px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.stepper-step > header h2 { margin: 0; font-size: 16px; outline: none; }
.stepper-step > header p { margin: 2px 0 0; color: var(--muted); }
.stepper-step .run-body { padding: 14px 20px 18px; }
.stepper-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }

/* the Inbox */
.ib-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--panel); box-shadow: var(--shadow-1); overflow: hidden; }
.ib-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-2); color: var(--ink); }
.ib-row:first-child { border-top: 0; }
a.ib-row:hover { background: var(--hover); text-decoration: none; }
.ib-ic { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--line-2); color: var(--muted); flex: none; }
.ib-row.content .ib-ic { background: var(--accent-soft); color: var(--accent); }
.ib-main { flex: 1; min-width: 0; }
.ib-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ib-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ib-body { margin-top: 6px; } .ib-body .md { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.ib-out { margin: 6px 0 0; }
.ib-acts { display: flex; align-items: center; gap: 8px; flex: none; color: var(--muted); }
.ib-acts select { height: 28px; }
.ib-proj { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }

/* the New project wizard */
.wizard { max-width: 780px; }
.wz-dots { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 16px; padding: 0; }
.wz-step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); }
.wz-step > header { display: flex; gap: 12px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.wz-step > header h2 { margin: 0; font-size: 15px; }
.wz-step > header p { margin: 2px 0 0; color: var(--muted); }
.wz-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-2); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice span { display: flex; flex-direction: column; }
.choice small { color: var(--muted); font-size: 12.5px; }
.wz-cycles { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }

/* Settings: grouped sections */
.settings-nav-h { font-size: 11px; font-weight: 600; color: var(--faint); letter-spacing: .02em; margin: 12px 10px 4px; }
.settings-nav-h:first-child { margin-top: 0; }
.settings-nav a.on { background: var(--active); color: var(--ink); }
.settings-nav a.on .i { color: var(--accent); }

/* the spec: a table of contents beside the text */
.doc-layout.with-toc { grid-template-columns: 180px minmax(0, 1fr) 260px; }
.spec-toc { position: sticky; top: 70px; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.spec-toc a { color: var(--muted); padding: 4px 8px; border-radius: var(--r-1); }
.spec-toc a:hover { color: var(--ink); background: var(--hover); text-decoration: none; }
@media (max-width: 1100px) { .doc-layout.with-toc { grid-template-columns: minmax(0, 1fr); } .spec-toc { display: none; } }

/* New ticket */
.type-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.type-opt { position: relative; }
.type-opt input { position: absolute; opacity: 0; pointer-events: none; }
.type-opt span { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); font-weight: 500; cursor: pointer; background: var(--panel); }
.type-opt span .i { width: 14px; height: 14px; color: var(--muted); }
.type-opt input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.type-opt input:checked + span .i { color: var(--accent); }
.type-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.prop-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.more-fields summary { cursor: pointer; color: var(--muted); }
.new-full { max-width: 980px; }
.panel-f { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); }
#new-ticket .new-ticket-form header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
#new-ticket .new-ticket-form header h2 { margin: 0; font-size: 15px; }
#new-ticket .new-ticket-form footer { display: flex; align-items: center; gap: 8px; padding: 12px 18px 16px; }

/* the ticket: field chips, flags, the folded work panel */
.field-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.fchip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); font-size: 12px; font-weight: 500; }
.fchip .i { width: 12px; height: 12px; color: var(--muted); }
.fchip.type { background: var(--accent-soft); color: var(--accent); }
.fchip.batch { background: var(--ok-soft); color: var(--ok); }
.fchip.batch .i { color: var(--ok); }
.other-labels { margin-top: 8px; }
.add-line { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 8px 14px; }
.add-line > .i { color: var(--muted); }
.block.inline-add { display: inline-flex; border: 0; padding: 0; }
.block.inline-add .block-h { padding: 0; border: 0; gap: 0; }
.block.inline-add .block-h > .i, .block.inline-add .block-h h3, .block.inline-add .block-h .count, .block.inline-add .block-h .grow { display: none; }

/* board: add a ticket in a column */
.col-add { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--r-1); color: var(--muted); margin-left: 4px; }
.col-add:hover { background: var(--hover); color: var(--accent); text-decoration: none; }
.col-add .i { width: 14px; height: 14px; }
.vs-about { margin-right: 6px; }

/* help in place, and the workflow page */
.side-how { margin: 10px 0 0; color: var(--muted); }
.wf-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wf-state { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.wf-arrow .i { width: 14px; height: 14px; color: var(--faint); }
.workflow-link { border: 1px solid var(--line); border-radius: var(--r-3); background: var(--panel); margin-bottom: 8px; }

/* the AI Agent tab: two ways to start */
.agent-start { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.agent-start p { margin: 4px 0 10px; }
.agent-job { display: inline; }

/* ───────── at a glance (Home, Overview): a main column and a right rail ───────── */
.glance { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.glance-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.glance-main > .cycle-strip, .glance-main > .box, .glance-main > .setup-box { margin: 0; }
.rail { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 62px; }
@media (max-width: 1100px) { .glance { grid-template-columns: minmax(0, 1fr); } .rail { position: static; } }

/* a section as a card: a header line, then its rows edge to edge */
.card-sec, .rail-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); overflow: hidden; }
.card-sec > header, .rail-card > header { display: flex; align-items: baseline; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-sec > header h2, .rail-card > header h2 { margin: 0; font-size: 13.5px; display: inline-flex; align-items: center; gap: 8px; }
.card-sec > header h2 .i { color: var(--muted); }
.card-sec > header small, .rail-card > header small { color: var(--muted); font-size: 12px; }
.card-sec > header .grow, .rail-card > header .grow { flex: 1; }
.card-sec > header .btn { align-self: center; }
.card-pad { padding: 12px 16px; }
.card-sec .rows.flat, .card-sec .ib-list.flat { border: 0; border-radius: 0; box-shadow: none; }
.card-sec .attn { border: 0; border-radius: 0; box-shadow: none; margin: 0; }
.card-sec .tbl-wrap { border: 0; border-radius: 0; margin: 0; }
.card-sec .tbl { margin: 0; }
.card-sec > .ready { padding: 12px 16px; margin: 0; }
.card-sec .queue-h:first-child { margin-top: 0; }

/* attention in tiers */
.tiers .quiet-line { padding: 10px 16px; margin: 0; }
.attn-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.pchip { display: inline-flex; gap: 4px; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.pchip b { font-weight: 700; color: var(--ink); }
.pchip:hover { text-decoration: none; filter: brightness(1.1); }
.tone-danger .attn-n { color: var(--err); } .tone-warn .attn-n { color: var(--warn); }
.can-wait { border-top: 1px solid var(--line-2); }
.can-wait > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 16px; color: var(--muted); font-size: 12.5px; }
.can-wait > summary::-webkit-details-marker { display: none; }
.can-wait > summary b { color: var(--ink-2); font-weight: 600; }
.can-wait > summary .caret { width: 14px; height: 14px; transition: transform .15s; }
.can-wait[open] > summary .caret { transform: rotate(90deg); }
.can-wait > summary:hover { color: var(--ink); background: var(--hover); }
.can-wait .attn { border-top: 1px solid var(--line-2); }
.all-clear { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 16px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 12.5px; }
.all-clear .i { width: 14px; height: 14px; color: var(--ok); }
.all-clear b { color: var(--ink-2); font-weight: 600; }

/* the projects table: status with a bar by state */
.pstatus { min-width: 210px; }
.pstatus .pill { margin-right: 6px; }
.pstatus small { display: block; margin-top: 4px; font-size: 11.5px; }
.status-board .n.ok { color: var(--ok); }
.sbar { display: inline-flex; vertical-align: middle; width: 140px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line-2); gap: 1px; }
.sbar.wide { display: flex; width: 100%; height: 10px; margin: 4px 0 6px; }
.sbar i { display: block; min-width: 3px; }
.sbar.empty { background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 10px); }
.cs-bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.legend.tight { margin: 0; gap: 4px 12px; font-size: 11.5px; }
.legend.tight i { width: 8px; height: 8px; border-radius: 2px; }

/* the right rail: the week, then what's coming */
.week { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 12px 14px; }
.wk-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0; border-radius: var(--r-2); background: var(--line-2); color: var(--muted); }
.wk-day b { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.wk-day small { font-size: 10.5px; }
.wk-day.past { opacity: .55; }
.wk-day.demo small { color: var(--accent); font-weight: 600; }
.wk-day.start small { color: var(--ok); font-weight: 600; }
.wk-day.today { background: var(--accent); color: var(--accent-ink); }
.wk-day.today b, .wk-day.today small { color: var(--accent-ink); }
.rail-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line-2); }
.rail-row > span { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rail-row > span > .i { color: var(--muted); }
.rail-row > span > span { display: flex; flex-direction: column; min-width: 0; }
.rail-row small { color: var(--muted); font-size: 11.5px; }
.rail-card .load-list { margin: 0; border: 0; }
.agenda { list-style: none; margin: 0; padding: 4px 0; }
.agenda li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line-2); }
.agenda li:first-child { border-top: 0; }
.ag-d { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.ag-d small { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.ag-d b { font-size: 17px; font-weight: 650; }
.agenda li.today .ag-d small, .agenda li.today .ag-d b { color: var(--accent); }
.ag-l { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ag-l > a, .ag-l > span { display: flex; align-items: flex-start; gap: 7px; color: var(--ink); font-size: 12.5px; }
.ag-l > a:hover { text-decoration: none; color: var(--accent); }
.ag-l .i { width: 13px; height: 13px; color: var(--muted); margin-top: 2px; }
.ag-l > a > span, .ag-l > span > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-l .t-err .i { color: var(--err); }

/* a developer's or tester's numbers on one line */
.count-line { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.cl { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 12.5px; }
.cl b { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.cl.err b { color: var(--err); } .cl.warn b { color: var(--warn); } .cl.accent b { color: var(--accent); }
.cl.zero { opacity: .6; }

/* the welcome card, lighter */
.welcome { padding: 12px 16px; margin-bottom: 16px; }
.welcome h2 { font-size: 13.5px; }
.welcome p, .welcome ul { font-size: 12.5px; }
.attn .attn-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.attn .attn-row .attn-t a { color: var(--ink); }
.attn .attn-row .attn-t a:hover { color: var(--accent); text-decoration: none; }
.attn .attn-row .attn-n { min-width: 22px; text-align: right; }
.status-board td:first-child { min-width: 210px; }
.status-board .proj-cell small { white-space: nowrap; }
.cl.ok b { color: var(--ok); }
.count-line + .two-col, .count-line + .count-line { margin-top: 14px; }
.glance-main .count-line, .count-line { margin-bottom: 4px; }
.help { position: relative; display: inline-block; vertical-align: middle; margin-left: 2px; outline: none; }
.help .help-pop { display: none; position: absolute; z-index: 30; top: 22px; left: -8px; width: 300px; padding: 10px 12px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-3); font-size: 12.5px; font-weight: 400; color: var(--ink-2); line-height: 1.5; text-align: left; white-space: normal; }
.help:hover .help-pop, .help:focus .help-pop, .help:focus-within .help-pop { display: block; }
.help:focus-visible .info { outline: 2px solid var(--accent); outline-offset: 1px; }
.status-board td:first-child { min-width: 170px; }
.pstatus { min-width: 160px; }
.pstatus .sbar { width: 100px; }
.status-board th, .status-board td { padding-left: 8px; padding-right: 8px; }

/* ───────── the phase switch (Settings → Phase, New project) ───────── */
.ps-opt:has(input[value=scoping]), .ps-badge.ps-scoping { --pc: var(--accent); }
.ps-opt:has(input[value=ready]), .ps-badge.ps-ready { --pc: #3b82f6; }
.ps-opt:has(input[value=delivery]), .ps-badge.ps-delivery { --pc: var(--ok); }
.ps-opt:has(input[value=paused]), .ps-badge.ps-paused { --pc: var(--warn); }
.ps-opt:has(input[value=maintenance]), .ps-badge.ps-maintenance { --pc: #0d9488; }
:root[data-theme="dark"] .ps-opt:has(input[value=ready]), :root[data-theme="dark"] .ps-badge.ps-ready { --pc: #7aa7f7; }
:root[data-theme="dark"] .ps-opt:has(input[value=maintenance]), :root[data-theme="dark"] .ps-badge.ps-maintenance { --pc: #4fd1c5; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ps-opt:has(input[value=ready]), :root:not([data-theme="light"]) .ps-badge.ps-ready { --pc: #7aa7f7; }
  :root:not([data-theme="light"]) .ps-opt:has(input[value=maintenance]), :root:not([data-theme="light"]) .ps-badge.ps-maintenance { --pc: #4fd1c5; }
}
.phase-switch { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 3px; padding: 3px; margin: 16px 0 0; background: var(--line-2); border: 1px solid var(--line); border-radius: 11px; }
.ps-opt { position: relative; cursor: pointer; }
.ps-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.ps-in { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 64px; padding: 10px 6px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 12.5px; text-align: center; transition: background-color .12s, color .12s, box-shadow .12s; }
.ps-in .i { width: 18px; height: 18px; }
.ps-opt:hover .ps-in { color: var(--ink); background: color-mix(in srgb, var(--panel) 55%, transparent); }
.ps-opt input:checked + .ps-in { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-2), inset 0 -2px 0 var(--pc); }
.ps-opt input:checked + .ps-in .i { color: var(--pc); }
.ps-opt input:focus-visible + .ps-in { outline: 2px solid var(--accent); outline-offset: 1px; }
.ps-tag { position: absolute; top: 5px; right: 6px; font-size: 10px; font-weight: 600; line-height: 16px; padding: 0 5px; border-radius: 999px; background: color-mix(in srgb, var(--pc) 16%, transparent); color: var(--pc); text-transform: uppercase; letter-spacing: .03em; }
.ps-desc { padding: 14px 2px 4px; }
.ps-desc p { margin: 0 0 8px; color: var(--ink-2); }
.ps-effects { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--muted); }
.ps-effects li { display: inline-flex; align-items: center; gap: 6px; }
.ps-effects li.on .i { color: var(--ok); } .ps-effects li.off .i { color: var(--faint); }
.ps-effects .i { width: 14px; height: 14px; }
.ps-now { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding-top: 16px; font-weight: 600; }
.ps-now > span:nth-child(2) { margin-right: auto; }
.ps-agreed { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; font-size: 12.5px; color: var(--muted); }
.ps-agreed .i { width: 14px; height: 14px; color: var(--ok); }
.ps-agreed.t-warn .i { color: var(--warn); }
.ps-badge { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; flex: none; background: color-mix(in srgb, var(--pc) 14%, transparent); color: var(--pc); }
.ps-badge .i { width: 15px; height: 15px; }
.ps-fields:not(:has(> :not([hidden]))) { display: none; }
.ps-fields { border-top: 1px solid var(--line-2); margin-top: 12px; }
.phase-history { border-top: 1px solid var(--line-2); padding: 12px 0 16px; }
.phase-history > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 500; list-style: none; }
.phase-history > summary::-webkit-details-marker { display: none; }
.phase-history > summary .i { width: 14px; height: 14px; }
.ps-hist { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.ps-hist li { display: flex; gap: 12px; position: relative; padding-bottom: 14px; }
.ps-hist li:not(:last-child)::before { content: ""; position: absolute; left: 12px; top: 28px; bottom: 0; width: 1px; background: var(--line); }
.ps-hist b { font-weight: 600; font-size: 13px; }
.ps-hist small { display: block; color: var(--muted); font-size: 12px; }
.ps-hist p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-2); }
@media (max-width: 640px) {
  .phase-switch { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .ps-in { min-height: 56px; font-size: 12px; }
}
.ps-now small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; line-height: 1.2; }
.ps-now .muted { font-weight: 400; }

/* ───────── New project wizard, second version: steps on the left, what will be created on the right ───────── */
.wizard { max-width: 1120px; }
.wz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.wz-main { min-width: 0; }
.wz-body { gap: 18px; }
.wz-sec { display: flex; flex-direction: column; gap: 10px; }
.wz-sec + .wz-sec { border-top: 1px solid var(--line-2); padding-top: 18px; }
.wz-sec-h b { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.wz-sec-h span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.wz-sec .phase-switch { margin-top: 2px; }
.wz-sec .ps-desc { padding-top: 10px; }
.wz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.wz-l { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.wz-start input { margin-top: 6px; }
.wz-more { border: 1px dashed var(--line); border-radius: var(--r-2); padding: 10px 12px; }
.wz-more > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--accent); font-weight: 500; list-style: none; }
.wz-more > summary::-webkit-details-marker { display: none; }
.wz-more[open] > summary { margin-bottom: 12px; }
.wz-people td:last-child { width: 180px; }
.wz-summary { position: sticky; top: 72px; }
.wz-sum-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); padding: 16px 16px 12px; }
.wz-sum-card h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 13.5px; }
.wz-sum-card h2 .i { color: var(--accent); }
.wz-sum { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.wz-sum li { display: flex; gap: 10px; align-items: flex-start; }
.wz-sum li > .i { color: var(--muted); margin-top: 2px; }
.wz-sum li > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.wz-sum b { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.wz-sum small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.wz-sum .proj-badge { --h: 250; }
.wz-sum-foot { margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--line-2); }
/* A segmented radio choice for forms (cycle length, delivery, spec source). */
.seg-choice { display: inline-flex; flex-wrap: wrap; background: var(--line-2); border: 1px solid var(--line); border-radius: var(--r-2); padding: 2px; gap: 2px; }
.seg-choice label { position: relative; margin: 0; cursor: pointer; }
.seg-choice input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.seg-choice span { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 5px; color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.seg-choice label:hover span { color: var(--ink); }
.seg-choice input:checked + span { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-2); }
.seg-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Notices: a neutral one, and an informative one. */
.notice:not(.warn):not(.err) { background: var(--side); border: 1px solid var(--line); color: var(--ink-2); }
.notice.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
.notice.info > .i { color: var(--accent); }
.notice > .i { margin-top: 1px; }
@media (max-width: 980px) {
  .wz-layout { grid-template-columns: 1fr; }
  .wz-summary { position: static; order: -1; }
  .wz-sum { flex-direction: row; flex-wrap: wrap; gap: 8px 16px; }
  .wz-sum li small { display: none; }
  .wz-sum-foot { display: none; }
}
@media (max-width: 640px) { .wz-grid { grid-template-columns: 1fr; } }

/* Rail links: one line each (a brief, the decisions, a follow-up), its status on the right. */
.rail-links { display: flex; flex-direction: column; }
.rail-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line-2); color: var(--ink); font-size: 13px; }
.rail-link:first-child { border-top: 0; }
.rail-link:hover { background: var(--hover); text-decoration: none; }
.rail-link .rl-t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rail-link .rl-t > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-link .rl-t .i { color: var(--muted); width: 14px; height: 14px; }
.rail-link > .i { color: var(--faint); width: 14px; height: 14px; }
.rail-card > .quiet-line { padding: 10px 14px; margin: 0; }
/* A rail taller than the window would hide its last cards while sticky: it only sticks where it fits. */
.rail { position: static; }
@media (min-height: 1100px) { .rail { position: sticky; } }
.move-target { margin-top: 6px; gap: 6px; flex-wrap: nowrap; }
.move-target input[type=date] { height: 28px; width: 150px; }
.section-h form { margin: 0; }

/* ───────── the ticket assistant (New ticket): the template as fields, or as Markdown ───────── */
.tpl-editor { display: flex; flex-direction: column; gap: 10px; }
.tpl-head { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line-2); padding-bottom: 6px; }
.tpl-head [data-tpl-tab] { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: 500 12.5px var(--font); cursor: pointer; }
.tpl-head [data-tpl-tab] .i { width: 14px; height: 14px; }
.tpl-head [data-tpl-tab]:hover { color: var(--ink); background: var(--hover); }
.tpl-head [data-tpl-tab].on { color: var(--ink); background: var(--active); }
.tpl-guided { display: flex; flex-direction: column; gap: 14px; }
.tg-sec { display: flex; flex-direction: column; gap: 6px; }
.tg-l { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.tg-l small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 1px; }
.tg-sec textarea { resize: vertical; min-height: 56px; line-height: 1.5; }
.tg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tg-list li { display: flex; align-items: center; gap: 8px; }
.tg-list .tg-n { flex: none; min-width: 34px; font: 600 11.5px var(--mono); color: var(--muted); text-align: right; }
.tg-list input { flex: 1; min-width: 0; }
.tg-list .icon-btn { opacity: 0; font-size: 16px; line-height: 1; color: var(--muted); }
.tg-list li:hover .icon-btn, .tg-list li:focus-within .icon-btn { opacity: 1; }
.tg-sec > [data-tg-add] { align-self: flex-start; margin-left: 38px; }
.tpl-raw-hint { margin: 0 0 6px; }
.tpl-ready { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 12px; border-radius: var(--r-2); background: var(--side); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.tpl-ready:empty { display: none; }
.tpl-ready .tr-h { font-weight: 600; color: var(--ink-2); margin-right: 4px; }
.tpl-ready .tr-c.ok { color: var(--ok); }
.tpl-ready.all { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, var(--line)); }
.tpl-ready.all .tr-h { color: var(--ok); }
.tpl-ready.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.tpl-ready.warn .tr-h { color: var(--warn); }
.from-line { display: flex; align-items: center; gap: 6px; margin: -4px 0 0; }
.from-line .i { width: 13px; height: 13px; }

/* ───────── working client content by hand ───────── */
.work-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.source-col { margin: 0; }
pre.source.tall { max-height: calc(100vh - 260px); min-height: 220px; background: var(--side); border: 1px solid var(--line-2); border-radius: var(--r-2); padding: 12px 14px; font: 13px/1.6 var(--font); color: var(--ink); }
pre.source[data-source-select] { cursor: text; }
pre.source[data-source-select]::selection, pre.source[data-source-select] *::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.work-col { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 72px; }
.work-acts { display: flex; flex-direction: column; }
.work-act { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-top: 1px solid var(--line-2); color: var(--ink); }
.work-act:first-child { border-top: 0; }
.work-act:hover { background: var(--hover); text-decoration: none; }
.work-act > .i { color: var(--accent); margin-top: 2px; }
.work-act span { display: flex; flex-direction: column; }
.work-act b { font-weight: 600; font-size: 13px; }
.work-act small { color: var(--muted); font-size: 12px; }
.handled-card textarea { width: 100%; }
.card-pad { padding: 12px 14px; }
.rail-link .ref { font: 600 11.5px var(--mono); color: var(--muted); }
.with-source { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 40%); gap: 18px; align-items: start; }
.source-pane { position: sticky; top: 72px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); overflow: hidden; }
.source-pane > header { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.source-pane > header .i { color: var(--muted); margin-top: 2px; }
.source-pane > header small { display: block; color: var(--muted); font-size: 12px; }
.source-pane pre.source { margin: 0; max-height: calc(100vh - 180px); padding: 12px 14px; font: 13px/1.6 var(--font); }
.sel-pop { position: absolute; z-index: 60; display: flex; gap: 6px; padding: 6px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-3); }
@media (max-width: 980px) {
  .work-split, .with-source { grid-template-columns: 1fr; }
  .work-col, .source-pane { position: static; }
  pre.source.tall { max-height: 50vh; }
}
.tg-more > summary { cursor: pointer; color: var(--accent); font-size: 12.5px; font-weight: 500; list-style: none; }
.tg-more > summary::-webkit-details-marker { display: none; }
.tg-more[open] > summary { margin-bottom: 12px; color: var(--muted); }
.quick-fix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 4px 0 10px 34px; }
.qf { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.qf select, .qf input { height: 28px; font-size: 12.5px; width: auto; min-width: 120px; margin: 0 !important; }
.qf.done select, .qf.done input { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); color: var(--ok); }
.qf.done span::after { content: " ✓"; color: var(--ok); }
.fix-rows .refine-item { border-bottom: 1px solid var(--line-2); }
.fix-rows .refine-item:last-child { border-bottom: 0; }
.refine-item > p { margin: -2px 0 4px; padding-left: 34px; }
input::placeholder, textarea::placeholder { text-transform: none; }

/* Narrow screens: the settings nav becomes one scrolling strip above the section (a later rule had overridden the
   earlier media query, squeezing the section beside the nav); split views stack without overflowing. */
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
  .settings-nav-h, .settings-nav hr { display: none; }
  .settings-nav a { flex: none; white-space: nowrap; }
}
.work-split > *, .with-source > *, .wz-layout > * { min-width: 0; }
@media (max-width: 640px) {
  .source-col .section-h > .small.muted:last-child { display: none; }
  .ps-now > span:nth-child(2) { margin-right: 0; }
}
.back-link { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px 0 4px; margin-right: 10px; border-radius: var(--r-1); color: var(--muted); font-size: 12.5px; font-weight: 500; }
.back-link:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.back-link .i { width: 14px; height: 14px; }
.item-ref .back-link { display: inline-flex; font-family: var(--font); flex: none; margin-left: -8px; }

/* The way back from a detail page, above its title. */
.back-row { margin: -6px 0 10px; }
.back-row .back-link { margin-left: -8px; }
.toast a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ───────── the sidebar, made useful (UX.md section 10): pins, live project lines, recent, the collapsed rail ───────── */
.side-top { display: flex; align-items: center; justify-content: space-between; }
.side-toggle { width: 26px; height: 26px; color: var(--faint); }
.side-toggle:hover { color: var(--ink); }
.pin-link, .recent-link { position: relative; font-size: 13px; }
.pin-link > span, .recent-link > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-link .i, .recent-link .i { width: 15px; height: 15px; }
.pin-proj { font: 600 10px var(--mono); color: var(--faint); }
.pin-x { display: none; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border: 0; border-radius: var(--r-1); background: var(--active); color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.pin-link:hover .pin-x, .pin-x:focus-visible { display: inline-grid; place-items: center; }
.pin-link:hover .pin-proj { visibility: hidden; }
.pin-x:hover { color: var(--err); }
.side-hint { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 4px 8px 2px; color: var(--faint); font-size: 12px; line-height: 1.4; }
.side-hint .i { width: 14px; height: 14px; margin-top: 1px; flex: none; }
.proj-live { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin: -2px 0 4px; padding: 0 8px 0 35px; font-size: 11.5px; }
.proj-live .lv { color: var(--muted); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.proj-live a.lv:hover { color: var(--ink); text-decoration: none; }
.proj-live .lv.err { color: var(--err); } .proj-live .lv.warn { color: var(--warn); } .proj-live .lv.accent { color: var(--accent); }
.hdot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.hdot.h-on_track { background: var(--ok); } .hdot.h-at_risk { background: var(--warn); } .hdot.h-behind { background: var(--err); }
.pin-btn .i { width: 16px; height: 16px; }
.pin-btn.on { color: #e5a400; }
.pin-btn.on .i { fill: currentColor; }
.top-actions { display: flex; align-items: center; gap: 8px; }

/* The collapsed rail: 56 px of icons; names show as tooltips (title). */
@media (min-width: 901px) {
:root[data-side="mini"] .side { width: 56px; padding: 10px 6px; overflow-x: hidden; }
:root[data-side="mini"] .side-top { flex-direction: column; gap: 8px; padding: 2px 0 8px; }
:root[data-side="mini"] .brand > span:not(.logo), :root[data-side="mini"] .search-btn span, :root[data-side="mini"] .search-btn kbd,
:root[data-side="mini"] .nav > span:not(.proj-badge):not(.nav-badge), :root[data-side="mini"] .side-h, :root[data-side="mini"] .proj-live, :root[data-side="mini"] .side-hint,
:root[data-side="mini"] .pin-proj, :root[data-side="mini"] .pin-x, :root[data-side="mini"] .proj-phase, :root[data-side="mini"] .user-menu .who,
:root[data-side="mini"] .user-menu > summary > .i { display: none !important; }
:root[data-side="mini"] .search-btn { justify-content: center; padding: 0; }
:root[data-side="mini"] .nav { justify-content: center; padding: 0; position: relative; height: 32px; }
:root[data-side="mini"] .nav-badge { position: absolute; top: 1px; right: 2px; min-width: 15px; height: 14px; padding: 0 3px; font-size: 9.5px; }
:root[data-side="mini"] .side-nav.pins, :root[data-side="mini"] .side-nav.projects, :root[data-side="mini"] .side-recent { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 6px; }
:root[data-side="mini"] .user-menu > summary { justify-content: center; padding: 6px 0; }
:root[data-side="mini"] .side-toggle .i { transform: scaleX(-1); }
}


/* Queues on demand (Overview): every list, its count; a zero fades but stays a link. */
.queue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--line-2); }
.qtile { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; background: var(--panel); color: var(--ink); }
.qtile:hover { background: var(--hover); text-decoration: none; }
.qtile b { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
.qtile span { font-size: 12.5px; color: var(--muted); }
.qtile.zero b { color: var(--faint); }
.qtile.t-err b { color: var(--err); } .qtile.t-warn b { color: var(--warn); }
.queue-grid { gap: 0; background: none; }
.qtile { border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }

.q-links .rail-link { padding: 7px 14px; }
.q-links .qn { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2); }
.q-links .zero .qn, .q-links .zero .rl-t { color: var(--faint); }
.q-links .qn.t-err { color: var(--err); } .q-links .qn.t-warn { color: var(--warn); }

/* Horizontal strips (project tabs, sub-tabs, the settings nav on phones): a thin scrollbar that stays out of the way. */
.subtabs, .ptabs, .settings-nav, .tbl-wrap { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--faint) 45%, transparent) transparent; }
.subtabs::-webkit-scrollbar, .ptabs::-webkit-scrollbar, .settings-nav::-webkit-scrollbar, .tbl-wrap::-webkit-scrollbar { height: 4px; }
.subtabs::-webkit-scrollbar-thumb, .ptabs::-webkit-scrollbar-thumb, .settings-nav::-webkit-scrollbar-thumb, .tbl-wrap::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--faint) 45%, transparent); border-radius: 4px; }
.subtabs::-webkit-scrollbar-track, .ptabs::-webkit-scrollbar-track, .settings-nav::-webkit-scrollbar-track, .tbl-wrap::-webkit-scrollbar-track { background: transparent; }
.subtabs { padding-bottom: 4px; }

/* Tab strips: a 3 px scrollbar, invisible until the strip is hovered (desktop); none on touch screens, which swipe. */
.subtabs, .ptabs, .settings-nav, .tbl-wrap { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.subtabs:hover, .ptabs:hover, .settings-nav:hover, .tbl-wrap:hover { scrollbar-color: color-mix(in srgb, var(--faint) 55%, transparent) transparent; }
.subtabs::-webkit-scrollbar, .ptabs::-webkit-scrollbar, .settings-nav::-webkit-scrollbar, .tbl-wrap::-webkit-scrollbar { height: 3px; }
.subtabs::-webkit-scrollbar-thumb, .ptabs::-webkit-scrollbar-thumb, .settings-nav::-webkit-scrollbar-thumb, .tbl-wrap::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.subtabs:hover::-webkit-scrollbar-thumb, .ptabs:hover::-webkit-scrollbar-thumb, .settings-nav:hover::-webkit-scrollbar-thumb, .tbl-wrap:hover::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--faint) 55%, transparent); }
.subtabs { padding-bottom: 3px; }
@media (hover: none) { .subtabs, .ptabs, .settings-nav { scrollbar-width: none; } .subtabs::-webkit-scrollbar, .ptabs::-webkit-scrollbar, .settings-nav::-webkit-scrollbar { display: none; } }
/* Chrome and Edge drop ::-webkit-scrollbar once scrollbar-width/color are set: those stay for Firefox only. */
.subtabs, .ptabs, .settings-nav, .tbl-wrap, .subtabs:hover, .ptabs:hover, .settings-nav:hover, .tbl-wrap:hover { scrollbar-width: auto; scrollbar-color: auto; }
@supports (-moz-appearance: none) {
  .subtabs, .ptabs, .settings-nav, .tbl-wrap { scrollbar-width: thin; scrollbar-color: transparent transparent; }
  .subtabs:hover, .ptabs:hover, .settings-nav:hover, .tbl-wrap:hover { scrollbar-color: color-mix(in srgb, var(--faint) 55%, transparent) transparent; }
}
@media (hover: none) { .subtabs, .ptabs, .settings-nav { scrollbar-width: none; } }

/* Project info (read-only, for everyone): branches with a copy button, environments by stage, people. */
.info-sec .set-h h2 { display: flex; align-items: center; gap: 8px; }
.info-sec .set-h h2 .i { color: var(--muted); }
.info-sec .set-b { padding: 16px 24px; }
.info-sec .set-b > .tbl-wrap .tbl { box-shadow: none; }
.info-tbl td { vertical-align: middle; }
.branch { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.branch .i { width: 13px; height: 13px; color: var(--muted); }
.branch code { font: 12.5px var(--mono); }
.copy-btn { width: 22px; height: 22px; opacity: .45; vertical-align: middle; }
.copy-btn .i { width: 13px; height: 13px; }
tr:hover .copy-btn, li:hover .copy-btn, .branch:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.env-stage + .env-stage { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.env-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.env-list { display: flex; flex-direction: column; gap: 6px; }
.env-list li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.env-list a { display: inline-flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env-list a .i { width: 12px; height: 12px; flex: none; }
.env-kind { width: 140px; flex: none; }
.info-dl { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; margin: 0 0 12px; }
.info-dl dt { color: var(--muted); font-size: 12.5px; } .info-dl dd { margin: 0; }
.info-note { white-space: pre-wrap; background: var(--side); border: 1px solid var(--line-2); border-radius: var(--r-2); padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.info-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.info-people .person { display: flex; gap: 10px; align-items: center; }
.info-people .person span { display: flex; flex-direction: column; min-width: 0; }
.info-people small { color: var(--muted); font-size: 12px; }
.info-sec h3 { margin: 18px 0 10px; }
@media (max-width: 640px) { .env-kind { width: auto; } .env-list li { flex-wrap: wrap; } .info-dl { grid-template-columns: 1fr; gap: 2px; } .info-dl dd { margin-bottom: 8px; } }
.info-tbl td:first-child, .info-tbl td:nth-child(3) { white-space: nowrap; }
/* Sticky headers inside a scroll area with padding stick to its padding edge, leaving a gap the rows scroll through:
   pulled up by that padding so they sit flush on the edge, with a hairline to separate them from what scrolls under. */
.ws-body .group-head { top: -16px; margin: 0 -20px; padding: 8px 24px; }
.ws-body .group[open] > .group-head { box-shadow: 0 1px 0 var(--line-2); }

/* The ticket count sits by the view's name; the chips row shows only when it has something to say. */
.ws-count { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ───────── quality gates, criterion by criterion (UX.md 12) ───────── */
.modal.has-verdict { width: 640px; }
.modal.has-verdict .composer textarea { min-height: 64px; }
.vc-extra-h { margin: 0 0 -6px; font-weight: 600; color: var(--ink-2); }
.verdict { display: flex; flex-direction: column; gap: 10px; }
.vc-lead { display: flex; gap: 8px; margin: 0; font-size: 12.5px; color: var(--ink-2); }
.vc-lead .i { color: var(--accent); margin-top: 1px; }
.vc-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--panel); }
.vc-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; transition: background .15s; }
.vc-row + .vc-row { border-top: 1px solid var(--line-2); }
.vc-row[data-res="fail"] { background: color-mix(in srgb, var(--err-soft) 70%, transparent); }
.vc-row[data-res="pass"] { background: color-mix(in srgb, var(--ok-soft) 55%, transparent); }
.vc-row.flash { box-shadow: inset 3px 0 0 var(--err); }
.vc-head, .vc-tick { display: flex; align-items: flex-start; gap: 8px; }
.vc-tick { cursor: pointer; }
.vc-tick input { margin-top: 2px; }
.vc-n { font: 600 11px var(--mono); color: var(--muted); background: var(--side); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; flex: none; margin-top: 1px; }
.vc-t { flex: 1; min-width: 0; font-size: 13px; color: var(--ink); }
.vc-note { width: 100%; font-size: 12.5px; }
.vc-row:not([data-res="fail"]) .vc-note:placeholder-shown:not(:focus) { background: transparent; border-color: transparent; padding-left: 0; }
.vc-head + .vc-note, .vc-tick + .vc-note { margin-left: 34px; width: calc(100% - 34px); }
.vc-seg { display: inline-flex; flex: none; border: 1px solid var(--field-line); border-radius: var(--r-2); overflow: hidden; background: var(--field); }
.vc-seg label { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; font-size: 12px; font-weight: 500; color: var(--muted); cursor: pointer; user-select: none; }
.vc-seg label + label { border-left: 1px solid var(--field-line); }
.vc-seg input { position: absolute; opacity: 0; pointer-events: none; }
.vc-seg .i { width: 13px; height: 13px; }
.vc-seg label:has(input:focus-visible) { box-shadow: inset 0 0 0 2px var(--btn-primary-ring, var(--accent)); }
.vc-seg label.pass:has(input:checked) { background: var(--ok); color: #fff; }
.vc-seg label.fail:has(input:checked) { background: var(--err); color: #fff; }
.vc-seg label:hover:not(:has(input:checked)) { background: var(--hover); color: var(--ink); }
.vc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.verdict[data-mode="check"] .vc-fields { grid-template-columns: 1fr; }
.vc-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.vc-sum { margin: 0; font-size: 12.5px; color: var(--muted); min-height: 1.5em; }
.vc-sum.t-ok { color: var(--ok); } .vc-sum.t-err { color: var(--err); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; align-self: flex-start; }
.link-btn:hover { color: var(--ink); }
.vc-loading { margin: 0; }
@media (max-width: 640px) {
  .vc-head { flex-wrap: wrap; }
  .vc-seg { margin-left: 34px; }
  .vc-fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .vc-row { transition: none; } }
.modal.has-verdict .move-hint { display: none; }
.modal.has-verdict .composer textarea { height: 76px; }

/* Review's workbench: the queue, and the selected ticket with its result */
.bench { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.bench-list { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; box-shadow: var(--shadow-1); position: sticky; top: 64px; max-height: calc(100vh - 88px); overflow-y: auto; }
.bench-proj { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--side); border-bottom: 1px solid var(--line-2); }
.bench-proj .count { margin-left: auto; }
.bench-row { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); color: var(--ink); border-left: 3px solid transparent; }
.bench-row:last-child { border-bottom: 0; }
.bench-row:hover { background: var(--hover); text-decoration: none; }
.bench-row.on { background: var(--accent-soft); border-left-color: var(--accent); }
.br-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.br-top .ref { font: 500 12px var(--mono); }
.br-top .due { display: inline-flex; align-items: center; gap: 3px; } .br-top .due .i { width: 12px; height: 12px; }
.br-top .grow { flex: 1; }
.br-title { font-weight: 500; font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bench-pane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); min-width: 0; }
.bench-h { padding: 16px 18px 12px; border-bottom: 1px solid var(--line-2); }
.bench-h h2 { margin: 8px 0 6px; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.bench-ref { display: flex; align-items: center; gap: 8px; }
.bench-ref .ref-key { font: 500 12px var(--mono); color: var(--muted); }
.bench-sec { padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.bench-sec:last-child { border-bottom: 0; }
.bench-sec h3 { margin: 0 0 8px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; text-transform: none; color: var(--ink-2); }
.bench-sec h3 .i { width: 14px; height: 14px; color: var(--muted); }
details.bench-sec > summary { cursor: pointer; list-style: none; }
details.bench-sec > summary::-webkit-details-marker { display: none; }
details.bench-sec:not([open]) h3 { margin: 0; }
details.bench-sec > summary h3::after { content: "›"; margin-left: 4px; color: var(--faint); transition: transform .15s; display: inline-block; }
details.bench-sec[open] > summary h3::after { transform: rotate(90deg); }
.bench-sec.decide { background: color-mix(in srgb, var(--side) 60%, transparent); border-radius: 0 0 var(--r-3) var(--r-3); }
.bench-form { display: flex; flex-direction: column; gap: 10px; }
.bench-foot { display: flex; align-items: center; gap: 10px; }
.bench-foot .grow { flex: 1; }
.where { display: flex; flex-wrap: wrap; gap: 6px; }
.where-l { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; color: var(--ink-2); background: var(--panel); max-width: 100%; }
.where-l span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.where-l .i { width: 13px; height: 13px; color: var(--muted); }
.where-l:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.bench-c { border: 1px solid var(--line); border-radius: var(--r-2); padding: 10px 12px; background: var(--panel); font-size: 13px; }
.bench-c header { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.bench-c.k-ko { border-color: color-mix(in srgb, var(--err) 35%, var(--line)); }
.bench-c .c-body .md > :last-child { margin-bottom: 0; }
@media (max-width: 900px) {
  .bench { grid-template-columns: 1fr; }
  .bench-list { position: static; max-height: none; }
}

/* The Overview's progress for the team and the client */
.cs-progress { display: flex; align-items: flex-start; gap: 16px; }
.cs-progress .grow-1 { flex: 1; min-width: 0; }
.cs-progress .legend { margin: 8px 0 0; }
.cs-num { display: flex; flex-direction: column; flex: none; line-height: 1.15; }
.cs-num b { font-size: 22px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cs-num span { font-size: 12px; color: var(--muted); }
.batch-prog { display: flex; flex-direction: column; padding: 4px 0; }
.bp-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px 44px 110px; align-items: center; gap: 12px; padding: 8px 16px; }
.bp-row + .bp-row { border-top: 1px solid var(--line-2); }
.bp-name { display: flex; gap: 8px; min-width: 0; align-items: baseline; }
.bp-name b { font: 600 12px var(--mono); color: var(--ink-2); flex: none; }
.bp-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bp-bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.bp-n { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-2); text-align: right; }
@media (max-width: 640px) { .bp-row { grid-template-columns: minmax(0, 1fr) 44px; } .bp-bar { grid-column: 1 / -1; grid-row: 2; } .bp-t { display: none; } .cs-progress { flex-direction: column; gap: 8px; } }
.branch-sug { display: inline-flex; align-items: center; gap: 2px; margin-top: 4px; max-width: 100%; }
.branch-sug code { font: 12px var(--mono); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.next-step .branch-sug .copy-btn { opacity: .8; }
@media (max-width: 640px) { .vc-head .vc-t { flex-basis: calc(100% - 44px); } .vc-head + .vc-note { margin-left: 0; width: 100%; } }

/* ── Repositories through the GitHub App (UX.md section 12): the picker, its empty states, Admin → GitHub ── */
.gh-picker { display: flex; flex-direction: column; gap: 12px; }
.gh-empty { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px dashed var(--field-line); border-radius: var(--r-3); background: var(--bg); }
.gh-empty b { color: var(--ink); }
.gh-empty p { margin: 4px 0 8px; font-size: 13px; color: var(--ink-2); }
.gh-empty p.small { margin: 0; }
.gh-empty-ic { width: 32px; height: 32px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.gh-area { display: flex; flex-direction: column; gap: 8px; }
.gh-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gh-head .grow { flex: 1; }
.gh-search { position: relative; display: inline-flex; align-items: center; flex: 1 1 240px; max-width: 360px; }
.gh-search .i { position: absolute; left: 9px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.gh-picker .gh-area .gh-search input[type=search][data-gh-search] { width: 100%; padding-left: 30px; } /* past the controls rule (0,4,1) */
.gh-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-3); max-height: 420px; overflow: auto; background: var(--panel); }
.gh-repo { border-bottom: 1px solid var(--line-2); padding: 8px 12px; }
.gh-repo:last-child { border-bottom: 0; }
.gh-repo.on { background: color-mix(in srgb, var(--accent-soft) 55%, var(--panel)); }
.gh-repo.gone { background: var(--warn-soft); }
.gh-tick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; font-size: 13px; margin: 0; }
.gh-tick input { margin: 0; }
.gh-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.gh-name .i { width: 14px; height: 14px; color: var(--muted); }
.gh-name b { font-weight: 600; overflow-wrap: anywhere; }
.gh-def { margin-left: auto; }
.gh-gone-note { margin: 6px 0 0 24px; }
.gh-fields { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 8px 0 2px 24px; }
.gh-fields[hidden] { display: none; }
.gh-fields label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); margin: 0; }
.gh-fields select { min-width: 120px; max-width: 200px; }
.gh-fields label.gh-missing select { border-color: var(--warn); }
.gh-repo.loading .gh-fields select { opacity: .6; }
.gh-other > summary { cursor: pointer; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.gh-other[open] > summary { margin-bottom: 8px; }
.gh-steps { margin: 8px 0 0; padding-left: 20px; font-size: 13px; color: var(--ink-2); display: flex; flex-direction: column; gap: 6px; }
.gh-setup-help { padding: 10px 18px 14px; }
.gh-setup-help summary { cursor: pointer; }
.set .gh-steps { padding-right: 18px; }
.ns-branch { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.gh-accounts { display: flex; flex-direction: column; gap: 12px; }
.gh-acc-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--panel); }
.gh-acc { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; min-height: 44px; }
.gh-acc:last-child { border-bottom: 0; }
.gh-acc .grow { flex: 1; }
.gh-acc form { margin: 0; }
.gh-acc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gh-acc-actions form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.gh-prov { flex: none; }
.gh-prov-github { background: var(--line-2); color: var(--ink-2); }
.gh-prov-gitlab { background: color-mix(in srgb, #fc6d26 16%, var(--panel)); color: color-mix(in srgb, #e24329 80%, var(--ink)); }
.gh-events { margin-top: 4px; }
.set .gh-events { padding: 10px 18px 0; }
.gh-events > summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.gh-events > summary .i { width: 14px; height: 14px; color: var(--muted); }
.gh-ev-list { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--panel); }
.gh-ev { display: flex; align-items: baseline; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.gh-ev:last-child { border-bottom: 0; }
.gh-ev .pill { flex: none; }
.gh-ev-t { flex: 1; min-width: 0; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 2px; }
.gh-ev time { flex: none; font-size: 12px; color: var(--muted); }
@media (max-width: 640px) {
  .gh-ev { flex-wrap: wrap; }
  .gh-ev time { margin-left: auto; }
  .gh-fields { margin-left: 0; }
  .gh-fields label { min-width: 0; flex: 1 1 130px; }
  .gh-fields select, .gh-fields input:not([type=hidden]) { width: 100%; min-width: 0; max-width: none; }
  .gh-def { margin-left: 0; width: 100%; }
}

/* A project followed, not worked in (an admin's observer role, a SuperAdmin's support view): the PM's pages, without
   their write controls. Core refuses the writes anyway; this keeps the page from offering them. */
.ro-banner { background: var(--accent-soft); color: var(--accent); }
.read-only form[method="post"], .read-only [data-new-ticket], .read-only [data-open]:not([data-open="palette"]):not([data-open="shortcuts"]),
.read-only .attn-agent { display: none !important; }
