﻿/* ============================================================
   AE Partners â€” Enterprise workspace design tokens
   Light + dark, indigo accent. Legacy variable names kept so
   existing component styles adopt the new system automatically.
   ============================================================ */

:root {
    --font-ui: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-display: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

    /* surfaces */
    --paper: #f6f7f9;      /* app canvas */
    --surface-2: #eef0f3;  /* subtle raised / hover */
    --card: #ffffff;       /* panels, tables, cards */
    --line: #e4e7eb;       /* borders / dividers */

    /* text */
    --ink: #16181d;        /* primary text */
    --ink-deep: #0f1115;   /* strongest text */
    --ink-soft: #626b76;   /* secondary text */

    /* accent (indigo) â€” links, active nav, focus, primary actions, progress */
    --accent: #5b5bd6;
    --accent-hover: #4b4bc4;
    --accent-soft: rgba(91, 91, 214, 0.12);
    --copper: #5b5bd6;     /* legacy accent name â†’ indigo */

    /* status */
    --good: #2f9e44;
    --bad: #e03131;

    /* role accents (permissions matrix, team lists) */
    --role-admin: #5b5bd6;
    --role-editor: #2f9e7a;
    --role-reviewer: #c9822e;
    --role-viewer: #626b76;

    /* text that always sits on a coloured/dark fill */
    --on-dark: #ffffff;
    --cream: #ffffff;

    /* app-shell chrome (neutral dark, constant across themes) */
    --sidebar-bg: #17181c;
    --sidebar-fg: #c6cad2;
    --sidebar-fg-soft: #8a909b;
    --sidebar-active-bg: rgba(255, 255, 255, 0.08);

    /* elevation */
    --shadow-sm: 0 1px 2px rgba(16, 18, 24, 0.06), 0 1px 3px rgba(16, 18, 24, 0.05);
    --shadow-md: 0 4px 12px rgba(16, 18, 24, 0.08), 0 2px 4px rgba(16, 18, 24, 0.05);
    --shadow-lg: 0 12px 32px rgba(16, 18, 24, 0.14);

    --radius: 8px;
}

/* dark â€” applied when the user picks it, or by system default when unset */
:root[data-theme="dark"] {
    --paper: #0d0d12;
    --surface-2: #1b1b22;
    --card: #131319;
    --line: rgba(255, 255, 255, 0.08);

    --ink: #e8e8ec;
    --ink-deep: #f4f4f8;
    --ink-soft: rgba(232, 232, 236, 0.6);

    --accent: #6d5cf5;
    --accent-hover: #8b7bff;
    --accent-soft: rgba(109, 92, 245, 0.16);
    --copper: #6d5cf5;

    --good: #3ec77e;
    --bad: #f06d6d;

    --role-admin: #6d5cf5;
    --role-editor: #3ec77e;
    --role-reviewer: #e0a250;
    --role-viewer: rgba(232, 232, 236, 0.6);

    --sidebar-bg: #0a0a0e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #0d0d12;
        --surface-2: #1b1b22;
        --card: #131319;
        --line: rgba(255, 255, 255, 0.08);

        --ink: #e8e8ec;
        --ink-deep: #f4f4f8;
        --ink-soft: rgba(232, 232, 236, 0.6);

        --accent: #6d5cf5;
        --accent-hover: #8b7bff;
        --accent-soft: rgba(109, 92, 245, 0.16);
        --copper: #6d5cf5;

        --good: #3ec77e;
        --bad: #f06d6d;

        --role-admin: #6d5cf5;
        --role-editor: #3ec77e;
        --role-reviewer: #e0a250;
        --role-viewer: rgba(232, 232, 236, 0.6);

        --sidebar-bg: #0a0a0e;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
        --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
    }
}

html, body {
    font-family: var(--font-ui);
    background: var(--paper);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

h1:focus {
    outline: none;
}

::selection {
    background: var(--accent-soft);
}

.validation-message {
    color: var(--bad);
}

/* ---- global select theming ----
   Native <select> ignores the app theme (renders OS chrome) unless
   appearance is reset and a custom chevron is drawn. Applies everywhere
   except selects that opt into a bespoke look (.pill-select select). */
select {
    appearance: none;
    -webkit-appearance: none;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--ink);
    background-color: var(--card);
    background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
        linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
    background-position: calc(100% - 1.15rem) center, calc(100% - 0.85rem) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.5rem 2.2rem 0.5rem 0.7rem;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

select option {
    background: var(--card);
    color: var(--ink);
}

/* --- shared list-page toolbar (view toggle, search) --- */

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.search-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    color: var(--ink);
    padding: 0.5rem 0.8rem;
    min-width: 18rem;
    box-shadow: var(--shadow-sm);
}

.search-box:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.view-switch {
    display: inline-flex;
    background: var(--surface-2);
    border-radius: 8px;
    padding: 2px;
}

.view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 1.9rem;
    border: none;
    background: none;
    color: var(--ink-soft);
    border-radius: 6px;
    cursor: pointer;
}

.view-btn svg {
    width: 16px;
    height: 16px;
}

.view-btn.active {
    background: var(--card);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

/* --- shared list-page filter bar (pill dropdowns) --- */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.filter-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-soft);
    margin-right: 0.15rem;
}

.pill-select {
    position: relative;
    display: inline-block;
}

.pill-trigger {
    appearance: none;
    -webkit-appearance: none;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.4rem 1.9rem 0.4rem 0.9rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.12s ease;
    white-space: nowrap;
}

.pill-trigger:hover {
    border-color: var(--ink-soft);
}

.pill-trigger:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* custom filter dropdown â€” replaces native <select> so the open list
   matches the app's dark theme instead of OS chrome */

.filter-menu {
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    z-index: 50;
    min-width: 11rem;
    max-height: 16rem;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.3rem;
    display: flex;
    flex-direction: column;
}

.filter-option {
    text-align: left;
    border: none;
    background: none;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--ink);
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.filter-option:hover {
    background: var(--surface-2);
}

.filter-option.selected {
    color: var(--accent);
    font-weight: 600;
    background: var(--accent-soft);
}

/* chevron */
.pill-select::after {
    content: "";
    position: absolute;
    right: 0.75rem;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 1.5px solid var(--ink-soft);
    border-bottom: 1.5px solid var(--ink-soft);
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}

.pill-select.active .pill-trigger {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.pill-select.active::after {
    border-color: var(--accent);
}

.clear-filters {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ink-soft);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem 0.4rem;
}

.clear-filters:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* --- shared table row actions (admin list pages) --- */

/* Keep action cells as real table-cells: display:flex on a <td> drops it out
   of table layout and makes the row divider misalign. Right-align instead. */
.cell-actions {
    white-space: nowrap;
    text-align: right;
}

.cell-actions > a,
.cell-actions > button {
    margin-left: 0.4rem;
    vertical-align: middle;
}

.cell-actions > a:first-child,
.cell-actions > button:first-child {
    margin-left: 0;
}

/* Use / Edit / Delete / user actions rendered as visible pill badges. */
.row-link,
.row-delete,
.row-action {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-ui);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1;
    padding: 0.34rem 0.72rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    text-decoration: none;
}

.row-link,
.row-action {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.row-link:hover,
.row-action:hover {
    background: color-mix(in srgb, var(--accent) 20%, transparent);
    text-decoration: none;
}

.row-delete {
    color: var(--bad);
    background: color-mix(in srgb, var(--bad) 12%, transparent);
    border-color: color-mix(in srgb, var(--bad) 30%, transparent);
}

.row-delete:hover {
    background: color-mix(in srgb, var(--bad) 22%, transparent);
    text-decoration: none;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1.2rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* --- Kanban board (shared by Requests and Clients board view) --- */
.kanban-board {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 0.6rem;
}

.kanban-col {
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-height: 8rem;
    /* Cap to the viewport (170px board top + a little breathing room) so a full
       column scrolls its own cards instead of scrolling the whole page. */
    max-height: calc(100vh - 12rem);
    padding: 0.7rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius, 12px);
}

/* Cards scroll here; the column head stays pinned. */
.kanban-col-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--ink-soft) 28%, transparent) transparent;
}

