/* Maestro Workspaces — space-age blue: cool blue-biased neutrals, cobalt
   accent, sterile-clean light mode, deep-space dark (item 551).
   Tokens: --accent-ink is for accent-colored TEXT (AA in both modes);
   --accent is for fills/borders/decoration only. *-soft = tinted backgrounds.
   --warn is the amber caution channel — cautions must NOT ride --accent
   (blue) or --danger (error); --review is the review-stage purple. */

/* Feature-package styles (one file per package — parallel-build ownership). */
@import url("./wp-members.css");
@import url("./wp-workspace.css");
@import url("./wp-mywork.css");
@import url("./wp-notify.css");
@import url("./wp-board.css");
@import url("./wp-drawer.css");
@import url("./wp-live.css");
@import url("./wp-connect.css");
@import url("./wp-account.css");
@import url("./wp-settings.css");
@import url("./wp-projects.css");
@import url("./wp-project.css");
@import url("./wp-threads.css");
@import url("./wp-knowledge.css");
@import url("./wp-projsettings.css");
@import url("./wp-skills.css");
@import url("./wp-code.css");
@import url("./wp-help.css");
/* MUST follow wp-help.css — wp-whatsnew reuses .hp-* layout and its rail rules
   win equal-specificity ties only by source order. */
@import url("./wp-whatsnew.css");
@import url("./wp-sites.css");
@import url("./wp-milestones.css");

:root {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Instrument Serif", Georgia, serif;
}

/* Dark is also the pre-JS fallback (theme.js sets data-theme before paint). */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f131a;
  --panel: #151a23;
  --panel-2: #1c2230;
  --border: #2b3344;
  --border-soft: #222937;
  --text: #e6eaf2;
  --text-dim: #7e8798;
  --muted: #939db0;
  --accent: #6f9aff;
  --accent-ink: #8caeff;
  --accent-soft: rgba(111, 154, 255, .14);
  --warn: #e5b84f;
  --warn-soft: rgba(229, 184, 79, .14);
  --review: #b592ff;
  --review-soft: rgba(181, 146, 255, .13);
  --danger: #ff7285;
  --danger-soft: rgba(255, 114, 133, .12);
  --ok: #43d68f;
  --ok-soft: rgba(67, 214, 143, .12);
  --focus: rgba(111, 154, 255, .5);
  --shadow: rgba(2, 6, 16, .5);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #ecf0f6;
  --border: #d7dde7;
  --border-soft: #e4e9f1;
  --text: #161b25;
  --text-dim: #8a93a3;
  --muted: #5b6577;
  --accent: #2e63e7;
  --accent-ink: #2451c7;
  --accent-soft: rgba(46, 99, 231, .08);
  --warn: #9a6a03;
  --warn-soft: rgba(154, 106, 3, .12);
  --review: #6d3fc0;
  --review-soft: rgba(109, 63, 192, .1);
  --danger: #c22f45;
  --danger-soft: rgba(194, 47, 69, .09);
  --ok: #137a4e;
  --ok-soft: rgba(19, 122, 78, .1);
  --focus: rgba(46, 99, 231, .45);
  --shadow: rgba(23, 34, 56, .14);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  /* faint atmospheric glow at the page top — depth from light, not lines */
  background: radial-gradient(900px 460px at 50% -180px, var(--accent-soft), transparent 70%), var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h1 { font-weight: 650; font-size: 24px; margin: 4px 0 20px; letter-spacing: -.015em; }
h1 .thin { color: var(--muted); }

/* Page context — the quiet parent trail app.js setCrumbs() renders directly
   above each view's own title (the topbar carries no breadcrumbs any more). */
#page-context { display: flex; align-items: center; gap: 7px; font-size: 13px; margin: 0 0 2px; }
.pc-link { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.pc-link:hover { color: var(--accent-ink); }
.pc-sep { color: var(--border); }
h2 { font-size: 22px; font-weight: 500; margin: 0 0 12px; }
h3 { font-size: 17px; font-weight: 500; margin: 0 0 8px; }

.mono { font-family: var(--mono); font-size: .93em; letter-spacing: .01em; }
kbd {
  font-family: var(--mono); font-size: 12px; line-height: 1;
  background: var(--panel-2); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 3px 6px;
}

/* ---------- avatars (dom.js avatarNode; sized inline) ---------- */
.avatar, .chip-avatar, .chip-initials {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; flex: none; object-fit: cover; overflow: hidden;
}
.avatar.initials, .chip-initials {
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--muted); font-weight: 500; letter-spacing: .04em;
}
.avatar.agent {
  border: 1px solid var(--accent); background: var(--accent-soft);
  color: var(--accent-ink); font-weight: 600; letter-spacing: .02em;
}

