/* =====================================================================
   RowCast design system
   Colours are tokens. Dark mode re-steps them rather than inverting.
   Chart colours (--rc-series-1, --rc-up, --rc-down) are validated for
   colour-blind separation and contrast on both surfaces: change them only
   after re-running the palette check.
   ===================================================================== */
:root,
[data-bs-theme="light"] {
    --rc-page: #f6f7fb;
    --rc-surface: #ffffff;
    --rc-surface-raised: #ffffff;
    --rc-surface-2: #f1f3f9;
    --rc-ink: #101828;
    --rc-ink-2: #475467;
    --rc-muted: #5d6b82;
    --rc-grid: #e4e7ec;
    --rc-axis: #d0d5dd;
    --rc-border: #e4e7ec;
    --rc-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --rc-shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .14), 0 4px 8px -4px rgba(16, 24, 40, .06);

    --rc-accent: #2459e0;
    --rc-accent-hover: #1d47b8;
    --rc-accent-soft: #e8eefd;
    --rc-accent-soft-ink: #1d47b8;
    --rc-on-accent: #ffffff;
    --rc-teal: #0e9f8e;
    --rc-teal-soft: #e3f6f3;
    --rc-teal-ink: #0b6e63;
    --rc-amber-soft: #fff4dd;
    --rc-amber-ink: #8f4a05;
    --rc-violet-soft: #f0ecff;
    --rc-violet-ink: #5b3fd6;
    --rc-hero: radial-gradient(60rem 30rem at 85% -10%, #dfe8ff 0%, transparent 60%),
               radial-gradient(40rem 24rem at 0% 0%, #e6f7f4 0%, transparent 55%);

    --rc-series-1: #2a78d6;
    --rc-up: #2a78d6;
    --rc-down: #e34948;
    --rc-good-text: #0f7a3d;
    --rc-good-soft: #e7f6ec;
    --rc-bad-text: #c0362c;
    --rc-bad-soft: #fdecea;
    --rc-warn-bg: #fff6e0;
    --rc-warn-border: #f0c869;

    --bs-body-bg: var(--rc-page);
    --bs-body-color: var(--rc-ink);
    --bs-secondary-color: var(--rc-ink-2);
    --bs-tertiary-bg: var(--rc-surface-2);
    --bs-border-color: var(--rc-border);
    --bs-primary: var(--rc-accent);
    --bs-primary-rgb: 36, 89, 224;
    --bs-link-color: var(--rc-accent);
    --bs-link-color-rgb: 36, 89, 224;
    --bs-link-hover-color: var(--rc-accent-hover);
    --bs-link-hover-color-rgb: 29, 71, 184;
    --bs-font-sans-serif: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-border-radius: .625rem;
    --bs-border-radius-sm: .5rem;
    --bs-border-radius-lg: .875rem;
}

[data-bs-theme="dark"] {
    --rc-page: #0b0f17;
    --rc-surface: #121826;
    --rc-surface-raised: #161d2d;
    --rc-surface-2: #182032;
    --rc-ink: #f2f4f7;
    --rc-ink-2: #c3c9d5;
    --rc-muted: #98a2b3;
    --rc-grid: #253047;
    --rc-axis: #344058;
    --rc-border: #222b3d;
    --rc-shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --rc-shadow-lg: 0 16px 40px -12px rgba(0, 0, 0, .6);

    --rc-accent: #6d8dff;
    --rc-accent-hover: #87a1ff;
    --rc-accent-soft: #1b2650;
    --rc-accent-soft-ink: #a9bcff;
    --rc-on-accent: #0b0f17;
    --rc-teal: #2dd4bf;
    --rc-teal-soft: #0f2a2a;
    --rc-teal-ink: #5eead4;
    --rc-amber-soft: #2d2412;
    --rc-amber-ink: #fcd34d;
    --rc-violet-soft: #241d3d;
    --rc-violet-ink: #c4b5fd;
    --rc-hero: radial-gradient(60rem 30rem at 85% -10%, #18244d 0%, transparent 60%),
               radial-gradient(40rem 24rem at 0% 0%, #0d2a2a 0%, transparent 55%);

    --rc-series-1: #3987e5;
    --rc-up: #3987e5;
    --rc-down: #e66767;
    --rc-good-text: #3ccf7a;
    --rc-good-soft: #10291c;
    --rc-bad-text: #ff8a80;
    --rc-bad-soft: #321615;
    --rc-warn-bg: #2d2511;
    --rc-warn-border: #7a5c12;

    --bs-body-bg: var(--rc-page);
    --bs-body-color: var(--rc-ink);
    --bs-secondary-color: var(--rc-ink-2);
    --bs-tertiary-bg: var(--rc-surface-2);
    --bs-border-color: var(--rc-border);
    --bs-primary: var(--rc-accent);
    --bs-primary-rgb: 109, 141, 255;
    --bs-link-color: var(--rc-accent);
    --bs-link-color-rgb: 109, 141, 255;
    --bs-link-hover-color: var(--rc-accent-hover);
    --bs-link-hover-color-rgb: 135, 161, 255;
}

/* ---------- Base ---------- */
html { font-size: 15px; scroll-padding-top: 5rem; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
    min-height: 100vh;
    background: var(--rc-page);
    color: var(--rc-ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, .h1, .h2, .h3, .h4, .h5 { color: var(--rc-ink); letter-spacing: -0.015em; }
a { text-underline-offset: .2em; }
::selection { background: var(--rc-accent-soft); }
:focus-visible { outline: 2px solid var(--rc-accent); outline-offset: 2px; }
hr { border-color: var(--rc-border); opacity: 1; }
.text-body-secondary { color: var(--rc-ink-2) !important; }
.text-muted-2 { color: var(--rc-muted); }
.small-caps, .eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--rc-accent); }

.skip-link { position: absolute; left: 1rem; top: .5rem; z-index: 2000; background: var(--rc-surface-raised); padding: .5rem 1rem; border-radius: 8px; }

.icon { width: 1em; height: 1em; fill: currentColor; flex: none; vertical-align: -0.125em; }
.icon-lg { width: 1.25em; height: 1.25em; }

/* Brand: the mark (three rising bars on one baseline, img/logo-mark.svg) and the word. */
.brand { font-weight: 750; font-size: 1.2rem; letter-spacing: -0.025em; line-height: 1; color: var(--rc-ink); display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand:hover { color: var(--rc-ink); }
.brand-mark {
    width: 2rem; height: 2rem; border-radius: 9px; display: inline-block; flex: none;
    background: url("../img/logo-mark.svg") center / contain no-repeat;
    box-shadow: 0 4px 12px -2px rgba(36, 89, 224, .45);
}
.auth-aside .brand-mark { box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }

/* ---------- Buttons ---------- */
.btn { --bs-btn-font-weight: 600; --bs-btn-border-radius: .625rem; --bs-btn-padding-x: 1rem; --bs-btn-padding-y: .5rem; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-sm { --bs-btn-padding-x: .75rem; --bs-btn-padding-y: .3rem; --bs-btn-font-size: .85rem; --bs-btn-border-radius: .5rem; }
.btn-lg { --bs-btn-padding-x: 1.4rem; --bs-btn-padding-y: .75rem; --bs-btn-font-size: 1.05rem; --bs-btn-border-radius: .75rem; }

.btn-primary {
    --bs-btn-color: var(--rc-on-accent); --bs-btn-hover-color: var(--rc-on-accent); --bs-btn-active-color: var(--rc-on-accent); --bs-btn-disabled-color: var(--rc-on-accent);
    --bs-btn-bg: var(--rc-accent); --bs-btn-border-color: var(--rc-accent);
    --bs-btn-hover-bg: var(--rc-accent-hover); --bs-btn-hover-border-color: var(--rc-accent-hover);
    --bs-btn-active-bg: var(--rc-accent-hover); --bs-btn-active-border-color: var(--rc-accent-hover);
    --bs-btn-disabled-bg: var(--rc-accent); --bs-btn-disabled-border-color: var(--rc-accent);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .08), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn-outline-secondary, .btn-secondary {
    --bs-btn-color: var(--rc-ink); --bs-btn-bg: var(--rc-surface); --bs-btn-border-color: var(--rc-axis);
    --bs-btn-hover-color: var(--rc-ink); --bs-btn-hover-bg: var(--rc-surface-2); --bs-btn-hover-border-color: var(--rc-axis);
    --bs-btn-active-color: var(--rc-ink); --bs-btn-active-bg: var(--rc-surface-2); --bs-btn-active-border-color: var(--rc-axis);
    --bs-btn-disabled-color: var(--rc-muted); --bs-btn-disabled-bg: var(--rc-surface); --bs-btn-disabled-border-color: var(--rc-border);
    box-shadow: var(--rc-shadow);
}
.btn-soft {
    --bs-btn-color: var(--rc-accent-soft-ink); --bs-btn-bg: var(--rc-accent-soft); --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--rc-accent-soft-ink); --bs-btn-hover-bg: var(--rc-accent-soft); --bs-btn-hover-border-color: var(--rc-accent);
    --bs-btn-active-color: var(--rc-accent-soft-ink); --bs-btn-active-bg: var(--rc-accent-soft); --bs-btn-active-border-color: var(--rc-accent);
}
.btn-ghost {
    --bs-btn-color: var(--rc-ink-2); --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--rc-ink); --bs-btn-hover-bg: var(--rc-surface-2); --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--rc-ink); --bs-btn-active-bg: var(--rc-surface-2); --bs-btn-active-border-color: transparent;
}
.btn-link { --bs-btn-font-weight: 600; text-decoration: none; }
.btn-link.text-danger { color: var(--rc-bad-text) !important; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 .2rem var(--rc-surface), 0 0 0 .35rem var(--rc-accent);
    border-color: var(--rc-accent);
    outline: none;
}

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .9rem; color: var(--rc-ink); margin-bottom: .35rem; }
.form-control, .form-select { background-color: var(--rc-surface-raised); border-color: var(--rc-axis); border-radius: .625rem; padding: .55rem .8rem; color: var(--rc-ink); }
.form-control::placeholder { color: var(--rc-muted); }
.form-control-lg, .form-select-lg { border-radius: .75rem; }
.form-text { color: var(--rc-muted); }
/* Tick boxes and radio buttons need a visible edge in both themes. */
.form-check-input { border-color: var(--rc-muted); }
.form-check-input:checked { background-color: var(--rc-accent); border-color: var(--rc-accent); }
.form-check-label { color: var(--rc-ink); }
legend.form-label { font-size: 1rem; }
.validation-summary-valid { display: none; }
.text-danger { color: var(--rc-bad-text) !important; }

/* Upload drop zone: the real file input covers the area, so drag and drop works natively. */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; text-align: center; padding: 2.25rem 1rem; border: 2px dashed var(--rc-axis); border-radius: 1rem; background: var(--rc-surface-2); transition: border-color .15s, background-color .15s; }
.dropzone:hover, .dropzone.is-dragging, .dropzone:focus-within { border-color: var(--rc-accent); background: var(--rc-accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone-icon { width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; background: var(--rc-surface); color: var(--rc-accent); box-shadow: var(--rc-shadow); font-size: 1.4rem; margin-bottom: .35rem; }
.dropzone-title { font-weight: 650; font-size: 1.05rem; }
.dropzone-file { font-weight: 600; color: var(--rc-accent-soft-ink); }

/* ---------- Cards & page structure ---------- */
.rc-card {
    background: var(--rc-surface);
    border: 1px solid var(--rc-border);
    border-radius: 1rem;
    padding: 1.35rem;
    box-shadow: var(--rc-shadow);
}
.rc-card + .rc-card { margin-top: 1rem; }
.rc-card h2, .rc-card h3 { font-size: 1.05rem; font-weight: 650; margin-bottom: .75rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; }
.card-head h2, .card-head h3 { margin: 0; display: inline-flex; align-items: center; gap: .5rem; }
.card-head a { font-size: .9rem; font-weight: 600; text-decoration: none; }

.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.65rem; font-weight: 750; margin: 0; letter-spacing: -0.02em; }
.page-head p { margin: .3rem 0 0; color: var(--rc-ink-2); max-width: 46rem; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 575.98px) {
    .page-head { align-items: stretch; }
    .page-head .actions, .page-head > .d-flex { width: 100%; }
    .page-head .actions .btn, .page-head > .d-flex > .btn, .page-head > .d-flex > form { flex: 1 1 auto; }
    .page-head > .d-flex > form .btn { width: 100%; }
}

/* Coloured icon chips used in feature lists, steps and empty states. */
.chip-icon { width: 2.5rem; height: 2.5rem; border-radius: .75rem; display: inline-grid; place-items: center; font-size: 1.2rem; flex: none; background: var(--rc-accent-soft); color: var(--rc-accent-soft-ink); }
.chip-icon.teal { background: var(--rc-teal-soft); color: var(--rc-teal-ink); }
.chip-icon.amber { background: var(--rc-amber-soft); color: var(--rc-amber-ink); }
.chip-icon.violet { background: var(--rc-violet-soft); color: var(--rc-violet-ink); }
.chip-icon.good { background: var(--rc-good-soft); color: var(--rc-good-text); }
.chip-icon.bad { background: var(--rc-bad-soft); color: var(--rc-bad-text); }
.chip-icon.sm { width: 2rem; height: 2rem; border-radius: .6rem; font-size: 1rem; }

/* ---------- Stat tiles (value + delta, text in text colours) ---------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.tile { background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: 1rem; padding: 1.1rem 1.2rem; box-shadow: var(--rc-shadow); min-width: 0; }
.tile-label { color: var(--rc-ink-2); font-size: .85rem; font-weight: 600; margin-bottom: .4rem; }
.tile-value { font-size: 1.75rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.tile-sub { font-size: .85rem; color: var(--rc-muted); margin-top: .35rem; }
.tile a.tile-link { font-size: .85rem; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: .25rem; margin-top: .5rem; }
.delta { font-size: .8rem; font-weight: 650; display: inline-flex; gap: .3rem; align-items: baseline; margin-top: .45rem; padding: .2rem .55rem; border-radius: .5rem; line-height: 1.35; background: var(--rc-surface-2); }
.delta.good { color: var(--rc-good-text); background: var(--rc-good-soft); }
.delta.bad { color: var(--rc-bad-text); background: var(--rc-bad-soft); }
.delta.neutral { color: var(--rc-ink-2); }

.hero-number { font-size: 3rem; font-weight: 700; line-height: 1.05; letter-spacing: -0.03em; }

.credit-pill { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .8rem; border-radius: 999px; background: var(--rc-accent-soft); color: var(--rc-accent-soft-ink); font-weight: 650; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.credit-pill:hover { color: var(--rc-accent-soft-ink); box-shadow: inset 0 0 0 1px var(--rc-accent); }

.empty-state { text-align: center; padding: 3rem 1.25rem; }
.empty-state .chip-icon { width: 3.5rem; height: 3.5rem; font-size: 1.6rem; border-radius: 1rem; margin-bottom: 1rem; }
.empty-state h2, .empty-state .h4 { font-size: 1.3rem; font-weight: 700; }
.empty-state p { color: var(--rc-ink-2); max-width: 34rem; margin: .5rem auto 1.25rem; }
.empty-state .actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }

.reassure { display: flex; gap: .7rem; align-items: flex-start; color: var(--rc-ink-2); font-size: .92rem; }
.reassure .icon { color: var(--rc-teal); margin-top: .2rem; }
.reassure-icon { flex: none; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--rc-teal-soft); position: relative; margin-top: .1rem; }
.reassure-icon::after { content: ""; position: absolute; left: 35%; top: 22%; width: 30%; height: 45%; border: solid var(--rc-teal-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }

.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.check-list li { display: flex; gap: .6rem; align-items: flex-start; }
.check-list .icon { color: var(--rc-teal); margin-top: .2rem; }

.warning-list { list-style: none; padding: 0; margin: 0; }
.warning-list li { background: var(--rc-warn-bg); border: 1px solid var(--rc-warn-border); border-radius: .625rem; padding: .6rem .8rem; margin-bottom: .5rem; font-size: .92rem; }
.warning-list li::before { content: "Check: "; font-weight: 650; }

/* Status badges carry a label, never colour alone. */
.status-badge { font-size: .78rem; font-weight: 650; padding: .2rem .6rem; border-radius: 999px; display: inline-flex; align-items: center; gap: .35rem; background: var(--rc-surface-2); color: var(--rc-ink-2); white-space: nowrap; }
.status-badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.status-Succeeded, .status-Complete { color: var(--rc-good-text); background: var(--rc-good-soft); }
.status-Failed, .status-Cancelled { color: var(--rc-bad-text); background: var(--rc-bad-soft); }
.status-Queued, .status-Running, .status-Pending { color: var(--rc-accent-soft-ink); background: var(--rc-accent-soft); }

/* Alerts */
.alert { border-radius: .875rem; border-width: 1px; }
/* Alerts that start with an icon lay the icon beside the text. */
.alert:has(> .icon) { display: flex; gap: .65rem; align-items: flex-start; }
.alert > .icon { margin-top: .2rem; }
.alert-success { --bs-alert-bg: var(--rc-good-soft); --bs-alert-color: var(--rc-good-text); --bs-alert-border-color: transparent; }
.alert-danger { --bs-alert-bg: var(--rc-bad-soft); --bs-alert-color: var(--rc-bad-text); --bs-alert-border-color: transparent; }
.alert-info { --bs-alert-bg: var(--rc-accent-soft); --bs-alert-color: var(--rc-accent-soft-ink); --bs-alert-border-color: transparent; }
.alert-warning { --bs-alert-bg: var(--rc-amber-soft); --bs-alert-color: var(--rc-amber-ink); --bs-alert-border-color: transparent; }
.alert ul { margin-bottom: 0; }

.progress { --bs-progress-bg: var(--rc-surface-2); --bs-progress-bar-bg: var(--rc-accent); height: .5rem; border-radius: 999px; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--rc-ink); --bs-table-border-color: var(--rc-grid); --bs-table-hover-bg: var(--rc-surface-2); --bs-table-hover-color: var(--rc-ink); margin-bottom: 0; }
.table thead th { color: var(--rc-muted); font-weight: 650; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; background: var(--rc-surface-2); border-bottom: 1px solid var(--rc-grid); padding-top: .65rem; padding-bottom: .65rem; white-space: nowrap; }
.table thead th:first-child { border-top-left-radius: .6rem; }
.table thead th:last-child { border-top-right-radius: .6rem; }
.table > :not(caption) > * > * { padding: .75rem .75rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Column mapping ---------- */
.map-table td, .map-table th { vertical-align: top; }
.map-table .samples { color: var(--rc-muted); font-size: .85rem; max-width: 18rem; }
.pii-flag { display: inline-flex; gap: .3rem; align-items: center; font-size: .78rem; font-weight: 650; color: var(--rc-bad-text); margin-top: .25rem; }
.type-chip { font-size: .72rem; font-weight: 600; border-radius: 999px; padding: .1rem .55rem; color: var(--rc-ink-2); background: var(--rc-surface-2); }

/* Progress steps (upload → columns → report) */
.steps { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1.5rem; flex-wrap: wrap; }
.steps li { display: inline-flex; align-items: center; gap: .5rem; font-size: .85rem; font-weight: 600; color: var(--rc-muted); }
.steps li + li::before { content: ""; width: 1.5rem; height: 2px; background: var(--rc-axis); border-radius: 2px; margin-right: .1rem; }
.steps .n { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: inline-grid; place-items: center; background: var(--rc-surface-2); color: var(--rc-ink-2); font-size: .8rem; border: 1px solid var(--rc-border); }
.steps .current { color: var(--rc-ink); }
.steps .current .n { background: var(--rc-accent); color: var(--rc-on-accent); border-color: var(--rc-accent); }
.steps .done .n { background: var(--rc-teal-soft); color: var(--rc-teal-ink); border-color: transparent; }

/* ---------- Report ---------- */
.report-hero { background: var(--rc-hero), var(--rc-surface); }
.report-headline { font-size: 1.6rem; font-weight: 750; line-height: 1.25; letter-spacing: -0.02em; margin: 0; }
@media (min-width: 992px) { .report-headline { font-size: 1.9rem; } }
.insight { padding: .9rem 0; border-top: 1px solid var(--rc-grid); display: flex; gap: .75rem; }
.insight:first-of-type { border-top: 0; padding-top: 0; }
.insight h4 { font-size: 1rem; font-weight: 650; margin: 0 0 .2rem; }
.insight p { margin: 0; color: var(--rc-ink-2); }
form.insight { display: block; }
.marker { width: .6rem; height: .6rem; border-radius: 50%; flex: none; }
.marker.win { background: var(--rc-good-text); }
.marker.concern { background: var(--rc-bad-text); }
.disclaimer { font-size: .85rem; color: var(--rc-muted); }

/* ---------- Charts ---------- */
.filter-row { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: end; margin-bottom: 1.25rem; padding: 1rem 1.1rem; background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: 1rem; box-shadow: var(--rc-shadow); }
.filter-row > div { flex: 1 1 11rem; min-width: 0; }
.filter-row .form-select { min-width: 0; width: 100%; }
.filter-row .form-label { font-size: .8rem; color: var(--rc-ink-2); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 1rem; }
.chart-card { background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: 1rem; padding: 1.1rem 1.2rem .85rem; min-width: 0; box-shadow: var(--rc-shadow); }
.chart-card h3 { font-size: 1rem; font-weight: 650; margin: 0; }
.chart-card .chart-sub { font-size: .85rem; color: var(--rc-muted); margin: .15rem 0 .5rem; }
.chart { width: 100%; height: 300px; }
@media (max-width: 575.98px) { .chart { height: 260px; } }
.chart-card.loading .chart { opacity: .45; transition: opacity .15s; }
.legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .85rem; color: var(--rc-ink-2); margin-bottom: .25rem; }
.legend-key { display: inline-block; width: 1rem; height: 2px; vertical-align: middle; margin-right: .35rem; background: var(--rc-series-1); }
.legend-key.dashed { background: repeating-linear-gradient(90deg, var(--rc-series-1) 0 4px, transparent 4px 7px); }
.legend-key.band { height: .7rem; opacity: .2; }
.table-toggle { font-size: .85rem; }
.chart-table { font-size: .85rem; margin-top: .5rem; }

