/*
 * Growth OS stylesheet.
 *
 * WHY THIS IS HAND-WRITTEN AND NOT COMPILED
 *
 * The previous build used Tailwind through Vite. On shared hosting that meant
 * `node_modules` (50+ packages), a build step, and a generated `public/build`
 * folder — none of which survive re-uploading the project, and all of which
 * must be reproduced on a server that may not have a usable Node.
 *
 * Two separate deployment failures came from exactly that. So there is no
 * build here. This file is served as-is. Deployment is: upload, composer
 * install, migrate.
 *
 * The trade is real: no utility classes, so markup uses semantic class names
 * and this file has to define them. That is a fair price for removing the
 * single most fragile part of the deployment.
 *
 * Custom properties carry the tenant's brand colour, injected per request by
 * BrandingService and re-validated as hex at that point.
 */

/*
 * THEME
 *
 * Colours are defined once as custom properties and switched by a data-theme
 * attribute on <html>. Nothing else in this file references a literal colour,
 * so a theme is a palette swap rather than a second stylesheet.
 *
 * The attribute is written by an inline script in the <head>, BEFORE any
 * painting, which is what prevents the white flash a dark-mode user gets when
 * the page renders light and then corrects itself.
 */

:root,
:root[data-theme="dark"] {
    --brand: #7c5cff;
    --brand-accent: #4dd0e1;

    --bg: #020617;
    --surface: rgba(15, 23, 42, 0.6);
    --surface-solid: #0f172a;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.15);
    --text: #e2e8f0;
    --muted: #94a3b8;
    --dim: #64748b;
    --input-bg: #1e293b;
    --hover: rgba(255, 255, 255, 0.05);
    --active: rgba(255, 255, 255, 0.1);
    /*
     * The sidebar is DARK IN BOTH THEMES, on purpose.
     *
     * It is chrome, not content. Keeping it constant gives the product a fixed
     * point that does not restyle itself when the theme changes, and it lets
     * the content area go properly light without the navigation competing with
     * it. Its own text tokens sit below, because --text follows the theme and
     * would be black-on-black here.
     */
    --sidebar-bg: #0b1220;
    --sidebar-text: #e2e8f0;
    --sidebar-muted: #94a3b8;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: rgba(255, 255, 255, 0.12);
    --sidebar-border: rgba(255, 255, 255, 0.07);

    --shadow: none;
    --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, 0.5);

    --danger: #fb7185;
    --success: #34d399;
    --warning: #fbbf24;
    --info: #7dd3fc;
    --accent-soft: #c4b5fd;

    /* Status TEXT is separate from the status colour: on a dark surface a pale
       tint reads well, on a light one it disappears. */
    --on-success: #a7f3d0;
    --on-danger: #fecdd3;
    --on-warning: #fde68a;
    --on-info: #7dd3fc;
    --on-accent: #c4b5fd;
    --backdrop: rgba(0, 0, 0, 0.6);

    /* Solid, pre-mixed surfaces. Written out per theme rather than computed,
       because color-mix() is unsupported in older browsers and a dropped
       declaration leaves an alert with no background and no text colour. */
    --bg-success: rgba(52, 211, 153, 0.12);
    --bg-danger:  rgba(251, 113, 133, 0.12);
    --bg-warning: rgba(251, 191, 36, 0.12);
    --bg-info:    rgba(56, 189, 248, 0.12);
    --bg-accent:  rgba(167, 139, 250, 0.15);
    --br-success: rgba(52, 211, 153, 0.35);
    --br-danger:  rgba(251, 113, 133, 0.35);
    --br-warning: rgba(251, 191, 36, 0.35);

    --radius: 0.7rem;
    --radius-lg: 1.1rem;

    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #eef2f7;
    --surface: #ffffff;
    --surface-solid: #ffffff;
    --border: rgba(15, 23, 42, 0.12);
    --border-strong: rgba(15, 23, 42, 0.2);
    --text: #0f172a;
    /* Muted text is darkened well past the dark-theme equivalent: the same
       grey that reads as "secondary" on black fails contrast on white. */
    --muted: #475569;
    --dim: #64748b;
    --input-bg: #ffffff;
    --hover: rgba(15, 23, 42, 0.05);
    --active: rgba(15, 23, 42, 0.09);
    /* Unchanged from the dark theme — see the note above. */
    --sidebar-bg: #0b1220;
    --sidebar-text: #e2e8f0;
    --sidebar-muted: #94a3b8;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: rgba(255, 255, 255, 0.12);
    --sidebar-border: rgba(255, 255, 255, 0.07);

    /* Light surfaces need a shadow to read as raised; dark ones do not. */
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px -4px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.18);

    --danger: #dc2626;
    --success: #059669;
    --warning: #b45309;
    --info: #0369a1;
    --accent-soft: #6d28d9;

    /* Darker than the dark-theme equivalents by design — a pale mint or peach
       on white fails contrast badly, and status colour is exactly where that
       matters most. */
    --on-success: #065f46;
    --on-danger: #991b1b;
    --on-warning: #92400e;
    --on-info: #075985;
    --on-accent: #5b21b6;
    --backdrop: rgba(15, 23, 42, 0.4);

    /* Stronger tints than the dark theme. A 12% wash that reads clearly on
       near-black is almost invisible on white, which is why the warning and
       error banners disappeared in light mode. */
    --bg-success: #ecfdf5;
    --bg-danger:  #fef2f2;
    --bg-warning: #fffbeb;
    --bg-info:    #f0f9ff;
    --bg-accent:  #f5f3ff;
    --br-success: #6ee7b7;
    --br-danger:  #fca5a5;
    --br-warning: #fcd34d;

    color-scheme: light;
}

/* Respect the operating system until the user chooses for themselves. */
@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --bg: #eef2f7;
        --surface: #ffffff;
        --surface-solid: #ffffff;
        --border: rgba(15, 23, 42, 0.12);
        --border-strong: rgba(15, 23, 42, 0.2);
        --text: #0f172a;
        --muted: #475569;
        --dim: #64748b;
        --input-bg: #ffffff;
        --hover: rgba(15, 23, 42, 0.05);
        --active: rgba(15, 23, 42, 0.09);
        --sidebar-bg: #0b1220;
        --sidebar-text: #e2e8f0;
        --sidebar-muted: #94a3b8;
        --sidebar-hover: rgba(255, 255, 255, 0.06);
        --sidebar-active: rgba(255, 255, 255, 0.12);
        --sidebar-border: rgba(255, 255, 255, 0.07);
        --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px -4px rgba(15, 23, 42, 0.08);
        --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.18);
        --danger: #dc2626;
        --success: #059669;
        --warning: #b45309;
        --info: #0369a1;
        --accent-soft: #6d28d9;
        --on-success: #065f46;
        --on-danger: #991b1b;
        --on-warning: #92400e;
        --on-info: #075985;
        --on-accent: #5b21b6;
        --backdrop: rgba(15, 23, 42, 0.4);
        --bg-success: #ecfdf5;
        --bg-danger:  #fef2f2;
        --bg-warning: #fffbeb;
        --bg-info:    #f0f9ff;
        --bg-accent:  #f5f3ff;
        --br-success: #6ee7b7;
        --br-danger:  #fca5a5;
        --br-warning: #fcd34d;
        color-scheme: light;
    }
}

*, *::before, *::after { box-sizing: border-box; }

