/* Review boards: production stylesheet.
   Layout and components follow docs/design/UI-SPEC.md. Chrome (header, buttons, menus, panels, badges,
   sign-in and state pages) uses the family portal's look from chrometzka.me; the canvas stays neutral
   so the drafts stay the focus. */

:root {
  /* Portal tokens, copied verbatim. Source: chrometzka.me docs/design/portal-v1/assets/portal.css
     (:root), served by the portal as /assets/portal.css. */
  --pt-paper: #f5f3ee;
  --pt-surface: #ffffff;
  --pt-ink: #1d1c1a;
  --pt-ink-2: #57544e;
  --pt-ink-3: #75716a;
  --pt-line: #e2ded5;
  --pt-line-strong: #cfcac0;
  --pt-accent: #2f4f45;
  --pt-accent-hover: #26413a;
  --pt-accent-soft: #e7ede9;
  --pt-warn-soft: #f6efe2;
  --pt-warn-ink: #6b4a12;
  --pt-error-soft: #f8e9e6;
  --pt-error-ink: #8a2c1d;
  --pt-ok-soft: #e7ede9;
  --pt-t-tx: #e8e3ef;   --pt-i-tx: #4d3f6b;      /* muted lavender tile tint */
  --pt-t-boards: #e2e8ed; --pt-i-boards: #3d5366; /* the Boards tile on the portal Home */
  --pt-radius: 14px;
  --pt-radius-sm: 12px;
  --pt-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  /* Source: chrometzka.me portal/static/cockpit.css (.chip.off and .skel fill, .skel radius,
     .tabs inner radius, .sheet radius and shadow, .veil scrim) and portal.css (.tile:hover shadow). */
  --pt-chip-off: #ebe8e1;
  --pt-radius-xs: 8px;
  --pt-radius-tab: 9px;
  --pt-radius-sheet: 22px;
  --pt-shadow-tile: 0 2px 10px rgba(29, 28, 26, .06);
  --pt-shadow-sheet: 0 8px 30px rgba(29, 28, 26, .18);
  --pt-scrim: rgba(29, 28, 26, .5);

  /* Boards colour roles mapped to the portal tokens. */
  --bd-canvas: #E6E6E3;            /* Boards' own neutral grey, deliberately not the warm paper: drafts stay the focus */
  --bd-surface: var(--pt-surface);
  --bd-surface-2: var(--pt-paper);
  --bd-surface-3: var(--pt-chip-off);
  --bd-border: var(--pt-line);
  --bd-border-strong: var(--pt-line-strong);
  --bd-text: var(--pt-ink);
  --bd-text-2: var(--pt-ink-2);
  --bd-text-3: var(--pt-ink-3);
  --bd-accent: var(--pt-accent);
  --bd-accent-hover: var(--pt-accent-hover);
  --bd-accent-soft: var(--pt-accent-soft);
  --bd-accent-text: #FFFFFF;
  --bd-resolved: var(--pt-ink-3);
  --bd-agent: var(--pt-i-tx);
  --bd-agent-soft: var(--pt-t-tx);
  --bd-danger: var(--pt-error-ink);
  --bd-danger-soft: var(--pt-error-soft);
  --bd-success: var(--pt-accent);
  --bd-success-soft: var(--pt-ok-soft);
  --bd-notice-bg: var(--pt-warn-soft);
  --bd-notice-text: var(--pt-warn-ink);
  --bd-label-bg: var(--pt-accent);
  --bd-label-text: #FFFFFF;
  --bd-app-bg: var(--pt-t-boards);
  --bd-app-ink: var(--pt-i-boards);

  /* Elevation: the portal has only the tile hover shadow and the sheet shadow. Floating controls over
     drafts need more lift, so shadow-1 and shadow-2 keep Boards' geometry with the portal's ink tint. */
  --bd-shadow-1: 0 1px 2px rgba(29, 28, 26, .08);
  --bd-shadow-2: 0 4px 16px rgba(29, 28, 26, .12), 0 1px 3px rgba(29, 28, 26, .08);
  --bd-shadow-3: var(--pt-shadow-sheet);

  /* type: portal font stack; Boards keeps its compact size scale for app chrome */
  --bd-font: var(--pt-font);
  --bd-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --bd-fs-11: 11px; --bd-lh-11: 14px;
  --bd-fs-12: 12px; --bd-lh-12: 16px;
  --bd-fs-13: 13px; --bd-lh-13: 18px;
  --bd-fs-14: 14px; --bd-lh-14: 20px;
  --bd-fs-16: 16px; --bd-lh-16: 22px;
  --bd-fs-20: 20px; --bd-lh-20: 26px;
  --bd-fs-24: 24px; --bd-lh-24: 30px;

  /* space (4 px base) */
  --bd-s1: 4px; --bd-s2: 8px; --bd-s3: 12px; --bd-s4: 16px; --bd-s5: 24px; --bd-s6: 32px; --bd-s7: 48px;
  /* radii: r2 to r5 and the pill are portal radii; r1 stays Boards' own for keyboard hints */
  --bd-r1: 4px; --bd-r2: var(--pt-radius-xs); --bd-r3: var(--pt-radius-sm); --bd-r4: var(--pt-radius); --bd-r5: var(--pt-radius-sheet);
  --bd-pill: 999px;

  /* layout */
  --bd-header-h: 56px;
  --bd-panel-w: 360px;
  --bd-toolbar-h: 40px;
  --bd-sheet-peek: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--bd-font); font-size: var(--bd-fs-14); line-height: var(--bd-lh-14); color: var(--bd-text); background: var(--bd-surface-2); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