/* ---------- topbar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  height: 56px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: baseline; gap: 8px; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
/* the SVG logo mark (assets/maestro-mark.svg) — transparent, its own colors */
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  transform: translateY(5px);
}
.brand-mark img { width: 100%; height: 100%; display: block; }
.top-right { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.top-link { color: var(--muted); font-size: 14px; }
.top-link:hover { color: var(--text); }
.as-btn { background: none; border: none; padding: 0; }
#notify-bell { display: inline-flex; align-items: center; }
.rt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.rt-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
.user-chip:hover { color: var(--text); }
.chip-name { max-width: 160px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Narrow screens: the brand and the right-hand cluster together overflow the
   document. That overflow is not just cosmetic — a position:fixed overlay
   sizes to the overflowed document width, so dialogs get pushed off the
   visible viewport. Shed the duplicated bits and tighten the spacing. */
@media (max-width: 640px) {
  #topbar { gap: 10px; padding: 0 12px; }
  .top-right { gap: 12px; }
  .top-link { display: none; }    /* My Work is in the sidebar, behind the ☰ toggle */
  .chip-name { display: none; }   /* the avatar still opens the account menu */
}

.pop-user { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-width: 220px; }
.pop-user-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pop-user-name { color: var(--text); }
.pop-user-email { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.pop-user .role-badge { align-self: flex-start; margin-top: 3px; }

/* ---------- main / generic ---------- */
#main { max-width: 1360px; margin: 0 auto; padding: 32px 28px 96px; }
.sub { color: var(--muted); margin: -14px 0 24px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 14px; color: var(--text);
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: none; }
.btn.danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn.small { min-height: 28px; padding: 3px 10px; font-size: 13px; }
input.text, textarea.text {
  min-height: 36px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px; width: 100%;
}
input.text:focus, textarea.text:focus { border-color: var(--accent); }
.err { color: var(--danger); margin-top: 10px; min-height: 20px; }
.muted { color: var(--muted); }
.spin { color: var(--muted); padding: 48px 0; text-align: center; }

/* ---------- maestro shared badges (components/maestro.js; WP0-owned) ---------- */
.m-pill {
  display: inline-flex; align-items: center;
  padding: 1px 9px; border-radius: 999px;
  font-size: 12px; line-height: 1.7; white-space: nowrap;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.m-pill.st-active, .m-pill.st-completed, .m-pill.st-resolved, .m-pill.st-approved {
  background: var(--ok-soft); border-color: var(--ok); color: var(--ok);
}
.m-pill.st-building, .m-pill.st-executing, .m-pill.st-running, .m-pill.st-busy,
.m-pill.st-triaging, .m-pill.st-planning, .m-pill.st-reviewing,
.m-pill.st-cloning, .m-pill.st-parsing, .m-pill.st-indexing {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink);
}
.m-pill.st-failed, .m-pill.st-blocked, .m-pill.st-rejected,
.m-pill.st-degraded, .m-pill.st-timed_out {
  background: var(--danger-soft); border-color: var(--danger); color: var(--danger);
}
.m-kind {
  display: inline-flex; align-items: center;
  padding: 1px 8px; border-radius: 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  background: var(--panel-2); border: 1px solid var(--border-soft); color: var(--muted);
}
.m-kind.k-bug, .m-kind.k-security { border-color: var(--danger); color: var(--danger); }
.m-prio { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex: none; }
.m-prio.p-critical { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.m-prio.p-high { background: var(--danger); }
.m-prio.p-medium { background: var(--accent); }
.m-event-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  font-size: 12px; background: var(--panel-2); border: 1px solid var(--border-soft);
  color: var(--muted);
}
.m-event-icon.ev-build_failed, .m-event-icon.ev-agent_error, .m-event-icon.ev-callback_failed { color: var(--danger); border-color: var(--danger); }
.m-event-icon.ev-build_completed, .m-event-icon.ev-resolution { color: var(--ok); border-color: var(--ok); }
.m-project-link { color: var(--accent-ink); }
.m-project-link:hover { text-decoration: underline; }

/* ---------- toasts ---------- */
#toast-holder { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 11px 16px; max-width: 400px; font-size: 14px;
  box-shadow: 0 6px 24px var(--shadow);
  animation: slidein .18s ease-out;
}
.toast.error { border-left-color: var(--danger); }
.toast.undo { display: flex; align-items: center; gap: 14px; }
.undo-msg { flex: 1; min-width: 0; }
.undo-btn {
  background: none; border: none; padding: 2px 4px; flex: none;
  color: var(--accent-ink); font-weight: 600;
}
.undo-btn:hover { text-decoration: underline; }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }

/* ---------- login ---------- */
.login-wrap { max-width: 380px; margin: 12vh auto 0; }
.login-wrap h1 { text-align: center; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- workspaces ---------- */
/* min(320px, 100%) rather than a bare 320px: a hard min track cannot shrink
   below its floor, so on a viewport narrower than that the card pushed the
   document wider than the screen (and a position:fixed overlay sizes to the
   document, taking dialogs off-screen with it). */
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.ws-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.ws-card h3 { margin: 0 0 2px; font-weight: 500; font-size: 17px; }
.ws-role { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.ws-boards { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.board-link {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; border: 1px solid var(--border-soft); border-radius: 8px;
  background: var(--panel-2);
}
.board-link:hover { border-color: var(--accent); }
.board-count { color: var(--muted); font-size: 13px; }
.ws-new { border-style: dashed; display: flex; flex-direction: column; gap: 10px; justify-content: center; }

/* ---------- board head + filters ---------- */
.board-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
/* compact: the board name is a wayfinding label in a working surface, not a
   page headline — the global h1 scale would fight the icon cluster (551) */
.board-head h1 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.board-title { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 160px; }
/* Visible at rest, not hover-to-reveal. This menu is the only route to the
   board's settings AND to its archived items, and a control you cannot see is
   one you cannot look for — hover-to-reveal only works for things you already
   know are there. Muted so it stays quiet next to the title, full on
   hover/focus. */
.board-title .board-more { opacity: .45; transition: opacity .15s; font-size: 13px; padding: 2px 8px; }
.board-title:hover .board-more, .board-title .board-more:focus-visible { opacity: 1; }
/* Only rendered when the board is actually published — a private board carries
   no badge, so this reads as a state worth noticing rather than a label every
   board wears. Sits before the ⋯ so a rename never pushes it off the row. */
.board-vis {
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  color: var(--accent); border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
/* Same quiet-at-rest treatment as .board-more, and rendered only when the
   board actually has a description — so it reads as "there is something to
   read here", not as chrome every board wears. */
.board-title .board-desc-btn { opacity: .45; transition: opacity .15s; font-size: 13px; padding: 2px 6px; }
.board-title:hover .board-desc-btn, .board-title .board-desc-btn:focus-visible { opacity: 1; }
/* Wider than the menu popover it shares a shell with: this holds prose, and
   .pop's 300px cap would set it in a column too narrow to read. The width has
   to be lifted on .pop itself — a max-width on the inner node cannot widen the
   container that clamps it. */
.pop:has(.board-desc-pop) { max-width: 420px; }
.board-desc-pop { padding: 4px 10px; font-size: 13px; }
.board-desc-pop > :first-child { margin-top: 0; }
.board-desc-pop > :last-child { margin-bottom: 0; }

.board-rename { font-size: 22px; font-weight: 650; letter-spacing: -.01em; max-width: 380px; }

/* One height for every control in the bar, from one rule.
 *
 * `height`, NOT `min-height` — this is the whole point. Each control type
 * derives its height from a different mechanism, so a shared `min-height`
 * aligns nothing: it is a floor for some, dead code for the search input
 * (whose 1.6 line-height overshoots it) and irrelevant to anything with no
 * box of its own. A fixed height plus a normalized line-height collapses
 * them, and — because the selector is `> *` — a control added to the bar
 * later inherits the alignment with no CSS of its own. Do not "tidy" this
 * back to min-height.
 *
 * .filterbar has exactly one markup site (board.js renderShell), so the
 * wildcard cannot reach anything else. box-sizing is already border-box
 * globally (see the reset at the top of this file).
 *
 * Controls are grouped by JOB and order carries that meaning within the one
 * right-aligned cluster: READ (pulse), FIND (search), REFINE (Filter),
 * SHAPE (Group, Columns, view), SURFACE (archived, own mode). Adding a
 * control means deciding where in that order it belongs — that decision is
 * the layout. */
.filterbar {
  --control-h: 30px;
  display: flex; gap: 5px; align-items: center; flex-wrap: wrap;
  margin-left: auto;
}
.filterbar > * { height: var(--control-h); line-height: 1.2; }

/* Expanding search: a 30px icon at rest, a real input on focus — and pinned
   open by .holding while it carries text (board.js syncSearchHold), because
   search is the one filter whose state has no chip. */
.fsearch { position: relative; display: flex; align-items: center; border: 1px solid transparent; border-radius: 8px; }
.fsearch:hover { background: var(--panel-2); }
.fsearch:focus-within, .fsearch.holding { border-color: var(--border); background: var(--panel); }
.fsearch .icon { position: absolute; left: 7px; color: var(--muted); pointer-events: none; }
.fsearch input.text {
  height: 100%; min-height: 0; width: 30px;
  border: none; background: none; cursor: pointer;
  padding: 0 8px 0 30px; border-radius: 8px; font-size: 13.5px;
  transition: width .18s ease;
}
.fsearch:focus-within input.text, .fsearch.holding input.text { width: 200px; cursor: text; }
.fsearch input.text::placeholder { color: transparent; }
.fsearch:focus-within input.text::placeholder { color: var(--muted); opacity: .7; }
/* the "/" shortcut hint: hover-only, never while the input is open */
.fsearch kbd { position: absolute; right: 7px; font-size: 10px; padding: 1px 5px; opacity: 0; pointer-events: none; transition: opacity .12s; }
.fsearch:hover:not(:focus-within):not(.holding) kbd { opacity: .75; }

/* One trigger shape for every dropdown and toggle in the bar. `.on` is the
 * single accent state, and it means the same thing everywhere: this control
 * is currently doing something (a filter is applied, a surface is open). */
.fpill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 10px; white-space: nowrap; font-size: 14px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 9px; color: var(--muted);
}
.fpill:hover { color: var(--text); border-color: var(--muted); }
.fpill .icon { flex: none; }
.fpill.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
/* icon-square variant: name and value ride the tooltip/aria-label; the count
   badge (state) stays visible, as a corner dot */
.fpill.iconic {
  width: 30px; padding: 0; justify-content: center;
  position: relative; overflow: visible;
  background: none; border-color: transparent;
}
.fpill.iconic:hover { background: var(--panel-2); }
.fpill.iconic.on { background: var(--accent-soft); border-color: transparent; }
.fcount {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--bg);
  font-size: 11px; font-weight: 600; line-height: 1;
}
.fpill.iconic .fcount {
  position: absolute; top: -4px; right: -4px;
  min-width: 15px; height: 15px; padding: 0 4px; font-size: 10px;
}

.fseg {
  display: inline-flex; padding: 2px; gap: 2px; margin-left: 3px;
  background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 8px;
}
.fseg button {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; padding: 0 6px;
  border: 0; border-radius: 6px; background: none; color: var(--muted);
}
.fseg button:hover { color: var(--text); }
.fseg button[aria-pressed="true"] {
  background: var(--panel); color: var(--text); box-shadow: 0 1px 2px var(--shadow);
}

/* Applied filters, spelled out. The bar's badge says THAT filtering is on;
 * this row says WHAT — which a <select> could only do by being read. Each
 * chip clears exactly its own filter. Search is deliberately absent: it has
 * a permanent box showing its own text, so a chip would double-report it.
 * :empty collapses the row, so it costs nothing at rest. */
.fchips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex-basis: 100%; }
.fchips:empty { display: none; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 4px 0 10px; border-radius: 999px; font-size: 13px;
  background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent-ink);
}
.fchip-k { opacity: .7; }
.fchip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; padding: 0; flex: none;
  border: 0; border-radius: 50%; background: none; color: inherit;
}
.fchip-x:hover { background: var(--accent); color: var(--bg); }
.fclear {
  border: 0; background: none; padding: 2px 4px; font-size: 13px; color: var(--muted);
  text-decoration: underline; text-underline-offset: 2px;
}
.fclear:hover { color: var(--text); }

