﻿/* ============================================================
   AE Partners — workspace tokens. Legacy names kept so existing
   component styles adopt the AE Partners theme (wwwroot/theme.css).
   Values only point at theme tokens; light/dark lives in theme.css.
   ============================================================ */

:root {
    --font-ui: var(--font-body);
    --font-display: var(--font-heading);

    /* surfaces */
    --paper: var(--bg-app);         /* app canvas */
    --surface-2: var(--bg-subtle);  /* subtle raised / hover */
    --card: var(--bg-surface);      /* panels, tables, cards */
    --line: var(--border);          /* borders / dividers */

    /* text */
    --ink: var(--text-primary);
    --ink-deep: var(--text-primary);
    --ink-soft: var(--text-secondary);

    /* accent — links, active nav, focus, primary actions, progress */
    --accent: var(--brand-primary-strong);
    --accent-hover: var(--brand-primary-hover);
    --accent-soft: var(--brand-primary-tint);
    --copper: var(--brand-primary-strong);

    /* status */
    --good: var(--success);
    --bad: var(--danger);

    /* role accents (permissions matrix, team lists) */
    --role-admin: var(--brand-primary);
    --role-editor: var(--success);
    --role-reviewer: var(--brand-accent);
    --role-viewer: var(--text-secondary);

    /* text that sits on a brand fill */
    --on-dark: var(--text-on-brand);
    --cream: var(--text-on-brand);

    /* app-shell chrome */
    --sidebar-bg: var(--bg-subtle);
    --sidebar-fg: var(--text-secondary);
    --sidebar-fg-soft: var(--text-tertiary);
    --sidebar-active-bg: var(--brand-primary-tint);

    /* admin rail */
    --rail-bg: var(--bg-subtle);
    --rail-border: var(--border);
    --rail-divider: var(--border);
    --rail-brand-ink: var(--text-primary);
    --rail-brand-tag: var(--text-secondary);
    --rail-btn-bg: var(--bg-surface);
    --rail-btn-border: var(--border);
    --rail-btn-ink: var(--text-secondary);
    --rail-btn-hover: var(--border);
    --rail-group-ink: var(--text-tertiary);
    --rail-item-ink: var(--text-secondary);
    --rail-item-hover: color-mix(in srgb, var(--text-primary) 5%, transparent);
    --rail-active-bg: var(--brand-primary-tint);
    --rail-active-ink: var(--brand-primary-strong);
    --rail-active-bar: var(--brand-primary);
    --rail-pill: var(--brand-primary);
    --rail-badge-bg: var(--brand-primary-tint);
    --rail-badge-ink: var(--brand-primary-strong);
    --rail-count-ink: var(--text-tertiary);
    --rail-card-bg: var(--bg-surface);
    --rail-card-ink: var(--text-primary);
    --rail-logout-ink: var(--text-secondary);
    --rail-logout-hover: color-mix(in srgb, var(--text-primary) 7%, transparent);
    --rail-drawer-bg: var(--bg-subtle);
    --rail-topbar-bg: var(--bg-surface);
    --rail-burger-bar: var(--text-primary);
    --rail-scrim: var(--scrim);
    --rail-modal-bg: var(--bg-surface);
    --rail-modal-border: var(--border);
    --rail-modal-title: var(--text-primary);
    --rail-modal-body: var(--text-secondary);
    --rail-cancel-bg: var(--bg-subtle);
    --rail-cancel-border: var(--border);
    --rail-cancel-ink: var(--text-primary);

    --radius: 8px;
}

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;
}

/* --- QuickGrid bridge (admin list pages) --- */

/* QuickGrid ships two stylesheets. Its Themes/Default.css is keyed entirely on
   [theme=default], so passing Theme="aep" on the grid switches every one of
   those rules off in one move — padding, bold headers, grey hover fills, the
   lot. What's left below is only the component's own scoped CSS, which we
   can't switch off and have to out-specify.

   Specificity matters here: app.css is linked BEFORE the scoped bundle
   (App.razor), so an equal-specificity rule loses. Every selector below leads
   with `table.quickgrid` / `div.table-pager` to add the element that wins the
   tie. Don't "simplify" those away. */

table.quickgrid {
    width: 100%;
    border-collapse: collapse;
}

/* Table chrome — header, cell padding, row rules — lives here, not per page.
   This used to exist only as ~50 lines of `::deep .rq-grid th/td` on the checklists
   page, so every other grid rendered as unpadded, unruled browser-default rows. */

table.quickgrid th {
    padding: 13px 12px 13px 0;
    text-align: left;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    white-space: nowrap;
}

table.quickgrid td {
    padding: 14px 12px 14px 0;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

/* The row inset belongs at the row edges, not between every column. */
table.quickgrid th:first-child,
table.quickgrid td:first-child {
    padding-left: 18px;
}

table.quickgrid th:last-child,
table.quickgrid td:last-child {
    padding-right: 18px;
}

/* Head corners round into the .tablecard that wraps the grid. */
table.quickgrid thead tr th:first-child {
    border-radius: 12px 0 0 0;
}

table.quickgrid thead tr th:last-child {
    border-radius: 0 12px 0 0;
}

/* No rule under the last real row — :last-child would land on a hidden filler
   row (see the display:none rule below); real rows carry aria-rowindex. */
table.quickgrid tbody tr[aria-rowindex]:not(:has(~ tr[aria-rowindex])) td {
    border-bottom: none;
}

/* QuickGrid pads every page out to ItemsPerPage with blank <tr>s so the table
   keeps a constant height — which reads as a run of empty ruled lines after the
   last record. Real rows carry aria-rowindex; the filler never does. */
table.quickgrid tbody tr:not([aria-rowindex]) {
    display: none;
}

/* Sortable headers render as <button>. Strip the button back to plain text so
   the page's own `th` typography (weight, size, letter-spacing) shows through
   unchanged — a sorted table must look identical to an unsorted one. */
table.quickgrid th .col-title {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    padding: 0;
    align-items: center;
}

table.quickgrid th button.col-title {
    cursor: pointer;
}

table.quickgrid th button.col-title:hover {
    color: var(--accent);
}

/* QuickGrid's caret is a black data-URI SVG — invisible on dark. Paint it with
   a mask instead so it takes currentColor and follows the theme. */
table.quickgrid th .sort-indicator {
    width: 0.85rem;
    height: 0.85rem;
    opacity: 0.55;
}

table.quickgrid .col-sort-asc .sort-indicator,
table.quickgrid .col-sort-desc .sort-indicator {
    background-image: none;
    background-color: currentColor;
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M 2 3.25 L 12 20.75 L 22 3.25 L 12 10 z"/></svg>') center / 0.7rem no-repeat;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M 2 3.25 L 12 20.75 L 22 3.25 L 12 10 z"/></svg>') center / 0.7rem no-repeat;
}

table.quickgrid .col-sort-asc .sort-indicator {
    color: var(--accent);
    opacity: 1;
}

table.quickgrid .col-sort-desc .sort-indicator {
    color: var(--accent);
    opacity: 1;
}

/* QuickGrid 10.0.10 has no OnRowClick parameter and we don't control the <tr>,
   so "click the row to open it" lives on a wrapper inside each cell that should
   navigate. Cells that must NOT navigate (group filter chip, action buttons)
   simply omit it — that reproduces the old @onclick:stopPropagation exactly.

   The negative margins pull the wrapper out over the td's padding band so the
   whole cell is the target, not just the text inside it. They must stay in step
   with the `table.quickgrid td` padding above (and the wider first/last-child
   inset), otherwise the row grows or a dead edge comes back. */
.cell-hit {
    display: block;
    margin: -14px -12px -14px 0;
    padding: 14px 12px 14px 0;
}

table.quickgrid td:first-child .cell-hit {
    margin-left: -18px;
    padding-left: 18px;
}

table.quickgrid td:last-child .cell-hit {
    margin-right: -18px;
    padding-right: 18px;
}

/* Pager. Wrap every <Paginator> in <div class="table-pager"> — the wrapper is
   what lets these beat the Paginator's own scoped rules.

   Paginator's markup is:
     .paginator > .summary ("N items")
               > nav > .go-first .go-previous .pagination-text .go-next .go-last

   Its own CSS pins nav right with `margin-left:auto` and draws a bare grey
   rule on top. Both are replaced here: the whole control centres under the
   table as one card, using the same surface/border/radius as the table itself. */
div.table-pager {
    display: flex;
    justify-content: center;
    margin-top: 0.9rem;
}

div.table-pager .paginator {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    margin: 0;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--line);
    border-top: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    font-family: var(--font-ui);
    font-size: 0.78rem;
    color: var(--ink-soft);
}

/* Kills the `margin-left:auto` that would shove the buttons to the far right. */
div.table-pager .paginator nav {
    margin-left: 0;
    gap: 0.3rem;
}

div.table-pager .summary,
div.table-pager .pagination-text {
    margin: 0;
    white-space: nowrap;
}

div.table-pager .summary strong,
div.table-pager .pagination-text strong {
    font-weight: 600;
    color: var(--ink);
}

/* Divider between the item count and the controls, matching the table rules. */
div.table-pager .summary {
    padding-right: 1rem;
    border-right: 1px solid var(--line);
}

div.table-pager .pagination-text {
    padding: 0 0.35rem;
}

div.table-pager nav button {
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    line-height: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background-color: transparent;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

/* QuickGrid paints the four arrows as black data-URI SVGs, which vanish on the
   dark theme. Repaint them with a mask so they take currentColor instead.
   `background: none center/1rem no-repeat` in its scoped CSS is a shorthand, so
   background-image has to be cleared explicitly here. */
div.table-pager nav button.go-first,
div.table-pager nav button.go-previous,
div.table-pager nav button.go-next,
div.table-pager nav button.go-last {
    background-image: none;
    color: var(--ink-soft);
}

div.table-pager nav button.go-first::before,
div.table-pager nav button.go-previous::before,
div.table-pager nav button.go-next::before,
div.table-pager nav button.go-last::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    background-color: currentColor;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 0.62rem;
    mask-size: 0.62rem;
}

div.table-pager nav button.go-previous::before,
div.table-pager nav button.go-next::before {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g transform="rotate(90)" transform-origin="12 12"><path d="M 2 3.25 L 12 20.75 L 22 3.25 L 12 11 z"/></g></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g transform="rotate(90)" transform-origin="12 12"><path d="M 2 3.25 L 12 20.75 L 22 3.25 L 12 11 z"/></g></svg>');
}

div.table-pager nav button.go-first::before,
div.table-pager nav button.go-last::before {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g transform="rotate(90) scale(0.8)" transform-origin="12 12"><path d="m 2,1.5 l 10,17.5 l 10,-17.5 l -10,7.75 l -10,-7.75 z"/><rect height="2" width="20" y="20.5" x="2"/></g></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g transform="rotate(90) scale(0.8)" transform-origin="12 12"><path d="m 2,1.5 l 10,17.5 l 10,-17.5 l -10,7.75 l -10,-7.75 z"/><rect height="2" width="20" y="20.5" x="2"/></g></svg>');
}

div.table-pager nav button:not([disabled]):hover {
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
    background-color: var(--accent-soft);
    color: var(--accent);
}

div.table-pager nav button:not([disabled]):active {
    background-color: color-mix(in srgb, var(--accent) 20%, transparent);
}

div.table-pager nav button[disabled] {
    opacity: 0.32;
}

