/* Refresh components — page chrome + every shared UI component.
   Split out of the original refresh_shell.css; tokens live in tokens.css. */

/* ===== Baseline ===== */
/* Tailwind's reset seeds its own grays (#e5e7eb borders, #9ca3af placeholders);
   re-seed with brand tokens here so an unclassed element can never leak them. */
*, ::before, ::after { border-color: var(--pt-border); }
::placeholder { color: var(--pt-fg-muted); opacity: 1; }
/* The gutter stays reserved so pages that scroll and pages that don't share one width. */
html { scrollbar-gutter: stable; }
html, body {
    background: var(--pt-bg);
    color: var(--pt-fg);
    font-family: var(--pt-font-body);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
:where(button, a, input, textarea, select, [tabindex]):focus { outline: none; }
:where(button, a, input, textarea, select, [tabindex]):focus-visible {
    outline: none;
    box-shadow: var(--pt-focus-ring);
    border-radius: var(--pt-radius-sm);
}
[x-cloak] { display: none !important; }

/* ===== Icon weight =====
   Phosphor ships one glyph at several weights, so "which weight" has to be a rule
   or it becomes a coin flip per template. The rule is about SIZE, because that is
   what decides whether duotone's two tones can be seen at all:

     duotone — pictures only: an illustration, or a glyph in a tinted tile. In
               practice >=32px. Below that the two tones muddy into one grey.
     bold    — everything that sits in a line of text, a button, a table cell, or
               a chip. This is almost every icon in the app.
     fill    — reserved for encoding binary state where outline-vs-filled IS the
               meaning. Today that is exactly one thing: the priority star, which
               ships both weights so a row class can pick one (.priority-star--on
               / --off). Never reach for fill to add emphasis — a filled warning
               next to fourteen bold ones just looks like a different warning.

   Enforced by zui_refresh/tests/unit/test_icon_weight.py. */
.icon-illustration { font-size: var(--pt-icon-empty); }

/* ===== Icon button (shared, used by pages) ===== */
.icon-btn {
    width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--pt-radius-pill); border: 1px solid var(--pt-border);
    background: var(--pt-surface); color: var(--pt-fg-muted); cursor: pointer;
    transition: color var(--pt-dur-instant), border-color var(--pt-dur-instant),
                transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.icon-btn:hover { color: var(--pt-fg); border-color: var(--pt-fg); }
.icon-btn.is-on { background: var(--pt-fg); color: var(--pt-surface); border-color: var(--pt-fg); }
.icon-btn [class^="ph-"], .icon-btn [class*=" ph-"] { font-size: var(--pt-text-md); }

/* ===== Sidebar ===== */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 100;
    background: var(--pt-bg); display: flex; flex-direction: column;
    border-right: 1px solid var(--pt-border);
    /* Collapse animates width here, margin on .main-content and left on .save-bar, all
       off the same --sidebar-w flip. None can be a transform (the rail's contents
       genuinely reflow and the main column must actually get wider), so every frame
       relayouts the document — including a long data table. Kept at --pt-dur-fast to
       keep that relayout window short. */
    transition: transform var(--pt-dur-fast) var(--pt-ease-paper),
                width var(--pt-dur-fast) var(--pt-ease-paper);
}
/* ===== Sidebar rails =====
   Three columns run the full height of the panel and everything hangs off them:
     box    8px — the search button and every nav row share one left edge, so the
                  hover and active pills all start in the same place.
     icon  20px — 8px box + 12px inner padding. The logo mark, the magnifier, and
                  every nav icon sit in this column.
     label 52px — 20px icon column + 20px icon + 12px gap.
   Before this they were at 16/12/8, 24/20, and 50/52 respectively — close enough
   to look like a mistake rather than a choice. */
.sidebar-brand {
    display: flex; align-items: center; gap: var(--pt-space-2);
    /* Sides are the 20px icon rail (8px box + 12px inner padding), spelled as the sum so it
       stays tied to the rail and not to a spacing step. 16 + 32px mark + 16 = the 64px
       collapsed width, so the collapsed brand is a square cell. */
    padding: var(--pt-space-4) calc(var(--pt-space-2) + var(--pt-space-3)) var(--pt-space-4);
}
.sidebar-brand-link {
    display: inline-flex; flex-direction: column; align-items: flex-start; gap: var(--pt-space-1);
    text-decoration: none; flex: 1; min-width: 0;
}
.sidebar-brand-row { display: flex; align-items: center; gap: var(--pt-space-3); align-self: stretch; min-width: 0; }
/* Height, not width — the mark is 107x77, so sizing by width left the row at 28.8px. */
.sidebar-brand-mark { height: 32px; width: auto; display: block; flex: none; }
.sidebar-brand-callsign { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
/* Callsign eyebrow is lockup lettering, not UI type — sized to the mark, below the type scale. */
.sidebar-brand-eyebrow { font-size: 8px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1.2; color: var(--pt-fg-muted); white-space: nowrap; }
.sidebar-brand-title { font-weight: var(--pt-weight-strong); font-size: var(--pt-text-lg); line-height: 1.2; color: var(--pt-fg); letter-spacing: var(--pt-track-tight); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-search {
    margin: 0 var(--pt-space-2) var(--pt-space-3);
    position: relative;
}
/* Styled like a search input, but it's a button that opens the command palette. */
.sidebar-search-btn {
    width: 100%; height: 40px; display: block;
    /* Left padding lands the label in the 52px rail (8 box + 44); right clears the
       ⌘K chip. Both are clearance for absolutely-positioned children, not rhythm. */
    padding: 0 44px 0 44px; font-size: var(--pt-text-sm); text-align: left;
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md);
    color: var(--pt-fg-muted); font-family: inherit; cursor: pointer;
}
.sidebar-search-btn:hover { border-color: var(--pt-fg-muted); }
.sidebar-search-btn__label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-search [class^="ph-"],
.sidebar-search [class*=" ph-"] {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--pt-fg-muted); font-size: var(--pt-text-lg); pointer-events: none;
}
/* 12px inset mirrors the nav rows' padding, so the chip's right edge lands in the
   same column their content ends in. */
.sidebar-search kbd {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    font-size: var(--pt-text-2xs); font-weight: var(--pt-weight-strong); padding: 2px var(--pt-space-2); line-height: 16px;
    background: var(--pt-bg); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md); color: var(--pt-fg-muted);
    font-family: inherit;
}

.sidebar-nav { flex: 1; padding: var(--pt-space-2) var(--pt-space-2) var(--pt-space-4); overflow-y: auto; }

/* ===== Flat nav =====
   Two workspaces holding six links. An accordion over that would cost a click and
   hide the destination to save nothing, so every link is always on screen.
   Collapsing the rail drops the labels and keeps the same rows. */
.nav-section + .nav-section { margin-top: var(--pt-space-4); }
.nav-section__label { padding: 0 var(--pt-space-3); margin-bottom: var(--pt-space-2); }
.sidebar-link {
    display: flex; align-items: center; gap: var(--pt-space-3);
    padding: var(--pt-space-2) var(--pt-space-3); font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value);
    color: var(--pt-fg); border-radius: var(--pt-radius-md); text-decoration: none;
    transition: background var(--pt-dur-instant);
    border: 0; background: transparent; cursor: pointer; text-align: left;
    width: 100%;
}
.sidebar-link:hover { background: var(--pt-surface); }
.sidebar-link.active { background: var(--pt-rocket-flame-20); color: var(--pt-ink-on-flame-20); font-weight: var(--pt-weight-strong); }
.sidebar-link [class^="ph-"], .sidebar-link [class*=" ph-"] { font-size: var(--pt-text-lg); flex: none; }
.sidebar-link__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-link .count {
    flex: none; font-size: var(--pt-text-xs); font-weight: var(--pt-weight-value); color: var(--pt-fg-muted);
    font-variant-numeric: tabular-nums;
}
.sidebar-link.active .count { color: var(--pt-ink-on-flame-20); }

.sidebar-footer {
    /* min-height (not height) so the collapsed vertical icon stack can grow past it. */
    min-height: var(--bottom-bar-h); box-sizing: border-box;
    padding: var(--pt-space-2); border-top: 1px solid var(--pt-border);
    display: flex; align-items: center; gap: var(--pt-space-2);
}
.profile-card {
    display: flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-2); border-radius: var(--pt-radius-md);
    background: transparent; border: 0;
    flex: 1; min-width: 0; text-align: left;
}
.profile-card__text { flex: 1; min-width: 0; overflow: hidden; }
.profile-card-name { font-size: var(--pt-text-xs); font-weight: var(--pt-weight-strong); line-height: 1.2; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-card-role { font-size: var(--pt-text-2xs); color: var(--pt-fg-muted); display: block; }
.sidebar-icon-btn {
    width: 32px; height: 32px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--pt-radius-md); border: 0;
    background: transparent; color: var(--pt-fg-muted); cursor: pointer;
    transition: background var(--pt-dur-instant), color var(--pt-dur-instant), transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.sidebar-icon-btn:hover { background: var(--pt-surface); color: var(--pt-fg); }
.sidebar-icon-btn [class^="ph-"], .sidebar-icon-btn [class*=" ph-"] { font-size: var(--pt-text-md); }

.mobile-sidebar-toggle {
    display: none;
    position: fixed; top: 12px; left: 12px; z-index: 120;
    /* 40, not the 32 the other icon buttons use — this is the one touch-only control. */
    width: 40px; height: 40px;
    border-radius: var(--pt-radius-md); border: 1px solid var(--pt-border);
    background: var(--pt-bg); color: var(--pt-fg); cursor: pointer;
    align-items: center; justify-content: center;
}
.mobile-sidebar-toggle [class^="ph-"], .mobile-sidebar-toggle [class*=" ph-"] { font-size: var(--pt-text-lg); }

/* Collapse toggle — lives in the brand row, reuses the sidebar-icon-btn look. */
.sidebar-collapse-btn { flex-shrink: 0; }

/* ===== Collapsed rail (desktop only) =====
   Driven by data-sidebar-collapsed on <html>. Mobile keeps the full off-canvas
   panel, so all of this is scoped to the desktop breakpoint. */
@media (min-width: 1024px) {
    :root[data-sidebar-collapsed="true"] { --sidebar-w: 64px; }

    /* Brand: center the rocket, drop the wordmark. */
    [data-sidebar-collapsed="true"] .sidebar-brand { justify-content: center; padding: var(--pt-space-4) var(--pt-space-2) var(--pt-space-4); }
    [data-sidebar-collapsed="true"] .sidebar-brand-link { flex: none; align-items: center; }
    [data-sidebar-collapsed="true"] .sidebar-brand-row { justify-content: center; }
    [data-sidebar-collapsed="true"] .sidebar-brand-callsign { display: none; }

    /* Search collapses to a single icon button sized like the workspace icons:
       same 8px side inset (matching .sidebar-nav padding) and 40px height, so it
       doesn't read as a smaller pill. */
    [data-sidebar-collapsed="true"] .sidebar-search { margin: 0 var(--pt-space-2) var(--pt-space-3); }
    [data-sidebar-collapsed="true"] .sidebar-search-btn {
        height: 40px; padding: 0;
        display: flex; align-items: center; justify-content: center;
    }
    [data-sidebar-collapsed="true"] .sidebar-search-btn__label,
    [data-sidebar-collapsed="true"] .sidebar-search kbd { display: none; }
    [data-sidebar-collapsed="true"] .sidebar-search [class^="ph-"],
    [data-sidebar-collapsed="true"] .sidebar-search [class*=" ph-"] { position: static; transform: none; font-size: var(--pt-text-lg); }

    /* Same rows, labels dropped. The native title attribute carries the name on
       hover, so nothing needs a flyout to stay reachable. */
    [data-sidebar-collapsed="true"] .sidebar-link { justify-content: center; gap: 0; padding: var(--pt-space-3) 0; }
    [data-sidebar-collapsed="true"] .sidebar-link__label,
    [data-sidebar-collapsed="true"] .sidebar-link .count,
    [data-sidebar-collapsed="true"] .nav-section__label { display: none; }

    /* Sections separate on a hairline once their labels are gone. */
    [data-sidebar-collapsed="true"] .nav-section + .nav-section {
        margin-top: var(--pt-space-3); padding-top: var(--pt-space-3);
        border-top: 1px solid var(--pt-border);
    }

    /* Footer stacks: avatar over theme toggle. */
    [data-sidebar-collapsed="true"] .sidebar-footer { flex-direction: column; gap: var(--pt-space-2); padding: var(--pt-space-2) 0; }
    [data-sidebar-collapsed="true"] .profile-card { justify-content: center; padding: var(--pt-space-2) 0; }
    [data-sidebar-collapsed="true"] .profile-card__text { display: none; }
}

/* In-flight feedback for the live table region (search / filter / sort / paginate).
   Without it the table just sits on a slow query, then jumps to new rows. The
   delay means only requests that outlive ~300ms ever dim (sub-budget responses
   need no feedback at all — NN/g's 100ms limit, Turbo's 500ms bar), so the
   common fast swap stays visually instant instead of flickering on every
   keystroke. Class, not id: region ids are entity-scoped (#role-candidates). */
.table-region.htmx-request {
    opacity: 0.6;
    transition: opacity var(--pt-dur-instant) var(--pt-ease-paper);
    transition-delay: 300ms;
}
/* Requests that outlive ~600ms also pulse the stale rows — the static dim alone
   reads as frozen on a genuinely slow query. Opacity keyframes, not a gradient
   shimmer (brand: no gradients). */
.table-region.htmx-request .data-table tbody { animation: rows-pulse 1.6s var(--pt-ease-paper) 600ms infinite; }
@keyframes rows-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
    /* The global 0.01ms clamp would turn an infinite pulse into a strobe. */
    .table-region.htmx-request .data-table tbody { animation: none; }
}

/* ===== Layout ===== */
/* NOTE: this is the same element as #app-main (<main id="app-main" class="main-content">),
   so the collapse and the nav fade have to share ONE transition declaration — an
   #app-main rule would outrank this one on specificity and silently drop margin-left. */
.main-content {
    margin-left: var(--sidebar-w); min-height: 100vh;
    padding: var(--pt-space-6);
    /* margin-left matches the sidebar's collapse timing (see .sidebar); opacity
       drives the shell navigation fade-in below, and is deliberately the shortest
       token we have — navigation must feel instant, not smooth. */
    transition: margin-left var(--pt-dur-fast) var(--pt-ease-paper),
                opacity var(--pt-dur-instant) var(--pt-ease-paper);
}

/* ===== Shell navigation fade-in =====
   Boosted nav swaps #app-main while the sidebar stays put, so without this the whole
   content region hard-cuts to a different page. Incoming content only — the outgoing
   page is never faded out, so the content area never sits blank waiting on the request
   (that read as a flash of nothing). Paired with swap:0ms / settle:20ms on the hx-swap
   declarations: the old markup holds until the response lands, then the new markup
   fades up from the settling state. Falls back to no fade (opacity 1) when htmx is
   absent, since the class is only ever added by htmx. Opacity only, 80ms: enough to
   stop a hard cut, short enough that the swap still reads as instant. No blur — it
   composites the whole content region, and blur reads as slow even when it isn't. */
#app-main.htmx-settling { opacity: 0; }
/* Programmatic focus after a shell swap (refresh.js) — a content region is not a control, no ring. */
#app-main:focus { outline: none; }
@media (min-width: 1600px) { .main-content { padding: var(--pt-space-6) var(--pt-space-8); } }
/* Edit-form pages reserve room for the sticky save-bar */
.main-content.has-save-bar {
    height: calc(100dvh - var(--bottom-bar-h)); min-height: 0; overflow-y: auto;
    padding-bottom: var(--pt-space-24); scroll-padding-block: var(--pt-space-6);
}

/* One full-width content column — record metadata lives in a Details tab, not a sidebar. */
.layout-grid { display: grid; gap: var(--pt-space-4); grid-template-columns: minmax(0, 1fr); }

/* ===== Breadcrumb + record pager ===== */
.breadcrumb { display: flex; align-items: center; gap: var(--pt-space-2); font-size: var(--pt-text-xs); color: var(--pt-fg-muted); margin-bottom: var(--pt-space-4); }
.breadcrumb a { color: var(--pt-fg-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--pt-fg); }
.breadcrumb .sep { color: var(--pt-border); }
.breadcrumb .current { color: var(--pt-fg); font-weight: var(--pt-weight-value); }

/* ===== Buttons ===== */
.btn-primary {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-2) var(--pt-space-4); font-size: var(--pt-text-sm); font-weight: var(--pt-weight-strong);
    color: var(--pt-white); background: var(--pt-rocket-flame); border: 0; border-radius: var(--pt-radius-pill);
    cursor: pointer; white-space: nowrap;
    transition: background var(--pt-dur-instant),
                transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.btn-primary:hover { background: var(--pt-rocket-flame-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
/* Destructive primary — for confirm-delete/void actions inside modals */
.btn-primary--danger { background: var(--pt-red-alert); }
.btn-primary--danger:hover { background: var(--pt-red-alert-hover); }
.btn-secondary {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-2) var(--pt-space-4); font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value);
    color: var(--pt-fg); background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-pill); cursor: pointer; white-space: nowrap;
    transition: border-color var(--pt-dur-instant),
                transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.btn-secondary:hover { border-color: var(--pt-fg); }
.btn-secondary--sm { padding: var(--pt-space-2) var(--pt-space-3); font-size: var(--pt-text-xs); }
/* Bordered destructive secondary — a low-emphasis red trigger that keeps the
   secondary button shape (sits beside other secondaries without a filled CTA). */
.btn-secondary--danger { color: var(--pt-red-alert); }
.btn-secondary--danger:hover { border-color: var(--pt-red-alert); }
.btn-secondary .count {
    color: var(--pt-fg-muted); font-weight: var(--pt-weight-value);
    padding-left: var(--pt-space-1); border-left: 1px solid var(--pt-border);
    margin-left: var(--pt-space-1); padding-right: 0;
}
.btn-ghost {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-2) var(--pt-space-3); font-size: var(--pt-text-xs); font-weight: var(--pt-weight-value);
    color: var(--pt-fg-muted); background: transparent; border: 0;
    border-radius: var(--pt-radius-pill); cursor: pointer;
    transition: color var(--pt-dur-instant), background var(--pt-dur-instant),
                transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.btn-ghost:hover { color: var(--pt-fg); background: var(--surface-muted); }
.btn-ghost.is-on { background: var(--pt-fg); color: var(--pt-surface); }
.btn-ghost.danger { color: var(--pt-red-alert); }
.btn-ghost.danger:hover { background: var(--pt-red-alert-20); }

/* Press feedback — motion earns its place on high-frequency controls here because it
   confirms the press landed. Subtle and short; disabled buttons don't respond. */
.btn-primary:active:not(:disabled),
.btn-secondary:active:not(:disabled),
.btn-ghost:active:not(:disabled),
.icon-btn:active:not(:disabled),
.sidebar-icon-btn:active,
.row-action:active,
.star-btn:active,
.rt-btn:active,
.toast__close:active,
.filter-chip .chip-x:active,
.multi-picker__chip__remove:active,
.pager-btn:active:not(.is-disabled):not(.is-current),
.toast__action:active,
.view-tab__remove:active,
.view-tab--add:active,
.filter-add:active,
.review-nav-btn:active:not(.is-disabled) {
    transform: scale(0.97);
}
@media (prefers-reduced-motion: reduce) {
    .btn-primary, .btn-secondary, .btn-ghost, .icon-btn,
    .sidebar-icon-btn, .row-action, .star-btn, .rt-btn,
    .toast__close, .filter-chip .chip-x,
    .multi-picker__chip__remove, .pager-btn, .review-nav-btn,
    .toast__action, .view-tab__remove, .view-tab--add, .filter-add {
        transition-property: color, background, border-color, opacity;
    }
    .btn-primary:active:not(:disabled),
    .btn-secondary:active:not(:disabled),
    .btn-ghost:active:not(:disabled),
    .icon-btn:active:not(:disabled),
    .sidebar-icon-btn:active,
    .row-action:active,
    .star-btn:active,
    .rt-btn:active,
    .toast__close:active,
    .filter-chip .chip-x:active,
    .multi-picker__chip__remove:active,
    .pager-btn:active,
    .toast__action:active,
    .view-tab__remove:active,
    .view-tab--add:active,
    .filter-add:active,
    .review-nav-btn:active { transform: none; }
}
/* Small primary — matches btn-secondary--sm so the two pair on compact rows */
.btn-primary--sm { padding: var(--pt-space-2) var(--pt-space-3); font-size: var(--pt-text-xs); }

/* ===== Avatars =====
   One family, three axes: `.av` is the tile, a size class picks the diameter, a
   variant class picks what fills it. Every person and every company in the app
   renders through this — there is no second avatar component, and no surface gets
   to invent its own diameter inline. */
.av {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: var(--pt-weight-strong); font-size: var(--pt-text-2xs);
}
.av-sm { width: 24px; height: 24px; }
.av-md { width: 40px; height: 40px; font-size: var(--pt-text-xs); }
.av-lg { width: 48px; height: 48px; font-size: var(--pt-text-md); }
.av-xl { width: 64px; height: 64px; font-size: var(--pt-text-xl); letter-spacing: -0.02em; }
/* Logo avatar — real company mark on a neutral tile instead of initials. The mark
   needs more breathing room as the tile grows, so the inset steps with the size. */
.av--logo { background: var(--pt-white); border: 1px solid var(--pt-border); padding: var(--pt-space-1); }
.av--logo.av-lg, .av--logo.av-xl { padding: var(--pt-space-2); }
.av--logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
/* Photo avatar — a profile image (or the generic silhouette) instead of initials. */
.av--photo { background: none; padding: 0; overflow: hidden; }
.av--photo img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
/* Initials on a high-contrast tile — a company with no mark on file. */
.av--contrast { background: var(--pt-contrast-bg); color: var(--pt-contrast-fg); }
/* You. Only the signed-in user's own optimistic rows wear this, so a comment you
   just posted is recognisably yours before the server answers. */
