/* ==========================================================================
   Studio Design System — Tokens + Component Primitives
   Loaded before dashboard.css so it can reference these vars.
   ========================================================================== */

:root {
    /* Progress-bar fills — one source of truth for every meter bar across
       admin + portal. Horizontal gradients (blue→periwinkle healthy,
       amber→gold warn, red→coral at/near max). */
    --cc-bar-gradient:        linear-gradient(90deg, #1264FF, #818cf8);
    --cc-bar-gradient-warn:   linear-gradient(90deg, #f59e0b, #fbbf24);
    --cc-bar-gradient-danger: linear-gradient(90deg, #ef4444, #f87171);

    /* Muted zero — lighter than text-tertiary for de-emphasized integer 0 metrics */
    --color-muted-zero: #bbbbbb;

    /* Warning banner — trial alerts, expiration notices */
    --color-warning-bg: #fffbeb;
    --color-warning-border: #fde68a;
    --color-warning-text: #92400e;

    /* Spacing scale (4px baseline) */
    --space-0: 0;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Typography scale
     *
     * --text-base is the size of a VALUE: a name, an amount, a status, an
     * answer — anything the reader came to the page to read. It was 13px, and
     * because the token is named "base" it became the app's default: since
     * April roughly two thirds of every font-size added to this repo has been
     * 13px, and each screen rebuilt at 13px made more of the app small. Nothing
     * ever shrank; the default was just a size too low.
     *
     * --text-label is for the words ABOUT the value: field labels, eyebrows,
     * column headers, timestamps, helper text. 13px is right for those, so it
     * keeps the old number under a name that says what it's for.
     *
     * The rule, when you're picking one: if the user is reading it for the
     * information, it's base or larger. If it's telling them what they're
     * looking at, it's label or smaller.
     */
    --text-xs: 11px;
    --text-sm: 12px;
    --text-label: 13px;
    --text-base: 14px;
    /* Kept at its own name for the call sites that already ask for 14
     * explicitly. Same value as base now — reach for base in new code. */
    --text-md: 14px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-2xl: 22px;
    --text-3xl: 28px;
    --text-4xl: 34px;

    /* Dark mode override handled further down where other dark vars live */

    --leading-tight: 1.2;
    --leading-snug: 1.35;
    --leading-normal: 1.5;
    --leading-loose: 1.7;

    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* Z-index scale */
    --z-dropdown: 100;
    --z-sticky: 500;
    --z-modal-backdrop: 9000;
    --z-modal: 9500;
    --z-toast: 9999;
    --z-tooltip: 10000;
}

/* ==========================================================================
   Metrics grid — always fills container width, auto-fits columns to child count
   Each card maintains a min width of ~180px; 2/3/4/5/6 cards fill row proportionally.
   ========================================================================== */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

/* Metric card icons — dark-mode tints so icons don't sit on a white chip in dark mode */
[data-theme="dark"] {
    --color-muted-zero: #4b5563;
    --color-warning-bg: rgba(251, 191, 36, 0.1);
    --color-warning-border: rgba(251, 191, 36, 0.25);
    --color-warning-text: #fbbf24;
}

[data-theme="dark"] .metric-card__icon--primary { background: rgba(20, 95, 255, 0.16); color: #93c5fd; }
[data-theme="dark"] .metric-card__icon--success { background: rgba(28, 198, 109, 0.16); color: #6ee7b7; }
[data-theme="dark"] .metric-card__icon--warning { background: rgba(255, 182, 0, 0.16); color: #fcd34d; }
[data-theme="dark"] .metric-card__icon--danger  { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }

/* ==========================================================================
   Select (form-input variant) — native chevron is missing when appearance
   is stripped. Inject a chevron SVG so all `<select class="form-input">`
   have a visible dropdown indicator.
   ========================================================================== */

select.form-input,
select.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    background-size: 14px;
    padding-right: 36px !important;
}

[data-theme="dark"] select.form-input,
[data-theme="dark"] select.form-select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}

/* ==========================================================================
   Detail rows (sidebar + main cards: Contact Info, Member Details, Contact
   Details, Giving, etc.). Uses CSS grid on the parent .card__body so:
   - All labels align to the same column width (longest label)
   - 30px gap between label column and value column
   - Values left-align, truncate with ellipsis on overflow
   - Borders between rows preserved
   ========================================================================== */

.card__body:has(> .detail-row) {
    display: grid;
    grid-template-columns: max-content 1fr;
}

.card__body:has(> .detail-row) > .detail-row {
    display: contents;
}

.card__body:has(> .detail-row) > .detail-row > .detail-row__label {
    width: auto !important;
    max-width: none !important;
    padding: var(--space-3) 30px var(--space-3) 0;
    border-bottom: 1px solid var(--color-border-light);
    text-align: left;
    white-space: nowrap;
    font-weight: var(--weight-semibold);
    color: var(--color-text);
}

.card__body:has(> .detail-row) > .detail-row > .detail-row__value {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border-light);
}

.card__body:has(> .detail-row) > .detail-row:last-child > .detail-row__label,
.card__body:has(> .detail-row) > .detail-row:last-child > .detail-row__value {
    border-bottom: none;
}

.card__body:has(> .detail-row) > .detail-row > .detail-row__value {
    min-width: 0;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card__body:has(> .detail-row) > .detail-row > .detail-row__value > a,
.card__body:has(> .detail-row) > .detail-row > .detail-row__value > span {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.detail-row__value--wrap {
    white-space: normal !important;
    text-overflow: unset !important;
    text-align: left !important;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.detail-row__value--wrap > a,
.detail-row__value--wrap > span {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
}

.detail-row__value a {
    color: var(--color-primary);
    text-decoration: none;
}
.detail-row__value a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   User chip — avatar + short name (e.g. "Jessica W.") for meta/attribution rows
   ========================================================================== */

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.user-chip__name {
    font-weight: var(--weight-medium);
    color: var(--color-text-secondary);
}

.user-chip__sep {
    color: var(--color-border);
}

.user-chip__time {
    color: var(--color-text-tertiary);
}

/* ==========================================================================
   Card header — consistent min-height so title-only and title+actions rows
   line up vertically across all detail-section cards. Buttons inside get
   auto-compact sizing so they don't stretch the header height.
   ========================================================================== */

.card__header {
    min-height: 60px;
    height: 60px;
    box-sizing: border-box;
}

.card__header .btn,
.card__header .btn--sm {
    padding: 4px 10px;
    font-size: var(--text-sm);
    height: 28px;
    min-height: 28px;
    line-height: 1;
}

.card__header .btn--ghost {
    padding: 4px 8px;
}

/* ==========================================================================
   Money column — right-aligned, tabular numerals so digits line up on the
   decimal across rows. Use on <td> or cells showing currency amounts.
   ========================================================================== */

.money {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    white-space: nowrap;
    font-weight: var(--weight-semibold);
}

.money--positive { color: var(--color-success); }
.money--negative { color: var(--color-danger); }
.money--muted    { color: var(--color-text-secondary); font-weight: var(--weight-normal); }

/* Apply to table headers too so "Amount" aligns with cell contents.
   Specificity must beat `.data-table th { text-align: left }`. */
.data-table th.money,
th.money {
    text-align: right;
    padding-right: var(--space-5);
}

/* Match the header's right padding on the value cells so each money column's
   header and figures share one right edge. th.money adds space-5 but the
   default td padding-right is 0, which left every money column misaligned. */
.data-table td.money,
td.money {
    padding-right: var(--space-5);
}

/* On a sortable money column the arrow goes to the LEFT of the label, so the
   label keeps the same right edge as the figures under it. Sitting after the
   label it pushed "Price" 16px off that edge — and it does so at rest too,
   because an idle arrow is only transparent, it still takes its space. */
.data-table th.money .th-sort__arrow {
    order: -1;
}

/* ==========================================================================
   Page header + Detail header — center-align the actions block vertically
   so buttons sit in the middle of the title + subtitle stack.
   ========================================================================== */

.page-header__actions,
.detail-header__actions {
    align-self: center;
}

/* ==========================================================================
   Toolbar — in-card variant: adds bottom border to separate from table below
   ========================================================================== */

.toolbar.toolbar--in-card {
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--color-border-light);
    margin: 0;
    justify-content: flex-start;
}

.toolbar.toolbar--in-card .toolbar__search {
    flex: 0 0 auto;
}

.toolbar.toolbar--in-card .filter-select {
    flex: 0 0 auto;
}

/* Search width variants — pick one per toolbar based on the context */
.toolbar__search--short { width: 240px; }
.toolbar__search--mid   { width: 340px; }
.toolbar__search--long  { width: 480px; }

/* When a width modifier is set on the wrapper, the input fills it so the
   absolutely-positioned clear (X) button sits inside the input's right edge,
   not in the gap between input and wrapper. */
.toolbar__search--short .toolbar__search-input,
.toolbar__search--mid   .toolbar__search-input,
.toolbar__search--long  .toolbar__search-input,
.toolbar.toolbar--in-card .toolbar__search-input {
    width: 100%;
}

.toolbar--in-card .filter-select {
    flex: 0 0 auto;
}

/* One control height for the whole toolbar row.
   The search input and the filter selects size themselves off 13px text with
   8px padding; .btn sizes itself off 14px text with 9px padding, so a Filter
   or Map button next to a search box rendered several pixels taller than it.
   Pinning the height (border-box) puts every control on the same top and
   bottom edge. .btn--sm is left alone — a toolbar that deliberately asks for
   a small button still gets one. */
.toolbar__search-input,
.toolbar .filter-select,
.toolbar .btn:not(.btn--sm) {
    height: 36px;
}

.toolbar .btn:not(.btn--sm) {
    /* .btn carries min-height: calc(1.4em + 20px) so icon and text buttons
       agree on a height. That floor (38px) outranks the height above, so it
       has to be released here or the buttons stay taller than the inputs. */
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    font-size: 13px;
}

/* ==========================================================================
   Tabs — shared primitive (no page-specific prefix needed)
   ========================================================================== */

.tabs {
    display: inline-flex;
    gap: var(--space-1);
    border-bottom: 0;
}

.tab {
    padding: var(--space-2) var(--space-4);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-secondary);
    font-family: inherit;
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

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

.tab--active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

[data-theme="dark"] .tab--active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

.tab__count {
    font-size: var(--text-sm);
    font-weight: var(--weight-normal);
    color: var(--color-text-tertiary);
    margin-left: var(--space-1);
}

/* ==========================================================================
   Bulk action bar — standardized across pages
   ========================================================================== */

.bulk-bar {
    padding: var(--space-2) var(--space-5);
    background: var(--color-primary-bg);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

[data-theme="dark"] .bulk-bar {
    background: rgba(18, 100, 255, 0.12);
    border-color: rgba(18, 100, 255, 0.25);
}

.bulk-bar__count {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--color-primary);
}

[data-theme="dark"] .bulk-bar__count {
    color: #60a5fa;
}

.bulk-bar__btn {
    padding: var(--space-1) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text-secondary);
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.bulk-bar__btn--activate { color: var(--color-success); }
.bulk-bar__btn--delete { color: var(--color-danger); border-color: var(--color-danger-light); }
[data-theme="dark"] .bulk-bar__btn--delete { border-color: rgba(239, 68, 68, 0.4); }

.bulk-bar__clear {
    margin-left: auto;
    padding: var(--space-1) var(--space-3);
    background: transparent;
    border: none;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text-secondary);
    cursor: pointer;
    font-family: inherit;
}

/* ==========================================================================
   Row list — generic alternative to <table> for notes/activities/feeds
   ========================================================================== */

.row-list {
    display: flex;
    flex-direction: column;
}

.row-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border-light);
}

.row-item:last-child {
    border-bottom: none;
}

.row-item__checkbox {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 3px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.row-item__content {
    flex: 1;
    min-width: 0;
}

.row-item__header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.row-item__title {
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    font-size: var(--text-base);
}

.row-item__body {
    font-size: var(--text-base);
    color: var(--color-text);
    white-space: pre-wrap;
    word-break: break-word;
}

.row-item__meta {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    margin-top: var(--space-2);
}

.row-item__actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-top: 0;
}

.row-item__channel {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.empty-filter-msg {
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-base);
    color: var(--color-text-tertiary);
    text-align: center;
}

.row-item__action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-tertiary);
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    display: flex;
    line-height: 0;
}