/* Authenticator QR code: always dark-on-white so phones can scan it in dark mode too. */
.qr-code { display: inline-block; background: #ffffff; padding: 12px; border-radius: 8px; margin-bottom: 1rem; }
.qr-code svg { display: block; width: 200px; height: 200px; }

/* =====================================================================
   App shell (signed in): sidebar on desktop, top bar + tab bar on phones
   ===================================================================== */
.app-shell { display: flex; min-height: 100vh; }
/* On desktop the wrapper is the visible sidebar column (Bootstrap makes .offcanvas-lg transparent there);
   on phones the same menu slides in from the left. */
@media (min-width: 992px) {
    .sidebar-wrap { width: 16rem; flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; background: var(--rc-surface); border-right: 1px solid var(--rc-border); }
    .sidebar { height: 100%; display: flex; flex-direction: column; }
}
@media (max-width: 991.98px) { .sidebar-wrap { display: contents; } }
.sidebar .offcanvas-body { display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem 1rem; flex-grow: 1; }
.footer-blurb { max-width: 22rem; }
.side-nav { list-style: none; padding: 0; margin: 0; display: grid; gap: .15rem; }
.side-label { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--rc-muted); padding: .75rem .75rem .3rem; }
.side-link { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: .625rem; color: var(--rc-ink-2); font-weight: 600; font-size: .94rem; text-decoration: none; }
.side-link .icon { font-size: 1.1rem; color: var(--rc-muted); }
.side-link:hover { background: var(--rc-surface-2); color: var(--rc-ink); }
.side-link.active { background: var(--rc-accent-soft); color: var(--rc-accent-soft-ink); }
.side-link.active .icon { color: var(--rc-accent-soft-ink); }
.side-link .badge-admin { margin-left: auto; font-size: .65rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--rc-bad-text); background: var(--rc-bad-soft); border-radius: 4px; padding: .1rem .35rem; }
/* minmax(0, 1fr): a long email must shorten with "…", never widen the sidebar. */
.sidebar-foot { margin-top: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; }
.sidebar-foot > * { min-width: 0; }
.credit-card-widget { border-radius: .875rem; padding: .9rem 1rem; background: linear-gradient(135deg, var(--rc-accent-soft), var(--rc-violet-soft)); }
.credit-card-widget .n { font-size: 1.5rem; font-weight: 750; line-height: 1.1; color: var(--rc-ink); }
.credit-card-widget .l { font-size: .8rem; color: var(--rc-ink-2); }
.credit-card-widget a { font-size: .85rem; font-weight: 650; text-decoration: none; display: inline-flex; gap: .3rem; align-items: center; margin-top: .4rem; }
.account-btn { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .6rem; border-radius: .75rem; background: transparent; border: 1px solid var(--rc-border); color: var(--rc-ink); text-align: left; }
.account-btn:hover { background: var(--rc-surface-2); }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; color: #ffffff; background: linear-gradient(135deg, #2459e0, #5b3fd6); flex: none; text-transform: uppercase; }
.account-btn .who { min-width: 0; flex: 1; }
.account-btn .who span { display: block; font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-menu { --bs-dropdown-bg: var(--rc-surface-raised); --bs-dropdown-border-color: var(--rc-border); --bs-dropdown-link-color: var(--rc-ink); --bs-dropdown-link-hover-bg: var(--rc-surface-2); --bs-dropdown-link-hover-color: var(--rc-ink); --bs-dropdown-link-active-bg: var(--rc-accent-soft); --bs-dropdown-link-active-color: var(--rc-accent-soft-ink); border-radius: .75rem; box-shadow: var(--rc-shadow-lg); padding: .35rem; }
.dropdown-item { border-radius: .5rem; display: flex; gap: .55rem; align-items: center; padding: .45rem .65rem; font-weight: 500; }
.offcanvas { --bs-offcanvas-bg: var(--rc-surface); --bs-offcanvas-width: 18rem; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-content { width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.75rem 1.25rem 2.5rem; flex: 1; }
@media (min-width: 992px) { .app-content { padding: 2.25rem 2.25rem 3rem; } }
.app-footer { width: 100%; max-width: 1200px; margin: 0 auto; padding: 1rem 1.25rem 1.5rem; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .85rem; color: var(--rc-muted); }
@media (min-width: 992px) { .app-footer { padding: 1rem 2.25rem 1.75rem; } }
.app-footer a { color: var(--rc-ink-2); text-decoration: none; }
.app-footer a:hover { color: var(--rc-ink); }

/* Three columns so the logo sits exactly in the middle, whatever is on either side. */
.app-topbar { position: sticky; top: 0; z-index: 1030; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .75rem; padding: .6rem 1rem; background: color-mix(in srgb, var(--rc-surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--rc-border); }
.icon-btn { width: 2.5rem; height: 2.5rem; display: inline-grid; place-items: center; border-radius: .625rem; border: 1px solid var(--rc-border); background: var(--rc-surface); color: var(--rc-ink); font-size: 1.15rem; }
.icon-btn:hover { background: var(--rc-surface-2); }

/* Phones: a bottom tab bar for the main places, with room for the home indicator. */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--rc-surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-top: 1px solid var(--rc-border); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); }
.tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: .15rem; font-size: .7rem; font-weight: 600; color: var(--rc-muted); text-decoration: none; padding: .3rem 0; background: none; border: 0; min-height: 3rem; justify-content: center; }
.tabbar .icon { font-size: 1.3rem; }
.tabbar .active { color: var(--rc-accent); }
.tabbar .tab-upload .icon { width: 2.6rem; height: 2.6rem; padding: .6rem; border-radius: 50%; background: var(--rc-accent); color: var(--rc-on-accent); box-shadow: 0 6px 16px -4px rgba(36, 89, 224, .55); margin-top: -1.1rem; }
@media (max-width: 991.98px) {
    .app-shell { flex-direction: column; }
    .app-main { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
}

/* =====================================================================
   Site shell (signed out): marketing header and footer
   ===================================================================== */
.site-header { position: sticky; top: 0; z-index: 1030; background: color-mix(in srgb, var(--rc-page) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.site-header .navbar { padding: .75rem 0; }
.site-header .nav-link { color: var(--rc-ink-2); font-weight: 600; font-size: .95rem; padding: .5rem .8rem !important; border-radius: .5rem; }
.site-header .nav-link:hover { color: var(--rc-ink); background: var(--rc-surface-2); }
.site-header .navbar-toggler { border: 1px solid var(--rc-border); border-radius: .625rem; padding: .4rem .55rem; color: var(--rc-ink); font-size: 1.2rem; }
.site-header .navbar-toggler:focus { box-shadow: 0 0 0 .2rem var(--rc-accent-soft); }
@media (max-width: 991.98px) {
    .site-header .navbar-collapse { padding: .75rem 0 1rem; }
    .site-header .navbar-collapse .btn { width: 100%; margin-top: .25rem; }
}

.site-footer { border-top: 1px solid var(--rc-border); background: var(--rc-surface); color: var(--rc-ink-2); padding: 3rem 0 2rem; font-size: .92rem; margin-top: 4rem; }
.site-footer h2 { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--rc-muted); margin-bottom: .9rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.site-footer a { color: var(--rc-ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--rc-ink); }
.site-footer .fine { border-top: 1px solid var(--rc-border); margin-top: 2rem; padding-top: 1.25rem; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; color: var(--rc-muted); font-size: .85rem; }

.site-main { padding-bottom: 1rem; }
.site-main > .container-page { padding-top: 2rem; }
.container-page { max-width: 1160px; margin: 0 auto; padding-left: 1.25rem; padding-right: 1.25rem; }

/* ---------- Landing page ---------- */
.hero { background: var(--rc-hero); margin-top: -4.5rem; padding: 8rem 0 4rem; }
@media (min-width: 992px) { .hero { padding: 9.5rem 0 5.5rem; } }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; line-height: 1.05; letter-spacing: -0.035em; margin-bottom: 1.25rem; }
.hero .lead { font-size: 1.15rem; color: var(--rc-ink-2); max-width: 36rem; }
.gradient-text { background: linear-gradient(100deg, #2459e0 0%, #5b3fd6 50%, #0e9f8e 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-bs-theme="dark"] .gradient-text { background-image: linear-gradient(100deg, #87a1ff 0%, #b49cff 50%, #5eead4 100%); }
.pill-note { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; font-weight: 600; padding: .3rem .8rem .3rem .4rem; border-radius: 999px; background: var(--rc-surface); border: 1px solid var(--rc-border); color: var(--rc-ink-2); box-shadow: var(--rc-shadow); margin-bottom: 1.25rem; }
.pill-note .tag { background: var(--rc-teal-soft); color: var(--rc-teal-ink); border-radius: 999px; padding: .1rem .55rem; font-size: .75rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: 1.5rem; color: var(--rc-ink-2); font-size: .9rem; }
.hero-meta span { display: inline-flex; gap: .4rem; align-items: center; }
.hero-meta .icon { color: var(--rc-teal); }

/* Product preview: a mock report card built in HTML (decorative). */
.preview { position: relative; }
.preview-window { background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: 1.25rem; box-shadow: var(--rc-shadow-lg); overflow: hidden; }
.preview-bar { display: flex; gap: .4rem; align-items: center; padding: .7rem 1rem; border-bottom: 1px solid var(--rc-border); background: var(--rc-surface-2); }
.preview-bar i { width: .65rem; height: .65rem; border-radius: 50%; background: var(--rc-axis); display: inline-block; }
.preview-bar span { margin-left: .5rem; font-size: .78rem; color: var(--rc-muted); font-weight: 600; }
.preview-body { padding: 1.25rem; display: grid; gap: 1rem; }
.preview-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.preview-kpis > div { border: 1px solid var(--rc-border); border-radius: .75rem; padding: .7rem .8rem; }
.preview-kpis .l { font-size: .72rem; color: var(--rc-muted); font-weight: 600; }
.preview-kpis .v { font-size: 1.15rem; font-weight: 750; letter-spacing: -0.02em; }
.preview-kpis .d { font-size: .72rem; font-weight: 650; color: var(--rc-good-text); }
.preview-kpis .d.bad { color: var(--rc-bad-text); }
.preview-chart { border: 1px solid var(--rc-border); border-radius: .75rem; padding: .75rem .9rem .5rem; }
.preview-chart svg { width: 100%; height: 120px; display: block; }
.preview-chart .line { fill: none; stroke: var(--rc-series-1); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.preview-chart .area { fill: var(--rc-series-1); opacity: .1; }
.preview-chart .fc { fill: none; stroke: var(--rc-series-1); stroke-width: 2; stroke-dasharray: 5 5; }
.preview-chart .band { fill: var(--rc-series-1); opacity: .12; }
.preview-chart .grid { stroke: var(--rc-grid); stroke-width: 1; }
.preview-insights { display: grid; gap: .5rem; font-size: .88rem; }
.preview-insights div { display: flex; gap: .55rem; align-items: flex-start; }
.preview-float { position: absolute; background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: .875rem; box-shadow: var(--rc-shadow-lg); padding: .7rem .9rem; font-size: .82rem; display: flex; gap: .6rem; align-items: center; }
.preview-float strong { display: block; font-size: .85rem; }
.preview-float.one { left: -1.5rem; bottom: -1.5rem; }
.preview-float.two { right: -1rem; top: -1.25rem; }
@media (max-width: 1199.98px) { .preview-float { display: none; } }

.trust-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; padding: 1.5rem 0; border-top: 1px solid var(--rc-border); border-bottom: 1px solid var(--rc-border); }
.trust-strip div { display: flex; gap: .7rem; align-items: center; font-weight: 600; color: var(--rc-ink-2); font-size: .92rem; }

.section { padding: 4.5rem 0; }
.section-head { max-width: 40rem; margin: 0 auto 2.5rem; text-align: center; }
.section-head h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 800; letter-spacing: -0.03em; margin: .5rem 0 .75rem; }
.section-head p { color: var(--rc-ink-2); font-size: 1.05rem; margin: 0; }

.feature { height: 100%; background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: 1rem; padding: 1.5rem; box-shadow: var(--rc-shadow); transition: transform .15s, box-shadow .15s; }
.feature:hover { transform: translateY(-2px); box-shadow: var(--rc-shadow-lg); }
.feature h3 { font-size: 1.05rem; font-weight: 700; margin: 1rem 0 .4rem; }
.feature p { color: var(--rc-ink-2); margin: 0; font-size: .95rem; }

.step-num { width: 2.25rem; height: 2.25rem; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 750; background: var(--rc-accent); color: var(--rc-on-accent); box-shadow: 0 4px 12px -2px rgba(36, 89, 224, .4); }

/* Pricing */
.price-card { position: relative; height: 100%; display: flex; flex-direction: column; background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: 1.25rem; padding: 1.75rem 1.5rem; box-shadow: var(--rc-shadow); }
.price-card.featured { border: 2px solid var(--rc-accent); box-shadow: var(--rc-shadow-lg); }
.price-card .ribbon { position: absolute; top: -.8rem; left: 50%; transform: translateX(-50%); background: var(--rc-accent); color: var(--rc-on-accent); font-size: .72rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; padding: .25rem .75rem; border-radius: 999px; white-space: nowrap; }
.price-card h3 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.price-card .price { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin: .75rem 0 .1rem; }
.price-card .price small { font-size: .95rem; font-weight: 600; color: var(--rc-muted); letter-spacing: 0; }
.price-card .per { color: var(--rc-muted); font-size: .88rem; margin-bottom: 1.1rem; }
.price-card .check-list { margin-bottom: 1.5rem; font-size: .93rem; }
.price-card form, .price-card > .btn { margin-top: auto; }
.price-card form .btn, .price-card > .btn { width: 100%; }
.pack-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--rc-grid); }
.pack-row:first-of-type { border-top: 0; padding-top: 0; }
.pack-row .name { font-weight: 650; }
.pack-row .meta { font-size: .88rem; color: var(--rc-muted); }

/* FAQ (native details/summary, no script) */
.faq { display: grid; gap: .75rem; }
.faq details { background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: .875rem; padding: 1rem 1.2rem; box-shadow: var(--rc-shadow); }
.faq summary { font-weight: 650; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; font-weight: 400; color: var(--rc-muted); line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: .75rem 0 0; color: var(--rc-ink-2); }

.cta-band { border-radius: 1.5rem; padding: 3rem 1.5rem; text-align: center; color: #ffffff; background: linear-gradient(120deg, #1d47b8 0%, #4b37c4 55%, #0b7f73 100%); box-shadow: var(--rc-shadow-lg); }
.cta-band h2 { color: #ffffff; font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -0.03em; }
.cta-band p { color: rgba(255, 255, 255, .85); max-width: 34rem; margin: .5rem auto 1.5rem; }
.cta-band .btn-light { --bs-btn-color: #1d47b8; --bs-btn-bg: #ffffff; --bs-btn-border-color: #ffffff; --bs-btn-hover-bg: #eef2ff; --bs-btn-hover-border-color: #eef2ff; --bs-btn-hover-color: #1d47b8; }
.cta-band .btn-outline-light { --bs-btn-color: #ffffff; --bs-btn-border-color: rgba(255, 255, 255, .6); --bs-btn-hover-bg: rgba(255, 255, 255, .12); --bs-btn-hover-color: #ffffff; --bs-btn-hover-border-color: #ffffff; }

/* ---------- Auth pages (sign in, sign up) ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-shell { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } }
.auth-aside { display: none; position: relative; overflow: hidden; color: #ffffff; padding: 3rem; background: linear-gradient(150deg, #1d47b8 0%, #4b37c4 55%, #0b7f73 100%); }
@media (min-width: 992px) { .auth-aside { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-aside::after { content: ""; position: absolute; inset: 0; background: radial-gradient(28rem 18rem at 90% 10%, rgba(255, 255, 255, .16), transparent 70%); pointer-events: none; }
.auth-aside .brand { color: #ffffff; }
.auth-aside h2 { color: #ffffff; font-size: 2.1rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; max-width: 26rem; }
.auth-aside p { color: rgba(255, 255, 255, .85); max-width: 28rem; }
.auth-aside .check-list .icon { color: #7ff0dc; }
.auth-aside .quote { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); border-radius: 1rem; padding: 1rem 1.2rem; font-size: .92rem; max-width: 28rem; }
.auth-main { display: flex; flex-direction: column; padding: 1.25rem; }
@media (min-width: 576px) { .auth-main { padding: 2rem 2.5rem; } }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
@media (min-width: 992px) { .auth-top .brand { visibility: hidden; } }
.auth-form { width: 100%; max-width: 27rem; margin: auto; padding: 2.5rem 0; }
.auth-form h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: .35rem; }
.auth-form .lead-sm { color: var(--rc-ink-2); margin-bottom: 1.75rem; }
.auth-form .rc-card { box-shadow: none; border: 0; padding: 0; background: transparent; }
/* Identity's built-in pages use narrow Bootstrap columns: let them fill the form area. */
.auth-form .row > [class*="col-"] { flex: 0 0 100%; max-width: 100%; }
.auth-form .btn-primary { width: 100%; --bs-btn-padding-y: .65rem; }
.auth-links { display: grid; gap: .35rem; margin-top: 1.25rem; font-size: .92rem; }
.auth-foot { font-size: .82rem; color: var(--rc-muted); display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.auth-foot a { color: var(--rc-muted); }

/* ---------- Home: onboarding checklist ---------- */
.onboard { background: var(--rc-hero), var(--rc-surface); }
.onboard-list { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .5rem; }
.onboard-list li { display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem; border-radius: .75rem; background: var(--rc-surface); border: 1px solid var(--rc-border); }
.onboard-list .tick { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--rc-axis); color: transparent; flex: none; font-size: .8rem; }
.onboard-list .done .tick { background: var(--rc-teal); border-color: var(--rc-teal); color: #ffffff; }
.onboard-list .done .what { color: var(--rc-muted); text-decoration: line-through; }
.onboard-list .what { flex: 1; font-weight: 600; min-width: 0; }
.onboard-list .what small { display: block; font-weight: 400; color: var(--rc-muted); text-decoration: none; }
.onboard-list .btn { flex: none; }
@media (max-width: 575.98px) { .onboard-list li { flex-wrap: wrap; } .onboard-list .btn { width: 100%; } }

/* Sheet cards on Home */
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 1rem; }
.sheet-card { display: flex; flex-direction: column; gap: .75rem; background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: 1rem; padding: 1.2rem; box-shadow: var(--rc-shadow); transition: box-shadow .15s, border-color .15s; }
.sheet-card:hover { box-shadow: var(--rc-shadow-lg); border-color: var(--rc-axis); }
.sheet-card .title { display: flex; gap: .75rem; align-items: center; min-width: 0; }
.sheet-card h3 { font-size: 1.02rem; font-weight: 700; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-card .meta { font-size: .85rem; color: var(--rc-muted); display: grid; gap: .2rem; }
.sheet-card .meta span { display: inline-flex; gap: .4rem; align-items: center; }
.sheet-card .actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: auto; }
.sheet-card .actions .btn { flex: 1 1 auto; white-space: nowrap; }

.list-rows { list-style: none; padding: 0; margin: 0; }
.list-rows li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 0; border-top: 1px solid var(--rc-grid); }
.list-rows li:first-child { border-top: 0; padding-top: 0; }
.list-rows a { font-weight: 600; text-decoration: none; color: var(--rc-ink); }
.list-rows a:hover { color: var(--rc-accent); }
.list-rows .sub { display: block; font-size: .82rem; color: var(--rc-muted); font-weight: 400; }

/* ---------- Guide ---------- */
.guide-nav { display: flex; flex-wrap: wrap; gap: .5rem; }
.guide-nav a { font-size: .85rem; font-weight: 600; padding: .35rem .8rem; border-radius: 999px; background: var(--rc-surface); border: 1px solid var(--rc-border); color: var(--rc-ink-2); text-decoration: none; }
.guide-nav a:hover { border-color: var(--rc-accent); color: var(--rc-accent); }
.guide-step { display: grid; grid-template-columns: auto 1fr; gap: 1rem 1.25rem; }
.guide-step + .guide-step { margin-top: 1rem; }
.guide-step h3 { font-size: 1.1rem; font-weight: 700; margin: .25rem 0 .4rem; }
.guide-step p { color: var(--rc-ink-2); }
.guide-step ul { color: var(--rc-ink-2); padding-left: 1.1rem; }
.guide-section { scroll-margin-top: 5rem; }
.guide-section + .guide-section { margin-top: 2.5rem; }
.guide-section > h2 { font-size: 1.35rem; font-weight: 750; margin-bottom: 1rem; display: flex; gap: .6rem; align-items: center; }
.example-sheet { font-size: .82rem; border: 1px solid var(--rc-border); border-radius: .75rem; overflow: hidden; }
.example-sheet table { margin: 0; }
.example-sheet th { background: #e9f4ec !important; color: #1d5e33 !important; text-transform: none !important; letter-spacing: 0 !important; font-size: .8rem !important; }
[data-bs-theme="dark"] .example-sheet th { background: #10291c !important; color: #8fe3ae !important; }
.kbd-path { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .25rem; font-weight: 600; font-size: .88rem; }
.kbd-path span { padding: .1rem .5rem; border-radius: .4rem; background: var(--rc-surface-2); border: 1px solid var(--rc-border); }

/* ---------- Admin ---------- */
.admin-nav { display: flex; flex-wrap: wrap; gap: .35rem; padding: .3rem; background: var(--rc-surface-2); border-radius: .75rem; width: fit-content; max-width: 100%; }
.admin-nav a { color: var(--rc-ink-2); text-decoration: none; padding: .4rem .9rem; border-radius: .55rem; font-weight: 600; font-size: .9rem; }
.admin-nav a.active { background: var(--rc-surface); color: var(--rc-ink); box-shadow: var(--rc-shadow); }
.admin-nav a:hover { color: var(--rc-ink); }
.admin-badge { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--rc-bad-text); background: var(--rc-bad-soft); border-radius: 4px; padding: .1rem .45rem; }
.secret-state { font-size: .85rem; color: var(--rc-good-text); }
.copy-field { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9rem; }

/* Identity "Manage your account" pages */
.nav-pills { --bs-nav-pills-link-active-bg: var(--rc-accent-soft); --bs-nav-pills-link-active-color: var(--rc-accent-soft-ink); --bs-nav-link-color: var(--rc-ink-2); --bs-nav-link-hover-color: var(--rc-ink); gap: .15rem; }
.nav-pills .nav-link { border-radius: .6rem; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
    .sidebar, .app-topbar, .tabbar, .site-header, .site-footer, .app-footer { display: none !important; }
    .app-main { padding: 0 !important; }
    .rc-card, .tile, .chart-card { box-shadow: none; break-inside: avoid; }
}

/* ---------- Small helpers ---------- */
.narrow { max-width: 46rem; margin-left: auto; margin-right: auto; }
.section-title { font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 800; letter-spacing: -0.03em; }

/* Column mapping on phones: each column becomes its own card. */
@media (max-width: 767.98px) {
    .map-table thead { display: none; }
    .map-table, .map-table tbody, .map-table tr, .map-table td { display: block; width: 100%; }
    .map-table tr { border: 1px solid var(--rc-border); border-radius: .875rem; padding: .75rem; margin-bottom: .75rem; background: var(--rc-surface); }
    .map-table td { border: 0 !important; padding: .35rem 0 !important; }
    .map-table td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--rc-muted); margin-bottom: .2rem; }
    .map-table .samples { max-width: none; }
}
.min-w-0 { min-width: 0; }
.rc-card-soft { background: var(--rc-surface-2); border: 1px solid var(--rc-border); border-radius: .875rem; padding: 1rem 1.1rem; }
.page-pad { padding-top: 2.5rem; }
.legal { max-width: 54rem; }
.legal h2 { margin-top: 1.75rem; }
/* Phones: two stat tiles per row. */
@media (max-width: 575.98px) {
    .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
    .tile { padding: .9rem; }
    .tile-value { font-size: 1.35rem; }
    .tile-label, .tile-sub, .delta { font-size: .75rem; }
    .page-head .credit-pill { display: none; }
}
@media (max-width: 575.98px) {
    .filter-row { padding: .8rem; gap: .6rem; }
    .filter-row > div { flex: 1 1 calc(50% - .3rem); }
}
.offcanvas-lg { --bs-offcanvas-width: 20rem; --bs-offcanvas-bg: var(--rc-surface); }
.preview-kpis .v { white-space: nowrap; font-size: clamp(.85rem, 3.4vw, 1.15rem); }
@media (max-width: 575.98px) {
    .hero { padding-top: 6.5rem; padding-bottom: 3rem; }
    .hero .d-flex > .btn { flex: 1 1 100%; }
    .preview-body { padding: .9rem; }
    .preview-kpis { gap: .5rem; }
    .preview-kpis > div { padding: .55rem .6rem; }
    .section { padding: 3rem 0; }
    .cta-band .btn { flex: 1 1 100%; }
}

/* Identity's "Manage your account" layout: match our page headings. */
.app-content > h1 { font-size: 1.65rem; font-weight: 750; letter-spacing: -0.02em; margin-bottom: .25rem; }
.app-content > h1 + div > h2 { font-size: 1rem; font-weight: 400; color: var(--rc-ink-2); margin-bottom: 1rem; }
.app-content > h1 + div > hr { margin: 0 0 1.5rem; }
.app-content h3 { font-size: 1.2rem; font-weight: 700; }
.app-topbar > :first-child { justify-self: start; }
.app-topbar > :last-child { justify-self: end; }
.sidebar-brand { padding: .25rem .5rem .75rem; }

/* Legal pages */
.legal { max-width: 54rem; }
.legal h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.legal h2 { font-size: 1.15rem; font-weight: 700; margin-top: 2rem; scroll-margin-top: 5rem; }
.legal h3 { font-size: 1rem; font-weight: 700; margin-top: 1.25rem; }
.legal p, .legal li { color: var(--rc-ink-2); line-height: 1.65; }
.legal strong { color: var(--rc-ink); }
.legal .meta { color: var(--rc-muted); font-size: .9rem; }
.legal .toc { columns: 2 14rem; padding-left: 1.1rem; font-size: .92rem; }
.legal .notice { border-left: 4px solid var(--rc-accent); background: var(--rc-accent-soft); border-radius: .5rem; padding: .9rem 1.1rem; color: var(--rc-ink); }
.legal .notice p { color: var(--rc-ink); margin: 0; }
.legal-details { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; padding: 1rem 1.2rem; border: 1px solid var(--rc-border); border-radius: .875rem; background: var(--rc-surface-2); margin: 1rem 0 0; }
.legal-details dt { font-weight: 650; color: var(--rc-ink); }
.legal-details dd { margin: 0; color: var(--rc-ink-2); }
@media (max-width: 575.98px) { .legal-details { grid-template-columns: 1fr; } .legal-details dd { margin-bottom: .5rem; } }