.av--self { background: var(--pt-galactic-seafoam-20); color: var(--pt-ink-on-seafoam-20); }

/* ===== Badges, tags, labels, chips ===== */
.status-badge {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-1) var(--pt-space-3); font-size: var(--pt-text-xs); font-weight: var(--pt-weight-strong);
    line-height: 16px; border-radius: var(--pt-radius-pill); white-space: nowrap;
    box-shadow: inset 0 0 0 1px currentColor;
}
.status-badge--green { background: var(--pt-galactic-seafoam-20); color: var(--pt-ink-on-seafoam-20); }
.status-badge--gold { background: var(--pt-solar-gold-20); color: var(--pt-ink-on-gold-20); }
.status-badge--red { background: var(--pt-red-alert-20); color: var(--pt-ink-on-red-20); }
.status-badge--blue { background: var(--pt-atmosphere-blue-20); color: var(--pt-ink-on-blue-20); }
.status-badge--purple { background: var(--pt-voyager-purple-20); color: var(--pt-ink-on-purple-20); }
.status-badge--flame { background: var(--pt-rocket-flame-20); color: var(--pt-ink-on-flame-20); }
.status-badge--black { background: var(--pt-contrast-bg); color: var(--pt-contrast-fg); }
.status-badge--neutral { background: var(--surface-muted); color: var(--pt-fg-muted); }

/* Compact list-cell variant of status-badge */
.status-badge--list { padding: 2px var(--pt-space-2); font-size: var(--pt-text-xs); line-height: 16px; }
.cell-status { display: flex; flex-direction: column; align-items: flex-start; gap: var(--pt-space-1); }
.cell-status__detail { color: var(--pt-fg-muted); font-size: var(--pt-text-xs); line-height: var(--pt-leading-sm); white-space: nowrap; }

/* Requirement enforcement is configuration, not lifecycle status. */
.enforcement-label {
    display: inline-flex; align-items: center; padding: 2px var(--pt-space-2);
    border-radius: var(--pt-radius-xs); font-size: var(--pt-text-xs); font-weight: var(--pt-weight-strong);
    line-height: 16px; white-space: nowrap;
}
.enforcement-label--red { background: var(--pt-red-alert-20); color: var(--pt-ink-on-red-20); }
.enforcement-label--gold { background: var(--pt-solar-gold-20); color: var(--pt-ink-on-gold-20); }
.enforcement-label--neutral { background: var(--surface-muted); color: var(--pt-fg-muted); }

/* A solid dot means outstanding human work and nothing else. */
.attention-marker {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    font-size: var(--pt-text-xs); font-weight: var(--pt-weight-strong); white-space: nowrap;
}
.attention-marker__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: currentColor; }
.attention-marker--warning { color: var(--pt-ink-on-gold-20); }
.attention-marker--danger { color: var(--pt-ink-on-red-20); }

/* Neutral metadata label (no status dot) */
.tag {
    display: inline-flex; align-items: center;
    padding: 3px var(--pt-space-3); font-size: var(--pt-text-xs); font-weight: var(--pt-weight-value);
    background: var(--surface-muted); color: var(--pt-fg);
    border-radius: var(--pt-radius-pill); white-space: nowrap;
}
.tag--xs { padding: 2px var(--pt-space-2); font-size: var(--pt-text-2xs); line-height: 16px; }
/* A wrapping cluster of tags (details panel sections, table tag cells). */
.tag-row { display: flex; flex-wrap: wrap; gap: var(--pt-space-1); }

/* UI label = neutral pill with optional leading icon */
.ui-label {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-1) var(--pt-space-3); border-radius: var(--pt-radius-pill);
    font-size: var(--pt-text-xs); font-weight: var(--pt-weight-value);
    background: var(--surface-muted); color: var(--pt-fg);
}
.ui-label__icon { color: var(--pt-fg-muted); font-size: var(--pt-text-sm); }
.ui-label a { color: var(--pt-fg); text-decoration: none; }
.ui-label a:hover { color: var(--pt-rocket-flame); }

/* ===== Hero ===== */
.detail-hero {
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md); padding: var(--pt-space-6); margin-bottom: var(--pt-space-4);
}
.hero-row { display: flex; align-items: center; gap: var(--pt-space-6); flex-wrap: wrap; }
.hero-main { flex: 1; min-width: 280px; }
/* Family eyebrow — icon chip plus small-caps label naming what kind of record this is. */
.hero-eyebrow {
    display: flex; align-items: center; gap: var(--pt-space-2);
    margin-bottom: var(--pt-space-2);
    font-size: var(--pt-text-2xs); line-height: var(--pt-leading-2xs);
    font-weight: var(--pt-weight-strong); letter-spacing: var(--pt-track-caps);
    text-transform: uppercase; color: var(--pt-fg-muted);
}
/* The family icon at avatar size, in the avatar's slot — what an icon-marked family wears instead of a face.
   One fixed hue per family, never reused for state — the tint/ink pairs tokens.css ships. */
.hero-tile {
    display: inline-flex; align-items: center; justify-content: center;
    width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
    background: var(--surface-muted); color: var(--pt-fg-muted);
    font-size: var(--pt-text-xl);
}
.detail-hero[data-accent="flame"] .hero-tile { background: var(--pt-rocket-flame-20); color: var(--pt-ink-on-flame-20); }
.detail-hero[data-accent="seafoam"] .hero-tile { background: var(--pt-galactic-seafoam-20); color: var(--pt-ink-on-seafoam-20); }
.detail-hero[data-accent="gold"] .hero-tile { background: var(--pt-solar-gold-20); color: var(--pt-ink-on-gold-20); }
.detail-hero[data-accent="blue"] .hero-tile { background: var(--pt-atmosphere-blue-20); color: var(--pt-ink-on-blue-20); }
.detail-hero[data-accent="purple"] .hero-tile { background: var(--pt-voyager-purple-20); color: var(--pt-ink-on-purple-20); }
/* Page-title role. The margin belongs to the wrapper (.page-head, .hero-main), never to the heading. */
.hero-name,
.page-headline {
    font-size: var(--pt-text-2xl); line-height: var(--pt-leading-2xl);
    font-weight: var(--pt-weight-strong); letter-spacing: var(--pt-track-tight);
    color: var(--pt-fg); margin: 0;
}
.hero-name { display: flex; align-items: center; gap: var(--pt-space-3); flex-wrap: wrap; }
.hero-sub { color: var(--pt-fg-muted); font-size: var(--pt-text-sm); margin-top: var(--pt-space-2); }
/* Structured sub line: each fact one inline-flex item, so a mini avatar sits beside its own fact only. */
.hero-sub { display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--pt-space-2); row-gap: var(--pt-space-1); }
.hero-sub__item { display: inline-flex; align-items: center; gap: var(--pt-space-1); min-width: 0; }
.hero-sub__dot { color: var(--pt-fg-muted); }
.av-xs { width: 18px; height: 18px; font-size: 9px; }
.av--logo.av-xs { padding: 2px; }
.hero-sub a { color: var(--pt-fg); font-weight: var(--pt-weight-value); text-decoration: none; }
.hero-sub a:hover { color: var(--pt-rocket-flame); }
.hero-pipeline { margin-top: var(--pt-space-4); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--pt-space-2); align-items: center; }

/* Hero metadata — the record's key facts as a footer row of the hero card. */
.hero-meta {
    display: flex; flex-wrap: wrap; row-gap: var(--pt-space-3);
    margin-top: var(--pt-space-4); padding-top: var(--pt-space-4);
    border-top: 1px solid var(--pt-border);
}
.hero-meta__item {
    display: flex; flex-direction: column; gap: 2px;
    padding: 0 var(--pt-space-4); min-width: 0;
}
.hero-meta__item:first-child { padding-left: 0; }
.hero-meta__item + .hero-meta__item { border-left: 1px solid var(--pt-border); }
/* A closing fact (a date, usually) sits at the far right; the gap divides it, so it drops the rule. */
.hero-meta__item--end { margin-left: auto; align-items: flex-end; padding-right: 0; }
.hero-meta__item + .hero-meta__item--end { border-left: none; }
.hero-meta__k { white-space: nowrap; }
.hero-meta__v {
    font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value); color: var(--pt-fg);
    display: inline-flex; align-items: center; gap: var(--pt-space-2); white-space: nowrap;
}
/* Never underlined — a hero link answers with the brand colour, as .hero-sub a does. */
.hero-meta__link {
    color: var(--pt-fg); text-decoration: none;
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
}
.hero-meta__link:hover { color: var(--pt-rocket-flame); }

/* ===== Popover motion (shared: action panel, filter-chip editor) =====
   Panels grow from the corner they're anchored to, so they read as coming out of
   their trigger rather than materialising in mid-air. Each panel sets its own
   transform-origin to match its anchor. Exit snaps quicker than the entrance. */
.pop-enter-active {
    transition: opacity var(--pt-dur-fast) var(--pt-ease-paper),
                transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.pop-leave-active {
    transition: opacity var(--pt-dur-instant) var(--pt-ease-paper),
                transform var(--pt-dur-instant) var(--pt-ease-paper);
}
.pop-hidden { opacity: 0; transform: scale(0.96); }
.pop-shown { opacity: 1; transform: scale(1); }
@media (prefers-reduced-motion: reduce) {
    /* Keep the fade, drop the scale. */
    .pop-hidden { transform: none; }
}

/* ===== Action popover ===== */
/* The trigger cluster. Positioned, because .action-panel anchors to it. */
.action-bar { display: flex; align-items: center; gap: var(--pt-space-2); position: relative; }
.action-panel {
    position: absolute; right: 0; top: calc(100% + 8px); width: 320px;
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md); padding: var(--pt-space-2); z-index: 50;
    transform-origin: top right; /* anchored under the trigger's right edge */
}
.action-item {
    display: flex; align-items: flex-start; gap: var(--pt-space-3);
    padding: var(--pt-space-2) var(--pt-space-3); border-radius: var(--pt-radius-sm); cursor: pointer;
    color: var(--pt-fg); text-decoration: none; border: 0; background: none;
    width: 100%; text-align: left; font: inherit;
}
.action-item:hover { background: var(--surface-muted); }
.action-item.danger { color: var(--pt-red-alert); }
/* The header's leading action reads green and bold, as the legacy UI marked it. */
.action-item.success .action-item__label { color: var(--pt-ink-on-seafoam-20); font-weight: var(--pt-weight-bold); }
.action-item__icon {
    width: 32px; height: 32px; border-radius: var(--pt-radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: var(--pt-text-md);
}
.action-item__icon--info { background: var(--pt-atmosphere-blue-20); color: var(--pt-ink-on-blue-20); }
.action-item__icon--success { background: var(--pt-galactic-seafoam-20); color: var(--pt-ink-on-seafoam-20); }
.action-item__icon--neutral { background: var(--surface-muted); color: var(--pt-fg-muted); }
.action-item__icon--danger { background: var(--pt-red-alert-20); color: var(--pt-ink-on-red-20); }
.action-item__main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.action-item__label { font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value); line-height: 16px; }
.action-item__desc { font-size: var(--pt-text-2xs); color: var(--pt-fg-muted); line-height: 14px; margin-top: var(--pt-space-1); }

/* ===== Small label + caption (shared; used by the invoice financial summary) ===== */
/* Leadings paired with their sizes so a label + figure stack lands on the 8px grid. */
.kpi-label { font-size: var(--pt-text-xs); line-height: var(--pt-leading-xs); font-weight: var(--pt-weight-value); color: var(--pt-fg-muted); }
.kpi-meta { font-size: var(--pt-text-2xs); line-height: var(--pt-leading-2xs); color: var(--pt-fg-muted); margin-top: var(--pt-space-1); }

/* ===== Tabs (view + detail) ===== */
.view-tabs, .detail-tabs {
    display: flex; align-items: center; border-bottom: 1px solid var(--pt-border);
    overflow-x: auto; overflow-y: hidden;
}
/* Same construction, so the same gap to the content below — the strip's margin
   lives here for both, never as a utility class on one of them. */
.view-tabs {
    gap: 0; height: calc(var(--pt-leading-sm) + var(--pt-space-6) + 1px); box-sizing: border-box;
    margin-bottom: var(--pt-space-6);
}
.detail-tabs { gap: 0; margin-bottom: var(--pt-space-6); }
.view-tab, .detail-tab {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-3) var(--pt-space-4); font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value);
    color: var(--pt-fg-muted); border: 0; background: transparent;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    cursor: pointer; white-space: nowrap;
    transition: color var(--pt-dur-instant);
}
.view-tab { line-height: var(--pt-leading-sm); }
.view-tab:hover, .detail-tab:hover { color: var(--pt-fg); }
.view-tab.active, .detail-tab.active { color: var(--pt-fg); border-bottom-color: var(--pt-fg); font-weight: var(--pt-weight-strong); }
.view-tab .count, .view-tab .n,
.detail-tab .count { color: var(--pt-fg-muted); font-weight: var(--pt-weight-value); }
.view-tab.active .count, .view-tab.active .n,
.detail-tab.active .count { color: var(--pt-fg); }
.view-tab--add { color: var(--pt-fg-muted); padding: var(--pt-space-3); transition: color var(--pt-dur-instant), transform var(--pt-dur-fast) var(--pt-ease-paper); }

/* User-saved views (savedViews in refresh.js): the tab is a span so the nav
   link and the delete button don't nest interactive elements. */
.view-tab--saved { cursor: default; }
.view-tab__link { color: inherit; text-decoration: none; cursor: pointer; }
.view-tab__remove {
    display: inline-flex; border: 0; background: none; padding: 0;
    color: var(--pt-fg-muted); font-size: var(--pt-text-2xs); cursor: pointer;
    border-radius: var(--pt-radius-xs);
    opacity: 0; transition: opacity var(--pt-dur-instant), transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.view-tab--saved:hover .view-tab__remove, .view-tab__remove:focus-visible { opacity: 1; }
.view-tab__remove:hover { color: var(--pt-red-alert); }

/* Entrance for tabs created by savedViews.save() this session only —
   persisted tabs render without the flag so page loads stay still. */
.view-tab--fresh {
    transition: opacity var(--pt-dur-fast) var(--pt-ease-paper),
                transform var(--pt-dur-fast) var(--pt-ease-paper);
}
@starting-style {
    .view-tab--fresh { opacity: 0; transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
    /* Keep the fade, drop the lift. */
    .view-tab--fresh { transition-property: opacity; }
    @starting-style {
        .view-tab--fresh { transform: none; }
    }
}

/* ===== Section cards ===== */
.section-card {
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md); overflow: hidden;
}
.section-card + .section-card { margin-top: var(--pt-space-4); }
/* A fields tab's own editor: one quiet button above the panel, opening the drawer. */
.tab-edit-row { display: flex; justify-content: flex-end; margin-bottom: var(--pt-space-3); }
/* The choose-first step ahead of a create drawer: stacked option buttons. */
.drawer-picker { display: flex; flex-direction: column; gap: var(--pt-space-2); padding: var(--pt-space-4); }
.drawer-picker__option {
    display: flex; align-items: center; gap: var(--pt-space-3); text-align: left;
    padding: var(--pt-space-3) var(--pt-space-4); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md); background: var(--pt-surface); cursor: pointer;
    font: inherit; color: inherit;
}
.drawer-picker__option:hover { border-color: var(--pt-border-strong); background: var(--pt-surface-raised); }
.drawer-picker__option i { font-size: 1.25rem; color: var(--pt-fg-muted); }
.drawer-picker__main { display: flex; flex-direction: column; }
.drawer-picker__label { font-weight: var(--pt-weight-medium); }
.drawer-picker__desc { font-size: var(--pt-text-sm); color: var(--pt-fg-muted); }
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--pt-space-4) var(--pt-space-6); border-bottom: 1px solid var(--pt-border); gap: var(--pt-space-3);
}
/* The title with its qualifying chip beside it; the head's justify-between pushes the note to the far end.
   Baseline, not center: the title's taller line box would otherwise float the chip visually high. */
.section-head__lead { display: flex; align-items: baseline; gap: var(--pt-space-2); }
.section-head__note { font-size: var(--pt-text-sm); color: var(--pt-fg-muted); text-align: right; }
/* Section-title role — the step that separates a card's heading from the 14px rows under it. */
.section-title,
.form-card-title,
.rev-hero__name {
    font-size: var(--pt-text-lg); line-height: var(--pt-leading-lg); font-weight: var(--pt-weight-strong);
}
.section-title { display: inline-flex; align-items: center; gap: var(--pt-space-2); }
.count-pill {
    font-size: var(--pt-text-2xs); font-weight: var(--pt-weight-strong); padding: 2px var(--pt-space-2);
    border-radius: var(--pt-radius-pill);
    background: var(--surface-muted); color: var(--pt-fg-muted);
}
.section-body { padding: var(--pt-space-6); }

/* ===== Related table ===== */
.rel-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rel-table th {
    text-align: left; padding: var(--pt-space-3) var(--pt-space-6); background: var(--surface-muted);
    border-bottom: 1px solid var(--pt-border); white-space: nowrap;
}
.rel-table td {
    padding: var(--pt-space-4) var(--pt-space-6); font-size: var(--pt-text-sm);
    border-bottom: 1px solid var(--pt-border); vertical-align: middle;
    font-variant-numeric: tabular-nums;
}
.rel-table th.col-numeric, .rel-table td.col-numeric { text-align: right; }
.rel-table tbody tr:last-child td { border-bottom: 0; }
.rel-table tbody tr:hover { background: var(--surface-muted); cursor: pointer; }
.rel-table a { color: var(--pt-fg); font-weight: var(--pt-weight-strong); text-decoration: none; }
.rel-table a:hover { color: var(--pt-rocket-flame); }

.cell-name { display: flex; align-items: center; gap: var(--pt-space-3); }
/* Also worn by a <button> — a drawer family's name cell opens a panel, not a page. */
.cell-name__title {
    font-weight: var(--pt-weight-strong); color: var(--pt-fg); line-height: 1.2; text-decoration: none;
    background: none; border: 0; padding: 0; font-family: inherit; font-size: inherit;
    text-align: left; cursor: pointer;
}
.cell-name__sub { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); line-height: 1.2; margin-top: var(--pt-space-1); }
/* The brand mark that marks Planetary Talent staff — the flex line keeps it beside the name. */
.cell-name__line { display: flex; align-items: center; gap: var(--pt-space-1); }
.cell-name__mark { width: 14px; height: 14px; flex-shrink: 0; }
.hero-name__mark { width: 20px; height: 20px; }
.cell-user { display: inline-flex; align-items: center; gap: var(--pt-space-2); white-space: nowrap; }
.cell-muted { color: var(--pt-fg-muted); }
/* Money + link cells in list tables */
.cell-amount { font-weight: var(--pt-weight-value); font-variant-numeric: tabular-nums; }
/* Record-id links (e.g. invoice numbers) stay neutral at rest — color is
   punctuation, so flame only answers the hover. The row hover already signals
   clickability. */
/* Also worn by a <button> — a link cell with a drawer_url opens a peek, not a page. */
.cell-link {
    color: var(--pt-fg); text-decoration: none; font-weight: var(--pt-weight-value);
    background: none; border: 0; padding: 0; font-family: inherit; font-size: inherit;
    text-align: left; cursor: pointer;
}
.cell-link:hover { color: var(--pt-rocket-flame); }

/* Credit amounts read red; received payments read seafoam. */
.cell-amount--credit { color: var(--pt-red-alert); }
.cell-amount--paid { color: var(--pt-galactic-seafoam); }
.cell-amount--debit { color: var(--pt-solar-gold); }
.cell-nowrap { white-space: nowrap; }

/* Figure strip — the invoice overview's subtotal / adjustments / total divided as
   one group with balance due split off to the right, reused by the metrics panel. */
.fin-summary {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: var(--pt-space-6); padding: var(--pt-space-6); flex-wrap: wrap;
}
.fin-summary__figures { display: flex; align-items: flex-start; flex: 1; min-width: 0; }
.fin-summary__cell { padding: 0 var(--pt-space-6); }
.fin-summary__figures .fin-summary__cell:first-child { padding-left: 0; }
.fin-summary__figures .fin-summary__cell + .fin-summary__cell { border-left: 1px solid var(--pt-border); }
.fin-summary__cell--balance {
    text-align: right; padding-right: 0; border-left: 1px solid var(--pt-border); flex-shrink: 0;
}
/* Headline figures use the same DM Sans face as the rest of the UI. */
.stat-tile__value,
.fin-summary__value {
    font-family: var(--pt-font-body); font-weight: var(--pt-weight-regular);
    font-size: var(--pt-text-display); line-height: var(--pt-leading-display);
    font-variant-numeric: tabular-nums;
}
.fin-summary__value { margin-top: var(--pt-space-2); }
/* 8px steps around the figure keep the card on the grid, strip and lone rail card alike. */
.fin-summary__value + .kpi-meta { margin-top: var(--pt-space-2); }
.fin-summary__value--credit { color: var(--pt-red-alert); }
.fin-summary__value--paid { color: var(--pt-galactic-seafoam); }
.fin-summary__value--draft { color: var(--pt-ink-on-gold-20); }

/* Invoice flags / entity checks — one line per warning, info, or passing check. */
.note-list { display: flex; flex-direction: column; gap: var(--pt-space-3); }
.note-item { display: flex; align-items: flex-start; gap: var(--pt-space-2); font-size: var(--pt-text-sm); }
.note-item i { line-height: 1.5; flex-shrink: 0; }
.note-item--warning i { color: var(--pt-ink-on-gold-20); }
.note-item--info i { color: var(--pt-ink-on-blue-20); }
.note-item--ok i { color: var(--pt-ink-on-seafoam-20); }