/* ---------- sections + table ---------- */
.section { margin-bottom: 32px; }
.section-head {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 2px 10px;
}
.section-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.section-title { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.section-count { color: var(--muted); font-size: 13px; }
/* the flat frame's "● Building 3 ————" rule; also the anchor patched chips
   insert before (board.js refreshSectionChips) */
.section-rule { flex: 1; height: 1px; background: var(--border-soft); margin-left: 4px; min-width: 24px; }

.tbl { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel); }
/* The board's flat variant (554): no box — the section header's rule and
   inset hairlines between rows carry the structure. Scoped by the extra
   class because .tbl is a shared primitive (usage, project, threads,
   knowledge keep the boxed form). */
.tbl.flat { border: none; border-radius: 0; background: none; overflow: visible; }
.tbl.flat .trow { border-bottom: none; }
.tbl.flat .trow.item { position: relative; }
.tbl.flat .trow.item::after {
  content: ""; position: absolute; left: 68px; right: 12px; bottom: 0;
  height: 1px; background: var(--border-soft);
}
/* a parent row fuses with its well — no line slicing them apart */
.tbl.flat .trow.item:has(+ .kids-well)::after { display: none; }
.tbl.flat .trow.head {
  background: none; color: var(--text-dim);
  font-family: var(--mono); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .07em;
  min-height: 30px; border-bottom: 1px solid var(--border-soft);
}
.tbl.flat .add-row { background: none; }
.trow {
  display: grid; align-items: center;
  border-bottom: 1px solid var(--border-soft);
  min-height: 40px;
}
.trow:last-child { border-bottom: none; }
.trow.head { background: var(--panel-2); color: var(--muted); font-size: 13px; min-height: 34px; }
.trow.item:hover { background: var(--panel-2); }
.trow.dragging { opacity: .35; }
.trow.drop-above { box-shadow: inset 0 2px 0 var(--accent); }
.tcell { padding: 10px 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcell.title-cell { display: flex; align-items: center; gap: 8px; cursor: pointer; }
/* Hover-reveal: the grip repeated on every row was chrome noise (item 551).
   The cell keeps its track — only the glyph fades — so revealing it can
   never shift the row's layout. */
.drag-grip { color: var(--muted); cursor: grab; user-select: none; opacity: 0; transition: opacity .12s; }
.trow.item:hover .drag-grip { opacity: .85; }
.tcell.sel-cell { display: flex; align-items: center; justify-content: center; padding: 10px 0 10px 10px; }
.tcell.sel-cell input { accent-color: var(--accent); cursor: pointer; margin: 0; }

/* A column header that is ALSO a control (item 563): group by this column, or
   narrow the board to some of its values. Emitted as a real <button> so Tab
   reaches it and Enter opens it with no keyboard code of our own — which means
   undoing the UA button styling to put the header look back.
   `font: inherit` is not sufficient on its own: the head row's appearance is
   also text-transform and letter-spacing, which the shorthand does not carry.
   `text-align: left` is not decoration either — a button defaults to centre
   while every value cell beneath it is left-aligned, so without it the labels
   stop lining up with their columns (.pop-item declares it for the same
   reason). No `display`, deliberately: as a grid item the button blockifies
   and .tcell's ellipsis keeps working, which a flex container would break. */
.trow.head .thfilter {
  background: none; border: 0; border-radius: 6px;
  font: inherit; color: inherit;
  text-transform: inherit; letter-spacing: inherit; text-align: left;
  cursor: pointer;
}
.trow.head .thfilter:hover { color: var(--text); }
/* The same single accent state as .fpill.on — "this control is currently doing
   something" — so a filtered column says so without being opened. The funnel
   repeats it in the icon language for anyone who cannot pick the colour up. */
.trow.head .thfilter.on { color: var(--accent-ink); box-shadow: inset 0 -2px 0 var(--accent); }
.trow.head .thfilter .icon { margin-left: 5px; vertical-align: -1px; opacity: .85; }
.trow.head .thfilter:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* The subject is the row's payload: it wraps to a second line before it
   ellipses (.tcell's nowrap is overridden here). Value cells stay put —
   .trow is align-items:center, so they center against the taller row. */
.title-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  overflow-wrap: anywhere;
  overflow: hidden;
  text-overflow: ellipsis;
}
.title-text:hover { text-decoration: underline dotted var(--muted); }
.note-count { color: var(--muted); font-size: 13px; }

/* quiet mono id prefixing item subjects (board rows, kanban cards, drawer,
   My Work, archived list) — a bordered white badge repeated on every row was
   chrome noise; plain muted mono reads in both themes (item 551) */
.item-id {
  flex: 0 0 auto;
  display: inline-block;
  margin-right: 6px;
  font-family: var(--mono);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: middle;
}
/* flex-gap containers already space their children */
.title-cell .item-id, .sub-row .item-id { margin-right: 0; }

.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 76px; padding: 3px 12px; border-radius: 20px;
  font-size: 13px; color: var(--text); font-weight: 500;
  border: none; background: var(--panel-2);
}
/* Soft value bubble (item 554, the 551-mockup treatment): the option's OWN
   color as INK on a faint wash of it. --opt arrives inline from pickers.js
   pillProps() — the ONLY sanctioned way to color a pill; nothing sets a
   solid background anymore. The ink mix is TEXT-dominant so any user hex
   stays readable on both themes and pathological near-bg colors degrade
   toward muted, never toward invisible. */
