/* =========================================================================
   Societal Socks — shared application stylesheet
   Single source of truth for design tokens and chrome.
   Linked by index.html and crm.html so the nav and shell never drift.
   ========================================================================= */

:root {
    /* ---- palette ---------------------------------------------------- */
    --c-bg:            #f5f6f8;
    --c-surface:       #ffffff;
    --c-surface-sunk:  #eef1f5;
    --c-surface-alt:   #fafbfc;
    --c-line:          #e2e6ec;
    --c-line-strong:   #cfd6e0;
    --c-ink:           #131a24;   /* 15.7:1 on white */
    --c-ink-soft:      #2f3a4a;
    --c-muted:         #56637a;   /* 6.6:1 on white  — AA for body text */

    --c-accent:        #2a55c8;   /* 6.3:1 on white  — AA for text + UI  */
    --c-accent-soft:   #eef3ff;
    --c-accent-line:   #c6d6fb;
    --c-accent-strong: #1e42a4;

    --c-good:          #0f7a52;   /* AA on white */
    --c-good-soft:     #e9f7f0;
    --c-warn:          #91620a;   /* AA on white */
    --c-warn-soft:     #fdf5e4;
    --c-bad:           #b62828;   /* AA on white */
    --c-bad-soft:      #fdeeee;

    /* ---- stage accents ---------------------------------------------- */
    --s-identified:     #7c8798;
    --s-contacted:      #3f6fd8;
    --s-generic_sample: #0e7fa3;
    --s-design_sent:    #6b48c4;
    --s-bespoke_sample: #a3467d;
    --s-decision:       #b06a12;
    --s-client_active:  #0f7a52;
    --s-reorder_due:    #b45309;
    --s-reordering:     #0e7fa3;
    --s-dormant:        #6b7280;
    --s-warm:           #9a6a12;
    --s-archive:        #8a94a3;

    /* ---- spacing / radius / shadow / type --------------------------- */
    --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
    --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

    --r-sm: 5px; --r-md: 8px; --r-lg: 12px; --r-pill: 999px;

    --sh-1: 0 1px 2px rgba(19, 26, 36, 0.05);
    --sh-2: 0 1px 3px rgba(19, 26, 36, 0.07), 0 1px 2px rgba(19, 26, 36, 0.04);
    --sh-3: 0 4px 12px rgba(19, 26, 36, 0.08), 0 1px 3px rgba(19, 26, 36, 0.05);
    --sh-4: 0 12px 32px rgba(19, 26, 36, 0.12), 0 2px 8px rgba(19, 26, 36, 0.06);

    --fs-micro: 10px; --fs-xs: 11px; --fs-sm: 12.5px;
    --fs-base: 14px;  --fs-md: 16px; --fs-lg: 20px; --fs-xl: 28px;

    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-head: 'Outfit', 'Inter', system-ui, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;

    --speed: 0.15s;

    /* ---- legacy aliases (pre-existing pages read these) -------------- */
    --bg-base: var(--c-bg);
    --bg-card: var(--c-surface);
    --border-color: var(--c-line);
    --text-main: var(--c-ink);
    --text-muted: var(--c-muted);
    --primary: var(--c-accent);
    --primary-light: var(--c-accent-soft);
    --primary-hover: var(--c-accent-strong);
    --success: var(--c-good);
    --success-light: var(--c-good-soft);
    --danger: var(--c-bad);
    --danger-light: var(--c-bad-soft);
    --warning: var(--c-warn);
    --warning-light: var(--c-warn-soft);
}

