/* Admin design system — the shared "adm-" class set that gives every
   portal admin page the listings editor's look: forest-green header
   card, panels, green form controls, tables, banners. Written once
   here; admin pages opt in by wrapping content in .adm-page.

   Self-contained palette (scoped to .adm-page) so it never depends on
   the host theme tokens — light + dark both defined. */

.adm-page {
    --adm-brand:        var(--accent);
    --adm-brand-bright: var(--accent-bright);
    --adm-brand-deep:   var(--accent-active);
    --adm-surface:      var(--white);
    --adm-surface-2:    var(--surface-2);
    --adm-border:       rgba(var(--accent-rgb),  0.14);
    --adm-border-strong:rgba(var(--accent-rgb),  0.24);
    --adm-text:         var(--text);
    --adm-text-muted:   var(--text-secondary);
    --adm-text-soft:    var(--text-tertiary);
    --adm-danger:       var(--danger);
    --adm-warn:         var(--warning-text);
    --adm-ok:           var(--accent);
    --adm-info:         var(--info-bright);

    /* Aliases for the numbered token names used by the newer Payments /
       invoice sections. They were never defined, so var(--adm-text-2,
       var(--text-secondary)) etc. fell back to fixed light-theme greys that didn't
       adapt to dark mode (low-contrast text + near-invisible borders).
       Aliasing to the real tokens is resolved lazily at use-time, so
       these now follow light/dark correctly. */
    --adm-text-2:       var(--adm-text-muted);
    --adm-text-3:       var(--adm-text-soft);
    --adm-border-2:     var(--adm-border-strong);
    --adm-border-subtle:var(--adm-border);

    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding-bottom: 1rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--adm-text);
}

[data-theme="dark"] .adm-page {
    --adm-brand:        var(--accent);
    --adm-brand-bright: var(--accent-bright);
    --adm-brand-deep:   var(--accent-border);
    --adm-surface:      var(--surface);
    --adm-surface-2:    var(--surface-2);
    --adm-border:       rgba(var(--accent-rgb),  0.18);
    --adm-border-strong:rgba(var(--accent-rgb),  0.30);
    --adm-text:         var(--text);
    --adm-text-muted:   var(--text-secondary);
    --adm-text-soft:    var(--text-tertiary);
    --adm-danger:       var(--danger);
    --adm-warn:         var(--warning-bright);
    --adm-info:         var(--info);
}

/* ─── Header card ─────────────────────────────────────────── */

.adm-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--adm-border);
    border-radius: 16px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--adm-brand) 10%, var(--adm-surface)),
        var(--adm-surface) 60%);
}

.adm-head-icon {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(150deg, var(--adm-brand), var(--adm-brand-deep));
    color: var(--white);
    box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--adm-brand) 60%, transparent);
}

.adm-head-icon svg { width: 26px; height: 26px; }
.adm-head-text { flex: 1; min-width: 0; }

.adm-eyebrow {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--adm-brand);
}

.adm-title {
    margin: 0.1rem 0 0.2rem;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--adm-text);
}

.adm-subtitle {
    margin: 0;
    max-width: 70ch;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--adm-text-muted);
}

.adm-head-meta {
    margin: 0.15rem 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 12.5px;
    color: var(--adm-text-muted);
}

.adm-head-meta code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
}

.adm-head-dot { color: var(--adm-text-soft); }

.adm-head-actions { flex-shrink: 0; display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ─── Tabs ────────────────────────────────────────────────── */

.adm-tabs { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.adm-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.95rem;
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    background: var(--adm-surface);
    color: var(--adm-text-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    /* No background-color in the transition: the active tab uses a
       gradient (background-image), which can't interpolate to/from a
       solid — transitioning it makes the tab flash transparent. */
    transition: border-color 130ms ease, color 130ms ease;
}

.adm-tab:hover { color: var(--adm-text); border-color: var(--adm-border-strong); }

.adm-tab.is-active {
    background: linear-gradient(150deg, var(--adm-brand), var(--adm-brand-deep));
    border-color: transparent;
    color: var(--white);
}

.adm-tab svg { width: 15px; height: 15px; }

.adm-tab-count {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: color-mix(in srgb, currentColor 18%, transparent);
    font-size: 10.5px;
    font-weight: 800;
}

/* ─── Panels ──────────────────────────────────────────────── */

.adm-panel {
    border: 1px solid var(--adm-border);
    border-radius: 14px;
    background: var(--adm-surface);
    padding: 1.25rem 1.3rem;
}

.adm-panel-head { margin-bottom: 1rem; }

.adm-panel-eyebrow {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--adm-brand);
}

.adm-panel-title {
    margin: 0.15rem 0 0.3rem;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--adm-text);
}

.adm-panel-hint {
    margin: 0;
    max-width: 70ch;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--adm-text-muted);
}

.adm-panel-hint strong { color: var(--adm-text); font-weight: 600; }

/* A panel head with an inline action on the right. */
.adm-panel-head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

/* Trailing button bar for panels that act as forms — sits below the
   .adm-grid and aligns its buttons to the right with a subtle
   top divider. Cancel + Submit, in that order. */
.adm-panel-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.2rem;
    padding-top: 0.95rem;
    border-top: 1px solid var(--adm-border);
}

/* Native <details> styled to match panels — used for collapsible
   "Sign off" / "Cancel inspection" sections that take space when
   open but stay tucked away by default. */
.adm-details-summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--adm-text);
    list-style: none;
    padding: 0.4rem 0;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.adm-details-summary::-webkit-details-marker { display: none; }
.adm-details-summary::before {
    content: '▸';
    color: var(--adm-text-muted);
    transition: transform 0.12s ease;
    font-size: 12px;
}
details[open] > .adm-details-summary::before { transform: rotate(90deg); }

/* ─── Phase 13 — inspection page (mobile-friendly + photos) ───── */

.adm-inspection-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.adm-room-group {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 14px;
    padding: 0.85rem 0.95rem 0.95rem;
}

.adm-room-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--adm-border);
}

.adm-room-head h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--adm-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.adm-room-count {
    font-size: 12px;
    color: var(--adm-text-muted);
}

.adm-room-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.adm-room-item {
    padding: 0.7rem;
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    background: color-mix(in srgb, var(--adm-surface) 90%, var(--adm-border));
}

.adm-item-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.adm-item-text { flex: 1 1 240px; min-width: 0; }

.adm-item-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-weight: 600;
    color: var(--adm-text);
    font-size: 14.5px;
}

.adm-item-notes {
    margin: 0.25rem 0 0;
    font-size: 13px;
    color: var(--adm-text-muted);
    line-height: 1.45;
}

.adm-item-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.adm-item-edit-title {
    font-weight: 600;
    margin-bottom: 0.6rem;
}
.adm-item-edit-foot {
    margin-top: 0.7rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
}

/* Phase 20 — compliance score panel shown when an inspection has
   items. Visually heavyweight to set the top-line story for the page
   when the inspection's complete. */
.adm-compliance-panel {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.2rem;
    border-radius: 14px;
    border: 1px solid var(--adm-border);
    background: var(--adm-surface);
    margin-bottom: 1rem;
}
.adm-compliance-panel[data-tone="ok"]     { background: color-mix(in srgb, var(--accent-bright) 6%, var(--adm-surface)); border-color: color-mix(in srgb, var(--accent-bright) 22%, var(--adm-border)); }
.adm-compliance-panel[data-tone="info"]   { background: color-mix(in srgb, var(--info-bright) 6%, var(--adm-surface)); border-color: color-mix(in srgb, var(--info-bright) 22%, var(--adm-border)); }
.adm-compliance-panel[data-tone="warn"]   { background: color-mix(in srgb, var(--warning) 6%, var(--adm-surface)); border-color: color-mix(in srgb, var(--warning) 22%, var(--adm-border)); }
.adm-compliance-panel[data-tone="danger"] { background: color-mix(in srgb, var(--danger-bright) 6%, var(--adm-surface)); border-color: color-mix(in srgb, var(--danger-bright) 22%, var(--adm-border)); }

.adm-compliance-score {
    display: flex;
    align-items: baseline;
    gap: 0.15rem;
    flex-shrink: 0;
    font-family: 'Outfit', var(--font-sans);
    font-variant-numeric: tabular-nums;
}
.adm-compliance-num {
    font-size: 40px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--adm-text);
}
.adm-compliance-panel[data-tone="ok"]     .adm-compliance-num { color: var(--accent); }
.adm-compliance-panel[data-tone="info"]   .adm-compliance-num { color: var(--info); }
.adm-compliance-panel[data-tone="warn"]   .adm-compliance-num { color: var(--warning); }
.adm-compliance-panel[data-tone="danger"] .adm-compliance-num { color: var(--danger); }
.adm-compliance-pct { font-size: 22px; font-weight: 600; color: var(--adm-text-muted); }
.adm-compliance-text { flex: 1; display: flex; flex-direction: column; gap: 0.1rem; }
.adm-compliance-text strong { font-size: 15px; color: var(--adm-text); }
.adm-compliance-text > span:last-child { font-size: 13px; color: var(--adm-text-muted); line-height: 1.5; }

/* Phase 19 — rectification block beneath a rectified item.
   The original Condition stays as a danger/warn pill above; this block
   is the "and then it was fixed on X by Y" addendum. */