/* --- 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: var(--danger-ink);
    padding: 1rem 1rem 1rem 1.2rem;
    color: var(--text-on-brand);
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* --- Kanban board (shared by Checklists 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;
}

/* --- Back navigation, every detail page (see Shared/BackLink.razor) ---
   Global, not scoped: one look for every module. The chevron comes from
   Icon.ChevronLeft at 18px, sized down here so it matches the label's cap
   height instead of towering over it. */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 550;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.back-link svg {
    width: 15px;
    height: 15px;
}

.back-link:hover {
    opacity: .82;
    color: var(--accent);
    text-decoration: none;
}

/* Three pages sit the link inside a horizontal bar next to the title instead of
   on its own line above it. There the bar owns the spacing — the link's own
   bottom margin would just lift it off the title's centre line. */
.detail-bar .back-link,
.detail-head .back-link,
.wiz-topbar .back-link {
    margin-bottom: 0;
}

/* --- "nothing here" / "not found" copy, every module ---
   Was six scoped copies with six different sizes, paddings and greys. One rule:
   --ink-soft is re-declared inside the module token blocks to the same value
   their local --dim carries, so this reads identically in all of them. */

.empty-note {
    color: var(--ink-soft);
    font-size: 0.875rem;
    padding: 1.2rem 0;
}

/* --- Checklist status pill, every module (see Shared/StatusBadge.razor) ---
   One progression: unsent grey, out with the client accent, being filled amber,
   waiting on us blue, done green — and overdue red, which outranks all of them.
   Keyed on data-status rather than a .status-… class so it cannot collide with
   the .st-… container modifiers the checklists board already uses. */

.status-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}

.status-badge[data-status="draft"] {
    background: var(--surface-2);
    color: var(--ink-soft);
}

.status-badge[data-status="sent"] {
    background: var(--accent-soft);
    color: var(--accent);
}

.status-badge[data-status="inprogress"] {
    background: var(--warning-tint);
    color: var(--warning-ink);
}

.status-badge[data-status="submitted"] {
    background: var(--info-tint);
    color: var(--info-ink);
}

.status-badge[data-status="approved"] {
    background: color-mix(in srgb, var(--good) 16%, transparent);
    color: var(--good);
}

.status-badge[data-status="overdue"],
.status-badge[data-status="expired"] {
    background: color-mix(in srgb, var(--bad) 15%, transparent);
    color: var(--bad);
}

/* Job statuses ride the same pill (see Work/JobLook.cs) so one status is one
   colour across the app. "inprogress" is shared with checklists on purpose — same
   word, same meaning, same amber. The two waiting-on-someone-else states share
   blue because to the person reading the board they mean the same thing: not
   your move. */

.status-badge[data-status="planned"] {
    background: var(--surface-2);
    color: var(--ink-soft);
}

.status-badge[data-status="readytostart"],
.status-badge[data-status="reviewandadvise"] {
    background: var(--accent-soft);
    color: var(--accent);
}

.status-badge[data-status="waitingforinfo"],
.status-badge[data-status="waitingforsignature"] {
    background: var(--info-tint);
    color: var(--info-ink);
}

.status-badge[data-status="completed"] {
    background: color-mix(in srgb, var(--good) 16%, transparent);
    color: var(--good);
}

/* --- Buttons, every module (see Shared/Button.razor) ---
   There used to be no bare .btn rule at all, despite 27 elements asking for one:
   .btn-primary was redefined five times, .btn-ghost and .btn-cancel four each,
   every copy in its own module palette. So the same button was indigo on one
   screen, violet on another, and a different height on a third.

   One base + three variants + three sizes, on the global tokens. Legacy names
   (btn-save, btn-confirm, btn-invite, btn-discard, btn-cancel, btn-softdelete,
   btn-reactivate, btn-add) all map onto these — see git history if you are
   looking for one of them. */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    font: 600 13px var(--font-ui);
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

/* A button that is an <a> still matches the global `a:hover { text-decoration:
   underline }`, which outranks .btn on its own. Kill it on every state, or every
   link-shaped button underlines the moment you point at it. */
.btn:hover,
.btn:focus,
.btn:active,
.btn:visited {
    text-decoration: none;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: default;
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* sizes */

.btn-lg {
    height: 50px;
    padding: 0 24px;
    border-radius: 10px;
    font-size: 14.5px;
}

.btn-sm {
    height: 34px;
    padding: 0 13px;
    border-radius: 8px;
    font-size: 12.5px;
}

.btn-xs {
    height: 30px;
    padding: 0 11px;
    border-radius: 7px;
    font-size: 12px;
}

/* Variants.
   Doubled class (.btn.btn-variant) on purpose, not by accident: a module that
   colours its links — `.clients-page a { color: var(--c-link) }` — is (0,1,1) and
   would otherwise beat a single-class .btn-primary and repaint every button that
   happens to be an <a>. Two classes puts the button ahead of any `.page a` rule
   in both the resting and hover state. */

.btn.btn-primary {
    background: var(--accent);
    color: var(--on-dark);
}

.btn.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    color: var(--on-dark);
}

.btn.btn-ghost {
    border-color: var(--line);
    background: var(--card);
    color: var(--ink);
    font-weight: 550;
}

.btn.btn-ghost:hover:not(:disabled) {
    background: var(--surface-2);
    color: var(--ink);
}

.btn.btn-danger {
    border-color: color-mix(in srgb, var(--bad) 35%, transparent);
    background: color-mix(in srgb, var(--bad) 10%, transparent);
    color: var(--bad);
    font-weight: 550;
}

.btn.btn-danger:hover:not(:disabled) {
    background: color-mix(in srgb, var(--bad) 18%, transparent);
    color: var(--bad);
}

/* Square icon-only button. Combine with a variant and a size:
   class="btn btn-ghost btn-icon btn-sm". */
.btn-icon {
    width: 38px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 34px;
}

.btn-icon.btn-xs {
    width: 30px;
}

/* Fill the row it sits in — the team cards put two buttons side by side and want
   the left one to stretch. Was .btn-reactivate.wide. */
.btn.wide {
    flex: 1;
}

/* --- List-page header, every module (see Shared/PageHeader.razor) ---
   .page-head lived in four scoped stylesheets, the title answered to three
   different class names and the eyebrow to three more. One block, global. */

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.6rem;
}

.page-eyebrow {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.page-title {
    margin: 0.35rem 0 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.page-sub {
    margin: 0.4rem 0 0;
    max-width: 46rem;
    font-size: 0.875rem;
    color: var(--ink-soft);
}

.page-head-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

/* --- Row selection and the bulk bar, every list ---
   Was clients-only. Selection now means the same thing on every list view, so the
   tick, the "N selected" bar and its buttons are defined once. */

.tickbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: transparent;
    font-size: 10px;
    color: var(--on-dark);
    cursor: pointer;
}

.tickbox.on {
    border-color: var(--accent);
    background: var(--accent);
}

/* Partially selected: some rows on the page ticked, not all. */
.tickbox.some {
    border-color: var(--accent);
    color: var(--accent);
}

.bulkbar {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.bulk-count {
    color: var(--accent);
    font-size: 12px;
}

.bulk-btn {
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--card);
    color: var(--ink);
    font: 500 12px var(--font-ui);
    cursor: pointer;
}

.bulk-btn:hover {
    background: var(--surface-2);
}

.bulk-btn.danger {
    border-color: color-mix(in srgb, var(--bad) 35%, transparent);
    background: color-mix(in srgb, var(--bad) 10%, transparent);
    color: var(--bad);
}

.bulk-btn.restore {
    border-color: color-mix(in srgb, var(--good) 35%, transparent);
    background: color-mix(in srgb, var(--good) 10%, transparent);
    color: var(--good);
}

.bulk-clear {
    border: none;
    background: none;
    color: var(--ink-soft);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

/* --- Tab bar, every module ---
   Three near-identical copies existed (clients, team roster, team member) and the
   checklists page had none at all, which is why its ACTIVE/ARCHIVED tabs rendered as
   plain browser buttons. One definition, on the global tokens. */

.tabbar {
    margin-bottom:2% !important;
    display: flex;
    gap: 26px;
    margin: 22px 0 0;
    border-bottom: 1px solid var(--line);
}

.tab {
    position: relative;
    padding: 0 0 11px;
    border: none;
    background: none;
    font: 600 11.5px var(--font-mono);
    letter-spacing: 0.11em;
    color: var(--ink-soft);
    cursor: pointer;
}

.tab.on {
    color: var(--ink);
}

/* The record count beside a tab label. Was hand-spaced with &nbsp; on the clients
   page and had no rule at all on checklists, so it read as "ACTIVE34". */
.tab-count {
    margin-left: 7px;
    color: var(--ink-soft);
    font-weight: 500;
}

.tab.on .tab-count {
    color: var(--accent);
}

.tab-count:empty {
    display: none;
}

/* Underline for the active tab. A span rather than a border so switching tabs
   cannot shift the row by a pixel. */
.tab-bar {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    border-radius: 2px;
    background: transparent;
}

.tab.on .tab-bar {
    background: var(--accent);
}

/* The row above a list: how many records on the left, the bulk bar on the right.
   Shared so selection controls sit in the same place on every list view. */

.listmeta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    font-size: 12.5px;
    color: var(--ink-soft);
}

.listmeta-strong {
    color: var(--ink);
    font-weight: 600;
}

/* A selected row reads as selected on every list, not just clients. */
.list-row.picked {
    background: var(--accent-soft);
}

/* The bulk bar's Dropdown would otherwise stretch to fill the flex row. */
.bulkbar .role-bulk,
.bulkbar .req-filter {
    min-width: 150px;
    max-width: 190px;
}

/* --- How a list row and a card respond to the pointer, everywhere ---
   Every list page had invented its own: some rows tinted, some did nothing, some
   cards lifted, some only changed border. Two classes now carry the behaviour and
   each page's own rule set keeps only its layout.

   Rows tint, cards lift. A row that lifted would tear the table apart, and a card
   that only tinted reads as disabled next to one that lifts. */

.list-row,
.grid-card {
    cursor: pointer;
}

.grid-card {
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

/* Doubled class: the scoped `.mcard[b-x]` / `.tpl-card[b-x]` base borders are
   also (0,2,0) and load after app.css, so a single-class hover lost the tie —
   which is why only the checklists cards picked up the accent border. */
.grid-card.grid-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.list-row {
    transition: background 0.15s ease;
}

.list-row:hover {
    background: var(--surface-2);
}

/* The per-row menu, the selection tick and anything else clickable inside a row
   or card is its own target — the pointer should not claim the whole surface. */
.list-row .row-menu-trigger,
.list-row .tickbox,
.grid-card .row-menu-trigger,
.grid-card .tickbox {
    cursor: pointer;
}

/* Respect the OS setting: the lift is decoration, the border change carries the
   meaning, so drop only the movement. */
@media (prefers-reduced-motion: reduce) {
    .grid-card:hover {
        transform: none;
    }
}

/* --- KPI strip, every module (dashboard's shape, made shared) ---
   Three strips existed: the dashboard's kpi-card (coloured left rail, icon chip,
   big value, label, footnote), the checklists page's req-stat (dot + label + count)
   and the clients page's stat-card (label + value + note + progress bar). Same
   job, three looks. This is the dashboard's, with a dot and a track added so the
   other two fit without inventing anything. */

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    /* Top margin matters on the detail pages, where the strip follows a header
       directly — the per-page .stat-row rules each carried 20-22px and losing it
       ran the cards into the heading. It collapses against .page-head's larger
       bottom margin on the list pages, so those are unchanged. */
    margin: 1.25rem 0 0.75rem;
}

.kpi-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.85rem 0.95rem 0.85rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* The left rail is what tells the four apart at a glance.
   Drawn as a clipped pseudo-element, not border-left: a 3px left border meeting a
   1px top border across a 12px corner radius renders a visible wedge above the
   corner — the coloured sliver poking out of the top-left of the first card. */
.kpi-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--kpi-rail, transparent);
}