.row-item__action-btn:hover {
    color: var(--color-danger);
    background: var(--color-danger-bg);
}

/* ==========================================================================
   Pill / Tag — inline removable label
   ========================================================================== */

.pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px var(--space-3);
    background: var(--color-surface-secondary);
    color: var(--color-text);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

[data-theme="dark"] .pill {
    background: var(--color-surface-hover);
}

.pill--primary { background: var(--color-primary-light); color: var(--color-primary); }
.pill--success { background: var(--color-success-light); color: var(--color-success); }
.pill--warning { background: var(--color-warning-light); color: var(--color-warning); }
.pill--danger { background: var(--color-danger-light); color: var(--color-danger); }

.pill__close {
    background: none;
    border: none;
    cursor: pointer;
    color: currentColor;
    opacity: 0.6;
    padding: 0;
    display: flex;
    line-height: 0;
}

.pill__close:hover {
    opacity: 1;
}

.pill--add {
    border: 1px dashed var(--color-border);
    background: transparent;
    color: var(--color-text-tertiary);
}

/* ==========================================================================
   Tag input — clean multi-input style for tag editors in sidebars/profiles
   ========================================================================== */

.tag-editor {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.tag-editor__list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    min-height: 28px;
}

.tag-editor__empty {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
    margin: 0;
}