/* ===== Big data table (list view) ===== */
/* No overflow:hidden here — it would make the card its own scrollport and kill the
   pager's sticky. The corners it used to clip are now owned by the two children that
   actually reach the card's edges. */
.table-card {
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md);
}
.table-wrap { overflow-x: auto; border-radius: var(--pt-radius-md) var(--pt-radius-md) 0 0; }
/* Inside a section-card, which already rounds and clips, the wrap's own radius draws a second curve. */
.table-wrap--flush { border-radius: 0; }

/* ===== Rail layout: a panel's main column beside a stack of summary cards ===== */
.rail-cols { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--pt-space-4); align-items: start; }
.rail { position: sticky; top: var(--pt-space-4); display: flex; flex-direction: column; gap: var(--pt-space-4); }
@media (max-width: 1100px) { .rail-cols { grid-template-columns: 1fr; } .rail { position: static; } }
.rail-rows { display: flex; flex-direction: column; }
.rail-row { display: flex; justify-content: space-between; gap: var(--pt-space-3); padding: var(--pt-space-2) 0; font-size: var(--pt-text-sm); }
.rail-row + .rail-row { border-top: 1px solid var(--pt-border); }
.rail-row .kpi-label { align-self: center; }
/* A rail row that carries a control (confirm costs, issue) stacks its button over its note. */
.rail-row--action { flex-direction: column; align-items: flex-start; gap: var(--pt-space-2); padding-top: var(--pt-space-3); }
.rail-row--action .btn-primary { width: 100%; }
.upcoming-vendor { flex-direction: column; gap: var(--pt-space-3); }
.upcoming-vendor__summary { display: flex; justify-content: space-between; gap: var(--pt-space-3); }
.upcoming-vendor__summary > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.upcoming-vendor__summary .cell-name__sub { display: block; margin-top: var(--pt-space-1); }
.upcoming-vendor button { max-width: 100%; white-space: normal; text-align: left; }

/* ===== Grouped table: collapsible parents, nested child lines, sortable headers ===== */
/* Fixed layout: column widths stay put whichever rows are on screen, so nothing shifts on group or collapse. */
.group-table { table-layout: fixed; }
/* Same header band as the list views' data-table, so the two read as one system. */
.group-table thead th { height: var(--table-band-h); padding-top: 0; padding-bottom: 0; }
/* Tighter inner gutters so a many-column table survives a rail beside it; the card edges keep theirs. */
.group-table th, .group-table td { padding-left: var(--pt-space-4); padding-right: var(--pt-space-4); }
.group-table th:first-child, .group-table td:first-child { padding-left: var(--pt-space-6); }
.group-table th:last-child, .group-table td:last-child { padding-right: var(--pt-space-6); }
.group-table tfoot td { border-top: 1px solid var(--pt-fg); border-bottom: 0; font-weight: var(--pt-weight-strong); }
.group-table tfoot .table-grand td { font-size: var(--pt-text-md); font-weight: var(--pt-weight-bold); border-top: 0; }
.group-table tfoot tr:hover { background: transparent; cursor: default; }
.th-sort {
    background: none; border: 0; padding: 0; cursor: pointer; color: inherit;
    font: inherit; text-transform: inherit; letter-spacing: inherit;
}
.th-sort:hover { color: var(--pt-fg); }
/* Group parents carry the same row rhythm as the ungrouped view, one step up in weight and size. */
.group-row td {
    background: var(--surface-muted); font-weight: var(--pt-weight-strong); font-size: var(--pt-text-md);
    padding-top: var(--pt-space-4); padding-bottom: var(--pt-space-4);
}
.group-row + tr td { border-top: 1px solid var(--pt-border); }
.group-toggle {
    display: flex; align-items: center; gap: var(--pt-space-3);
    background: none; border: 0; padding: 0; cursor: pointer; color: inherit; font: inherit; font-weight: var(--pt-weight-strong);
}
.group-caret { transition: transform var(--pt-dur-fast) ease; color: var(--pt-fg-muted); font-size: var(--pt-text-md); }
.group-row.is-open .group-caret { transform: rotate(90deg); color: var(--pt-fg); }
/* A child line sits under the row it belongs to: indented and quieter. */
.child-row td:first-child { padding-left: calc(var(--pt-space-6) + var(--pt-space-4)); }
.child-row td { padding-top: var(--pt-space-3); padding-bottom: var(--pt-space-3); }
.child-row .cell-name__title { font-weight: var(--pt-weight-value); color: var(--pt-fg-muted); }
/* tabular-nums table-wide so dates, percentages, and amounts align down columns. */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 100%; font-variant-numeric: tabular-nums; }
.data-table thead th {
    text-align: left;
    height: var(--table-band-h); padding: 0 var(--pt-space-4); background: var(--surface-muted);
    border-bottom: 1px solid var(--pt-border); white-space: nowrap;
    position: sticky; top: 0; z-index: 1;
}
.data-table thead th.col-numeric { text-align: right; }
.data-table thead th.is-sticky-l {
    left: 0; z-index: 2; background: var(--surface-muted);
    border-right: 1px solid var(--pt-border);
}
.data-table thead th a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: var(--pt-space-1); }
.data-table thead th a:hover { color: var(--pt-fg); }
.sort-caret { opacity: 0.4; font-size: var(--pt-text-xs); }
.sort-caret.is-active { opacity: 1; color: var(--pt-fg); }

.data-table tbody tr {
    --row-bg: var(--pt-surface);
    background: var(--row-bg); cursor: pointer;
    /* opacity carries the optimistic bulk-removal fade (and its Undo fade-back) */
    transition: background var(--pt-dur-instant) var(--pt-ease-paper),
                opacity var(--pt-dur-fast) var(--pt-ease-paper);
}
/* Optimistic bulk removal: rows fade out, then hide; Undo unhides + fades back. */
.data-table tbody tr.row-vanish { opacity: 0; }
.data-table tbody tr:hover { --row-bg: var(--surface-muted); }
.data-table tbody tr.is-selected { --row-bg: var(--pt-atmosphere-blue-20); }
/* Keyboard cursor (j/k). --row-bg so sticky cells follow; the flame bar on the
   first cell marks the cursor without fighting .is-selected's tint. */
.data-table tbody tr.kb-active { --row-bg: var(--surface-muted); }
.data-table tbody tr.kb-active > td:first-child { box-shadow: inset 2px 0 0 var(--pt-rocket-flame); }
.data-table tbody td {
    padding: var(--pt-space-3) var(--pt-space-4); font-size: var(--pt-text-sm); color: var(--pt-fg);
    border-bottom: 1px solid var(--pt-border); vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody td.col-numeric { text-align: right; font-variant-numeric: tabular-nums; }
.data-table thead th.col-score,
.data-table tbody td.col-score { text-align: left; }
/* A free-text column (a description, a notes field) holds a paragraph. Clamped so
   switching it on cannot widen the row until every other column is unreadable. */
.data-table .cell-clamp { max-width: 28ch; overflow-wrap: anywhere; }
/* Same transition as the row — the sticky cell reads --row-bg from the <tr>, and
   without this it snaps to the hover color while the rest of the row fades. */
.data-table tbody td.is-sticky-l {
    position: sticky; left: 0; background: var(--row-bg); border-right: 1px solid var(--pt-border);
    transition: background var(--pt-dur-instant) var(--pt-ease-paper);
}

/* List-table support cells */
.row-action {
    width: 32px; height: 32px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--pt-fg-muted); background: transparent; border: 0; cursor: pointer;
    transition: background var(--pt-dur-instant), color var(--pt-dur-instant), transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.row-action:hover { background: var(--pt-border); color: var(--pt-fg); }
.row-action.is-on { background: var(--pt-fg); color: var(--pt-surface); }
/* A row's kebab menu: the shared action panel, fixed off the trigger by rowMenu() so the table's scroll box never clips it. */
.row-menu { display: inline-flex; }
.row-menu__panel { z-index: 60; text-align: left; white-space: normal; }
.action-item.is-disabled { cursor: not-allowed; opacity: 0.55; }
.action-item.is-disabled:hover { background: none; }
.cell-name__sub-link { color: inherit; text-decoration: none; }
.cell-name__sub-link:hover { color: var(--pt-rocket-flame); text-decoration: underline; }
/* A settings screen's form card: one foldable card holding every section, saving from its own footer. */
.settings-form__head { display: flex; align-items: center; justify-content: space-between; gap: var(--pt-space-3); }
.settings-form__section + .settings-form__section { border-top: 1px solid var(--pt-border); }
.settings-form__title { font-weight: var(--pt-weight-strong); margin-bottom: var(--pt-space-3); }
.settings-form__footer { display: flex; justify-content: flex-end; border-top: 1px solid var(--pt-border); }
.settings-form { margin-bottom: var(--pt-space-6); }
.settings-table .table-toolbar { margin-bottom: var(--pt-space-3); }
/* A code panel's block: monospace, wrapped, scrolling only when a line will not wrap. */
.code-panel {
    margin: 0; padding: var(--pt-space-4) var(--pt-space-6); overflow-x: auto;
    font-family: var(--pt-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: var(--pt-text-xs);
    line-height: var(--pt-leading-xs); white-space: pre-wrap; word-break: break-word; color: var(--pt-fg);
}
/* A date-range chip's two day pickers, side by side. */
.chip-dates { display: flex; gap: var(--pt-space-3); padding: var(--pt-space-2) 0; }
.chip-dates__field { display: flex; flex-direction: column; gap: var(--pt-space-1); flex: 1; }

.priority-star { color: var(--pt-solar-gold); font-size: var(--pt-text-md); }
/* Muted, not border-colored: the unstarred state must stay visible against the row. */
.priority-star--off { color: var(--pt-fg-muted); }
/* Starred state lives on whatever the toggle names as its data-optimistic target
   — the <tr> in a table, the button itself on a board card or the review desk —
   so the button ships both icon weights and the .is-starred class picks one. */
.priority-star--on { display: none; }
.is-starred .priority-star--on { display: inline; }
.is-starred .priority-star--off { display: none; }
.star-btn {
    background: none; border: 0; padding: var(--pt-space-1); line-height: 0; cursor: pointer;
    display: inline-flex; border-radius: 50%;
    transition: background var(--pt-dur-instant), transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.star-btn:hover { background: var(--pt-border); }
.star-btn:hover .priority-star--off { color: var(--pt-solar-gold); }

/* Second sticky-left column (a locked priority/star column after the checkbox).
   Offset = rendered width of the sticky checkbox cell: 40px content + 16px×2
   padding − overlap ≈ 49px. Named here so the one place that must track the
   checkbox width is obvious if that cell ever changes. */
.data-table { --col-select-w: 49px; }
.data-table thead th.is-sticky-l.col-sticky-2,
.data-table tbody td.is-sticky-l.col-sticky-2 { left: var(--col-select-w); }
/* Keep the star column to its own content — a control, not a reading, so it takes no
   more of the row than the star and its heading need. */
.data-table th.col-priority,
.data-table td.col-priority { width: 1%; white-space: nowrap; text-align: center; }
/* The two chrome columns that bracket every list table. Deliberately NOT named
   col-* : that prefix is the data-column namespace (col-<column key>), and
   columnPicker.applyOrder() reorders anything in it. A chrome cell that lands in
   that namespace gets shuffled in with the data and the table comes out wrong. */
.data-table th.table-select { width: 40px; }
.data-table th.table-actions,
.data-table td.table-actions { text-align: right; white-space: nowrap; }
.col-priority__head { font-size: var(--pt-text-md); color: var(--pt-fg-muted); }

/* ===== Empty state (table body with no rows) ===== */
.empty-state {
    display: flex; flex-direction: column; align-items: center;
    gap: var(--pt-space-1); padding: var(--pt-space-12) var(--pt-space-6); text-align: center;
}
.empty-state__icon { font-size: var(--pt-icon-empty); color: var(--pt-fg-muted); margin-bottom: var(--pt-space-2); }
.empty-state__title { font-size: var(--pt-text-md); font-weight: var(--pt-weight-strong); color: var(--pt-fg); }
.empty-state__sub { font-size: var(--pt-text-sm); line-height: var(--pt-leading-sm); color: var(--pt-fg-muted); max-width: 360px; }
.empty-state .btn-secondary { margin-top: var(--pt-space-4); }
/* The empty row is the table's only row — no hover tint, no trailing rule. */
.data-table tbody tr.empty-row:hover { --row-bg: transparent; }
.data-table tbody tr.empty-row td { border-bottom: 0; }

/* ===== Score ring ===== */
.score-indicator {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    font-variant-numeric: tabular-nums; font-weight: var(--pt-weight-strong); white-space: nowrap;
}
.score-indicator__value { flex: 0 0 6ch; inline-size: 6ch; text-align: left; }
.score-ring { width: 16px; height: 16px; flex-shrink: 0; overflow: visible; }
.score-ring__track, .score-ring__value { fill: none; stroke-width: 3; }
.score-ring__track { stroke: var(--pt-border); }
.score-ring__value {
    stroke: var(--score-ring-color, var(--pt-fg-muted)); stroke-linecap: round;
    transform: rotate(-90deg); transform-origin: center;
}
.score-ring--affinity, .score-ring--positive { --score-ring-color: var(--pt-galactic-seafoam); }
.score-ring--warning { --score-ring-color: var(--pt-solar-gold); }
.score-ring--danger { --score-ring-color: var(--pt-red-alert); }

/* ===== Stage breakdown bar ===== */
.stage-bar {
    display: flex; gap: var(--pt-space-1); align-items: stretch;
    height: 8px; border-radius: var(--pt-radius-pill);
    overflow: hidden; background: var(--surface-muted);
}
.stage-bar__seg { transition: opacity var(--pt-dur-instant); }
.stage-bar__seg:hover { opacity: 0.85; }
.stage-legend { display: flex; flex-wrap: wrap; gap: var(--pt-space-4) var(--pt-space-6); margin-top: var(--pt-space-4); }
.stage-legend__item { display: inline-flex; align-items: center; gap: var(--pt-space-2); font-size: var(--pt-text-sm); }
.stage-legend__swatch { width: 12px; height: 12px; border-radius: var(--pt-radius-xs); }
.stage-legend__label { color: var(--pt-fg-muted); }
.stage-legend__value { font-weight: var(--pt-weight-strong); color: var(--pt-fg); font-variant-numeric: tabular-nums; }

/* Interactive variants — only on pages that carry a board for the click to land on.
   The segment grows a little rather than only lightening, so the bar reads as a row
   of targets without needing a hover to discover it. */
.stage-bar { padding: 1px 0; }
.stage-bar__seg--linked {
    border: 0; padding: 0; cursor: pointer; border-radius: var(--pt-radius-xs);
    transition: opacity var(--pt-dur-instant), transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.stage-bar__seg--linked:hover { opacity: 1; transform: scaleY(1.6); }
.stage-legend__item--linked {
    border: 0; background: none; padding: var(--pt-space-1) var(--pt-space-2);
    margin: calc(var(--pt-space-1) * -1) calc(var(--pt-space-2) * -1);
    border-radius: var(--pt-radius-sm); cursor: pointer; font: inherit;
    transition: background var(--pt-dur-instant);
}
.stage-legend__item--linked:hover { background: var(--surface-muted); }
.stage-legend__item--linked:hover .stage-legend__label { color: var(--pt-fg); }

/* ===== Stage board (the Candidates tab's second rendering) ===== */
/* The toolbar keeps its own margin; the switch sits at the end of the same row. */
.controls-row { display: flex; align-items: flex-start; gap: var(--pt-space-3); }
.controls-row > form { flex: 1; min-width: 0; }

/* Same shape and same "chosen" treatment as .radio-group below — both are one
   mutually-exclusive choice, so they must not read as two different controls. */
.view-switch {
    display: inline-flex; flex-shrink: 0; margin-bottom: var(--pt-space-4);
    background: var(--surface-muted); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-pill); padding: 2px; gap: 2px;
}
.view-switch__btn {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-2) var(--pt-space-4); border: 0; background: none;
    border-radius: var(--pt-radius-pill); cursor: pointer;
    font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value); color: var(--pt-fg-muted);
    transition: background var(--pt-dur-instant), color var(--pt-dur-instant);
}
.view-switch__btn:hover { color: var(--pt-fg); }
.view-switch__btn.active { background: var(--pt-fg); color: var(--pt-surface); }
.view-switch--end { margin-left: auto; }

/* The board occupies exactly the table's footprint — same column, same edges, the
   inspector still alongside — so switching views moves nothing but the content.
   The card's panel drops away beneath it: the stage columns are the surfaces here,
   and a white sheet behind them just muddies the stack. */
.table-card--board { background: none; border-color: transparent; }

/* Flush to the container on every edge; the columns' own gap is the only inset, so
   the first column starts exactly where the table's first cell did. */
.board-view { display: flex; flex-direction: column; gap: var(--pt-space-3); }
/* Work-item counts across the whole board — a quiet strip over the columns, not a
   card of its own: it is a reading of the board, so it sits on the board's ground. */
.board-summary {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--pt-space-3);
    padding: var(--pt-space-2) var(--pt-space-1);
}
/* A live nav badge before its first fetch, and with nothing to say. */
.sidebar-link .count.is-hidden { display: none; }
/* The strip over a tab: whole-set counts, each a link that narrows the tab to it. */
.count-strip {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--pt-space-2);
    padding: 0 var(--pt-space-1); margin-bottom: var(--pt-space-3);
    font-size: var(--pt-text-sm); color: var(--pt-fg-muted);
}
.count-strip__item { color: var(--pt-fg-muted); text-decoration: none; }
.count-strip__item:hover { color: var(--pt-rocket-flame); }
.count-strip__count { font-weight: var(--pt-weight-strong); color: var(--pt-fg); font-variant-numeric: tabular-nums; }
.count-strip__sep { color: var(--pt-border); }
.board-summary__stat { display: inline-flex; align-items: center; gap: var(--pt-space-2); }
.board-summary__count {
    font-size: var(--pt-text-sm); font-weight: var(--pt-weight-strong); color: var(--pt-fg);
    font-variant-numeric: tabular-nums;
}
.board {
    display: flex; align-items: stretch; gap: var(--pt-space-3); overflow-x: auto;
    height: var(--board-viewport-height, 70vh);
}
.board-col {
    display: flex; flex-direction: column; flex: 0 0 260px;
    background: var(--surface-muted); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md); height: 100%; min-height: 0;
}
.board-col__head {
    display: flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-3); border-top: 4px solid transparent;
    border-radius: var(--pt-radius-md) var(--pt-radius-md) 0 0;
}
.board-col__icon { flex-shrink: 0; font-size: var(--pt-text-lg); line-height: 1; }
.board-col__title {
    flex: 1; min-width: 0; margin: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.board-col__count {
    font-size: var(--pt-text-xs); font-weight: var(--pt-weight-strong); color: var(--pt-fg);
    font-variant-numeric: tabular-nums;
}
.board-col__body {
    display: flex; flex-direction: column; gap: var(--pt-space-2);
    padding: 0 var(--pt-space-2) var(--pt-space-3); overflow-y: auto;
}
.board-col__empty {
    margin: 0; padding: var(--pt-space-4) 0; text-align: center;
    font-size: var(--pt-text-xs); color: var(--pt-fg-muted);
}
/* Landing flash after a stage-bar click — a brief ring, not a colour change, so it
   reads as "here" without competing with the stage colours. */
@keyframes board-col-flash {
    from { box-shadow: 0 0 0 3px var(--pt-rocket-flame); }
    to { box-shadow: 0 0 0 3px transparent; }
}
.board-col--flash { animation: board-col-flash 600ms var(--pt-ease-paper); }

.board-card {
    position: relative; display: block; padding: var(--pt-space-3); text-decoration: none;
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-sm);
    /* No grab cursor: the card opens candidate review and cannot be moved. */
    cursor: pointer; touch-action: pan-y;
    transition: border-color var(--pt-dur-fast) var(--pt-ease-paper);
}
.board-card:hover { border-color: var(--pt-fg-muted); }
.board-card__review { position: absolute; z-index: 1; inset: 0; border-radius: inherit; }
.board-card__review:focus-visible { outline: none; box-shadow: var(--pt-focus-ring); }
/* Held against a drag: no transition, so the card tracks the pointer 1:1 within its
   resistance limit. Releasing drops this class and --springing eases it home. */
.board-card--refusing { transition: none; cursor: not-allowed; }
.board-card--springing { transition: transform var(--pt-dur-base) var(--pt-ease-paper); }
/* Peek fetch in flight — the card dims rather than showing a spinner it has no room for. */
.board-card.is-loading { opacity: 0.6; }

.board-card__top { display: flex; align-items: center; gap: var(--pt-space-2); }
.board-card__name {
    flex: 1; min-width: 0; font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value); color: var(--pt-fg);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.board-card__star { position: relative; z-index: 2; color: var(--pt-solar-gold); flex-shrink: 0; display: inline-flex; line-height: 0; }
/* An unflagged card's star is nearly invisible until the card is reached for — it is
   a control on every card now, and fourteen grey stars would read as data. */
.board-card__star .star-btn .priority-star--off { opacity: 0; transition: opacity var(--pt-dur-instant); }
.board-card:hover .board-card__star .star-btn .priority-star--off,
.board-card__star .star-btn:focus-visible .priority-star--off { opacity: 1; }
.board-card__meta {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--pt-space-2); margin-top: var(--pt-space-2);
    font-size: var(--pt-text-xs); font-variant-numeric: tabular-nums;
}
/* Affinity uses one proportional ring treatment across list, board, and detail. */
.board-card__meta .score-indicator { font-size: var(--pt-text-xs); }
/* Days in stage. Neutral until it crosses the warn threshold — an always-coloured
   clock would make a healthy pipeline look alarming. */
.board-card__age { display: inline-flex; align-items: center; gap: 4px; color: var(--pt-fg-muted); }
/* The card's glance signal, its own row under the meta line — the star sits up in
   __top, so the two never share space. Full width so a booked slot has room to read. */