.kanban-col-body::-webkit-scrollbar { width: 8px; }
.kanban-col-body::-webkit-scrollbar-track { background: transparent; }
.kanban-col-body::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--ink-soft) 28%, transparent);
    border-radius: 8px;
}

.kanban-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0 0.2rem 0.2rem;
}

.kanban-col-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kanban-count {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-soft);
}

.kanban-card {
    cursor: pointer;
    margin: 0;
}

.kanban-card[draggable="true"] {
    cursor: grab;
}

.kanban-card[draggable="true"]:active {
    cursor: grabbing;
}

/* --- Reminders module (shared by the schedule + template editors) --- */

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--ink-soft);
    font-size: 0.85rem;
    text-decoration: none;
}

.back-link:hover {
    color: var(--accent);
}

/* ------------------------------------------------------------------
   Reminders module â€” mirrors Reminders.dc.html one-for-one. Every
   number below is the design's own px value. The token block re-points
   both the design's names and the app's legacy names, so nested
   components (Dropdown, Quill, ConfirmDialog) adopt the palette too.
   ------------------------------------------------------------------ */

.rem-shell,
.tpl-shell {
    --surface: #ffffff;
    --surface2: #f3f3f6;
    --head: #fafafb;
    --cat-mix: 12%;
    --field: #f5f5f8;
    --border: rgba(20, 20, 30, .09);
    --text: #181820;
    --dim: rgba(24, 24, 32, .58);
    --faint: rgba(24, 24, 32, .36);
    --danger: #dc4b4b;
    --danger-soft: rgba(220, 75, 75, .08);
    --warn-soft: #fdf6e3;
    --warn-border: #eacf7a;
    --warn-text: #8a6d12;

    --accent: #6d5cf5;
    --accent-hover: #5c4ae4;
    --accent-soft: rgba(109, 92, 245, .1);

    /* legacy names â†’ design palette, for nested components */
    --line: rgba(20, 20, 30, .09);
    --card: #ffffff;
    --surface-2: #f3f3f6;
    --ink: #181820;
    --ink-soft: rgba(24, 24, 32, .58);
    --bad: #dc4b4b;

    color: var(--text);
}

:root[data-theme="dark"] .rem-shell,
:root[data-theme="dark"] .tpl-shell {
    --surface: #111117;
    --surface2: #191921;
    --head: #0f0f15;
    --cat-mix: 16%;
    --field: #0d0d12;
    --border: rgba(255, 255, 255, .075);
    --text: #e8e8ec;
    --dim: rgba(232, 232, 236, .6);
    --faint: rgba(232, 232, 236, .34);
    --danger: #f06d6d;
    --danger-soft: rgba(240, 109, 109, .14);
    --warn-soft: rgba(234, 179, 8, .1);
    --warn-border: rgba(234, 179, 8, .28);
    --warn-text: #e8c766;

    --accent: #6d5cf5;
    --accent-hover: #8b7bff;
    --accent-soft: rgba(109, 92, 245, .16);

    --line: rgba(255, 255, 255, .075);
    --card: #111117;
    --surface-2: #191921;
    --ink: #e8e8ec;
    --ink-soft: rgba(232, 232, 236, .6);
    --bad: #f06d6d;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .rem-shell,
    :root:not([data-theme="light"]) .tpl-shell {
        --surface: #111117;
        --surface2: #191921;
        --head: #0f0f15;
        --cat-mix: 16%;
        --field: #0d0d12;
        --border: rgba(255, 255, 255, .075);
        --text: #e8e8ec;
        --dim: rgba(232, 232, 236, .6);
        --faint: rgba(232, 232, 236, .34);
        --danger: #f06d6d;
        --danger-soft: rgba(240, 109, 109, .14);
        --warn-soft: rgba(234, 179, 8, .1);
        --warn-border: rgba(234, 179, 8, .28);
        --warn-text: #e8c766;

        --accent: #6d5cf5;
        --accent-hover: #8b7bff;
        --accent-soft: rgba(109, 92, 245, .16);

        --line: rgba(255, 255, 255, .075);
        --card: #111117;
        --surface-2: #191921;
        --ink: #e8e8ec;
        --ink-soft: rgba(232, 232, 236, .6);
        --bad: #f06d6d;
    }
}

/* --- page head --- */

.rem-shell .eyebrow,
.tpl-shell .eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 5px;
}

.rem-shell .page-title,
.tpl-shell .page-title {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 750;
    letter-spacing: -.02em;
    color: var(--text);
    margin: 0 0 6px;
}

.rem-shell .page-title.no-sub {
    margin-bottom: 26px;
}

.rem-shell .page-sub {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--dim);
    max-width: 560px;
    margin: 0 0 22px;
}

.rem-shell .back-link,
.tpl-shell .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 550;
    color: var(--accent);
    margin-bottom: 16px;
    text-decoration: none;
}

.rem-shell .back-link:hover,
.tpl-shell .back-link:hover {
    opacity: .82;
    color: var(--accent);
    text-decoration: none;
}

.rem-shell .empty-note,
.tpl-shell .empty-note {
    font-size: 13.5px;
    color: var(--dim);
}

/* --- tabs --- */

.rem-shell .tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 26px;
}

.rem-shell .tab {
    position: relative;
    border: none;
    background: none;
    padding: 12px 4px;
    margin-right: 22px;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    color: var(--dim);
    cursor: pointer;
}

.rem-shell .tab.on {
    font-weight: 650;
    color: var(--text);
}

.rem-shell .tab-rule {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
}

/* --- schedule cards --- */

.rem-shell .sched-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 16px;
    width: auto;
    padding:0% 2%;
}

.rem-shell .sched-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    padding: 20px;
    cursor: pointer;
    transition: border-color .15s, transform .15s;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rem-shell .sched-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.rem-shell .sc-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.rem-shell .sc-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.rem-shell .sc-titles {
    min-width: 0;
}

.rem-shell .sc-name {
    font-size: 15.5px;
    font-weight: 650;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.rem-shell .sc-badge {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 3px 7px;
    border-radius: 5px;
}

.rem-shell .sc-updated {
    font-size: 12px;
    color: var(--faint);
    margin-top: 2px;
}

.rem-shell .sc-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rem-shell .sc-dot {
    width: 8px;
    height: 8px;
    border-radius: 2.5px;
    background: var(--accent);
    flex: none;
}

.rem-shell .sc-dot.faint {
    background: var(--faint);
}

.rem-shell .sc-rules {
    font-size: 13px;
    font-weight: 500;
    color: var(--dim);
}

.rem-shell .sc-foot {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
    margin-top: auto;
}

.rem-shell .sched-add {
    border: 1.5px dashed var(--border);
    border-radius: 14px;
    background: transparent;
    padding: 20px;
    min-height: 180px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--dim);
    font-family: var(--font-ui);
    font-size: 13.5px;
    font-weight: 600;
}

.rem-shell .sched-add:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* --- buttons --- */

.rem-shell .btn-primary,
.rem-shell .btn-primary-sm,
.rem-shell .btn-save {
    border: none;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-ui);
    cursor: pointer;
}

.rem-shell .btn-primary-sm {
    flex: 1;
    height: 32px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
}

.rem-shell .btn-primary {
    height: 36px;
    padding: 0 16px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: none;
}

.rem-shell .btn-save {
    height: 40px;
    padding: 0 22px;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 650;
}

.rem-shell .btn-save:disabled {
    opacity: .6;
    cursor: default;
}