.kpi-l-indigo { --kpi-rail: var(--accent); }
.kpi-l-blue { --kpi-rail: var(--info); }
.kpi-l-amber { --kpi-rail: var(--brand-accent); }
.kpi-l-green { --kpi-rail: var(--good); }
.kpi-l-red { --kpi-rail: var(--bad); }
.kpi-l-grey { --kpi-rail: var(--ink-soft); }

.kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.kpi-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 10px;
    flex: none;
}

.kpi-chip svg {
    width: 16px;
    height: 16px;
}

/* For a strip whose rows are statuses, not actions — a dot instead of an icon. */
.kpi-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
    background: currentColor;
}

.kpi-value {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.7rem;
    line-height: 1;
    color: var(--ink-deep);
}

.kpi-label {
    font-size: 0.82rem;
    color: var(--ink-soft);
}

.kpi-foot {
    margin-top: 0.1rem;
    font-size: 0.75rem;
    color: var(--ink-soft);
}

/* Optional fill bar, for a stat that is a share of something. */
.kpi-track {
    height: 4px;
    margin-top: 0.5rem;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}

.kpi-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
}

/* Icon-chip and fill tints. Shared with the dashboard's activity feed. */
.tone-indigo { background: var(--accent-soft); color: var(--accent); }
.tone-blue { background: var(--info-tint); color: var(--info-ink); }
.tone-amber { background: var(--warning-tint); color: var(--warning-ink); }
.tone-red { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.tone-green { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.tone-grey { background: var(--surface-2); color: var(--ink-soft); }

.kpi-fill.tone-indigo { background: var(--accent); }
.kpi-fill.tone-blue { background: var(--info); }
.kpi-fill.tone-amber { background: var(--brand-accent); }
.kpi-fill.tone-red { background: var(--bad); }
.kpi-fill.tone-green { background: var(--good); }
.kpi-fill.tone-grey { background: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
    .kpi-card:hover {
        transform: none;
    }
}

/* ------------------------------------------------------------------
   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: var(--bg-surface);
    --surface2: var(--bg-subtle);
    --head: var(--bg-subtle);
    --cat-mix: 12%;
    --field: var(--bg-subtle);
    --text: var(--text-primary);
    --dim: var(--text-secondary);
    --faint: var(--text-tertiary);
    --danger-soft: var(--danger-tint);
    --warn-soft: var(--warning-tint);
    --warn-border: var(--warning);
    --warn-text: var(--warning-ink);

    color: var(--text);
}

/* --- page head ---
   Size and weight come from the global .page-title now; only the tighter
   bottom margin these two modules want lives here. */

.rem-shell .page-title,
.tpl-shell .page-title {
    margin: 0 0 6px;
}

.rem-shell .page-title.no-sub {
    margin-bottom: 26px;
}

/* --- tabs --- */

.rem-shell .tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 26px;
}

/* This module's tabs are deliberately a different shape from the shared .tabbar —
   14px UI font, not 11.5px tracked mono. It overrides the family, size, weight and
   colour but inherits nothing else, so the tracking has to be reset explicitly. */
.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;
    letter-spacing: normal;
    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);
}

/* --- template table --- */

.rem-shell .tmpl-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface);
    width: auto;
    padding:0% 2%;
}

/* Was a CSS grid of `2.2fr 2.6fr 1fr 1.4fr`. `fr` has no table equivalent, so
   the same proportions are expressed as percentages of the 7.2fr total under
   table-layout:fixed — which distributes width the same way grid did. */
.rem-shell .tmpl-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.rem-shell .tmpl-table th:nth-child(1) { width: 30.56%; }
.rem-shell .tmpl-table th:nth-child(2) { width: 36.11%; }
.rem-shell .tmpl-table th:nth-child(3) { width: 13.89%; }
.rem-shell .tmpl-table th:nth-child(4) { width: 19.44%; }

.rem-shell .tmpl-table th {
    padding: 13px 0;
    text-align: left;
    background: var(--head);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--dim);
}

.rem-shell .tmpl-table td {
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

/* The grid put its 22px inset on the container, not between columns — so the
   padding goes on the outer edges only, or columns 2-4 would shift right. */
.rem-shell .tmpl-table th:first-child,
.rem-shell .tmpl-table td:first-child {
    padding-left: 22px;
}

.rem-shell .tmpl-table th:last-child,
.rem-shell .tmpl-table td:last-child {
    padding-right: 22px;
}

.rem-shell .tmpl-row {
    cursor: pointer;
}

.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: var(--info-tint);
    color: var(--info-ink);
}

.rem-shell .t-icon.sms {
    background: var(--brand-secondary-tint);
    color: var(--success-ink);
}

.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 var(--text-on-brand);
    border-bottom: 2.4px solid var(--text-on-brand);
    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;
}

/* A fieldset used only to disable a whole editor at once — it must not add any
   box of its own. min-width:0 stops the UA default from breaking the layout. */
.rem-shell .edit-lock {
    border: none;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.rem-shell .edit-lock:disabled {
    opacity: 0.72;
}

/* The same body shown to a role that may look but not change it. */
.rem-shell .body-readonly {
    padding: 16px 18px;
    min-height: 200px;
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.7;
    color: var(--dim);
}

.rem-shell .readonly-note {
    margin: 0 0 16px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    font-size: 12.5px;
    color: var(--dim);
}

/* 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;
}

/* ------------------------------------------------------------------
   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: var(--text-secondary); }
.tpl-cat-accounting { --cat: var(--info-ink); }
.tpl-cat-bookkeeping { --cat: color-mix(in srgb, var(--info-ink) 60%, var(--success-ink)); }
.tpl-cat-tax { --cat: var(--warning-ink); }
.tpl-cat-advisory { --cat: var(--danger-ink); }
.tpl-cat-compliance { --cat: var(--success-ink); }
.tpl-cat-payroll { --cat: color-mix(in srgb, var(--warning-ink) 55%, var(--brand-primary-strong)); }
.tpl-cat-onboarding { --cat: var(--brand-primary-strong); }

.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: var(--shadow-lg);
}

.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: var(--text-on-brand);
}

.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: var(--text-on-brand);
    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: var(--text-on-brand);
    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-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-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: var(--shadow-lg);
}

.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;
}

/* --- the shared ChecklistPreview, 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;
    }
}

/* ------------------------------------------------------------------
   Checklists module Ã¢â‚¬â€ mirrors Checklists.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, ChecklistPreview, PortalField, Quill) adopt the palette too.
   Status colour rides on --st / --st-soft, set by the .st-Ã¢â‚¬Â¦ class.
   ------------------------------------------------------------------ */

.req-shell {
    --bg: var(--bg-app);
    --surface: var(--bg-surface);
    --surface2: var(--bg-subtle);
    --head: var(--bg-subtle);
    --text: var(--text-primary);
    --dim: var(--text-secondary);
    --faint: var(--text-tertiary);
    --track: var(--border);

    --ok: var(--success);
    --ok-soft: var(--success-tint);
    --ok-border: var(--success);
    --danger-soft: var(--danger-tint);

    /* chip fills */
    --st-draft-soft: color-mix(in srgb, var(--text-primary) 10%, transparent);
    --st-sent-soft: var(--info-tint);
    --st-inprogress-soft: var(--warning-tint);
    --st-submitted-soft: var(--success-tint);
    --st-approved-soft: var(--brand-primary-tint);
    --st-expired-soft: var(--danger-tint);

    /* legacy names Ã¢â€ â€™ design palette, for nested components */
    --field: var(--bg-subtle);
    --radius: 12px;

    color: var(--text);
}

.req-shell .st-draft { --st: var(--faint); --st-soft: var(--st-draft-soft); }
.req-shell .st-sent { --st: var(--info-ink); --st-soft: var(--st-sent-soft); }
.req-shell .st-inprogress { --st: var(--warning-ink); --st-soft: var(--st-inprogress-soft); }
.req-shell .st-submitted { --st: var(--success-ink); --st-soft: var(--st-submitted-soft); }
.req-shell .st-approved { --st: var(--accent); --st-soft: var(--st-approved-soft); }
.req-shell .st-expired { --st: var(--bad); --st-soft: var(--st-expired-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: var(--shadow-lg);
}

/* ------------------------------------------------------------------
   The shared ChecklistPreview + 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: var(--text-on-brand);
}

.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: var(--text-on-brand);
    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 — AE Partners theme aliases.
   ============================================================ */

.landing-shell,
.auth-shell {
    --lv-bg: var(--bg-app);
    --lv-fg: var(--text-primary);
    --lv-fg-60: var(--text-secondary);
    --lv-fg-55: var(--text-secondary);
    --lv-fg-50: var(--text-secondary);
    --lv-fg-40: var(--text-tertiary);
    --lv-fg-35: var(--text-tertiary);
    --lv-fg-32: var(--text-tertiary);

    --lv-line-soft: var(--border);
    --lv-hairline: var(--border);
    --lv-line-mid: var(--border);
    --lv-line: var(--border);
    --lv-line-09: var(--border);
    --lv-line-10: var(--border-strong);
    --lv-line-12: var(--border-strong);
    --lv-line-strong: var(--border-strong);
    --lv-line-hover: var(--text-muted);
    --lv-footline: var(--border);

    --lv-surface: var(--bg-surface);
    --lv-surface-2: var(--bg-surface);
    --lv-surface-3: var(--bg-subtle);
    --lv-tint: var(--brand-primary-tint);
    --lv-tint-2: color-mix(in srgb, var(--brand-primary) 4%, transparent);
    --lv-chrome-fill: linear-gradient(180deg, var(--bg-surface), var(--bg-subtle));

    --lv-violet: var(--brand-primary);
    --lv-violet-2: var(--brand-accent);
    --lv-violet-strong: var(--brand-primary-strong);
    --lv-violet-text: var(--brand-primary-strong);
    --lv-violet-eyebrow: var(--brand-primary-strong);
    --lv-violet-soft: var(--brand-primary-tint);
    --lv-violet-line: var(--brand-primary-soft);
    --lv-violet-line-2: var(--brand-primary-soft);
    --lv-violet-icon-bg: var(--brand-primary-tint);
    --lv-violet-icon-line: var(--brand-primary-soft);
    --lv-violet-icon-fg: var(--brand-primary-strong);
    --lv-teal: var(--success-ink);
    --lv-teal-soft: var(--brand-secondary-tint);
    --lv-amber: var(--warning-ink);
    --lv-amber-soft: var(--warning-tint);
    --lv-bar: var(--border-strong);

    --lv-grad-a: var(--brand-primary);
    --lv-grad-b: var(--brand-accent);

    --lv-glow-1: color-mix(in srgb, var(--brand-accent-soft) 45%, transparent);
    --lv-glow-2: color-mix(in srgb, var(--brand-secondary) 22%, transparent);
    --lv-vignette: color-mix(in srgb, var(--text-primary) 5%, transparent);

    --lv-card-bg: var(--bg-surface);
    --lv-card-line: var(--border);
    --lv-card-shadow: var(--shadow-lg);
    --lv-card-inset: 0 0 0 transparent;
    --lv-field-bg: var(--bg-subtle);
}

/* ==========================================================================
   Auth card — design 5a "vault, refined".
   --------------------------------------------------------------------------
   Global rather than a .razor.css because sign-in and password reset are
   separate components rendering the same card; scoped styles can't be shared.
   ========================================================================== */

.login-card {
    width: 420px;
    max-width: 100%;
    border-radius: 20px;
    padding: 38px 40px 30px;
    background: var(--lv-card-bg);
    border: 1px solid var(--lv-card-line);
    box-shadow: var(--lv-card-shadow), var(--lv-card-inset);
    animation: rise-in 0.5s ease-out;
}

.login-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 22px;
}

.login-mark {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    display: block;
    box-shadow: 0 12px 28px -6px color-mix(in srgb, var(--brand-primary) 60%, transparent);
}

.login-eyebrow {
    margin-top: 16px;
    font: 600 10.5px var(--font-mono);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--lv-violet-eyebrow);
}