.board-card__signal { margin-top: var(--pt-space-2); }
.board-card__signal .status-badge {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.board-card__work-items {
    display: grid; gap: 5px; margin-top: var(--pt-space-2); padding-top: var(--pt-space-2);
    border-top: 1px solid var(--pt-border);
}
.board-card__work-item { display: flex; align-items: center; justify-content: space-between; gap: var(--pt-space-2); }
.board-card__work-label {
    display: inline-flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden;
    color: var(--pt-fg-muted); font-size: var(--pt-text-xs); text-overflow: ellipsis; white-space: nowrap;
}
.board-card__work-item .status-badge { flex-shrink: 0; }
.board-card__work-more { color: var(--pt-fg-muted); font-size: var(--pt-text-xs); }
.board-card--warn .board-card__age { color: var(--pt-ink-on-gold-20); }
.board-card--stale .board-card__age { color: var(--pt-ink-on-flame-20); font-weight: var(--pt-weight-strong); }

@media (prefers-reduced-motion: reduce) {
    .stage-bar__seg--linked:hover { transform: none; }
    .board-col--flash { animation: none; }
    .board-card--springing { transition: none; }
}

/* ===== Metadata rows (fields tabs) ===== */
.inspector-label { margin-bottom: var(--pt-space-2); }
/* A hairline per row: at this density a key pairs with its value only if the rows are ruled off. */
.inspector-row {
    display: flex; justify-content: space-between; align-items: center;
    gap: var(--pt-space-3); padding: var(--pt-space-2) 0;
    border-bottom: 1px solid var(--pt-border);
}
.inspector-row:last-child { padding-bottom: 0; border-bottom: 0; }
/* Meta role — the key recedes so the value carries the row. */
.inspector-row .k {
    font-size: var(--pt-text-xs); font-weight: var(--pt-weight-regular);
    color: var(--pt-fg-muted); flex-shrink: 0;
}
/* `anywhere`, not `break-word`: only `anywhere` shrinks the flex item's min-content
   width, so a value with no space to wrap at (a long email, a portfolio URL) wraps
   inside its own column instead of running under the next one. */
.inspector-row .v {
    color: var(--pt-fg); font-size: var(--pt-text-sm); line-height: var(--pt-leading-sm);
    font-weight: var(--pt-weight-value); font-variant-numeric: tabular-nums; text-align: right;
    display: inline-flex; align-items: center; gap: var(--pt-space-2); min-width: 0; overflow-wrap: anywhere;
}
.inspector-row .v.muted { color: var(--pt-fg-muted); font-weight: var(--pt-weight-regular); }
.inspector-row .v.inspector-row__value--stacked {
    flex-direction: column; align-items: flex-end; gap: var(--pt-space-1);
}
.inspector-row__note { margin-left: var(--pt-space-2); color: var(--pt-fg-muted); font-weight: var(--pt-weight-regular); }
.inspector-row__value--stacked .inspector-row__note { margin-left: 0; }
/* The desk's Intake card and the record-answer drawer: the state's detail, the exchange, and one control per slot. */
.desk-intake__detail { margin: 0 0 var(--pt-space-4); font-size: var(--pt-text-sm); color: var(--pt-fg-muted); }
.desk-intake__block { padding-top: var(--pt-space-4); margin-top: var(--pt-space-4); border-top: 1px solid var(--pt-border); }
.desk-intake__block:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.desk-intake__question, .answer-drawer__text { margin: 0 0 var(--pt-space-2); font-size: var(--pt-text-sm); color: var(--pt-fg-muted); }
.desk-intake__reply, .answer-drawer__reply {
    margin: 0 0 var(--pt-space-4); padding: var(--pt-space-3) var(--pt-space-4);
    border-left: 3px solid var(--pt-rocket-flame); background: var(--surface-muted);
    border-radius: var(--pt-radius-sm); font-size: var(--pt-text-sm); white-space: pre-wrap;
}
.desk-intake__actions { display: flex; flex-wrap: wrap; gap: var(--pt-space-2); margin-top: var(--pt-space-3); }
.desk-intake__form { display: flex; flex-direction: column; gap: var(--pt-space-3); align-items: flex-start; }
.desk-intake__form .desk-field { width: 100%; }
.answer-drawer__exchange { margin: var(--pt-space-4) 0; }
.answer-drawer__label { font-size: var(--pt-text-xs); font-weight: var(--pt-weight-strong); color: var(--pt-fg-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--pt-space-1); }
/* Same link manners as the hero's: never underlined, answering in the brand colour. */
.inspector-row .v a { color: var(--pt-fg); text-decoration: none; }
.inspector-row .v a:hover { color: var(--pt-rocket-flame); }

/* Fields panel — a kind="fields" tab's groups laid out full width as a grid. */
.details-panel {
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md); padding: var(--pt-space-6); font-size: var(--pt-text-sm);
    display: grid; gap: var(--pt-space-6); grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 768px) {
    .details-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--pt-space-8); }
}
@media (min-width: 1280px) {
    .details-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* A prose group (recruiting notes) is a paragraph, not a key-facts column: it takes the
   whole row, reads left to right, and keeps the line breaks whoever wrote it typed. */
.details-panel__section--prose { grid-column: 1 / -1; }
/* One prose convention: reading text takes --pt-leading-prose, 14px UI text --pt-leading-sm. */
.details-panel__prose { color: var(--pt-fg); line-height: var(--pt-leading-prose); overflow-wrap: anywhere; }

/* The detail rail — an opted-in family's aside cards standing beside the tabs; the tab
   column keeps ~3/4 of the width, and below the breakpoint the rail follows the tabs.
   The strip keeps its own row so the rail's top lines up with the panel, not the tabs. */
.detail-body { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
/* Stacked, the rail needs the spacing the strip's own margin gives the panel. */
.detail-body > .detail-aside { margin-top: var(--pt-space-6); }
@media (min-width: 1024px) {
    .detail-body { grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr); column-gap: var(--pt-space-6); }
    .detail-body > .detail-tabs { grid-column: 1; grid-row: 1; }
    .detail-body > #detail-panel { grid-column: 1; grid-row: 2; }
    .detail-body > .detail-aside { grid-column: 2; grid-row: 2; margin-top: 0; }
}
.detail-aside { display: flex; flex-direction: column; gap: var(--pt-space-4); }
.side-card {
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md); padding: var(--pt-space-6); font-size: var(--pt-text-sm);
}

/* ===== Forms ===== */
/* No overflow: hidden — a popover field (.fk-picker, .multi-picker) opens past the
   card's edge, and nothing in the card reaches the rounded corners anyway. */
.form-card {
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md);
}
.form-card + .form-card { margin-top: var(--pt-space-4); }
/* The non-field-errors card sits above the first section card, which carries no top margin. */
.form-card--error-summary { margin-bottom: var(--pt-space-4); }
.form-card-head { padding: var(--pt-space-4) var(--pt-space-6); border-bottom: 1px solid var(--pt-border); }
/* .form-card-title takes the shared section-title role — see the grouped rule by .section-title. */
.form-card-sub { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); margin-top: var(--pt-space-1); }
.form-card-intro {
    font-size: var(--pt-text-sm); color: var(--pt-fg-muted); line-height: 1.5;
    margin: 0 0 var(--pt-space-5);
}
/* A self-describing form row: label and live status over the row's fields, a note under them. */
.form-row { padding: var(--pt-space-4) 0; border-top: 1px solid var(--pt-border); }
.form-row:first-of-type { border-top: 0; padding-top: 0; }
.form-row__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--pt-space-3); margin-bottom: var(--pt-space-3); }
.form-row__label { font-size: var(--pt-text-sm); font-weight: var(--pt-weight-strong); color: var(--pt-fg); }
.form-row__note { margin-top: var(--pt-space-2); }
.form-card-body { padding: var(--pt-space-6); }
/* A body whose only child brings its own padding (a table, a nested list). */
.form-card-body--flush { padding: 0; }

/* Form field grid */
.field-grid { display: grid; grid-template-columns: 1fr; gap: var(--pt-space-6); }
@media (min-width: 768px) { .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field-grid .full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: var(--pt-space-2); }
/* Muted, so a column of labels recedes behind the 14px values being typed into. */
.field-label {
    font-size: var(--pt-text-xs); font-weight: var(--pt-weight-strong); color: var(--pt-fg-muted);
    display: flex; align-items: center; gap: var(--pt-space-2);
}
.field-label .req { color: var(--pt-red-alert); }
.field-label [class^="ph-"], .field-label [class*=" ph-"] { color: var(--pt-fg-muted); font-size: var(--pt-text-sm); cursor: help; }
.field-help { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); line-height: 1.4; }
/* Help text standing free of a field (form-level notes) gets its own breathing room. */
.field-help--standalone { margin-top: var(--pt-space-4); }
.field-error { font-size: var(--pt-text-xs); color: var(--pt-red-alert); display: flex; align-items: center; gap: var(--pt-space-1); }

.input, .select, .textarea {
    width: 100%; padding: var(--pt-space-2) var(--pt-space-3); font: inherit; font-size: var(--pt-text-sm); color: var(--pt-fg);
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-sm); outline: none;
    transition: border-color var(--pt-dur-instant);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--pt-fg-muted); }
/* Focus is the shared ring (:focus-visible at the top of this file) and nothing else —
   darkening the border on top of it drew a second line inside the ring's gap and read
   as a double outline. Same rule for every field-ish control below: one indicator, and
   where focus lands on an inner input, the wrapper carries the ring (see .input-affix). */
.input.has-error, .select.has-error, .textarea.has-error { border-color: var(--pt-red-alert); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.5; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23727779' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat; background-position: right 12px center;
    padding-right: 36px; cursor: pointer;
}

.input-affix {
    display: flex; align-items: stretch; border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-sm); background: var(--pt-surface);
    transition: border-color var(--pt-dur-instant);
}
.input-affix:hover { border-color: var(--pt-fg-muted); }
.input-affix.has-error { border-color: var(--pt-red-alert); }
/* The ring goes on the wrapper, not the bare inner input — otherwise it lands inside
   the affix border and boxes the text field within its own prefix/suffix. */
.input-affix:focus-within { box-shadow: var(--pt-focus-ring); }
.input-affix input:focus-visible { box-shadow: none; }
.input-affix__prefix, .input-affix__suffix {
    display: inline-flex; align-items: center; padding: 0 var(--pt-space-3);
    color: var(--pt-fg-muted); font-size: var(--pt-text-sm);
}
.input-affix__prefix { border-right: 1px solid var(--pt-border); }
.input-affix__suffix { border-left: 1px solid var(--pt-border); }
.input-affix input {
    flex: 1; padding: var(--pt-space-2) var(--pt-space-3); font: inherit; font-size: var(--pt-text-sm);
    color: var(--pt-fg); background: transparent; border: 0; outline: none; min-width: 0;
    font-variant-numeric: tabular-nums;
}

/* Native date / datetime inputs. tokens.css sets color-scheme, so the picker panel
   themes itself; these rules only keep the control the same height as .input (which
   it isn't by default) and make the calendar button read as a button. */
.input[type="date"], .input[type="datetime-local"], .input[type="time"] {
    min-height: 38px; font-variant-numeric: tabular-nums;
}
.input[type="date"]::-webkit-calendar-picker-indicator,
.input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer; opacity: 0.5; transition: opacity var(--pt-dur-instant);
}
.input[type="date"]:hover::-webkit-calendar-picker-indicator,
.input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator,
.input[type="time"]:hover::-webkit-calendar-picker-indicator { opacity: 1; }

/* System-written timestamps (approved_at, paid_at, …) — a read-only stamp, not a field. */
.stamp-row {
    display: flex; align-items: baseline; justify-content: space-between; gap: var(--pt-space-4);
    padding: var(--pt-space-3) 0; border-bottom: 1px solid var(--pt-border);
}
.stamp-row:first-child { padding-top: 0; }
.stamp-row:last-child { padding-bottom: 0; border-bottom: 0; }
.stamp-row__label { font-size: var(--pt-text-xs); font-weight: var(--pt-weight-strong); color: var(--pt-fg-muted); }
.stamp-row__value { font-size: var(--pt-text-sm); font-variant-numeric: tabular-nums; text-align: right; }
.stamp-row__by { font-size: var(--pt-text-2xs); color: var(--pt-fg-muted); margin-top: var(--pt-space-1); }

.range-pair { display: flex; align-items: center; gap: var(--pt-space-2); }
.range-pair > * { flex: 1; min-width: 0; }
.range-pair__sep { flex: 0 0 auto; color: var(--pt-fg-muted); font-size: var(--pt-text-sm); }

.radio-group {
    display: inline-flex; padding: 2px; gap: 2px;
    background: var(--surface-muted); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-pill); flex-wrap: wrap;
    /* .field and .field-grid stretch their children; the pill track fits its options instead. */
    width: fit-content; max-width: 100%;
}
.radio-pill { position: relative; cursor: pointer; }
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill__label {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-2) var(--pt-space-4); font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value);
    color: var(--pt-fg-muted); border-radius: var(--pt-radius-pill);
    transition: color var(--pt-dur-instant), background var(--pt-dur-instant);
}
.radio-pill:hover .radio-pill__label { color: var(--pt-fg); }
.radio-pill input:checked + .radio-pill__label { background: var(--pt-fg); color: var(--pt-surface); }

.toggle { position: relative; display: inline-flex; align-items: center; gap: var(--pt-space-3); cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track {
    width: 36px; height: 20px; background: var(--pt-border);
    border-radius: var(--pt-radius-pill); position: relative;
    transition: background var(--pt-dur-instant); flex-shrink: 0;
}
.toggle__track::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px; border-radius: 50%; background: var(--pt-surface);
    transition: transform var(--pt-dur-instant) var(--pt-ease-paper);
}
.toggle input:checked + .toggle__track { background: var(--pt-rocket-flame); }
.toggle input:checked + .toggle__track::after { transform: translateX(16px); }

.chk {
    appearance: none; width: 16px; height: 16px; border: 1.5px solid var(--pt-border);
    border-radius: var(--pt-radius-xs); cursor: pointer; background: var(--pt-surface);
    background-repeat: no-repeat; background-position: center;
    background-size: 12px 12px;
    transition: background var(--pt-dur-instant), border-color var(--pt-dur-instant);
    flex-shrink: 0;
}
.chk:checked {
    background-color: var(--pt-rocket-flame);
    border-color: var(--pt-rocket-flame);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='5 12 10 17 19 8'/></svg>");
}

/* Boolean row: name + explanation on the left, the switch on the right. The right
   shape for a BooleanField that reads as a setting; .chk stays for list selection. */
.toggle-field {
    display: flex; align-items: flex-start; justify-content: space-between; gap: var(--pt-space-4);
    padding: var(--pt-space-3) 0; border-bottom: 1px solid var(--pt-border);
}
.toggle-field:first-child { padding-top: 0; }
.toggle-field:last-child { padding-bottom: 0; border-bottom: 0; }
.toggle-field__main { min-width: 0; }
.toggle-field__title, .toggle-field__sub { display: block; }
.toggle-field__title { font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value); cursor: pointer; }
.toggle-field__sub { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); margin-top: var(--pt-space-1); line-height: 1.4; }

/* FK picker (single FK select with search popover) */
.fk-picker { position: relative; }
.fk-picker__trigger {
    display: flex; align-items: center; gap: var(--pt-space-3);
    width: 100%; padding: var(--pt-space-2) 36px var(--pt-space-2) var(--pt-space-3); font: inherit; font-size: var(--pt-text-sm);
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-sm); cursor: pointer; text-align: left;
    transition: border-color var(--pt-dur-instant);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23727779' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat; background-position: right 12px center;
}
.fk-picker__trigger:hover { border-color: var(--pt-fg-muted); }
.fk-picker__current { display: flex; align-items: center; gap: var(--pt-space-3); flex: 1; min-width: 0; }
.fk-picker__avatar {
    width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: var(--pt-weight-strong); font-size: var(--pt-text-2xs);
}
.fk-picker__avatar--square { border-radius: var(--pt-radius-xs); }
/* The trigger and each option are <button>s, so their text wrappers have to be
   spans — these stack the title over the sub the way the layout assumes. */
.fk-picker__text, .fk-option__main { min-width: 0; }
.fk-picker__title, .fk-picker__sub, .fk-option__title, .fk-option__sub { display: block; }
.fk-picker__title, .fk-picker__sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fk-picker__title { font-weight: var(--pt-weight-value); line-height: 1.2; }
.fk-picker__sub { font-size: var(--pt-text-2xs); color: var(--pt-fg-muted); line-height: 1.2; font-variant-numeric: tabular-nums; }
.fk-picker__empty { color: var(--pt-fg-muted); }

.fk-popover {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-sm); padding: var(--pt-space-1);
    max-height: 320px; overflow-y: auto;
}
.fk-popover__search { position: relative; margin-bottom: var(--pt-space-1); }
.fk-popover__search input {
    width: 100%; padding: var(--pt-space-2) var(--pt-space-3) var(--pt-space-2) var(--pt-space-8); font: inherit; font-size: var(--pt-text-sm);
    background: var(--surface-muted); border: 1px solid transparent; border-radius: var(--pt-radius-sm);
    outline: none; color: var(--pt-fg);
    transition: border-color var(--pt-dur-instant), background var(--pt-dur-instant);
}
.fk-popover__search input:focus { background: var(--pt-bg); }
.fk-popover__search [class^="ph-"],
.fk-popover__search [class*=" ph-"] { position: absolute; left: 12px; top: 8px; color: var(--pt-fg-muted); font-size: var(--pt-text-sm); }

.fk-option {
    display: flex; align-items: center; gap: var(--pt-space-3);
    padding: var(--pt-space-2) var(--pt-space-3); border-radius: var(--pt-radius-sm); cursor: pointer;
    width: 100%; text-align: left; border: 0; background: transparent; font: inherit;
}
.fk-option:hover, .fk-option.is-active { background: var(--surface-muted); }
.fk-option__main { flex: 1; min-width: 0; }
.fk-option__title { font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value); line-height: 1.2; }
.fk-option__sub { font-size: var(--pt-text-2xs); color: var(--pt-fg-muted); line-height: 1.2; margin-top: var(--pt-space-1); font-variant-numeric: tabular-nums; }
.fk-option__check { color: var(--pt-rocket-flame); }
.fk-option__none {
    padding: var(--pt-space-2) var(--pt-space-3); font-size: var(--pt-text-sm); color: var(--pt-fg-muted);
    text-align: left; cursor: pointer; border-radius: var(--pt-radius-sm);
    background: transparent; border: 0; width: 100%; font: inherit;
}
.fk-option__none:hover { background: var(--surface-muted); }
/* The "no matches" line is a message, not a choice. */
.fk-option__none--empty { cursor: default; }
.fk-option__none--empty:hover { background: transparent; }

/* Multi-FK / tag picker (chips inside an input field) */
.multi-picker { position: relative; }
.multi-picker__field {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--pt-space-1);
    width: 100%; min-height: 40px; padding: var(--pt-space-1) var(--pt-space-2);
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-sm); cursor: text;
    transition: border-color var(--pt-dur-instant);
}
.multi-picker__field:hover { border-color: var(--pt-fg-muted); }
/* Ring on the chip field, not the bare inner input (same reason as .input-affix). */
.multi-picker__field.is-focused { box-shadow: var(--pt-focus-ring); }
.multi-picker__input:focus-visible { box-shadow: none; }
.multi-picker__chip {
    display: inline-flex; align-items: center; gap: var(--pt-space-1);
    padding: var(--pt-space-1) var(--pt-space-1) var(--pt-space-1) var(--pt-space-3); background: var(--surface-muted);
    border-radius: var(--pt-radius-pill); font-size: var(--pt-text-xs); font-weight: var(--pt-weight-value);
}
.multi-picker__chip__remove {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    color: var(--pt-fg-muted); border: 0; background: transparent; cursor: pointer;
    transition: transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.multi-picker__chip__remove:hover { background: var(--pt-border); color: var(--pt-fg); }
.multi-picker__input {
    flex: 1; min-width: 80px; padding: var(--pt-space-1); border: 0; outline: none;
    font: inherit; font-size: var(--pt-text-sm); background: transparent; color: var(--pt-fg);
}

/* File drop area */
.file-drop {
    position: relative;
    display: flex; align-items: center; gap: var(--pt-space-4);
    padding: var(--pt-space-4); border: 1px dashed var(--pt-border);
    border-radius: var(--pt-radius-sm); cursor: pointer;
    transition: border-color var(--pt-dur-instant), background var(--pt-dur-instant);
}
.file-drop:hover { border-color: var(--pt-fg); background: var(--surface-muted); }
/* The real input stays in the label so a click still opens the picker, but the
   native "Choose File" button must not lay out — it squeezed the drop zone flat. */
.file-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-drop__title, .file-drop__sub { display: block; }
.file-drop__icon {
    width: 40px; height: 40px; border-radius: var(--pt-radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--pt-atmosphere-blue-20); color: var(--pt-ink-on-blue-20);
    flex-shrink: 0; font-size: var(--pt-text-lg);
}
.file-drop__main { flex: 1; min-width: 0; }
.file-drop__title { font-size: var(--pt-text-sm); font-weight: var(--pt-weight-strong); }
.file-drop__sub { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); margin-top: var(--pt-space-1); }