.adm-item-rectification {
    margin-top: 0.55rem;
    padding: 0.55rem 0.7rem;
    background: color-mix(in srgb, var(--accent-bright) 8%, var(--adm-surface));
    border: 1px solid color-mix(in srgb, var(--accent-bright) 28%, var(--adm-border));
    border-radius: 8px;
    color: var(--adm-text);
    font-size: 13px;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    line-height: 1.4;
}
.adm-item-rectification svg {
    width: 16px; height: 16px;
    color: var(--accent-bright);
    flex-shrink: 0;
    margin-top: 2px;
}
.adm-item-rectification strong { color: var(--accent); }
.adm-item-rectification-note {
    margin: 0.25rem 0 0;
    color: var(--adm-text-muted);
    font-style: italic;
}

/* Photo strip — horizontal scroll on small screens, wraps on larger. */
.adm-item-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.7rem;
}

.adm-item-photo {
    position: relative;
    width: 88px;
    height: 88px;
    border-radius: 8px;
    overflow: hidden;
    background: color-mix(in srgb, var(--adm-border) 50%, var(--adm-surface));
    border: 1px solid var(--adm-border);
    flex: 0 0 auto;
}
.adm-item-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.adm-item-photo-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--adm-text-muted);
    font-size: 13px;
}
.adm-item-photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 0;
    background: rgba(var(--shadow-rgb),  0.72);
    color: var(--white);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.adm-item-photo-remove:hover { background: rgba(var(--danger-rgb),  0.92); }

.adm-item-photo-add {
    width: 88px;
    height: 88px;
    border-radius: 8px;
    border: 2px dashed var(--adm-border-strong);
    color: var(--adm-brand, var(--accent));
    background: var(--adm-surface);
    display: grid;
    place-items: center;
    grid-auto-flow: row;
    gap: 0.2rem;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease;
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.adm-item-photo-add:hover {
    border-color: var(--adm-brand, var(--accent));
    background: color-mix(in srgb, var(--adm-brand, var(--accent)) 6%, var(--adm-surface));
}
.adm-item-photo-add svg { width: 22px; height: 22px; }
.adm-item-photo-add input[type="file"] {
    /* Hide the native file input — the parent label is the click target. */
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    clip: rect(0 0 0 0);
    overflow: hidden;
}

/* Phone-sized tweaks — touch targets get bigger, photos wider for thumb */
@media (max-width: 720px) {
    .adm-inspection-page .adm-head {
        flex-direction: column;
        align-items: stretch;
    }
    .adm-inspection-page .adm-head-actions {
        order: 99;
    }
    .adm-item-main { flex-direction: column; }
    .adm-item-actions { width: 100%; justify-content: flex-end; }
    .adm-item-photo, .adm-item-photo-add { width: 96px; height: 96px; }
    .adm-modal {
        max-width: calc(100vw - 1.6rem);
        max-height: calc(100vh - 4rem);
    }
    /* Bigger buttons for thumb-tapping */
    .adm-inspection-page .adm-btn { min-height: 44px; }
}


/* ─── Form grid + fields ──────────────────────────────────── */

.adm-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.9rem 1rem;
}

.adm-grid-3 { grid-template-columns: repeat(3, 1fr); }

.adm-field { display: flex; flex-direction: column; gap: 0.32rem; min-width: 0; }
.adm-field-wide { grid-column: 1 / -1; }

.adm-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--adm-brand);
}

.adm-help { font-size: 11.5px; line-height: 1.5; color: var(--adm-text-soft); }

.adm-input,
.adm-select,
.adm-textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--adm-border-strong);
    border-radius: 9px;
    background: var(--adm-surface);
    color: var(--adm-text);
    font-family: inherit;
    font-size: 13.5px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.adm-textarea { resize: vertical; line-height: 1.5; min-height: 80px; }

.adm-input:focus-visible,
.adm-select:focus-visible,
.adm-textarea:focus-visible {
    outline: none;
    border-color: var(--adm-brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--adm-brand) 16%, transparent);
}

.adm-input::placeholder,
.adm-textarea::placeholder { color: var(--adm-text-soft); }

/* ─── Buttons ─────────────────────────────────────────────── */

.adm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.95rem;
    border-radius: 9px;
    border: 1px solid var(--adm-border-strong);
    background: var(--adm-surface);
    color: var(--adm-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    /* filter (not background) so the gradient primary button can't
       flash transparent on hover — a gradient can't transition to a
       solid colour. */
    transition: filter 130ms ease, border-color 130ms ease, transform 80ms ease;
}

.adm-btn:active { transform: translateY(1px); }
.adm-btn svg { width: 15px; height: 15px; }
.adm-btn:disabled, .adm-btn.is-busy { opacity: 0.6; cursor: default; }
.adm-btn.is-sm { padding: 0.35rem 0.65rem; font-size: 12px; }

.adm-btn.is-primary {
    background: linear-gradient(150deg, var(--adm-brand), var(--adm-brand-deep));
    border-color: transparent;
    color: var(--white);
}

.adm-btn.is-primary:hover { filter: brightness(1.08); }
.adm-btn.is-ghost:hover { border-color: var(--adm-border-strong); }
.adm-btn.is-ghost { background: var(--adm-surface-2); }

.adm-btn.is-danger {
    color: var(--adm-danger);
    border-color: color-mix(in srgb, var(--adm-danger) 40%, var(--adm-border));
}

.adm-btn.is-danger:hover {
    background: color-mix(in srgb, var(--adm-danger) 10%, var(--adm-surface));
}

/* ─── Toolbar + checkbox ──────────────────────────────────── */

.adm-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.adm-check {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--adm-border-strong);
    border-radius: 9px;
    background: var(--adm-surface);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--adm-text-muted);
    cursor: pointer;
}

.adm-check input[type="checkbox"],
.adm-check input[type="radio"] {
    accent-color: var(--adm-brand);
    width: 15px;
    height: 15px;
    margin: 0;
    cursor: pointer;
}

/* Colour picker + preset swatches */
.adm-color {
    width: 46px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--adm-border-strong);
    border-radius: 8px;
    background: var(--adm-surface);
    cursor: pointer;
}

.adm-swatch {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: 2px solid transparent;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(var(--shadow-rgb),  0.12);
    padding: 0;
}

/* ─── Banners ─────────────────────────────────────────────── */

.adm-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.7rem 0.9rem;
    border-radius: 11px;
    border: 1px solid transparent;
    font-size: 12.5px;
    line-height: 1.5;
}

.adm-banner svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.adm-banner strong { font-weight: 800; }

.adm-banner.is-ok {
    background: color-mix(in srgb, var(--adm-ok) 11%, var(--adm-surface));
    border-color: color-mix(in srgb, var(--adm-ok) 32%, transparent);
    color: var(--adm-ok);
}

.adm-banner.is-error {
    background: color-mix(in srgb, var(--adm-danger) 11%, var(--adm-surface));
    border-color: color-mix(in srgb, var(--adm-danger) 32%, transparent);
    color: var(--adm-danger);
}

.adm-banner.is-warn {
    background: color-mix(in srgb, var(--adm-warn) 12%, var(--adm-surface));
    border-color: color-mix(in srgb, var(--adm-warn) 34%, transparent);
    color: var(--adm-warn);
}

.adm-banner.is-info {
    background: color-mix(in srgb, var(--adm-info) 11%, var(--adm-surface));
    border-color: color-mix(in srgb, var(--adm-info) 30%, transparent);
    color: var(--adm-info);
}

/* ─── Status pills ────────────────────────────────────────── */

.adm-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    background: var(--adm-surface-2);
    border: 1px solid var(--adm-border);
    font-size: 11px;
    font-weight: 700;
    color: var(--adm-text-muted);
}

.adm-pill[data-tone="ok"] {
    background: color-mix(in srgb, var(--adm-ok) 12%, var(--adm-surface));
    border-color: color-mix(in srgb, var(--adm-ok) 30%, transparent);
    color: var(--adm-ok);
}

.adm-pill[data-tone="warn"] {
    background: color-mix(in srgb, var(--adm-warn) 13%, var(--adm-surface));
    border-color: color-mix(in srgb, var(--adm-warn) 32%, transparent);
    color: var(--adm-warn);
}

.adm-pill[data-tone="danger"] {
    background: color-mix(in srgb, var(--adm-danger) 12%, var(--adm-surface));
    border-color: color-mix(in srgb, var(--adm-danger) 30%, transparent);
    color: var(--adm-danger);
}

.adm-pill[data-tone="brand"] {
    background: color-mix(in srgb, var(--adm-brand) 12%, var(--adm-surface));
    border-color: color-mix(in srgb, var(--adm-brand) 30%, transparent);
    color: var(--adm-brand);
}

.adm-pill[data-tone="info"] {
    background: color-mix(in srgb, var(--info-bright) 10%, var(--adm-surface));
    border-color: color-mix(in srgb, var(--info-bright) 30%, transparent);
    color: var(--info);
}

.adm-pill[data-tone="neutral"] {
    background: var(--adm-surface-2);
    border-color: var(--adm-border);
    color: var(--adm-text-soft);
}

/* ─── KPI grid (usage / metric cards) ─────────────────────── */

.adm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.8rem;
}

.adm-kpi {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    background: var(--adm-surface-2);
}

.adm-kpi-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--adm-text-soft);
}

.adm-kpi-value {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--adm-text);
    font-variant-numeric: tabular-nums;
}

.adm-kpi-value small { font-size: 12px; font-weight: 600; color: var(--adm-text-soft); }

.adm-meter {
    height: 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--adm-brand) 12%, var(--adm-surface));
    overflow: hidden;
}

.adm-meter-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--adm-brand);
}

.adm-meter-fill[data-full="true"] { background: var(--adm-warn); }

.adm-kpi-sub { font-size: 11px; color: var(--adm-text-soft); }

/* ─── Nested card (a card within a panel) ─────────────────── */

.adm-card {
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    background: var(--adm-surface);
    padding: 1rem 1.05rem;
}