.login-title {
    font: 700 24px/1.15 var(--font-heading);
    color: var(--lv-fg);
    margin: 8px 0 0;
    letter-spacing: -0.015em;
}

.login-sub {
    font: 400 13px/1.5 var(--font-body);
    color: var(--lv-fg-60);
    margin: 10px 0 0;
    text-align: center;
}

/* --- Microsoft SSO --- */

.ms-button {
    width: 100%;
    height: 46px;
    border-radius: 9px;
    border: 1px solid var(--lv-line-strong);
    background: var(--lv-surface);
    color: var(--lv-fg);
    font: 500 13.5px var(--font-body);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
    cursor: pointer;
}

.ms-button:hover {
    border-color: var(--lv-line-hover);
}

.ms-button:disabled {
    cursor: not-allowed;
}

.ms-form {
    margin: 0;
}

.ms-logo {
    display: grid;
    grid-template-columns: 8px 8px;
    grid-template-rows: 8px 8px;
    gap: 2px;
}

.ms-logo i:nth-child(1) { background: var(--ms-red); }
.ms-logo i:nth-child(2) { background: var(--ms-green); }
.ms-logo i:nth-child(3) { background: var(--ms-blue); }
.ms-logo i:nth-child(4) { background: var(--ms-yellow); }

/* Shown in place of the password form once Entra SSO is the only way in. */
.login-sso-note {
    margin: 14px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--lv-fg-35);
}

.login-or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.login-or span {
    flex: 1;
    height: 1px;
    background: var(--lv-line-09);
}

.login-or em {
    font: 400 11px var(--font-mono);
    font-style: normal;
    color: var(--lv-fg-35);
}

/* --- fields --- */

.login-label {
    display: block;
    font: 500 12px var(--font-body);
    color: var(--lv-fg-60);
    margin: 0 0 8px;
}

.login-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.login-forgot {
    font: 500 12px var(--font-body);
    color: var(--lv-violet-eyebrow);
    text-decoration: none;
}

.login-forgot:hover {
    text-decoration: underline;
}

.login-card input[type="email"],
.login-card input[type="password"],
.login-card input[type="text"] {
    width: 100%;
    height: 46px;
    border-radius: 9px;
    border: 1px solid var(--lv-line-10);
    background: var(--lv-field-bg);
    color: var(--lv-fg);
    font: 400 14px var(--font-body);
    padding: 0 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-card input::placeholder {
    color: var(--lv-fg-35);
}

.login-card input:focus {
    outline: none;
    border-color: var(--lv-violet);
    box-shadow: 0 0 0 3px var(--lv-violet-soft);
}

/* email block spacing, then the password block */
.login-card input[type="email"] {
    margin-bottom: 13px;
}

.password-wrap {
    position: relative;
    margin-bottom: 18px;
}

.password-wrap input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: var(--lv-fg-40);
    cursor: pointer;
    padding: 0;
    line-height: 0;
}

.password-toggle:hover {
    color: var(--lv-fg-60);
}

.password-toggle svg {
    width: 17px;
    height: 17px;
}

.login-button {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 9px;
    background: var(--lv-violet-strong);
    color: var(--text-on-brand);
    font: 600 14px var(--font-body);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.login-button:hover {
    background: var(--lv-violet-2);
}

.login-error {
    display: block;
    color: var(--bad);
    font: 400 12px var(--font-body);
    margin: 0 0 10px;
}

/* Confirmations ("link sent", "password changed"). Success green, not brand coral,
   which reads as an error next to .login-error. */
.login-note {
    display: block;
    color: var(--success-ink);
    background: var(--success-tint);
    border: 1px solid color-mix(in srgb, var(--success) 40%, transparent);
    border-radius: 9px;
    padding: 11px 13px;
    font: 400 12.5px/1.5 var(--font-body);
    margin: 0 0 16px;
}

/* Back to the sign-in page from a reset screen. */
.login-foot {
    text-align: center;
    margin: 18px 0 0;
    font: 400 12px var(--font-body);
    color: var(--lv-fg-60);
}

.login-foot a {
    color: var(--lv-violet-eyebrow);
    text-decoration: none;
}

.login-foot a:hover {
    text-decoration: underline;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-card { animation: none; }
}

/* ==========================================================================
   Inline video players
   --------------------------------------------------------------------------
   VideoEmbeds.Expand rewrites recognised video links into this wrapper at
   render time. It lives here rather than in a .razor.css because the markup
   arrives through MarkupString, which never carries a Blazor scope attribute —
   scoped rules would not match it.
   ========================================================================== */

.video-embed {
    position: relative;
    aspect-ratio: 16 / 9;
    width: 100%;
    max-width: 44rem;
    margin: 1rem 0;
    border-radius: 0.6rem;
    overflow: hidden;
    background: var(--media-bg);
    border: 1px solid var(--line);
}

.video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* ============================================================
   Team module tokens — AE Partners theme aliases (light and dark
   both come from theme.css).
   ============================================================ */

:root {
    --t-canvas: var(--bg-app);
    --t-panel: var(--bg-surface);
    --t-panel-2: var(--bg-subtle);
    --t-panel-3: var(--bg-subtle);
    --t-modal: var(--bg-surface);
    --t-field: var(--bg-surface);
    --t-field-2: var(--bg-surface);
    --t-idle: var(--bg-subtle);
    --t-hover: var(--bg-subtle);
    --t-hover-2: var(--border);
    --t-hover-3: var(--bg-subtle);
    --t-track: var(--border);
    --t-track-2: var(--border);
    --t-switch-on: var(--brand-primary);
    --t-pick-on: var(--brand-primary-tint);
    --t-reactivate-bg: var(--brand-primary-tint);
    --t-reactivate-hover: color-mix(in srgb, var(--brand-primary) 22%, var(--bg-surface));
    --t-invite-hover: var(--brand-primary-tint);
    --t-invite-plus: var(--brand-primary-tint);
    --t-accent: var(--brand-primary-strong);
    --t-accent-hi: var(--brand-primary-hover);
    --t-link: var(--brand-primary-strong);
    --t-link-hi: var(--brand-primary-hover);
    --t-violet: var(--brand-primary);
    --t-violet-soft: var(--brand-primary-strong);
    --t-violet-tint: var(--brand-primary-tint);
    --t-violet-tint-2: color-mix(in srgb, var(--brand-primary) 22%, var(--bg-surface));
    --t-eyebrow: var(--brand-primary-strong);
    --t-on-accent: var(--text-on-brand);
    --t-green: var(--success-ink);
    --t-green-tint: var(--success-tint);
    --t-green-tint-2: var(--success-tint);
    --t-amber: var(--warning-ink);
    --t-amber-tint: var(--warning-tint);
    --t-amber-ink: var(--warning-ink);
    --t-red: var(--danger);
    --t-red-tint: var(--danger-tint);
    --t-red-ink: var(--danger-ink);
    --t-red-bg: var(--danger-tint);
    --t-red-bg-hover: color-mix(in srgb, var(--danger) 18%, var(--bg-surface));
    --t-red-btn: var(--danger-ink);
    --t-blue: var(--info-ink);
    --t-blue-tint: var(--info-tint);
    --t-grey-tint: var(--bg-subtle);
    --t-grey-dot: var(--text-secondary);
    --t-avatar-ink: var(--text-primary);
    --t-off-ink: var(--text-tertiary);
    --t-arrow: var(--text-muted);
    --t-sep: var(--border-strong);
    --t-g0: var(--text-primary);
    --t-g-strong: var(--text-primary);
    --t-g1: var(--text-primary);
    --t-g2: var(--text-primary);
    --t-g3: var(--text-secondary);
    --t-g4: var(--text-secondary);
    --t-g5: var(--text-secondary);
    --t-g6: var(--text-secondary);
    --t-g7: var(--text-secondary);
    --t-g7b: var(--text-secondary);
    --t-g8: var(--text-secondary);
    --t-g9: var(--text-secondary);
    --t-g9b: var(--text-secondary);
    --t-g9c: var(--text-secondary);
    --t-g10: var(--text-secondary);
    --t-g11: var(--text-tertiary);
    --t-g12: var(--text-tertiary);
    --t-g12b: var(--text-tertiary);
    --t-g12c: var(--text-tertiary);
    --t-g13: var(--text-tertiary);
    --t-g14: var(--text-tertiary);
    --t-line: var(--border);
    --t-line-2: var(--border-strong);
    --t-line-3: var(--border);
    --t-line-4: var(--border-strong);
    --t-line-5: var(--border);
    --t-line-soft: var(--border);
    --t-line-hair: var(--border);
    --t-line-faint: var(--border);
    --t-line-faint-2: var(--border);
    --t-line-dash: var(--border-strong);
    --t-line-strong: var(--border-strong);
    --t-line-strong-2: var(--border-strong);
    --t-line-box: var(--text-muted);
    --t-dash-accent: var(--brand-primary-soft);
    --t-dash-accent-hi: var(--brand-primary);
    --t-focus: var(--brand-primary);
    --t-accent-border: var(--brand-primary-soft);
    --t-amber-border: var(--warning);
    --t-amber-border-2: color-mix(in srgb, var(--warning) 50%, transparent);
    --t-red-border: color-mix(in srgb, var(--danger) 30%, transparent);
    --t-red-border-2: color-mix(in srgb, var(--danger) 40%, transparent);
    --t-scrim: var(--scrim);
    --t-shadow-menu: var(--shadow-lg);
    --t-shadow-modal: var(--shadow-lg);
    --t-shadow-accent: 0 6px 18px -8px var(--brand-primary);
    --t-av-0: var(--brand-primary-tint);
    --t-av-1: var(--brand-secondary-tint);
    --t-av-2: var(--warning-tint);
    --t-av-3: var(--info-tint);
    --t-av-4: var(--success-tint);
    --t-av-5: color-mix(in srgb, var(--brand-accent-soft) 55%, var(--bg-surface));
    --t-av-6: var(--brand-primary-tint);
    --t-av-7: var(--brand-secondary-tint);
    --t-av-8: var(--warning-tint);
    --t-av-9: var(--info-tint);
    --t-av-10: var(--success-tint);
}

.admin-main:has(.team-page) {
    padding: 26px 32px 80px;
    width: auto;
    background: var(--t-canvas);
    color: var(--t-g0);
    font-family: var(--font-body);
    font-size: 14px;
}

@media (max-width: 720px) {
    .admin-main:has(.team-page) {
        padding: 18px 14px 60px;
    }
}

/* ============================================================
   Clients module tokens — AE Partners theme aliases, same
   arrangement as the team block above.
   ============================================================ */

:root {
    --c-canvas: var(--bg-app);
    --c-panel: var(--bg-surface);
    --c-panel-2: var(--bg-subtle);
    --c-panel-3: var(--bg-subtle);
    --c-card: var(--bg-surface);
    --c-field: var(--bg-surface);
    --c-field-hover: var(--bg-subtle);
    --c-hover: var(--bg-subtle);
    --c-note: var(--brand-primary-tint);
    --c-modal: var(--bg-surface);
    --c-modal-cancel: var(--bg-surface);
    --c-menu: var(--bg-surface);
    --c-menu-hover: var(--bg-subtle);
    --c-menu-btn: var(--bg-subtle);
    --c-idle: var(--bg-subtle);
    --c-track: var(--border);
    --c-toggle-off: var(--border-strong);
    --c-chip-on: var(--brand-primary-tint);
    --c-chip-ink: var(--brand-primary-strong);
    --c-danger-bg: var(--danger-tint);
    --c-restore-bg: var(--success-tint);
    --c-tab-on: var(--text-primary);
    --c-accent: var(--brand-primary-strong);
    --c-accent-hi: var(--brand-primary-hover);
    --c-violet: var(--brand-primary);
    --c-violet-soft: var(--brand-primary-strong);
    --c-eyebrow: var(--brand-primary-strong);
    --c-link: var(--brand-primary-strong);
    --c-link-hi: var(--brand-primary-hover);
    --c-on-accent: var(--text-on-brand);
    --c-company: var(--info-ink);
    --c-company-bg: var(--info-tint);
    --c-unit: var(--brand-primary-strong);
    --c-unit-bg: var(--brand-primary-tint);
    --c-family: var(--success-ink);
    --c-family-bg: var(--success-tint);
    --c-individual: var(--warning-ink);
    --c-individual-bg: var(--warning-tint);
    --c-red: var(--danger);
    --c-red-ink: var(--danger-ink);
    --c-red-soft: var(--danger-ink);
    --c-red-bd: color-mix(in srgb, var(--danger) 30%, transparent);
    --c-red-tint: var(--danger-tint);
    --c-attn-bg: var(--danger-tint);
    --c-attn-bd: color-mix(in srgb, var(--danger) 35%, transparent);
    --c-amber: var(--warning-ink);
    --c-amber-tint: var(--warning-tint);
    --c-green: var(--success-ink);
    --c-green-bd: color-mix(in srgb, var(--success) 35%, transparent);
    --c-green-tint: var(--success-tint);
    --c-blue: var(--info-ink);
    --c-blue-tint: var(--info-tint);
    --c-draft-tint: color-mix(in srgb, var(--text-primary) 6%, transparent);
    --c-confirm: var(--danger-ink);
    --c-g0: var(--text-primary);
    --c-g1: var(--text-primary);
    --c-g-input: var(--text-primary);
    --c-g2: var(--text-primary);
    --c-g3: var(--text-secondary);
    --c-g4: var(--text-secondary);
    --c-g5: var(--text-secondary);
    --c-g6: var(--text-secondary);
    --c-g7: var(--text-secondary);
    --c-g8: var(--text-secondary);
    --c-g9: var(--text-secondary);
    --c-g10: var(--text-secondary);
    --c-g11: var(--text-secondary);
    --c-g12: var(--text-tertiary);
    --c-g13: var(--text-tertiary);
    --c-g14: var(--text-tertiary);
    --c-g16: var(--text-tertiary);
    --c-line: var(--border);
    --c-line-2: var(--border-strong);
    --c-line-3: var(--border);
    --c-line-14: var(--border-strong);
    --c-line-menu: var(--border-strong);
    --c-line-soft: var(--border);
    --c-line-faint: var(--border);
    --c-line-box: var(--text-muted);
    --c-sel-row: color-mix(in srgb, var(--brand-primary-tint) 60%, transparent);
    --c-sel-bd: var(--brand-primary-soft);
    --c-pick-bd: var(--brand-primary-soft);
    --c-pick-bg: color-mix(in srgb, var(--brand-primary-tint) 60%, transparent);
    --c-note-bd: var(--brand-primary-soft);
    --c-scrim: var(--scrim);
    --c-shadow-menu: var(--shadow-lg);
    --c-shadow-modal: var(--shadow-lg);
    --c-shadow-accent: 0 6px 18px -8px var(--brand-primary);
    --c-av0-bg: var(--brand-primary-tint);
    --c-av0: var(--brand-primary-strong);
    --c-av1-bg: var(--success-tint);
    --c-av1: var(--success-ink);
    --c-av2-bg: var(--warning-tint);
    --c-av2: var(--warning-ink);
    --c-av3-bg: var(--info-tint);
    --c-av3: var(--info-ink);
    --c-av4-bg: var(--brand-secondary-tint);
    --c-av4: var(--text-secondary);
}

.admin-main:has(.clients-page),
.admin-main:has(.work-shell) {
    padding: 26px 32px 90px;
    width: auto;
    background: var(--c-canvas);
    color: var(--c-g0);
    font-family: var(--font-body);
    font-size: 14px;
}

@media (max-width: 720px) {
    .admin-main:has(.clients-page),
.admin-main:has(.work-shell) {
        padding: 18px 14px 60px;
    }
}

/* ------------------------------------------------------------
   Clients module — a direct port of the "Client Module Redesign"
   mockup. Not scoped CSS: the list and the client page share most
   of these rules, and scoped stylesheets can't be shared.
   ------------------------------------------------------------ */

@keyframes clientFadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

@keyframes clientFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes clientGrowBar {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.clients-page {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--c-g0);
}

.clients-page a {
    color: var(--c-link);
    text-decoration: none;
}

.clients-page a:hover {
    color: var(--c-link-hi);
}

.clients-page .screen {
    animation: clientFadeUp 0.28s ease both;
}

.clients-page .notfound {
    color: var(--c-g9);
    font-size: 13.5px;
}

/* ---------- page header ---------- */

/* ---------- tabs ---------- */

/* ---------- stat cards ---------- */

/* ---------- toolbar ---------- */

/* justify-content is pinned: the shared .toolbar above sets space-between, and
   this row spaces itself with the .toolbar-gap spacer instead. */
.clients-page .toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    margin: 18px 0 14px;
}