/*
 * RESTORES THE BROWSER'S OWN `hidden` BEHAVIOUR.
 *
 * `[hidden] { display: none }` lives in the browser's default stylesheet, and
 * any author rule that sets `display` on the same element overrides it —
 * `[hidden]` and a class selector have identical specificity, and the author
 * sheet wins ties against the user-agent sheet.
 *
 * `.modal-backdrop { display: grid }` therefore beat `hidden`, and EVERY
 * dialog on the page rendered at once, stacked, with no way to dismiss any of
 * them. The JavaScript was setting `hidden` correctly the whole time; the
 * element simply ignored it.
 *
 * `!important` is warranted here in a way it rarely is: this is not winning an
 * argument with another rule, it is reinstating a browser default that author
 * styles are silently allowed to break. Applying it once means no future
 * component can reintroduce the same fault by setting `display`.
 */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    /* Never let a stray wide child scroll the whole document sideways.
       Wide content scrolls inside its own container instead. */
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* Hidden until Alpine initialises, or the mobile drawer flashes open on load. */
[x-cloak] { display: none !important; }

/* ---------------------------------------------------------------- layout - */

.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 15.5rem;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
}

/* Below this width the sidebar is replaced by the off-canvas drawer. */
@media (max-width: 1023px) { .sidebar { display: none; } }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 1rem; }
@media (min-width: 640px) { .content { padding: 1.5rem; } }
@media (min-width: 1024px) { .content { padding: 2rem; } }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}
@media (min-width: 640px) { .topbar { padding: 0.75rem 1.5rem; } }

.guest-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}
.guest-box { width: 100%; max-width: 26rem; }

/* ------------------------------------------------------------ components - */

.card {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1rem;
}
@media (min-width: 640px) { .card { padding: 1.5rem; } }

/*
 * One rule for section spacing.
 *
 * `.card + .card` only spaced ADJACENT siblings, so a card following a grid,
 * a form or an alert had no gap at all — which is why the pages looked
 * unevenly spaced. Margin on every card, removed inside grids where the grid
 * gap already handles it.
 */
.card { margin-bottom: 1.5rem; }
.card:last-child { margin-bottom: 0; }

/*
 * Cards inside a grid stretch to the tallest in the row.
 *
 * Grid items stretch by default, but only the item itself — a card with less
 * content still ended shorter than its neighbour. height:100% plus a column
 * flex makes every card in a row end level, with its action pinned to the
 * bottom rather than floating mid-card.
 */
.grid > .card {
    margin-bottom: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.grid > .card > .btn-row:last-child,
.grid > .card > form:last-child,
.grid > .card > a.btn-primary:last-child,
.grid > .card > a.btn-ghost:last-child { margin-top: auto; }
.card-title { margin: 0 0 0.25rem; font-size: 1rem; font-weight: 600; }
/* A title that is not the first child still needs air above it. */
.card > .card-title:not(:first-child) { margin-top: 1.25rem; }
.card-sub { margin: 0 0 1rem; font-size: 0.85rem; color: var(--muted); }

h1 { font-size: 1.35rem; font-weight: 700; margin: 0 0 0.35rem; }
@media (min-width: 640px) { h1 { font-size: 1.6rem; } }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 0.5rem; }

.lede { color: var(--muted); font-size: 0.9rem; margin: 0 0 1.5rem; }
.muted { color: var(--muted); }
.dim { color: var(--dim); font-size: 0.8rem; }
.right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- forms -- */

.label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.field {
    display: block;
    width: 100%;
    padding: 0.7rem 0.9rem;
    /* 16px on small screens is not cosmetic: iOS Safari zooms the viewport
       when a focused input is smaller, stranding the user zoomed in. */
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
@media (min-width: 640px) { .field { font-size: 0.9rem; padding: 0.6rem 0.9rem; } }

.field:focus {
    outline: none;
    border-color: transparent;
    box-shadow: 0 0 0 2px var(--brand);
}
.field::placeholder { color: var(--dim); }
textarea.field { min-height: 6rem; resize: vertical; }

.field-group { margin-bottom: 0.9rem; }
.hint { font-size: 0.78rem; color: var(--dim); margin-top: 0.3rem; }
.error { font-size: 0.82rem; color: var(--danger); margin-top: 0.3rem; }
.stat-value, h1, h2, h3, strong { color: var(--text); }

.grid { display: grid; gap: 1rem; align-items: stretch; }
.grid + .card, .grid + .grid { margin-top: 1.5rem; }
@media (min-width: 640px) { .grid { gap: 1.25rem; } }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 640px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.span-2 { grid-column: 1 / -1; }

/* --------------------------------------------------------------- buttons - */

.btn, .btn-primary, .btn-ghost, .btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    /* ~44px: the minimum comfortable touch target. */
    min-height: 2.75rem;
    padding: 0.55rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.btn:disabled, .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }

.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--hover); }

.btn-danger { background: transparent; border-color: rgba(251,113,133,0.4); color: var(--danger); }
.btn-danger:hover { background: var(--bg-danger); }

.btn-sm { min-height: 2rem; padding: 0.3rem 0.75rem; font-size: 0.78rem; }
.btn-block { width: 100%; }
@media (min-width: 640px) { .btn-auto-sm { width: auto; } }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---------------------------------------------------------------- badges - */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
    background: var(--hover);
    color: var(--muted);
}
.badge-draft { background: var(--hover); color: var(--muted); }
.badge-review { background: var(--bg-warning); color: var(--on-warning); }
.badge-approved { background: var(--bg-success); color: var(--on-success); }
.badge-scheduled { background: var(--bg-info); color: var(--on-info); }
.badge-published { background: var(--bg-accent); color: var(--on-accent); }
.badge-rejected { background: var(--bg-danger); color: var(--on-danger); }
.badge-ai { background: var(--bg-accent); color: var(--on-accent); }
.badge-template { background: var(--hover); color: var(--muted); }

/* ----------------------------------------------------------------- lists - */

.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.row:last-child { border-bottom: none; }

.nav { padding: 0 0.7rem; flex: 1; overflow-y: auto; }
.nav .dim, .nav p { color: var(--sidebar-muted); }
.nav a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.15rem;
    border-radius: 0.6rem;
    font-size: 0.88rem;
    color: var(--sidebar-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
.nav a.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}
.nav-section { margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--sidebar-border); }

/* ---------------------------------------------------------------- tables - */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 34rem; }
th { text-align: left; padding-bottom: 0.6rem; font-size: 0.72rem; text-transform: uppercase;
     letter-spacing: 0.05em; color: var(--dim); font-weight: 500; }
td { padding: 0.7rem 0.5rem 0.7rem 0; border-top: 1px solid var(--border); }

/* ---------------------------------------------------------------- alerts - */

.alert { padding: 0.85rem 1rem; border-radius: var(--radius); font-size: 0.88rem; margin-bottom: 1.25rem; }
.alert-success { background: var(--bg-success); border: 1px solid var(--br-success); color: var(--on-success); }
.alert-error   { background: var(--bg-danger);  border: 1px solid var(--br-danger);  color: var(--on-danger); }
.alert-warning { background: var(--bg-warning); border: 1px solid var(--br-warning); color: var(--on-warning); }
.alert-info    { background: var(--hover);border: 1px solid var(--border);         color: var(--muted); }