.pill.soft {
  background: color-mix(in srgb, var(--opt) 15%, transparent);
  color: color-mix(in srgb, var(--opt) 50%, var(--text));
  font-weight: 550;
}
.pill.empty { background: transparent; border: 1px dashed var(--border); color: var(--muted); font-weight: 400; }
/* Inside table rows the empty affordance is quiet until the row is engaged —
   border reserved (transparent) so the reveal can never move the row. The
   drawer / My Work / milestone header pills have no row to hover, so the
   base dashed state above still serves them; and where hover does not exist
   at all, the affordance stays visible at rest. */
.trow .pill.empty { border-color: transparent; }
.trow:hover .pill.empty, .trow:focus-within .pill.empty { border-color: var(--border); }
@media (hover: none) { .trow .pill.empty { border-color: var(--border); } }
.chips { display: flex; gap: 5px; align-items: center; flex-wrap: nowrap; overflow: hidden; }
/* Owner cells in table rows: avatar circles only (554 mockup) — the name
   span and assign chip reveal on row engagement. The drawer's person editor
   is not inside a .trow and keeps its full chips. Opacity/display are scoped
   so cell heights never change. */
.trow .person-chip { border: none; background: none; padding: 0; }
.trow .person-chip .person-name { display: none; }
.trow .chip.add { opacity: 0; transition: opacity .12s; }
.trow:hover .chip.add, .trow:focus-within .chip.add { opacity: 1; }
@media (hover: none) { .trow .chip.add { opacity: 1; } }
.chip {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 10px; font-size: 13px; white-space: nowrap;
}
.chip.add { color: var(--muted); border-style: dashed; background: none; }
.cellbtn { background: none; border: none; padding: 0; width: 100%; text-align: left; }
input.cell-edit { background: var(--panel-2); border: 1px solid var(--accent); border-radius: 6px; padding: 4px 8px; width: 100%; }
input.cell-date { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; color: var(--text); font-size: 13px; }