/* Focus ring: portal.css :focus-visible (3 px accent outline, 3 px offset). */
:focus-visible { outline: 3px solid var(--bd-accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.bd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bd-mono { font-family: var(--bd-mono); }

/* ---------- buttons ----------
   Compact buttons take the portal's small control shape (portal.css .btn-text: pill, strong hairline,
   white, 500). Primary uses .btn-primary colours and weight. Pressed toggles use the portal's pressed
   filter chip (cockpit.css .chip-f[aria-pressed="true"]). */
.bd-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border: 1px solid var(--bd-border-strong); border-radius: var(--bd-pill); background: var(--bd-surface); color: var(--bd-text); font-size: var(--bd-fs-13); font-weight: 500; white-space: nowrap; }
a.bd-btn { text-decoration: none; color: var(--bd-text); }
.bd-btn:hover { background: var(--bd-surface-2); }
.bd-btn[aria-pressed="true"] { background: var(--bd-accent-soft); border-color: var(--bd-accent); color: var(--bd-accent); font-weight: 600; }
.bd-btn--primary, a.bd-btn--primary { background: var(--bd-accent); border-color: var(--bd-accent); color: var(--bd-accent-text); font-weight: 600; }
.bd-btn--primary:hover { background: var(--bd-accent-hover); border-color: var(--bd-accent-hover); }
.bd-btn--ghost { border-color: transparent; background: transparent; }
.bd-btn--ghost:hover { background: var(--bd-surface-3); border-color: transparent; }
.bd-btn--ghost[aria-pressed="true"] { background: var(--bd-accent-soft); border-color: transparent; }
.bd-btn--icon { width: 32px; padding: 0; justify-content: center; }
.bd-btn:disabled { opacity: .45; cursor: default; }
.bd-btn svg { width: 16px; height: 16px; flex: none; }
.bd-kbd { font-family: var(--bd-mono); font-size: var(--bd-fs-11); line-height: 16px; padding: 0 5px; border: 1px solid var(--bd-border-strong); border-bottom-width: 2px; border-radius: var(--bd-r1); color: var(--bd-text-2); background: var(--bd-surface); }
.bd-btn[aria-pressed="true"] .bd-kbd { color: var(--bd-accent); border-color: var(--bd-accent); }
.bd-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--bd-pill); background: var(--bd-accent-soft); color: var(--bd-accent); font-size: var(--bd-fs-12); font-weight: 600; }
.bd-count--zero { background: var(--bd-surface-3); color: var(--bd-text-2); }
[aria-pressed="true"] .bd-count:not(.bd-count--zero) { background: var(--bd-surface); }
/* Segmented control: portal two-part switch (cockpit.css .tabs), scaled to 32 px. */
.bd-seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--bd-border-strong); border-radius: var(--bd-r3); background: var(--bd-surface); }
.bd-seg button { height: 26px; padding: 0 10px; border: 0; border-radius: var(--pt-radius-tab); background: transparent; font-size: var(--bd-fs-13); color: var(--bd-text); font-weight: 500; white-space: nowrap; }
.bd-seg button:hover { background: var(--bd-surface-2); }
.bd-seg button[aria-pressed="true"] { background: var(--bd-accent-soft); color: var(--bd-accent); font-weight: 600; }
.bd-seg button:focus-visible { outline-offset: 1px; }

/* ---------- app shell ---------- */
.app { container: app / inline-size; position: relative; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--bd-surface); }
.bd-header { flex: none; height: var(--bd-header-h); display: flex; align-items: center; gap: var(--bd-s3); padding: 0 var(--bd-s3) 0 var(--bd-s4); border-bottom: 1px solid var(--bd-border); background: var(--bd-surface); position: relative; z-index: 30; }
.bd-header__home { display: inline-flex; align-items: center; gap: 8px; color: var(--bd-text-2); text-decoration: none; font-size: var(--bd-fs-13); font-weight: 500; padding: 4px 10px 4px 4px; margin-left: -6px; border-radius: var(--bd-pill); flex: none; }
.bd-header__home:hover { background: var(--bd-surface-2); color: var(--bd-text); }
.bd-header__home svg { width: 16px; height: 16px; }
/* Boards app icon: the same glyph and tint as the Boards tile on the portal Home
   (portal.css .tile .ic and .t-boards; glyph from portal/templates/cockpit/icons.html "boards"). */
.bd-appicon { display: inline-grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: var(--pt-radius); background: var(--bd-app-bg); color: var(--bd-app-ink); }
.bd-appicon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bd-appicon--sm { width: 24px; height: 24px; border-radius: 6px; }
.bd-header__home .bd-appicon--sm svg { width: 16px; height: 16px; stroke-width: 1.9; }
.bd-header__sep { color: var(--bd-border-strong); flex: none; }
.bd-header__title { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.bd-title { margin: 0; font-size: var(--bd-fs-14); line-height: var(--bd-lh-14); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-summary { margin: 0; font-size: var(--bd-fs-12); line-height: var(--bd-lh-12); color: var(--bd-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-header__actions { display: flex; align-items: center; gap: var(--bd-s2); flex: none; }
.bd-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--bd-surface); color: var(--bd-text); display: inline-flex; align-items: center; justify-content: center; font-size: var(--bd-fs-13); font-weight: 600; border: 1px solid var(--bd-border-strong); flex: none; }
.bd-avatar:hover, .bd-avatar[aria-expanded="true"] { background: var(--bd-surface-2); }

/* version switcher */
.bd-version { position: relative; flex: none; }
.bd-version__btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 13px; border: 1px solid var(--bd-border-strong); border-radius: var(--bd-pill); background: var(--bd-surface); font-weight: 600; font-size: var(--bd-fs-13); }
.bd-version__btn:hover { background: var(--bd-surface-2); }
.bd-version__btn svg { width: 14px; height: 14px; color: var(--bd-text-3); }
/* Tags: portal status chips (cockpit.css .chip: pill, 600; .ok, .off and the lavender tint). */
.bd-tag { font-size: var(--bd-fs-11); line-height: 16px; font-weight: 600; padding: 0 7px; border-radius: var(--bd-pill); background: var(--bd-surface-3); color: var(--bd-text-2); }
.bd-tag--latest { background: var(--bd-success-soft); color: var(--bd-success); }
.bd-tag--agent { background: var(--bd-agent-soft); color: var(--bd-agent); }
.bd-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 280px; margin: 0; padding: 4px; list-style: none; background: var(--bd-surface); border: 1px solid var(--bd-border); border-radius: var(--bd-r3); box-shadow: var(--bd-shadow-3); z-index: 50; }
.bd-menu__item { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--bd-r2); cursor: pointer; }
.bd-menu__item:hover, .bd-menu__item[aria-selected="true"] { background: var(--bd-surface-2); }
.bd-menu :focus-visible { outline-offset: -3px; }
.bd-menu__item[aria-current="true"] { background: var(--bd-accent-soft); }
.bd-menu__n { font-weight: 700; font-size: var(--bd-fs-13); }
.bd-menu__meta { font-size: var(--bd-fs-12); color: var(--bd-text-2); line-height: var(--bd-lh-12); }
.bd-menu__meta b { display: block; color: var(--bd-text); font-weight: 500; font-size: var(--bd-fs-13); line-height: var(--bd-lh-13); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }

.bd-notice { flex: none; display: flex; align-items: center; gap: var(--bd-s2); padding: 6px var(--bd-s4); background: var(--bd-notice-bg); color: var(--bd-notice-text); font-size: var(--bd-fs-13); border-bottom: 1px solid var(--bd-border); }
.bd-notice a { color: inherit; font-weight: 600; }

.bd-main { flex: 1 1 auto; min-height: 0; display: flex; position: relative; }

/* ---------- canvas ---------- */
.bd-canvas { --z: 1; position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; background: var(--bd-canvas); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; outline: none; }
.bd-canvas:focus-visible { outline: 3px solid var(--bd-accent); outline-offset: -3px; }
.bd-canvas.is-panning { cursor: grabbing; }
.app[data-mode="comment"] .bd-canvas { cursor: crosshair; }
.bd-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }

.bd-group-label { position: absolute; transform-origin: 0 0; transform: scale(calc(1 / var(--z))) translateY(calc(-100% - var(--bd-label-gap, 40px))); display: flex; align-items: baseline; gap: 10px; white-space: nowrap; pointer-events: auto; cursor: pointer; z-index: 4; }
.bd-canvas[data-badges="inside"] .bd-group-label { --bd-label-gap: 8px; }
.bd-group-label__id { font-family: var(--bd-mono); font-size: var(--bd-fs-13); line-height: 22px; font-weight: 700; padding: 0 8px; border-radius: var(--bd-r2); background: var(--bd-label-bg); color: var(--bd-label-text); align-self: center; }
.bd-group-label__title { font-size: var(--bd-fs-16); line-height: var(--bd-lh-16); font-weight: 600; color: var(--bd-text); }
.bd-group-label__note { font-size: var(--bd-fs-13); color: var(--bd-text-2); max-width: 560px; overflow: hidden; text-overflow: ellipsis; }
.bd-canvas[data-lod="0"] .bd-group-label__note, .bd-canvas[data-lod="1"] .bd-group-label__note { display: none; }