/* ------------------------------------------------------------ empty state - */

.empty { text-align: center; padding: 3rem 1rem; }
.empty h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.empty p { margin: 0 auto; max-width: 26rem; color: var(--muted); font-size: 0.88rem; }

/* ------------------------------------------------------------- progress -- */

.bar { height: 0.5rem; background: var(--active); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

.stat-value { font-size: 1.5rem; font-weight: 700; margin: 0.15rem 0; }
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }

/* --------------------------------------------------------- mobile drawer - */

.hamburger {
    display: grid;
    place-items: center;
    width: 2.5rem; height: 2.5rem;
    background: none; border: none; cursor: pointer;
    color: var(--muted); border-radius: 0.5rem;
}
.hamburger:hover { background: var(--hover); }
@media (min-width: 1024px) { .hamburger, .drawer, .drawer-backdrop { display: none !important; } }

.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: var(--backdrop); }
.drawer {
    position: fixed; inset: 0 auto 0 0; z-index: 50;
    width: 18rem; max-width: 85vw;
    overflow-y: auto;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding-bottom: 2rem;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; }

/* ------------------------------------------------------------- calendar -- */

.cal { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 1px; min-width: 40rem; }
.cal-head { text-align: center; font-size: 0.7rem; text-transform: uppercase; color: var(--dim); padding-bottom: 0.5rem; }
.cal-day { min-height: 5rem; border: 1px solid var(--border); border-radius: 0.5rem; padding: 0.35rem; font-size: 0.75rem; }
.cal-day.other { opacity: 0.4; }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--brand); }
.cal-item { display: block; margin-top: 0.25rem; padding: 0.2rem 0.35rem; border-radius: 0.25rem;
            background: var(--hover); overflow: hidden; text-overflow: ellipsis;
            white-space: nowrap; text-decoration: none; }

/* --------------------------------------------------------------- utility - */

.flex { display: flex; gap: 0.5rem; }
.flex-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { align-items: center; }
.col { flex-direction: column; }
.mt { margin-top: 1rem; }
.mt-sm { margin-top: 0.5rem; }
.mb { margin-bottom: 1rem; }
.min-w-0 { min-width: 0; }
.grow { flex: 1; }
.shrink-0 { flex-shrink: 0; }
.hide-sm { display: none; }
@media (min-width: 640px) { .hide-sm { display: inline; } }

/* ---------------------------------------------------------- theme toggle - */

.theme-toggle {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.theme-toggle:hover { background: var(--hover); color: var(--text); }

/* Only one icon is ever visible; the other is removed from the layout so it
   cannot be read out by a screen reader or picked up by a text selection. */
:root[data-theme="light"] .theme-toggle .icon-moon,
:root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }

@media (prefers-color-scheme: light) {
    :root:not([data-theme]) .theme-toggle .icon-moon { display: none; }
    :root:not([data-theme]) .theme-toggle .icon-sun { display: block; }
}

/* ------------------------------------------------------- layout polish -- */

/* Stat blocks in a row align on their numbers even when a label wraps. */
.grid > div > .stat-label { min-height: 1.6em; }

/* A row of buttons should never sit flush against the text above it. */
.card > .btn-row { margin-top: 1rem; }

/* Tables and lists inside a card need breathing room from the heading. */
.card > .table-scroll { margin-top: 0.75rem; }

/* The last row in a card should not add a border the card already provides. */
.card > .row:last-of-type { border-bottom: none; padding-bottom: 0; }

/* Empty states are vertically centred in their card so a short one does not
   sit awkwardly at the top of a tall grid cell. */
.grid > .card > .empty { margin: auto 0; }

/* Forms inside a grid card fill the available height, so the submit button
   lines up with its neighbour's. */
.grid > .card > form { display: flex; flex-direction: column; flex: 1; }
.grid > .card > form > button:last-child { margin-top: auto; }

/* --------------------------------------------------------- sidebar head - */

/*
 * Shared by both sidebars. Previously the admin console styled this inline,
 * which meant it drifted from the tenant app and ignored the theme tokens.
 */
.sidebar-head {
    padding: 1.25rem 1.25rem 0.5rem;
}
.sidebar-head strong { display: block; color: #fff; font-size: 1rem; }

/* The tenant app's own sidebar header uses the same spacing. */
.sidebar > div:first-child { padding: 1.35rem 1.15rem 0.9rem; }

/* Admin tables are wide; let them scroll inside the card rather than pushing
   the page sideways. */
.card > .table-scroll table { min-width: 32rem; }

/* ------------------------------------------------------------ nav icons - */

.nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
.nav a.active svg { opacity: 1; }

/* The sidebar keeps its own text colours, so buttons inside it must too —
   otherwise a ghost button renders dark-on-dark in light mode. */
.sidebar .btn-ghost,
.drawer .btn-ghost {
    color: var(--sidebar-muted);
    border-color: var(--sidebar-border);
}
.sidebar .btn-ghost:hover,
.drawer .btn-ghost:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }

.drawer { background: var(--sidebar-bg); color: var(--sidebar-text); border-right: none; }
.drawer-head { border-bottom: 1px solid var(--sidebar-border); }
.drawer-head strong { color: #fff; }

/* ------------------------------------------------------------- surfaces - */

.card {
    box-shadow: var(--shadow);
    /* A hairline border in light mode; in dark the surface tint is enough. */
    border-radius: var(--radius-lg);
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.content { background: var(--bg); }

/* --------------------------------------------------------- profile menu - */

.avatar {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    text-transform: uppercase;
}
.avatar:hover { filter: brightness(1.1); }

.menu-wrap { position: relative; }

.menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    z-index: 60;
    min-width: 13rem;
    padding: 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.menu-head {
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.3rem;
}
.menu-head strong { display: block; font-size: 0.88rem; }

.menu a,
.menu button {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: none;
    border-radius: 0.5rem;
    background: none;
    font: inherit;
    font-size: 0.87rem;
    color: var(--text);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--hover); }
.menu svg { width: 16px; height: 16px; opacity: 0.7; }

/*
 * Sign out is tinted, not shouted.
 *
 * A solid red button reads as "danger — you will lose something", which is
 * wrong for an action every user takes daily. The soft tint marks it as
 * distinct from the neutral items without implying consequence.
 */
.menu .menu-danger { color: var(--danger); }
.menu .menu-danger:hover { background: var(--bg-danger); }

.menu-divider { height: 1px; background: var(--border); margin: 0.3rem 0; }

/* -------------------------------------------------- collapsible sidebar - */

/*
 * Collapsed state stores only a class on <html>, set before paint by the same
 * inline script that handles the theme — so a collapsed sidebar does not
 * animate open on every page load.
 */
:root[data-sidebar="collapsed"] .sidebar { width: 4.2rem; }
:root[data-sidebar="collapsed"] .sidebar .nav a span,
:root[data-sidebar="collapsed"] .sidebar .nav .badge,
:root[data-sidebar="collapsed"] .sidebar-head p,
:root[data-sidebar="collapsed"] .sidebar-head strong { display: none; }
:root[data-sidebar="collapsed"] .sidebar .nav a { justify-content: center; padding: 0.6rem; }
:root[data-sidebar="collapsed"] .sidebar-head { padding: 1.35rem 0.5rem 0.9rem; text-align: center; }



/* Only offered where there is a sidebar to collapse. */
@media (min-width: 1024px) {  }



/* --------------------------------------------------------- guest screens - */

.guest-box .card { box-shadow: var(--shadow-lg); }

/* ------------------------------------------------------------- branding - */

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: #fff;
    min-width: 0;
}