/* Markdown editor toolbar */
.rt-toolbar {
    display: flex; align-items: center; gap: var(--pt-space-1);
    padding: var(--pt-space-2); border: 1px solid var(--pt-border); border-bottom: 0;
    border-radius: var(--pt-radius-sm) var(--pt-radius-sm) 0 0;
    background: var(--surface-muted);
}
.rt-toolbar + .textarea { border-radius: 0 0 var(--pt-radius-sm) var(--pt-radius-sm); }
.rt-btn {
    width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    color: var(--pt-fg-muted); background: transparent; border: 0;
    border-radius: var(--pt-radius-pill); cursor: pointer; font-size: var(--pt-text-sm);
    transition: transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.rt-btn:hover { background: var(--pt-border); color: var(--pt-fg); }
.rt-sep { width: 1px; height: 16px; background: var(--pt-border); margin: 0 var(--pt-space-1); }

/* Sticky save bar */
.save-bar {
    position: fixed; left: var(--sidebar-w); right: 0; bottom: 0; z-index: 50;
    /* Shares --bottom-bar-h with the sidebar footer so the two align exactly. */
    height: var(--bottom-bar-h); box-sizing: border-box;
    display: flex; align-items: center; justify-content: space-between; gap: var(--pt-space-4);
    padding: 0 var(--pt-space-6); background: var(--pt-surface); border-top: 1px solid var(--pt-border);
    /* Matches the sidebar's collapse timing (see .sidebar). */
    transition: left var(--pt-dur-fast) var(--pt-ease-paper);
}
@media (min-width: 1600px) { .save-bar { padding: 0 var(--pt-space-8); } }
.save-bar__status { display: inline-flex; align-items: center; gap: var(--pt-space-2); font-size: var(--pt-text-sm); color: var(--pt-fg-muted); }
.save-bar__dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--pt-solar-gold);
    transition: background var(--pt-dur-base) var(--pt-ease-paper);
}
.save-bar__dot.saved { background: var(--pt-galactic-seafoam); }
.save-bar__actions { display: flex; gap: var(--pt-space-2); }

/* List view: requirement / team list editor rows (used in role edit) */
.req-editor-row { display: flex; align-items: center; gap: var(--pt-space-3); padding: var(--pt-space-2) 0; }
/* Entrance for rows added via the editor's Add button only — listEditor flags them
   `fresh`, so seeded rows don't animate when Alpine renders them on page load. */
.req-editor-row--new {
    transition: opacity var(--pt-dur-fast) var(--pt-ease-paper),
                transform var(--pt-dur-fast) var(--pt-ease-paper);
}
@starting-style {
    .req-editor-row--new { opacity: 0; transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
    /* Keep the fade, drop the lift. */
    .req-editor-row--new { transition-property: opacity; }
    @starting-style {
        .req-editor-row--new { transform: none; }
    }
}
.req-editor-row .input { flex: 1; }
/* Full-page edit: constrain the stacked form cards to a comfortable reading width. */
.form-stack { max-width: 880px; }

/* ===== List view toolbar pieces ===== */
/* .page-headline takes the shared page-title role — see the grouped rule by .hero-name. */
.page-subtitle { color: var(--pt-fg-muted); font-size: var(--pt-text-sm); margin-top: var(--pt-space-2); }

/* Plain page heading block: headline (+ optional subtitle) over the content. */
.page-head { display: flex; flex-direction: column; gap: var(--pt-space-1); margin-bottom: var(--pt-space-6); }
/* List-view header: heading block and action bar stack, then share a row on wide screens. */
.page-header { display: flex; flex-direction: column; gap: var(--pt-space-4); margin-bottom: var(--pt-space-6); }
@media (min-width: 1280px) {
    .page-header { flex-direction: row; align-items: flex-end; justify-content: space-between; }
}

/* The #table-controls form: search box, filter chips and friends wrap as one row. */
.table-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pt-space-2); margin-bottom: var(--pt-space-4); }

/* Caps label role — every uppercase micro-label in the app, in one place. */
/* Individual rules below keep only their own box: margins, padding, display, deliberate colour. */
.nav-section__label,
.hero-meta__k,
.rel-table th,
.data-table thead th,
.inspector-label,
.board-summary__label,
.board-col__title,
.chip-edit-panel__header,
.eyebrow,
.col-item__type,
.section-label,
.palette-group-label,
.peek__fact dt,
.peek__section-title,
.history-cols span,
.history-group,
.desk-fields__group,
.tpl-scope,
.tpl-label {
    font-size: var(--pt-text-2xs); line-height: var(--pt-leading-2xs);
    font-weight: var(--pt-weight-strong); text-transform: uppercase;
    letter-spacing: var(--pt-track-caps); color: var(--pt-fg-muted);
}

.search-input {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-2) var(--pt-space-4); background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-pill); min-width: 280px;
    transition: border-color var(--pt-dur-instant);
}
.search-input:focus-within { border-color: var(--pt-fg); }
.search-input input {
    flex: 1; background: transparent; border: 0; outline: none;
    font: inherit; font-size: var(--pt-text-sm); color: var(--pt-fg); min-width: 0;
}
/* The pill shows focus via :focus-within border; suppress the global focus ring
   so there's no inner rounded-rect highlight inside the pill. */
.search-input input:focus-visible { box-shadow: none; }
.search-input [class^="ph-"], .search-input [class*=" ph-"] { color: var(--pt-fg-muted); font-size: var(--pt-text-md); }

.filter-chip-wrap { position: relative; }
.filter-chip {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-1) var(--pt-space-1) var(--pt-space-1) var(--pt-space-3); font-size: var(--pt-text-xs); font-weight: var(--pt-weight-value);
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-pill); color: var(--pt-fg);
    cursor: pointer;
    transition: border-color var(--pt-dur-instant);
}
.filter-chip:hover { border-color: var(--pt-fg); }
.filter-chip .chip-op { color: var(--pt-fg-muted); font-weight: var(--pt-weight-regular); }
.filter-chip .chip-val { font-weight: var(--pt-weight-strong); }
.filter-chip .chip-x {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    color: var(--pt-fg-muted); border: 0; background: transparent; cursor: pointer;
    transition: transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.filter-chip .chip-x:hover { background: var(--surface-muted); color: var(--pt-fg); }

/* Filter chip edit popover (click a chip to refine it) */
.filter-chip .chip-body {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    background: transparent; border: 0; font: inherit;
    font-size: var(--pt-text-xs); font-weight: var(--pt-weight-value); cursor: pointer; color: inherit; padding: 0;
}
.chip-edit-panel {
    position: absolute; left: 0; top: calc(100% + 8px); z-index: 60;
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md); padding: var(--pt-space-1); min-width: 210px;
    transform-origin: top left; /* anchored under the chip's left edge */
}
.chip-edit-panel--wide { min-width: 240px; }
.chip-edit-panel__header { padding: var(--pt-space-2) var(--pt-space-3) var(--pt-space-1); }
.chip-edit-option {
    display: flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-2) var(--pt-space-3); border-radius: var(--pt-radius-sm); cursor: pointer; font-size: var(--pt-text-sm);
}
.chip-edit-option:hover { background: var(--surface-muted); }
.chip-edit-panel__footer {
    display: flex; justify-content: flex-end; gap: var(--pt-space-2);
    padding: var(--pt-space-2); border-top: 1px solid var(--pt-border); margin-top: var(--pt-space-1);
}
/* The pencil that says the chip is editable — the smallest thing on screen, so it
   sits at the bottom of the type scale rather than below it. */
.chip-edit-hint { font-size: var(--pt-text-2xs) !important; color: var(--pt-fg-muted); }
.chip-range {
    display: flex; align-items: center; gap: var(--pt-space-3);
    padding: var(--pt-space-2) var(--pt-space-3) var(--pt-space-1);
}
.chip-range__input { flex: 1; min-width: 0; height: var(--pt-space-1); accent-color: var(--pt-rocket-flame); }
.chip-range__value {
    flex: none; min-width: 40px; text-align: right;
    font-size: var(--pt-text-sm); font-weight: var(--pt-weight-strong); font-variant-numeric: tabular-nums;
}

.filter-add {
    display: inline-flex; align-items: center; gap: var(--pt-space-1);
    padding: var(--pt-space-2) var(--pt-space-3); font-size: var(--pt-text-xs); font-weight: var(--pt-weight-value);
    color: var(--pt-fg-muted); background: transparent;
    border: 1px dashed var(--pt-border); border-radius: var(--pt-radius-pill); cursor: pointer;
    transition: border-color var(--pt-dur-instant), color var(--pt-dur-instant), transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.filter-add:hover { border-style: solid; border-color: var(--pt-fg); color: var(--pt-fg); }

/* The chip row: shown chips plus the Add filter button, wrapping as one group so a
   table carrying a dozen filters still reads as a single line of controls. */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pt-space-2); min-width: 0; }
.filter-add-wrap { position: relative; }
.filter-add-menu { min-width: 200px; }
/* A picker of more than a handful of options scrolls rather than running off screen. */
.chip-edit-options { max-height: 280px; overflow-y: auto; }
.chip-edit-search {
    display: flex; align-items: center; gap: var(--pt-space-2);
    margin: 0 var(--pt-space-2) var(--pt-space-1); padding: var(--pt-space-1) var(--pt-space-2);
    border: 1px solid var(--pt-border); border-radius: var(--pt-radius-sm);
}
.chip-edit-search input {
    flex: 1; min-width: 0; border: 0; background: transparent; font: inherit;
    font-size: var(--pt-text-sm); color: var(--pt-fg); outline: none;
}
.chip-edit-search [class^="ph-"] { color: var(--pt-fg-muted); font-size: var(--pt-text-sm); }
.chip-edit-option__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* How many rows an option would keep — the figure reads beside the name, never instead of it. */
.chip-edit-option__count {
    flex: none; font-size: var(--pt-text-2xs); font-variant-numeric: tabular-nums; color: var(--pt-fg-muted);
}
/* The menu's own option buttons carry no chrome — they read as the labels they are. */
button.chip-edit-option {
    width: 100%; text-align: left; border: 0; background: transparent; font: inherit;
    font-size: var(--pt-text-sm); color: var(--pt-fg);
}
.chip-edit-empty {
    margin: 0; padding: var(--pt-space-2) var(--pt-space-3);
    font-size: var(--pt-text-sm); color: var(--pt-fg-muted);
}

/* An embedded table's own create button rides the toolbar row, pushed to its end. */
.toolbar-add { margin-left: auto; }

/* Pagination */
.pager {
    display: flex; align-items: center; justify-content: space-between;
    /* min-height, not padding: the pager's contents change with state (controls only
       appear past page one, the bulk bar swaps in on selection) and padding made the
       band swing between 43 and 57px. One height holds through all three. */
    min-height: var(--table-band-h); padding: 0 var(--pt-space-4);
    border-top: 1px solid var(--pt-border); background: var(--pt-surface);
    /* Rides the bottom of the viewport while the table is in view, so paging and the
       bulk bar are reachable without scrolling to the end of a long list. Settles at
       the table's real end once the card's bottom comes up. */
    position: sticky; bottom: 0; z-index: 1;
    border-radius: 0 0 var(--pt-radius-md) var(--pt-radius-md);
}
.pager-info { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); }
.pager-info strong { color: var(--pt-fg); font-weight: var(--pt-weight-strong); }
.pager-controls { display: flex; align-items: center; gap: var(--pt-space-1); }
.pager-btn {
    min-width: 32px; height: 32px; padding: 0 var(--pt-space-3);
    display: inline-flex; align-items: center; justify-content: center; gap: var(--pt-space-1);
    font-size: var(--pt-text-xs); font-weight: var(--pt-weight-value); color: var(--pt-fg); background: var(--pt-surface);
    border: 1px solid var(--pt-border); border-radius: var(--pt-radius-pill); cursor: pointer;
    transition: border-color var(--pt-dur-instant), transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.pager-btn { text-decoration: none; }
.pager-btn:hover { border-color: var(--pt-fg); }
.pager-btn.is-current { background: var(--pt-fg); color: var(--pt-surface); border-color: var(--pt-fg); }
.pager-btn.is-disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* Entrance only — @starting-style fires on the display:none -> flex flip when the
   first row is selected. Opacity alone (no travel): this swaps in tens of times a
   day, so it must stay near-imperceptible. Deselection snaps deliberately. */
.bulk-bar {
    display: flex; align-items: center; gap: var(--pt-space-4);
    transition: opacity var(--pt-dur-fast) var(--pt-ease-paper);
}
@starting-style {
    .bulk-bar { opacity: 0; }
}
.bulk-action {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    font-size: var(--pt-text-sm); font-weight: var(--pt-weight-strong); color: var(--pt-fg); cursor: pointer;
    background: transparent; border: 0; padding: 0;
}
.bulk-action:hover { color: var(--pt-rocket-flame); }
.bulk-action.danger:hover { color: var(--pt-red-alert); }
/* "Clear" undoes the selection rather than acting on it — quieter than its siblings. */
.bulk-action--quiet { color: var(--pt-fg-muted); }

/* ===== Drawer (list view column picker) ===== */
/* Both halves rest in their CLOSED state and flip on .is-open (bound in
   _column_picker.html), rather than being mounted and class-swapped by an Alpine
   x-transition. Two things come out of that: the panel is laid out and painted once
   at page load, so opening is pure compositing with no first-frame hitch; and a
   plain CSS transition is interruptible, so toggling mid-travel reverses from wherever
   the panel is instead of snapping to the end state and starting over.
   The scrim fades on the same curve/duration as the panel so the dimming doesn't land
   before the thing it's dimming for. Exit uses ease-out (never ease-in — it would stall
   on the frame the user is watching) and is quicker than the entrance: the closed rules
   carry the exit duration, the .is-open rules override it with the slower entrance. */
.drawer-backdrop {
    position: fixed; inset: 0; background: var(--pt-scrim); z-index: 200;
    opacity: 0; pointer-events: none;
    transition: opacity var(--pt-dur-fast) var(--pt-ease-drawer);
}
.drawer-backdrop.is-open {
    opacity: 1; pointer-events: auto;
    transition-duration: var(--pt-dur-base);
}
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: 380px; z-index: 201;
    background: var(--pt-surface); border-left: 1px solid var(--pt-border);
    display: flex; flex-direction: column;
    /* visibility (not display) keeps the closed panel out of the tab order without
       costing a layout pass on open; it flips at the end of the exit so it can't
       blank the panel mid-slide. */
    transform: translateX(100%); visibility: hidden;
    transition: transform var(--pt-dur-fast) var(--pt-ease-drawer),
                visibility var(--pt-dur-fast);
}
.drawer.is-open {
    transform: none; visibility: visible;
    transition-duration: var(--pt-dur-base);
}
.drawer-header {
    padding: var(--pt-space-4) var(--pt-space-6); border-bottom: 1px solid var(--pt-border);
    display: flex; align-items: center; justify-content: space-between;
}
.drawer-title { font-size: var(--pt-text-md); font-weight: var(--pt-weight-strong); }
.drawer-sub { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); margin-top: var(--pt-space-1); }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--pt-space-4); }
.drawer-footer {
    padding: var(--pt-space-4) var(--pt-space-6); border-top: 1px solid var(--pt-border);
    display: flex; justify-content: space-between; gap: var(--pt-space-2); align-items: center;
}
/* Same construction as .sidebar-search and .fk-popover__search: the field carries
   left padding, the magnifier is absolutely placed into it. */
.col-search-wrap { position: relative; margin-bottom: var(--pt-space-2); }
.col-search-wrap [class^="ph-"], .col-search-wrap [class*=" ph-"] {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--pt-fg-muted); font-size: var(--pt-text-sm); pointer-events: none;
}
.col-search {
    width: 100%; padding: var(--pt-space-2) var(--pt-space-3) var(--pt-space-2) 36px;
    background: var(--surface-muted); border: 1px solid transparent;
    border-radius: var(--pt-radius-pill); font: inherit; font-size: var(--pt-text-sm);
    color: var(--pt-fg); outline: none;
}
.col-search:focus { background: var(--pt-surface); }
.col-item {
    display: flex; align-items: center; gap: var(--pt-space-3);
    padding: var(--pt-space-2) var(--pt-space-3); border-radius: var(--pt-radius-sm);
    transition: background var(--pt-dur-instant);
}
.col-item:hover { background: var(--surface-muted); }
.col-item.is-dragging { opacity: 0.4; }
.col-item.is-drop-target { background: var(--pt-rocket-flame-20); }
.col-item.is-hidden { opacity: 0.6; }
.col-item__handle { color: var(--pt-fg-muted); font-size: var(--pt-text-md); cursor: grab; }
.col-item__handle:active { cursor: grabbing; }
.col-item__label { flex: 1; font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value); }
.section-label { margin: var(--pt-space-4) 0 var(--pt-space-1); padding: 0 var(--pt-space-3); }
.section-label:first-child { margin-top: var(--pt-space-1); }

/* ===== Cost drawer (slide-over cost creator) ===== */
/* Rides the generic .drawer shell above; the swapped content states own their
   layout — a full-height pane with a scrolling middle and a pinned footer. */
.cost-drawer { width: 420px; max-width: 100vw; }
.cost-drawer__content { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cost-drawer__pane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cost-drawer__scroll {
    flex: 1; overflow-y: auto; padding: var(--pt-space-4) var(--pt-space-6);
    display: flex; flex-direction: column; gap: var(--pt-space-4); align-items: stretch;
}
.cost-drawer__footer {
    padding: var(--pt-space-4) var(--pt-space-6); border-top: 1px solid var(--pt-border);
    display: flex; align-items: center; gap: var(--pt-space-2);
}
.cost-drawer__nested { margin-left: calc(16px + var(--pt-space-2)); }

/* ===== Form drawer (the base's create/edit slide-over) ===== */
/* Rides the generic .drawer shell plus .drawer-body / .drawer-footer; the flex chain
   below is what lets the swapped-in <form> own both of those. */
.form-drawer { width: 480px; max-width: 100vw; }
.form-drawer__content,
.form-drawer__form { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.form-drawer__section { display: flex; flex-direction: column; gap: var(--pt-space-4); }
.form-drawer__section + .form-drawer__section { margin-top: var(--pt-space-6); }

/* ===== Peek drawer (the base's read-only related-record slide-over) ===== */
/* Rides the same shell and flex chain as the form content, wider because it carries a
   figure strip and tables instead of one column of fields. */
.form-drawer:has(.peek-drawer) { width: 560px; }
.peek-drawer { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.peek-drawer .drawer-body { display: flex; flex-direction: column; gap: var(--pt-space-4); }
.peek-drawer__head { display: flex; align-items: center; justify-content: space-between; gap: var(--pt-space-3); }
.peek-drawer__sub { font-size: var(--pt-text-sm); color: var(--pt-fg-muted); }
/* Operator actions on the chrome: a wrapping row of quiet buttons; each confirms in its own modal. */
.peek-drawer__actions { display: flex; flex-wrap: wrap; gap: var(--pt-space-2); }
/* Tiles read two by two here — the page strip's single row would squeeze four of them. */
.peek-drawer .fin-summary { padding: var(--pt-space-4); }
.peek-drawer .fin-summary__figures {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pt-space-4);
}
.peek-drawer .fin-summary__cell { padding: 0; }
.peek-drawer .fin-summary__figures .fin-summary__cell + .fin-summary__cell { border-left: 0; }
/* Compact context: a 560px aside is no hero, so its figures step down off the stat role. */
.peek-drawer .fin-summary__value {
    font-family: var(--pt-font-body); font-weight: var(--pt-weight-bold);
    font-size: var(--pt-text-lg); line-height: var(--pt-leading-lg);
}
.peek-drawer .section-head, .peek-drawer .section-body { padding: var(--pt-space-3) var(--pt-space-4); }
/* Compact context: heads on cards inside a drawer take the card-title role, not the section title. */
.peek-drawer .section-title { font-size: var(--pt-text-md); line-height: var(--pt-leading-md); }
.peek-drawer .rel-table th, .peek-drawer .rel-table td { padding: var(--pt-space-2) var(--pt-space-4); }
/* The body's own gap spaces the cards, so the stacked rule would double it. */
.peek-drawer .section-card + .section-card { margin-top: 0; }

.drawer-hint { font-size: var(--pt-text-sm); color: var(--pt-fg-muted); }
/* Pushed to the far end of the drawer footer, away from the primary. */
.drawer-add-another { margin-left: auto; }
.drawer-back {
    align-self: flex-start; display: inline-flex; align-items: center; gap: var(--pt-space-1);
    background: none; border: 0; padding: 0; font: inherit;
    font-size: var(--pt-text-xs); font-weight: var(--pt-weight-strong); color: var(--pt-fg-muted); cursor: pointer;
}
.drawer-back:hover { color: var(--pt-fg); }
.drawer-note {
    display: flex; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-3) var(--pt-space-4); border-radius: var(--pt-radius-sm);
    font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value);
}
.drawer-note--success { background: var(--pt-galactic-seafoam-20); color: var(--pt-ink-on-seafoam-20); }

.cost-cat-list { display: flex; flex-direction: column; gap: var(--pt-space-2); }
.cost-cat {
    display: flex; align-items: center; gap: var(--pt-space-3); width: 100%; text-align: left;
    padding: var(--pt-space-3) var(--pt-space-4); font: inherit; color: var(--pt-fg);
    background: var(--pt-surface); border: 1px solid var(--pt-border); border-radius: var(--pt-radius-md);
    cursor: pointer; transition: border-color var(--pt-dur-instant);
}
.cost-cat:hover { border-color: var(--pt-rocket-flame); }
.cost-cat__icon {
    flex: 0 0 auto; width: 32px; height: 32px; border-radius: var(--pt-radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--pt-rocket-flame-20); color: var(--pt-ink-on-flame-20);
    font-size: var(--pt-text-lg);
}
.cost-cat__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cost-cat__label { font-size: var(--pt-text-sm); font-weight: var(--pt-weight-strong); }
.cost-cat__desc { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); }
.cost-cat__caret { color: var(--pt-fg-muted); transition: color var(--pt-dur-instant), transform var(--pt-dur-instant); }
.cost-cat:hover .cost-cat__caret { color: var(--pt-rocket-flame); transform: translateX(2px); }