.bd-frame { position: absolute; margin: 0; background: var(--bd-surface); }
.bd-frame::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: 0 0 0 calc(1px / var(--z)) rgba(0,0,0,.10), 0 calc(2px / var(--z)) calc(10px / var(--z)) rgba(0,0,0,.08); }
.bd-frame__media { position: absolute; inset: 0; overflow: hidden; background: var(--bd-surface-2); }
.bd-frame__media img { display: block; width: 100%; height: 100%; -webkit-user-drag: none; pointer-events: none; }
.bd-frame__media iframe { display: block; border: 0; transform-origin: 0 0; pointer-events: none; background: #fff; }
.bd-frame__placeholder { position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: center; background: repeating-linear-gradient(135deg, var(--bd-surface-2) 0 calc(14px / var(--z)), var(--bd-surface-3) calc(14px / var(--z)) calc(28px / var(--z))); }
.bd-frame__placeholder span { position: sticky; margin-top: calc(48px / var(--z)); font-size: calc(13px / var(--z)); color: var(--bd-text-3); }
.bd-frame.is-loaded .bd-frame__placeholder { display: none; }
.bd-frame__error { position: absolute; inset: 0; display: none; background: var(--bd-danger-soft); }
.bd-frame.is-error .bd-frame__error { display: block; }
.bd-frame__error-box { position: absolute; left: 50%; top: calc(64px / var(--z)); transform-origin: 50% 0; transform: translateX(-50%) scale(calc(1 / var(--z))); width: 240px; text-align: center; font-size: var(--bd-fs-13); color: var(--bd-danger); }
.bd-frame__error-box b { display: block; font-size: var(--bd-fs-14); margin-bottom: 4px; }
.bd-frame__error-box button { margin-top: 10px; }
.bd-frame__ring { position: absolute; inset: calc(-3px / var(--z)); border: calc(2px / var(--z)) solid var(--bd-accent); pointer-events: none; display: none; border-radius: calc(2px / var(--z)); }
.bd-frame.is-selected .bd-frame__ring { display: block; }
.bd-frame.is-hover .bd-frame__ring { display: block; border-color: rgba(47, 79, 69, .45); }
.bd-frame.is-selected.is-hover .bd-frame__ring { border-color: var(--bd-accent); }

/* frame badge: counter scaled, above the frame when there is room, inside otherwise */
.bd-badge { position: absolute; left: 0; top: 0; transform-origin: 0 0; transform: scale(calc(1 / var(--z))) translateY(calc(-100% - 6px)); max-width: calc(var(--fw) * var(--z) * 1px); display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 2px; white-space: nowrap; overflow: hidden; pointer-events: auto; cursor: pointer; font-size: var(--bd-fs-12); line-height: 22px; }
.bd-canvas[data-badges="inside"] .bd-badge { transform: scale(calc(1 / var(--z))) translate(6px, 6px); max-width: calc(var(--fw) * var(--z) * 1px - 12px); padding: 0 8px; background: rgba(255,255,255,.94); border-radius: var(--bd-pill); box-shadow: var(--bd-shadow-2); }
.bd-badge__id { font-family: var(--bd-mono); font-weight: 700; color: var(--bd-text); flex: none; }
.bd-badge__caption { color: var(--bd-text-2); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bd-badge__vp { flex: none; font-size: var(--bd-fs-11); color: var(--bd-text-3); }
.bd-badge__notes { flex: none; display: inline-flex; align-items: center; gap: 2px; color: var(--bd-accent); font-weight: 600; }
.bd-badge__notes svg { width: 12px; height: 12px; }
.bd-frame.is-selected .bd-badge__id { color: var(--bd-accent); }
.bd-canvas[data-lod="0"] .bd-badge__caption, .bd-canvas[data-lod="0"] .bd-badge__vp { display: none; }
.bd-canvas[data-lod="1"] .bd-badge__vp { display: none; }

/* pins: teardrop with the point on the commented spot */
.bd-pin { position: absolute; transform-origin: 0 100%; transform: scale(calc(1 / var(--z))) translateY(-100%); min-width: 28px; height: 28px; padding: 0 7px; border: 2px solid #fff; border-radius: 14px 14px 14px 2px; background: var(--bd-accent); color: var(--bd-accent-text); font-size: var(--bd-fs-12); font-weight: 700; line-height: 24px; text-align: center; box-shadow: var(--bd-shadow-2); pointer-events: auto; cursor: pointer; z-index: 2; }
.bd-pin:hover { background: var(--bd-accent-hover); }
.bd-pin--resolved { background: var(--bd-resolved); }
.bd-pin--resolved:hover { background: var(--pt-ink-2); }
/* Selected pins: white border, accent ring, then a white hairline, so the ring reads on light and dark drafts. */
.bd-pin.is-selected { box-shadow: 0 0 0 3px var(--bd-accent), 0 0 0 5px #fff, var(--bd-shadow-3); z-index: 3; }
.bd-pin--resolved.is-selected { box-shadow: 0 0 0 3px var(--bd-resolved), 0 0 0 5px #fff, var(--bd-shadow-3); }
.bd-pin--draft { background: var(--bd-accent); color: #fff; font-size: 16px; box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 0 0 7px rgba(47, 79, 69, .35), var(--bd-shadow-2); animation: bd-pop .16s ease-out; z-index: 4; }
.bd-canvas[data-lod="0"] .bd-pin:not(.bd-pin--draft):not(.is-selected) { min-width: 12px; width: 12px; height: 12px; padding: 0; border-width: 2px; border-radius: 6px 6px 6px 1px; font-size: 0; line-height: 0; }
.bd-frame.is-tiny .bd-badge { display: none; }
.bd-canvas[data-filter="open"] .bd-pin--resolved { display: none; }
.bd-canvas[data-filter="resolved"] .bd-pin:not(.bd-pin--resolved):not(.bd-pin--draft) { display: none; }
@keyframes bd-pop { from { transform: scale(calc(0.6 / var(--z))) translateY(-100%); } }

/* comment mode hint */
.bd-hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: none; align-items: center; gap: 10px; height: 36px; padding: 0 6px 0 14px; border-radius: var(--bd-pill); background: var(--bd-text); color: #fff; font-size: var(--bd-fs-13); box-shadow: var(--bd-shadow-2); z-index: 20; white-space: nowrap; }
.app[data-mode="comment"] .bd-hint { display: flex; }
.bd-hint button { height: 26px; padding: 0 10px; border: 0; border-radius: var(--bd-pill); background: rgba(255,255,255,.16); color: #fff; font-size: var(--bd-fs-12); font-weight: 600; }
.bd-hint button:focus-visible, .bd-toast button:focus-visible { outline-color: #fff; }

/* canvas toolbar */
.bd-toolbar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; height: 44px; padding: 0 4px; border-radius: var(--bd-r3); background: var(--bd-surface); box-shadow: var(--bd-shadow-2); border: 1px solid var(--bd-border); z-index: 20; white-space: nowrap; }
.bd-toolbar__sep { width: 1px; height: 20px; margin: 0 4px; background: var(--bd-border); }
.bd-toolbar .bd-btn { height: 34px; border-color: transparent; background: transparent; }
.bd-toolbar .bd-btn:hover { background: var(--bd-surface-2); }
.bd-toolbar .bd-btn[aria-pressed="true"] { background: var(--bd-accent-soft); color: var(--bd-accent); }
.bd-zoom { min-width: 52px; text-align: center; font-size: var(--bd-fs-12); font-variant-numeric: tabular-nums; color: var(--bd-text-2); border: 0; background: transparent; height: 34px; border-radius: var(--bd-pill); }
.bd-zoom:hover { background: var(--bd-surface-2); }
.bd-current { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; height: 34px; padding: 0 12px; border: 0; border-radius: var(--bd-pill); background: var(--bd-surface-2); font-size: var(--bd-fs-12); }
.bd-current:hover { background: var(--bd-surface-3); }
.bd-current__id { font-family: var(--bd-mono); font-weight: 700; }
.bd-current__cap { color: var(--bd-text-2); overflow: hidden; text-overflow: ellipsis; }

/* composer popover (desktop) */
.bd-popover { position: absolute; z-index: 25; width: 320px; background: var(--bd-surface); border: 1px solid var(--bd-border); border-radius: var(--bd-r3); box-shadow: var(--bd-shadow-3); }
.bd-composer { padding: 12px; }
.bd-composer__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: var(--bd-fs-12); color: var(--bd-text-2); }
.bd-composer__head .bd-mono { color: var(--bd-text); font-weight: 700; }
.bd-composer textarea { display: block; width: 100%; min-height: 76px; max-height: 240px; resize: vertical; padding: 8px 12px; border: 1px solid var(--bd-border-strong); border-radius: var(--bd-r3); font-size: var(--bd-fs-14); line-height: var(--bd-lh-14); background: var(--bd-surface); }
.bd-composer textarea:focus { outline: none; border-color: var(--bd-accent); box-shadow: 0 0 0 3px var(--bd-accent-soft); }
.bd-composer__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.bd-composer__hint { font-size: var(--bd-fs-11); color: var(--bd-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bd-composer__actions { display: flex; gap: 6px; }
.bd-composer__error { margin-top: 8px; padding: 6px 8px; border-radius: var(--bd-r2); background: var(--bd-danger-soft); color: var(--bd-danger); font-size: var(--bd-fs-12); }

/* ---------- comment panel ---------- */
.bd-panel { flex: none; width: var(--bd-panel-w); display: flex; flex-direction: column; border-left: 1px solid var(--bd-border); background: var(--bd-surface); min-height: 0; z-index: 10; }
.app.is-panel-closed .bd-panel { display: none; }
.bd-panel__head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--bd-border); }
.bd-panel__title { margin: 0; font-size: var(--bd-fs-14); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.bd-panel__grip { display: none; }
.bd-panel__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 24px; }
.bd-panel__sheet-compose { display: none; }
.bd-fgroup__head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px 16px; background: rgba(255,255,255,.96); backdrop-filter: blur(4px); cursor: pointer; }
.bd-fgroup__head:hover .bd-fgroup__id { color: var(--bd-accent); }
.bd-fgroup__id { font-family: var(--bd-mono); font-size: var(--bd-fs-12); font-weight: 700; }
.bd-fgroup__cap { font-size: var(--bd-fs-12); color: var(--bd-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.bd-fgroup__add { flex: none; height: 24px; padding: 0 8px; border: 0; border-radius: var(--bd-pill); background: transparent; color: var(--bd-text-3); font-size: var(--bd-fs-12); }
.bd-fgroup__add:hover { background: var(--bd-surface-2); color: var(--bd-text); }

.bd-thread { margin: 0 8px 4px; padding: 10px 10px 10px 8px; border-radius: var(--bd-r3); display: grid; grid-template-columns: 34px 1fr; gap: 0 4px; cursor: pointer; border: 1px solid transparent; }
.bd-thread:hover { background: var(--bd-surface-2); }
.bd-thread.is-selected { background: var(--bd-accent-soft); border-color: rgba(47, 79, 69, .25); }
.bd-thread:focus-visible { outline-offset: -1px; }
.bd-thread__pin { width: 26px; height: 26px; border-radius: 13px 13px 13px 2px; background: var(--bd-accent-soft); color: var(--bd-accent); box-shadow: inset 0 0 0 1px rgba(47, 79, 69, .3); font-size: var(--bd-fs-11); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.bd-thread__pin--frame { border-radius: var(--bd-r2); background: var(--bd-surface-3); color: var(--bd-text-2); box-shadow: none; }
.bd-thread--resolved .bd-thread__pin { background: var(--bd-surface-3); color: var(--bd-text-2); box-shadow: none; }
.bd-thread__meta { display: flex; align-items: baseline; gap: 6px; font-size: var(--bd-fs-12); color: var(--bd-text-3); }
.bd-thread__author { font-weight: 600; color: var(--bd-text); font-size: var(--bd-fs-13); }
.bd-thread__body { margin: 2px 0 0; font-size: var(--bd-fs-14); line-height: var(--bd-lh-14); white-space: pre-wrap; overflow-wrap: anywhere; }
.bd-thread--resolved .bd-thread__body { color: var(--bd-text-2); }
.bd-reply { margin-top: 10px; padding-left: 10px; border-left: 2px solid var(--bd-border); }
.bd-reply--agent { border-left-color: rgba(77, 63, 107, .35); }
.bd-reply .bd-thread__body { font-size: var(--bd-fs-13); line-height: var(--bd-lh-13); }
.bd-thread__actions { display: none; gap: 4px; margin-top: 8px; }
.bd-thread.is-selected .bd-thread__actions { display: flex; }
@media (hover: hover) { .bd-thread:hover .bd-thread__actions, .bd-thread:focus-within .bd-thread__actions { display: flex; } }
.bd-thread__actions .bd-btn { height: 26px; padding: 0 8px; font-size: var(--bd-fs-12); }
.bd-thread__status { font-size: var(--bd-fs-11); font-weight: 600; color: var(--bd-success); }
.bd-thread .bd-composer { padding: 0; margin-top: 8px; }
.bd-thread .bd-composer textarea { min-height: 56px; }

.bd-empty { padding: 40px 24px; text-align: center; color: var(--bd-text-2); font-size: var(--bd-fs-13); }
.bd-empty__icon { width: 40px; height: 40px; margin: 0 auto 12px; border-radius: 50%; background: var(--bd-surface-2); display: flex; align-items: center; justify-content: center; color: var(--bd-text-3); }
.bd-empty__icon svg { width: 20px; height: 20px; }
.bd-empty b { display: block; color: var(--bd-text); font-size: var(--bd-fs-14); margin-bottom: 4px; }

/* ---------- compare ---------- */
.bd-compare { position: absolute; inset: 0; z-index: 21; display: flex; flex-direction: column; background: var(--bd-canvas); }
.bd-compare__bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bd-surface); border-bottom: 1px solid var(--bd-border); }
.bd-compare__title { font-weight: 600; font-size: var(--bd-fs-13); margin-right: 4px; }
.bd-compare__spacer { flex: 1; }
.bd-compare__panes { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--bd-border); }
.bd-compare[data-layout="flip"] .bd-compare__panes { grid-template-columns: 1fr; }
.bd-compare[data-layout="flip"] .bd-pane:not(.is-active) { display: none; }
.bd-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bd-canvas); }
.bd-pane__head { flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--bd-surface-2); border-bottom: 1px solid var(--bd-border); }
.bd-pane__letter { flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--bd-label-bg); color: #fff; font: 700 12px/22px var(--bd-mono); text-align: center; }
.bd-select { height: 30px; padding: 0 26px 0 10px; border: 1px solid var(--bd-border-strong); border-radius: var(--bd-r3); background: var(--bd-surface) url("/static/select-chevron.svg") no-repeat right 9px center; -webkit-appearance: none; appearance: none; font-size: var(--bd-fs-13); min-width: 0; }
.bd-select--id { font-family: var(--bd-mono); font-weight: 700; font-size: var(--bd-fs-12); flex: 1 1 auto; }
.bd-pane__scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 24px; touch-action: pan-x pan-y; }
.bd-pane__frame { position: relative; margin: 0 auto; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.1), 0 2px 10px rgba(0,0,0,.08); --z: 1; }
.bd-pane__frame img { display: block; width: 100%; height: auto; }
.bd-pane__frame iframe { display: block; border: 0; transform-origin: 0 0; pointer-events: none; }
.bd-pane__caption { font-size: var(--bd-fs-12); color: var(--bd-text-2); margin: 0 auto 8px; }
.bd-pane__missing { margin: 48px auto; max-width: 280px; text-align: center; color: var(--bd-text-2); font-size: var(--bd-fs-13); }