.tag-editor__tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 4px var(--space-3);
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

[data-theme="dark"] .tag-editor__tag {
    background: rgba(20, 95, 255, 0.18);
    color: #93c5fd;
}

.tag-editor__remove {
    background: none;
    border: none;
    cursor: pointer;
    color: currentColor;
    opacity: 0.6;
    padding: 0;
    display: inline-flex;
    line-height: 0;
    transition: opacity var(--transition-fast);
}

.tag-editor__remove:hover {
    opacity: 1;
}

.tag-editor__input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--text-base);
    color: var(--color-text);
    outline: none;
    transition: border-color var(--transition-fast);
}

.tag-editor__input:focus-visible { outline: none; }

.tag-editor__hint {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    margin: 0;
}

/* ==========================================================================
   Back link (used on detail pages)
   ========================================================================== */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    text-decoration: none;
    margin-bottom: var(--space-2);
}

.back-link:hover {
    color: var(--color-text);
}

/* ==========================================================================
   Meta row — inline metadata (email, phone, dates) with separators
   ========================================================================== */

.meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-size: var(--text-base);
    color: var(--color-text-secondary);
}

.meta-row a,
.meta-row > span {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.meta-row a:hover {
    color: var(--color-primary);
}

.meta-row svg {
    flex-shrink: 0;
}

.meta-row__separator {
    color: var(--color-border);
    display: inline-flex;
    align-items: center;
}

/* Badges + pills inside headings/titles sit on text baseline by default; flex-align them */
.detail-header__title .badge,
.detail-header__title .pill {
    display: inline-flex;
    align-items: center;
}

/* ─── Report toolbar ──────────────────────────────────────────────────────
   The filter bar that sits above a report: a date range, optional selects,
   an Apply button, and a segmented group of period presets on the right.
   Lifted out of Serving Reports when the CCLI Report needed the same bar —
   two copies is where a pattern stops being page-specific. `.rpt-*` on the
   Serving Reports page is aliased to these rules, the way `.event-side-nav`
   aliases `.side-nav`, so both pages move together from here on.
   ──────────────────────────────────────────────────────────────────────── */

.report-toolbar,
.rpt-toolbar {
    /* One height for every control in the bar. Left to their natural sizes a
       .btn lands at ~40px, the preset group at ~39.5px and a padded date input
       at ~34px, so the Apply button visibly overhangs the field it sits next
       to. Pinned to the button's natural height so the buttons don't move and
       only the inputs grow to meet them. */
    --report-control-h: 40px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: 14px;
    padding: var(--space-4) 18px;
    margin-bottom: 18px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.report-toolbar__filters,
.rpt-filters {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.report-field,
.rpt-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.report-field > label,
.report-field__label,
.rpt-field label {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.report-input,
.rpt-input {
    box-sizing: border-box;
    height: var(--report-control-h);
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    padding: 0 11px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    outline: none;
    transition: border-color .12s, box-shadow .12s;
}

/* A bare <select> ignores vertical centring from height alone in some
   engines; give it the same box and let the UA centre its own text. */
.report-input--select,
.rpt-input--select { padding-right: 8px; }

/* Buttons sitting in the filter row, not in a card header — the card-header
   auto-shrink rule doesn't reach here, so match them to the fields. */
.report-toolbar__filters .btn,
.rpt-filters .btn {
    height: var(--report-control-h);
    padding-top: 0;
    padding-bottom: 0;
    display: inline-flex;
    align-items: center;
}

.report-input:focus-visible { outline: none; }
.rpt-input:focus-visible { outline: none; }

.report-input--select,
.rpt-input--select { min-width: 170px; }

/* Segmented preset group — one visually-joined control, not loose buttons. */
.report-presets,
.rpt-presets {
    box-sizing: border-box;
    height: var(--report-control-h);
    display: inline-flex;
    align-items: stretch;
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}

.report-preset,
.rpt-preset {
    /* 13px, not --text-sm (12px): keeps pixel parity with the Serving Reports
       bar these rules were lifted from, so promoting them shifts nothing. */
    font-size: 13px;
    font-weight: var(--weight-semibold);
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 0 13px;
    border-radius: 8px;
    transition: all .12s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.report-preset:hover,
.rpt-preset:hover { color: var(--color-text); }

.report-preset.is-active,
.rpt-preset.is-active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

[data-theme="dark"] .report-preset.is-active,
[data-theme="dark"] .rpt-preset.is-active { background: #0f131c; }

/* Read-only figures that belong to the toolbar rather than to a filter —
   a licence number, a period total. Same micro-label as .report-field.
   These sit in __foot rather than beside the controls: dropped into the main
   row they read as a filter someone forgot to wire up, and wrap to a stray
   line the moment the bar gets busy. */
.report-toolbar__foot {
    flex-basis: 100%;
    margin: var(--space-3) -18px calc(var(--space-4) * -1);
    padding: var(--space-3) 18px;
    border-top: 1px solid var(--color-border-light);
}

.report-meta {
    display: flex;
    align-items: flex-end;
    gap: var(--space-6);
    flex-wrap: wrap;
}

.report-meta__label {
    display: block;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 5px;
}

.report-meta__value {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.report-meta__value--muted { color: var(--color-text-tertiary); font-weight: var(--weight-normal); }
.report-meta__value--danger { color: var(--color-danger); }

/* ─── Inline notice strip ─────────────────────────────────────────────────
   A one-line warning or hint attached to the bottom of a card. Uses the
   warning tokens so it flips with the theme instead of pinning a light
   literal — see the CCLI report, where a hardcoded #92400e left dark brown
   text on a near-black background.
   ──────────────────────────────────────────────────────────────────────── */

.notice-strip {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 10px 16px;
    font-size: var(--text-sm);
    border-radius: 10px;
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border: 1px solid var(--color-warning-border);
}

.notice-strip a { color: inherit; font-weight: var(--weight-semibold); }
.notice-strip--attached {
    border: 0;
    border-top: 1px solid var(--color-border-light);
    border-radius: 0 0 var(--radius-lg, 12px) var(--radius-lg, 12px);
}

/* ─── Menu button ─────────────────────────────────────────────────────────
   Button + a short list of choices beneath it. Behaviour is the delegated
   handler in dashboard.js; this is just the panel. Lifted from the person
   profile's "Add ▾" and "More ▾" menus, which were inline-styled copies of
   each other.
   ──────────────────────────────────────────────────────────────────────── */

.menu-button { position: relative; display: inline-block; }

.menu-button__panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: var(--z-dropdown);
    min-width: 300px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    text-align: left;
}

/* `hidden` is a UA rule and loses to any author display; say it explicitly. */
.menu-button__panel[hidden] { display: none; }

.menu-button__item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    width: 100%;
    padding: 10px var(--space-4);
    border: 0;
    border-top: 1px solid var(--color-border-light);
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: var(--text-base);
    color: var(--color-text);
    text-align: left;
    text-decoration: none;
    transition: background .12s;
}

.menu-button__item:first-child { border-top: 0; }
.menu-button__item:hover { background: var(--color-surface-hover); }
.menu-button__item svg { flex-shrink: 0; margin-top: 2px; color: var(--color-text-tertiary); }
.menu-button__item:hover svg { color: var(--color-primary); }

.menu-button__label { font-weight: var(--weight-medium); display: block; }
.menu-button__hint {
    display: block;
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
    margin-top: 1px;
    line-height: var(--leading-normal);
}