@media (prefers-reduced-motion: reduce) {
    :root { --speed: 0.001s; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* The view sections carry display utilities, which would otherwise out-specify
   the UA's [hidden] rule and render every view at once. */
[hidden] { display: none !important; }

body {
    font-family: var(--font-body);
    background-color: var(--c-bg);
    color: var(--c-ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: var(--fs-base);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4, .font-heading {
    font-family: var(--font-head);
    color: var(--c-ink);
    letter-spacing: -0.015em;
}

a { color: var(--c-accent); }

:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- scrollbars ------------------------------------------------------ */
.custom-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
.custom-scroll::-webkit-scrollbar-thumb {
    background: var(--c-line-strong);
    border-radius: var(--r-pill);
    border: 2px solid transparent;
    background-clip: content-box;
}
.custom-scroll::-webkit-scrollbar-thumb:hover { background: #a9b3c1; background-clip: content-box; }
.custom-scroll { scrollbar-width: thin; scrollbar-color: var(--c-line-strong) transparent; }

/* =========================================================================
   GLOBAL NAV
   ========================================================================= */
#nav-header {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-line);
    position: sticky;
    top: 0;
    z-index: 1000;
    /* Some pages centre their body content with flexbox; the bar must still
       span the window rather than shrink to its own contents. */
    width: 100%;
    align-self: stretch;
    flex-shrink: 0;
}
.nav-container {
    max-width: 1560px;
    margin: 0 auto;
    padding: 0 var(--sp-6);
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
}
.logo-area { display: flex; align-items: center; gap: var(--sp-3); text-decoration: none; flex-shrink: 0; }
/* THE WORDMARK, 30px -> 36px. Task P155-#56: Toby's note was "the logo appears
   too small across our website", and "across" includes here. The bar's height
   is fixed at 62px by .nav-container, so a taller mark costs no height — what
   it costs is WIDTH, and this bar has ten items in it.

   38px was tried first and measured: it pushed the ten-item menu onto a second
   row at 1440px, where 30px had left 48.8px of slack. 36px with the link
   padding at 10px restores 49.5px of slack — the same room the bar had before
   this task — while the wordmark still grows 20%. Below about 1300px the menu
   wraps, but it did that at 30px too (measured: -0.2px of slack at 1280px
   before, -0.5px after), so that is unchanged, and at 1180px the labels drop
   and only the icons remain.

   The mark is the only branding in this header now that the 'LeeP' span beside
   it has gone, so it has to carry the bar. */
.logo-area img { height: 36px; width: auto; }
/* `.logo-title` was the style for that span. The span was removed in "The CRM
   says whose CRM it is" (commit ee31110) because 'LeeP' was leftover branding
   from whatever this codebase was before Societal Socks, and nothing has
   rendered the class since. Removed here rather than left as a rule matching
   no element on any page. */
.nav-menu { display: flex; list-style: none; gap: 2px; flex-wrap: wrap; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 9px;    /* 12 -> 10px (P155-#56), 10 -> 9px when the bar reached twelve items */
    color: var(--c-muted);
    text-decoration: none;
    border-radius: var(--r-sm);
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    transition: color var(--speed) ease, background var(--speed) ease;
}
.nav-link svg { width: 15px; height: 15px; flex-shrink: 0; stroke-width: 1.9; }
.nav-link:hover { color: var(--c-ink); background: var(--c-surface-sunk); }
.nav-link.active { color: var(--c-accent); background: var(--c-accent-soft); }

/* TWELVE ITEMS (Social, then Website back on 5 Oct 2026). Icons + labels need
   ~1250px of menu, which only a 1600px+ window has. So the bar steps down
   rather than wrapping onto a second row:
     >= 1600px  icon + label
     1341-1599  label only (drops ~260px of icons; measured to fit at 1366)
     <= 1340    icon only, label kept as the link's hover title (nav.js) */
@media (max-width: 1599px) {
    .nav-link svg { display: none; }
}
@media (max-width: 1340px) {
    .nav-container { height: auto; padding: var(--sp-3) var(--sp-4); flex-wrap: wrap; }
    .nav-link svg { display: block; }
    .nav-link span { display: none; }
    .nav-link { padding: 8px 10px; }
}

/* =========================================================================
   PAGE SHELL
   ========================================================================= */
.content-container {
    max-width: 1560px;
    width: 100%;
    margin: 0 auto;
    padding: var(--sp-8) var(--sp-6) var(--sp-10);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
    flex-wrap: wrap;
}
.page-title { font-size: var(--fs-xl); font-weight: 700; line-height: 1.1; }
.page-subtitle { font-size: var(--fs-sm); color: var(--c-muted); margin-top: 6px; max-width: 62ch; }

/* ---- sub tabs -------------------------------------------------------- */
.sub-nav {
    display: inline-flex;
    gap: 2px;
    background: var(--c-surface-sunk);
    padding: 3px;
    border-radius: var(--r-md);
    width: fit-content;
}
.sub-tab-btn {
    background: transparent;
    border: none;
    color: var(--c-muted);
    padding: 7px 16px;
    border-radius: 6px;
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 650;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: background var(--speed), color var(--speed);
}
.sub-tab-btn:hover { color: var(--c-ink); }
.sub-tab-btn.active {
    background: var(--c-surface);
    color: var(--c-ink);
    box-shadow: var(--sh-1);
}
.sub-tab-btn .tab-count {
    font-size: var(--fs-micro);
    font-weight: 700;
    background: rgba(19,26,36,0.07);
    border-radius: var(--r-pill);
    padding: 1px 6px;
}

/* =========================================================================
   SURFACES
   ========================================================================= */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    box-shadow: var(--sh-1);
}

/* =========================================================================
   BUTTONS
   ========================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--r-sm);
    font-weight: 650;
    font-size: var(--fs-sm);
    line-height: 1.2;
    cursor: pointer;
    transition: background var(--speed), border-color var(--speed), color var(--speed);
    border: 1px solid transparent;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; stroke-width: 2; }
.btn-primary { background: var(--c-accent); color: #fff; }
.btn-primary:hover { background: var(--c-accent-strong); }
.btn-secondary { background: var(--c-surface); border-color: var(--c-line-strong); color: var(--c-ink); }
.btn-secondary:hover { background: var(--c-surface-alt); border-color: #b8c2d0; }
.btn-ghost { background: transparent; color: var(--c-muted); }
.btn-ghost:hover { background: var(--c-surface-sunk); color: var(--c-ink); }
.btn-danger { background: var(--c-bad); color: #fff; }
.btn-danger:hover { background: #9c2020; }
.btn-sm { padding: 5px 10px; font-size: var(--fs-xs); }
.btn-icon { padding: 6px; width: 30px; height: 30px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-trash {
    background: none; border: none; color: var(--c-muted);
    cursor: pointer; padding: 5px; border-radius: var(--r-sm);
    display: inline-flex; align-items: center; justify-content: center;
    transition: color var(--speed), background var(--speed);
}
.btn-trash:hover { color: var(--c-bad); background: var(--c-bad-soft); }
.btn-trash svg { width: 14px; height: 14px; }

/* =========================================================================
   FORM CONTROLS
   ========================================================================= */
.input, .input-dark {
    background: var(--c-surface);
    border: 1px solid var(--c-line-strong);
    color: var(--c-ink);
    padding: 7px 10px;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    font-family: inherit;
    outline: none;
    transition: border-color var(--speed), box-shadow var(--speed);
    max-width: 100%;
}
.input:focus, .input-dark:focus {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-soft);
}
.input::placeholder, .input-dark::placeholder { color: #8f9aab; }
select.input, select.input-dark {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2356637a'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.4' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 11px;
    padding-right: 26px;
    cursor: pointer;
}
.w-full { width: 100%; }
label.input-label {
    font-size: var(--fs-micro);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.07em;
    color: var(--c-muted);
    margin-bottom: 5px;
    display: block;
}
.form-textarea { width: 100%; min-height: 76px; resize: vertical; font-family: inherit; line-height: 1.55; }

/* =========================================================================
   TOOLBAR
   ========================================================================= */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px var(--sp-4);
    flex-wrap: wrap;
    gap: var(--sp-3);
}
.toolbar-group { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

/* =========================================================================
   TABLES
   ========================================================================= */
.table-container {
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    overflow: auto;
    background: var(--c-surface);
    box-shadow: var(--sh-1);
}
.table-clean { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.table-clean th {
    background: var(--c-surface-alt);
    padding: 10px 14px;
    text-transform: uppercase;
    font-size: var(--fs-micro);
    font-weight: 700;
    color: var(--c-muted);
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--c-line);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}
.table-clean td { padding: 11px 14px; border-bottom: 1px solid var(--c-line); color: var(--c-ink); vertical-align: middle; }
.table-clean tr:last-child td { border-bottom: none; }
.table-clean tbody tr:hover td { background: var(--c-surface-alt); }
.table-clean tbody tr.is-selected td { background: var(--c-accent-soft); }
.th-sortable { cursor: pointer; user-select: none; }
.th-sortable:hover { color: var(--c-ink); }
.th-sortable .sort-caret { opacity: 0.35; margin-left: 4px; }
.th-sortable.sorted .sort-caret { opacity: 1; color: var(--c-accent); }

.val-positive { color: var(--c-good); font-weight: 700; }
.val-negative { color: var(--c-bad); font-weight: 700; }
.text-mono { font-family: var(--font-mono); }

/* =========================================================================
   BADGES / CHIPS
   ========================================================================= */
.badge {
    font-size: var(--fs-micro);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-success { background: var(--c-good-soft); border-color: rgba(15,122,82,0.18); color: var(--c-good); }
.badge-danger  { background: var(--c-bad-soft);  border-color: rgba(182,40,40,0.18);  color: var(--c-bad); }
.badge-primary { background: var(--c-accent-soft); border-color: var(--c-accent-line); color: var(--c-accent); }
.badge-warn    { background: var(--c-warn-soft); border-color: rgba(145,98,10,0.18); color: var(--c-warn); }
.badge-neutral { background: var(--c-surface-sunk); border-color: var(--c-line); color: var(--c-muted); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--fs-micro);
    font-weight: 650;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    background: var(--c-surface-sunk);
    color: var(--c-muted);
    border: 1px solid var(--c-line);
    white-space: nowrap;
}
.chip-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* =========================================================================
   MODALS
   ========================================================================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(19, 26, 36, 0.34);
    backdrop-filter: blur(3px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--sp-6);
}
.modal-backdrop.open { display: flex; }
.modal-card {
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-lg);
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    box-shadow: var(--sh-4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-card.wide { max-width: 560px; }
.modal-header {
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--c-line);
    display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3);
}
.modal-body { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); overflow-y: auto; }
.modal-footer {
    padding: var(--sp-3) var(--sp-5);
    border-top: 1px solid var(--c-line);
    display: flex; justify-content: flex-end; gap: var(--sp-2);
    background: var(--c-surface-alt);
}