.clients-page .searchbox {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--c-panel-2);
    border: 1px solid var(--c-line-2);
    border-radius: 9px;
    padding: 0 12px;
    height: 36px;
    min-width: 280px;
}

.clients-page .search-icon {
    color: var(--c-g16);
    font-size: 13px;
}

.clients-page .searchbox input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    color: var(--c-g0);
    font-size: 13px;
    font-family: inherit;
}

.clients-page .searchbox input:focus {
    outline: none;
}

.clients-page .searchbox input::placeholder {
    color: var(--c-g16);
}

.clients-page .segbar {
    display: flex;
    gap: 6px;
    background: var(--c-panel-3);
    border: 1px solid var(--c-line);
    border-radius: 9px;
    padding: 3px;
    flex-wrap: wrap;
}

.clients-page .seg {
    border: none;
    cursor: pointer;
    border-radius: 6px;
    padding: 6px 11px;
    font: 500 12px var(--font-body);
    background: transparent;
    color: var(--c-g8);
}

.clients-page .seg.on {
    background: var(--c-chip-on);
    color: var(--c-chip-ink);
}

.clients-page .chip-toggle {
    border: 1px solid var(--c-line-2);
    background: var(--c-panel-2);
    color: var(--c-g8);
    border-radius: 9px;
    height: 36px;
    padding: 0 13px;
    font: 500 12px var(--font-body);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
}

.clients-page .chip-toggle.on {
    border-color: var(--c-attn-bd);
    background: var(--c-attn-bg);
    color: var(--c-red-soft);
}

.clients-page .toolbar-gap {
    flex: 1;
}

.clients-page .viewtoggle {
    display: flex;
    gap: 3px;
    background: var(--c-panel-3);
    border: 1px solid var(--c-line);
    border-radius: 9px;
    padding: 3px;
}

.clients-page .viewtoggle button {
    border: none;
    cursor: pointer;
    border-radius: 6px;
    width: 32px;
    height: 28px;
    font-size: 12px;
    background: transparent;
    color: var(--c-g8);
}

.clients-page .viewtoggle button.on {
    background: var(--c-chip-on);
    color: var(--c-chip-ink);
}

.clients-page .sortbox {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--c-g13);
    font-size: 12px;
}

/* The native <select> popup can't be themed, so the module drives the app's
   Dropdown and restyles its trigger and menu to the design's select. */
.clients-page .groupbox .dd-trigger,
.clients-page .sortbox .dd-trigger {
    background: var(--c-panel-2);
    border: 1px solid var(--c-line-2);
    color: var(--c-g3);
    height: 36px;
    font: 400 12.5px var(--font-body);
    gap: 8px;
}

.clients-page .groupbox .dd-trigger {
    border-radius: 9px;
    padding: 0 10px;
}

.clients-page .sortbox .dd-trigger {
    border-radius: 8px;
    padding: 0 9px;
}

.clients-page .dd-wrap .dd-trigger::after {
    width: 5px;
    height: 5px;
    border-width: 1.4px;
    border-color: currentColor;
    opacity: 0.7;
}

.clients-page .dd-wrap .dd-trigger:hover {
    border-color: var(--c-line-box);
}

.clients-page .dd-wrap .dd-menu {
    background: var(--c-menu);
    border: 1px solid var(--c-line-menu);
    border-radius: 10px;
    box-shadow: var(--c-shadow-menu);
    padding: 5px;
}

.clients-page .dd-wrap .dd-option {
    color: var(--c-g2);
    font: 400 12.5px var(--font-body);
    padding: 8px 10px;
    border-radius: 7px;
}

.clients-page .dd-wrap .dd-option:hover {
    background: var(--c-menu-hover);
}

.clients-page .dd-wrap .dd-option.selected {
    background: var(--c-chip-on);
    color: var(--c-chip-ink);
}

/* ---------- count line + bulk bar ---------- */

/* ---------- table card (shared by both screens) ---------- */

.clients-page .tablecard {
    background: var(--c-panel);
    border: 1px solid var(--c-line);
    border-radius: 13px;
    animation: clientFadeUp 0.28s ease both;
}

/* No overflow clipping at desktop width: the row "⋮" menu is a child of the
   last rows and would be cut off. Corners are rounded on the edge rows instead. */
.clients-page .tablescroll > :first-child {
    border-radius: 12px 12px 0 0;
}

.clients-page .tablescroll > :last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.clients-page .trow {
    min-width: 1100px;
    display: grid;
    grid-template-columns: 34px minmax(240px, 2.1fr) 150px minmax(160px, 1.2fr) 120px 128px 110px 40px;
    gap: 12px;
    align-items: center;
}

.clients-page .thead {
    padding: 11px 16px;
    background: var(--c-panel-2);
    border-bottom: 1px solid var(--c-line);
    font: 600 10px var(--font-mono);
    letter-spacing: 0.11em;
    color: var(--c-g14);
}

.clients-page .trow.tbody {
    padding: 10px 16px;
    border-bottom: 1px solid var(--c-line-soft);
    position: relative;
}

.clients-page .trow.tbody.picked {
    background: var(--c-sel-row);
}

.clients-page .cell-client {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    cursor: pointer;
}

.clients-page .avatar {
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 600 11px var(--font-mono);
}

.clients-page .avatar-lg {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 12px;
}

.clients-page .avatar-xl {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    font-size: 15px;
}

.clients-page .client-text {
    min-width: 0;
}