.rem-shell .btn-ghost-sm,
.rem-shell .btn-ghost-xs,
.rem-shell .btn-cancel {
    border: 1px solid var(--border);
    background: transparent;
    font-family: var(--font-ui);
    font-weight: 550;
    cursor: pointer;
}

.rem-shell .btn-ghost-sm {
    height: 32px;
    padding: 0 13px;
    border-radius: 8px;
    font-size: 12.5px;
    color: var(--dim);
}

.rem-shell .btn-ghost-xs {
    height: 30px;
    padding: 0 13px;
    border-radius: 7px;
    font-size: 12.5px;
    color: var(--dim);
}

.rem-shell .btn-ghost-sm:hover,
.rem-shell .btn-ghost-xs:hover {
    background: var(--surface2);
    color: var(--text);
}

.rem-shell .btn-cancel {
    height: 40px;
    padding: 0 20px;
    border-radius: 9px;
    font-size: 13.5px;
    color: var(--text);
}

.rem-shell .btn-cancel:hover {
    background: var(--surface2);
}

.rem-shell .btn-icon-danger {
    height: 32px;
    width: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.rem-shell .btn-icon-danger.sm {
    height: 30px;
    width: 30px;
    border-radius: 7px;
}

.rem-shell .btn-icon-danger:hover {
    background: var(--danger-soft);
}

/* --- template table --- */

.rem-shell .tmpl-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface);
    width: auto;
    padding:0% 2%;
}

.rem-shell .tmpl-head,
.rem-shell .tmpl-row {
    display: grid;
    grid-template-columns: 2.2fr 2.6fr 1fr 1.4fr;
}

.rem-shell .tmpl-head {
    padding: 13px 22px;
    background: var(--head);
    border-bottom: 1px solid var(--border);
}

.rem-shell .tmpl-h {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--dim);
}

.rem-shell .tmpl-row {
    align-items: center;
    padding: 15px 22px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.rem-shell .tmpl-row:hover {
    background: var(--surface2);
}

.rem-shell .t-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.rem-shell .t-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.rem-shell .t-icon.email {
    background: rgba(75, 139, 244, .15);
    color: #4b8bf4;
}

.rem-shell .t-icon.sms {
    background: rgba(45, 212, 191, .15);
    color: #2dd4bf;
}

.rem-shell .t-icon.team {
    background: var(--accent-soft);
    color: var(--accent);
}

.rem-shell .t-titles {
    min-width: 0;
}

.rem-shell .t-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rem-shell .t-internal {
    font-size: 11px;
    color: var(--faint);
}

.rem-shell .t-sub {
    font-size: 13px;
    color: var(--dim);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 20px;
}

.rem-shell .t-updated {
    font-size: 13px;
    color: var(--dim);
}

.rem-shell .t-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.rem-shell .tmpl-add {
    padding: 15px 22px;
    color: var(--accent);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rem-shell .tmpl-add:hover {
    background: var(--surface2);
}

.rem-shell .tmpl-empty {
    padding: 22px;
    font-size: 13.5px;
    color: var(--dim);
    border-bottom: 1px solid var(--border);
}

/* --- editor layouts --- */

.rem-shell .sched-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
    width:  auto;
    align-items: start;
    padding:0% 2%;
}

.rem-shell .tmpl-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    width: auto;
    align-items: start;
    padding:0% 2%;
}

.rem-shell .layout-main {
    min-width: 0;
}

@media (max-width: 1140px) {
    .rem-shell .sched-layout,
    .rem-shell .tmpl-layout {
        grid-template-columns: 1fr;
    }

    .rem-shell .rail {
        position: static;
    }
}

.rem-shell .panel {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    padding: 22px;
}

.rem-shell .settings-panel {
    margin-bottom: 26px;
}

.rem-shell .editor-panel {
    padding: 24px;
    min-width: 0;
}

/* --- fields --- */

.rem-shell .field-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.rem-shell .field {
    margin-bottom: 18px;
}

.rem-shell .field-last {
    margin-top: 18px;
}

.rem-shell .flabel {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--dim);
    margin-bottom: 7px;
}

.rem-shell .flabel .opt {
    color: var(--faint);
    font-weight: 400;
}

.rem-shell .finput,
.rem-shell .ftextarea {
    width: 100%;
    height: 40px;
    padding: 0 13px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--field);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 13.5px;
}

.rem-shell .ftextarea {
    height: auto;
    min-height: 64px;
    padding: 10px 13px;
    line-height: 1.5;
    resize: vertical;
}

.rem-shell .finput:focus,
.rem-shell .ftextarea:focus,
.rem-shell .num-input:focus,
.rem-shell .time-input:focus,
.rem-shell .body-area:focus {
    outline: none;
    border-color: var(--accent);
}

.rem-shell input::placeholder,
.rem-shell textarea::placeholder {
    color: var(--faint);
}

.rem-shell .cbx-row {
    display: flex;
    align-items: flex-end;
    padding-bottom: 2px;
}

.rem-shell .cbx-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}

.rem-shell .cbx {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--field);
    flex: none;
    margin: 0;
    cursor: pointer;
}

.rem-shell .cbx:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.rem-shell .cbx:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 5px;
    width: 11px;
    height: 5px;
    border-left: 2.4px solid #fff;
    border-bottom: 2.4px solid #fff;
    transform: rotate(-45deg);
}

/* --- section head --- */

.rem-shell .sec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 6px;
}

.rem-shell .sec-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.rem-shell .sec-sub {
    font-size: 12.5px;
    color: var(--dim);
    margin: 3px 0 0;
}

/* --- rule timeline --- */

.rem-shell .timeline {
    position: relative;
    padding-left: 40px;
    margin-top: 16px;
}

.rem-shell .timeline::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: var(--border);
}

.rem-shell .tl-group {
    position: relative;
    margin: 26px 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rem-shell .tl-group::before {
    content: "";
    position: absolute;
    left: -33px;
    top: 1px;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--paper);
}

.rem-shell .tl-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--text);
}

.rem-shell .tl-line {
    height: 1px;
    flex: 1;
    background: var(--border);
}

.rem-shell .tl-count {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--faint);
}

.rem-shell .rule {
    position: relative;
    margin-bottom: 12px;
}

.rem-shell .timeline .rule::before {
    content: "";
    position: absolute;
    left: -31px;
    top: 22px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--faint);
    box-shadow: 0 0 0 4px var(--paper);
}

/* Design draws the card with overflow:hidden; the themed Dropdown opens an
   absolutely-positioned menu inside the body, so it has to stay visible. */
.rem-shell .rule-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.rem-shell .rule-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 13px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
}

.rem-shell .day-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    flex: none;
    line-height: 1;
}

.rem-shell .day-num {
    font-size: 16px;
    font-weight: 750;
}

.rem-shell .day-unit {
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    opacity: .8;
}

.rem-shell .rule-titles {
    flex: 1 1 130px;
    min-width: 130px;
}

.rem-shell .rule-title {
    font-size: 14.5px;
    font-weight: 650;
    color: var(--text);
}

.rem-shell .rule-meta {
    font-size: 12px;
    color: var(--dim);
    margin-top: 2px;
}

.rem-shell .rule-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.rem-shell .ch-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 9px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .02em;
    background: var(--surface2);
    color: var(--dim);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.rem-shell .rule-remove {
    border: none;
    background: none;
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 550;
    color: var(--danger);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.rem-shell .rule-remove:hover {
    background: var(--danger-soft);
}

.rem-shell .rule-body {
    padding: 14px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 8px;
    font-size: 13px;
    color: var(--dim);
}

/* the design's day box is 46px wide â€” no room for the native spinners */
.rem-shell .num-input::-webkit-outer-spin-button,
.rem-shell .num-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.rem-shell .num-input {
    appearance: textfield;
    -moz-appearance: textfield;
    width: 46px;
    height: 34px;
    text-align: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--field);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 650;
}

.rem-shell .time-input {
    width: 92px;
    height: 34px;
    padding: 0 11px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--field);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 550;
}