/* =========================================================================
   TOAST
   ========================================================================= */
#toast-notification {
    position: fixed;
    bottom: var(--sp-8);
    left: 50%;
    transform: translateX(-50%) translateY(14px);
    background: var(--c-ink);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--r-md);
    font-size: var(--fs-sm);
    font-weight: 600;
    z-index: 4000;
    box-shadow: var(--sh-4);
    display: none;
    opacity: 0;
    transition: opacity var(--speed) ease-out, transform var(--speed) ease-out;
}
#toast-notification.visible { display: block; opacity: 1; transform: translateX(-50%) translateY(0); }
/* A toast that reports a failure should not look like one that reports success. */
#toast-notification.is-error { background: var(--c-bad); }

/* =========================================================================
   UTILITIES
   ========================================================================= */

/* Letter-spacing utilities, at Tailwind 2.2's exact values. The proposal and
   label artifacts were authored against the Tailwind CDN these pages used to
   load; that CDN is gone, so the tracking-* classes still sitting on the
   PRINTED documents would silently resolve to `normal` and reflow customer-
   facing type. These are exact ports, not re-designs — do not "improve" them. */
.tracking-tighter { letter-spacing: -0.05em; }
.tracking-tight   { letter-spacing: -0.025em; }
.tracking-normal  { letter-spacing: 0; }
.tracking-wide    { letter-spacing: 0.025em; }
.tracking-wider   { letter-spacing: 0.05em; }
.tracking-widest  { letter-spacing: 0.1em; }