.clients-page .client-name {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--c-g0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clients-page .client-email {
    font-size: 12px;
    color: var(--c-g12);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clients-page .type-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: 500 11px var(--font-mono);
    letter-spacing: 0.05em;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.clients-page .ccard .type-chip,
.clients-page .detail-titlerow .type-chip {
    font-size: 10.5px;
    letter-spacing: 0.07em;
}

.clients-page .detail-titlerow .type-chip {
    padding: 4px 9px;
}

.clients-page .type-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex: none;
}

.clients-page .cell-group {
    font-size: 12.5px;
    color: var(--c-g6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clients-page .cell-group.none {
    color: var(--c-g16);
}

.clients-page .cell-checklists {
    display: flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
    min-width: 0;
}

.clients-page .req-open {
    font: 600 14px var(--font-heading);
}

.clients-page .req-note {
    font-size: 11.5px;
    color: var(--c-g13);
    overflow: hidden;
    text-overflow: ellipsis;
}

.clients-page .req-note.late {
    color: var(--c-red);
}

.clients-page .cell-due {
    font-size: 12.5px;
}

.clients-page .cell-activity {
    font-size: 12px;
    color: var(--c-g13);
}

.clients-page .cell-menu {
    display: flex;
    justify-content: flex-end;
}

.clients-page .empty-row {
    padding: 48px 20px;
    text-align: center;
    color: var(--c-g13);
    font-size: 13px;
}

.clients-page .empty-block {
    background: var(--c-panel);
    border: 1px solid var(--c-line);
    border-radius: 13px;
    padding: 48px 20px;
    text-align: center;
    color: var(--c-g13);
    font-size: 13px;
}

.clients-page .reset-link {
    border: none;
    background: none;
    color: var(--c-link);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
}

.clients-page .reset-link:hover {
    color: var(--c-link-hi);
}

/* ---------- row menu ---------- */

.clients-page .rowmenu {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

.clients-page .dots {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--c-g13);
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
}

.clients-page .dots:hover,
.clients-page .dots.on {
    background: var(--c-menu-btn);
    color: var(--c-g2);
}

.clients-page .menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
}

.clients-page .menu {
    position: absolute;
    right: 0;
    z-index: 40;
    min-width: 186px;
    background: var(--c-menu);
    border: 1px solid var(--c-line-menu);
    border-radius: 10px;
    padding: 5px;
    box-shadow: var(--c-shadow-menu);
    animation: clientFadeIn 0.14s ease both;
}

.clients-page .menu > button {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    color: var(--c-g2);
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
}

.clients-page .menu > button:hover {
    background: var(--c-menu-hover);
}

.clients-page .menu > .danger {
    color: var(--c-red-ink);
}

.clients-page .menu > .good {
    color: var(--c-green);
}

/* ---------- card view ---------- */

.clients-page .cardgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
    gap: 12px;
    animation: clientFadeUp 0.28s ease both;
}

.clients-page .ccard {
    background: var(--c-card);
    border: 1px solid var(--c-line);
    border-radius: 13px;
    padding: 14px 15px 13px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.clients-page .ccard.picked {
    border-color: var(--c-sel-bd);
}

.clients-page .ccard-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.clients-page .ccard-head .dots {
    width: 24px;
    height: 24px;
    border-radius: 6px;
}

.clients-page .ccard-id {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.clients-page .ccard-name {
    font: 600 13.5px/1.3 var(--font-heading);
    letter-spacing: -0.01em;
    color: var(--c-g0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clients-page .ccard-id .client-email {
    margin-top: 2px;
}

.clients-page .ccard-phone {
    font: 500 12px var(--font-mono);
    color: var(--c-g8);
}

.clients-page .ccard-tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.clients-page .tile {
    background: var(--c-field);
    border-radius: 9px;
    padding: 8px 10px;
}

.clients-page .micro {
    font: 600 9.5px var(--font-mono);
    letter-spacing: 0.11em;
    color: var(--c-g14);
}

.clients-page .tile-value {
    font: 600 17px var(--font-heading);
    margin-top: 3px;
    color: var(--c-g0);
}

.clients-page .ccard-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 11px;
    border-top: 1px solid var(--c-line-faint);
}

.clients-page .ccard-foot .cell-group {
    font-size: 11.5px;
}

.clients-page .ccard-meta {
    font-size: 11.5px;
    flex: none;
}

/* ---------- client page: header ---------- */

.clients-page .detail-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.clients-page .detail-id {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin: 20px 0 0;
}

.clients-page .detail-idtext {
    min-width: 0;
}

.clients-page .detail-titlerow {
    display: flex;
    align-items: center;
    gap: 11px;
    flex-wrap: wrap;
}

.clients-page .detail-h1 {
    font: 600 25px/1.2 var(--font-heading);
    letter-spacing: -0.022em;
    margin: 0;
    color: var(--c-g0);
}

.clients-page .detail-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 7px;
    font-size: 13px;
    color: var(--c-g9);
    flex-wrap: wrap;
}

.clients-page .detail-meta .mono {
    font-family: var(--font-mono);
}

.clients-page .detail-stats {
    margin: 22px 0 4px;
}

.clients-page .detail-stat-value {
    font-size: 22px;
    margin-top: 8px;
}

.clients-page .detail-stat-note {
    margin-top: 3px;
}

/* ---------- client page: checklists tab ---------- */

.clients-page .reqcard {
    margin-top: 18px;
    animation: clientFadeUp 0.24s ease both;
}

.clients-page .req-title {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--c-g0);
}

.clients-page .req-meta {
    font-size: 11.5px;
    color: var(--c-g13);
    margin-top: 2px;
}







    .clients-page .req-due {
        font-size: 12.5px;
        height: auto;
        width: auto;
    }

.clients-page .req-assigned {
    font-size: 12.5px;
    color: var(--c-g6);
}

    .clients-page .req-updated {
        font-size: 12px;
        color: var(--c-g13);
        height: auto;
        width: auto;
    }

/* ---------- client page: details tab ---------- */

.clients-page .detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 14px;
    margin-top: 18px;
    animation: clientFadeUp 0.24s ease both;
}

.clients-page .detail-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.clients-page .panel {
    background: var(--c-panel);
    border: 1px solid var(--c-line);
    border-radius: 13px;
    padding: 18px 20px 20px;
}

.clients-page .panel.side {
    padding: 16px 18px 18px;
}

.clients-page .panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.clients-page .panel-title {
    font: 600 11px var(--font-mono);
    letter-spacing: 0.12em;
    color: var(--c-g10);
}

.clients-page .save-btn {
    border: none;
    border-radius: 8px;
    background: var(--c-idle);
    color: var(--c-g13);
    height: 30px;
    padding: 0 13px;
    font: 600 12px var(--font-body);
    cursor: default;
}

.clients-page .save-btn.dirty {
    background: var(--c-accent);
    color: var(--c-on-accent);
    cursor: pointer;
}

.clients-page .field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
    margin-top: 16px;
}

.clients-page .field-grid.wide-gap {
    gap: 14px;
    margin-top: 0;
}

.clients-page .field {
    display: block;
    min-width: 0;
}

.clients-page .field.wide {
    grid-column: span 2;
}

.clients-page .field-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    color: var(--c-g10);
    margin-bottom: 6px;
}

.clients-page .field-hint {
    color: var(--c-amber);
    font-size: 11px;
}

.clients-page .field input {
    width: 100%;
    background: var(--c-field);
    border: 1px solid var(--c-line-2);
    border-radius: 9px;
    height: 38px;
    padding: 0 11px;
    color: var(--c-g-input);
    font-size: 13px;
    font-family: inherit;
}

.clients-page .field input:focus {
    outline: none;
    border-color: var(--c-accent);
}

.clients-page .field input::placeholder {
    color: var(--c-g14);
}

.clients-page .field .dd-trigger,
.clients-page .assign-row .dd-trigger {
    width: 100%;
    background: var(--c-field);
    border: 1px solid var(--c-line-2);
    border-radius: 9px;
    height: 40px;
    padding: 0 11px;
    color: var(--c-g-input);
    font: 400 13px var(--font-body);
}

.clients-page .assign-row .dd-trigger {
    height: 38px;
}

.clients-page .side-value {
    font-size: 13.5px;
    margin-top: 11px;
    color: var(--c-g1);
}

.clients-page .side-note {
    font-size: 12px;
    color: var(--c-g13);
    margin-top: 5px;
}

.clients-page .side-btn {
    margin-top: 13px;
    border: 1px solid var(--c-line-14);
    background: var(--c-field);
    color: var(--c-g2);
    border-radius: 8px;
    height: 32px;
    padding: 0 12px;
    font: 500 12px var(--font-body);
    cursor: pointer;
}

.clients-page .side-btn:hover {
    background: var(--c-field-hover);
}

.clients-page .toggle-row {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-top: 14px;
}

.clients-page .toggle {
    width: 34px;
    height: 20px;
    flex: none;
    border-radius: 11px;
    background: var(--c-toggle-off);
    padding: 2px;
    cursor: pointer;
    display: flex;
    justify-content: flex-start;
}

.clients-page .toggle.on {
    background: var(--c-accent);
    justify-content: flex-end;
}

.clients-page .knob {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--c-g13);
}

.clients-page .toggle.on .knob {
    background: var(--text-on-dark);
}

.clients-page .toggle-label {
    font-size: 13px;
    color: var(--c-g1);
}

.clients-page .toggle-note {
    font-size: 11.5px;
    color: var(--c-g13);
    margin-top: 2px;
}

.clients-page .assign-row {
    margin-top: 12px;
}

.clients-page .assign-label {
    display: block;
    font-size: 11.5px;
    color: var(--c-g10);
    margin-bottom: 6px;
}

/* ---------- new-client screen ---------- */

    .clients-page .newscreen {
        justify-content: center;
        display: flex;
        width:auto;
    }

.clients-page .new-h1 {
    font: 600 22px var(--font-heading);
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--c-g0);
}

.clients-page .formcard {
    background: var(--c-panel);
    border: 1px solid var(--c-line);
    border-radius: 14px;
    padding: 22px 24px 24px;
    margin-top: 20px;
}

.clients-page .typegrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 9px;
    margin-top: 12px;
}

.clients-page .typepick {
    border: 1px solid var(--c-line-faint);
    background: var(--c-field);
    border-radius: 11px;
    padding: 12px 13px;
    cursor: pointer;
}

.clients-page .typepick.on {
    border-color: var(--c-pick-bd);
    background: var(--c-pick-bg);
}

.clients-page .typepick-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.clients-page .typepick-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: none;
}

.clients-page .typepick-label {
    font: 600 12.5px var(--font-body);
    color: var(--c-g4);
}

.clients-page .typepick.on .typepick-label {
    color: var(--c-tab-on);
}

.clients-page .typepick-note {
    font-size: 11.5px;
    color: var(--c-g13);
    margin-top: 6px;
}

.clients-page .divider {
    height: 1px;
    background: var(--c-line);
    margin: 22px 0;
}

.clients-page .newscreen .field input {
    height: 40px;
    padding: 0 12px;
}

.clients-page .notebox {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    background: var(--c-note);
    border: 1px solid var(--c-note-bd);
    border-radius: 11px;
    padding: 13px 15px;
    margin-top: 20px;
}

.clients-page .note-icon {
    color: var(--c-violet);
    font-size: 13px;
}

.clients-page .note-text {
    font-size: 12.5px;
    color: var(--c-g7);
    line-height: 1.5;
}

.clients-page .formactions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 22px;
}

/* ---------- narrow screens ---------- */

@media (max-width: 1180px) {
    .clients-page .tablescroll {
        overflow-x: auto;
        border-radius: 13px;
    }
}

@media (max-width: 1100px) {
    .clients-page .detail-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .clients-page .searchbox {
        min-width: 0;
        flex: 1;
    }

    .clients-page .field-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .clients-page .field.wide {
        grid-column: span 1;
    }
}