/* the themed Dropdown, sized to the design's <select> */
.rem-shell .rule-body .dd-trigger,
.rem-shell .insert-var .dd-trigger {
    height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--field);
    color: var(--text);
    font-size: 13px;
    font-weight: 550;
}

.rem-shell .dd-wide {
    min-width: 190px;
}

.rem-shell .dd-med {
    min-width: 150px;
}

.rem-shell .dd-var {
    min-width: 120px;
}

.rem-shell .rule-add {
    position: relative;
    width: 100%;
    border: 1.5px dashed var(--border);
    border-radius: 12px;
    background: transparent;
    padding: 14px;
    margin-top: 16px;
    text-align: center;
    color: var(--dim);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.rem-shell .rule-add:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.rem-shell .timeline .rule-add::before {
    content: "";
    position: absolute;
    left: -31px;
    top: 14px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px dashed var(--faint);
}

.rem-shell .form-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

/* --- side rail --- */

.rem-shell .rail {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    padding: 20px;
    position: sticky;
    top: 20px;
}

.rem-shell .rail-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 16px;
}

.rem-shell .rail-sub {
    font-size: 12px;
    color: var(--dim);
    margin: -11px 0 14px;
}

.rem-shell .rail-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-top: 1px solid var(--border);
}

.rem-shell .rail-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--faint);
    flex: none;
}

.rem-shell .rail-label {
    font-size: 13px;
    font-weight: 550;
    color: var(--text);
    flex: 1;
}

.rem-shell .rail-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--dim);
}

.rem-shell .rail-stats {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 16px;
}

.rem-shell .rail-stat-l {
    font-size: 11px;
    color: var(--dim);
    margin-bottom: 3px;
}

.rem-shell .rail-stat-v {
    font-size: 20px;
    font-weight: 750;
    color: var(--text);
}

.rem-shell .rail-note {
    margin-top: 16px;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--faint);
}

/* --- message body editor --- */

.rem-shell .body-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}

.rem-shell .body-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--dim);
}

.rem-shell .insert-var {
    display: flex;
    align-items: center;
    gap: 7px;
}

.rem-shell .insert-var-note {
    font-size: 11.5px;
    color: var(--faint);
}

.rem-shell .body-box {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.rem-shell .body-area {
    display: block;
    width: 100%;
    border: none;
    background: transparent;
    padding: 16px 18px;
    min-height: 200px;
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    resize: vertical;
}

/* Quill sits inside .body-box; the extra .rte in the chain outranks the
   component's own scoped rules, which load after app.css. */
.rem-shell .body-box .rte {
    border-radius: 0;
}

.rem-shell .body-box .rte .ql-toolbar.ql-snow {
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: var(--head);
    padding: 7px 10px;
}

.rem-shell .body-box .rte .ql-container.ql-snow {
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 14px;
}

.rem-shell .body-box .rte .ql-editor {
    min-height: 200px;
    max-height: none;
    padding: 16px 18px;
    line-height: 1.7;
    color: var(--text);
}

.rem-shell .sms-count {
    display: flex;
    justify-content: flex-end;
    font-size: 11.5px;
    color: var(--faint);
    margin-top: 8px;
}

.rem-shell .sms-warn {
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 9px;
    background: var(--warn-soft);
    border: 1px solid var(--warn-border);
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--warn-text);
}

/* --- merge-variable rail --- */

.rem-shell .var-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.rem-shell .var-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 11px;
    border: none;
    border-radius: 8px;
    background: var(--surface2);
    text-align: left;
    cursor: pointer;
}

.rem-shell .var-chip:hover {
    background: var(--accent-soft);
}

.rem-shell .var-token {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.rem-shell .var-desc {
    font-size: 12px;
    color: var(--dim);
    flex: 1;
    text-align: right;
}

/* ============================================================
   Hue chips â€” shared by Clients list/detail: entity type badges,
   group/partner dots and avatars. --h is set inline per item so
   every name paints a stable, theme-adaptive colour.
   ============================================================ */

.hue-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.2rem 0.55rem;
    border-radius: 7px;
    background: color-mix(in oklch, oklch(0.7 0.13 var(--h, 245)) 20%, var(--card));
    color: color-mix(in oklch, oklch(0.5 0.16 var(--h, 245)) 68%, var(--ink));
    white-space: nowrap;
}

.hue-dot {
    width: 7px;
    height: 7px;
    flex-shrink: 0;
    border-radius: 50%;
    background: oklch(0.62 0.16 var(--h, 245));
}

.hue-avatar {
    background: color-mix(in oklch, oklch(0.7 0.13 var(--h, 245)) 26%, var(--card));
    color: color-mix(in oklch, oklch(0.46 0.16 var(--h, 245)) 72%, var(--ink));
}

/* ------------------------------------------------------------------
   Templates module â€” mirrors Templates.dc.html one-for-one. Every
   number below is the design's own px value. Category colour rides on
   --cat, set by the .tpl-cat-â€¦ class on the group (list) or on the
   shell itself (detail page); --cat-mix is the tint strength, which
   the token block lifts from 12% to 16% in dark.
   ------------------------------------------------------------------ */

.tpl-shell {
    --cat: var(--accent);
}

/* Compliance / Onboarding / Tax are the design's own hues; the other five
   categories in TemplateCategories.All follow the same saturation. */
.tpl-cat-general { --cat: #64748b; }
.tpl-cat-accounting { --cat: #4b8bf4; }
.tpl-cat-bookkeeping { --cat: #0ea5e9; }
.tpl-cat-tax { --cat: #e0a11b; }
.tpl-cat-advisory { --cat: #a855f7; }
.tpl-cat-compliance { --cat: #14b8a6; }
.tpl-cat-payroll { --cat: #f97316; }
.tpl-cat-onboarding { --cat: #6d5cf5; }

.tpl-shell .page-title {
    margin: 0 0 22px;
}

/* --- toolbar --- */

.tpl-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.tpl-filter-label {
    font-size: 13px;
    color: var(--dim);
}

.tpl-toolbar-gap {
    flex: 1;
}

.tpl-filter {
    position: relative;
}

.tpl-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: 38px;
    min-width: 170px;
    padding: 0 12px 0 14px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
}

.tpl-filter-btn.open {
    border-color: var(--accent);
}

.tpl-filter-btn svg {
    opacity: .6;
    flex: none;
}

.tpl-shell .menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
}

.tpl-filter-menu {
    position: absolute;
    top: 44px;
    left: 0;
    z-index: 21;
    width: 250px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
}

.tpl-filter-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 280px;
    overflow: auto;
}

.tpl-filter-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
}

.tpl-filter-row:hover {
    background: var(--surface2);
}

.tpl-check {
    width: 19px;
    height: 19px;
    border-radius: 6px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--faint);
    color: #fff;
}

.tpl-check.on {
    border: none;
    background: var(--accent);
}

.tpl-filter-name {
    flex: 1;
    font-size: 13.5px;
    font-weight: 550;
    color: var(--text);
}

.tpl-filter-count {
    font-size: 11.5px;
    color: var(--faint);
}

.tpl-filter-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    margin-top: 6px;
    padding: 10px 6px 4px;
}

.tpl-filter-clear {
    font-size: 13px;
    font-weight: 550;
    color: var(--dim);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.tpl-filter-clear:hover {
    color: var(--text);
}

.tpl-filter-apply {
    height: 32px;
    padding: 0 18px;
    border-radius: 8px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.tpl-search {
    position: relative;
}

.tpl-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    color: var(--faint);
    pointer-events: none;
}

.tpl-search-input {
    width: 250px;
    height: 38px;
    padding: 0 14px 0 34px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 13px;
}

.tpl-search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.tpl-search-input::placeholder {
    color: var(--faint);
}

.tpl-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

/* the shared ViewSwitch, wearing the design's segmented control */
.tpl-shell .view-switch {
    display: flex;
    gap: 0;
    padding: 3px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
}

.tpl-shell .view-switch .view-btn {
    width: 32px;
    height: 30px;
    border-radius: 7px;
    background: transparent;
    color: var(--dim);
    box-shadow: none;
}

.tpl-shell .view-switch .view-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: none;
}

/* --- category group --- */

.tpl-group {
    margin-bottom: 34px;
}

.tpl-group-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.tpl-group-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--cat) var(--cat-mix), transparent);
    color: var(--cat);
}