.flex-between { display: flex; justify-content: space-between; align-items: center; }
.d-flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.flex-grow { flex-grow: 1; }
.align-items-center { align-items: center; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mb-3 { margin-bottom: var(--sp-3); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-bold { font-weight: 700; }
.text-muted { color: var(--c-muted); }
.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.pointer { cursor: pointer; }
.py-2 { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
.py-4 { padding-top: var(--sp-4); padding-bottom: var(--sp-4); }
.py-6 { padding-top: var(--sp-6); padding-bottom: var(--sp-6); }
.py-8 { padding-top: var(--sp-8); padding-bottom: var(--sp-8); }
.empty-note { color: var(--c-muted); font-size: var(--fs-xs); text-align: center; padding: var(--sp-4) 0; }

/* =========================================================================
   CRM — ATTENTION STRIP
   ========================================================================= */
.attention-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
}
.attention-tile {
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-left: 3px solid var(--c-line-strong);
    border-radius: var(--r-md);
    padding: 12px var(--sp-4);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    box-shadow: var(--sh-1);
    transition: border-color var(--speed), box-shadow var(--speed), background var(--speed);
}
.attention-tile:hover { box-shadow: var(--sh-2); background: var(--c-surface-alt); }
.attention-tile.is-active { border-color: var(--c-accent); background: var(--c-accent-soft); }
.attention-tile[data-kind="overdue"]  { border-left-color: var(--c-bad); }
.attention-tile[data-kind="stale"]    { border-left-color: var(--c-warn); }
.attention-tile[data-kind="noaction"] { border-left-color: var(--s-identified); }
.attention-tile[data-kind="unposted"] { border-left-color: var(--s-generic_sample); }
.attention-num {
    font-family: var(--font-head);
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    min-width: 1.6ch;
}
.attention-tile[data-kind="overdue"] .attention-num  { color: var(--c-bad); }
.attention-tile[data-kind="stale"] .attention-num    { color: var(--c-warn); }
.attention-tile[data-kind="noaction"] .attention-num { color: var(--c-muted); }
.attention-tile[data-kind="unposted"] .attention-num { color: var(--s-generic_sample); }
.attention-label { font-size: var(--fs-sm); font-weight: 650; line-height: 1.3; }
.attention-sub { font-size: var(--fs-xs); color: var(--c-muted); margin-top: 2px; }

.filter-pill {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--c-accent-soft); border: 1px solid var(--c-accent-line);
    color: var(--c-accent-strong);
    font-size: var(--fs-xs); font-weight: 650;
    padding: 4px 6px 4px 10px; border-radius: var(--r-pill);
}
.filter-pill button {
    background: none; border: none; cursor: pointer; color: inherit;
    font-size: 13px; line-height: 1; padding: 2px 4px; border-radius: 50%;
}
.filter-pill button:hover { background: rgba(42,85,200,0.14); }

/* =========================================================================
   CRM — FOLDER RAIL
   ========================================================================= */
.folder-rail {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 10px var(--sp-4);
    margin-bottom: var(--sp-4);
}
.folder-rail-label {
    font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: 0.08em;
    font-weight: 700; color: var(--c-muted); margin-right: 2px;
}
.folder-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 11px;
    border-radius: var(--r-pill);
    border: 1px solid var(--c-line-strong);
    background: var(--c-surface);
    color: var(--c-ink);
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--speed), border-color var(--speed), color var(--speed);
    max-width: 260px;
}
.folder-chip:hover { background: var(--c-surface-sunk); }
.folder-chip .fc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-chip .fc-count {
    font-size: var(--fs-micro); font-weight: 700;
    background: var(--c-surface-sunk); color: var(--c-muted);
    border-radius: var(--r-pill); padding: 1px 6px; min-width: 20px; text-align: center;
}
.folder-chip.is-active {
    background: var(--c-ink); border-color: var(--c-ink); color: #fff;
}
.folder-chip.is-active .fc-count { background: rgba(255,255,255,0.2); color: #fff; }
.folder-chip.is-drop-target { border-color: var(--c-accent); background: var(--c-accent-soft); }

/* =========================================================================
   CRM — KANBAN BOARD
   ========================================================================= */
.board {
    display: flex;
    gap: var(--sp-3);
    overflow-x: auto;
    align-items: stretch;
    padding-bottom: var(--sp-3);
    min-height: 420px;
}
.board-col {
    flex: 1 1 0;
    min-width: 232px;
    max-width: 340px;
    background: var(--c-surface-sunk);
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 210px);
    transition: background var(--speed), border-color var(--speed);
}
.board-col.is-drop-target {
    background: var(--c-accent-soft);
    border-color: var(--c-accent);
    box-shadow: inset 0 0 0 1px var(--c-accent);
}
.board-col-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--c-surface-sunk);
    border-bottom: 1px solid var(--c-line);
    border-radius: var(--r-md) var(--r-md) 0 0;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.board-col-accent { width: 3px; align-self: stretch; border-radius: var(--r-pill); background: var(--col-accent, var(--c-line-strong)); }
.board-col-title {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--c-ink);
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.board-col-count {
    background: var(--c-surface); border: 1px solid var(--c-line);
    border-radius: var(--r-pill); padding: 1px 7px;
    font-size: var(--fs-micro); font-weight: 700; color: var(--c-muted);
}
.col-collapse-btn {
    background: none; border: none; cursor: pointer; color: var(--c-muted);
    padding: 3px; border-radius: var(--r-sm); display: inline-flex; line-height: 0;
}
.col-collapse-btn:hover { background: var(--c-line); color: var(--c-ink); }
.col-collapse-btn svg { width: 13px; height: 13px; transition: transform var(--speed); }
.board-col-hint {
    font-size: var(--fs-micro); color: var(--c-muted);
    padding: 6px 12px 0; line-height: 1.4;
}
.board-col-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding: 10px;
    min-height: 60px;
}

/* collapsed column becomes a narrow vertical rail */
.board-col.collapsed { flex: 0 0 46px; min-width: 46px; max-width: 46px; }
.board-col.collapsed .board-col-body,
.board-col.collapsed .board-col-hint { display: none; }
.board-col.collapsed .board-col-header {
    flex-direction: column;
    height: 100%;
    border-bottom: none;
    border-radius: var(--r-md);
    padding: 10px 6px;
    gap: 10px;
}
.board-col.collapsed .board-col-accent { width: 100%; height: 3px; align-self: auto; flex: 0 0 3px; }
.board-col.collapsed .board-col-title {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    flex-grow: 1;
    text-overflow: clip;
}
.board-col.collapsed .col-collapse-btn svg { transform: rotate(180deg); }

/* =========================================================================
   CRM — LEAD CARD
   ========================================================================= */
.lead-card {
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-left: 3px solid var(--card-accent, var(--c-line-strong));
    border-radius: var(--r-sm);
    padding: 10px 11px;
    cursor: pointer;
    box-shadow: var(--sh-1);
    transition: box-shadow var(--speed), border-color var(--speed), transform var(--speed);
    position: relative;
}
.lead-card:hover { box-shadow: var(--sh-3); }
.lead-card:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.lead-card.dragging { opacity: 0.45; }
.lead-card.is-selected { border-color: var(--c-accent); box-shadow: 0 0 0 2px var(--c-accent-soft), var(--sh-1); }
.lead-card.is-overdue { border-left-color: var(--c-bad); background: var(--c-bad-soft); }
.lead-card.is-stale:not(.is-overdue) { border-left-color: var(--c-warn); background: var(--c-warn-soft); }