.adm-card[data-current="true"] {
    border-color: color-mix(in srgb, var(--adm-brand) 38%, var(--adm-border));
    background: color-mix(in srgb, var(--adm-brand) 6%, var(--adm-surface));
}

/* ─── Related-items hub cards ─────────────────────────────────
   Used on the lease detail page to surface every linked entity
   (application, renter, listing, inspections, maintenance,
   statement) as a click-through tile. Tone via data-tone:
   "warn" = needs attention (e.g. no application yet),
   "ok"   = on track / no follow-up needed. */
.adm-related-card {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--adm-border);
    background: var(--adm-surface);
    color: inherit;
    text-decoration: none;
    transition: transform 0.06s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.adm-related-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -10px rgba(var(--shadow-rgb),  0.25);
    border-color: color-mix(in srgb, var(--adm-brand) 22%, var(--adm-border));
}
.adm-related-card[data-tone="warn"] {
    border-color: rgba(var(--gold-rgb),  0.30);
    background: color-mix(in srgb, var(--warning-subtle) 30%, var(--adm-surface));
}

.adm-related-icon {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(var(--accent-rgb),  0.10);
    color: var(--adm-brand, var(--accent));
}
.adm-related-card[data-tone="warn"] .adm-related-icon {
    background: rgba(var(--gold-rgb),  0.14);
    color: var(--warning-text);
}
.adm-related-icon svg { width: 18px; height: 18px; }

.adm-related-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.adm-related-eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    color: var(--adm-text-soft, var(--text-secondary));
}
.adm-related-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--adm-text, var(--text));
}
.adm-related-sub {
    font-size: 12px;
    color: var(--adm-text-soft, var(--text-secondary));
    line-height: 1.4;
}

/* ─── Table ───────────────────────────────────────────────── */

.adm-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    overflow: hidden;
}

.adm-table th,
.adm-table td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid var(--adm-border);
}

.adm-table th {
    background: var(--adm-surface-2);
    color: var(--adm-text-soft);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.adm-table td { color: var(--adm-text-muted); }
.adm-table tr:last-child td { border-bottom: none; }
.adm-table tbody tr { transition: background-color 110ms ease; }
.adm-table tbody tr:hover td { background: color-mix(in srgb, var(--adm-brand) 5%, var(--adm-surface)); }

/* ─── List rows ───────────────────────────────────────────── */

.adm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }

.adm-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--adm-border);
    border-radius: 11px;
    background: var(--adm-surface);
    transition: border-color 120ms ease;
}

.adm-row:hover { border-color: var(--adm-border-strong); }

.adm-row-icon {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--adm-brand) 12%, var(--adm-surface));
    color: var(--adm-brand);
}

.adm-row-icon svg { width: 18px; height: 18px; }
.adm-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.adm-row-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: 13px;
    font-weight: 700;
    color: var(--adm-text);
}
.adm-row-sub { font-size: 11px; color: var(--adm-text-soft); overflow-wrap: anywhere; }
.adm-row-sub code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10.5px;
}
.adm-row-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }

.adm-icon-btn {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--adm-border);
    background: var(--adm-surface);
    color: var(--adm-text-muted);
    cursor: pointer;
    transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.adm-icon-btn:hover { color: var(--adm-brand); border-color: var(--adm-border-strong); }
.adm-icon-btn svg { width: 16px; height: 16px; }
.adm-icon-btn.is-danger:hover {
    color: var(--adm-danger);
    border-color: color-mix(in srgb, var(--adm-danger) 40%, var(--adm-border));
}

/* ─── Empty + loading states ──────────────────────────────── */

.adm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--adm-text-soft);
}

.adm-empty svg { width: 30px; height: 30px; }
.adm-empty p { margin: 0; font-size: 12.5px; max-width: 44ch; }

.adm-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    color: var(--adm-text-soft);
    font-size: 13px;
}

.adm-spin { width: 18px; height: 18px; animation: adm-spin 0.7s linear infinite; }

@keyframes adm-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .adm-spin { animation: none; }
}

/* ─── Sticky footer ───────────────────────────────────────── */

.adm-footer {
    position: sticky;
    bottom: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--adm-surface) 92%, transparent);
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px -18px rgba(var(--shadow-rgb),  0.5);
}

.adm-footer-note { font-size: 11.5px; color: var(--adm-text-soft); }

.adm-banner code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
}

/* ─── Plan / pricing blocks (billing) ─────────────────────── */

.adm-plan-line {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.adm-plan-name {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--adm-text);
}

.adm-plan-price {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--adm-brand);
}

.adm-plan-price small {
    font-size: 11px;
    font-weight: 600;
    color: var(--adm-text-soft);
}

.adm-meta-line {
    margin: 0.5rem 0 0;
    font-size: 12px;
    color: var(--adm-text-muted);
}

.adm-meta-line strong { color: var(--adm-text); font-weight: 700; }

.adm-plan-actions { margin-top: 0.9rem; }

.adm-plan-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.adm-plan-feats {
    list-style: none;
    margin: 0.6rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.adm-plan-feats li {
    position: relative;
    padding-left: 1.1rem;
    font-size: 12px;
    color: var(--adm-text-muted);
}

.adm-plan-feats li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.36em;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--adm-brand);
}

/* ─── Modal / dialog ──────────────────────────────────────── */

.adm-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(var(--shadow-rgb),  0.55);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9998;
    animation: adm-modal-fade 160ms ease-out;
}

.adm-modal {
    /* Self-contained palette — the modal renders outside .adm-page,
       so it carries its own tokens (light + dark below). */
    --adm-brand:        var(--accent);
    --adm-brand-bright: var(--accent-bright);
    --adm-brand-deep:   var(--accent-active);
    --adm-surface:      var(--white);
    --adm-surface-2:    var(--surface-2);
    --adm-border:       rgba(var(--accent-rgb),  0.14);
    --adm-border-strong:rgba(var(--accent-rgb),  0.24);
    --adm-text:         var(--text);
    --adm-text-muted:   var(--text-secondary);
    --adm-text-soft:    var(--text-tertiary);
    --adm-danger:       var(--danger);
    --adm-warn:         var(--warning-text);
    --adm-ok:           var(--accent);
    --adm-info:         var(--info-bright);

    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 2rem));
    max-height: 86vh;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--adm-border);
    border-radius: 16px;
    background: var(--adm-surface);
    color: var(--adm-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    box-shadow: 0 24px 56px -12px rgba(var(--shadow-rgb),  0.4);
    animation: adm-modal-rise 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .adm-modal {
    --adm-brand:        var(--accent);
    --adm-brand-bright: var(--accent-bright);
    --adm-brand-deep:   var(--accent-border);
    --adm-surface:      var(--surface);
    --adm-surface-2:    var(--surface-2);
    --adm-border:       rgba(var(--accent-rgb),  0.18);
    --adm-border-strong:rgba(var(--accent-rgb),  0.30);
    --adm-text:         var(--text);
    --adm-text-muted:   var(--text-secondary);
    --adm-text-soft:    var(--text-tertiary);
    --adm-danger:       var(--danger);
    --adm-warn:         var(--warning-bright);
    --adm-ok:           var(--accent);
    --adm-info:         var(--info);
}

@keyframes adm-modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes adm-modal-rise {
    from { opacity: 0; transform: translate(-50%, -47%) scale(0.98); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .adm-modal, .adm-modal-backdrop { animation: none; }
}

.adm-modal-head {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--adm-border);
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--adm-brand) 8%, var(--adm-surface)),
        var(--adm-surface) 70%);
}

.adm-modal-icon {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: linear-gradient(150deg, var(--adm-brand), var(--adm-brand-deep));
    color: var(--white);
}

.adm-modal-icon svg { width: 19px; height: 19px; }

.adm-modal-head-text { flex: 1; min-width: 0; }

.adm-modal-head-text h2 {
    margin: 0;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--adm-text);
}

.adm-modal-head-text p {
    margin: 0.1rem 0 0;
    font-size: 12px;
    color: var(--adm-text-soft);
}

.adm-modal-close {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--adm-border);
    background: var(--adm-surface-2);
    color: var(--adm-text-muted);
    cursor: pointer;
    transition: color 120ms ease, border-color 120ms ease;
}

.adm-modal-close:hover { color: var(--adm-text); border-color: var(--adm-border-strong); }
.adm-modal-close svg { width: 15px; height: 15px; }

.adm-modal-body { padding: 1.15rem; overflow-y: auto; }

.adm-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.8rem 1.15rem;
    border-top: 1px solid var(--adm-border);
    background: var(--adm-surface-2);
}

/* ─── Two-column layout (editor + preview) ────────────────── */

.adm-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
    align-items: start;
}

.adm-preview-subject {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    background: var(--adm-surface-2);
    font-size: 13px;
    font-weight: 600;
    color: var(--adm-text);
}

.adm-preview-body {
    margin: 0;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    background: var(--adm-surface-2);
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--adm-text-muted);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 380px;
    overflow: auto;
}

/* ─── Responsive ──────────────────────────────────────────── */

@media (max-width: 980px) {
    .adm-cols { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .adm-grid, .adm-grid-3 { grid-template-columns: 1fr; }
    .adm-head { flex-direction: column; align-items: flex-start; }
}

/* ─────────────────────────────────────────────────────────
   Compact list polish + search/sort interactions
   ───────────────────────────────────────────────────────── */

/* Tighter list rows so a laptop fits ~12 visible without scrolling. */
.adm-list { gap: 0.35rem; }

.adm-row {
    padding: 0.55rem 0.75rem;
    gap: 0.65rem;
    align-items: center;
}

.adm-row-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}