/* ---- Triage sidebar sub-navigation ------------------------------------- */
/* Folder links nested under the Triage item, the way Karbon nests them. Kept in
   app.css rather than a scoped sheet because AdminLayout owns the whole rail and
   its styles already live here. */
.nav-sub {
    display: flex;
    flex-direction: column;
    margin: 0.1rem 0 0.35rem 2.35rem;
}

.admin-nav-sublink {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.28rem 0.5rem;
    border-radius: 5px;
    font-size: 0.8rem;
    color: var(--rail-item-ink);
    text-decoration: none;
}

/* The mailbox row carries an avatar rather than an icon. A long name — or an
   email address, before the counts have loaded and supplied a real name — has to
   truncate: the rail is a fixed 256px and anything wider spills over the edge of
   it, which is exactly what it did. min-width:0 is what lets a flex child shrink
   far enough for ellipsis to engage at all. */
.admin-nav-link.nav-mailbox .nav-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-nav-link.nav-mailbox { min-width: 0; }

.admin-nav-sublink .nav-count,
.admin-nav-link.nav-mailbox .nav-count {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}

.admin-nav-sublink:hover {
    background: var(--rail-item-hover));
    color: inherit;
}

.admin-nav-sublink.active {
    color: var(--accent);
    font-weight: 600;
}

/* ============================================================
   Work module — the board, the job form and the progress report
   share these. Unscoped for the same reason the clients block is:
   three pages need them, and a scoped stylesheet cannot be shared.
   Board and card layout stay in WorkPage.razor.css, which is the
   only page that draws them.

   Uses the --c-* admin list palette (declared above, dark-mode
   aware) so a work row and a client row read as one product.
   .toolbar, .listmeta, .list-row, .cell-hit and .status-badge are
   already global and are deliberately not repeated here.
   ============================================================ */

.work-shell {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--c-g0);
}

.work-shell a {
    color: var(--c-link);
    text-decoration: none;
}

.work-shell a:hover {
    color: var(--c-link-hi);
}

/* --- toolbar --- */

/* The shared .toolbar sets space-between; these rows space themselves with
   .toolbar-gap instead, the same way the clients toolbar does. */
.work-shell .toolbar {
    justify-content: flex-start;
    gap: 10px;
}

.work-shell .toolbar-gap {
    flex: 1;
}

.work-shell .searchbox {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--c-panel-2);
    border: 1px solid var(--c-line-2);
    border-radius: 9px;
    padding: 0 12px;
    height: 36px;
    min-width: 260px;
}

.work-shell .search-icon {
    color: var(--c-g16);
    font-size: 13px;
}

.work-shell .searchbox input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    color: var(--c-g0);
    font-size: 13px;
    font-family: inherit;
}

.work-shell .searchbox input:focus {
    outline: none;
}

.work-shell .searchbox input::placeholder {
    color: var(--c-g16);
}

.work-shell .filterbox {
    min-width: 150px;
}

.work-shell .sortbox {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--c-g13);
    font-size: 12px;
}

.work-shell .filterbox .dd-trigger,
.work-shell .sortbox .dd-trigger {
    background: var(--c-panel-2);
    border: 1px solid var(--c-line-2);
    border-radius: 9px;
    color: var(--c-g3);
    height: 36px;
    padding: 0 10px;
    font: 400 12.5px var(--font-body);
    gap: 8px;
}

.work-shell .chip-toggle {
    border: 1px solid var(--c-line-2);
    background: var(--c-panel-2);
    color: var(--c-g8);
    border-radius: 9px;
    height: 36px;
    padding: 0 13px;
    font: 500 12px var(--font-body);
    cursor: pointer;
}

.work-shell .chip-toggle.on {
    background: var(--c-chip-on);
    color: var(--c-chip-ink);
}

/* --- table --- */

.work-shell .tablecard {
    background: var(--c-panel);
    border: 1px solid var(--c-line);
    border-radius: 13px;
}

.work-shell .table-pager {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.work-shell .empty-row {
    padding: 48px 20px;
    text-align: center;
    color: var(--c-g13);
    font-size: 13px;
}

.work-shell .empty-block {
    padding: 56px 20px;
    text-align: center;
    color: var(--c-g13);
    font-size: 13px;
    border: 1px solid var(--c-line);
    border-radius: 13px;
    background: var(--c-panel);
}

.work-shell .reset-link {
    border: none;
    background: none;
    color: var(--c-link);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
}

.work-shell .listmeta-hint {
    color: var(--c-g16);
}

/* --- cells --- */

.work-shell .work-title {
    font-weight: 600;
    color: var(--c-g0);
}

.work-shell .work-client {
    margin-top: 2px;
    font-size: 12px;
    color: var(--c-g13);
}

.work-shell .work-group::before {
    content: "·";
    margin: 0 5px;
}

/* The current step, on a list row. Indented under the client so it reads as
   detail about the job rather than as a second job. */
.work-shell .work-current {
    margin-top: 3px;
    font-size: 11px;
    color: var(--c-g16);
}

.work-shell .work-current-count {
    margin-left: 6px;
    font-variant-numeric: tabular-nums;
}

.work-shell .work-type {
    font-size: 12.5px;
    color: var(--c-g3);
}

.work-shell .work-type.none,
.work-shell .work-assigned.none {
    color: var(--c-g16);
}

.work-shell .work-assigned {
    font-size: 12.5px;
}

.work-shell .work-due {
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

/* The statutory date sits under the internal one rather than in its own column:
   most work has only the internal date, and an almost-always-empty column is
   worse than a second line on the few rows that need it. */
.work-shell .work-deadline {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--c-g16);
}

.work-shell .work-budget-value {
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    color: var(--c-g3);
}

.work-shell .work-budget-note {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--c-g13);
}

.work-shell .work-budget-note.over {
    color: var(--c-red);
}

.work-shell .work-activity {
    font-size: 12px;
    color: var(--c-g13);
}

/* --- checklist progress, on cards and report rows --- */

.work-shell .task-bar {
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background: var(--c-panel-2);
    overflow: hidden;
}

.work-shell .task-bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--c-link);
}

.work-shell .task-pct {
    flex: none;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--c-g13);
}

.work-shell .prog-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 7rem;
}

/* --- row menu --- */

.work-shell .cell-menu {
    display: flex;
    justify-content: flex-end;
}

.work-shell .rowmenu {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

.work-shell .dots {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--c-g13);
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
}

.work-shell .dots:hover,
.work-shell .dots.on {
    background: var(--c-menu-btn);
    color: var(--c-g2);
}

.work-shell .menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
}

.work-shell .menu {
    position: absolute;
    top: 30px;
    right: 0;
    z-index: 40;
    min-width: 186px;
    background: var(--c-menu);
    border: 1px solid var(--c-line-menu);
    border-radius: 10px;
    padding: 5px;
    box-shadow: var(--c-shadow-menu);
}

.work-shell .menu > button {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    color: var(--c-g2);
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
}

.work-shell .menu > button:hover {
    background: var(--c-menu-hover);
}

.work-shell .menu > .danger {
    color: var(--c-red-ink);
}

.work-shell .menu > .good {
    color: var(--c-green);
}
/* --- Work: the job fields, shared by the edit page and the create modal ---
   Unscoped because two components render the same fields and a scoped sheet
   cannot be shared. JobFields.razor owns the markup; both hosts just wrap it. */

.work-shell .panel-title {
    font: 600 11px var(--font-mono);
    letter-spacing: 0.12em;
    color: var(--c-g10);
}

.work-shell .divider {
    height: 1px;
    background: var(--c-line);
    margin: 22px 0;
}

.work-shell .field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
    margin-top: 16px;
}

@media (max-width: 720px) {
    .work-shell .field-grid {
        grid-template-columns: 1fr;
    }
}

.work-shell .field {
    display: block;
    min-width: 0;
}

.work-shell .field.wide {
    grid-column: 1 / -1;
}

.work-shell .field-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    color: var(--c-g10);
    margin-bottom: 6px;
}

.work-shell .field-note {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--c-g14);
}

/* textarea included: styling only `input` left the description box at its
   browser default size, floating in the middle of a full-width row. */
.work-shell .field input,
.work-shell .field textarea {
    width: 100%;
    background: var(--c-field);
    border: 1px solid var(--c-line-2);
    border-radius: 9px;
    padding: 0 11px;
    color: var(--c-g-input);
    font-size: 13px;
    font-family: inherit;
}

.work-shell .field input {
    height: 38px;
}

.work-shell .field textarea {
    padding: 9px 11px;
    line-height: 1.5;
    resize: vertical;
}

.work-shell .field input:focus,
.work-shell .field textarea:focus {
    outline: none;
    border-color: var(--c-accent);
}

.work-shell .field input::placeholder,
.work-shell .field textarea::placeholder {
    color: var(--c-g14);
}

.work-shell .field input:disabled,
.work-shell .field textarea:disabled {
    opacity: 0.6;
}

.work-shell .field .dd-trigger {
    width: 100%;
    background: var(--c-field);
    border: 1px solid var(--c-line-2);
    border-radius: 9px;
    height: 38px;
    padding: 0 11px;
    color: var(--c-g-input);
    font: 400 13px var(--font-body);
}

/* Two boxes, one stored number of minutes: "9h 45m" is what people say, and a
   single decimal field turns 45 minutes into 0.75 of an hour on the way in. */
.work-shell .duration {
    display: flex;
    align-items: center;
    gap: 6px;
}

.work-shell .duration input {
    width: 5.5rem;
}

.work-shell .duration-unit {
    font-size: 12px;
    color: var(--c-g13);
}

.work-shell .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.work-shell .form-error {
    margin: 18px 0 0;
    padding: 10px 12px;
    border-radius: 9px;
    background: var(--c-attn-bg);
    color: var(--c-red-ink);
    font-size: 12.5px;
}

/* --- Work: the create modal ---
   Creating is a short form reached from the board, so it is a dialog rather than
   a page you navigate away to and back from. Editing keeps its own page: it
   carries the checklist and the linked checklists, which need the room. */

.work-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 1rem;
    overflow-y: auto;
    background: var(--rail-scrim);
}

.work-modal {
    width: min(46rem, 100%);
    padding: 22px 24px 24px;
    border: 1px solid var(--c-line);
    border-radius: 14px;
    background: var(--c-panel);
    box-shadow: var(--c-shadow-menu);
}

.work-modal-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--c-line);
}

.work-modal-title {
    margin: 0;
    font: 600 17px var(--font-heading);
    color: var(--c-g0);
}

.work-modal-close {
    border: none;
    background: none;
    color: var(--c-g13);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.work-modal-close:hover {
    color: var(--c-g0);
}

/* To-Do reuses the work shell wholesale; only its rows are its own. */
.admin-main:has(.todo-shell) { padding-bottom: 90px; }

/* --- work checklists (.tk-) -------------------------------------------
   Global rather than isolated because two components draw the same checklist:
   a job's Tasks tab and a work template's editor. Isolated CSS carries a scope
   attribute for the one component it belongs to, so the second would silently
   render unstyled. */

/* The checklist. Its own stylesheet now that it owns a tab rather than living
   in a 280px sidebar — the fields come from the .work-shell block in app.css,
   everything below is the list itself. */

.tk-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--c-line);
}

.tk-count {
    font-size: 12.5px;
    color: var(--c-g13);
}

.tk-toggle {
    border: none;
    background: none;
    color: var(--c-link);
    font: 500 12px var(--font-body);
    cursor: pointer;
    padding: 0;
}