.tpl-group-title {
    font-family: var(--font-display);
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.tpl-group-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--faint);
    background: var(--surface2);
    padding: 2px 8px;
    border-radius: 20px;
}

.tpl-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .02em;
    color: var(--cat);
    background: color-mix(in srgb, var(--cat) var(--cat-mix), transparent);
    padding: 3px 9px;
    border-radius: 6px;
    white-space: nowrap;
}

/* --- card grid --- */

.tpl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
    gap: 16px;
}

.tpl-card {
    display: flex;
    flex-direction: column;
    min-height: 176px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s, transform .15s, box-shadow .15s;
}

.tpl-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}

.tpl-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.tpl-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--cat) var(--cat-mix), transparent);
    color: var(--cat);
}

.tpl-card-menu {
    position: relative;
}

.tpl-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--faint);
    cursor: pointer;
}

.tpl-dots:hover {
    color: var(--text);
    background: var(--surface2);
}

.tpl-card-name {
    font-size: 15px;
    font-weight: 650;
    line-height: 1.32;
    color: var(--text);
    margin-bottom: 6px;
}

.tpl-card-desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--dim);
    margin-bottom: 14px;
}

.tpl-card-spacer {
    flex: 1;
}

.tpl-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 4px;
}

.tpl-card-meta {
    font-size: 12px;
    color: var(--faint);
    white-space: nowrap;
}

.tpl-card-new {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 11px;
    min-height: 176px;
    padding: 18px;
    border: 1.5px dashed var(--border);
    border-radius: 14px;
    background: transparent;
    color: var(--dim);
    font-family: var(--font-ui);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}

.tpl-card-new:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
    opacity: 1;
}

.tpl-card-new-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
}

/* --- list view --- */

.tpl-list {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
}

.tpl-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.tpl-row:hover {
    background: var(--surface2);
}

.tpl-row-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--cat) var(--cat-mix), transparent);
    color: var(--cat);
}

.tpl-row-titles {
    min-width: 0;
    flex: 1;
}

.tpl-row-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tpl-row-desc {
    font-size: 12.5px;
    color: var(--dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tpl-row-fields {
    flex: none;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--dim);
}

.tpl-row-updated {
    flex: none;
    width: 120px;
    text-align: right;
    font-size: 12.5px;
    color: var(--faint);
}

.tpl-row-new {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    color: var(--accent);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
}

.tpl-row-new:hover {
    background: var(--surface2);
    color: var(--accent);
    text-decoration: none;
    opacity: 1;
}

/* --- card row menu --- */

.tpl-shell .row-menu {
    position: absolute;
    right: 0;
    top: 28px;
    z-index: 21;
    min-width: 9rem;
    padding: 6px;
    display: flex;
    flex-direction: column;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
}

.tpl-shell .row-menu a,
.tpl-shell .row-menu button {
    text-align: left;
    border: none;
    background: none;
    font-family: var(--font-ui);
    font-size: 13.5px;
    font-weight: 550;
    color: var(--text);
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
}

.tpl-shell .row-menu a:hover,
.tpl-shell .row-menu button:hover {
    background: var(--surface2);
    text-decoration: none;
    opacity: 1;
}

.tpl-shell .row-menu .menu-danger {
    color: var(--danger);
}

/* --- empty states --- */

.tpl-empty {
    text-align: center;
    padding: 70px 20px;
    color: var(--dim);
}

.tpl-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.tpl-empty-sub {
    font-size: 13px;
}

/* --- detail page head --- */

.tpl-head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.tpl-head-icon {
    width: 56px;
    height: 56px;
    border-radius: 15px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--cat) var(--cat-mix), transparent);
    color: var(--cat);
}

.tpl-head-main {
    flex: 1;
    min-width: 220px;
}

.tpl-head-meta {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}

.tpl-head-sub {
    font-size: 12px;
    color: var(--faint);
}

.tpl-head-title {
    font-family: var(--font-display);
    margin: 0 0 6px;
    font-size: 25px;
    font-weight: 750;
    letter-spacing: -.02em;
    line-height: 1.2;
    color: var(--text);
}

.tpl-head-desc {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--dim);
    max-width: 640px;
}

.tpl-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.tpl-btn-primary,
.tpl-btn-ghost,
.tpl-btn-done {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    border-radius: 10px;
    font-family: var(--font-ui);
    font-size: 13.5px;
    cursor: pointer;
    text-decoration: none;
}

.tpl-btn-primary {
    padding: 0 18px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-weight: 650;
}

.tpl-btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
    text-decoration: none;
    opacity: 1;
}

.tpl-btn-ghost {
    padding: 0 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 550;
}

.tpl-btn-ghost:hover {
    background: var(--surface2);
}

.tpl-btn-done {
    padding: 0 18px;
    border: 1px solid var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 650;
}

.tpl-btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpl-btn-icon:hover {
    background: var(--surface2);
    color: var(--text);
}

/* --- the shared RequestPreview, wearing the design's preview page ---
   Three-class selectors deliberately: the component's own scoped rules
   load after app.css, so a two-class override would lose the tie. */

.tpl-shell .prev-wrap .prev-lockbar {
    gap: 10px;
    padding: 11px 16px;
    border: none;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 13px;
    margin-bottom: 20px;
}

.tpl-shell .prev-wrap .prev-lockbar svg {
    width: 16px;
    height: 16px;
}

.tpl-shell .prev-wrap .prev-shell {
    grid-template-columns: 250px 1fr;
    gap: 22px;
    max-width: auto;
    padding:0% 1%
}

.tpl-shell .prev-wrap .prev-nav {
    position: sticky;
    top: 20px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: none;
}

.tpl-shell .prev-wrap .prev-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
    padding: 2px 6px 12px;
    border-bottom: 1px solid var(--border);
    margin: 0 0 8px;
}

.tpl-shell .prev-wrap .prev-nav-list {
    gap: 2px;
}

.tpl-shell .prev-wrap .prev-nav-item {
    gap: 10px;
    padding: 9px 10px;
    margin-bottom: 2px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 550;
    line-height: 1.35;
    color: var(--text);
}

.tpl-shell .prev-wrap .prev-nav-item:hover {
    background: var(--surface2);
}

.tpl-shell .prev-wrap .prev-nav-item.active {
    background: color-mix(in srgb, var(--cat) var(--cat-mix), transparent);
    color: var(--cat);
    font-weight: 650;
}

.tpl-shell .prev-wrap .prev-nav-sub {
    margin: 0;
    padding-left: 0;
    border-left: none;
}

.tpl-shell .prev-wrap .prev-nav-subitem {
    gap: 10px;
    padding: 8px 10px 8px 22px;
    margin-bottom: 2px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 450;
    line-height: 1.35;
    color: var(--dim);
}

.tpl-shell .prev-wrap .prev-nav-subitem:hover {
    background: var(--surface2);
}

.tpl-shell .prev-wrap .prev-nav-count {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--faint);
    background: var(--surface2);
    padding: 2px 8px;
    border-radius: 20px;
}

.tpl-shell .prev-wrap .prev-nav-tick {
    background: var(--cat);
}

.tpl-shell .prev-wrap .prev-body {
    gap: 16px;
    counter-reset: tplsec;
}

.tpl-shell .prev-wrap .prev-card {
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: none;
}