.lead-card-top { display: flex; align-items: flex-start; gap: 8px; }
.lead-select {
    margin: 2px 0 0; width: 14px; height: 14px; flex-shrink: 0;
    accent-color: var(--c-accent); cursor: pointer;
}
.lead-name {
    font-size: 13px; font-weight: 700; line-height: 1.3;
    flex-grow: 1; word-break: break-word;
}
.lead-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.chip-category {
    background: transparent; border-style: dashed; color: var(--c-muted);
    text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700;
    font-size: 9.5px; padding: 2px 7px;
}
/* "Sample posted 21 Aug 25 · 20d" — carried ONLY by a lead that has the
   marker. A lead without one carries no chip here at all. Task P155-#22. */
.chip-sample {
    background: var(--c-accent-soft);
    border-color: var(--c-accent-line);
    color: var(--c-accent-strong);
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
}
.chip-sample svg { width: 10px; height: 10px; flex-shrink: 0; }
/* A card is narrow and a date is not. Never let this one spill past its edge. */
.chip-sample { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* The count of unposted samples on a sample column's own header line, so the
   answer to "which of these still have to go out" is visible without a badge
   on every card. Clicking it turns the filter on. */
.col-await {
    display: inline-flex; align-items: center;
    font-family: inherit; font-size: var(--fs-micro); font-weight: 700;
    color: var(--c-warn); background: var(--c-warn-soft);
    border: 1px solid rgba(145,98,10,0.18); border-radius: var(--r-pill);
    padding: 1px 7px; margin-left: 4px; cursor: pointer;
}
.col-await:hover { background: #f7ecd3; }
.col-await:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.lead-next {
    margin-top: 8px; font-size: var(--fs-xs); line-height: 1.45;
    display: flex; flex-direction: column; gap: 2px;
}
.lead-next-text {
    color: var(--c-ink); font-weight: 600;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.lead-next-date {
    color: var(--c-muted); font-family: var(--font-mono);
    font-size: var(--fs-micro); letter-spacing: -0.01em;
}
.lead-next.overdue .lead-next-date { color: var(--c-bad); font-weight: 700; }
.lead-next.none .lead-next-text { color: var(--c-muted); font-weight: 500; font-style: italic; }
.lead-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--c-line);
}
.lead-days { font-size: var(--fs-micro); color: var(--c-muted); font-family: var(--font-mono); white-space: nowrap; }
.lead-days.warn { color: var(--c-warn); font-weight: 700; }
.lead-stage-select {
    font-size: var(--fs-micro); padding: 3px 18px 3px 6px;
    background-position: right 4px center; background-size: 9px;
    max-width: 132px; color: var(--c-muted);
    border-color: transparent; background-color: transparent;
    transition: border-color var(--speed), background-color var(--speed), color var(--speed);
}
.lead-card:hover .lead-stage-select,
.lead-stage-select:focus,
.lead-stage-select:hover {
    border-color: var(--c-line-strong); background-color: var(--c-surface); color: var(--c-ink);
}
@media (hover: none) {
    .lead-stage-select { border-color: var(--c-line-strong); background-color: var(--c-surface); }
}
.col-empty {
    border: 1px dashed var(--c-line-strong);
    border-radius: var(--r-sm);
    padding: var(--sp-4) var(--sp-2);
    text-align: center;
    font-size: var(--fs-xs);
    color: var(--c-muted);
}

/* =========================================================================
   CRM — HOLDING DRAWERS (warm / archive)
   ========================================================================= */
.holding-drawer { margin-top: var(--sp-4); }
.holding-summary {
    padding: 11px var(--sp-4);
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; user-select: none;
    font-size: var(--fs-sm); font-weight: 650;
    background: none; border: none; width: 100%; font-family: inherit; color: var(--c-ink);
    border-radius: var(--r-md);
}
.holding-summary:hover { background: var(--c-surface-alt); }
.holding-summary .hd-accent { width: 3px; height: 16px; border-radius: var(--r-pill); background: var(--hd-accent, var(--c-line-strong)); }
.holding-summary .hd-chevron { margin-left: auto; transition: transform var(--speed); color: var(--c-muted); line-height: 0; }
.holding-summary .hd-chevron svg { width: 14px; height: 14px; }
.holding-drawer.open .hd-chevron { transform: rotate(180deg); }
.holding-body {
    display: none;
    padding: var(--sp-4);
    border-top: 1px solid var(--c-line);
    background: var(--c-surface-alt);
    border-radius: 0 0 var(--r-md) var(--r-md);
}
.holding-drawer.open .holding-body { display: block; }
.holding-body.is-drop-target { background: var(--c-accent-soft); box-shadow: inset 0 0 0 1px var(--c-accent); }
.holding-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
}

/* =========================================================================
   CRM — BULK ACTION BAR
   ========================================================================= */
#bulk-bar {
    position: fixed;
    bottom: var(--sp-6);
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    background: var(--c-ink);
    color: #fff;
    border-radius: var(--r-lg);
    box-shadow: var(--sh-4);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2500;
    transition: transform var(--speed) ease-out;
    flex-wrap: wrap;
    max-width: calc(100vw - 32px);
}
#bulk-bar { opacity: 0; pointer-events: none; }
#bulk-bar.visible { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
#bulk-bar .bulk-count { font-size: var(--fs-sm); font-weight: 700; padding-right: 10px; border-right: 1px solid rgba(255,255,255,0.2); }
#bulk-bar select, #bulk-bar .btn { font-size: var(--fs-xs); }
#bulk-bar select {
    background-color: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    padding: 6px 24px 6px 9px;
    border-radius: var(--r-sm);
    font-family: inherit;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23ffffff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.4' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 7px center; background-size: 11px;
    appearance: none; cursor: pointer;
}
#bulk-bar select option { color: var(--c-ink); }
#bulk-bar .btn-ghost { color: #cdd5e0; }
#bulk-bar .btn-ghost:hover { color: #fff; background: rgba(255,255,255,0.12); }