.adm-row-icon svg { width: 16px; height: 16px; }

.adm-row-title {
    font-size: 13.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.adm-row-sub { font-size: 11.5px; line-height: 1.4; }
.adm-row-sub + .adm-row-sub { margin-top: 1px; }

.adm-row-trailing {
    text-align: right;
    font-size: 11.5px;
    color: var(--adm-text-soft);
    flex-shrink: 0;
    min-width: 0;
}

.adm-row-trailing strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--adm-text);
}

/* Pills sit comfortably inside row-title without bumping the height. */
.adm-pill {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1.2;
}

/* Sort indicators on table headers — set via portal-list.js. */
.adm-sort-indicator {
    font-size: 11px;
    color: var(--adm-brand);
    margin-left: 2px;
    display: inline-block;
    min-width: 0.8em;
}

[data-sort] {
    user-select: none;
}

[data-sort]:hover {
    color: var(--adm-brand);
}

/* Toolbar that mixes a search input + filter pills + actions */
.adm-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.45rem 0.55rem;
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    margin-bottom: 0.85rem;
}

.adm-toolbar-search {
    /* Constrain so the search doesn't eat the whole bar — pairs well
       with filter selects sitting beside it on a laptop screen. */
    flex: 0 1 380px;
    min-width: 200px;
    position: relative;
    display: flex;
    align-items: center;
}

.adm-toolbar-search svg {
    position: absolute;
    left: 0.6rem;
    width: 14px;
    height: 14px;
    color: var(--adm-text-soft);
    pointer-events: none;
}

.adm-toolbar-search input {
    width: 100%;
    padding: 0.42rem 0.55rem 0.42rem 1.85rem;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    background: var(--adm-surface-2);
    color: var(--adm-text);
    font: inherit;
    font-size: 13px;
    transition: border-color 110ms ease, box-shadow 110ms ease;
}

.adm-toolbar-search input::placeholder {
    color: var(--adm-text-soft);
}

.adm-toolbar-search input:focus-visible {
    outline: none;
    border-color: var(--adm-brand);
    background: var(--adm-surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--adm-brand) 18%, transparent);
}

/* Inline filter — label sits to the left of the select, not above it. */
.adm-toolbar-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.adm-toolbar-filter > label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--adm-text-soft);
    font-weight: 600;
    white-space: nowrap;
}

.adm-toolbar-filter > select {
    padding: 0.42rem 1.75rem 0.42rem 0.65rem;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    background: var(--adm-surface-2);
    color: var(--adm-text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--adm-text-soft) 50%),
        linear-gradient(135deg, var(--adm-text-soft) 50%, transparent 50%);
    background-position:
        calc(100% - 14px) 50%,
        calc(100% - 9px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    transition: border-color 110ms ease, box-shadow 110ms ease;
    min-width: 130px;
}

.adm-toolbar-filter > select:focus-visible {
    outline: none;
    border-color: var(--adm-brand);
    background-color: var(--adm-surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--adm-brand) 18%, transparent);
}

.adm-toolbar-divider {
    width: 1px;
    height: 22px;
    background: var(--adm-border);
    flex-shrink: 0;
}

.adm-toolbar-counter {
    font-size: 11px;
    color: var(--adm-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-left: auto;
    padding: 0 0.25rem;
    white-space: nowrap;
}

.adm-toolbar-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* Tighter tables for dense data display */
.adm-table {
    font-size: 12.5px;
}

.adm-table th {
    padding: 0.55rem 0.65rem;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--adm-text-soft);
    background: var(--adm-surface-2);
    border-bottom: 1px solid var(--adm-border);
    white-space: nowrap;
}

.adm-table td {
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid var(--adm-border);
    vertical-align: top;
}

.adm-table td.num,
.adm-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.adm-table td a {
    color: var(--adm-text);
    text-decoration: none;
    font-weight: 500;
}

.adm-table td a:hover {
    color: var(--adm-brand);
    text-decoration: underline;
}

.adm-table tbody tr {
    transition: background-color 110ms ease;
}

.adm-table tbody tr:hover td {
    background: color-mix(in srgb, var(--adm-brand) 4%, var(--adm-surface));
}

.adm-table .row-cell-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--adm-text);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.adm-table .row-cell-sub {
    display: block;
    font-size: 11px;
    color: var(--adm-text-soft);
    margin-top: 2px;
    line-height: 1.35;
}

.adm-empty-row td {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--adm-text-soft);
    font-size: 12.5px;
}

/* KPI tiles for the rentals dashboard — denser by default */
.adm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.adm-kpi-tile {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.adm-kpi-tile .adm-eyebrow {
    margin: 0;
    font-size: 10px;
    color: var(--adm-text-soft);
}

.adm-kpi-tile .adm-kpi-value {
    font-family: 'Outfit', var(--font-sans);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--adm-text);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.adm-kpi-tile[data-tone="brand"] .adm-kpi-value { color: var(--adm-brand); }
.adm-kpi-tile[data-tone="danger"] .adm-kpi-value { color: var(--adm-danger); }
.adm-kpi-tile[data-tone="warn"] .adm-kpi-value { color: var(--adm-warn); }
.adm-kpi-tile[data-tone="ok"] .adm-kpi-value { color: var(--adm-ok, var(--accent)); }

/* Clickable variant — when the KPI tile is a <button> it acts as a
   filter pill. Active state matches the .adm-tab.is-active accent. */
button.adm-kpi-tile {
    text-align: left;
    cursor: pointer;
    font: inherit;
    transition: border-color 0.12s ease, transform 0.06s ease;
}
button.adm-kpi-tile:hover {
    border-color: color-mix(in srgb, var(--adm-brand) 30%, var(--adm-border));
    transform: translateY(-1px);
}
button.adm-kpi-tile.is-active {
    border-color: var(--adm-brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--adm-brand) 18%, transparent);
}

.adm-action-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.8rem;
}

.adm-kpi-tile .adm-kpi-sub {
    font-size: 11.5px;
    color: var(--adm-text-soft);
    line-height: 1.35;
    margin: 0;
}

/* Tighter head and page chrome — fits more on a 13-14" laptop */
.adm-page { padding: 1rem 1.25rem 2rem; }

.adm-head {
    padding: 0.95rem 1.25rem;
    margin-bottom: 0.85rem;
}

.adm-title { font-size: 22px; }
.adm-subtitle { font-size: 12.5px; margin-top: 0.2rem; }

@media (max-width: 1100px) {
    .adm-toolbar-counter { width: 100%; text-align: right; }
}

@media (max-width: 720px) {
    .adm-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .adm-toolbar-search,
    .adm-toolbar .adm-field { width: 100%; min-width: 0; }
    .adm-toolbar-filter { width: 100%; }
    .adm-toolbar-filter > select { flex: 1; }
    .adm-toolbar-divider { display: none; }
    .adm-table { font-size: 12px; }
    .adm-table td, .adm-table th { padding: 0.5rem 0.45rem; }
}

/* ─────────────────────────────────────────────────────────
   Calendar + chase-list layout (/portal/calendar)
   ───────────────────────────────────────────────────────── */

.adm-calendar-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.adm-calendar-agenda,
.adm-calendar-tasks {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    padding: 0.85rem 1rem 1rem;
}

.adm-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding-bottom: 0.6rem;
    margin-bottom: 0.6rem;
    border-bottom: 1px solid var(--adm-border);
}

.adm-section-head h2 {
    margin: 0;
    font-family: 'Outfit', var(--font-sans);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--adm-text);
}

.adm-section-meta {
    font-size: 11px;
    color: var(--adm-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* ─── Agenda timeline ────────────────────────────────────── */

.adm-agenda {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.adm-agenda-day {
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 0.85rem;
    align-items: start;
}

.adm-agenda-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding-top: 0.15rem;
}

.adm-agenda-date-pill {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--adm-surface-2);
    border: 1px solid var(--adm-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    line-height: 1;
}

.adm-agenda-date-pill[data-state="today"] {
    background: color-mix(in srgb, var(--adm-brand) 18%, var(--adm-surface));
    border-color: var(--adm-brand);
    color: var(--adm-brand);
}

.adm-agenda-date-pill[data-state="past"] {
    opacity: 0.6;
}

.adm-agenda-day-num {
    font-family: 'Outfit', var(--font-sans);
    font-size: 20px;
    font-weight: 700;
    color: var(--adm-text);
    letter-spacing: -0.02em;
}

.adm-agenda-date-pill[data-state="today"] .adm-agenda-day-num { color: var(--adm-brand); }

.adm-agenda-day-mo {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--adm-text-soft);
    font-weight: 600;
}

.adm-agenda-rel {
    font-size: 10px;
    color: var(--adm-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    text-align: center;
    max-width: 86px;
    line-height: 1.2;
}

.adm-agenda-events {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.adm-agenda-event {
    background: var(--adm-surface-2);
    border: 1px solid var(--adm-border);
    border-left: 3px solid var(--adm-border-strong);
    border-radius: 8px;
    transition: background 110ms ease, border-color 110ms ease;
}

.adm-agenda-event[data-tone="danger"] { border-left-color: var(--adm-danger); }
.adm-agenda-event[data-tone="warn"]   { border-left-color: var(--adm-warn); }
.adm-agenda-event[data-tone="ok"]     { border-left-color: var(--adm-ok, var(--accent)); }
.adm-agenda-event[data-tone="info"]   { border-left-color: var(--adm-info, var(--info)); }
.adm-agenda-event[data-tone="brand"]  { border-left-color: var(--adm-brand); }

.adm-agenda-event:hover {
    background: color-mix(in srgb, var(--adm-brand) 5%, var(--adm-surface));
    border-color: var(--adm-border-strong);
}

.adm-agenda-event a {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 0.55rem;
    align-items: center;
    padding: 0.5rem 0.65rem;
    color: var(--adm-text);
    text-decoration: none;
}

.adm-agenda-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--adm-surface);
    display: inline-grid;
    place-items: center;
    font-size: 14px;
    border: 1px solid var(--adm-border);
}

.adm-agenda-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.adm-agenda-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--adm-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adm-agenda-sub {
    font-size: 11px;
    color: var(--adm-text-soft);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.adm-agenda-time {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--adm-text-soft);
    font-variant-numeric: tabular-nums;
}

/* ─── Chase list ─────────────────────────────────────────── */

.adm-task-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.adm-task {
    background: var(--adm-surface-2);
    border: 1px solid var(--adm-border);
    border-left: 3px solid var(--adm-border-strong);
    border-radius: 8px;
}

.adm-task[data-tone="danger"] {
    border-left-color: var(--adm-danger);
    background: color-mix(in srgb, var(--adm-danger) 5%, var(--adm-surface-2));
}

.adm-task[data-tone="warn"] { border-left-color: var(--adm-warn); }
.adm-task[data-tone="info"] { border-left-color: var(--adm-info, var(--info)); }
.adm-task[data-tone="ok"]   { border-left-color: var(--adm-ok, var(--accent)); }

.adm-task:hover {
    border-color: var(--adm-border-strong);
}

.adm-task a {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 0.55rem;
    align-items: center;
    padding: 0.55rem 0.65rem;
    color: var(--adm-text);
    text-decoration: none;
}

.adm-task-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--adm-surface);
    display: inline-grid;
    place-items: center;
    font-size: 13px;
    border: 1px solid var(--adm-border);
}