/* Instructions is page 1 when present, so it bumps the counter and the
   first section head numbers itself 2 â€” exactly as the nav numbers it. */
.tpl-shell .prev-wrap #prev-instructions {
    counter-increment: tplsec;
}

.tpl-shell .prev-wrap .prev-section-head {
    gap: 11px;
    justify-content: flex-start;
    padding: 15px 20px;
    margin: 0 0 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface2);
}

.tpl-shell .prev-wrap .prev-section-head:not(.sub)::before {
    counter-increment: tplsec;
    content: counter(tplsec);
    width: 26px;
    height: 26px;
    border-radius: 8px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 750;
    background: color-mix(in srgb, var(--cat) var(--cat-mix), transparent);
    color: var(--cat);
}

.tpl-shell .prev-wrap .prev-section-head.sub {
    margin-top: 16px;
}

.tpl-shell .prev-wrap .prev-heading {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.tpl-shell .prev-wrap .prev-subheading {
    flex: 1;
    font-size: 14px;
    font-weight: 650;
    color: var(--text);
}

.tpl-shell .prev-wrap .prev-section-count {
    font-family: var(--font-ui);
    font-size: 10.5px;
    font-weight: 600;
    color: var(--faint);
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 20px;
}

/* --- page summary --- */

.tpl-shell .prev-wrap .sum {
    margin-top: 8px;
}

.tpl-shell .prev-wrap .sum-title {
    font-family: var(--font-ui);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .12em;
    color: var(--faint);
    margin: 0 0 10px;
}

.tpl-shell .prev-wrap .sum-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.tpl-shell .prev-wrap .sum-tile {
    flex: 1;
    min-width: 120px;
    gap: 0;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: none;
}

.tpl-shell .prev-wrap .sum-figure {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 750;
    line-height: 1;
    color: var(--text);
}

.tpl-shell .prev-wrap .sum-tile:last-child .sum-figure {
    color: var(--accent);
}

.tpl-shell .prev-wrap .sum-label {
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--dim);
    margin-top: 6px;
}

.tpl-shell .prev-wrap .sum-card {
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: none;
}

.tpl-shell .prev-wrap .sum-head {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 3px;
}

.tpl-shell .prev-wrap .sum-note {
    font-size: 12.5px;
    color: var(--dim);
    margin: 0 0 12px;
}

.tpl-shell .prev-wrap .sum-list {
    margin: 0;
}

.tpl-shell .prev-wrap .sum-list li {
    border-top: 1px solid var(--border);
}

.tpl-shell .prev-wrap .sum-link {
    font-size: 13.5px;
    font-weight: 550;
    color: var(--accent);
    padding: 9px 0;
}

.tpl-shell .prev-wrap .sum-link:hover {
    opacity: .8;
    text-decoration: none;
}

/* the design collapses the preview's two columns at 860px */
@media (max-width: 860px) {
    .tpl-shell .prev-wrap .prev-shell {
        grid-template-columns: 1fr;
    }

    .tpl-shell .prev-wrap .prev-nav {
        position: static;
    }
}

/* ------------------------------------------------------------------
   Requests module Ã¢â‚¬â€ mirrors Requests.dc.html one-for-one. Every number
   below is the design's own px value. The token block re-points both
   the design's names and the app's legacy names, so nested components
   (Dropdown, RequestPreview, PortalField, Quill) adopt the palette too.
   Status colour rides on --st / --st-soft, set by the .st-Ã¢â‚¬Â¦ class.
   ------------------------------------------------------------------ */

.req-shell {
    --bg: #f4f4f7;
    --surface: #ffffff;
    --surface2: #f2f2f6;
    --head: #fafafb;
    --border: rgba(20, 20, 30, .09);
    --text: #181820;
    --dim: rgba(24, 24, 32, .58);
    --faint: rgba(24, 24, 32, .36);
    --track: rgba(20, 20, 30, .1);

    --accent: #6d5cf5;
    --accent-hover: #5c4ae4;
    --accent-soft: rgba(109, 92, 245, .1);
    --ok: #16a34a;
    --ok-soft: rgba(22, 163, 74, .1);
    --ok-border: rgba(22, 163, 74, .28);
    --danger: #dc4b4b;
    --danger-soft: rgba(220, 75, 75, .08);

    /* chip fills Ã¢â‚¬â€ hex2rgba(colour, .12) in light, .16 in dark */
    --st-draft-soft: rgba(24, 24, 32, .12);
    --st-sent-soft: rgba(75, 139, 244, .12);
    --st-inprogress-soft: rgba(224, 161, 27, .12);
    --st-submitted-soft: rgba(22, 163, 74, .12);
    --st-approved-soft: rgba(109, 92, 245, .12);

    /* legacy names Ã¢â€ â€™ design palette, for nested components */
    --line: rgba(20, 20, 30, .09);
    --card: #ffffff;
    --surface-2: #f2f2f6;
    --paper: #f4f4f7;
    --field: #f4f4f7;
    --ink: #181820;
    --ink-deep: #181820;
    --ink-soft: rgba(24, 24, 32, .58);
    --good: #16a34a;
    --bad: #dc4b4b;
    --radius: 12px;

    color: var(--text);
}

:root[data-theme="dark"] .req-shell {
    --bg: #0d0d12;
    --surface: #131319;
    --surface2: #1c1c24;
    --head: #0f0f15;
    --border: rgba(255, 255, 255, .08);
    --text: #e8e8ec;
    --dim: rgba(232, 232, 236, .6);
    --faint: rgba(232, 232, 236, .34);
    --track: rgba(255, 255, 255, .1);

    --accent: #6d5cf5;
    --accent-hover: #8b7bff;
    --accent-soft: rgba(109, 92, 245, .16);
    --ok: #3ec77e;
    --ok-soft: rgba(62, 199, 126, .12);
    --ok-border: rgba(62, 199, 126, .3);
    --danger: #f06d6d;
    --danger-soft: rgba(240, 109, 109, .14);

    --st-draft-soft: rgba(232, 232, 236, .16);
    --st-sent-soft: rgba(75, 139, 244, .16);
    --st-inprogress-soft: rgba(224, 161, 27, .16);
    --st-submitted-soft: rgba(62, 199, 126, .16);
    --st-approved-soft: rgba(109, 92, 245, .16);

    --line: rgba(255, 255, 255, .08);
    --card: #131319;
    --surface-2: #1c1c24;
    --paper: #0d0d12;
    --field: #0d0d12;
    --ink: #e8e8ec;
    --ink-deep: #e8e8ec;
    --ink-soft: rgba(232, 232, 236, .6);
    --good: #3ec77e;
    --bad: #f06d6d;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .req-shell {
        --bg: #0d0d12;
        --surface: #131319;
        --surface2: #1c1c24;
        --head: #0f0f15;
        --border: rgba(255, 255, 255, .08);
        --text: #e8e8ec;
        --dim: rgba(232, 232, 236, .6);
        --faint: rgba(232, 232, 236, .34);
        --track: rgba(255, 255, 255, .1);

        --accent: #6d5cf5;
        --accent-hover: #8b7bff;
        --accent-soft: rgba(109, 92, 245, .16);
        --ok: #3ec77e;
        --ok-soft: rgba(62, 199, 126, .12);
        --ok-border: rgba(62, 199, 126, .3);
        --danger: #f06d6d;
        --danger-soft: rgba(240, 109, 109, .14);

        --st-draft-soft: rgba(232, 232, 236, .16);
        --st-sent-soft: rgba(75, 139, 244, .16);
        --st-inprogress-soft: rgba(224, 161, 27, .16);
        --st-submitted-soft: rgba(62, 199, 126, .16);
        --st-approved-soft: rgba(109, 92, 245, .16);

        --line: rgba(255, 255, 255, .08);
        --card: #131319;
        --surface-2: #1c1c24;
        --paper: #0d0d12;
        --field: #0d0d12;
        --ink: #e8e8ec;
        --ink-deep: #e8e8ec;
        --ink-soft: rgba(232, 232, 236, .6);
        --good: #3ec77e;
        --bad: #f06d6d;
    }
}