/* toast and dialogs */
.bd-toast { position: absolute; left: 50%; bottom: 72px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; border-radius: var(--bd-r3); background: var(--bd-text); color: #fff; font-size: var(--bd-fs-13); box-shadow: var(--bd-shadow-3); white-space: nowrap; }
.bd-toast button { border: 0; background: rgba(255,255,255,.14); color: #fff; height: 26px; padding: 0 10px; border-radius: var(--bd-pill); font-size: var(--bd-fs-12); font-weight: 600; }
.bd-scrim { position: absolute; inset: 0; z-index: 70; background: var(--pt-scrim); display: flex; align-items: center; justify-content: center; padding: 16px; }
.bd-dialog { width: 100%; max-width: 440px; max-height: 100%; overflow: auto; background: var(--bd-surface); border-radius: var(--bd-r5); box-shadow: var(--bd-shadow-3); padding: 24px 28px; }
.bd-dialog h2 { margin: 0 0 6px; font-size: var(--bd-fs-20); line-height: var(--bd-lh-20); font-weight: 600; letter-spacing: -.01em; }
.bd-dialog p { margin: 0 0 16px; color: var(--bd-text-2); font-size: var(--bd-fs-13); line-height: var(--bd-lh-13); }
.bd-keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0 16px; font-size: var(--bd-fs-13); align-items: center; }
.bd-keys dt { text-align: right; white-space: nowrap; }
.bd-keys dd { margin: 0; color: var(--bd-text-2); }
.bd-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- index ---------- */
.bd-index { max-width: 960px; margin: 0 auto; padding: 32px 24px 64px; }
.bd-index__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
/* Page title: portal.css .page h1 (34 px desktop, 30 px phone, 600, -0.01em). */
.bd-index__head h1 { margin: 0; font-size: 34px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
.bd-index__head p { margin: 0; font-size: var(--bd-fs-14); color: var(--bd-text-2); }
.bd-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--bd-border); border-radius: var(--bd-r4); background: var(--bd-surface); overflow: hidden; }
.bd-row { border-top: 1px solid var(--bd-border); }
.bd-row:first-child { border-top: 0; }
.bd-row a { display: grid; grid-template-columns: 112px 1fr 80px 120px 72px; align-items: center; gap: 20px; padding: 12px 20px 12px 12px; color: inherit; text-decoration: none; }
.bd-row a:focus-visible { outline-offset: -3px; border-radius: var(--bd-r4); }
.bd-row a:hover { background: var(--bd-surface-2); }
.bd-row__thumb { width: 112px; height: 72px; border-radius: var(--bd-r2); background: var(--bd-canvas); overflow: hidden; display: flex; align-items: flex-start; justify-content: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.bd-row__thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.bd-row__thumb--phone img { width: auto; height: 160%; object-fit: initial; margin-top: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.1); }
.bd-row__title { font-size: var(--bd-fs-14); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-row__slug { font-family: var(--bd-mono); font-size: var(--bd-fs-12); color: var(--bd-text-3); }
.bd-row__ver { font-size: var(--bd-fs-13); font-weight: 600; }
.bd-row__date { font-size: var(--bd-fs-13); color: var(--bd-text-2); }
.bd-row__open { justify-self: end; display: inline-flex; align-items: center; gap: 4px; font-size: var(--bd-fs-12); color: var(--bd-text-3); }
.bd-row__mobile-meta { display: none; }
.bd-list-head { display: grid; grid-template-columns: 112px 1fr 80px 120px 72px; gap: 20px; padding: 0 20px 8px 12px; font-size: var(--bd-fs-12); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: var(--bd-text-3); }
.bd-list-head span:last-child { text-align: right; }

/* ---------- narrow layout (container query on .app) ---------- */
@container app (max-width: 720px) {
  .bd-header { --bd-header-h: 48px; height: 48px; gap: 6px; padding: 0 6px 0 4px; }
  .bd-header__home span:not(.bd-appicon), .bd-header__sep, .bd-summary, .bd-header__arrange, .bd-avatar, .bd-header .bd-btn__label, .bd-header .bd-kbd { display: none; }
  .bd-header__home { margin-left: 0; padding: 8px; }
  .bd-title { font-size: var(--bd-fs-14); }
  .bd-header__actions { gap: 4px; }
  .bd-header__actions .bd-btn { padding: 0 8px; }
  .bd-header__actions [data-action="compare"], .bd-header__actions [data-action="comment-mode"], .bd-header__actions [data-action="toggle-panel"] { display: none; }
  .bd-menu { position: fixed; left: 8px; right: 8px; top: 52px; min-width: 0; }
  .bd-menu__meta b { max-width: none; }

  .bd-toolbar { bottom: calc(var(--bd-sheet-peek) + 12px); left: 8px; right: 8px; transform: none; justify-content: space-between; height: 48px; }
  .bd-main:has(.bd-panel[data-sheet="half"]) .bd-toolbar { bottom: calc(55% + 12px); }
  .bd-toolbar .bd-btn { height: 40px; min-width: 40px; }
  .bd-toolbar [data-desktop-only] { display: none; }
  .bd-current { flex: 1 1 auto; max-width: none; min-width: 0; height: 40px; justify-content: center; }
  .bd-hint { top: 8px; font-size: var(--bd-fs-12); }

  /* comments panel becomes a bottom sheet */
  /* Bottom sheet: portal phone sheet (cockpit.css .sheet: 22 px top corners, upward ink shadow). */
  .bd-panel { position: absolute; left: 0; right: 0; bottom: 0; width: auto; height: var(--bd-sheet-peek); border-left: 0; border-radius: var(--bd-r5) var(--bd-r5) 0 0; box-shadow: 0 -8px 30px rgba(29, 28, 26, .18); transition: height .24s cubic-bezier(.2,.8,.2,1); z-index: 22; }
  .app.is-panel-closed .bd-panel { display: flex; }
  .bd-panel[data-sheet="half"] { height: 55%; }
  .bd-panel[data-sheet="full"] { height: calc(100% - 8px); }
  .bd-panel.is-dragging { transition: none; }
  .bd-panel__head { position: relative; height: var(--bd-sheet-peek); padding: 14px 12px 6px 16px; border-bottom-color: transparent; touch-action: none; cursor: grab; }
  .bd-panel[data-sheet="half"] .bd-panel__head, .bd-panel[data-sheet="full"] .bd-panel__head { border-bottom-color: var(--bd-border); }
  .bd-panel__grip { display: block; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--bd-border-strong); }
  .bd-panel[data-sheet="peek"] .bd-panel__body, .bd-panel[data-sheet="peek"] .bd-panel__sheet-compose { visibility: hidden; }
  .bd-panel__sheet-compose { display: block; flex: none; border-bottom: 1px solid var(--bd-border); }
  .bd-panel__sheet-compose .bd-composer { padding: 12px 16px; }
  .bd-panel__sheet-compose textarea { min-height: 88px; font-size: 16px; }
  .bd-thread__actions .bd-btn { height: 32px; padding: 0 12px; }
  .bd-pin { min-width: 30px; height: 30px; line-height: 26px; border-radius: 15px 15px 15px 2px; }

  .bd-compare__bar { flex-wrap: wrap; padding: 6px 8px; gap: 6px; }
  .bd-compare__title { display: none; }
  .bd-compare__bar .bd-btn__label { display: none; }
  .bd-pane__head { display: grid; grid-template-columns: 32px 1fr 32px; gap: 4px; padding: 6px; }
  .bd-pane__head .bd-pane__letter { justify-self: center; }
  .bd-pane__head .bd-select--id { grid-column: 2 / 4; grid-row: 1; }
  .bd-pane__head [data-pane-step="-1"] { grid-column: 1; grid-row: 2; }
  .bd-pane__head .bd-select--ver { grid-column: 2; grid-row: 2; width: 100%; }
  .bd-pane__head [data-pane-step="1"] { grid-column: 3; grid-row: 2; }
  .bd-pane__scroll { padding: 8px; }
  .bd-toast { bottom: calc(var(--bd-sheet-peek) + 72px); }

  .bd-index { padding: 20px 12px 48px; }
  .bd-index__head { flex-direction: column; gap: 4px; }
  .bd-index__head h1 { font-size: 30px; }
  .bd-list-head { display: none; }
  .bd-row a { grid-template-columns: 72px 1fr auto; gap: 12px; padding: 10px 12px 10px 10px; }
  .bd-row__thumb { width: 72px; height: 52px; }
  .bd-row__ver, .bd-row__date, .bd-row__slug { display: none; }
  .bd-row__mobile-meta { display: block; font-size: var(--bd-fs-12); color: var(--bd-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bd-row__mobile-meta .bd-mono { color: var(--bd-text-3); }
}

@media (prefers-reduced-motion: reduce) {
  .bd-panel { transition: none; }
  .bd-pin--draft { animation: none; }
}

/* Production shell, index and standalone states. */
.bd-stage { position: relative; flex: 1 1 auto; min-width: 0; display: flex; }
.bd-stage > .bd-canvas { position: absolute; inset: 0; }
.bd-index-shell { height: auto; min-height: 100dvh; overflow: visible; background: var(--bd-surface-2); }
/* The index sits on the portal's paper like the portal Home; its header blends into the page. */
.bd-index-shell .bd-header { position: sticky; top: 0; background: var(--bd-surface-2); }
.bd-index-shell .bd-header__home span:not(.bd-appicon) { display: inline; }
.bd-index-shell .bd-avatar { display: inline-flex; }
.bd-row__identity { min-width: 0; }
.bd-row__title { display: block; }
.bd-row__thumb > svg { margin: auto; width: 20px; height: 20px; color: var(--bd-text-2); }
.bd-row__open svg { width: 14px; height: 14px; }
.bd-row__thumb--phone img { width: 42%; height: auto; margin-top: 6px; }
.bd-account { position: relative; }
.bd-account__menu { top: calc(100% + 6px); right: 0; left: auto; min-width: 136px; }
.bd-account__menu button { width: 100%; }
.bd-state { min-height: 100%; display: grid; place-items: center; text-align: center; padding: 24px; }
.bd-stage__state { flex: 1; min-height: 0; background: var(--bd-canvas); }
.bd-state h2 { margin: 0 0 4px; font-size: var(--bd-fs-16); }
.bd-stage__state [data-loading] h2 { font-size: var(--bd-fs-14); }
.bd-state p { margin: 0 0 16px; color: var(--bd-text-2); font-size: var(--bd-fs-13); }
/* Standalone pages (signed out, no access, missing board or version, sign-in callback) use the portal's
   quiet single column: portal.css .quiet, .quiet-col, .quiet h1, .quiet .lede, .quiet .actions, .btn. */
main.bd-state { min-height: 100vh; min-height: 100dvh; padding: 48px 24px 32px; background: var(--bd-surface-2); font-size: 18px; line-height: 1.5; }
main.bd-state > div { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; }
/* State pages show the bare glyph in ink, like the portal's quiet pages show their line icon without a tile. */
main.bd-state .bd-appicon { width: auto; height: auto; margin-bottom: 28px; background: none; color: var(--bd-text); }
main.bd-state .bd-appicon svg { width: 32px; height: 32px; stroke-width: 1.6; }
main.bd-state h1, main.bd-state h2 { margin: 0; font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
main.bd-state p { margin: 20px 0 0; color: var(--bd-text-2); font-size: 18px; line-height: 1.5; }
main.bd-state p + p { margin-top: 12px; font-size: 16px; }
main.bd-state a:not(.bd-btn) { color: var(--bd-accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
main.bd-state .bd-btn { display: flex; justify-content: center; width: 100%; height: auto; min-height: 64px; margin-top: 40px; padding: 10px 20px; border-radius: var(--pt-radius-sm); font-size: 19px; font-weight: 600; line-height: 1.2; white-space: normal; }
main.bd-state .bd-btn:not(.bd-btn--primary) { background: var(--bd-surface); border-color: var(--bd-border-strong); color: var(--bd-text); }
main.bd-state .bd-btn:not(.bd-btn--primary):hover { background: var(--bd-surface-2); }
main.bd-state .bd-mono { font-size: .9em; overflow-wrap: anywhere; }
@media (min-width: 760px) { main.bd-state h1, main.bd-state h2 { font-size: 34px; } }
.bd-spinner { margin: 0 auto 12px; width: 24px; height: 24px; border: 3px solid var(--bd-border-strong); border-top-color: var(--bd-accent); border-radius: 50%; animation: bd-spin .8s linear infinite; }
@keyframes bd-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .bd-spinner { animation: none; } }
.bd-compare[data-filter="open"] .bd-pin--resolved,
.bd-compare[data-filter="resolved"] .bd-pin:not(.bd-pin--resolved):not(.bd-pin--draft) { display: none; }
.bd-pane__frame { isolation: isolate; }
.bd-pane__frame iframe { position: absolute; inset: 0 auto auto 0; }
.bd-pane__frame img { pointer-events: none; }
.bd-pane__scroll { position: relative; }
.bd-group-label, .bd-fgroup__focus { background: none; border: 0; text-align: left; color: inherit; }
.bd-group-label { padding: 0; }
.bd-fgroup__focus { display: flex; min-width: 0; padding: 0; align-items: center; gap: 8px; flex: 1; }
.bd-menu { max-height: min(60dvh, 440px); overflow-y: auto; }
.bd-menu__item > a { color: inherit; text-decoration: none; display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; }
@container app (max-width: 720px) {
  .bd-compare { bottom: var(--bd-sheet-peek); }
  .bd-header__actions [data-action="more"] { min-height: 40px; min-width: 40px; }
  .bd-composer textarea { font-size: 16px; }
}
.bd-pins { position: absolute; inset: 0; pointer-events: none; }
.bd-pane__frame iframe { transform: scale(var(--pane-scale, 1)); }
.bd-pane__frame.is-loaded .bd-frame__placeholder { display: none; }
.bd-pane__frame.is-error .bd-frame__error { display: block; }
.bd-pane__frame .bd-frame__error-box { width: min(100%, 240px); overflow-wrap: anywhere; }

.bd-menu__item > span > svg { width: 16px; height: 16px; }
.app[data-mode="comment"] .bd-pane__frame { cursor: crosshair; }

/* ---------- index: projects, timeline and previews (agent-host-plumbing #147) ----------
   Appended to boards.css. Reuses the portal tokens, .bd-seg, .bd-btn, .bd-count, .bd-tag and the
   existing .bd-list / .bd-row card. Only geometry for the wider index and larger thumbnails changes. */

/* Page width and head */
.bd-index { width: 100%; max-width: 1040px; }
.bd-index__head { align-items: flex-end; gap: var(--bd-s4); margin-bottom: var(--bd-s5); }
.bd-index__titles { min-width: 0; }
.bd-index__head .bd-index__titles p { margin-top: 6px; }
.bd-index__back { display: inline-flex; align-items: center; gap: 4px; height: 28px; margin: 0 0 6px -8px; padding: 0 10px 0 6px; border-radius: var(--bd-pill); color: var(--bd-text-2); font-size: var(--bd-fs-13); font-weight: 500; text-decoration: none; }
.bd-index__back:hover { background: var(--bd-surface-3); color: var(--bd-text); }
.bd-index__back svg { width: 16px; height: 16px; }

/* View switch: the existing segmented control, with links because each view has its own URL. */
.bd-seg a { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: var(--pt-radius-tab); color: var(--bd-text); font-size: var(--bd-fs-13); font-weight: 500; text-decoration: none; white-space: nowrap; }
.bd-seg a:hover { background: var(--bd-surface-2); }
.bd-seg a[aria-current="page"] { background: var(--bd-accent-soft); color: var(--bd-accent); font-weight: 600; }
.bd-seg a:focus-visible { outline-offset: 1px; }
.bd-view { flex: none; }

/* Project sections (grouped view) */
.bd-project + .bd-project { margin-top: var(--bd-s6); }
.bd-project__head { display: flex; align-items: center; gap: 6px; min-height: 36px; margin: 0 0 10px -6px; }
.bd-project__toggle svg { transition: transform .16s ease; }
.bd-project__toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }
.bd-project__name { margin: 0; min-width: 0; font-size: var(--bd-fs-20); line-height: var(--bd-lh-20); font-weight: 600; letter-spacing: -.01em; }
.bd-project__name a { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; color: inherit; text-decoration: none; border-radius: var(--bd-r2); }
.bd-project__name a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-project__name svg { flex: none; width: 18px; height: 18px; color: var(--bd-text-3); transition: transform .16s ease, color .16s ease; }
.bd-project__name a:hover { color: var(--bd-accent); }
.bd-project__name a:hover svg { color: var(--bd-accent); transform: translateX(2px); }
.bd-project__meta { margin-left: 6px; font-size: var(--bd-fs-13); color: var(--bd-text-2); white-space: nowrap; }
.bd-project__open { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding-right: 20px; font-size: var(--bd-fs-13); color: var(--bd-text-2); white-space: nowrap; }
.bd-project__open--zero { gap: 4px; color: var(--bd-text-2); }
.bd-project__open--zero svg { color: var(--bd-text-3); }
.bd-project__open--zero svg { width: 14px; height: 14px; }
.bd-project__open--has { color: var(--bd-accent); font-weight: 600; }
.bd-project__open--has .bd-count { background: var(--bd-accent); color: var(--bd-accent-text); }
.bd-project.is-collapsed { padding-bottom: 10px; border-bottom: 1px solid var(--bd-border); }
.bd-project.is-collapsed .bd-project__head { margin-bottom: 0; }
.bd-project.is-collapsed + .bd-project { margin-top: var(--bd-s4); }

/* Rows: larger 16:10 thumbnail; second line carries the project label (timeline) and the slug. */
.bd-row a, .bd-list-head { grid-template-columns: 128px 1fr 64px 112px 72px; }
.bd-row__thumb { position: relative; width: 128px; height: 80px; box-shadow: none; }
.bd-row__thumb::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(29, 28, 26, .08); pointer-events: none; }
.bd-row a:hover .bd-row__thumb::after { box-shadow: inset 0 0 0 1px rgba(29, 28, 26, .16); }
.bd-row__thumb--phone img { width: 42%; height: auto; margin-top: 6px; border-radius: 3px 3px 0 0; box-shadow: 0 0 0 1px rgba(29, 28, 26, .10), 0 1px 3px rgba(29, 28, 26, .08); }
.bd-row__thumb--none { background: repeating-linear-gradient(135deg, var(--bd-surface-2) 0 6px, var(--bd-surface-3) 6px 12px); }
.bd-row__thumb--none > svg { color: var(--bd-text-3); }
.bd-row__sub { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 2px; }
.bd-row__sub .bd-row__slug { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-row__sub .bd-tag { flex: none; }
.bd-row__mobile-meta .bd-tag { margin-right: 2px; }

/* Unknown project: empty state with a way back */
.bd-empty__actions { margin-top: var(--bd-s4); display: flex; justify-content: center; }
.bd-empty__projects { margin: var(--bd-s5) auto 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; max-width: 520px; font-size: var(--bd-fs-13); color: var(--bd-text-3); }
.bd-empty__projects a { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border: 1px solid var(--bd-border-strong); border-radius: var(--bd-pill); background: var(--bd-surface); color: var(--bd-text); font-weight: 500; text-decoration: none; }
.bd-empty__projects a:hover { background: var(--bd-surface-2); }
.bd-list > .bd-empty { list-style: none; }

@container app (max-width: 720px) {
  .bd-index__head { flex-direction: row; align-items: flex-end; gap: var(--bd-s3); margin-bottom: var(--bd-s4); }
  .bd-index__head .bd-index__titles p { font-size: var(--bd-fs-13); }
  .bd-seg a { height: 34px; padding: 0 12px; }
  .bd-project + .bd-project { margin-top: var(--bd-s5); }
  .bd-project__head { gap: 2px; margin: 0 0 8px -8px; }
  .bd-project__toggle { width: 40px; height: 40px; }
  .bd-project__name { font-size: 18px; line-height: 24px; }
  .bd-project__meta { margin-left: 8px; }
  .bd-project__updated { display: none; }
  .bd-project__open { padding-right: 4px; }
  .bd-project.is-collapsed { padding-bottom: 6px; }
  .bd-row a { grid-template-columns: 80px 1fr auto; gap: 12px; padding: 10px 14px 10px 10px; }
  .bd-row__thumb { width: 80px; height: 50px; }
  .bd-row__sub { display: none; }
  .bd-row__title { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 19px; }
  .bd-row__mobile-meta { margin-top: 2px; }
  .bd-row__thumb--none > svg { width: 16px; height: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .bd-project__toggle svg, .bd-project__name svg { transition: none; }
}