.adm-task-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.adm-task-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--adm-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adm-task-sub {
    font-size: 11px;
    color: var(--adm-text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adm-task-amount {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--adm-danger);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

@media (max-width: 980px) {
    .adm-calendar-grid {
        grid-template-columns: 1fr;
    }
    .adm-agenda-day { grid-template-columns: 72px 1fr; gap: 0.5rem; }
    .adm-agenda-date-pill { width: 50px; height: 50px; }
    .adm-agenda-rel { max-width: 72px; font-size: 9.5px; }
}

/* ─── Card subsections ─────────────────────────────────────────
   adm-card has been a bare container; these inner pieces let us
   build a richer card with a heading band + body section without
   needing the Card component. Used by the per-property
   inspection-history page (compliance trend, repeat offenders,
   timeline) and reusable anywhere a card needs structure. */
.adm-card-head {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-bottom: 0.7rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--adm-border);
}
.adm-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--adm-text);
    margin: 0;
    letter-spacing: -0.005em;
}
.adm-card-subtitle {
    font-size: 12px;
    color: var(--adm-text-soft);
    line-height: 1.45;
    margin: 0;
}
.adm-card-body { display: block; }

/* KPI tile unit suffix (e.g. the % after a percentage value). */
.adm-kpi-unit {
    font-size: 14px;
    font-weight: 600;
    color: var(--adm-text-soft);
    margin-left: 0.15rem;
}

/* ─── Sparkline / compliance trend ─────────────────────────────
   480×80 SVG used on the per-property inspection-history page.
   Visual zones are emitted as dashed gridlines (95 / 80 / 60) so
   the eye can read the line against compliance bands without a
   separate axis. */
.adm-sparkline {
    width: 100%;
    height: 120px;
    display: block;
}
.adm-sparkline-legend {
    margin-top: 0.45rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    font-size: 11px;
    color: var(--adm-text-soft);
}

/* ─── Inspection timeline rows ─────────────────────────────────
   Per-row layout for the per-property inspection history. The
   data-tone left-bar mirrors compliance: ok / info / warn /
   danger by latest score. */
.adm-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.adm-timeline-row {
    display: grid;
    grid-template-columns: 170px 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--adm-border);
    border-left: 4px solid var(--adm-border-strong);
    border-radius: 10px;
    background: var(--adm-surface);
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.adm-timeline-row:hover {
    border-color: color-mix(in srgb, var(--adm-brand) 25%, var(--adm-border));
    background: color-mix(in srgb, var(--adm-brand) 3%, var(--adm-surface));
}
.adm-timeline-row[data-tone="ok"]     { border-left-color: var(--adm-ok, var(--accent-bright)); }
.adm-timeline-row[data-tone="info"]   { border-left-color: var(--adm-info, var(--info-bright)); }
.adm-timeline-row[data-tone="warn"]   { border-left-color: var(--adm-warn, var(--gold-deep)); }
.adm-timeline-row[data-tone="danger"] { border-left-color: var(--adm-danger, var(--danger-bright)); }
.adm-timeline-date {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 13px;
    color: var(--adm-text);
}
.adm-timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    font-size: 12px;
}
.adm-timeline-score {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    justify-self: end;
}
.adm-timeline-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    font-size: 11.5px;
    color: var(--adm-text-soft);
}
.adm-timeline-counts strong { color: var(--adm-text); margin-right: 0.15rem; }
.adm-timeline-actions {
    display: flex;
    gap: 0.4rem;
    justify-self: end;
}

/* Big compliance-score number used in timeline + report cards. */
.adm-score {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    color: var(--adm-text);
    font-variant-numeric: tabular-nums;
}
.adm-score-unit {
    font-size: 13px;
    font-weight: 500;
    color: var(--adm-text-soft);
    margin-left: 0.1rem;
}
.adm-score[data-tone="ok"]     { color: var(--adm-ok, var(--accent)); }
.adm-score[data-tone="info"]   { color: var(--adm-info, var(--info)); }
.adm-score[data-tone="warn"]   { color: var(--adm-warn, var(--warning)); }
.adm-score[data-tone="danger"] { color: var(--adm-danger, var(--danger)); }

@media (max-width: 980px) {
    .adm-timeline-row {
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }
    .adm-timeline-score,
    .adm-timeline-actions { justify-self: start; }
}

/* ═══════════════════════════════════════════════════════════════
   Applications inbox v2 — tabs + row-style list + per-row actions
   ═══════════════════════════════════════════════════════════════ */

.apps-tabs {
    display: inline-flex;
    gap: 0;
    background: var(--adm-surface-2, var(--surface-2));
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 1rem;
}

.apps-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: var(--adm-text-soft, var(--text-tertiary));
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}

.apps-tab:hover { color: var(--adm-text, var(--text)); }

.apps-tab.is-active {
    background: var(--adm-surface);
    color: var(--adm-brand, var(--accent));
    box-shadow: 0 1px 2px rgba(var(--shadow-rgb),  0.06);
}

.apps-tab-count {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    background: rgba(var(--accent-rgb),  0.10);
    border-radius: 999px;
    color: var(--adm-brand, var(--accent));
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.apps-tab.is-active .apps-tab-count {
    background: var(--adm-brand, var(--accent));
    color: var(--white);
}

.apps-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.apps-search {
    flex: 1;
    max-width: 480px;
    padding: 0.55rem 0.85rem;
    background: var(--adm-surface);
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    color: var(--adm-text, var(--text));
}

.apps-search:focus {
    outline: 0;
    border-color: var(--adm-brand, var(--accent));
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb),  0.12);
}

.apps-toolbar-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--adm-text-soft, var(--text-tertiary));
    font-variant-numeric: tabular-nums;
}

/* ─── Row list ─────────────────────────────────────────── */

.apps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.apps-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: var(--adm-surface);
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.apps-row:hover {
    border-color: var(--adm-brand, var(--accent));
    box-shadow: 0 4px 12px -4px rgba(var(--accent-rgb),  0.10);
}

.apps-row-main {
    display: grid;
    grid-template-columns: 160px 1.8fr 1.8fr 1fr;
    gap: 1rem;
    align-items: center;
    flex: 1;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: inherit;
}

.apps-row-status .adm-pill { white-space: nowrap; }