.brand-logo { height: 26px; max-width: 100%; object-fit: contain; }

/* Stands in for a logo that has not been uploaded yet. */
.brand-mark {
    display: grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    flex-shrink: 0;
    border-radius: 0.55rem;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    text-transform: uppercase;
}

.brand-name {
    font-weight: 700;
    font-size: 0.98rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ------------------------------------------------------ workspace switch - */

.workspace-switch { padding: 0 0.7rem 0.9rem; }

.workspace-btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--sidebar-border);
    border-radius: 0.6rem;
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
}
.workspace-btn:hover { background: var(--sidebar-active); }

.workspace-mark {
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    border-radius: 0.4rem;
    background: var(--brand);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.workspace-name { flex: 1; min-width: 0; }
.workspace-caret { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.6; }

/* The switcher menu opens over the content, not inside the narrow sidebar. */
.workspace-switch .menu { left: 0; right: auto; min-width: 15rem; }

/* --------------------------------------------------- sidebar edge toggle - */

/*
 * Straddles the sidebar boundary, as in the reference. Positioned against the
 * app container rather than the sidebar so it stays put while the sidebar
 * animates, which stops it drifting mid-transition.
 */
.sidebar-edge-toggle {
    display: none;
    position: fixed;
    top: 4.6rem;
    left: 15.5rem;
    transform: translateX(-50%);
    z-index: 30;
    width: 1.6rem;
    height: 1.6rem;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: left 0.2s;
}
.sidebar-edge-toggle:hover { color: var(--text); }
.sidebar-edge-toggle svg { width: 12px; height: 12px; }

@media (min-width: 1024px) { .sidebar-edge-toggle { display: grid; } }

:root[data-sidebar="collapsed"] .sidebar-edge-toggle { left: 4.2rem; }
:root[data-sidebar="collapsed"] .sidebar-edge-toggle svg { transform: rotate(180deg); }

.sidebar { transition: width 0.2s; }

/* Collapsed: brand name and workspace label give way to the marks. */
:root[data-sidebar="collapsed"] .brand-name,
:root[data-sidebar="collapsed"] .workspace-name,
:root[data-sidebar="collapsed"] .workspace-caret { display: none; }
:root[data-sidebar="collapsed"] .workspace-btn { justify-content: center; padding: 0.5rem; }
:root[data-sidebar="collapsed"] .workspace-switch { padding: 0 0.5rem 0.9rem; }
:root[data-sidebar="collapsed"] .brand { justify-content: center; }
:root[data-sidebar="collapsed"] .brand-logo { height: 22px; }

/* --------------------------------------------------------- page headers - */

/*
 * The reference pairs a title with a subtitle and puts actions on the right.
 * A shared class beats each page inventing its own arrangement.
 */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.page-head h1 { margin: 0; }
.page-head .lede { margin: 0.2rem 0 0; }

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}
.card-head .card-title, .card-head .card-sub { margin: 0; }

/* ============================================================== dashboard = */

/*
 * The reference pairs a large greeting with a quiet subtitle, then a grid of
 * cards each carrying a title, a small info marker and a corner action. These
 * classes exist so pages stop inventing that arrangement individually.
 */

.greeting { font-size: 1.75rem; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
@media (max-width: 640px) { .greeting { font-size: 1.35rem; } }
.greeting-sub { color: var(--muted); font-size: .88rem; margin: .25rem 0 0; }

/* A card title with an info dot and a corner link, as in the reference. */
.card-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: 1rem;
}
.card-head-row .card-title { margin: 0; display: flex; align-items: center; gap: .4rem; }

.info-dot {
    display: inline-grid;
    place-items: center;
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    color: var(--dim);
    font-size: 9px;
    font-weight: 700;
    cursor: help;
}

.card-action {
    display: grid;
    place-items: center;
    width: 1.8rem; height: 1.8rem;
    border-radius: 0.5rem;
    color: var(--dim);
    text-decoration: none;
    flex-shrink: 0;
}
.card-action:hover { background: var(--hover); color: var(--text); }
.card-action svg { width: 15px; height: 15px; }

/* ---- score ring ---------------------------------------------------------
   An SVG ring rather than a bar: the reference uses one, and it reads as a
   single figure at a glance where a bar reads as progress toward a deadline. */

.ring-wrap { display: flex; align-items: center; justify-content: center; padding: .5rem 0 1rem; }
.ring { position: relative; width: 190px; height: 190px; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--active); stroke-width: 14; }
.ring-value { fill: none; stroke: var(--brand); stroke-width: 14; stroke-linecap: round;
              transition: stroke-dasharray .6s ease; }
.ring-centre {
    position: absolute; inset: 0;
    display: grid; place-content: center; text-align: center;
}
.ring-number { font-size: 2.4rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.ring-label { font-size: .75rem; color: var(--muted); margin-top: .3rem; }

/* ---- labelled progress rows (the "Team Performance" pattern) ------------ */

.meter { margin-bottom: .85rem; }
.meter:last-child { margin-bottom: 0; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.meter-name { font-size: .85rem; }
.meter-value { font-size: .85rem; font-weight: 700; }
.meter-track { height: .5rem; background: var(--active); border-radius: 999px; margin-top: .35rem; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--brand); }
.meter-fill.warm { background: var(--warning); }
.meter-fill.good { background: var(--success); }

/* ---- compact statistic tiles ------------------------------------------- */

.tile { display: flex; flex-direction: column; gap: .15rem; }
.tile-value { font-size: 1.75rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.tile-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); }
.tile-note { font-size: .78rem; color: var(--muted); }

/* A card whose whole surface is the brand colour, for the one figure that
   should draw the eye first. */