.check-row {
    display: flex; align-items: center; gap: var(--pt-space-2);
    font-size: var(--pt-text-sm); cursor: pointer;
}
.choice-card {
    display: flex; align-items: flex-start; gap: var(--pt-space-2);
    padding: var(--pt-space-3); border: 1px solid var(--pt-border); border-radius: var(--pt-radius-sm);
    cursor: pointer; transition: border-color var(--pt-dur-instant), background var(--pt-dur-instant);
}
.choice-card:has(input:checked) { border-color: var(--pt-rocket-flame); background: var(--pt-rocket-flame-20); }
.choice-card__text { display: flex; flex-direction: column; gap: 2px; }
.choice-card__label { font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value); }
.choice-card__desc { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); }

/* A just-created row announces itself, then settles. */
tr.row-flash > td { animation: row-flash 1.2s var(--pt-ease-paper); }
@keyframes row-flash {
    0%, 40% { background: var(--pt-rocket-flame-20); }
    100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
    tr.row-flash > td { animation: none; }
    .cost-cat:hover .cost-cat__caret { transform: none; }
}

/* ===== Toast ===== */
.toast-stack {
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 300;
    display: flex; flex-direction: column;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none; /* let clicks through the gaps; each toast re-enables */
}
/* Each toast sits in a cell that collapses as the toast leaves, so its neighbours
   slide up instead of teleporting when the node is removed. The travel is an inline
   pixel height set by dismissToast, since height:auto isn't interpolatable. The 10px
   spacing lives here rather than as
   the stack's gap so it collapses on the same transition. overflow:hidden is scoped
   to the leaving state so the cell never clips a toast at rest. */
.toast-cell {
    margin-bottom: var(--pt-space-2);
    transition: height var(--pt-dur-fast) var(--pt-ease-paper),
                margin-bottom var(--pt-dur-fast) var(--pt-ease-paper);
}
.toast-cell--leaving { margin-bottom: 0; overflow: hidden; }
.toast {
    pointer-events: auto;
    display: flex; align-items: flex-start; gap: var(--pt-space-3);
    padding: var(--pt-space-3) var(--pt-space-4);
    background: var(--pt-surface); color: var(--pt-fg);
    border: 1px solid var(--pt-border);
    /* Card-tier accent, shared with .board-col__head; rows use 2px. 4px is --pt-space-1
       and half of --pt-radius-sm, so the inner radius equals the border width and the
       corner miter resolves without a lopsided wedge. */
    border-left: 4px solid var(--pt-fg-muted);
    border-radius: var(--pt-radius-sm);
    font-size: var(--pt-text-sm); line-height: 1.4;
}
/* Transitions (not keyframes) so a toast dismissed mid-entry retargets from wherever
   it is instead of restarting from zero — toasts stack and get dismissed rapidly. */
.toast {
    opacity: 1; transform: translateY(0);
    transition: opacity var(--pt-dur-base) var(--pt-ease-paper),
                transform var(--pt-dur-base) var(--pt-ease-paper);
}
@starting-style {
    .toast { opacity: 0; transform: translateY(-8px); }
}
.toast--leaving {
    opacity: 0; transform: translateY(-8px);
    transition-duration: var(--pt-dur-fast);
}
@media (prefers-reduced-motion: reduce) {
    /* Keep the opacity fade (it explains that a toast arrived/left), drop the travel. */
    .toast { transform: none; }
    @starting-style {
        .toast { transform: none; }
    }
    .toast--leaving { transform: none; }
}
.toast__icon { flex-shrink: 0; margin-top: 1px; font-size: var(--pt-text-lg); color: var(--pt-fg-muted); }
.toast__body { flex: 1; min-width: 0; }
.toast__title { font-weight: var(--pt-weight-strong); margin-bottom: 2px; }
.toast__msg { font-weight: var(--pt-weight-value); word-break: break-word; }
/* Inherits --pt-fg rather than muting: on a 20% tint the muted grey falls to 3.4-4.0:1,
   under the 4.5 body-text floor. Weight alone carries the title/message hierarchy. */
.toast__title + .toast__msg { font-weight: var(--pt-weight-regular); }
/* Inline action (e.g. Undo) — the primitive that lets reversible bulk actions
   skip the confirm dialog. */
.toast__action {
    flex-shrink: 0; align-self: center;
    padding: var(--pt-space-1) var(--pt-space-2);
    font-family: inherit; font-size: var(--pt-text-xs); font-weight: var(--pt-weight-strong); line-height: 1;
    background: none; border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-sm); color: var(--pt-fg); cursor: pointer;
    transition: transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.toast__action:hover { background: var(--pt-hover-veil); }
.toast__close {
    flex-shrink: 0; padding: 2px; margin: -2px -2px 0 0;
    background: none; border: 0; cursor: pointer; line-height: 1;
    font-size: var(--pt-text-sm); color: var(--pt-fg-muted); border-radius: var(--pt-radius-xs);
    transition: transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.toast__close:hover { color: var(--pt-fg); background: var(--pt-hover-veil); }

/* Type accents — a 20% tint surface (the brand's way to give a background character)
   framed by the level's color on all four sides, the left edge heavier.
   The icon takes ink-on-*-20, NOT the brand color: the same hue on its own 20% tint
   is 1.6-3.2:1 in light mode, under the 3.0 non-text floor. Those tokens remap to the
   full brand color in dark, where the tint composites down and bright is correct. */
/* color-mix, not the --*-20 tokens: those are rgba at 0.2 alpha, and a toast floats
   over scrolling content — table rows read straight through them. Mixing 20% into
   --pt-surface gives the same tint as an opaque color, and follows the theme. */
.toast--success { border-color: var(--pt-galactic-seafoam); background: color-mix(in srgb, var(--pt-galactic-seafoam) 20%, var(--pt-surface)); }
.toast--success .toast__icon { color: var(--pt-ink-on-seafoam-20); }
.toast--error   { border-color: var(--pt-red-alert); background: color-mix(in srgb, var(--pt-red-alert) 20%, var(--pt-surface)); }
.toast--error   .toast__icon { color: var(--pt-ink-on-red-20); }
.toast--warning { border-color: var(--pt-solar-gold); background: color-mix(in srgb, var(--pt-solar-gold) 20%, var(--pt-surface)); }
.toast--warning .toast__icon { color: var(--pt-ink-on-gold-20); }
.toast--info    { border-color: var(--pt-atmosphere-blue); background: color-mix(in srgb, var(--pt-atmosphere-blue) 20%, var(--pt-surface)); }
.toast--info    .toast__icon { color: var(--pt-ink-on-blue-20); }

/* ===== Modal / confirmation dialog ===== */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 400;
    display: flex; align-items: center; justify-content: center; padding: var(--pt-space-6);
    background: var(--pt-scrim);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 1;
    transition: opacity var(--pt-dur-base) var(--pt-ease-paper);
}
@starting-style {
    .modal-backdrop { opacity: 0; }
}
.modal {
    width: min(440px, 100%); max-height: calc(100vh - 48px); overflow-y: auto;
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md);
    outline: none;
    opacity: 1; transform: none;
    transition: transform var(--pt-dur-base) var(--pt-ease-paper),
                opacity var(--pt-dur-base) var(--pt-ease-paper);
}
@starting-style {
    .modal { opacity: 0; transform: translateY(8px) scale(0.97); }
}
/* Built at runtime as "modal--" + opts.size (refresh.js), so it reads as unused
   to a plain grep. The peek, the keyboard-help sheet, and every [data-dialog]
   default to lg. */
.modal--lg { width: min(640px, 100%); }
.modal--xl { width: min(1040px, 100%); }
/* A rendered document (an email as the relay sends it) in its own sandboxed frame. */
.confirm-frame {
    display: block; width: 100%; height: min(72vh, 900px); margin-top: var(--pt-space-3);
    border: 1px solid var(--pt-border); border-radius: var(--pt-radius-md); background: #F7F3F2;
}
.confirm-details { margin-top: var(--pt-space-3); }
.confirm-details > summary { cursor: pointer; font-size: var(--pt-text-sm); color: var(--pt-fg-muted); }
.modal-header { display: flex; align-items: flex-start; gap: var(--pt-space-4); padding: var(--pt-space-6) var(--pt-space-6) 0; }
.modal-icon {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: var(--pt-radius-pill);
    display: flex; align-items: center; justify-content: center; font-size: var(--pt-text-lg);
    background: var(--pt-atmosphere-blue-20); color: var(--pt-ink-on-blue-20);
}
.modal-icon--danger  { background: var(--pt-red-alert-20);       color: var(--pt-ink-on-red-20); }
.modal-icon--warning { background: var(--pt-solar-gold-20);      color: var(--pt-ink-on-gold-20); }
.modal-icon--success { background: var(--pt-galactic-seafoam-20); color: var(--pt-ink-on-seafoam-20); }
.modal-title { font-size: var(--pt-text-md); font-weight: var(--pt-weight-strong); line-height: 1.3; padding-top: var(--pt-space-2); }
.modal-header + .modal-body { padding-top: var(--pt-space-2); }
.modal-body { padding: var(--pt-space-6) var(--pt-space-6) 0; }
.modal-header .modal-icon + .modal-title { /* aligns title beside the icon badge */ }
.modal-message { font-size: var(--pt-text-sm); line-height: var(--pt-leading-sm); color: var(--pt-fg-muted); }
/* promptModal's text field; the message (when present) sits directly above. */
.prompt-input {
    width: 100%; margin-top: var(--pt-space-3);
    padding: var(--pt-space-2) var(--pt-space-3);
    font: inherit; font-size: var(--pt-text-sm); color: var(--pt-fg);
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-sm);
}
/* A fragment-backed confirm body that stacks fields and messages on one rhythm. */
.confirm-stack { display: flex; flex-direction: column; gap: var(--pt-space-4); }
/* In a confirm body the popover flows in place — .modal scrolls, so an absolute overlay would clip. */
.confirm-stack .fk-popover { position: static; margin-top: var(--pt-space-1); }
/* The protected / cascade lists in a fragment-backed confirm body. */
.confirm-list {
    margin: var(--pt-space-2) 0; padding-left: var(--pt-space-6);
    list-style: disc; font-size: var(--pt-text-sm); line-height: var(--pt-leading-sm); color: var(--pt-fg-muted);
}
.confirm-list--blocked { color: var(--pt-ink-on-red-20); }
/* A fragment's rendered preview (an email body) — reads as a document, not code. */
.confirm-preview {
    margin: var(--pt-space-3) 0 0; padding: var(--pt-space-3) var(--pt-space-4);
    white-space: pre-wrap; overflow-wrap: anywhere; font: inherit;
    font-size: var(--pt-text-sm); line-height: var(--pt-leading-prose); color: var(--pt-fg);
    background: var(--pt-surface-sunken, var(--pt-surface)); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-sm); max-height: 320px; overflow-y: auto;
}
/* The reveal page's show-once secret: monospace beside its copy button, and the warning line under it. */
.reveal-value { display: flex; align-items: center; gap: var(--pt-space-2); }
.reveal-value code {
    flex: 1; padding: var(--pt-space-3) var(--pt-space-4);
    font-family: var(--pt-font-mono); font-size: var(--pt-text-sm); line-height: var(--pt-leading-sm);
    overflow-wrap: anywhere; color: var(--pt-fg);
    background: var(--pt-surface-sunken, var(--pt-surface)); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-sm);
}
.reveal-note {
    display: flex; align-items: center; gap: var(--pt-space-2); margin: var(--pt-space-3) 0 0;
    font-size: var(--pt-text-sm); line-height: var(--pt-leading-sm); color: var(--pt-ink-on-gold-20);
}
.reveal-actions { display: flex; justify-content: flex-end; }

.modal-footer { display: flex; justify-content: flex-end; gap: var(--pt-space-2); padding: var(--pt-space-6); }
/* Exit is deliberately quicker than the entrance — the system's response snaps. */
.modal-backdrop.is-leaving { opacity: 0; transition-duration: var(--pt-dur-fast); }
.modal-backdrop.is-leaving .modal {
    transform: translateY(8px) scale(0.98); opacity: 0;
    transition-duration: var(--pt-dur-fast);
}
@media (prefers-reduced-motion: reduce) {
    /* Keep both fades — the scrim and dialog still explain themselves — drop the travel. */
    .modal { transition-property: opacity; }
    @starting-style {
        .modal { transform: none; }
    }
    .modal-backdrop.is-leaving .modal { transform: none; }
}

/* ===== Board peek (the modal a board card opens into) ===== */
/* Lives in a .modal--lg body: identity strip, fact grid, then the work-item
   rows. Deliberately the same label + .status-badge pairing as the list cells so
   a status reads the same wherever it appears. */
/* The root takes the opening focus; scroll-margin keeps the modal-body padding
   above it, so focusing it doesn't nudge the dialog off its own top. */
.peek { scroll-margin-top: var(--pt-space-6); outline: none; }
.peek__head { display: flex; align-items: flex-start; gap: var(--pt-space-3); }
.peek__ident { min-width: 0; flex: 1; }
/* Card-title role, the app's only 16/24/600 heading: one step under a section title. */
.peek__name {
    display: flex; align-items: center; gap: var(--pt-space-2);
    font-size: var(--pt-text-md); font-weight: var(--pt-weight-strong); line-height: var(--pt-leading-md);
}
.peek__star { color: var(--pt-solar-gold); font-size: var(--pt-text-sm); }
.peek__sub { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); margin-top: 2px; }
.peek__badges { display: flex; flex-direction: column; align-items: flex-end; gap: var(--pt-space-2); flex-shrink: 0; }
.peek__match { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); }

.peek__facts {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: var(--pt-space-3); margin-top: var(--pt-space-4);
    padding: var(--pt-space-4) 0; border-top: 1px solid var(--pt-border); border-bottom: 1px solid var(--pt-border);
}
.peek__fact dt { display: flex; align-items: center; gap: var(--pt-space-1); }
.peek__fact dd { margin-top: 2px; font-size: var(--pt-text-sm); font-weight: var(--pt-weight-strong); }

.peek__section { margin-top: var(--pt-space-4); }
.peek__section-title { margin-bottom: var(--pt-space-2); }
.peek__items { display: flex; flex-direction: column; gap: var(--pt-space-2); }
.peek__item {
    display: flex; align-items: center; justify-content: space-between; gap: var(--pt-space-3);
    padding: var(--pt-space-3); border: 1px solid var(--pt-border); border-radius: var(--pt-radius-sm);
    background: var(--pt-bg);
}
.peek__item-text { min-width: 0; }
.peek__item-label { display: block; font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value); }
.peek__item-detail { display: block; font-size: var(--pt-text-xs); color: var(--pt-fg-muted); margin-top: 2px; }
.peek__item .status-badge { flex-shrink: 0; gap: var(--pt-space-1); }
/* A stage whose work the automation has not raised yet still needs a line. */
.peek__item--none { justify-content: center; color: var(--pt-fg-muted); font-size: var(--pt-text-sm); }
/* Banked work is context, not the thing being scanned — mute it a step. */
.peek__items--done .peek__item { background: transparent; }
.peek__items--done .peek__item-label { color: var(--pt-fg-muted); font-weight: var(--pt-weight-regular); }

.peek__next {
    display: flex; align-items: center; gap: var(--pt-space-2);
    margin-top: var(--pt-space-4); font-size: var(--pt-text-xs); color: var(--pt-fg-muted);
}

/* ===== Command palette (⌘K) ===== */
.palette-backdrop {
    position: fixed; inset: 0; z-index: 400;
    display: flex; justify-content: center; align-items: flex-start;
    padding: 12vh var(--pt-space-6) var(--pt-space-6);
    background: var(--pt-scrim);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 1;
    transition: opacity var(--pt-dur-instant) var(--pt-ease-paper);
}
@starting-style {
    .palette-backdrop { opacity: 0; }
}
.palette {
    width: min(560px, 100%); max-height: min(420px, 76vh);
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md);
    /* Keyboard-initiated and used constantly — entrance stays at the instant
       tier (unlike the modal's base tier) so it never reads as lag. */
    opacity: 1; transform: none;
    transition: transform var(--pt-dur-instant) var(--pt-ease-paper),
                opacity var(--pt-dur-instant) var(--pt-ease-paper);
}
@starting-style {
    .palette { opacity: 0; transform: scale(0.99); }
}
.palette-backdrop.is-leaving { opacity: 0; transition-duration: var(--pt-dur-instant); }
.palette-input {
    display: flex; align-items: center; gap: var(--pt-space-3); padding: var(--pt-space-1) var(--pt-space-4);
    border-bottom: 1px solid var(--pt-border); flex-shrink: 0;
}
.palette-input [class^="ph-"] { color: var(--pt-fg-muted); font-size: var(--pt-text-md); }
.palette-input input {
    flex: 1; height: 46px; min-width: 0; border: 0; background: none; outline: none;
    font-family: inherit; font-size: var(--pt-text-md); color: var(--pt-fg);
}
.palette-input input:focus-visible { box-shadow: none; }
.palette-input kbd, .palette-footer kbd, .kbd-row kbd {
    font-size: var(--pt-text-2xs); font-weight: var(--pt-weight-strong); padding: 2px var(--pt-space-2); line-height: 16px;
    background: var(--pt-bg); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md); color: var(--pt-fg-muted); font-family: inherit;
}