/* ST = { Draft: faint, Sent: #4b8bf4, In progress: #e0a11b,
          Submitted: ok, Approved: accent } */
.req-shell .st-draft { --st: var(--faint); --st-soft: var(--st-draft-soft); }
.req-shell .st-sent { --st: #4b8bf4; --st-soft: var(--st-sent-soft); }
.req-shell .st-inprogress { --st: #e0a11b; --st-soft: var(--st-inprogress-soft); }
.req-shell .st-submitted { --st: var(--ok); --st-soft: var(--st-submitted-soft); }
.req-shell .st-approved { --st: var(--accent); --st-soft: var(--st-approved-soft); }

/* --- shared atoms (status chip, avatar, ring, bar) --- */

.req-shell .st-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .02em;
    color: var(--st);
    background: var(--st-soft);
    padding: 4px 10px;
    border-radius: 8px;
    white-space: nowrap;
}

.req-shell .st-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--st);
    flex: none;
}

.req-shell .st-rail {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: var(--st);
}

.req-shell .req-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    border-radius: 10px;
    background: var(--surface2);
    color: var(--dim);
    font-weight: 700;
}

.req-shell .req-avatar.lg { width: 42px; height: 42px; font-size: 12px; }
.req-shell .req-avatar.sm { width: 30px; height: 30px; font-size: 10.5px; }

.req-shell .req-ring {
    position: relative;
    flex: none;
}

.req-shell .req-ring svg { transform: rotate(-90deg); display: block; }

.req-shell .req-ring-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--text);
}

.req-shell .req-ring.big .req-ring-pct { font-size: 12px; }

.req-shell .req-bar {
    flex: 1;
    height: 6px;
    border-radius: 4px;
    background: var(--surface2);
    overflow: hidden;
}

.req-shell .req-bar > span {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
}

/* --- the shared Dropdown, wearing the design's selects --- */

.req-shell .req-filter .dd-trigger {
    position: relative;
    height: 38px;
    padding: 0 32px 0 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 550;
    min-width: 132px;
}

/* the design draws the chevron as a pinned glyph, so it leaves the flex row */
.req-shell .req-filter .dd-trigger::after {
    position: absolute;
    right: 14px;
    top: 50%;
    margin-top: -4px;
    width: 6px;
    height: 6px;
    border-right: 2px solid var(--faint);
    border-bottom: 2px solid var(--faint);
    transform: rotate(45deg);
}

.req-shell .req-select .dd-trigger {
    position: relative;
    height: 46px;
    padding: 0 40px 0 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

.req-shell .req-select .dd-trigger::after {
    position: absolute;
    right: 16px;
    top: 50%;
    margin-top: -5px;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--faint);
    border-bottom: 2px solid var(--faint);
    transform: rotate(45deg);
}

.req-shell .dd-menu {
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
}

/* ------------------------------------------------------------------
   The shared RequestPreview + PortalField + PageSummary, wearing the
   design's review column. Three-class selectors deliberately: those
   components' scoped rules load after app.css, so a two-class override
   would lose the tie.
   ------------------------------------------------------------------ */

.req-shell .prev-wrap .prev-lockbar {
    gap: 10px;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    background: var(--surface2);
    color: var(--dim);
    font-size: 13px;
    margin-bottom: 20px;
}

.req-shell .prev-wrap .prev-lockbar svg {
    width: 16px;
    height: 16px;
    color: var(--dim);
}

.req-shell .prev-wrap .prev-shell {
    grid-template-columns: 280px 1fr;
    gap: 24px;
    width: auto;
    padding:0% 2%
}

/* the client sits in the header card on this page, not in the rail */
.req-shell .prev-wrap .prev-client { display: none; }

.req-shell .prev-wrap .prev-nav {
    position: sticky;
    top: 20px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: none;
}

.req-shell .prev-wrap .prev-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.req-shell .prev-wrap .prev-due {
    font-size: 11.5px;
    color: var(--faint);
    margin: 0 0 14px;
}

.req-shell .prev-wrap .prev-nav-list { gap: 0; }

.req-shell .prev-wrap .prev-nav-item {
    gap: 8px;
    padding: 9px 10px;
    margin-bottom: 2px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--dim);
}

.req-shell .prev-wrap .prev-nav-item:hover { background: var(--surface2); }

.req-shell .prev-wrap .prev-nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 650;
}

.req-shell .prev-wrap .prev-nav-sub {
    margin: 0;
    padding-left: 0;
    border-left: none;
}

.req-shell .prev-wrap .prev-nav-subitem {
    gap: 8px;
    padding: 8px 10px 8px 22px;
    margin-bottom: 2px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--dim);
}

.req-shell .prev-wrap .prev-nav-subitem:hover { background: var(--surface2); }

.req-shell .prev-wrap .prev-nav-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--faint);
    background: none;
    padding: 0;
    flex: none;
}

.req-shell .prev-wrap .prev-nav-tick {
    width: 18px;
    height: 18px;
    background: var(--ok);
    color: #fff;
}

.req-shell .prev-wrap .prev-nav-tick svg { width: 11px; height: 11px; }

.req-shell .prev-wrap .prev-body { gap: 16px; }

.req-shell .prev-wrap .prev-card {
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: none;
}

.req-shell .prev-wrap .prev-section-head {
    align-items: baseline;
    gap: 10px;
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.req-shell .prev-wrap .prev-section-head.sub { margin-top: 16px; }

.req-shell .prev-wrap .prev-heading {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.req-shell .prev-wrap .prev-subheading {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.req-shell .prev-wrap .prev-section-count {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 600;
    color: var(--faint);
    background: none;
    padding: 0;
}

/* --- question cards --- */

.req-shell .prev-wrap .field-row {
    display: flex;
    gap: 14px;
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: none;
    margin: 0;
}

.req-shell .prev-wrap .field-no {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 700;
    flex: none;
}

.req-shell .prev-wrap .field-main {
    flex: 1;
    min-width: 0;
    gap: 0;
}

.req-shell .prev-wrap .field-label {
    font-size: 15px;
    font-weight: 650;
    color: var(--text);
    margin-bottom: 8px;
}

.req-shell .prev-wrap .field-description {
    font-size: 13px;
    color: var(--dim);
    margin-bottom: 10px;
}

/* a locked answer reads as a filled block, not an input */
.req-shell .prev-wrap .field-row.locked :is(input[type=text], input[type=number], input[type=date], textarea) {
    width: 100%;
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--dim);
    padding: 10px 14px;
    background: var(--surface2);
    border: none;
    border-radius: 10px;
    margin-bottom: 14px;
    opacity: 1;
}

.req-shell .prev-wrap .yesno-group,
.req-shell .prev-wrap .checkbox-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.req-shell .prev-wrap .yesno-option,
.req-shell .prev-wrap .checkbox-option {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    color: var(--dim);
}

.req-shell .prev-wrap .field-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.req-shell .prev-wrap .field-actions .review {
    display: flex;
    align-items: center;
    gap: 12px;
}

.req-shell .prev-wrap .review-hint {
    font-size: 12.5px;
    color: var(--faint);
}

.req-shell .prev-wrap .pill {
    height: 27px;
    padding: 0 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--dim);
    font-family: var(--font-ui);
    font-size: 11.5px;
    font-weight: 650;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.req-shell .prev-wrap .pill.approve {
    border-color: var(--ok-border);
    background: var(--ok-soft);
    color: var(--ok);
}

.req-shell .prev-wrap .pill.changes { color: var(--accent); }
.req-shell .prev-wrap .pill.changes:hover { background: var(--accent-soft); }

.req-shell .prev-wrap .pill.comment {
    margin-left: auto;
    font-weight: 600;
}

.req-shell .prev-wrap .pill.comment:hover {
    background: var(--surface2);
    color: var(--text);
}

/* --- page summary --- */

.req-shell .prev-wrap .sum { margin-top: 26px; }

.req-shell .prev-wrap .sum-title {
    font-family: var(--font-ui);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--faint);
    margin: 0 0 10px;
}

.req-shell .prev-wrap .sum-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.req-shell .prev-wrap .sum-tile {
    flex: 1;
    min-width: 120px;
    gap: 0;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: none;
}

.req-shell .prev-wrap .sum-figure {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 750;
    line-height: 1;
    color: var(--text);
}

.req-shell .prev-wrap .sum-tile:last-child .sum-figure { color: var(--accent); }

.req-shell .prev-wrap .sum-label {
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dim);
    margin-top: 6px;
}