/* =========================================================================
   CRM — DRAWER
   ========================================================================= */
#crm-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(520px, 100vw);
    height: 100vh;
    background: var(--c-surface);
    border-left: 1px solid var(--c-line);
    z-index: 2600;
    box-shadow: var(--sh-4);
    transform: translateX(105%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    visibility: hidden;
}
#crm-drawer.open { transform: translateX(0); visibility: visible; }
.drawer-header {
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--c-line);
    display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3);
}
.drawer-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}
.drawer-section {
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    padding: var(--sp-4);
    background: var(--c-surface-alt);
}
.drawer-section-title {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--c-ink);
    margin-bottom: 11px;
    display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2);
}
.drawer-scroll-list { display: flex; flex-direction: column; gap: 7px; max-height: 190px; overflow-y: auto; }
.mini-row {
    display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2);
    background: var(--c-surface); border: 1px solid var(--c-line);
    padding: 7px 10px; border-radius: var(--r-sm); font-size: var(--fs-sm);
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .field-grid { grid-template-columns: 1fr; } }

.folder-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.folder-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: var(--r-pill);
    border: 1px solid var(--c-line-strong); background: var(--c-surface);
    font-family: inherit; font-size: var(--fs-xs); font-weight: 600;
    color: var(--c-muted); cursor: pointer;
}
.folder-toggle.on { background: var(--c-ink); border-color: var(--c-ink); color: #fff; }

/* activity log */
.activity-list { display: flex; flex-direction: column; gap: 0; max-height: 260px; overflow-y: auto; }
.activity-item {
    display: flex; gap: 10px; padding: 9px 0;
    border-bottom: 1px solid var(--c-line);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
    width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0;
    background: var(--c-line-strong);
}
.activity-item[data-kind="stage_change"] .activity-dot { background: var(--c-accent); }
.activity-item[data-kind="email"] .activity-dot { background: var(--s-generic_sample); }
.activity-item[data-kind="call"] .activity-dot { background: var(--s-decision); }
.activity-item[data-kind="note"] .activity-dot { background: var(--c-line-strong); }
.activity-item[data-kind="sample_posted"] .activity-dot { background: var(--s-bespoke_sample); }
.activity-text { font-size: var(--fs-sm); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.activity-meta { font-size: var(--fs-micro); color: var(--c-muted); margin-top: 2px; font-family: var(--font-mono); }
.notes-blob {
    white-space: pre-wrap; font-size: var(--fs-sm); line-height: 1.55;
    color: var(--c-ink); background: var(--c-surface);
    border: 1px solid var(--c-line); border-radius: var(--r-sm); padding: 9px 11px;
}

/* =========================================================================
   CRM — TABLE VIEW EXTRAS
   ========================================================================= */
.table-view-wrap { display: flex; flex-direction: column; min-height: 0; }
.stage-tag {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: var(--fs-micro); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; padding: 2px 8px; border-radius: var(--r-pill);
    background: var(--c-surface-sunk); color: var(--c-ink); border: 1px solid var(--c-line);
    white-space: nowrap;
}
.stage-tag .chip-dot { background: var(--stage-accent, var(--c-line-strong)); }
td.cell-tight { white-space: nowrap; }
.row-check { width: 14px; height: 14px; accent-color: var(--c-accent); cursor: pointer; }

@media (max-width: 720px) {
    .content-container { padding: var(--sp-5) var(--sp-3) var(--sp-8); }
    .page-title { font-size: 22px; }
    .board-col { min-width: 78vw; max-width: 78vw; }
    #crm-drawer { width: 100vw; }
    .attention-strip { grid-template-columns: 1fr; }
}

/* =========================================================================
   PRINT — the application chrome never appears on paper
   The nav is rendered by nav.js on EVERY page now, including the four that
   produce printed artifacts, so the rule that hides it belongs here once
   rather than being re-stated (or forgotten) per page.
   ========================================================================= */
@media print {
    #nav-header,
    .no-print { display: none !important; }
}

/* =========================================================================
   KPI TILES  (dashboard + bank ledger)
   ========================================================================= */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}
.kpi-card {
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    box-shadow: var(--sh-1);
    padding: var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.kpi-title {
    font-size: var(--fs-xs);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.07em;
    color: var(--c-muted);
    margin-bottom: 6px;
}
.kpi-value {
    font-family: var(--font-head);
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--c-ink);
}
.kpi-value.is-good { color: var(--c-good); }
.kpi-value.is-bad  { color: var(--c-bad); }
.kpi-trend {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--c-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
}
.kpi-trend svg { width: 12px; height: 12px; stroke-width: 2; flex: 0 0 auto; }
.kpi-trend.is-good { color: var(--c-good); }
.kpi-trend.is-bad  { color: var(--c-bad); }

/* =========================================================================
   SECTION PANELS  (a titled block of content inside a page)
   ========================================================================= */
.section-panel {
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    box-shadow: var(--sh-1);
    padding: var(--sp-5);
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.section-title {
    font-family: var(--font-head);
    font-size: var(--fs-md);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--c-ink);
    border-bottom: 1px solid var(--c-line);
    padding-bottom: var(--sp-3);
    margin-bottom: var(--sp-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
}
.section-title .section-hint {
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--c-muted);
    text-transform: none;
    letter-spacing: 0;
}

/* =========================================================================
   ALERT BARS  (a row that wants attention, with an action on the right)
   ========================================================================= */
.alert-bar {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-sm);
    border: 1px solid var(--c-line);
    border-left: 3px solid var(--c-line-strong);
    background: var(--c-surface-alt);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    font-size: var(--fs-sm);
    line-height: 1.5;
}
.alert-bar.warning { background: var(--c-warn-soft); border-color: rgba(145,98,10,0.18); border-left-color: var(--c-warn); }
.alert-bar.danger  { background: var(--c-bad-soft);  border-color: rgba(182,40,40,0.18);  border-left-color: var(--c-bad); }
.alert-icon { color: var(--c-muted); line-height: 0; flex: 0 0 auto; }
.alert-icon svg { width: 16px; height: 16px; stroke-width: 2; }
.alert-bar.warning .alert-icon { color: var(--c-warn); }
.alert-bar.danger  .alert-icon { color: var(--c-bad); }
.alert-content { flex-grow: 1; min-width: 0; }
.alert-title { font-weight: 700; color: var(--c-ink); }
.alert-desc { color: var(--c-muted); font-size: var(--fs-xs); margin-top: 2px; }
.checklist-container { display: flex; flex-direction: column; gap: var(--sp-2); }