.apps-row-listing {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.apps-row-ref {
    font-size: 11.5px;
    color: var(--adm-text-soft, var(--text-tertiary));
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.apps-row-title {
    font-size: 14px;
    color: var(--adm-text, var(--text));
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apps-row-applicant {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.apps-row-applicant strong {
    font-size: 13.5px;
    color: var(--adm-text, var(--text));
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apps-row-applicant strong.t-tertiary { color: var(--adm-text-soft, var(--text-tertiary)); font-weight: 500; font-style: italic; }

.apps-row-applicant span {
    font-size: 12px;
    color: var(--adm-text-soft, var(--text-tertiary));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apps-row-cotenant {
    display: inline-block;
    margin-top: 2px;
    padding: 1px 6px;
    background: rgba(var(--accent-rgb),  0.08);
    color: var(--adm-brand, var(--accent));
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    width: fit-content;
}

.apps-row-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-end;
    font-variant-numeric: tabular-nums;
}

.apps-row-fees {
    font-size: 14px;
    font-weight: 600;
    color: var(--adm-text, var(--text));
}

.apps-row-when {
    font-size: 11.5px;
    color: var(--adm-text-soft, var(--text-tertiary));
}

.apps-row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.85rem;
    border-left: 1px solid var(--adm-border-subtle, rgba(var(--glass-rgb),  0.6));
}

.apps-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.7rem;
    background: transparent;
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 7px;
    color: var(--adm-text-soft, var(--text-tertiary));
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.apps-action:hover {
    background: var(--surface-2);
    color: var(--adm-text, var(--text));
    border-color: var(--adm-border-strong, var(--border-strong));
}

.apps-action svg { width: 14px; height: 14px; flex-shrink: 0; }

.apps-action-open:hover {
    color: var(--adm-brand, var(--accent));
    border-color: var(--adm-brand, var(--accent));
    background: rgba(var(--accent-rgb),  0.06);
}

.apps-action-warn:hover {
    color: var(--warning);
    border-color: var(--warning);
    background: rgba(var(--warning-rgb),  0.06);
}

.apps-action-danger:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(var(--danger-rgb),  0.06);
}

.apps-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* "→ Lease" cross-link action — appears on rows whose application
   has been converted/linked to a lease. Brand-green styling so it
   reads as a positive forward-step, not a warning. */
.apps-action-link {
    color: var(--adm-brand, var(--accent));
}

.apps-action-link:hover {
    color: var(--adm-brand-deep, var(--accent-active));
    border-color: var(--adm-brand, var(--accent));
    background: rgba(var(--accent-rgb),  0.08);
}

/* Waiting-time pill next to the status pill — tone driven by the
   pill's data-tone so it just inherits the existing pill colours.
   Smaller + monospace digits so the time reads at a glance. */
.apps-row-waiting {
    margin-left: 0.4rem;
    font-feature-settings: "tnum" 1;
    font-size: 11px;
    padding: 0.15rem 0.45rem;
}

@media (max-width: 900px) {
    .apps-row { flex-direction: column; }
    .apps-row-main { grid-template-columns: 1fr; gap: 0.6rem; }
    .apps-row-status { order: -1; }
    .apps-row-meta { align-items: flex-start; flex-direction: row; gap: 0.85rem; }
    .apps-row-actions {
        border-left: 0;
        border-top: 1px solid var(--adm-border-subtle, rgba(var(--glass-rgb),  0.6));
        padding: 0.5rem 1rem;
        justify-content: flex-end;
    }
    .apps-tab-label { font-size: 12.5px; }
}

/* ─────────────────────────────────────────────────────────────
   Payments tab on /portal/leases/{id}?tab=payments. Pro-grade
   layout: big balance hero, three intent-cards (issue / receive /
   adjust) side-by-side, and a ledger table with running balance.
   All colours pull from the existing admin-theme tokens.
   ───────────────────────────────────────────────────────────── */

/* Big balance hero. data-tone drives the accent stripe + colour
   of the number — "settled" stays neutral so a paid lease doesn't
   shout for attention, "danger" goes forest-rust for arrears,
   "credit" stays brand-green. */
.adm-pay-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 1.5rem;
    background: var(--adm-surface);
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 14px;
    padding: 1.4rem 1.5rem;
    box-shadow: 0 1px 2px rgba(var(--shadow-rgb),  0.04),
                0 8px 24px -16px rgba(var(--shadow-rgb),  0.10);
    position: relative;
    overflow: hidden;
}

.adm-pay-hero::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--adm-brand, var(--accent));
}

.adm-pay-hero[data-tone="danger"]::before  { background: var(--adm-danger, var(--danger)); }
.adm-pay-hero[data-tone="settled"]::before { background: var(--text-tertiary); }

.adm-pay-hero-main { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }

.adm-pay-hero-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--adm-text-3, var(--text-tertiary));
}

.adm-pay-hero-amount { display: flex; align-items: baseline; gap: 0.65rem; flex-wrap: wrap; }

.adm-pay-hero-num {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--adm-text, var(--text));
    line-height: 1;
}

.adm-pay-hero[data-tone="danger"]  .adm-pay-hero-num { color: var(--adm-danger, var(--danger)); }
.adm-pay-hero[data-tone="credit"]  .adm-pay-hero-num { color: var(--adm-brand, var(--accent)); }
.adm-pay-hero[data-tone="settled"] .adm-pay-hero-num { color: var(--adm-text, var(--text)); }

.adm-pay-hero-sub {
    font-size: 14px;
    color: var(--adm-text-2, var(--text-secondary));
    font-weight: 500;
}

.adm-pay-hero-next {
    margin: 0.4rem 0 0;
    font-size: 13.5px;
    color: var(--adm-text-2, var(--text-secondary));
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.adm-pay-hero-next strong { color: var(--adm-text, var(--text)); }

.adm-pay-hero-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.adm-pay-hero-pill[data-tone="warn"] {
    color: var(--warning-deep);
    background: var(--warning-subtle);
    border: 1px solid var(--warning-border);
}

.adm-pay-hero-pill[data-tone="info"] {
    color: var(--info);
    background: var(--info-subtle);
    border: 1px solid var(--info-subtle);
}

/* Stats column on the right of the hero. */
.adm-pay-hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.85rem;
    align-content: center;
}

.adm-pay-hero-stat {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.6rem 0.75rem;
    background: var(--adm-surface-2, var(--surface-2));
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 9px;
}

.adm-pay-hero-stat-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--adm-text-3, var(--text-tertiary));
}

.adm-pay-hero-stat-val {
    font-size: 17px;
    font-weight: 700;
    color: var(--adm-text, var(--text));
    line-height: 1.2;
    margin-top: 0.1rem;
}

.adm-pay-hero-stat-sub {
    font-size: 11.5px;
    color: var(--adm-text-3, var(--text-tertiary));
}

@media (max-width: 880px) {
    .adm-pay-hero { grid-template-columns: 1fr; }
    .adm-pay-hero-stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 540px) {
    .adm-pay-hero-num { font-size: 30px; }
    .adm-pay-hero-stats { grid-template-columns: 1fr; }
}

/* Three intent-cards in a row — Issue / Record / Adjust. They
   compress to one column on tablet and below. */
.adm-pay-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 1180px) {
    .adm-pay-actions { grid-template-columns: 1fr; }
}

.adm-pay-card {
    display: flex;
    flex-direction: column;
    background: var(--adm-surface);
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 140ms ease, box-shadow 140ms ease;
    box-shadow: 0 1px 2px rgba(var(--shadow-rgb),  0.03);
}

.adm-pay-card:hover {
    border-color: var(--adm-border-2, var(--border-strong));
    box-shadow: 0 1px 2px rgba(var(--shadow-rgb),  0.04),
                0 8px 24px -16px rgba(var(--shadow-rgb),  0.12);
}

.adm-pay-card-head {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 1.05rem 1.1rem 0.9rem;
    border-bottom: 1px solid var(--adm-border, var(--border));
    background: linear-gradient(180deg, rgba(var(--accent-rgb),  0.025) 0%, rgba(var(--accent-rgb),  0) 100%);
}

.adm-pay-card-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: rgba(var(--accent-rgb),  0.08);
    color: var(--adm-brand, var(--accent));
}

.adm-pay-card[data-kind="payment"] .adm-pay-card-icon {
    background: rgba(var(--accent-rgb),  0.10);
    color: var(--adm-brand, var(--accent));
}
.adm-pay-card[data-kind="issue"] .adm-pay-card-icon {
    background: rgba(var(--gold-rgb),  0.10);
    color: var(--warning-deep);
}
.adm-pay-card[data-kind="adjust"] .adm-pay-card-icon {
    background: rgba(var(--tone-purple-rgb),  0.08);
    color: var(--tone-purple);
}

.adm-pay-card-icon svg { width: 18px; height: 18px; }

.adm-pay-card-titles { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }

.adm-pay-card-eyebrow {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--adm-text-3, var(--text-tertiary));
}

.adm-pay-card-titles h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--adm-text, var(--text));
    line-height: 1.25;
    letter-spacing: -0.005em;
}

.adm-pay-card-titles p {
    margin: 0.2rem 0 0;
    font-size: 12.5px;
    color: var(--adm-text-2, var(--text-secondary));
    line-height: 1.45;
}

.adm-pay-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1rem 1.1rem 0.6rem;
    flex: 1 1 auto;
}

.adm-pay-card-label {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--adm-text-3, var(--text-tertiary));
    margin-top: 0.3rem;
}

.adm-pay-card-label:first-child { margin-top: 0; }

.adm-pay-card-input,
.adm-pay-card-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--adm-border-2, var(--border-strong));
    border-radius: 9px;
    background: var(--adm-surface);
    color: var(--adm-text, var(--text));
    font-family: inherit;
    font-size: 14px;
    line-height: 1.3;
    transition: border-color 120ms ease, box-shadow 140ms ease;
}

.adm-pay-card-input:focus,
.adm-pay-card-select:focus {
    outline: 0;
    border-color: var(--adm-brand, var(--accent));
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb),  0.15);
}

.adm-pay-card-input::placeholder { color: var(--adm-text-3, var(--text-tertiary)); }

.adm-pay-card-summary {
    margin-top: 0.6rem;
    padding: 0.65rem 0.8rem;
    background: var(--adm-surface-2, var(--surface-2));
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 9px;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.adm-pay-card-amount {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--adm-text, var(--text));
    line-height: 1.15;
}

.adm-pay-card-amount-sub {
    font-size: 12px;
    color: var(--adm-text-2, var(--text-secondary));
}

/* Line-item preview on the Issue card. One row per InvoiceTemplate
   (or the legacy "Monthly rent" fallback) + a bold "Total to post"
   row underneath. Mirrors a small invoice receipt so the agent
   sees exactly what's about to land before they click. */
.adm-pay-card-lines {
    margin-top: 0.6rem;
    padding: 0.55rem 0.8rem;
    background: var(--adm-surface-2, var(--surface-2));
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 9px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.adm-pay-card-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.85rem;
    font-size: 13px;
    color: var(--adm-text, var(--text));
    line-height: 1.4;
}

.adm-pay-card-line-label {
    color: var(--adm-text-2, var(--text-secondary));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.adm-pay-card-line-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    flex-shrink: 0;
    color: var(--adm-text, var(--text));
}