.req-shell .prev-wrap .sum-card {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: none;
}

.req-shell .prev-wrap .sum-done {
    display: flex;
    align-items: center;
    gap: 12px;
}

.req-shell .prev-wrap .sum-check {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--ok);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.req-shell .prev-wrap .sum-check svg { width: 15px; height: 15px; }

.req-shell .prev-wrap .sum-head {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 3px;
}

.req-shell .prev-wrap .sum-note {
    font-size: 12.5px;
    color: var(--dim);
    margin: 0 0 10px;
}

.req-shell .prev-wrap .sum-list { margin: 0; }
.req-shell .prev-wrap .sum-list li { border-top: 1px solid var(--border); }

.req-shell .prev-wrap .sum-link {
    font-size: 13.5px;
    font-weight: 550;
    color: var(--accent);
    padding: 9px 0;
}

.req-shell .prev-wrap .sum-link:hover { opacity: .8; text-decoration: none; }

/* the design collapses the review columns at 900px */
@media (max-width: 900px) {
    .req-shell .prev-wrap .prev-shell { grid-template-columns: 1fr; }
    .req-shell .prev-wrap .prev-nav { position: static; }
}

/* ============================================================
   Landing + login ("vault") tokens.
   Dark is the design, literal; light is the same layout on paper.
   light-dark() picks per used colour-scheme, so one token list
   covers both — the theme toggle just flips color-scheme below.
   ponytail: needs light-dark() (Chrome 123 / Safari 17.5 / FF 120).
   ============================================================ */

.landing-shell,
.auth-shell {
    color-scheme: light dark;

    --lv-bg: light-dark(#f6f7f9, #08080b);
    --lv-fg: light-dark(#16181d, #ffffff);
    --lv-fg-60: light-dark(#4b535e, rgba(255, 255, 255, 0.6));
    --lv-fg-55: light-dark(#4b535e, rgba(255, 255, 255, 0.55));
    --lv-fg-50: light-dark(#626b76, rgba(255, 255, 255, 0.5));
    --lv-fg-40: light-dark(#757d88, rgba(255, 255, 255, 0.4));
    --lv-fg-35: light-dark(#868e99, rgba(255, 255, 255, 0.35));
    --lv-fg-32: light-dark(#8d95a0, rgba(255, 255, 255, 0.32));

    --lv-line-soft: light-dark(#eef0f3, rgba(255, 255, 255, 0.04));
    --lv-hairline: light-dark(#e4e7eb, rgba(255, 255, 255, 0.055));
    --lv-line-mid: light-dark(#e8ebef, rgba(255, 255, 255, 0.06));
    --lv-line: light-dark(#e4e7eb, rgba(255, 255, 255, 0.07));
    --lv-line-09: light-dark(#e4e7eb, rgba(255, 255, 255, 0.09));
    --lv-line-10: light-dark(#dfe3e8, rgba(255, 255, 255, 0.1));
    --lv-line-12: light-dark(#d8dde3, rgba(255, 255, 255, 0.12));
    --lv-line-strong: light-dark(#cfd5dc, rgba(255, 255, 255, 0.16));
    --lv-line-hover: light-dark(#9aa3ae, rgba(255, 255, 255, 0.4));
    --lv-footline: light-dark(#e4e7eb, rgba(255, 255, 255, 0.05));

    --lv-surface: light-dark(#ffffff, rgba(255, 255, 255, 0.02));
    --lv-surface-2: light-dark(#ffffff, rgba(255, 255, 255, 0.03));
    --lv-surface-3: light-dark(#f2f3f6, rgba(255, 255, 255, 0.04));
    --lv-tint: light-dark(rgba(109, 92, 245, 0.08), rgba(109, 92, 245, 0.14));
    --lv-tint-2: light-dark(rgba(109, 92, 245, 0.03), rgba(109, 92, 245, 0.05));
    --lv-chrome-fill: light-dark(linear-gradient(180deg, #ffffff, #fbfbfd), linear-gradient(180deg, rgba(34, 34, 46, 0.42), rgba(13, 13, 19, 0.18)));

    --lv-violet: #6d5cf5;
    --lv-violet-2: #7b6bff;
    --lv-violet-strong: light-dark(#6d5cf5, #8b7cff);
    --lv-violet-text: light-dark(#5b4bd8, #a99cff);
    --lv-violet-eyebrow: light-dark(#5b4bd8, #9b8cff);
    --lv-violet-soft: light-dark(rgba(109, 92, 245, 0.1), rgba(109, 92, 245, 0.16));
    --lv-violet-line: light-dark(rgba(109, 92, 245, 0.35), rgba(139, 124, 255, 0.28));
    --lv-violet-line-2: light-dark(rgba(109, 92, 245, 0.4), rgba(139, 124, 255, 0.4));
    --lv-violet-icon-bg: light-dark(rgba(109, 92, 245, 0.1), rgba(109, 92, 245, 0.15));
    --lv-violet-icon-line: light-dark(rgba(109, 92, 245, 0.22), rgba(139, 124, 255, 0.25));
    --lv-violet-icon-fg: light-dark(#6d5cf5, #a99cff);
    --lv-teal: light-dark(#0f9b84, #5eead4);
    --lv-teal-soft: light-dark(rgba(15, 155, 132, 0.12), rgba(94, 234, 212, 0.12));
    --lv-amber: light-dark(#b3761c, #f0a840);
    --lv-amber-soft: light-dark(rgba(179, 118, 28, 0.12), rgba(240, 168, 64, 0.14));
    --lv-bar: light-dark(#dfe2e8, #2a2a38);

    --lv-grad-a: light-dark(#6d5cf5, #a99cff);
    --lv-grad-b: light-dark(#0f9b84, #5eead4);

    --lv-glow-1: light-dark(rgba(109, 92, 245, 0.14), rgba(109, 92, 245, 0.3));
    --lv-glow-2: light-dark(rgba(94, 234, 212, 0.16), rgba(94, 234, 212, 0.09));
    --lv-vignette: light-dark(rgba(16, 18, 24, 0.05), rgba(0, 0, 0, 0.5));

    --lv-card-bg: light-dark(#ffffff, linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.018)));
    --lv-card-line: light-dark(#e4e7eb, rgba(255, 255, 255, 0.1));
    /* two tokens: light-dark() takes exactly two args, and a shadow list has commas */
    --lv-card-shadow: light-dark(0 30px 70px -35px rgba(16, 18, 24, 0.35), 0 40px 100px -30px rgba(0, 0, 0, 0.85));
    --lv-card-inset: light-dark(inset 0 1px 0 rgba(255, 255, 255, 0), inset 0 1px 0 rgba(255, 255, 255, 0.09));
    --lv-field-bg: light-dark(#f6f7f9, rgba(255, 255, 255, 0.03));
}

/* the site toggle drives which half of every light-dark() applies */
:root[data-theme="light"] .landing-shell,
:root[data-theme="light"] .auth-shell { color-scheme: light; }

:root[data-theme="dark"] .landing-shell,
:root[data-theme="dark"] .auth-shell { color-scheme: dark; }