/* =========================================================================
   EMPTY + LOADING STATES
   Every page used to show a blank panel or a bare "..." while it waited on
   Firebase. One component, so waiting looks the same everywhere.
   ========================================================================= */
.state-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    text-align: center;
    padding: var(--sp-8) var(--sp-4);
    color: var(--c-muted);
    flex-grow: 1;
}
.state-block svg { width: 26px; height: 26px; stroke-width: 1.6; color: var(--c-line-strong); }
.state-title { font-size: var(--fs-base); font-weight: 650; color: var(--c-ink-soft); }
.state-desc  { font-size: var(--fs-sm); color: var(--c-muted); max-width: 44ch; line-height: 1.5; }
.state-block .btn { margin-top: var(--sp-2); }

.spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid var(--c-line);
    border-top-color: var(--c-accent);
    animation: socsoc-spin 0.7s linear infinite;
}
@keyframes socsoc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* =========================================================================
   FORM SECTIONS  (a labelled group of fields in a sidebar or modal)
   ========================================================================= */
.form-section {
    border-bottom: 1px solid var(--c-line);
    padding-bottom: var(--sp-4);
}
.form-section:last-child { border-bottom: none; padding-bottom: 0; }
.form-section-title {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--c-muted);
    margin-bottom: var(--sp-3);
}

/* ---- range sliders (design studio + label maker) --------------------- */
input[type=range].range-input {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    width: 100%;
    cursor: pointer;
}
input[type=range].range-input::-webkit-slider-runnable-track {
    height: 3px; border-radius: 2px; background: var(--c-line-strong);
}
input[type=range].range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px; width: 14px; border-radius: 50%;
    background: var(--c-accent); border: 1px solid var(--c-accent);
    margin-top: -6px;
}
input[type=range].range-input::-moz-range-track {
    height: 3px; border-radius: 2px; background: var(--c-line-strong);
}
input[type=range].range-input::-moz-range-thumb {
    height: 14px; width: 14px; border: 1px solid var(--c-accent);
    border-radius: 50%; background: var(--c-accent);
}

/* =========================================================================
   TOOL TOP BAR
   The Studio, Label Maker and Proposal pages are full-height tools: below the
   global nav they each carry a strip of document-level controls. One
   component so those strips stop being three different designs.
   ========================================================================= */
.tool-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    flex-wrap: wrap;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-line);
    padding: var(--sp-3) var(--sp-6);
    flex-shrink: 0;
}
.tool-bar-title {
    font-family: var(--font-head);
    font-size: var(--fs-md);
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--c-ink);
    display: flex;
    align-items: baseline;
    gap: var(--sp-2);
}
.tool-bar-title .tool-bar-meta {
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--c-muted);
    letter-spacing: 0;
}
.tool-bar-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

/* ---- a tool's left-hand control column ------------------------------- */
.tool-panel {
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    padding: var(--sp-4);
}
.tool-panel-title {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--c-muted);
    margin-bottom: var(--sp-3);
}
.tool-sidebar {
    width: 320px;
    flex-shrink: 0;
    background: var(--c-surface);
    border-right: 1px solid var(--c-line);
    overflow-y: auto;
}
.tool-stage {
    flex-grow: 1;
    min-width: 0;
    background: var(--c-bg);
    overflow: auto;
}

/* ---- a checkerboard behind transparent artwork ----------------------- */
.pixel-bg {
    background-image:
        linear-gradient(45deg, var(--c-surface-sunk) 25%, transparent 25%, transparent 75%, var(--c-surface-sunk) 75%, var(--c-surface-sunk) 100%),
        linear-gradient(45deg, var(--c-surface-sunk) 25%, var(--c-surface) 25%, var(--c-surface) 75%, var(--c-surface-sunk) 75%, var(--c-surface-sunk) 100%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
}
.image-pixelated { image-rendering: pixelated; }

/* ---- segmented control (two or three exclusive options) -------------- */
.seg {
    display: inline-flex;
    background: var(--c-surface-sunk);
    border-radius: var(--r-md);
    padding: 3px;
    gap: 2px;
}
.seg > button {
    background: transparent;
    border: 0;
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 650;
    color: var(--c-muted);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--speed), color var(--speed);
}
.seg > button:hover { color: var(--c-ink); }
.seg > button.active { background: var(--c-surface); color: var(--c-ink); box-shadow: var(--sh-1); }

/* ---- a colour swatch input ------------------------------------------- */
.swatch-input {
    width: 34px; height: 26px; padding: 2px;
    border: 1px solid var(--c-line-strong);
    border-radius: var(--r-sm);
    background: var(--c-surface);
    cursor: pointer;
}