.adm-pay-card-line-total {
    margin-top: 0.3rem;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--adm-border-2, var(--border-strong));
}

.adm-pay-card-line-total .adm-pay-card-line-label,
.adm-pay-card-line-total .adm-pay-card-line-amount {
    font-weight: 700;
    color: var(--adm-text, var(--text));
    font-size: 14px;
}

.adm-pay-card-hint {
    margin: 0.35rem 0 0;
    font-size: 12px;
    color: var(--warning-deep);
    background: var(--warning-subtle);
    border: 1px solid var(--warning-border);
    border-radius: 7px;
    padding: 0.4rem 0.6rem;
    line-height: 1.4;
}

.adm-pay-card-foot-meta a {
    color: var(--adm-brand, var(--accent));
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
}
.adm-pay-card-foot-meta a:hover { text-decoration: none; border-bottom-style: solid; }

.adm-pay-card-empty {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.adm-pay-card-empty p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--adm-text-2, var(--text-secondary));
    text-align: center;
}

.adm-pay-card-foot {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.9rem 1.1rem 1.05rem;
    border-top: 1px solid var(--adm-border, var(--border));
    background: var(--adm-surface-2, var(--surface-2));
}

.adm-pay-card-foot .adm-btn { width: 100%; justify-content: center; }

.adm-pay-card-foot-meta {
    font-size: 11.5px;
    color: var(--adm-text-3, var(--text-tertiary));
    line-height: 1.4;
}

/* Charge vs Credit toggle inside the Adjustment card. */
.adm-pay-card-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    background: var(--adm-surface-2, var(--surface-2));
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 9px;
    padding: 0.3rem;
}

.adm-pay-card-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.6rem;
    border-radius: 7px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--adm-text-2, var(--text-secondary));
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.adm-pay-card-toggle-btn svg { width: 14px; height: 14px; }
.adm-pay-card-toggle-btn:hover { color: var(--adm-text, var(--text)); }

.adm-pay-card-toggle-btn.is-active.is-charge {
    background: var(--warning-subtle);
    color: var(--warning-deep);
    border-color: var(--warning-border);
}

.adm-pay-card-toggle-btn.is-active.is-credit {
    background: rgba(var(--accent-rgb),  0.10);
    color: var(--adm-brand, var(--accent));
    border-color: rgba(var(--accent-rgb),  0.25);
}

/* "End lease" — destructive, hidden behind a collapsed details. */
.adm-pay-end {
    margin-top: 1.5rem;
    background: var(--adm-surface);
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 14px;
    overflow: hidden;
}

.adm-pay-end > summary {
    cursor: pointer;
    padding: 1rem 1.2rem;
    list-style: none;
    transition: background 120ms ease;
}

.adm-pay-end > summary::-webkit-details-marker { display: none; }
.adm-pay-end > summary:hover { background: var(--adm-surface-2, var(--surface-2)); }

.adm-pay-end-summary {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.adm-pay-end-summary svg { width: 18px; height: 18px; color: var(--adm-danger, var(--danger)); }
.adm-pay-end-summary strong { color: var(--adm-text, var(--text)); font-size: 14px; }
.adm-pay-end-summary span:last-child {
    color: var(--adm-text-3, var(--text-tertiary));
    font-size: 12.5px;
    margin-left: 0.5rem;
}

.adm-pay-end-body {
    padding: 0 1.2rem 1.2rem;
    border-top: 1px solid var(--adm-border, var(--border));
}

.adm-pay-end-hint {
    margin: 0.9rem 0 0.9rem;
    font-size: 13px;
    color: var(--adm-text-2, var(--text-secondary));
    line-height: 1.5;
}

/* ─── Ledger table ──────────────────────────────────────────
   Two-column charge/credit layout (think bank-statement) with a
   running-balance column on the right. Per-row pill keys off the
   ledger-entry kind so the agent can spot rent vs payment vs
   deposit at a glance. */

.adm-ledger-panel { padding-top: 1.25rem; padding-bottom: 1.25rem; }

.adm-ledger-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 10px;
}

.adm-ledger {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.adm-ledger thead {
    background: var(--adm-surface-2, var(--surface-2));
}

.adm-ledger th {
    text-align: left;
    padding: 0.55rem 0.85rem;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--adm-text-3, var(--text-tertiary));
    border-bottom: 1px solid var(--adm-border, var(--border));
}

.adm-ledger th.adm-ledger-when    { width: 130px; }
.adm-ledger th.adm-ledger-charge,
.adm-ledger th.adm-ledger-credit,
.adm-ledger th.adm-ledger-balance {
    text-align: right;
    width: 140px;
}

.adm-ledger td {
    padding: 0.65rem 0.85rem;
    vertical-align: top;
    border-bottom: 1px solid var(--adm-border, var(--border));
}

.adm-ledger tr:last-child td { border-bottom: 0; }

.adm-ledger-when {
    color: var(--adm-text-2, var(--text-secondary));
    font-variant-numeric: tabular-nums;
}

.adm-ledger td.adm-ledger-when { display: flex; flex-direction: column; gap: 0.05rem; }

.adm-ledger-date { font-weight: 600; color: var(--adm-text, var(--text)); font-size: 13px; }
.adm-ledger-time { font-size: 11.5px; color: var(--adm-text-3, var(--text-tertiary)); }

.adm-ledger-entry {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.adm-ledger-desc { color: var(--adm-text, var(--text)); }

.adm-ledger-period {
    display: block;
    margin-top: 0.2rem;
    font-size: 11.5px;
    color: var(--adm-text-3, var(--text-tertiary));
    letter-spacing: 0.02em;
}

.adm-ledger-kind-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
    flex-shrink: 0;
}

.adm-ledger-kind-pill[data-kind="rent"] {
    color: var(--warning-deep); background: var(--warning-subtle); border-color: var(--warning-border);
}
.adm-ledger-kind-pill[data-kind="payment"] {
    color: var(--adm-brand, var(--accent)); background: rgba(var(--accent-rgb),  0.10); border-color: rgba(var(--accent-rgb),  0.22);
}
.adm-ledger-kind-pill[data-kind="deposit"] {
    color: var(--info); background: var(--info-subtle); border-color: var(--info-subtle);
}
.adm-ledger-kind-pill[data-kind="deposit-refund"] {
    color: var(--tone-purple); background: var(--accent-subtle); border-color: var(--accent-subtle);
}
.adm-ledger-kind-pill[data-kind="late-fee"] {
    color: var(--danger-strong); background: var(--danger-subtle); border-color: var(--danger-subtle);
}
.adm-ledger-kind-pill[data-kind="utilities"] {
    color: var(--accent); background: var(--accent-subtle); border-color: var(--accent-active);
}
.adm-ledger-kind-pill[data-kind="levy"] {
    color: var(--tone-indigo); background: var(--info-subtle); border-color: var(--info-subtle);
}
.adm-ledger-kind-pill[data-kind="adjustment"],
.adm-ledger-kind-pill[data-kind="other"] {
    color: var(--adm-text-2, var(--text-secondary)); background: var(--adm-surface-2, var(--surface-2)); border-color: var(--adm-border-2, var(--border-strong));
}

.adm-ledger-charge,
.adm-ledger-credit,
.adm-ledger-balance {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.adm-ledger-amount {
    font-weight: 700;
    font-size: 14px;
    color: var(--adm-text, var(--text));
}

.adm-ledger-amount-charge { color: var(--adm-danger, var(--danger)); }
.adm-ledger-amount-credit { color: var(--adm-brand, var(--accent)); }
.adm-ledger-amount.is-debt    { color: var(--adm-danger, var(--danger)); }
.adm-ledger-amount.is-credit  { color: var(--adm-brand, var(--accent)); }
.adm-ledger-amount.is-settled { color: var(--adm-text-2, var(--text-secondary)); }

.adm-ledger-foot {
    margin: 0.7rem 0 0;
    font-size: 11.5px;
    color: var(--adm-text-3, var(--text-tertiary));
}

/* Per-row actions for upcoming-period charges. Edit + Delete chips
   live in the trailing column; the row gets a subtle highlight so
   the agent sees which lines are still mutable. */
.adm-ledger th.adm-ledger-actions,
.adm-ledger td.adm-ledger-actions {
    width: 130px;
    text-align: right;
}

.adm-ledger-row[data-future="true"] {
    background: rgba(var(--accent-rgb),  0.025);
}

.adm-ledger-row[data-future="true"] td:first-child {
    box-shadow: inset 3px 0 0 var(--adm-brand, var(--accent));
}

.adm-ledger-upcoming {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.1rem 0.45rem;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--adm-brand, var(--accent));
    background: rgba(var(--accent-rgb),  0.12);
    border: 1px solid rgba(var(--accent-rgb),  0.25);
    border-radius: 999px;
}

.adm-ledger-row-actions {
    display: inline-flex;
    gap: 0.3rem;
    justify-content: flex-end;
}

.adm-ledger-row-action {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.5rem;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--adm-text-2, var(--text-secondary));
    background: var(--adm-surface);
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.adm-ledger-row-action svg { width: 12px; height: 12px; flex-shrink: 0; }

.adm-ledger-row-action:hover:not(:disabled) {
    background: rgba(var(--accent-rgb),  0.06);
    border-color: var(--adm-brand, var(--accent));
    color: var(--adm-brand, var(--accent));
}

.adm-ledger-row-action.is-danger:hover:not(:disabled) {
    background: var(--danger-subtle);
    border-color: var(--danger-border);
    color: var(--danger);
}

.adm-ledger-row-action:disabled { opacity: 0.5; cursor: not-allowed; }

/* Small modal variant for the edit-line dialog. */
.adm-modal.adm-modal-sm { max-width: 480px; }