.tk-toggle:hover {
    text-decoration: underline;
}

/* --- section --------------------------------------------------------- */

.tk-section {
    margin-top: 14px;
    border: 1px solid var(--c-line);
    border-radius: 11px;
    overflow: hidden;
}

.tk-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 12px;
    background: var(--c-panel-2);
}

/* Rotates rather than swapping glyphs, so the arrow animates between states
   instead of flickering to a different character. */
.tk-chev {
    flex: none;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--c-g13);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.tk-chev.on {
    transform: rotate(90deg);
}

.tk-title {
    font: 500 13px var(--font-body);
    color: var(--c-g0);
}

.tk-client-tag {
    padding: 1px 7px;
    border-radius: 20px;
    background: var(--c-chip-on);
    color: var(--c-chip-ink);
    font-size: 10px;
    font-weight: 600;
}

.tk-head-count {
    font-size: 11.5px;
    color: var(--c-g14);
}

.tk-rename {
    max-width: 18rem;
}

/* --- row -------------------------------------------------------------- */

.tk-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 9rem 9rem auto;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--c-line);
    background: var(--c-panel);
}

.tk-row.done .tk-name {
    color: var(--c-g14);
    text-decoration: line-through;
}

.tk-tick {
    width: 18px;
    height: 18px;
    border: 1px solid var(--c-line-2);
    border-radius: 5px;
    background: var(--c-field);
    color: var(--c-green);
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
}

.tk-tick.on {
    border-color: var(--c-green);
}

.tk-tick:disabled {
    cursor: default;
    opacity: 0.55;
}

.tk-info {
    min-width: 0;
}

.tk-name {
    margin: 0;
    font-size: 12.5px;
    color: var(--c-g0);
}

.tk-desc {
    margin: 2px 0 0;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--c-g13);
}

.tk-meta {
    margin: 3px 0 0;
    font-size: 11px;
    color: var(--c-g14);
}

.tk-role::before {
    content: "·";
    margin: 0 5px;
}

.tk-status ::deep .dd-trigger,
.tk-due input[type="date"] {
    width: 100%;
    height: 28px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: none;
    color: var(--c-g3);
    font: 400 12px var(--font-body);
}

.tk-status ::deep .dd-trigger:hover,
.tk-due input[type="date"]:hover {
    border-color: var(--c-line-2);
    background: var(--c-panel-2);
}

/* An empty date is an invitation, not a gap — dimmed so it reads as "set one"
   rather than as a broken control. */
.tk-due input.unset {
    color: var(--c-g16);
}

.tk-actions {
    display: flex;
    gap: 3px;
}

.tk-empty {
    margin: 0;
    padding: 14px;
    border-top: 1px solid var(--c-line);
    background: var(--c-panel);
    font-size: 11.5px;
    color: var(--c-g16);
}

/* --- forms ------------------------------------------------------------ */

.tk-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--c-line);
    background: var(--c-panel);
}

.tk-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tk-error {
    margin: 0;
    font-size: 11.5px;
    color: var(--c-red-ink);
}

.tk-add {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 14px;
}

.tk-add .mini-input {
    max-width: 18rem;
}

.mini-input {
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--c-line-2);
    border-radius: 8px;
    background: var(--c-field);
    color: var(--c-g-input);
    font: 400 12.5px var(--font-body);
}

.mini-input:focus {
    outline: none;
    border-color: var(--c-accent);
}

.mini-action {
    border: 1px solid transparent;
    border-radius: 6px;
    background: none;
    color: var(--c-g13);
    padding: 4px 8px;
    font: 500 11.5px var(--font-body);
    cursor: pointer;
}

.mini-action:hover:not(:disabled) {
    background: var(--c-menu-hover);
    color: var(--c-g2);
}

.mini-action:disabled {
    opacity: 0.4;
    cursor: default;
}

.mini-action.danger {
    color: var(--c-red-ink);
}

.mini-form-actions {
    display: flex;
    gap: 6px;
}

.panel-hint {
    margin: 14px 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--c-g14);
}

.toolbar-gap {
    flex: 1;
}

@media (max-width: 900px) {
    .tk-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
        row-gap: 8px;
    }

    .tk-status,
    .tk-due {
        grid-column: 2;
    }
}

/* --- work list tables (.wt-) ------------------------------------------
   Global for the same reason the checklist block above is: the templates list
   and the schedules list are the same table, and isolated CSS would style only
   whichever component happened to own the file. */

/* The templates list. Its own small table rather than the card grid the checklist
   templates use: a work template is picked by name, step count and how much the
   firm already leans on it, and those are columns, not cards. */

.wt-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 18px;
    font-size: 13px;
}

.wt-table th {
    text-align: left;
    font: 600 11.5px var(--font-body);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--c-g13);
    padding: 0 12px 9px;
    border-bottom: 1px solid var(--c-line);
    white-space: nowrap;
}

.wt-table td {
    padding: 12px;
    border-bottom: 1px solid var(--c-line);
    color: var(--c-g0);
    vertical-align: top;
}

.wt-table tbody tr:hover {
    background: var(--c-panel-2);
}

.wt-num {
    text-align: right;
    white-space: nowrap;
}

.wt-actions {
    text-align: right;
    white-space: nowrap;
}

.wt-name {
    font-weight: 600;
    color: var(--c-link);
    text-decoration: none;
}

.wt-name:hover {
    text-decoration: underline;
}

/* The second line under a name, and the "in 3 sections" under a count. */
.wt-sub {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: var(--c-g13);
}

/* My Week with its Outlook day panel. Global rather than TodoPage-scoped: the
   grid has to place children rendered by other components (PageHeader, the
   panel itself), which never carry TodoPage's scope attribute. */
.todo-shell.with-day {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    column-gap: 22px;
    align-items: start;
}

.todo-shell.with-day > * {
    grid-column: 1;
}

/* min-width: 0 so a long title can never push the page into a sideways scroll. */
.todo-shell.with-day > * {
    min-width: 0;
}

/* Starts beside the tabs, not the page title, so the tops line up — row 2 is
   the tab strip, row 1 the header with its Add button. */
/* Calendar closed down to its rail: the list takes the room back. */
.todo-shell.with-day:has(> .day-rail) {
    grid-template-columns: minmax(0, 1fr) 48px;
}

/* Sticky, so on a long list the day stays in view as the page scrolls. */
.todo-shell.with-day > .day-panel,
.todo-shell.with-day > .day-rail {
    grid-column: 2;
    grid-row: 2 / span 20;
    position: sticky;
    top: 16px;
}

@media (max-width: 1100px) {
    .todo-shell.with-day {
        display: block;
    }

    .todo-shell.with-day > .day-panel,
    .todo-shell.with-day > .day-rail {
        margin-top: 22px;
    }

    /* Below the list, a closed calendar is just its reopen button. */
    .todo-shell.with-day > .day-rail {
        height: auto;
        min-height: 0;
        padding: 6px;
    }
}

/* Images in any rich-text editor fit the editor instead of spilling to full size —
   testers dropped a picture in and could not shrink it back. */
.rte .ql-editor img {
    max-width: 100%;
    max-height: 22rem;
    height: auto;
}

/* Pictures inside rendered rich text (help text, instructions, blurbs) show as
   thumbnails — a full-size screenshot used to swamp the question it explained.
   Click one for the full image (aeLightbox in richtext.js). Tagged containers
   only, so avatars, logos and the editor itself are unaffected. */
.rich-html img {
    display: block;
    max-width: min(100%, 320px);
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0.5rem 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: zoom-in;
}

.rich-html img:hover {
    box-shadow: var(--shadow-md);
}

.img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--scrim-strong);
    cursor: zoom-out;
}

.img-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.img-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    border: none;
    background: none;
    color: var(--text-on-dark);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

/* The small dialog frame shared by To-Do's Add item and Time's entry dialog. */

.todo-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 1rem;
    overflow-y: auto;
    background: var(--rail-scrim);
}

.todo-modal {
    width: min(34rem, 100%);
    padding: 22px 24px 24px;
    border: 1px solid var(--c-line);
    border-radius: 14px;
    background: var(--c-panel);
    box-shadow: var(--c-shadow-menu);
}

.todo-modal-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--c-line);
}

.todo-modal-title {
    margin: 0;
    font: 600 17px var(--font-heading);
    color: var(--c-g0);
}

.todo-modal-close {
    border: none;
    background: none;
    color: var(--c-g13);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.todo-modal-close:hover {
    color: var(--c-g0);
}

/* Count tabs, shared by To-Do / My Week and the timesheet's day tabs. */

/* The count first and large, the name underneath. The number is the thing being
   compared across six tabs, so it is what the eye should land on. */
.todo-tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 1px;
    margin: 0 0 18px;
    border: 1px solid var(--c-line);
    border-radius: 12px;
    background: var(--c-line);
    overflow: hidden;
}

.todo-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 14px 8px;
    border: none;
    background: var(--c-panel);
    color: var(--c-g13);
    font-family: inherit;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.todo-tab:hover {
    background: var(--c-panel-2);
}

.todo-tab.on {
    background: var(--c-link);
    color: var(--text-on-brand);
}

.todo-tab-count {
    font: 700 22px var(--font-heading);
    line-height: 1.1;
    color: var(--c-g0);
    font-variant-numeric: tabular-nums;
}

.todo-tab.on .todo-tab-count {
    color: var(--text-on-brand);
}

.todo-tab-name {
    font-size: 11.5px;
    white-space: nowrap;
}

@media (max-width: 860px) {
    /* Six columns at phone width gives each about 50px, which fits neither a
       three-digit count nor "All completed". Two rows of three instead. */
    .todo-tabs {
        grid-auto-flow: row;
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Inbox fills the content column edge to edge, like a mail client; only the
   account bar keeps a little room above it. Doubled class on purpose: the scoped
   .admin-main padding in AdminLayout.razor.css loads later at equal specificity
   and otherwise leaves a gutter round the page and a strip under it. */
.admin-main.admin-main:has(.ibx) {
    padding: 0.75rem 0 0;
    /* Exactly the window: the Inbox's own panes scroll, the page never does. */
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.admin-main.admin-main:has(.ibx) .admin-userbar { flex: none; margin: 0 1.25rem 0.75rem; }

/* Scrollbars app-wide: thin, themed, and only there when something overflows
   (every scroller here is overflow:auto). The kanban board's look, everywhere.
   scrollbar-color inherits; scrollbar-width does not, hence the two rules. */
:root { scrollbar-color: color-mix(in srgb, var(--ink-soft) 28%, transparent) transparent; }
* { scrollbar-width: thin; }

/* The Inbox palette, shared by the Inbox page and anywhere its reader is shown
   (To-Do's email rows). Tokens only — layout stays with each page. */
.ib-tokens {
    --ib-mono: var(--font-mono);
    --ib-bg: var(--bg-subtle);
    --ib-panel: var(--bg-surface);
    --ib-ink: var(--text-primary);
    --ib-ink2: var(--text-secondary);
    --ib-ink3: var(--text-tertiary);
    --ib-line: var(--border);
    --ib-line-strong: var(--border-strong);
    --ib-hover: var(--bg-subtle);
    --ib-active: var(--brand-primary-tint);
    --ib-brand: var(--brand-primary-strong);
    --ib-brand-soft: var(--brand-primary-tint);
    --ib-brand-line: var(--brand-primary-soft);
    --ib-brand-text: var(--brand-primary-strong);
    --ib-chip: var(--border);
    --ib-shadow: var(--shadow-lg);
    --ib-shadow-lg: var(--shadow-lg);
}