/* ---- two-column dashboard split -------------------------------------- */
.dashboard-split {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: var(--sp-6);
    align-items: start;
}
.dashboard-split > .section-panel { min-height: 420px; }
@media (max-width: 980px) {
    .dashboard-split { grid-template-columns: 1fr; }
    .dashboard-split > .section-panel { min-height: 0; }
}

/* A KPI grid that stacks in a narrow side column instead of flowing. */
.kpi-grid.kpi-stack { grid-template-columns: 1fr; margin-bottom: 0; }
.ml-2 { margin-left: var(--sp-2); }
.seg.w-full > button { flex: 1; }

/* Inside a form section or a modal a control fills its column; in a toolbar
   it sits at its natural size. Stated once so no page has to say it inline. */
.form-section .input,
.modal-body .input,
.field-stack .input,
.line-grid .input { width: 100%; }
.toolbar .input { min-width: 190px; }
.toolbar select.input { min-width: 170px; }

/* ---- full-width underline tabs (the Studio's left panel) -------------- */
.tool-tabs { display: flex; border-bottom: 1px solid var(--c-line); flex-shrink: 0; }
.tool-tab {
    flex: 1;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 13px 8px;
    font-family: inherit;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--c-muted);
    cursor: pointer;
    transition: color var(--speed), background var(--speed), border-color var(--speed);
}
.tool-tab:hover { color: var(--c-ink); background: var(--c-surface-alt); }
.tool-tab.tab-active { color: var(--c-accent); border-bottom-color: var(--c-accent); background: var(--c-accent-soft); }

/* ---- a micro label above or beside a control -------------------------- */
.field-label {
    font-size: var(--fs-micro);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--c-muted);
}
.field-row { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.input-xs { padding: 5px 8px; font-size: var(--fs-xs); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-good); display: inline-block; flex: 0 0 auto; }
.link-btn {
    background: none; border: 0; padding: 0; cursor: pointer;
    font-family: inherit; font-size: var(--fs-xs); font-weight: 700;
    color: var(--c-accent);
}
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { opacity: 0.35; cursor: not-allowed; text-decoration: none; }
.pixel-frame { border: 1px solid var(--c-line); border-radius: var(--r-sm); }
.divider-top { border-top: 1px solid var(--c-line); }

/* ---- Studio: stripe rows, pixel grid cells, saved-design cards -------- */
.stripe-row {
    display: flex; align-items: center; gap: var(--sp-3);
    border: 1px solid var(--c-line); border-radius: var(--r-sm);
    background: var(--c-surface-alt); padding: 6px 8px;
}
.stripe-row:hover { border-color: var(--c-line-strong); }
.pixel-cell { border: 0.5px solid rgba(19,26,36,0.06); cursor: crosshair; }
.history-card {
    border: 1px solid var(--c-line); border-radius: var(--r-md);
    background: var(--c-surface); box-shadow: var(--sh-1);
    padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2);
}
.history-card:hover { border-color: var(--c-accent-line); box-shadow: var(--sh-2); }
.history-name {
    font-size: var(--fs-sm); font-weight: 700; color: var(--c-ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px;
}
.history-meta { font-size: var(--fs-micro); color: var(--c-muted); font-weight: 600; margin-top: 2px; }
.ml-auto { margin-left: auto; }

/* The flat-texture canvas sits on white, because that is what a transparent
   pixel becomes in the exported BMP. This is OUTPUT backing, not chrome. */
.texture-canvas { background: #ffffff; }

/* ---- toggle switch ---------------------------------------------------- */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch-track {
    width: 34px; height: 19px; border-radius: var(--r-pill);
    background: var(--c-line-strong); display: block; position: relative;
    transition: background var(--speed);
}
.switch-knob {
    position: absolute; top: 2px; left: 2px; width: 15px; height: 15px;
    border-radius: 50%; background: #fff; box-shadow: var(--sh-1);
    transition: transform var(--speed);
}
.switch-input:checked + .switch-track { background: var(--c-accent); }
.switch-input:checked + .switch-track .switch-knob { transform: translateX(15px); }
.switch-input:focus-visible + .switch-track { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* ---- a radio rendered as a segmented-control face --------------------- */
.seg-face {
    display: block; padding: 6px 12px; border-radius: 6px;
    font-size: var(--fs-sm); font-weight: 650; color: var(--c-muted);
    transition: background var(--speed), color var(--speed);
}
.seg input:checked + .seg-face { background: var(--c-surface); color: var(--c-ink); box-shadow: var(--sh-1); }
.seg > label { flex: 1; }

/* ---- file input ------------------------------------------------------- */
.file-input { display: block; width: 100%; font-size: var(--fs-xs); color: var(--c-muted); }
.file-input::file-selector-button {
    margin-right: var(--sp-2); padding: 5px 10px; border: 0;
    border-radius: var(--r-sm); font: inherit; font-weight: 650;
    background: var(--c-accent-soft); color: var(--c-accent); cursor: pointer;
}
.file-input::file-selector-button:hover { background: var(--c-accent-line); }

/* ---- a saved-item row in a tool's list -------------------------------- */
.saved-row {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--c-surface-alt); border: 1px solid var(--c-line);
    border-radius: var(--r-sm); padding: 7px 9px;
}
.saved-row:hover { background: var(--c-surface-sunk); }
.saved-row-name {
    background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
    font-family: inherit; font-size: var(--fs-sm); font-weight: 650; color: var(--c-ink);
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.saved-row-name:hover { color: var(--c-accent); }

/* a button confirming it did the thing */
.btn.is-saved { background: var(--c-good); border-color: var(--c-good); color: #fff; }
.proposal-gap { height: var(--sp-6); flex-shrink: 0; }