/* Keyboard-help grid (the "?" modal). */
.kbd-grid { display: grid; grid-template-columns: 1fr; gap: var(--pt-space-3); }
@media (min-width: 480px) { .kbd-grid { grid-template-columns: 1fr 1fr; column-gap: var(--pt-space-8); } }
.kbd-row {
    display: flex; align-items: center; justify-content: space-between; gap: var(--pt-space-4);
    font-size: var(--pt-text-sm); color: var(--pt-fg);
}
.kbd-keys { display: inline-flex; gap: var(--pt-space-1); }
.palette-results { overflow-y: auto; padding: var(--pt-space-2); flex: 1; }
.palette-group-label { padding: var(--pt-space-3) var(--pt-space-3) var(--pt-space-1); }
.palette-item {
    display: flex; align-items: center; gap: var(--pt-space-3); width: 100%;
    padding: var(--pt-space-3) var(--pt-space-3); border: 0; border-radius: var(--pt-radius-sm);
    background: none; text-align: left; cursor: pointer;
    font-family: inherit; color: var(--pt-fg);
}
.palette-item [class^="ph-"] { font-size: var(--pt-text-lg); color: var(--pt-fg-muted); flex-shrink: 0; }
.palette-item__title {
    font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.palette-item__sub {
    margin-left: auto; padding-left: var(--pt-space-3); flex-shrink: 0;
    font-size: var(--pt-text-xs); color: var(--pt-fg-muted); white-space: nowrap;
}
/* Highlight follows keyboard + hover; flame accent marks the committed row. */
.palette-item.is-active { background: var(--surface-muted); box-shadow: inset 2px 0 0 var(--pt-rocket-flame); }
.palette-item.is-active [class^="ph-"] { color: var(--pt-fg); }
.palette-empty { padding: var(--pt-space-6) var(--pt-space-4); text-align: center; font-size: var(--pt-text-sm); color: var(--pt-fg-muted); }
.palette-footer {
    display: flex; gap: var(--pt-space-4); padding: var(--pt-space-2) var(--pt-space-4); flex-shrink: 0;
    border-top: 1px solid var(--pt-border);
    font-size: var(--pt-text-xs); color: var(--pt-fg-muted);
}
.palette-footer span { display: inline-flex; align-items: center; gap: var(--pt-space-1); }
@media (prefers-reduced-motion: reduce) {
    .palette { transition-property: opacity; }
    @starting-style {
        .palette { transform: none; }
    }
}

/* ===== History / activity timeline ===== */
/* Structured, not prose: when / rail / who / what are four tracks that line up
   down the whole log, so a reader can scan one column at a time. One grid holds
   every row (rows and the header dissolve with display:contents) so the who
   track can size to the widest actor — full emails, never chopped. */
.history {
    display: grid;
    grid-template-columns: 12px 76px max-content minmax(0, 1fr);
    column-gap: var(--pt-space-3);
}
.history-cols,
.history-row { display: contents; }
.history-cols span { padding-bottom: var(--pt-space-3); }
.history-rule {
    grid-column: 1 / -1; border-bottom: 1px solid var(--pt-border);
    margin-bottom: var(--pt-space-4);
}
/* Date headers group the log the way Directus does: Today, Yesterday, then dates. */
.history-group { grid-column: 1 / -1; margin-bottom: var(--pt-space-3); }
.history-row + .history-group { margin-top: var(--pt-space-2); }

/* Dissolves so when/who land in the outer grid's own tracks; becomes a real box
   again in the narrow layout below. */
.history-meta { display: contents; }

.history-when {
    font-size: var(--pt-text-xs); color: var(--pt-fg-muted);
    font-variant-numeric: tabular-nums; padding-bottom: var(--pt-space-4);
}
.history-who {
    font-size: var(--pt-text-xs); font-weight: var(--pt-weight-value); color: var(--pt-fg);
    padding-bottom: var(--pt-space-4); white-space: nowrap;
}
.history-what { min-width: 0; padding-bottom: var(--pt-space-4); }
.history-row:last-child .history-when,
.history-row:last-child .history-who,
.history-row:last-child .history-what { padding-bottom: 0; }

.history-rail { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
/* Lifecycle color only (created seafoam, deleted red, edits neutral) — enough to
   spot births and deaths while scanning the rail, without ranking ordinary edits. */
.history-dot {
    width: 10px; height: 10px; border-radius: 50%; margin-top: 4px;
    background: var(--pt-polished-steel); flex-shrink: 0;
}
.history-dot--created { background: var(--pt-galactic-seafoam); }
.history-dot--deleted { background: var(--pt-red-alert); }
.history-line { flex: 1; width: 2px; background: var(--pt-border); margin-top: var(--pt-space-1); }
.history-row:last-child .history-line { display: none; }

.history-event { font-size: var(--pt-text-sm); display: flex; flex-wrap: wrap; gap: var(--pt-space-2); align-items: baseline; }
.history-action { font-weight: var(--pt-weight-strong); color: var(--pt-fg); }
/* The candidate an event happened to — sits beside the action, links to their match. */
.history-subject { font-weight: var(--pt-weight-strong); color: var(--pt-rocket-flame); text-decoration: none; }
.history-subject:hover { text-decoration: underline; }

/* Only the field name gets a track. The values are Directus-style diff bars:
   old on red over new on green, one rounded card split in two rows, so every
   change reads at a glance as a tiny unified diff. Bar tint is 10% of the
   semantic color; the <mark> word chips sit at 20% so changed words pop
   inside long values without shouting. */
.history-changes { display: flex; flex-direction: column; gap: var(--pt-space-2); }
.history-event + .history-changes { margin-top: var(--pt-space-2); }
.history-change {
    display: grid; grid-template-columns: 116px minmax(0, 1fr);
    align-items: start; gap: var(--pt-space-2); font-size: var(--pt-text-xs);
}
/* Same voice as .history-action, so Created and a field name read as peers. */
.history-change__field {
    color: var(--pt-fg); font-weight: var(--pt-weight-strong);
    font-size: var(--pt-text-sm); line-height: var(--pt-leading-sm);
}
.history-change__values { min-width: 0; }
.history-change__bar {
    position: relative; padding: 3px var(--pt-space-2) 3px var(--pt-space-6);
    line-height: var(--pt-leading-xs); overflow-wrap: break-word;
}
.history-change__bar i {
    position: absolute; left: var(--pt-space-2); top: 5px; font-size: 10px;
}
.history-change__bar--old {
    background: var(--pt-red-alert-20);
    color: var(--pt-ink-on-red-20);
    border-radius: var(--pt-radius-xs) var(--pt-radius-xs) 0 0;
}
.history-change__bar--new {
    background: var(--pt-galactic-seafoam-20);
    color: var(--pt-ink-on-seafoam-20);
    border-radius: 0 0 var(--pt-radius-xs) var(--pt-radius-xs);
}
.history-change__text mark {
    background: var(--pt-red-alert-20); color: inherit;
    border-radius: 2px; padding: 0 1px;
}
.history-change__bar--new .history-change__text mark { background: var(--pt-galactic-seafoam-20); }

/* Prose changes: a line diff, not two blobs. Monospace so the added and removed
   lines stack in register; the +/- sign is decoration, hence ::before. */
.history-diff {
    border: 1px solid var(--pt-border); border-radius: var(--pt-radius-xs);
    background: var(--pt-bg); overflow-x: auto;
    font-family: var(--pt-font-mono);
    font-size: var(--pt-text-code); line-height: var(--pt-leading-code);
}
.history-diff__line { padding: 0 var(--pt-space-2); white-space: pre-wrap; color: var(--pt-fg-muted); }
.history-diff__line::before { content: "\00a0\00a0"; }
.history-diff__line--added { background: var(--pt-galactic-seafoam-20); color: var(--pt-ink-on-seafoam-20); }
.history-diff__line--added::before { content: "+\00a0"; }
.history-diff__line--removed { background: var(--pt-red-alert-20); color: var(--pt-ink-on-red-20); }
.history-diff__line--removed::before { content: "-\00a0"; }
.history-diff__line--hunk { color: var(--pt-fg-muted); }

.history-empty { font-size: var(--pt-text-sm); color: var(--pt-fg-muted); }

/* Narrow: the when/who tracks stop fitting, so rows become their own two-column
   grids, the meta box reassembles as one line above the event, and the rail
   spans both rows beside it. */
@media (max-width: 719px) {
    .history { display: flex; flex-direction: column; }
    .history-cols, .history-rule { display: none; }
    .history-row { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: var(--pt-space-3); }
    .history-rail { grid-row: 1 / span 2; }
    .history-meta {
        display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--pt-space-2);
        grid-column: 2; grid-row: 1; margin-bottom: var(--pt-space-1);
    }
    .history-when, .history-who { padding-bottom: 0; }
    .history-who { white-space: normal; overflow-wrap: break-word; }
    .history-what { grid-column: 2; grid-row: 2; }
    /* The field name stacks above its values; the diff bars stay intact. */
    .history-change { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* ===== Long-text prose ===== */
.markdown {
    font-size: var(--pt-text-sm); line-height: var(--pt-leading-prose); color: var(--pt-fg);
}
.markdown h1, .markdown h2, .markdown h3 { color: var(--pt-fg); font-weight: var(--pt-weight-strong); margin: var(--pt-space-4) 0 var(--pt-space-2); }
.markdown h1 { font-size: var(--pt-text-lg); }
.markdown h2 { font-size: var(--pt-text-md); }
.markdown h3 { font-size: var(--pt-text-sm); }
.markdown p { margin-bottom: var(--pt-space-3); }
.markdown ul, .markdown ol { margin-bottom: var(--pt-space-3); padding-left: var(--pt-space-6); }
.markdown ul { list-style: disc; }
.markdown ol { list-style: decimal; }
.markdown li { margin-bottom: var(--pt-space-1); }
.markdown a { color: var(--pt-rocket-flame); text-decoration: underline; }

/* ===== Candidate review (three-column desk) ===== */
/* Breadcrumb row doubles as the pipeline pager — the decision lives at the foot
   of the assessment column, so the desk carries no bar of its own. */
/* The breadcrumb keeps its own box — same top edge, same margin below it as on
   every other page. Anything else shifts the crumb during a shell swap, since
   the swap leaves it on screen while the rest of the page changes underneath. */
.desk-topbar {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: var(--pt-space-4); flex-wrap: wrap;
}
/* Half the difference between the 32px pager and the 18px crumb line: centres
   the pager on that line rather than growing the row and pushing the crumb down. */
.desk-pager { display: inline-flex; align-items: center; gap: var(--pt-space-2); margin-top: -7px; }
.desk-pager__count { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); font-variant-numeric: tabular-nums; padding: 0 var(--pt-space-1); }
.desk-pager__count strong { color: var(--pt-fg); font-weight: var(--pt-weight-strong); }
.review-nav-btn {
    width: 32px; height: 32px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--pt-radius-pill); border: 1px solid var(--pt-border);
    background: var(--pt-surface); color: var(--pt-fg); text-decoration: none;
    transition: border-color var(--pt-dur-instant), transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.review-nav-btn:hover { border-color: var(--pt-fg); }
.review-nav-btn [class^="ph-"], .review-nav-btn [class*=" ph-"] { font-size: var(--pt-text-sm); }
.review-nav-btn.is-disabled { opacity: 0.4; pointer-events: none; }

/* Role · candidate · assessment. Stacked and page-scrolled by default; the
   viewport-filling desk with three self-scrolling columns starts at 1280px. */
.review-desk { display: grid; gap: var(--pt-space-4); grid-template-columns: minmax(0, 1fr); }
.desk-col {
    min-width: 0; display: flex; flex-direction: column;
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md); overflow: hidden;
}
/* One card per column: the section-cards stacked inside are seams, not cards, so
   they shed their own chrome and separate on a hairline instead. */
.desk-col .section-card { border: 0; border-radius: 0; background: transparent; overflow: visible; }
.desk-col .section-card + .section-card { margin-top: 0; border-top: 1px solid var(--pt-border); }
.desk-col__head {
    display: flex; align-items: flex-start; gap: var(--pt-space-4); flex: none;
    padding: var(--pt-space-6); border-bottom: 1px solid var(--pt-border);
}
.desk-col__head-action { flex-shrink: 0; }
.desk-col__scroll { min-height: 0; }
/* Resume controls, floated over the top-right of the document instead of taking a bar
   of their own. Quiet until reached for, so they never compete with the resume. */
.desk-doc__tools {
    position: absolute; top: var(--pt-space-3); right: var(--pt-space-3); z-index: 2;
    display: flex; gap: var(--pt-space-1); opacity: 0.35;
    transition: opacity var(--pt-dur-instant);
}
.desk-doc:hover .desk-doc__tools, .desk-doc__tools:focus-within { opacity: 1; }
.desk-doc__tool {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: var(--pt-radius-sm);
    color: var(--pt-fg-muted); background: var(--pt-surface);
    border: 1px solid var(--pt-border);
}
.desk-doc__tool:hover:not(:disabled) { color: var(--pt-fg); }
.desk-doc__tool:disabled { opacity: 0.4; cursor: default; }
/* The zoom readout carries a number, so it earns more room than an icon needs. */
.desk-doc__tool--wide {
    width: auto; padding: 0 var(--pt-space-2);
    font-size: var(--pt-text-xs); font-weight: var(--pt-weight-strong); font-variant-numeric: tabular-nums;
}

/* PDF pages, drawn by pdf.js. Each page is a canvas with an invisible text layer laid
   exactly over it, so the resume selects and finds like text rather than a picture. */
.pdf-page { position: relative; margin: 0 auto var(--pt-space-4); width: max-content; }
.pdf-page canvas { display: block; border-radius: var(--pt-radius-sm); }
.textLayer {
    position: absolute; inset: 0; overflow: hidden; line-height: 1;
    text-align: initial; forced-color-adjust: none; caret-color: transparent;
    transform-origin: 0 0; opacity: 1;
}
.textLayer span, .textLayer br {
    position: absolute; white-space: pre; cursor: text;
    color: transparent; transform-origin: 0 0;
}
.textLayer span::selection { background: var(--pt-atmosphere-blue-20); }

/* Contact lines under the candidate's name, separated rather than run together. */
.desk-contact { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pt-space-3); }

/* IP location map. The canvas holds its height whatever the tiles do, so the column
   does not jump as Leaflet loads. */
.ip-map { position: relative; height: 220px; }
.ip-map__canvas { height: 100%; border-radius: var(--pt-radius-md); overflow: hidden; }
.ip-map__fallback {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: var(--pt-space-2); height: 100%;
    color: var(--pt-fg-muted); font-size: var(--pt-text-sm); text-align: center;
}
.ip-map__pin span {
    display: block; width: 12px; height: 12px; border-radius: 50%;
    background: var(--pt-rocket-flame); border: 2px solid var(--pt-surface);
}

/* Image gallery + lightbox. The strip is a scrolling row of thumbnails so a long
   portfolio never pushes the rest of the column off screen; the lightbox is fixed
   to the viewport, so a self-scrolling desk column cannot clip it. */
.gallery__strip {
    display: flex; gap: var(--pt-space-2); overflow-x: auto; padding-bottom: var(--pt-space-2);
}
.gallery__thumb {
    flex: none; width: 112px; height: 84px; padding: 0; cursor: zoom-in;
    border: 1px solid var(--pt-border); border-radius: var(--pt-radius-sm);
    background: var(--surface-muted); overflow: hidden;
    transition: border-color var(--pt-dur-instant), transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.gallery__thumb:hover { border-color: var(--pt-fg-muted); transform: translateY(-1px); }
.gallery__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery__lightbox {
    position: fixed; inset: 0; z-index: 80; cursor: zoom-out;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: var(--pt-space-4); padding: var(--pt-space-6); background: rgb(0 0 0 / 78%);
}
.gallery__full {
    max-width: min(100%, 1200px); max-height: 80vh; object-fit: contain; cursor: default;
    border-radius: var(--pt-radius-md);
}
.gallery__bar {
    display: flex; align-items: center; gap: var(--pt-space-3); cursor: default;
    padding: var(--pt-space-2) var(--pt-space-3);
    background: var(--pt-surface); border-radius: var(--pt-radius-pill);
}
.gallery__caption { font-size: var(--pt-text-sm); color: var(--pt-fg); }
.gallery__count { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); font-variant-numeric: tabular-nums; }

/* USD reading of the stated rates, beside the boxes that state them: a figure the
   filters actually compare against, never an input. */
.desk-usd { display: flex; flex-direction: column; gap: var(--pt-space-2); margin-top: var(--pt-space-3); }
.desk-usd__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--pt-space-3); }
.desk-usd__k { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); }
.desk-usd__v { font-size: var(--pt-text-sm); font-weight: var(--pt-weight-strong); font-variant-numeric: tabular-nums; }

/* Engine-owned readouts: a label and its value, never an input. */
.desk-signals { display: flex; flex-direction: column; gap: var(--pt-space-3); }
.desk-signal { display: flex; align-items: center; justify-content: space-between; gap: var(--pt-space-3); }
/* The Review card: signals and Vouched rows above the rule, the reviewer's own scores below it. */
.desk-review__scores { margin-top: var(--pt-space-5); }
.desk-signal--child .desk-signal__label { padding-left: var(--pt-space-4); }
.desk-signal__label { font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value); }
.desk-signal__value {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    font-size: var(--pt-text-sm); font-weight: var(--pt-weight-strong); font-variant-numeric: tabular-nums;
}

/* Editable candidate facts. Two to a row in a narrow column, one where the value is a
   name rather than a number. */
.desk-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pt-space-3); }
.desk-fields__group { margin-bottom: var(--pt-space-3); }
.desk-fields + .desk-fields__group { margin-top: var(--pt-space-6); }
.desk-field { display: flex; flex-direction: column; gap: var(--pt-space-1); min-width: 0; }
.desk-field--wide { grid-column: 1 / -1; }
.desk-field__label { font-size: var(--pt-text-xs); font-weight: var(--pt-weight-regular); color: var(--pt-fg-muted); }

@media (min-width: 1280px) {
    /* No page scroll: the shell owns the viewport and each column scrolls itself,
       so the decision and the candidate's name never leave the screen. */
    .main-content.review-page {
        height: 100vh; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
    }
    .review-desk {
        flex: 1; min-height: 0;
        grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.16fr) minmax(0, 1fr);
    }
    .desk-col__scroll { flex: 1; overflow-y: auto; }
}

/* Resume, filling the rest of the candidate column. */
.desk-doc__bar {
    display: flex; align-items: center; justify-content: space-between; gap: var(--pt-space-3);
    flex: none; padding: var(--pt-space-3) var(--pt-space-6); border-bottom: 1px solid var(--pt-border);
}
.desk-doc__name {
    display: inline-flex; align-items: center; gap: var(--pt-space-2); min-width: 0;
    font-size: var(--pt-text-xs); color: var(--pt-fg-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.desk-doc__actions { display: inline-flex; align-items: center; gap: var(--pt-space-2); flex-shrink: 0; }
.desk-doc { position: relative; flex: 1; min-height: 0; background: var(--surface-muted); }
.desk-doc__frame { display: block; width: 100%; height: 100%; min-height: 420px; border: 0; }
.desk-doc__fallback {
    display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%;
    gap: var(--pt-space-3); padding: var(--pt-space-16) var(--pt-space-6); text-align: center;
    color: var(--pt-fg-muted); font-size: var(--pt-text-sm);
}
.desk-doc__fallback a { color: var(--pt-rocket-flame); text-decoration: underline; }
.desk-doc__image { display: block; width: 100%; height: 100%; object-fit: contain; }

/* A Word resume, converted client-side, drawn as the page it was written as. */
/* Zoomed past the column's width, the page scrolls sideways rather than being cut off. */
.resume-doc { height: 100%; overflow: auto; padding: var(--pt-space-6); }
.resume-doc__page {
    width: min(100%, 8.5in); margin: 0 auto; padding: clamp(1.5rem, 2vw, 2.75rem);
    background: var(--pt-surface); color: var(--pt-fg); overflow-wrap: anywhere;
    border-radius: var(--pt-radius-md);
}
.resume-doc__page > :first-child { margin-top: 0; }
.resume-doc__page > :last-child { margin-bottom: 0; }
.resume-doc__page p, .resume-doc__page ul, .resume-doc__page ol,
.resume-doc__page table, .resume-doc__page blockquote { margin: 0 0 1rem; }
.resume-doc__page h1, .resume-doc__page h2, .resume-doc__page h3,
.resume-doc__page h4, .resume-doc__page h5, .resume-doc__page h6 {
    margin: 1.5rem 0 0.75rem; font-weight: var(--pt-weight-strong); line-height: 1.2;
}
.resume-doc__page ul, .resume-doc__page ol { padding-left: 1.5rem; }
.resume-doc__page li + li { margin-top: 0.25rem; }
.resume-doc__page table { width: 100%; border-collapse: collapse; }
.resume-doc__page th, .resume-doc__page td {
    border: 1px solid var(--pt-border); padding: var(--pt-space-2); vertical-align: top;
}
.resume-doc__page img { max-width: 100%; height: auto; }

/* The Resume detail tab — the desk's viewer standing alone: a bordered card at reading
   height, the document scrolling inside it as it does in the desk column. */
.resume-tab {
    display: flex; flex-direction: column;
    height: calc(100vh - 260px); min-height: 480px;
    border: 1px solid var(--pt-border); border-radius: var(--pt-radius-md);
    background: var(--pt-surface); overflow: hidden;
}

/* Decision, pinned to the foot of the column it follows from. */
.desk-decide {
    display: flex; align-items: center; gap: var(--pt-space-2); flex: none;
    padding: var(--pt-space-4) var(--pt-space-6); border-top: 1px solid var(--pt-border);
    background: var(--pt-surface);
}
/* All decisions on one row — Reject and Withdraw a quarter each, Advance the rest,
   since advancing is the ordinary end of a review. Each opens its own menu upward,
   the footer being pinned to the bottom of the column. */
.desk-decide { align-items: stretch; }
.decide { position: relative; display: flex; }
.decide--reject { flex: 1; }
.decide--withdraw { flex: 1; }
.decide--advance { flex: 2; }
.decide__btn { flex: 1; justify-content: center; }
/* A closed candidate's footer is the outcome plus one way back; the outcome takes the
   room and Reopen sits at the far end, quiet — it is a correction, not the usual move. */
.desk-decide__reopen { margin-left: auto; flex: none; }
/* The menu is as wide as its longest outcome, not as wide as the button that opens
   it — "Compensation Alignment" does not fit in a third of this column. Each hangs
   from its own outer edge, so neither runs off the desk. */
.decide__menu {
    top: auto; bottom: calc(100% + 8px);
    min-width: 100%; width: max-content; max-width: 18rem;
    /* Every outcome on screen at once — a decision menu that scrolls hides options
       behind a gesture, and there are only ever a handful. */
    max-height: 60vh; overflow-y: auto;
}
.decide--reject .decide__menu { left: 0; right: auto; transform-origin: bottom left; }
.decide--withdraw .decide__menu { left: 0; right: auto; transform-origin: bottom left; }
.decide--advance .decide__menu { left: auto; right: 0; transform-origin: bottom right; }
.decide__item {
    display: flex; align-items: center; justify-content: space-between; gap: var(--pt-space-2);
    padding: var(--pt-space-2) var(--pt-space-3); border-radius: var(--pt-radius-sm); cursor: pointer;
    color: var(--pt-fg); border: 0; background: none; width: 100%; text-align: left;
    font: inherit; font-size: var(--pt-text-sm);
}
.decide__item:hover { background: var(--surface-muted); }
.decide__item.danger { color: var(--pt-red-alert); }
.decide__hint {
    font-size: var(--pt-text-2xs); font-weight: var(--pt-weight-value); color: var(--pt-fg-muted);
    border: 1px solid var(--pt-border); border-radius: var(--pt-radius-sm); padding: 0 var(--pt-space-1);
}

/* Identity block in a column head — the avatar is a plain .av av-lg; these are
   the text tracks beside it. */
.rev-hero__main { flex: 1; min-width: 0; }
/* Section-title role: a desk column's head is a section of the page, not the page's title. */
.rev-hero__name { display: flex; align-items: center; gap: var(--pt-space-3); flex-wrap: wrap; }
.rev-hero__affinity { font-size: var(--pt-text-sm); }
.rev-hero__sub { color: var(--pt-fg-muted); font-size: var(--pt-text-xs); margin-top: var(--pt-space-2); }
.rev-hero__sub a { color: var(--pt-fg); font-weight: var(--pt-weight-value); text-decoration: none; }
.rev-hero__sub a:hover { color: var(--pt-rocket-flame); }
.rev-hero__meta { display: flex; flex-wrap: wrap; gap: var(--pt-space-2); margin-top: var(--pt-space-3); }

/* Score rows. There is no edit mode: the slider IS the bar, the number IS the
   readout, and either one committing saves the row (see commitScore). */
.score-row + .score-row { margin-top: var(--pt-space-4); }
.score-row__head { display: flex; align-items: center; justify-content: space-between; gap: var(--pt-space-3); }
.score-row__label { font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value); }

/* Quiet until you reach for it — no field chrome sitting in the column at rest. */
.score-row__value {
    display: inline-flex; align-items: baseline; flex-shrink: 0;
    font-size: var(--pt-text-sm); font-weight: var(--pt-weight-strong); font-variant-numeric: tabular-nums;
}
.score-num {
    width: 40px; padding: 2px 1px 2px var(--pt-space-1); text-align: right;
    font: inherit; color: inherit;
    background: transparent; border: 1px solid transparent; border-radius: var(--pt-radius-sm);
    outline: none; transition: border-color var(--pt-dur-instant);
    /* The spinners would sit between the number and its % sign. */
    -moz-appearance: textfield; appearance: textfield;
}
.score-num:hover, .score-num:focus { border-color: var(--pt-border); }
.score-num::-webkit-inner-spin-button, .score-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.score-range {
    -webkit-appearance: none; appearance: none;
    display: block; width: 100%; margin-top: var(--pt-space-2);
    background: transparent; cursor: pointer;
}
.score-range::-webkit-slider-runnable-track {
    height: 8px; border-radius: var(--pt-radius-pill);
    background: linear-gradient(to right,
        var(--score-tier) 0 var(--score-fill), var(--surface-muted) var(--score-fill) 100%);
}
.score-range::-moz-range-track {
    height: 8px; border-radius: var(--pt-radius-pill);
    background: linear-gradient(to right,
        var(--score-tier) 0 var(--score-fill), var(--surface-muted) var(--score-fill) 100%);
}
.score-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; margin-top: -4px; border-radius: 50%;
    background: var(--pt-surface); border: 2px solid var(--score-tier);
    transition: transform var(--pt-dur-fast) var(--pt-ease-paper);
}
.score-range::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--pt-surface); border: 2px solid var(--score-tier);
}
.score-range:active::-webkit-slider-thumb { transform: scale(1.15); }
@media (prefers-reduced-motion: reduce) {
    /* The thumb already tracks the pointer — the grow is decoration, not feedback. */
    .score-range::-webkit-slider-thumb { transition: none; }
    .score-range:active::-webkit-slider-thumb { transform: none; }
}
/* The shared ring would box the whole full-width input; put it on the thumb. */
.score-range:focus-visible { box-shadow: none; }
.score-range:focus-visible::-webkit-slider-thumb { box-shadow: var(--pt-focus-ring); }
.score-range:focus-visible::-moz-range-thumb { box-shadow: var(--pt-focus-ring); }