.add-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel); }
.add-row input {
  flex: 1; background: none; border: none; color: var(--text);
  padding: 6px 2px;
}
.add-row input::placeholder { color: var(--muted); opacity: .7; }
.add-plus { color: var(--muted); }

/* ---------- batch action bar (multi-select) ---------- */
.batchbar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 60; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  max-width: calc(100vw - 24px);
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
  box-shadow: 0 8px 28px var(--shadow);
}
.batchbar .count { font-size: 14px; color: var(--muted); white-space: nowrap; padding-right: 4px; }
.batchbar .batch-set, .batchbar .batch-set-value { display: flex; align-items: center; gap: 6px; }
.batchbar input.text { min-height: 30px; padding: 3px 9px; font-size: 13px; width: 130px; }
/* Plain styled <select>. Named for the filter bar it was born in; that bar
   now uses popovers, and batchbar.js is the only caller left — the rule lives
   here rather than being renamed, because the class name is load-bearing in
   five places for a control whose appearance is not changing. */
.fsel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; color: var(--muted); max-width: 180px;
}

/* ---------- tooltip (dom.js, data-tip) ---------- */
/* Inverted rather than panel-coloured, so it reads as an overlay ON the UI
   instead of another surface IN it — .pop is the panel shape, and the two must
   not be confusable. pointer-events:none so it can never eat the click the
   user is lining up on the control underneath. */
.tip {
  position: fixed; z-index: 95; pointer-events: none;
  max-width: 260px; padding: 5px 9px; border-radius: 7px;
  background: var(--text); color: var(--bg);
  font-size: 12.5px; line-height: 1.45;
  box-shadow: 0 4px 14px var(--shadow);
  animation: tipin .12s ease-out;
}
@keyframes tipin { from { opacity: 0; transform: translateY(-2px); } }

/* ---------- popover menu ---------- */
.pop {
  position: fixed; z-index: 90; min-width: 190px; max-width: 300px; max-height: 340px; overflow: auto;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px var(--shadow); padding: 6px;
}
.pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; border-radius: 8px; padding: 9px 12px; text-align: left;
}
.pop-item:hover { background: var(--panel); }
.pop-item .section-dot { flex: none; }
.pop-item.checked { color: var(--accent-ink); }
.pop-sep { border-top: 1px solid var(--border-soft); margin: 5px 0; }
/* Section label inside a popover that groups several kinds of choice (the
 * board filter menu). Not interactive — a header, not a dead menu item. */
.pop-head {
  padding: 8px 12px 4px; font-size: 11px;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.pop-grow { flex: 1; }
/* A row that reports rather than acts (the grouping column in the Columns
   menu). Must come AFTER .pop-item:hover — equal specificity, later wins. */
.pop-static { color: var(--muted); }
.pop-static:hover { background: none; }
.pop-note { font-size: 12px; color: var(--muted); }
/* Switch, for a popover row that toggles rather than picks. Rendered as a
 * shape rather than a checkbox so it reads at a glance in a menu of ✓ rows —
 * the two states must not be confusable with "selected". */
.pop-sw {
  position: relative; width: 30px; height: 18px; flex: none;
  border-radius: 999px; background: var(--border); transition: background .15s;
}
.pop-sw::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--panel);
  box-shadow: 0 1px 2px var(--shadow); transition: transform .15s;
}
.pop-sw.on { background: var(--accent); }
.pop-sw.on::after { transform: translateX(12px); }