.adm-modal-eyebrow {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--adm-text-3, var(--text-tertiary));
    margin-bottom: 0.2rem;
}

.adm-modal-hint {
    margin: 0 0 0.85rem;
    padding: 0.6rem 0.75rem;
    background: var(--adm-surface-2, var(--surface-2));
    border: 1px solid var(--adm-border, var(--border));
    border-radius: 8px;
    font-size: 12.5px;
    color: var(--adm-text-2, var(--text-secondary));
    line-height: 1.45;
}

.adm-modal-hint a { color: var(--adm-brand, var(--accent)); font-weight: 600; }

@media (max-width: 720px) {
    .adm-ledger th.adm-ledger-when    { width: auto; min-width: 90px; }
    .adm-ledger th.adm-ledger-charge,
    .adm-ledger th.adm-ledger-credit,
    .adm-ledger th.adm-ledger-balance { width: auto; min-width: 90px; }
    .adm-ledger td { padding: 0.55rem 0.6rem; }
    .adm-ledger { font-size: 12.5px; }
}

/* ════════════════════════════════════════════════════════════════
   PWA install prompt — polished, branded floating card.
   (The portal's wwwroot/app.css is NOT linked, so install styling
   lives here in a loaded stylesheet. Replaces the old unstyled
   topbar banner.) Slides up bottom-centre on `beforeinstallprompt`.
   ════════════════════════════════════════════════════════════════ */
.pwa-install-card {
    position: fixed;
    z-index: var(--z-toast, 400);
    left: 50%;
    bottom: clamp(16px, 4vw, 28px);
    transform: translateX(-50%);
    width: min(440px, calc(100vw - 2 * var(--space-4)));
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    animation: pwa-slide-up var(--duration-base) var(--ease-out);
}
@keyframes pwa-slide-up {
    from { opacity: 0; transform: translate(-50%, 16px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
.pwa-install-card-icon {
    flex: none;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent), var(--accent-active));
    color: var(--white);
    --asetrix-brand: var(--white);
    box-shadow: var(--shadow-sm);
}
.pwa-install-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pwa-install-card-title {
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-tight);
    color: var(--text);
}
.pwa-install-card-sub {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    line-height: var(--leading-snug);
}
.pwa-install-card .btn { flex: none; }
.pwa-install-card-close {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-smooth), color var(--duration-fast) var(--ease-smooth);
}
.pwa-install-card-close:hover { background: var(--surface-hover); color: var(--text); }
.pwa-install-card-close svg { width: 16px; height: 16px; }
@media (max-width: 520px) {
    .pwa-install-card { flex-wrap: wrap; }
    .pwa-install-card-body { flex-basis: calc(100% - 44px - var(--space-3)); }
    .pwa-install-card .btn { flex: 1; }
    .pwa-install-card-close { position: absolute; top: 8px; right: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .pwa-install-card { animation: none; }
}

/* ─── Brand-cohesive page titles ─────────────────────────────────
   Fraunces display serif on the page-level headings only (topbar page
   title + in-page h1), matching the marketplace. Body, data, forms,
   cards + buttons stay Inter. */
:root { --font-display: 'Fraunces', Georgia, 'Times New Roman', serif; }
.portal-page-title-auto,
.portal-main .t-h1 {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-weight: 540;
    letter-spacing: -0.015em;
}
.portal-page-title-auto { font-weight: 560; }

/* Badge must stay compact even as a flex-column child (it was being
   blockified + stretched full width — the green eyebrow pill spanned
   the page). Mirrors the shared _primitives.css fix here too, because
   the Shared stylesheet is unfingerprinted and can serve stale from
   cache; admin.css is fingerprinted, so this lands immediately. */
.badge { width: fit-content; max-width: 100%; align-self: flex-start; }

/* ════════════════════════════════════════════════════════════════
   DASHBOARD — premium, card-based agency overview.
   Bento layout: hero → metric cards → getting-started → My Day +
   Activity. Icon medallions, tinted by category; quiet brand accents.
   ════════════════════════════════════════════════════════════════ */
.dash {
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 2.4vw, 32px);
}

/* ── Hero ─────────────────────────────────────────────────────── */
.dash-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-6);
    flex-wrap: wrap;
}
.dash-hero-text { display: flex; flex-direction: column; gap: var(--space-2); max-width: 60ch; }
.dash-hero-text h1 { margin: 0; }
.dash-hero-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ── Metric card grid ─────────────────────────────────────────── */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}
@media (min-width: 760px)  { .dash-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .dash-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.dash-stat {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-xs);
    transition: transform var(--duration-base) var(--ease-smooth),
                box-shadow var(--duration-base) var(--ease-smooth),
                border-color var(--duration-base) var(--ease-smooth);
}
a.dash-stat:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border);
}
.dash-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-lg);
    display: grid;
    place-items: center;
    background: var(--accent-subtle);
    color: var(--accent-text);
}
.dash-stat-icon .portal-icon { width: 21px; height: 21px; }
.dash-stat-value {
    font-size: clamp(1.8rem, 2.8vw, 2.3rem);
    font-weight: var(--weight-bold);
    line-height: 1;
    letter-spacing: var(--tracking-tighter);
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.dash-stat-value.is-money { font-size: clamp(1.4rem, 2.2vw, 1.8rem); }
.dash-stat-label {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--text);
    margin-top: -2px;
}
.dash-stat-sub {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    line-height: var(--leading-snug);
}
.dash-stat-arrow {
    position: absolute;
    top: var(--space-5);
    right: var(--space-5);
    color: var(--text-tertiary);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity var(--duration-fast) var(--ease-smooth), transform var(--duration-fast) var(--ease-smooth);
}
a.dash-stat:hover .dash-stat-arrow { opacity: 1; transform: translateX(0); }
.dash-stat-arrow svg { width: 18px; height: 18px; }

/* Category tints for the medallions. */
.dash-i-green  { background: var(--accent-subtle); color: var(--accent-text); }
.dash-i-blue   { background: var(--info-subtle);   color: var(--info); }
.dash-i-violet { background: rgba(var(--tone-purple-rgb),  0.12); color: var(--tone-purple); }
.dash-i-amber  { background: var(--warning-subtle); color: var(--warning); }
.dash-i-red    { background: var(--danger-subtle);  color: var(--danger); }
.dash-i-slate  { background: var(--surface-hover);  color: var(--text-secondary); }
.dash-stat-value.is-alert { color: var(--danger); }

/* ── Getting-started card (progress ring + step grid) ─────────── */
.dash-onboarding {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    padding: clamp(20px, 2.4vw, 28px);
    background:
        radial-gradient(120% 140% at 100% 0%, var(--accent-subtle) 0%, transparent 55%),
        var(--surface);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
}
.dash-onboarding-head { display: flex; align-items: center; gap: var(--space-4); }
.dash-ring {
    position: relative;
    width: 76px;
    height: 76px;
    flex: none;
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--pct, 0) * 1%), var(--accent-border) 0);
}
.dash-ring::before {
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    background: var(--surface);
}
.dash-ring-num {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    height: 100%;
    font-weight: var(--weight-bold);
    font-size: var(--text-md);
    font-variant-numeric: tabular-nums;
    color: var(--accent-text);
}
.dash-onboarding-titles { display: flex; flex-direction: column; gap: 2px; }
.dash-onboarding-titles h2 { margin: 0; font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.dash-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
}
@media (min-width: 900px) { .dash-steps { grid-template-columns: 1fr 1fr; } }
.dash-step {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}
.dash-step-mark {
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 2px solid var(--border-strong);
    color: transparent;
}
.dash-step-mark svg { width: 13px; height: 13px; }
.dash-step.is-done .dash-step-mark { background: var(--accent); border-color: var(--accent); color: var(--white); }
.dash-step-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dash-step-text strong { font-size: var(--text-sm); color: var(--text); }
.dash-step-text span { font-size: var(--text-xs); color: var(--text-secondary); line-height: var(--leading-snug); }
.dash-step.is-done .dash-step-text strong { color: var(--text-secondary); }
.dash-step .btn { flex: none; }

/* ── Two-column panels (My Day + Activity) ────────────────────── */
.dash-cols {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    align-items: start;
}
@media (min-width: 1000px) { .dash-cols { grid-template-columns: 1fr 1fr; } }
.dash-panel {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    box-shadow: var(--shadow-xs);
}
.dash-panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.dash-panel-head h2 { margin: 0; font-size: var(--text-md); font-weight: var(--weight-semibold); display: flex; align-items: center; gap: var(--space-2); }
.dash-panel-head a { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--accent-text); text-decoration: none; }
.dash-panel-head a:hover { text-decoration: underline; }

.dash-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dash-list > li {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-top: 1px solid var(--border-subtle);
}
.dash-list > li:first-child { border-top: none; padding-top: 0; }
.dash-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dash-row-main strong { font-size: var(--text-sm); color: var(--text); }
.dash-row-main a, .dash-row-main span { font-size: var(--text-xs); color: var(--text-secondary); text-decoration: none; }
.dash-row-meta { flex: none; font-size: var(--text-xs); color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.dash-row-meta.is-overdue { color: var(--danger); font-weight: var(--weight-semibold); }
.dash-activity-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    margin: 0 var(--space-1);
}

/* Empty state inside a panel. */
.dash-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--text-secondary);
}
.dash-empty-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-full);
    display: grid; place-items: center;
    background: var(--surface-hover);
    color: var(--text-tertiary);
}
.dash-empty-icon .portal-icon { width: 24px; height: 24px; }
.dash-empty p { margin: 0; max-width: 38ch; font-size: var(--text-sm); }