.card-accent {
    background: var(--brand);
    border-color: transparent;
    color: #fff;
}
.card-accent .card-title,
.card-accent .tile-value,
.card-accent strong { color: #fff; }
.card-accent .card-sub,
.card-accent .tile-label,
.card-accent .tile-note,
.card-accent .dim { color: rgba(255,255,255,.75); }
.card-accent .meter-track { background: rgba(255,255,255,.25); }
.card-accent .meter-fill { background: #fff; }
.card-accent .card-action { color: rgba(255,255,255,.8); }
.card-accent .card-action:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ---- footnote under a card --------------------------------------------- */

.card-note {
    margin: 1rem -1rem -1rem;
    padding: .75rem 1rem;
    border-top: 1px solid var(--border);
    font-size: .8rem;
    color: var(--muted);
    background: var(--hover);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
@media (min-width: 640px) { .card-note { margin: 1.25rem -1.5rem -1.5rem; padding: .85rem 1.5rem; } }

/* ------------------------------------------------- password visibility - */

.password-field { position: relative; }

/* Right padding so text never runs under the button. */
.password-field .field { padding-right: 2.9rem; }

.password-peek {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.4rem;
    background: none;
    color: var(--dim);
    cursor: pointer;
}
.password-peek:hover { color: var(--text); background: var(--hover); }
.password-peek svg { width: 17px; height: 17px; }

/* One icon at a time; the other is removed from the layout entirely so it is
   not read out by a screen reader or caught by a text selection. */
.password-peek .icon-eye-off { display: none; }
.password-peek[aria-pressed="true"] .icon-eye { display: none; }
.password-peek[aria-pressed="true"] .icon-eye-off { display: block; }

/* ================================================================= modal = */

/*
 * Closed by the `hidden` attribute, not a class, so a dialog is closed before
 * any JavaScript runs and cannot flash open on load.
 */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: var(--backdrop);
    display: grid;
    place-items: center;
    padding: 1rem;
    /*
     * The BACKDROP does not scroll; the dialog does. Scrolling the backdrop
     * moves the whole dialog, taking its close button off screen with it — at
     * which point the page genuinely is stuck.
     */
    overflow: hidden;
}

.modal {
    width: 100%;
    max-width: 46rem;
    /* Bounded so the dialog never exceeds the viewport, whatever it holds. */
    max-height: min(90vh, 48rem);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    /* Never scrolls away — the close button must always be reachable. */
    flex-shrink: 0;
}
.modal-head h2 { margin: 0; font-size: 1.05rem; }
.modal-head .dim { font-size: .85rem; }

.modal-body {
    padding: 1.25rem 1.5rem;
    /* The only scrolling region, so the header and its close button stay put. */
    overflow-y: auto;
    flex: 1;
}

.modal-close {
    display: grid;
    place-items: center;
    width: 2rem; height: 2rem;
    flex-shrink: 0;
    border: none;
    border-radius: .5rem;
    background: none;
    color: var(--muted);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}
.modal-close:hover { background: var(--hover); color: var(--text); }

/* A titled block inside the dialog, so four separate actions do not read as
   one long form. */
.modal-section { padding-bottom: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.modal-section:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: none; }
.modal-section h3 { margin: 0 0 .2rem; font-size: .92rem; }
.modal-section .dim { font-size: .82rem; margin: 0 0 .7rem; }

/* --------------------------------------------------------- clickable row - */

.list-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    padding: .8rem .25rem;
    border: none;
    border-bottom: 1px solid var(--border);
    background: none;
    font: inherit;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--hover); }