/* ---------- drawer ---------- */
.drawer-veil { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 60; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw); z-index: 70;
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px var(--shadow);
  display: flex; flex-direction: column;
  animation: drawerin .16s ease-out;
}
@keyframes drawerin { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; gap: 10px; padding: 20px 20px 12px; }
.drawer-title { font-size: 19px; font-weight: 650; letter-spacing: -.01em; flex: 1; margin: 0; cursor: pointer; }
.drawer-body { flex: 1; overflow-y: auto; padding: 0 20px 20px; }
.drawer-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.dfield { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 12px; }
.dfield-label { color: var(--muted); font-size: 13px; }
/* The workspec sits on the drawer's own surface, not in a filled card — the
   identity-card header is the one panel-2 block. .desc-section carries the
   spacing; .desc-box is just the content wrapper. */
.desc-section { margin-bottom: 20px; }
.desc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.desc-head h4 { margin: 0; color: var(--muted); font-weight: 500; font-size: 13px; }
.desc-box .md { font-size: 14px; }
.desc-empty { color: var(--muted); font-style: italic; }
.desc-edit textarea { min-height: 220px; font-family: var(--mono); font-size: 13px; line-height: 1.55; }

.md h1, .md h2, .md h3 { font-weight: 650; letter-spacing: -.01em; margin: 12px 0 6px; }
.md h1 { font-size: 21px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; }
.md p { margin: 8px 0; }
.md code { font-family: var(--mono); font-size: .92em; background: var(--bg); border: 1px solid var(--border-soft); border-radius: 4px; padding: 1px 5px; }
.md pre { font-family: var(--mono); background: var(--bg); border: 1px solid var(--border-soft); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.md pre code { border: none; padding: 0; background: none; }
.md h4, .md h5, .md h6 { font-weight: 650; font-size: 15px; margin: 10px 0 6px; }
.md ul, .md ol { margin: 6px 0; padding-left: 22px; }
.md li { margin: 2px 0; }
.md li input[type="checkbox"] { margin-right: 6px; }
.md a { color: var(--accent-ink); text-decoration: underline; text-decoration-color: var(--accent); }
/* A resolved #NNN reference. Reads as a chip rather than prose so a long item
   title inlined mid-sentence stays visibly a reference and not a run-on. */
.md a.item-ref { text-decoration: none; background: var(--bg); border: 1px solid var(--border-soft); border-radius: 4px; padding: 0 5px; white-space: normal; }
.md a.item-ref:hover { border-color: var(--accent); }
.md blockquote { margin: 8px 0; padding: 4px 14px; border-left: 3px solid var(--border); color: var(--muted); }
.md hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.md img { max-width: 100%; border-radius: 8px; }
/* full markdown (docit) emits tables the old renderer never did — scroll a wide
   one inside its own box so it can't widen the drawer/panel */
.md table { border-collapse: collapse; margin: 10px 0; font-size: 13px; display: block; max-width: 100%; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 5px 10px; text-align: left; }
.md th { background: var(--panel-2); font-weight: 600; }

/* ---------- activity trail + comments ---------- */
.activity h4 { margin: 0 0 10px; color: var(--muted); font-weight: 500; font-size: 13px; }
.note { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border-soft); }
.note-kind { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; background: var(--border); }
.note-kind.comment { background: var(--accent); }
.note-kind.system { background: var(--muted); }
.note-body { flex: 1; min-width: 0; }
.note-meta { color: var(--muted); font-family: var(--mono); font-size: 12px; }
/* ---------- in-place tab strip (dom.js tabbed()) ---------- */
/* Switches panels without navigating; the mp-*-tabs elsewhere are route links. */
.ui-tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border-soft); margin-bottom: 14px;
}
.ui-tab {
  border: none; background: none; color: var(--muted);
  padding: 8px 14px; font-size: 13px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ui-tab:hover { color: var(--text); }
.ui-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.ui-tab-panel { display: none; }
.ui-tab-panel.active { display: block; }

.note-text { white-space: pre-wrap; word-break: break-word; }
/* Rendered comments: docit emits block elements, so drop pre-wrap (the markup
   already carries the line breaks — keeping it would double every blank line)
   and collapse the outer margins so a one-line comment stays as compact as the
   plain-text version it replaced. */
.note-text.md { white-space: normal; }
.note-text.md > :first-child { margin-top: 0; }
.note-text.md > :last-child { margin-bottom: 0; }
.note-text.md h1, .note-text.md h2, .note-text.md h3 { font-size: 15px; margin: 10px 0 4px; }
.note-text.md pre { font-size: 12px; }
.note-text.md table { font-size: 12px; }
.comment-box { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); align-items: center; }
.comment-box input.text { flex: 1; }