/* Comment composer + thread. */
.comment-composer { display: flex; flex-direction: column; gap: var(--pt-space-2); }
/* The rule sits under the composer only when there is a thread below it. */
.comment-composer:has(+ .comment-thread .comment-row) { padding-bottom: var(--pt-space-4); border-bottom: 1px solid var(--pt-border); }
.comment-composer__actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--pt-space-3); }
.comment-thread { display: flex; flex-direction: column; }
.comment-row { display: flex; gap: var(--pt-space-3); padding: var(--pt-space-4) 0; border-bottom: 1px solid var(--pt-border); }
.comment-row:last-child { padding-bottom: 0; border-bottom: 0; }
/* Entrance for client-inserted comments only — server-rendered rows must not
   carry this class or the whole thread animates on page load. */
.comment-row--new {
    transition: opacity var(--pt-dur-base) var(--pt-ease-paper),
                transform var(--pt-dur-base) var(--pt-ease-paper);
}
@starting-style {
    .comment-row--new { opacity: 0; transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
    /* Keep the fade, drop the lift. */
    .comment-row--new { transition-property: opacity; }
    @starting-style {
        .comment-row--new { transform: none; }
    }
}
.comment-row__main { min-width: 0; flex: 1; }
.comment-row__meta { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); }
.comment-row__meta strong { color: var(--pt-fg); font-weight: var(--pt-weight-strong); }
.comment-row__body { font-size: var(--pt-text-sm); line-height: var(--pt-leading-prose); margin-top: var(--pt-space-1); }
/* The author's own edit / delete controls, tucked into the meta line. */
.comment-row__actions { display: inline-flex; align-items: center; gap: var(--pt-space-1); margin-left: var(--pt-space-2); vertical-align: middle; }
.comment-row__actions .icon-btn { width: 24px; height: 24px; border-color: transparent; }
.comment-composer--inline { padding-bottom: 0; border-bottom: 0; margin-top: var(--pt-space-2); }
.comment-thread__empty { font-size: var(--pt-text-sm); color: var(--pt-fg-muted); padding-top: var(--pt-space-4); }
/* In flight: the row is already there and already readable, just not yet real. */
.comment-row--pending { opacity: 0.55; }

/* ===== Inline editing ===== */

/* Right-hand cluster in a .section-head (save caption, toggle, Edit). */
.section-actions { display: flex; align-items: center; gap: var(--pt-space-2); flex-shrink: 0; }

/* Optimistic-save caption. Sized so swapping between states can't reflow the head. */
.save-status { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); }
.save-status__item { display: inline-flex; align-items: center; gap: var(--pt-space-1); }
.save-status__item--ok { color: var(--pt-galactic-seafoam); }
.save-status__item--bad { color: var(--pt-red-alert); }
.save-status__spin { display: inline-block; animation: save-spin 700ms linear infinite; }
@keyframes save-spin { to { transform: rotate(360deg); } }

.inline-edit-actions {
    display: flex; align-items: center; justify-content: flex-end;
    gap: var(--pt-space-3); margin-top: var(--pt-space-4);
}
.inline-edit-hint { font-size: var(--pt-text-2xs); color: var(--pt-fg-muted); margin-right: auto; }

/* ===== Email templates panel ===== */
.tpl-list { display: flex; flex-direction: column; gap: var(--pt-space-4); }
.tpl-head { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.tpl-desc { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); margin-top: var(--pt-space-1); }

/* Off means "invites stop going out" — red, full-width, above the fold of the card. */
/* One accordion per template: a clickable head, the body when open, and a footer that
   carries the missing-template warning whether the card is open or not. */
.tpl-card__head {
    display: flex; align-items: center; justify-content: space-between; gap: var(--pt-space-4);
    padding: var(--pt-space-4) var(--pt-space-6);
}
.tpl-card__toggle {
    flex: 1; min-width: 0; display: flex; align-items: center; text-align: left;
    background: none; border: 0; padding: 0; cursor: pointer; color: inherit; font: inherit;
}
.tpl-card__actions { display: flex; align-items: center; gap: var(--pt-space-2); flex-shrink: 0; }
.tpl-card.is-open .tpl-card__body { border-top: 1px solid var(--pt-border); }
.tpl-card__foot {
    display: flex; align-items: flex-start; gap: var(--pt-space-2);
    padding: var(--pt-space-3) var(--pt-space-6);
    font-size: var(--pt-text-xs); line-height: var(--pt-leading-xs);
    border-top: 1px solid var(--pt-border);
}
.tpl-card__foot--alert { background: var(--pt-red-alert-20); color: var(--pt-fg); }
.tpl-card__foot--alert i { color: var(--pt-red-alert); margin-top: 2px; flex-shrink: 0; }

.tpl-field + .tpl-field { margin-top: var(--pt-space-4); }
.tpl-label { display: block; margin-bottom: var(--pt-space-1); }
.tpl-subject { font-size: var(--pt-text-sm); font-weight: var(--pt-weight-value); }
.tpl-body {
    font-size: var(--pt-text-sm); line-height: var(--pt-leading-prose); color: var(--pt-fg);
    white-space: pre-wrap; word-break: break-word; font-family: inherit;
}

/* Placeholder chips — the only supported way to put a value in, since the
   allow-set is fixed by the intent's value_builder. */
.tpl-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pt-space-2); margin-top: var(--pt-space-4); }
.tpl-chips .tpl-label { margin-bottom: 0; }
.tpl-chip {
    font-size: var(--pt-text-2xs);
    padding: 2px var(--pt-space-2); border-radius: var(--pt-radius-pill);
    background: var(--surface-muted); color: var(--pt-fg-muted);
    border: 1px solid var(--pt-border); cursor: pointer;
    transition: color var(--pt-dur-instant), border-color var(--pt-dur-instant);
}
.tpl-chip:hover { color: var(--pt-fg); border-color: var(--pt-fg); }

.tpl-note {
    display: flex; align-items: center; gap: var(--pt-space-2); margin-bottom: var(--pt-space-4);
    font-size: var(--pt-text-sm); color: var(--pt-fg-muted);
}
.tpl-toggle {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    font-size: var(--pt-text-xs); font-weight: var(--pt-weight-value); color: var(--pt-fg-muted);
    background: transparent; border: 0; padding: 0; cursor: pointer;
}
.tpl-toggle.is-on { color: var(--pt-fg); }
/* Geometry and "on" colour match .toggle exactly. This one is a <button> rather
   than a checkbox, which is why the markup differs — a switch must not look like a
   different control just because of how its state is stored. */
.tpl-toggle__track {
    width: 36px; height: 20px; border-radius: var(--pt-radius-pill);
    background: var(--pt-border); padding: 2px; display: block;
    transition: background var(--pt-dur-instant);
}
.tpl-toggle.is-on .tpl-toggle__track { background: var(--pt-rocket-flame); }
.tpl-toggle__knob {
    width: 16px; height: 16px; border-radius: 50%; background: var(--pt-surface); display: block;
    transition: transform var(--pt-dur-instant) var(--pt-ease-paper);
}
.tpl-toggle.is-on .tpl-toggle__knob { transform: translateX(16px); }

/* ===== Cards tab region (crud "cards" kind — _cards_region.html) ===== */
.cards-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: var(--pt-space-4); margin-bottom: var(--pt-space-4);
}
.cards-intro { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); max-width: 46ch; line-height: 1.5; }
.card-stack { display: flex; flex-direction: column; gap: var(--pt-space-4); }
.card-muted { opacity: 0.62; }
.card-id { min-width: 0; }
.card-line { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); margin-top: var(--pt-space-1); }
.card-copy { display: flex; align-items: center; gap: var(--pt-space-2); flex-wrap: wrap; }
.card-copy__param { width: 192px; max-width: 100%; }
/* Copy affordance beside a value that is already on screen. Quiet until the row is
   reached for, and green for the beat after a copy so the click is answered twice. */
.copy-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; padding: 0; border: 0; border-radius: var(--pt-radius-sm);
    background: transparent; color: var(--pt-fg-muted); cursor: pointer; opacity: 0.55;
    transition: opacity var(--pt-dur-instant), color var(--pt-dur-instant), background var(--pt-dur-instant);
}
.copy-btn:hover, .copy-btn:focus-visible { opacity: 1; background: var(--pt-border); color: var(--pt-fg); }
.copy-btn.is-copied { opacity: 1; color: var(--pt-ink-on-seafoam-20); }
.copy-btn [class^="ph-"] { font-size: var(--pt-text-sm); }
.card-note { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); }

/* ===== Listings tab ===== */
.listing-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: var(--pt-space-4); margin-bottom: var(--pt-space-4);
}
.listing-intro { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); max-width: 46ch; line-height: 1.5; }

.listing-card.is-retired { opacity: 0.62; }

/* Metadata chips on the card head — reuse .tag, tint the Indeed one. */
.tag--indeed { background: var(--pt-atmosphere-blue-20); color: var(--pt-ink-on-blue-20); }
.tag--retired { background: var(--surface-muted); color: var(--pt-fg-muted); }

.listing-apply { display: flex; align-items: center; gap: var(--pt-space-2); flex-wrap: wrap; }
.listing-channel { width: 192px; max-width: 100%; }
.listing-retired-note { font-size: var(--pt-text-xs); color: var(--pt-fg-muted); }

/* Paired inputs (city/state, comp min/max) share a row and split evenly. */
.listing-loc { display: flex; gap: var(--pt-space-2); }
.listing-loc > * { flex: 1; min-width: 0; }
.listing-state { max-width: 96px; }
.listing-mono { font-size: var(--pt-text-xs); }
.listing-grid { margin-top: var(--pt-space-4); }

.listing-empty {
    display: flex; flex-direction: column; align-items: center; gap: var(--pt-space-2);
    padding: var(--pt-space-12) var(--pt-space-4); text-align: center;
    color: var(--pt-fg-muted); border: 1px dashed var(--pt-border); border-radius: var(--pt-radius-md);
}
.listing-empty i { font-size: var(--pt-icon-empty); }
.field-optional { font-size: var(--pt-text-2xs); font-weight: var(--pt-weight-regular); color: var(--pt-fg-muted); }

/* JD tab -> Listings bridge footer. */
.jd-bridge {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: var(--pt-space-3); margin-top: var(--pt-space-4);
    padding-top: var(--pt-space-4); border-top: 1px solid var(--pt-border);
}
.jd-bridge__link {
    display: inline-flex; align-items: center; gap: var(--pt-space-2);
    background: transparent; border: 0; padding: 0; cursor: pointer;
    font-size: var(--pt-text-xs); font-weight: var(--pt-weight-value); color: var(--pt-fg-muted);
}
.jd-bridge__link:hover { color: var(--pt-rocket-flame); }

/* ===== Responsive ===== */
@media (max-width: 1023px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.is-open { transform: translateX(0); }
    /* Off-canvas slide, not a width collapse — ride the drawer curve like the
       columns panel. Exit (closing) is quicker than the entrance. */
    .sidebar { transition: transform var(--pt-dur-fast) var(--pt-ease-drawer); }
    .sidebar.is-open { transition: transform var(--pt-dur-base) var(--pt-ease-drawer); }
    .main-content { margin-left: 0; padding: var(--pt-space-16) var(--pt-space-4) var(--pt-space-4); }
    .main-content.has-save-bar { padding-bottom: var(--pt-space-24); }
    .mobile-sidebar-toggle { display: inline-flex; }
    .save-bar { left: 0; }
    .hero-name { font-size: var(--pt-text-xl); line-height: var(--pt-leading-xl); }
    .page-headline { font-size: var(--pt-text-xl); line-height: var(--pt-leading-xl); }
}
@media (max-width: 640px) { .search-input { min-width: 0; flex: 1; } }

/* ===== Reduced motion =====
   Reduced motion means fewer and gentler animations, not zero: everything that
   TRAVELS across the screen is listed here and snaps instead, while the color and
   opacity feedback that explains state (hovers, focus rings, checkbox fills, the
   toast/modal/page fades) is deliberately kept.

   This block lives at the END of the file on purpose. A media query adds no
   specificity, so these rules only beat the component declarations above by coming
   later in source order — moving it back to the top silently disables it. Components
   whose reduced-motion state needs more than "no transition" (keep the fade, drop the
   travel) carry their own block beside their rules: .toast, .modal, .pop-hidden,
   .score-range, .comment-row--new, .req-editor-row--new, and the buttons' press
   feedback. */
@media (prefers-reduced-motion: reduce) {
    .sidebar,
    /* Matches the mobile off-canvas override, which is .sidebar.is-open — a bare
       .sidebar here is less specific and would lose to it, letting the drawer
       still slide open under reduced motion. */
    .sidebar.is-open,
    .save-bar,
    .toast-cell,
    .toggle__track::after,
    .tpl-toggle__track,
    .tpl-toggle__knob {
        transition: none;
    }
    /* The global 0.01ms clamp would turn this infinite spin into a strobe. The
       caption still reads "Saving…", which is the part that carries the meaning. */
    .save-status__spin { animation: none; }
    /* Scrim fade explains that the drawer opened/closed — keep it, drop the panel's
       travel (its states only move transform + visibility). */
    .drawer,
    .drawer.is-open {
        transition: none;
    }
    /* Not `transition: none` — this element also carries the nav fade-in, and the
       fade is what explains that the page changed. Drop the collapse travel only. */
    .main-content { transition-property: opacity; }
}

/* ===== Stat tiles: a row of headline figures ===== */
/* Tiles reflow when the available width falls below 320px. */
.stat-tiles {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: var(--pt-space-4); margin-bottom: var(--pt-space-6);
}
.stat-tile {
    display: flex; flex-direction: column; gap: var(--pt-space-2);
    background: var(--pt-surface); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-md); padding: var(--pt-space-4) var(--pt-space-6);
}
.stat-tile--link { text-decoration: none; color: inherit; transition: border-color var(--pt-dur-instant); }
.stat-tile--link:hover { border-color: var(--pt-fg); }
/* The dashboard's verdict line: quiet green when nothing needs attention, red with the anomalies when something does. */
.health-banner {
    display: flex; align-items: flex-start; gap: var(--pt-space-3);
    padding: var(--pt-space-4) var(--pt-space-6); margin-bottom: var(--pt-space-6);
    border: 1px solid var(--pt-border); border-radius: var(--pt-radius-md); background: var(--pt-surface);
}
.health-banner i { font-size: var(--pt-text-xl); line-height: 1; margin-top: 2px; }
.health-banner--ok { background: var(--pt-galactic-seafoam-20); color: var(--pt-ink-on-seafoam-20); border-color: transparent; }
.health-banner--alert { background: var(--pt-red-alert-20); color: var(--pt-ink-on-red-20); border-color: transparent; }
.health-banner__title { font-weight: var(--pt-weight-strong); font-size: var(--pt-text-md); margin: 0; }
.health-banner__sub { font-size: var(--pt-text-sm); margin: var(--pt-space-1) 0 0; opacity: 0.85; }
.health-banner__list { margin: var(--pt-space-2) 0 0; padding-left: var(--pt-space-4); font-size: var(--pt-text-sm); }
/* .stat-tile__value takes the shared stat figure role — see the grouped rule by .fin-summary. */


/* Figure tones — one scale for tiles and breakdown cells, so a figure reads the same in both. */
.fig--green { color: var(--pt-galactic-seafoam); }
.fig--purple { color: var(--pt-voyager-purple); }
.fig--red { color: var(--pt-red-alert); }
.fig--blue { color: var(--pt-atmosphere-blue); }
.fig--gold { color: var(--pt-ink-on-gold-20); }
.fig--neutral { color: var(--pt-fg); }

/* ===== Trend chart ===== */
.trend-chart { margin-bottom: var(--pt-space-6); }
.trend-chart__svg { width: 100%; max-height: 240px; }
.trend-chart__axis { stroke: var(--pt-border); stroke-width: 1; }
.trend-chart__grid { stroke: var(--pt-border); stroke-width: 0.5; stroke-dasharray: 4; }
.trend-chart__zero { stroke: var(--pt-fg-muted); stroke-width: 1; }
.trend-chart__tick, .trend-chart__period { fill: var(--pt-fg-muted); }
/* Sizes here are viewBox user units, not CSS px — the chart scales them up ~1.45x at full height. */
.trend-chart__tick, .trend-chart__period { font-size: var(--pt-text-2xs); }
.trend-chart__line { stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.trend-chart__dot { stroke: var(--pt-surface); stroke-width: 1.5; }
.trend-chart__empty { text-align: center; color: var(--pt-fg-muted); font-size: var(--pt-text-sm); padding: var(--pt-space-6) 0; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--pt-space-3); font-size: var(--pt-text-xs); color: var(--pt-fg-muted); }
.chart-legend__item { display: inline-flex; align-items: center; gap: var(--pt-space-2); }
.chart-legend__dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ===== Pill toggles: a radio or checkbox worn as a chip ===== */
.pill-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pt-space-2); }
.pill-row + .pill-row { margin-top: var(--pt-space-3); }
.pill {
    display: inline-flex; align-items: center; gap: var(--pt-space-1);
    padding: var(--pt-space-2) var(--pt-space-3); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-pill); font-size: var(--pt-text-xs); font-weight: var(--pt-weight-value);
    color: var(--pt-fg-muted); background: var(--pt-surface); cursor: pointer; white-space: nowrap;
}
.pill:hover { color: var(--pt-fg); border-color: var(--pt-fg); }
.pill.is-on { background: var(--pt-fg); border-color: var(--pt-fg); color: var(--pt-surface); }
.pill--sm { padding: var(--pt-space-1) var(--pt-space-2); }
/* Kept in the layout at zero size so it still takes focus and answers the keyboard. */
.pill__input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none; }
.pill:focus-within { outline: 2px solid var(--pt-fg); outline-offset: 2px; }
.year-step {
    display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
    border: 1px solid var(--pt-border); border-radius: 50%; background: var(--pt-surface);
    color: var(--pt-fg-muted); cursor: pointer;
}
.year-step:hover { color: var(--pt-fg); border-color: var(--pt-fg); }
.year-label { font-size: var(--pt-text-xs); font-weight: var(--pt-weight-strong); font-variant-numeric: tabular-nums; min-width: 34px; text-align: center; }

/* ===== Financial dashboard layout ===== */
.dash-filters { display: flex; flex-direction: column; gap: var(--pt-space-4); margin-bottom: var(--pt-space-6); }
.dash-filters .section-card + .section-card { margin-top: 0; }
.dash-toggle { display: inline-flex; align-items: center; gap: var(--pt-space-2); font-size: var(--pt-text-sm); color: var(--pt-fg-muted); cursor: pointer; }
.dash-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--pt-space-4); }
.dash-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--pt-space-2); max-height: 260px; overflow-y: auto; }
.dash-check { display: inline-flex; align-items: center; gap: var(--pt-space-2); font-size: var(--pt-text-sm); cursor: pointer; min-width: 0; }
.dash-check__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-breakdowns { display: flex; flex-direction: column; gap: var(--pt-space-4); }
.dash-breakdowns .section-card + .section-card { margin-top: 0; }

/* ---- Permission matrix (user Permissions tab) ---- */
.perm-matrix__verb, .perm-matrix__cell { text-align: center; width: 96px; }
.perm-matrix__entity { font-weight: 600; }
.perm-matrix__codename { margin-left: var(--pt-space-2); font-family: var(--pt-font-mono, monospace); font-size: var(--pt-text-xs); font-weight: 400; color: var(--pt-fg-muted); }
.perm-matrix--named { margin-top: var(--pt-space-4); }
.perm-matrix__implicit { color: var(--pt-fg-muted); }
.perm-toggle {
    display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
    border-radius: var(--pt-radius-sm); border: 1px dashed var(--pt-border); background: transparent;
    color: var(--pt-fg-muted); cursor: pointer;
}
.perm-toggle:hover { border-style: solid; color: var(--pt-fg); }
.perm-toggle--on {
    border: 1px solid transparent; background: var(--pt-galactic-seafoam-20); color: var(--pt-ink-on-seafoam-20);
}
.perm-toggle--on:hover { background: var(--pt-red-alert-20); color: var(--pt-ink-on-red-20); }
/* A role-inherited grant: visible but never toggled here — the bundle edits on the role's own screen. */
.perm-toggle--via {
    border: 1px solid transparent; background: var(--surface-muted); color: var(--pt-fg-muted); cursor: default;
}

/* ===== Instant tooltip: an element carrying data-tip shows it on hover with no delay.
   It opens to the LEFT so a cell inside a scrolling .table-wrap never clips it at the right edge. ===== */
.has-tip { position: relative; }
.has-tip:hover::after {
    content: attr(data-tip);
    position: absolute; right: calc(100% + var(--pt-space-2)); top: 50%; transform: translateY(-50%);
    background: var(--pt-fg); color: var(--pt-surface);
    font-size: var(--pt-text-xs); line-height: 1.3; white-space: nowrap;
    padding: var(--pt-space-1) var(--pt-space-2); border-radius: var(--pt-radius-sm);
    pointer-events: none; z-index: 20;
}