.list-avatar {
    display: grid;
    place-items: center;
    width: 2.2rem; height: 2.2rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* ---- social post preview ------------------------------------------------
   How the post will look once published. Built from the existing tokens so it
   follows light and dark without a second set of rules, and deliberately not a
   pixel copy of any platform's chrome — an imitation that is close but wrong
   is more misleading than an honest approximation.                          */

.sp {
    border: 1px solid var(--border-strong);
    border-radius: .9rem;
    background: var(--surface-solid);
    overflow: hidden;
    max-width: 30rem;
}

.sp-head { display: flex; align-items: center; gap: .6rem; padding: .75rem .85rem; }

.sp-avatar {
    width: 2.25rem; height: 2.25rem; flex: 0 0 auto;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .95rem;
}

.sp-name { font-weight: 700; font-size: .9rem; line-height: 1.2; }
.sp-meta { font-size: .75rem; color: var(--dim); margin-top: .1rem; }

.sp-media { display: block; width: 100%; height: auto; background: var(--input-bg); }
/* The image's own shape (square, portrait or landscape): never cropped. Only the empty placeholder is square. */
.sp-media-empty { aspect-ratio: 1 / 1; }

.sp-media-empty {
    display: flex; align-items: center; justify-content: center;
    color: var(--dim); font-size: .8rem;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.sp-body { padding: .85rem; }

/* pre-wrap: the composed text carries real line breaks, and collapsing them
   would show the customer a preview with different spacing to the post. */
.sp-text { margin: 0; font-size: .9rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

.sp-hidden { color: var(--dim); }

.sp-more { margin: .6rem 0 0; font-size: .75rem; color: var(--dim); }

.sp-foot {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .7rem .85rem;
    border-top: 1px solid var(--border);
}

.sp-count { font-size: .75rem; color: var(--dim); }

/* Off-screen rather than display:none — a hidden textarea cannot be read by
   the clipboard fallback in browsers without the async clipboard API. */
.sp-source {
    position: absolute; left: -9999px; top: 0;
    width: 1px; height: 1px; opacity: 0; border: 0; padding: 0;
}

/* Sub-heading inside a card — used by the video script panel to separate the
   voiceover from the scene breakdown without starting a second card. */
.card-subtitle {
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--dim);
    margin: 0 0 .4rem;
}

/* ---- progress for slow AI actions ---------------------------------------
   Shown inside the form that started the work, not as a page overlay: the
   person can still read the rest of the page while they wait, and it is
   obvious which action is running when two are on screen.                  */

.prog { margin-top: .9rem; }

.prog-track {
    height: 4px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.prog-fill {
    height: 100%;
    width: 4%;
    border-radius: 999px;
    background: var(--brand);
    /* Matches the JS tick, so the bar glides rather than stepping. */
    transition: width .32s linear;
}

.prog-label {
    margin: .45rem 0 0;
    font-size: .8rem;
    color: var(--dim);
}

.prog-failed .prog-fill { background: var(--danger, #b3261e); }

@media (prefers-reduced-motion: reduce) {
    .prog-fill { transition: none; }
}

/* ---- download control on an image ---------------------------------------
   Sits on the picture rather than beside it, so it reads as an action on the
   image and not on the post. Always visible on touch devices — a control that
   only appears on hover does not exist on a phone.                          */

.media-frame { position: relative; display: block; line-height: 0; }

.media-frame img { max-width: 100%; border-radius: .7rem; }

.media-download {
    position: absolute;
    top: .55rem;
    right: .55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: .5rem;
    /* Its own dark chip rather than a theme colour: it sits on a photograph
       whose colours are unknown, so it has to carry its own contrast. */
    background: rgba(17, 17, 17, .62);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .22);
    backdrop-filter: blur(3px);
    opacity: .82;
    transition: opacity .15s ease, background .15s ease;
}

.media-download:hover,
.media-download:focus-visible { opacity: 1; background: rgba(17, 17, 17, .82); }

.media-download svg { width: 1rem; height: 1rem; }

@media (prefers-reduced-motion: reduce) {
    .media-download { transition: none; }
}

/* ---- Business Brain and setup wizard ------------------------------------ */
.plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.check-row { display: flex; gap: 0.5rem; align-items: center; padding: 0.2rem 0; }
.gap-sm { gap: 0.5rem; }
.range { width: 100%; }
.swatches { gap: 0.35rem; }
.swatch {
    display: inline-block; width: 1.25rem; height: 1.25rem;
    border-radius: 4px; border: 1px solid var(--border-strong);
}
.brain-item { display: block; }
.brain-item > summary, details > summary.btn-ghost { cursor: pointer; }
details > summary.btn-ghost { display: inline-block; }
.facts { margin: 0; }
.facts .row { align-items: flex-start; justify-content: flex-start; gap: 1rem; }
.facts dt { min-width: 12rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
    .facts .row { flex-direction: column; gap: 0.15rem; }
    .facts dt { min-width: 0; }
}

/* ---- Data Vault --------------------------------------------------------- */
.vault-card { padding: 0.6rem; }
.vault-thumb {
    display: block; width: 100%; aspect-ratio: 1; object-fit: cover;
    border-radius: 0.5rem; background: var(--active);
}
.vault-name { margin: 0.4rem 0 0.2rem; font-size: 0.85rem; }
.vault-learned { padding: 0.75rem 0; border-top: 1px solid var(--border); }
.vault-learned:first-of-type { border-top: 0; }
.vault-learned .row p { margin: 0.25rem 0 0; }

/* ---- AI Business Assistant ---------------------------------------------- */
.assistant { display: grid; gap: 1rem; }
@media (min-width: 900px) { .assistant { grid-template-columns: 16rem 1fr; align-items: start; } }
.assistant-list { display: flex; flex-direction: column; gap: 0.25rem; }
.assistant-list .btn-block { margin-bottom: 0.5rem; }
@media (max-width: 899px) { .assistant-list { max-height: 12rem; overflow-y: auto; } }
.assistant-thread {
    display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.45rem 0.6rem;
    border-radius: 0.5rem; color: inherit; text-decoration: none; font-size: 0.875rem; min-width: 0;
}
.assistant-thread:hover, .assistant-thread.active { background: var(--active); }
.assistant-chat { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.assistant-messages { display: flex; flex-direction: column; gap: 0.75rem; }
.bubble { max-width: 46rem; padding: 0.75rem 0.9rem; border-radius: 0.8rem; border: 1px solid var(--border); }
.bubble-user { align-self: flex-end; background: var(--active); }
.bubble-assistant { align-self: flex-start; }
.bubble-who { display: block; font-size: 0.75rem; font-weight: 600; opacity: 0.7; margin-bottom: 0.25rem; }
.bubble-text { overflow-wrap: anywhere; line-height: 1.55; }
.bubble-sources { margin-top: 0.5rem; font-size: 0.85rem; }
.bubble-sources summary { cursor: pointer; }
.bubble-sources ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.assistant-composer { border-top: 1px solid var(--border); padding-top: 1rem; }

/* The floating "Ask AI" button on every app page (spec section 23). */
.ask-ai-fab {
    position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 40;
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.7rem 1.1rem; border-radius: 999px;
    background: var(--brand); color: #fff; font-weight: 600; text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.ask-ai-fab:hover, .ask-ai-fab:focus-visible { filter: brightness(1.08); }
@media print { .ask-ai-fab { display: none; } }
.assistant-thread .dim { flex-shrink: 0; white-space: nowrap; font-size: 0.75rem; }

/* ---- Video package ------------------------------------------------------ */
.vp-checklist { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; margin: 0 0 1rem; padding: 0; list-style: none; font-size: 0.85rem; }
.vp-checklist li { color: var(--good, #0f9d58); }
.vp-block { margin-top: 1rem; }
.vp-block .card-subtitle { margin: 0; }
.vp-text {
    margin: 0.4rem 0 0; padding: 0.6rem 0.75rem; border-radius: 0.5rem; background: var(--active);
    white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 0.875rem; line-height: 1.5;
}
.vp-hidden { display: none; }
.vp-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; min-width: 52rem; }
.vp-table th, .vp-table td { text-align: left; vertical-align: top; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); }
.vp-table th { font-weight: 600; white-space: nowrap; }
.vp-scene { border-top: 1px solid var(--border); padding: 0.5rem 0; }
.vp-scene summary { cursor: pointer; display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.vp-scene .btn-ghost { margin-top: 0.4rem; }
/* The wide storyboard scrolls inside its card instead of widening the page:
   grid and flex children default to min-width:auto, which lets a wide table
   push the whole column out. */
.grid > div, .grid > .card, .card { min-width: 0; }
.vp-block .table-scroll { max-width: 100%; overflow-x: auto; }

/* ---- Notification centre ------------------------------------------------ */
.notify-bell { position: relative; display: inline-flex; padding: 0.45rem; border-radius: 0.5rem; color: inherit; }
.notify-bell:hover, .notify-bell:focus-visible { background: var(--active); }
.notify-count {
    position: absolute; top: 0; right: 0; min-width: 1.1rem; height: 1.1rem; padding: 0 0.25rem;
    border-radius: 999px; background: var(--brand); color: #fff; font-size: 0.65rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.notify-row { color: inherit; text-decoration: none; }
.notify-row.unread { font-weight: 600; }
.notify-row .badge { margin-right: 0.35rem; }

/* ---- Campaign stage tracker --------------------------------------------- */
.stage-track { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.stage-track li {
    padding: 0.3rem 0.65rem; border-radius: 999px; font-size: 0.8rem;
    border: 1px solid var(--border); opacity: 0.55;
}
.stage-track li.done { opacity: 1; }
.stage-track li.current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---- Opportunities and brief ---- */
.opp { padding: 0.9rem 0; border-top: 1px solid var(--border); }
.opp:first-of-type { border-top: 0; }
.opp summary { cursor: pointer; }
.brief-list { margin: 0.25rem 0 0.75rem; padding-left: 1.1rem; }

/* ---- Calendar views and drag and drop ---- */
.cal-week .cal-day { min-height: 14rem; }
.cal-item[draggable="true"] { cursor: grab; }
.cal-item.dragging { opacity: 0.5; }
.cal-item.planned { border: 1px dashed var(--border-strong); background: transparent; }
.cal-item-full { white-space: normal; }
.cal-meta { display: block; font-size: 0.7rem; opacity: 0.8; margin-top: 0.15rem; }
.cal-time { font-weight: 600; }
.cal-day.drop-target { box-shadow: inset 0 0 0 2px var(--brand); }

/* ---- Mobile bottom navigation (UI spec section 13) ----------------------- */
.bottom-nav { display: none; }
@media (max-width: 1023px) {
    .bottom-nav {
        display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
        background: var(--surface-solid, #fff); border-top: 1px solid var(--border);
        padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom));
    }
    .bottom-nav a, .bottom-nav button {
        display: flex; flex-direction: column; align-items: center; gap: 0.15rem; padding: 0.3rem 0;
        font-size: 0.7rem; color: inherit; text-decoration: none; background: none; border: 0; cursor: pointer; opacity: 0.75;
    }
    .bottom-nav .active { opacity: 1; color: var(--brand); font-weight: 600; }
    /* The shared icon component has no intrinsic size (the sidebar sizes it),
       so without this the icons filled the whole bar. */
    .bottom-nav svg { width: 22px; height: 22px; flex-shrink: 0; }
    .content { padding-bottom: 5.5rem; }
    /* The bottom bar has Ask AI, so the floating button would cover content. */
    .ask-ai-fab { display: none; }
}
/* A one-button form inside a line of text (banners). */
.inline-form { display: inline; margin-left: .4rem; }

/* ------------------------------------------------- content item: layout - */
/* Main column (tabs) and a side column (preview, image studio, status).
   The tall, occasional sections live in tabs so the two columns stay even. */
.item-layout { display: grid; gap: 1.25rem; align-items: start; }
@media (min-width: 1100px) {
    .item-layout { grid-template-columns: minmax(0, 1.45fr) minmax(340px, 1fr); }
}
.item-side > .card, .item-main .tab-panel > .card { margin-bottom: 1.25rem; }

.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    padding: 0.3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex: 1 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.4rem;
    padding: 0.45rem 0.9rem;
    border: 0;
    border-radius: calc(var(--radius) - 0.2rem);
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.tab:hover { background: var(--hover); color: var(--text); }
.tab[aria-selected="true"] { background: var(--active); color: var(--text); box-shadow: inset 0 -2px 0 var(--brand); }
.tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.tab-count {
    min-width: 1.6rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--hover);
    color: var(--danger);
}
.tab-count.good { color: var(--success); }
.tab-count.warm { color: var(--warning); }
.tab-panel[hidden] { display: none; }

.form-row-2 { display: grid; gap: 0 0.85rem; }
@media (min-width: 640px) { .form-row-2 { grid-template-columns: 1fr 1fr; } }
.inline-controls { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.inline-controls .field { width: auto; min-width: 9rem; }
.divider-top { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.mb-sm { margin-bottom: 0.6rem; }
.mb-0 { margin-bottom: 0; }
.m-0-top { margin: 0.15rem 0 0; }

.image-advanced { margin: 0.6rem 0 1rem; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.55rem 0.8rem; }
.image-advanced > summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); }
.image-advanced[open] > summary { margin-bottom: 0.6rem; color: var(--text); }
.image-advanced .field-group:last-child { margin-bottom: 0.2rem; }
#image .check-row { font-size: 0.85rem; color: var(--muted); }
#image .btn-block { margin-top: 0.25rem; }

/* =========================================================================
 * DESIGN SYSTEM v2 (2026-10)
 *
 * One layer, appended last, so it restyles every page through the shared
 * tokens and component classes without touching a template. Principles:
 * one type scale (Inter, 12/13/14/16/22), one 4px spacing grid, one radius
 * scale, one floating shadow, quiet surfaces and a single strong accent
 * (the workspace brand colour, --brand). Delete this block to return to v1.
 * ========================================================================= */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin-var.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin-ext-var.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root,
:root[data-theme="dark"] {
    --bg: #0a0c12;
    --surface: #10131b;
    --surface-solid: #10131b;
    --surface-2: #151925;
    --border: rgba(255, 255, 255, 0.075);
    --border-strong: rgba(255, 255, 255, 0.13);
    --text: #eceef3;
    --muted: #a3abba;
    --dim: #7c8597;
    --input-bg: #0d1017;
    --hover: rgba(255, 255, 255, 0.045);
    --active: rgba(255, 255, 255, 0.08);
    --sidebar-bg: #07090e;
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-float: 0 12px 32px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
    --ring: color-mix(in srgb, var(--brand) 45%, transparent);
    --brand-soft: color-mix(in srgb, var(--brand) 16%, transparent);
    --brand-text: color-mix(in srgb, var(--brand) 55%, #ffffff);
    --radius-sm: 6px;
    --radius: 9px;
    --radius-lg: 14px;
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="light"] {
    --bg: #f6f7fa;
    --surface: #ffffff;
    --surface-solid: #ffffff;
    --surface-2: #f2f4f7;
    --border: #e6e8ee;
    --border-strong: #d5d9e2;
    --text: #0e1321;
    --muted: #4b5466;
    --dim: #6b7385;
    --input-bg: #ffffff;
    --hover: rgba(14, 19, 33, 0.04);
    --active: rgba(14, 19, 33, 0.07);
    --sidebar-bg: #0b0e17;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
    --shadow-float: 0 16px 40px -12px rgba(16, 24, 40, 0.22), 0 0 0 1px rgba(16, 24, 40, 0.06);
    --brand-text: color-mix(in srgb, var(--brand) 82%, #000000);
}
@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --bg: #f6f7fa;
        --surface: #ffffff;
        --surface-solid: #ffffff;
        --surface-2: #f2f4f7;
        --border: #e6e8ee;
        --border-strong: #d5d9e2;
        --text: #0e1321;
        --muted: #4b5466;
        --dim: #6b7385;
        --input-bg: #ffffff;
        --hover: rgba(14, 19, 33, 0.04);
        --active: rgba(14, 19, 33, 0.07);
        --sidebar-bg: #0b0e17;
        --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
        --shadow-float: 0 16px 40px -12px rgba(16, 24, 40, 0.22), 0 0 0 1px rgba(16, 24, 40, 0.06);
        --brand-text: color-mix(in srgb, var(--brand) 82%, #000000);
    }
}

/* ---- base type: 14px body, tighter headings ------------------------------ */
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    font-feature-settings: "cv11", "ss01", "cv05";
    text-rendering: optimizeLegibility;
}
::selection { background: var(--brand-soft); }
h1 { font-size: 1.375rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.25; }
h2 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 0.875rem; font-weight: 600; }
.lede { font-size: 0.875rem; color: var(--muted); }
.hint { font-size: 0.75rem; }
.stat-value { font-size: 1.625rem; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.75rem; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); }

/* ---- shell ----------------------------------------------------------------- */
.sidebar {
    width: 15rem;
    background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 9%, var(--sidebar-bg)) 0%, var(--sidebar-bg) 34%);
    border-right: 1px solid var(--sidebar-border);
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: 3.5rem;
    background: color-mix(in srgb, var(--surface) 84%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
}
.topbar strong { font-size: 0.875rem; font-weight: 600; }
@media (min-width: 1024px) { .content { padding: 1.75rem 2rem 2.5rem; } }

.nav { padding: 0 0.6rem; }
.nav a {
    gap: 0.625rem;
    min-height: 2.125rem;
    padding: 0.375rem 0.625rem;
    margin-bottom: 1px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
}
.nav a svg { width: 16px; height: 16px; opacity: 0.7; }
.nav a.active {
    background: color-mix(in srgb, var(--brand) 22%, transparent);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 35%, transparent);
}
.nav a.active svg { opacity: 1; color: color-mix(in srgb, var(--brand) 45%, #ffffff); }
.nav-section { margin-top: 0.875rem; padding-top: 0.875rem; }
.nav-label {
    margin: 0 0 0.375rem;
    padding: 0 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #7f889b;
}
.brand-mark, .workspace-mark {
    background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #ffffff));
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}
.workspace-btn { border-radius: 9px; font-size: 0.8125rem; }

/* ---- surfaces ---------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
@media (min-width: 640px) { .card { padding: 1.25rem 1.375rem; } }
.card-title { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; }
.card-sub { font-size: 0.8125rem; }
.page-head { margin-bottom: 1.25rem; }
.row { font-size: 0.875rem; padding: 0.625rem 0; }

/* ---- controls ---------------------------------------------------------------- */
.btn, .btn-primary, .btn-ghost, .btn-danger {
    min-height: 2.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius);
    letter-spacing: -0.005em;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.btn-primary {
    background-color: var(--brand);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0));
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); }
.btn-ghost:hover { background: var(--hover); }
.btn-sm { min-height: 1.875rem; padding: 0.25rem 0.75rem; font-size: 0.75rem; border-radius: 7px; }
.btn:focus-visible, .btn-primary:focus-visible, .btn-ghost:focus-visible, .btn-danger:focus-visible,
.tab:focus-visible, .nav a:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--ring);
}
.sidebar .btn-ghost, .drawer .btn-ghost { background: transparent; box-shadow: none; }