/* ---------- upload progress toast ---------- */
.progress-toast { min-width: 280px; }
.progress-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.progress-name { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-cancel { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.progress-cancel:hover { color: var(--text); }
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { width: 0; height: 100%; background: var(--accent); transition: width .12s ease-out; }
.progress-pct { font-family: var(--mono); font-size: 11px; color: var(--muted); min-width: 30px; text-align: right; }
.progress-toast.done .progress-fill { background: var(--ok); }

/* ---------- note attachments + lightbox ---------- */
.note-media { display: inline-block; margin-top: 6px; padding: 0; border: none; background: none; cursor: pointer; }
.note-media img { max-width: 280px; max-height: 190px; border-radius: 8px; border: 1px solid var(--border); display: block; }
.note-media:hover img { border-color: var(--muted); }
.note-media-file { display: inline-block; margin-top: 6px; color: var(--text); font-size: 13px; border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; }
.note-media-file:hover { border-color: var(--muted); }

.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .82); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; animation: fadein .12s ease-out; }
.lightbox-img { max-width: 92vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 12px 48px rgba(0, 0, 0, .6); cursor: default; }
.lightbox-close { position: fixed; top: 16px; right: 20px; width: 36px; height: 36px; border-radius: 50%; background: rgba(0, 0, 0, .55); border: 1px solid var(--border); color: #fff; cursor: pointer; font-size: 15px; line-height: 1; }
.lightbox-close:hover { background: rgba(0, 0, 0, .85); }
@keyframes fadein { from { opacity: 0; } }

/* ---------- my work ---------- */
.mw-board { margin-bottom: 26px; }
.mw-board h3 { margin: 0 0 10px; font-weight: 500; }
.mw-row {
  display: flex; gap: 12px; align-items: center;
  min-height: 44px; padding: 9px 14px;
  border: 1px solid var(--border-soft); border-radius: 8px;
  background: var(--panel); margin-bottom: 8px;
}
.mw-row:hover { border-color: var(--accent); }
.mw-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- kanban ---------- */
.kanban { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 24px; }
.lane {
  flex: 0 0 280px; background: var(--panel);
  border: 1px solid var(--border); border-top: 3px solid var(--accent);
  border-radius: 10px; padding: 12px;
}
.lane-over { border-color: var(--accent); }
.lane .section-head { padding: 2px 4px 10px; }
.lane .section-title { font-size: 15px; }
.lane-cards { display: flex; flex-direction: column; gap: 10px; min-height: 6px; }
.card {
  background: var(--panel-2); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 12px 14px; cursor: pointer;
}
.card:hover { border-color: var(--muted); }
.card.dragging { opacity: .4; }
.card.drop-above { box-shadow: 0 -2px 0 var(--accent); }
.card-title { margin-bottom: 8px; overflow-wrap: break-word; }
.card-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.card .pill { min-width: 0; padding: 2px 9px; font-size: 12px; }
.lane .add-row { background: none; padding: 8px 2px 0; }

@media (max-width: 760px) {
  .tcell.optional { display: none; }
  /* board.js sets the row template inline with tracks for every value
     column — hiding the cells alone leaves empty tracks squeezing the
     title, so collapse the template too (!important beats inline style) */
  .trow { grid-template-columns: 26px 20px 22px 1fr !important; }
  /* The meta cell is the one trailing cell worth its width on a phone, so it
     is NOT .optional and it keeps a real track. This rule must stay separate
     from the one above rather than being folded into it: a board with
     show_updated off emits four cells, and a hardcoded trailing track would
     sit empty and steal 96px back off the title. .trow.with-meta (0,2,0)
     outranks .trow (0,1,0), so the longer form applies only where board.js
     actually appended a meta cell. */
  .trow.with-meta { grid-template-columns: 26px 20px 22px 1fr 96px !important; }
  /* Sub-rows have NO disclosure cell (subGridTemplate) — without their own
     template here, the shared !important rules above would auto-place a
     child's title into the 22px disclosure track. Declared after .with-meta,
     and the combined selector (0,3,0) outranks both. */
  .trow.subrow { grid-template-columns: 26px 20px 1fr !important; }
  .trow.subrow.with-meta { grid-template-columns: 26px 20px 1fr 96px !important; }
  .dfield { grid-template-columns: 100px 1fr; }
}

/* ---------- shell + sidebar ---------- */
#shell { display: flex; align-items: stretch; min-height: 100vh; }
#content { flex: 1; min-width: 0; }
#sidebar {
  width: 260px; flex-shrink: 0;
  position: sticky; top: 0; align-self: flex-start;
  height: 100vh; overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--border-soft);
  padding: 16px 12px 24px; display: flex; flex-direction: column; gap: 4px;
}
.sb-loading, .sb-err { color: var(--muted); padding: 8px 10px; }
.sb-err { color: var(--danger); }
.sb-list { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sb-ws { padding: 2px 0; }
.sb-ws-head { display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 10px; border-radius: 7px; cursor: pointer; }
.sb-ws-head:hover { background: var(--panel-2); }
.sb-ws-name { flex: 1; min-width: 0; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The code has always set .active on the workspace name; nothing styled it,
   so landing on a workspace page looked identical to not being there. */
.sb-ws-link { text-decoration: none; }
.sb-ws-link.active { color: var(--accent); font-weight: 650; }
.sb-ws-tools { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.sb-ws-head:hover .sb-ws-tools, .sb-ws.open .sb-ws-tools, .sb-ws-tools:focus-within { opacity: 1; }
.sb-tool {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0;
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted);
}
.sb-tool:hover { color: var(--text); border-color: var(--muted); }
.sb-boards { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 6px 26px; }
.sb-board-row {
  display: flex; align-items: center; min-height: 34px; border-radius: 7px;
  border-left: 2px solid transparent;
}
.sb-board-row:hover { background: var(--panel-2); }
.sb-board-row.active { background: var(--panel-2); border-left-color: var(--accent); }
.sb-board {
  display: flex; align-items: center; gap: 7px;
  flex: 1; min-width: 0; color: var(--muted); font-size: 14px; padding: 5px 10px;
}
.sb-board .icon, .sb-proj .icon { flex-shrink: 0; opacity: .75; }
.sb-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-board-row:hover .sb-board, .sb-board-row.active .sb-board { color: var(--text); }
.sb-board-more { opacity: 0; margin-right: 4px; }
.sb-board-row:hover .sb-board-more, .sb-board-more:focus-visible { opacity: 1; }
.sb-rename {
  background: var(--panel-2); border: 1px solid var(--accent); border-radius: 7px;
  color: var(--text); padding: 4px 10px; font-size: 14px; width: 100%; margin: 1px 0;
}
.sb-empty { color: var(--muted); font-size: 13px; padding: 4px 10px; }
.sb-input {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); padding: 5px 10px; font-size: 14px; min-width: 0; flex: 1;
}
.sb-input:focus { border-color: var(--muted); }
/* filter box */
.sb-filter-row { display: flex; align-items: center; gap: 4px; padding: 0 0 8px; }
.sb-filter { flex: 1; }
.sb-filter::-webkit-search-cancel-button { -webkit-appearance: none; } /* custom ✕ only */
.sb-filter-clear { flex-shrink: 0; }

/* foldable sections (Favorites / Workspaces / Projects) */
.sb-sec { padding: 1px 0; }
.sb-sec-head {
  display: flex; align-items: center; gap: 2px;
  padding: 7px 6px 3px; border-radius: 7px; cursor: pointer; color: var(--muted);
}
.sb-sec-head:hover { color: var(--text); }
.sb-sec-head:hover .sb-caret { color: inherit; }
.sb-sec-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.sb-sec-tools { margin-left: auto; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.sb-sec-head:hover .sb-sec-tools, .sb-sec-tools:focus-within { opacity: 1; }
.sb-sec-body { display: flex; flex-direction: column; gap: 1px; }
.sb-sec:not(.open) > .sb-sec-body { display: none; }
.sb-sec.open > .sb-sec-head .sb-caret { transform: rotate(90deg); }

/* collapse carets (sections + workspaces) */
.sb-caret {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0; color: var(--muted);
  transition: transform .15s ease;
}
.sb-ws.open > .sb-ws-head .sb-caret { transform: rotate(90deg); }
.sb-ws:not(.open) .sb-boards { display: none; }

/* favorites star */
.sb-fav.on { color: var(--accent-ink); border-color: var(--accent); }

/* board/project caps */
.sb-showall {
  background: none; border: none; text-align: left; color: var(--muted);
  font-size: 13px; padding: 4px 10px; border-radius: 7px;
}
.sb-showall:hover { color: var(--text); background: var(--panel-2); }

/* projects section rows (mirror board rows) */
.sb-proj-row {
  display: flex; align-items: center; min-height: 34px; border-radius: 7px;
  border-left: 2px solid transparent;
}
.sb-proj-row:hover { background: var(--panel-2); }
.sb-proj-row.active { background: var(--panel-2); border-left-color: var(--accent); }
.sb-proj {
  display: flex; align-items: center; gap: 7px;
  flex: 1; min-width: 0; color: var(--muted); font-size: 14px; padding: 5px 10px;
}
.sb-proj-row:hover .sb-proj, .sb-proj-row.active .sb-proj { color: var(--text); }
.sb-proj-row .sb-ws-tools { margin-right: 4px; }
.sb-proj-row:hover .sb-ws-tools, .sb-proj-row .sb-ws-tools:focus-within { opacity: 1; }
.sb-allprojects { font-size: 13px; }

.sb-footer { border-top: 1px solid var(--border-soft); padding-top: 12px; margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
/* build provenance — deliberately the quietest text in the app */
.sb-version { font-size: 11px; color: var(--text-dim); padding: 2px 10px 0; letter-spacing: .01em; }
.sb-link { color: var(--muted); font-size: 14px; padding: 7px 10px; border-radius: 7px; }
.sb-link:hover { color: var(--text); background: var(--panel-2); }
.sb-toggle { display: none; font-size: 18px; color: var(--muted); margin-right: 2px; }
#sb-scrim { display: none; }

@media (max-width: 860px) {
  #sidebar {
    position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: 2px 0 18px var(--shadow);
  }
  #shell.sb-open #sidebar { transform: translateX(0); }
  #sb-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .5); }
  .sb-toggle { display: inline-flex; }
}

/* ---------- modal dialogs ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: var(--shadow);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 16vh 16px 16px; overflow-y: auto;
}
.modal-card {
  width: 100%; max-width: 400px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 18px 48px var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.modal-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px;
  background: none; border: none; color: var(--muted);
}
.modal-close:hover { color: var(--text); background: var(--panel-2); }
.modal-body { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px 20px; }
.modal-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: -4px; }
.modal-input {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 9px 12px; font-size: 14px; width: 100%;
}
.modal-input:focus { border-color: var(--muted); outline: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- members view ---------- */
.members-view { max-width: 720px; }
.member-list { display: flex; flex-direction: column; gap: 6px; max-width: 640px; margin-bottom: 28px; }
.member-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: 8px;
}
.member-name { color: var(--text); }
.role-badge {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 9px; border-radius: 20px; color: var(--muted); border: 1px solid var(--border);
}
.role-badge.role-admin { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.invite-form { max-width: 640px; background: var(--panel); border: 1px solid var(--border-soft); border-radius: 10px; padding: 20px; }
.invite-label { display: block; color: var(--text); margin-bottom: 10px; font-weight: 500; }
.invite-row { display: flex; gap: 8px; }
.invite-row .text { flex: 1; }
.invite-hint { font-size: 13px; margin-top: 10px; }
.invite-note { max-width: 640px; padding: 16px; border: 1px dashed var(--border); border-radius: 10px; }

/* ---------- tiny chart primitives (#343 metrics) ---------- */
/* element bar strip: dom.js barStrip() — CSS owns every color (theme-safe) */
.bstrip { display: flex; align-items: flex-end; gap: 2px; height: 44px; }
.bstrip i { flex: 1; min-width: 1px; background: var(--accent); border-radius: 2px 2px 0 0; }
.bstrip i.z { background: var(--border-soft); }
.bstrip i.neg { background: var(--ok); }   /* credit refunds render as give-back */
.spark { display: block; width: 100%; height: 34px; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.spark-fill { fill: var(--accent-soft); stroke: none; }

/* workspaces grid: the card title is a link to the workspace page */
.ws-card-link { color: inherit; text-decoration: none; }
.ws-card-link:hover { color: var(--accent); text-decoration: underline; }