.field {
    min-height: 2.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background-color: var(--input-bg);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea.field { line-height: 1.55; }
.field:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.label { font-size: 0.8125rem; font-weight: 550; margin-bottom: 0.375rem; }

.badge { font-size: 0.6875rem; font-weight: 600; padding: 0.125rem 0.5rem; letter-spacing: 0.01em; line-height: 1.5; }
.badge-ai { background: var(--brand-soft); color: var(--brand-text); }

.alert { border-radius: var(--radius); font-size: 0.8125rem; padding: 0.75rem 0.875rem; }

/* ---- tables ------------------------------------------------------------------ */
table { font-size: 0.8125rem; }
th {
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 550;
    color: var(--muted);
}
tbody tr { transition: background-color 0.12s ease; }
tbody tr:hover { background: var(--hover); }

/* ---- floating surfaces: one anatomy -------------------------------------------- */
.menu {
    max-width: 22rem;
    padding: 6px;
    border-radius: 12px;
    box-shadow: var(--shadow-float);
    border: none;
    animation: menu-in 0.14s ease-out;
}
.menu a, .menu button { min-height: 2.125rem; font-size: 0.8125rem; border-radius: 8px; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---- tabs, meters, empty states -------------------------------------------------- */
.tabs { background: var(--surface-2); border-radius: 11px; }
.tab { font-size: 0.8125rem; }
.tab[aria-selected="true"] { background: var(--surface); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08), 0 0 0 1px var(--border); }
.empty p { font-size: 0.8125rem; }

/* ---- scrollbars ---------------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- admin integrations ----------------------------------------------------- */
.integration-list { display: grid; gap: 1rem; max-width: 52rem; }
.integration-list .card { margin: 0; }
.integration-head { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; margin-bottom: 0.75rem; }
.inline-controls .grow { flex: 1 1 16rem; width: auto; }

/* ---- brand vault ----------------------------------------------------------- */
.brand-layout { display: grid; gap: 1.25rem; align-items: start; margin-bottom: 1.25rem; }
@media (min-width: 1100px) { .brand-layout { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); } }
.brand-layout > .card { margin: 0; }
.kind-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.kind-option { position: relative; cursor: pointer; }
.kind-option input { position: absolute; opacity: 0; pointer-events: none; }
.kind-option span {
    display: inline-flex; align-items: center; min-height: 2.125rem; padding: 0.35rem 0.85rem;
    border: 1px solid var(--border-strong); border-radius: 999px; font-size: 0.8125rem; font-weight: 500;
    color: var(--muted); background: var(--surface); transition: all 0.15s ease;
}
.kind-option:hover span { color: var(--text); background: var(--hover); }
.kind-option input:checked + span {
    color: var(--brand-text, var(--text)); border-color: var(--brand);
    background: var(--brand-soft, var(--active)); font-weight: 600;
}
.kind-option input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }
.colour-slots { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); }
.colour-slot { display: flex; gap: 0.4rem; align-items: center; }
.colour-slot input[type="color"] {
    width: 2.375rem; height: 2.375rem; flex-shrink: 0; padding: 2px; cursor: pointer;
    border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
}
.colour-slot .field { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8125rem; text-transform: uppercase; }
.kv { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.6rem 0.75rem; margin: 0; font-size: 0.8125rem; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; min-width: 0; }
.swatch-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.swatch-chip {
    display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.5rem 0.15rem 0.2rem;
    border: 1px solid var(--border); border-radius: 999px; font-size: 0.6875rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted);
}
.swatch-chip .swatch { width: 1rem; height: 1rem; border-radius: 999px; }
.asset-row { display: flex; align-items: center; gap: 0.75rem; }
.asset-thumb { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2, var(--hover)); flex-shrink: 0; }

/* ---- brain: competitor rows ------------------------------------------------ */
.competitor-rows { display: grid; gap: 0.5rem; }
.competitor-row { display: grid; gap: 0.5rem; grid-template-columns: 1fr; padding: 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2, transparent); }
@media (min-width: 900px) { .competitor-row { grid-template-columns: 1.1fr 1.2fr 0.9fr 1.2fr; padding: 0; border: 0; background: none; } }

/* ---- video production package --------------------------------------------- */
.video-form { padding-top: 1rem; border-top: 1px solid var(--border); }
.duration-row { display: flex; gap: 0.5rem; max-width: 20rem; }
.duration-row input { width: 7rem; }
.duration-row select { flex: 1; }
.preset-row { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.5rem; }
.vp-characters { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.vp-character { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.875rem; background: var(--surface-2, transparent); }
.vp-character .kv { grid-template-columns: 5.5rem 1fr; }
.vp-character .vp-text { margin: 0.6rem 0 0.4rem; }

/* Native file inputs, styled to match the buttons. */
input[type="file"].field { padding: 0.375rem; cursor: pointer; }
input[type="file"].field::file-selector-button {
    margin-right: 0.75rem; padding: 0.375rem 0.85rem; border: 1px solid var(--border-strong); border-radius: 7px;
    background: var(--surface-2, var(--hover)); color: var(--text); font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
}
input[type="file"].field::file-selector-button:hover { background: var(--hover); }

/* ---- sticky save bar (Business Brain) ---------------------------------------- */
.save-bar {
    position: sticky; bottom: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    margin: 1.25rem -0.25rem 0; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--shadow-float, var(--shadow));
}
.save-bar .dirty { color: var(--warning); font-weight: 600; }
@media (max-width: 1023px) { .save-bar { bottom: 4.5rem; } }

/* ---- image studio form ------------------------------------------------------- */
.image-form-title { margin: 1.1rem 0 0.6rem; padding-top: 0.9rem; border-top: 1px solid var(--border); font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.check-grid { display: grid; gap: 0.25rem; margin-bottom: 0.75rem; }
.check-grid .check-row input:disabled + span { color: var(--dim); }
/* Generated images are shown whole, in their own shape. */
.sp-media-link { display: block; }

/* ---- Post extras: photos, special details, contact (round 12) ---------- */
.extras-box { margin: 0.25rem 0 1rem; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 0.9rem; background: var(--surface-2, transparent); }
.extras-box > summary { cursor: pointer; font-weight: 600; font-size: 0.875rem; }
.extras-box[open] > summary { margin-bottom: 0.75rem; }
.extras input[type=file].field { padding: 0.45rem; font-size: 0.8125rem; }
.contact-grid { display: grid; gap: 0 0.85rem; }
@media (min-width: 640px) { .contact-grid { grid-template-columns: repeat(3, 1fr); } }
.image-form .contact-grid { grid-template-columns: 1fr; }
.mt-xs { margin-top: 0.35rem; }
.ref-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0 0 0.85rem; }
.ref-thumb { display: grid; gap: 0.2rem; width: 92px; font-size: 0.75rem; color: var(--muted); }
.ref-thumb img { width: 92px; height: 92px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.ref-role { font-weight: 600; color: var(--text); }
.ref-remove { display: flex; gap: 0.3rem; align-items: center; }

/* ---- Setup gate on the Content page ------------------------------------ */
.setup-gate-grid { display: grid; gap: 0.85rem; }
@media (min-width: 720px) { .setup-gate-grid { grid-template-columns: 1fr 1fr; } }
.setup-step { border: 1px solid var(--border); border-radius: var(--radius-lg, var(--radius)); padding: 1rem 1.1rem; }
.setup-step h3 { display: flex; gap: 0.5rem; align-items: center; margin: 0 0 0.5rem; font-size: 1rem; }
.setup-step.done { opacity: 0.7; }
.setup-missing { margin: 0 0 0.85rem; padding-left: 1.1rem; color: var(--muted); font-size: 0.875rem; }
.setup-missing li { margin: 0.15rem 0; }
.image-form .extras .form-row-2 { grid-template-columns: 1fr; }
