/* Self-hosted fonts (CSP: self-only; no external font hosts). */
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/figtree-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Spectral";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/spectral-500-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Spectral";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/spectral-600-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Spectral";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/spectral-700-latin.woff2") format("woff2");
}

/* ──────────────────────────────────────────────
   JMS / Jag Choir Finance Tracker
   Theme matched to the "Jag Choir" Claude Design site.
   All colors, fonts, radii live in :root — tweak here.
   ────────────────────────────────────────────── */
:root {
    /* Brand */
    --violet: #5b3a8c;
    --violet-dark: #4d3076;   /* hover */
    --violet-soft: #f3eef8;   /* tinted fills */
    --violet-soft2: #efe9f7;
    --violet-line: #d8cdea;   /* outline-button border */
    --gold: #9a7a28;   /* eyebrow text / gold CTA */
    --gold-bar: #c79a3b;   /* active underline */

    /* Neutrals (warm) */
    --ink: #241f2e;     /* primary text */
    --ink-soft: #54505e;     /* secondary */
    --ink-soft2: #6a6475;     /* tertiary */
    --ink-faint: #8a8392;     /* muted */
    --ink-faint2: #9a9292;     /* table-head muted */
    --line: #ece6dc;     /* card borders */
    --line-soft: #f1ece3;     /* hairlines */
    --line-soft2: #f4efe7;     /* row dividers */
    --input-line: #ddd4ea;     /* form field border */
    --surface: #ffffff;
    --surface-2: #faf7f2;     /* table head / subtle fill */
    --input-bg: #fcfbfe;
    --footer-bg: #f6f2ea;
    --canvas: #faf8f4;     /* warm cream page */
    --hero-top: #f4eefb;     /* light-purple wash */

    /* Status. The fg values are tuned to >= 4.5:1 (WCAG AA small text) on
       their paired bg AND on white — don't lighten them without rechecking. */
    --green-bg: #e8f3ea; --green-fg: #34693f;
    --amber-bg: #faf1dd; --amber-fg: #755a14;
    --rose-bg: #f6e9ee; --rose-fg: #9a4b6b;
    --danger: #b5483b; --danger-dark: #9d3a2e;

    /* Effects */
    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --radius-pill: 999px;
    --shadow-card: 0 1px 2px rgba(40, 30, 60, 0.04);
    --shadow: 0 6px 24px rgba(40, 30, 60, 0.07);
    --shadow-violet: 0 4px 12px rgba(91, 58, 140, 0.25);
    --shadow-violet-sm: 0 3px 8px rgba(91, 58, 140, 0.22);
    --ring: 0 0 0 3px rgba(91, 58, 140, 0.16);

    --font-display: "Spectral", Georgia, "Times New Roman", serif;
    --font-body: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
::selection { background: #e4d8f3; }

/* Visually hidden but read by screen readers (for color-only indicators). */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--canvas);
    background-image: linear-gradient(180deg, var(--hero-top) 0%, var(--canvas) 360px);
    background-repeat: no-repeat;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Nav — light translucent bar */
nav {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(250, 248, 244, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    padding: 0 1rem;
}
.nav-content {
    max-width: 1040px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}
.nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
}
.nav-logo {
    flex: none;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--violet);
    color: #fff;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 2px 6px rgba(91, 58, 140, 0.3);
}
.nav-brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.nav-brand-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 19px;
    letter-spacing: 0.2px;
    color: var(--ink);
}
.nav-brand-sub { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.4px; }

.nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.nav-links a {
    color: var(--ink-soft2);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.45rem 0.55rem;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-links a:hover { color: var(--violet); }
.nav-links a.active { color: var(--violet); border-bottom-color: var(--gold-bar); }

/* Main */
main {
    max-width: 1040px;
    margin: 1.75rem auto;
    padding: 0 1rem;
}

/* Flash Messages */
.flash {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: opacity 0.3s ease;
}
.flash-hide { opacity: 0; }
.flash-close {
    flex: none;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.6;
    font-size: 1.15rem;
    line-height: 1;
    padding: 0 0.1rem;
    cursor: pointer;
}
.flash-close:hover { opacity: 1; }
.flash-success { background: var(--green-bg); color: var(--green-fg); border-color: #cfe6d4; }
.flash-error   { background: var(--rose-bg);  color: var(--rose-fg);  border-color: #ecd6de; }
.flash-info    { background: var(--violet-soft); color: var(--violet); border-color: var(--violet-line); }

/* Headings — serif display */
h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.2px;
    margin-bottom: 1rem;
}
h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0;
}

/* Optional eyebrow label (gold, uppercase) */
.eyebrow {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--gold);
}

/* Table Header */
.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 0.85rem;
}

/* Reversed rows (fixes item 33). Hidden until their own table's "Show
   reversed" toggle adds `.show-reversed` to it.

   Only a *reversed* row carries the attribute — an active row carries nothing
   at all — so the bare attribute-presence selector can never hide live money.
   Hiding in CSS rather than in JavaScript is deliberate: with scripting off,
   or before `site.js` runs, the rows stay hidden instead of flashing into view
   and then disappearing. */
tr[data-reversed-row] {
    display: none;
}
.show-reversed tr[data-reversed-row] {
    display: table-row;
}

/* Table */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-card);
}
thead { background: var(--surface-2); }
th, td {
    padding: 0.75rem 0.9rem;
    text-align: left;
    font-size: 0.92rem;
    border-bottom: 1px solid var(--line-soft2);
}
th {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-faint2);
}
tbody tr:last-child td { border-bottom: none; }
th a { color: inherit; text-decoration: none; }
th a:hover { color: var(--violet); }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: #f7f3fb; }
td a { color: var(--violet); font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }

/* Horizontal-scroll wrapper for wide tables. The wrapper carries the card
   chrome (border/radius/shadow) so the rounded corners keep clipping, while
   the table inside scrolls sideways on narrow screens instead of squishing
   or overflowing the page body. */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    margin-bottom: 1.5rem;
}
.table-scroll > table {
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
}
/* Inside a scroller, badges and action buttons set the column's width —
   keep their labels on one line rather than wrapping mid-phrase. */
.table-scroll td .badge,
.table-scroll td .btn { white-space: nowrap; }

/* Key/value detail table (payment detail page) */
.detail-table th { width: 14rem; vertical-align: top; }
.detail-table tbody tr:hover { background: transparent; }
.detail-table tr.detail-subhead th {
    width: auto;
    padding-top: 1rem;
    color: var(--ink-soft2);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--line, #e2e2e2);
}
.plain-list {
    margin: 0;
    padding-left: 1rem;
}
.plain-list li + li { margin-top: 0.25rem; }
/* Guardian review: one contact per line, its checkbox, badges and reason
   line stacked so a long note never pushes the tick out of reach. */
.guardian-contact {
    list-style: none;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--line-soft2);
}
.guardian-contact:last-child { border-bottom: none; }
.guardian-contact-name { font-weight: 600; }
.guardian-contact .detail-meta { display: block; }
.audit-details {
    white-space: pre-wrap;
    max-width: 24rem;
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--ink-soft2);
}

/* Totals row (table footer) */
tfoot .totals-row td {
    font-weight: 700;
    background: var(--surface-2);
    border-top: 2px solid var(--line);
    color: var(--ink);
}

/* Payment disposition (original amount + where the money went) */
.disposition-total {
    font-weight: 600;
}
.disposition-breakdown {
    margin: 0.15rem 0 0;
    padding-left: 0;
    list-style: none;
    font-size: 0.82em;
    color: var(--ink-soft2);
}
.disposition-breakdown li {
    white-space: nowrap;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.22rem 0.7rem;
    border-radius: var(--radius-pill);
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.5;
}

/* Buttons */
.email-mode-select {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--violet-line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink-soft);
    font-family: inherit;
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.15rem;
    border-radius: 11px;
    font-size: 0.9rem;
    line-height: 1.2;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid transparent;
    box-sizing: border-box;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.06s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}
.btn-primary {
    background: var(--violet);
    color: #fff;
    box-shadow: var(--shadow-violet);
}
.btn-primary:hover { background: var(--violet-dark); }
.btn-secondary {
    background: var(--surface);
    color: var(--violet);
    border-color: var(--violet-line);
}
.btn-secondary:hover { background: var(--violet-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; border-radius: 9px; }
/* A Gmail-compose control that is over budget, has no recipients, or has not
   been enabled by site.js yet. Applied to anchors (which cannot carry the
   `disabled` attribute) and to the server-rendered inert <span> controls, so
   it repeats .btn:disabled's look rather than relying on it. */
.btn-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}
.email-budget-note {
    color: var(--danger);
    font-size: 0.8rem;
    line-height: 1.3;
    max-width: 24rem;
    align-self: center;
}
/* The quieter sibling (fixes item 48): the length hint that sits beside a
   client-built compose control, smaller and muted (.muted's --ink-faint)
   rather than danger-red, since it describes a control the admin can still
   act on. .email-budget-note above stays — the chaperones page and
   finance/student.html still render the louder standing message. */
.email-budget-hint {
    color: var(--ink-faint);
    font-size: 0.75rem;
    line-height: 1.3;
    max-width: 24rem;
    align-self: center;
}

/* Detail Page */
.detail-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}
.detail-header > :first-child { flex: 1 1 16rem; min-width: 0; }
/* flex-shrink stays on so the row can compress to the viewport and wrap its
   buttons instead of overflowing the page on phones. */
.detail-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; flex: 0 1 auto; min-width: 0; }
.detail-actions form { margin: 0; display: inline-flex; }
.detail-meta { color: var(--ink-soft2); font-size: 0.95rem; margin-bottom: 0.5rem; }

/* Keep emails (and other atomic values) from breaking mid-string across lines. */
.nowrap { white-space: nowrap; }

/* Student detail header: title row + subtitle + aligned contact grid + login footnote */
/* The contact block wraps onto its own full-width row beneath the title/actions. */
.detail-contact-block { flex: 1 1 100%; width: 100%; min-width: 0; }
.detail-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.detail-title h1 { margin: 0; }
.detail-title .badge-inactive { margin-left: 0; }
.detail-subtitle { color: var(--ink-soft2); font-size: 0.95rem; margin: 0.2rem 0 0.85rem; }
.detail-contacts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 0.65rem 1.5rem;
    border-top: 1px solid var(--line);
    padding-top: 0.85rem;
}
.contact-item { min-width: 0; }
.contact-label { font-size: 0.78rem; color: var(--ink-soft2); margin-bottom: 0.12rem; }
.contact-name { font-size: 0.95rem; color: var(--ink); }
.contact-email a { color: var(--violet); font-size: 0.9rem; text-decoration: none; word-break: break-all; }
.contact-email a:hover { text-decoration: underline; }
.detail-logins {
    font-size: 0.8rem;
    color: var(--ink-soft2);
    border-top: 1px solid var(--line);
    margin: 0.8rem 0 0;
    padding-top: 0.6rem;
}

.notes-section {
    background: var(--surface);
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--line);
    border-left: 3px solid var(--gold-bar);
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
    box-shadow: var(--shadow-card);
}

.inline-form { display: inline; }
.back-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--ink-soft2);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}
.back-link:hover { color: var(--violet); }

/* Forms */
.form {
    background: var(--surface);
    padding: 1.75rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
/* Strips the outer card chrome (background, border, shadow, padding) so a
   form built entirely from .form-fieldset sections (e.g. the events form)
   reads as separated cards instead of a card nested inside a card. */
.form.form-plain {
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}
.form.form-plain .form-fieldset {
    margin-bottom: 1.5rem;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 0.35rem;
}
.required { color: var(--danger); }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--input-line);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--ink);
    background: var(--input-bg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
/* Slip document-link inputs read-only (not disabled, so the value still
   POSTs) while their preset checkbox is unchecked — static/js/site.js
   toggles this alongside the `readonly` attribute. */
.form-group input.input-dimmed {
    background: var(--surface-2);
    color: var(--ink-faint);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--violet);
    box-shadow: var(--ring);
}
.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
/* Invisible fieldset used to disable a whole form (read-only system records). */
.fieldset-plain { border: none; margin: 0; padding: 0; min-width: 0; }

/* Visible fieldset for grouping long forms (e.g. Add/Edit Event) into sections. */
.form-fieldset {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem 1.1rem 0.6rem;
    margin: 0 0 1.1rem;
    min-width: 0;
}
.form-fieldset legend {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--violet);
    padding: 0 0.4rem;
}

/* Add/Edit Event: five identically-styled sections made a 100-line form read
   as one undifferentiated wall. Each carries a white card surface plus an
   inset left bar in an existing status token — no new colours, and no tinted
   fills, which would fight the cream canvas five ways at once. Opt-in classes
   rather than :nth-of-type() so .form-fieldset elsewhere (the Active radio
   group on charges/detail.html) is untouched. Inset box-shadow rather than
   border-left so the bar cannot fight the 1px border and 10px radius above —
   the same reason .row-parent-request uses it. */
.form-fieldset-accent {
    background: var(--surface);
    box-shadow: var(--shadow-card);
    padding-left: 1.35rem;
}
.fieldset-basics     { box-shadow: var(--shadow-card), inset 4px 0 0 var(--violet); }
.fieldset-parents    { box-shadow: var(--shadow-card), inset 4px 0 0 var(--gold-bar); }
.fieldset-fee        { box-shadow: var(--shadow-card), inset 4px 0 0 var(--green-fg); }
.fieldset-chaperones { box-shadow: var(--shadow-card), inset 4px 0 0 var(--amber-fg); }
.fieldset-slips      { box-shadow: var(--shadow-card), inset 4px 0 0 var(--rose-fg); }

/* Empty State */
.empty-message {
    text-align: center;
    padding: 2.5rem 2rem;
    color: var(--ink-faint);
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}
.empty-message a { color: var(--violet); font-weight: 600; }

/* Manage Page */
.manage-section {
    background: var(--surface);
    padding: 1.4rem 1.6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-card);
}
/* Fragment-navigated card (fixes item 42: the events overview's template
   shortcuts land on one specific template card). Same `:target` idiom as
   `.import-exception-group:target` / `.table-scroll tr:target`; the
   scroll-margin keeps the heading clear of the 68px sticky nav, which a bare
   fragment jump would otherwise hide it under. */
.manage-section:target {
    background: var(--violet-soft);
    border-color: var(--violet);
    scroll-margin-top: 84px;
}
.manage-section h2 { margin-bottom: 0.5rem; }
.manage-section p { margin-bottom: 0.75rem; color: var(--ink-soft2); }
.wizard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.wizard-panel {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 1rem;
}
.wizard-panel h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    margin: 0;
}

/* Import wizard step indicator (upload -> review & confirm) */
.import-steps {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.65rem;
    margin: -0.35rem 0 1.1rem;
    font-size: 0.85rem;
    color: var(--ink-faint);
}
.import-step {
    font-weight: 700;
    padding: 0.18rem 0.7rem;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink-faint);
    white-space: nowrap;
}
.import-step.current { background: var(--violet-soft); border-color: var(--violet-line); color: var(--violet); }
.import-step.done { background: var(--green-bg); border-color: #cfe6d4; color: var(--green-fg); }
.import-step-note { font-weight: 600; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.85rem;
    margin: 0.75rem 0 1rem;
}
.dashboard-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow-card);
    text-decoration: none;
    color: var(--ink);
}
.dashboard-card:hover { border-color: var(--violet); }
/* A count > 0 on an actionable card = the teacher has work to do. */
.dashboard-card-action {
    background: var(--green-bg);
    border-color: #9fd0a9;
}
.dashboard-card-action:hover { border-color: var(--green-fg); }
.dashboard-value {
    display: block;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}
.dashboard-label {
    display: block;
    margin-top: 0.35rem;
    color: var(--ink-faint);
    font-size: 0.82rem;
    font-weight: 700;
}
.attention-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.attention-section { margin-bottom: 0; }
.attention-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: baseline;
    margin-bottom: 0.45rem;
}
.attention-head h2 { margin: 0; }
.attention-head a {
    color: var(--violet);
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
}
.attention-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.attention-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.45rem 0;
    border-top: 1px solid var(--line);
}
.attention-list li:first-child { border-top: 0; }
.attention-list a {
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}
.attention-list span,
.attention-empty {
    color: var(--ink-faint);
    font-size: 0.88rem;
}
.advanced-section {
    border-left: 4px solid var(--line);
}
.advanced-section summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--ink);
}
.advanced-section[open] summary { margin-bottom: 0.85rem; }

/* Collapsible per-item sections on the Spirit Wear bulk editor: the page opens
   as a short accordion of headers (name + price + order count) instead of every
   full-roster grid at once. Collapsed grids still submit with the form. */
.bulk-section > summary {
    cursor: pointer;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.bulk-section > summary::marker { color: var(--violet); }
.bulk-section > summary .bulk-section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--ink);
}
.bulk-section > summary .bulk-section-count {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--ink-faint);
    white-space: nowrap;
}
.bulk-section[open] > summary { margin-bottom: 0.75rem; }

.backup-actions {
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
}

.merge-checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.4rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.12s ease;
}
.merge-checkbox-row:hover { background: var(--violet-soft); }

/* Danger Zone */
.danger-zone { border-left: 4px solid var(--danger); }
.danger-zone h2 { color: var(--danger); }
.danger-form { border-left: 4px solid var(--danger); }

/* Secondary action cards under a form (payment edit page): visually distinct
   from the form itself so "save my edits" and "move money" don't read as one
   surface. Fills the container, same as .form. Declared after
   .manage-section/.danger-zone so the accent border-left wins over
   .manage-section's border shorthand. */
.side-action-section {
    margin-top: 1.5rem;
}
.side-action-section h2 { margin-top: 0; margin-bottom: 0.35rem; }
.side-action-note { color: var(--ink-soft2); font-size: 0.85rem; margin-bottom: 0.75rem; }
.credit-action-section {
    border-left: 4px solid var(--gold-bar);
    background: #fffdf6;
}

.wipe-warning {
    background: var(--rose-bg);
    border: 1px solid #ecd6de;
    color: var(--rose-fg);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}
.wipe-warning ul { margin: 0.5rem 0 0.5rem 1.25rem; }
.wipe-warning p { margin-top: 0.5rem; margin-bottom: 0; font-size: 0.9rem; }

#wipe-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Three-column form row */
.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

/* Donation categories picker */
.donation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.4rem 1rem;
}
.donation-grid .checkbox-label { margin-top: 0; }

/* Checkbox label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 0.5rem;
}
.checkbox-label input[type="checkbox"] { width: auto; accent-color: var(--violet); }

/* Row states */
.row-inactive { opacity: 0.55; }
.row-assigned { background-color: #eef6ef; }
.row-balance-due { background-color: #fbf3e1; }
.row-credit { background-color: #eef6ef; }
.row-parent-request { box-shadow: inset 4px 0 0 var(--gold-bar); }
/* Season money dashboard settled/outstanding shading. Deliberately a
   green/rose pair rather than legacy's amber-for-due, unshaded-for-zero:
   the dashboard's whole job is telling paid apart from owing at a glance. */
.row-settled { background-color: #eef6ef; }
.row-outstanding { background-color: #f6e9ee; }

/* Legend */
.legend {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--ink-soft2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.legend-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 1px solid var(--line);
    border-radius: 4px;
}

/* Inactive badge — ink-soft2, not ink-faint2: the faint gray was 2.6:1 on
   this fill, unreadable for low-vision users. */
.badge-inactive {
    background: var(--line-soft);
    color: var(--ink-soft2);
    margin-left: 0.4rem;
}

/* Status badges */
.badge-paid     { background: var(--green-bg); color: var(--green-fg); }
.badge-overpaid { background: var(--green-bg); color: var(--green-fg); }
.badge-partial  { background: var(--amber-bg); color: var(--amber-fg); }
.badge-unpaid   { background: var(--rose-bg);  color: var(--rose-fg); }
.badge-waived   { background: var(--violet-soft); color: var(--violet); }
.charge-progress {
    margin-top: 5px;
    height: 5px;
    width: 120px;
    max-width: 100%;
    background: var(--rose-bg);
    border-radius: 999px;
    overflow: hidden;
}
.charge-progress > span {
    display: block;
    height: 100%;
    background: var(--green-fg);
}
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 1rem;
}
.overview-grid h3, .print-section h3 { margin: 1.25rem 0 0.5rem; }
@media print {
    nav, .no-print, .back-link, .nav-search { display: none !important; }
    main { max-width: 100%; }
    .print-section { border: none; box-shadow: none; padding: 0; }
    a[href]:after { content: ""; }
}
.adjust-charge { margin: 0.5rem 0 1.5rem; }
.adjust-charge > summary { cursor: pointer; font-weight: 600; color: var(--violet); }
.badge-pending  { background: var(--amber-bg); color: var(--amber-fg); }

.parent-request-section { border-left: 4px solid var(--gold-bar); }
/* Collapsed closeout form on a parent-request row */
.close-request { margin-top: 0.4rem; }
.close-request > summary {
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--violet);
    white-space: nowrap;
}
.close-request[open] > summary { margin-bottom: 0.4rem; }
.request-close-form {
    display: grid;
    gap: 0.45rem;
    min-width: 13rem;
}
.request-close-form textarea {
    width: 100%;
    min-height: 4rem;
    resize: vertical;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--input-line);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    background: var(--input-bg);
}
.request-status {
    display: inline-block;
    color: var(--ink-faint);
    font-size: 0.78rem;
    font-weight: 700;
}
.notice-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    margin: 0.75rem 0 1rem;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
}
.notice-warning {
    background: var(--amber-bg);
    border-color: #eedfbf;
    color: var(--amber-fg);
}

/* Table header with multiple action items */
.table-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
/* An action row used on its own rather than inside a .table-header, which is
   where this class normally gets its spacing from. Without this the buttons
   sit flush against the table below them. */
.table-header-actions.standalone {
    margin: 1rem 0 0.85rem;
}

/* File input styling */
input[type="file"] {
    padding: 0.4rem 0;
    font-size: 0.88rem;
    color: var(--ink-soft2);
}
input[type="file"]::file-selector-button {
    margin-right: 0.75rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--violet-line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--violet);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--violet-soft); }

/* Filter Bar */
.filter-bar {
    background: var(--surface);
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 0.85rem;
    box-shadow: var(--shadow-card);
}
.filter-form {
    display: flex;
    align-items: flex-end;
    gap: 0.85rem;
    flex-wrap: wrap;
}
.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.filter-group label {
    font-size: 0.7rem;
    color: var(--ink-faint2);
    margin-bottom: 0.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="number"] {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--input-line);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.filter-group select:focus,
.filter-group input[type="text"]:focus,
.filter-group input[type="number"]:focus {
    outline: none;
    border-color: var(--violet);
    box-shadow: var(--ring);
}
/* Apply/Clear sit side by side. ``.filter-group`` stacks its children so a
   labelled control sits above its input; the actions group has no label, so
   inheriting ``column`` stacked the two buttons instead. Row is the intended
   look on every filter form using the idiom. */
.filter-actions {
    flex-direction: row;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-left: auto;
}

/* ── Summary Bar ── */
.summary-bar {
    display: flex;
    gap: 1rem;
    margin: 1rem 0 0.5rem;
    flex-wrap: wrap;
}
.summary-card {
    flex: 1;
    min-width: 140px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-card);
}
/* Clickable summary cards (parent report): plain-card look, subtle hover cue. */
a.summary-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
a.summary-card-link:hover {
    border-color: var(--violet);
    box-shadow: var(--shadow-card), 0 0 0 1px var(--violet);
}
.summary-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
    margin-top: 0.2rem;
}
.summary-label {
    font-size: 0.82rem;
    color: var(--ink-faint);
    font-weight: 600;
}
.method-summary {
    font-size: 0.88rem;
    color: var(--ink-soft2);
    margin: 0.25rem 0 1rem;
    padding: 0 0.25rem;
}
.method-item { white-space: nowrap; }

/* ── Auth (admin login + parent login) ── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 72px 24px;
}
.auth-card-wrap { width: 400px; max-width: 100%; margin: 1.5rem auto; }
.auth-head { text-align: center; margin-bottom: 1.5rem; }
.auth-logo { width: 54px; height: 54px; font-size: 24px; margin: 0 auto 0.85rem; }
.auth-title { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; }
.auth-sub { color: var(--ink-soft2); font-size: 0.95rem; margin-top: 0.4rem; }
.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 1.75rem;
}
.auth-card-note { text-align: center; }
.auth-card-note p { margin-bottom: 0.5rem; }
.auth-submit { width: 100%; margin-top: 0.25rem; }
.auth-muted { color: var(--ink-faint); font-size: 0.85rem; }
.auth-muted a { color: var(--violet); font-weight: 600; text-decoration: none; }
.auth-help { margin-top: 0.85rem; text-align: center; }

/* ── Parent portal ── */
.portal-report-spaced { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.portal-report-head { margin-bottom: 1.25rem; display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.portal-report-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.portal-student-name { font-family: var(--font-display); font-size: 2.25rem; font-weight: 700; line-height: 1.05; margin: 0.4rem 0 0; }
.portal-section-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; margin: 2rem 0 0.75rem; }
.summary-value-paid { color: var(--green-fg); }
.summary-card-due { background: var(--violet); border-color: var(--violet); box-shadow: var(--shadow-violet); }
.summary-card-due .summary-label { color: var(--violet-soft); }
.summary-card-due .summary-value { color: #fff; }

.portal-footer { border-top: 1px solid var(--line); background: var(--footer-bg); margin-top: 3rem; }
.portal-footer-inner {
    max-width: 1040px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--ink-faint);
}

/* Responsive */
@media (max-width: 640px) {
    /* Compact two-row nav: brand + search on the first row, then the links as a
       single horizontally scrolling strip (instead of a tall vertical stack). */
    .nav-content { height: auto; flex-wrap: wrap; align-items: center; padding: 0.55rem 0; row-gap: 0.3rem; }
    .nav-search { flex: 1 1 auto; margin: 0 0 0 12px; }
    .nav-search input { width: 100%; min-width: 0; }
    .nav-links {
        flex: 1 1 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-links a,
    .nav-links form.nav-logout-form button { white-space: nowrap; }
    h1 { font-size: 1.65rem; }
    .portal-student-name { font-size: 1.75rem; }
    .dashboard-grid,
    .wizard-grid,
    .attention-grid { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .auth-wrap { padding: 36px 18px; }
    main { margin: 1.25rem auto; }
    /* Money first: float the highlighted "Due now" card to the front of the
       summary bar on phones so it isn't the last thing after five others. */
    .summary-bar .summary-card-due { order: -1; }
}

/* ============================================================
   Events & Trips (public parent-site page)
   ============================================================ */

/* sign-out link in the portal nav, set off from the tabs */
.nav-signout {
    padding-left: 14px;
    margin-left: 4px;
    border-left: 1px solid var(--line);
    color: var(--violet);
    font-weight: 600;
}

/* Logout/sign-out are POST forms (CSRF-protected); render the button as a nav link. */
.nav-links form.nav-logout-form { display: inline; margin: 0; }
.nav-links form.nav-logout-form button {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-soft2);
    padding: 0.45rem 0.55rem;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-links form.nav-logout-form button:hover { color: var(--violet); }
/* Portal sign-out keeps its set-off separator + accent color. */
.nav-links form.nav-signout-form { padding-left: 14px; margin-left: 4px; border-left: 1px solid var(--line); }
.nav-links form.nav-signout-form button { color: var(--violet); }

.events-hero {
    background: linear-gradient(180deg, var(--hero-top) 0%, var(--canvas) 100%);
    border-bottom: 1px solid var(--line);
}
.events-hero-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 46px 28px 38px;
}
.events-eyebrow {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--gold);
}
.events-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 46px;
    line-height: 1.05;
    margin: 8px 0 0;
}
.events-sub {
    font-size: 16px;
    color: var(--ink-soft2);
    margin: 10px 0 0;
    max-width: 520px;
}

.events-filterbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(250, 248, 244, 0.94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.events-filterbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.events-filter-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--ink-faint2);
}
.events-chips {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}
.filter-chip {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 15px;
    border-radius: 22px;
    background: var(--surface);
    color: var(--ink-soft);
    border: 1px solid #e2d9cd;
    text-decoration: none;
}
.filter-chip:hover { border-color: var(--violet-line); }
.filter-chip.active {
    background: var(--violet);
    color: #fff;
    border-color: var(--violet);
    box-shadow: 0 2px 6px rgba(91, 58, 140, 0.22);
}

.events-list-wrap {
    max-width: 1000px;
    margin: 0 auto;
    padding: 34px 28px 64px;
}
.events-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.events-empty {
    text-align: center;
    color: var(--ink-faint);
    padding: 40px 0;
    font-size: 15px;
}

.event-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(40, 30, 60, 0.04);
    overflow: hidden;
}
.event-summary {
    display: flex;
    gap: 20px;
    padding: 20px 22px;
    cursor: pointer;
    align-items: center;
    list-style: none;
}
.event-summary::-webkit-details-marker { display: none; }
.event-date-block {
    flex: none;
    width: 62px;
    text-align: center;
    background: var(--violet);
    color: #fff;
    border-radius: 12px;
    padding: 9px 0;
    box-shadow: 0 3px 8px rgba(91, 58, 140, 0.22);
}
.event-date-month {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    opacity: 0.85;
}
.event-date-day {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 28px;
    line-height: 1;
}
.event-summary-main { flex: 1; min-width: 0; }
.event-badges {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 5px;
}
.event-type-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    border-radius: 20px;
    padding: 3px 11px;
    background: var(--violet-soft2);
    color: var(--violet);
}
.event-type-badge.type-field-trip { background: #faf1dd; color: #8a6a1e; }
.event-type-badge.type-festival   { background: #f6e9ee; color: #9a4b6b; }
.event-attendance-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    border-radius: 20px;
    padding: 3px 11px;
    background: var(--violet-soft);
    color: #6b4a9c;
    border: 1px solid #e6dcf3;
}
.event-attendance-badge.att-mandatory { background: #f6e9ee; color: #9a4b6b; border-color: #ecd6de; }
.event-attendance-badge.att-optional  { background: var(--surface-2); color: var(--ink-soft2); border-color: var(--line); }
.event-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 21px;
    line-height: 1.15;
}
.event-meta {
    font-size: 14px;
    color: var(--ink-soft2);
    margin-top: 4px;
}
.event-caret {
    flex: none;
    color: #b8aec6;
    font-weight: 700;
}
.event-caret::before { content: "\25BC"; font-size: 13px; }
.event-card[open] .event-caret::before { content: "\25B2"; }

.event-detail {
    padding: 4px 22px 22px 104px;
    border-top: 1px solid var(--line-soft);
}
.event-note {
    font-size: 14px;
    color: var(--ink-soft);
    margin: 16px 0 18px;
    line-height: 1.5;
}
.event-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 28px;
    max-width: 560px;
}
.event-detail-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 3px;
}
.event-detail-val { font-size: 14px; }
.event-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
    flex-wrap: wrap;
}
.event-slip-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--violet);
    border: 1px solid var(--violet-line);
    border-radius: 9px;
    padding: 9px 16px;
    text-decoration: none;
}
.event-slip-link:hover { background: var(--violet-soft); }

/* Per-student status blocks, chaperone capacity, past-events + subscribe (features #5-8, #16) */
.event-status-blocks {
    margin-top: 16px;
}
.event-student-status {
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--line-soft);
    margin-top: 10px;
}
.event-student-status:first-child { margin-top: 0; }
.event-student-name {
    font-size: 14px;
    font-weight: 700;
}
.event-status-list { margin: 0; }
.event-status-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 6px 0;
}
.event-status-row + .event-status-row {
    border-top: 1px solid var(--line-soft);
}
.event-status-row dt {
    font-size: 13px;
    font-weight: 400;
    color: var(--ink-soft2);
}
.event-status-row dd {
    margin: 0;
    text-align: right;
}
/* "You're signed up" chip in the event card's badge row */
.event-signed-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    border-radius: 20px;
    padding: 3px 11px;
    background: var(--green-bg);
    color: var(--green-fg);
    border: 1px solid #cfe6d4;
}
.chap-capacity {
    margin-top: 12px;
    font-size: 13px;
    color: #555;
    font-weight: 600;
}
.events-past {
    margin-top: 28px;
    border-top: 1px solid var(--violet-line);
    padding-top: 14px;
}
.events-past > summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--violet);
    padding: 6px 0;
    list-style: revert;
}
.events-past[open] > summary { margin-bottom: 14px; }

/* Family (sibling) summary bar on the parent report (#14) */
.family-summary {
    margin-bottom: 26px;
    padding: 18px;
    border: 1px solid var(--violet-line);
    border-radius: 14px;
    background: var(--violet-soft);
}
.family-summary-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.family-summary-cards .summary-card { flex: 1 1 140px; }
.family-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}
.family-chip {
    font-size: 13px;
    font-weight: 600;
    color: var(--violet);
    background: #fff;
    border: 1px solid var(--violet-line);
    border-radius: 999px;
    padding: 6px 14px;
    text-decoration: none;
}
.family-chip:hover { background: var(--violet-soft); }

/* Finance-integrity alert banner on the Money Dashboard (shown when issues exist) */
.integrity-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 14px 18px;
    border: 1px solid var(--rose-fg, #b3261e);
    border-left-width: 5px;
    border-radius: 10px;
    background: var(--rose-bg, #fdecea);
    color: #7a2f2f;
    text-decoration: none;
}
.integrity-alert:hover { filter: brightness(0.98); }
.integrity-alert-icon { font-size: 20px; line-height: 1; }
.integrity-alert-text { flex: 1; }
.integrity-alert-cta { font-weight: 700; white-space: nowrap; }

/* "How to pay" panel on the parent report */
.pay-instructions {
    margin-bottom: 26px;
    padding: 18px;
    border: 1px solid var(--violet-line);
    border-radius: 14px;
    background: var(--violet-soft);
}
.pay-instructions-title {
    margin: 0 0 8px;
    font-size: 18px;
}
.pay-instructions-text {
    margin: 0 0 12px;
    color: #333;
    line-height: 1.5;
}
.parent-note {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    margin-top: 4px;
}

/* Global search (#1) */
.nav-search { margin: 0 12px 0 auto; }
.nav-search input {
    border: 1px solid var(--violet-line);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13px;
    min-width: 180px;
    background: #fff;
}
.search-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1.5rem;
}
.search-card {
    display: block;
    padding: 12px 16px;
    border: 1px solid var(--violet-line);
    border-radius: 12px;
    background: #fff;
    text-decoration: none;
    color: inherit;
}
.search-card:hover { background: var(--violet-soft); }
.search-card-title { font-weight: 600; color: var(--violet); }
.search-card-meta { font-size: 0.82rem; color: #666; margin-top: 3px; }

.event-eligibility-badge {
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    padding: 3px 11px;
    background: var(--violet-soft);
    color: #6b4a9c;
    border: 1px solid #e6dcf3;
}
.event-daterange {
    font-size: 13px;
    font-weight: 600;
    color: var(--violet);
    margin-top: 2px;
}
.event-chaperone-btn {
    font-size: 13px;
    font-weight: 600;
    color: var(--violet);
    background: var(--violet-soft);
    border: 1px solid var(--violet-line);
    border-radius: 9px;
    padding: 9px 16px;
    cursor: pointer;
    font-family: inherit;
}
.event-chaperone-btn:hover { background: #e9e0f5; }

/* Chaperone sign-up dialog (parent events page) */
.chap-dialog {
    border: none;
    border-radius: var(--radius);
    padding: 0;
    max-width: 440px;
    width: calc(100% - 32px);
    box-shadow: var(--shadow);
    color: var(--ink);
}
.chap-dialog::backdrop { background: rgba(40, 30, 60, 0.45); }
.chap-form { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.chap-dialog-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin: 0; }
.chap-dialog-sub { font-size: 13px; color: var(--ink-soft2); margin: 0 0 4px; }
.chap-label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.chap-cap { font-weight: 600; }  /* keeps label text + asterisk together on one line */
.chap-label input,
.chap-label select {
    font-family: inherit;
    font-size: 14px;
    padding: 8px 10px;
    border: 1px solid var(--input-line);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
}
.chap-check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.chap-check input { width: 16px; height: 16px; }
.chap-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.chap-bib-warn {
    margin: 0;
    padding: 9px 12px;
    font-size: 12.5px;
    line-height: 1.4;
    color: #8a5a00;
    background: #fff6e5;
    border: 1px solid #f3d9a0;
    border-radius: var(--radius-sm);
}

/* A parent's own chaperone sign-ups, shown under each event card (1c) */
.chap-mine {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--violet-soft);
    border: 1px solid var(--violet-line);
    border-radius: var(--radius-sm);
}
.chap-mine-title { font-size: 12px; font-weight: 700; color: var(--violet); margin-bottom: 6px; }
.chap-mine-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
}
.chap-mine-info { font-size: 13px; color: var(--ink-soft); }
.chap-mine-actions { display: flex; align-items: center; gap: 6px; }
.chap-mine-del { display: inline; margin: 0; }

@media (max-width: 560px) {
    .events-title { font-size: 34px; }
    .event-detail { padding-left: 22px; }
    .event-detail-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Events: List / Calendar toggle + month calendar
   ============================================================ */
.events-viewtabs {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin: 18px 0 0;
}
.events-print-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--violet);
    text-decoration: none;
    white-space: nowrap;
}
.events-print-link:hover { text-decoration: underline; }
.events-viewtabs-inner {
    display: flex;
    gap: 4px;
    background: #f1ebe1;
    border: 1px solid var(--violet-line);
    border-radius: var(--radius-sm);
    padding: 3px;
}
.events-tab {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-faint);
    border: none;
    font-family: inherit;
}
.events-tab.active {
    background: var(--surface);
    color: var(--violet);
    box-shadow: 0 1px 3px rgba(40, 30, 60, 0.1);
}

.events-cal { padding-top: 18px; }
/* Scroll container around the weekday + day grids (one wrapper so they pan
   together). On phones the grids keep a readable minimum width and scroll
   sideways — 7 columns squeezed into 375px leaves ~19px per event chip,
   which renders titles one letter per line. */
.cal-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.cal-month {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 26px;
    color: var(--ink);
}
.cal-nav-btns { display: flex; gap: 8px; align-items: center; }
.cal-btn {
    cursor: pointer;
    min-width: 38px;
    height: 38px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--violet);
    background: var(--surface);
    border: 1px solid var(--violet-line);
    border-radius: var(--radius-sm);
    font-family: inherit;
}
.cal-btn:hover { background: var(--violet-soft); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-weekdays { margin-bottom: 8px; }
.cal-weekday {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--ink-faint2);
    text-align: center;
}
.cal-cell {
    min-height: 96px;
    min-width: 0;
    background: #fcfaf6;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 7px 8px;
}
.cal-cell-has { background: var(--surface); border-color: var(--violet-line); cursor: pointer; }
.cal-cell-blank { background: transparent; border: none; min-height: 96px; }
.cal-cell-today { box-shadow: 0 0 0 2px var(--gold-bar); }
.cal-daynum { font-size: 13px; font-weight: 500; color: var(--ink-faint2); }
.cal-cell-has .cal-daynum { font-weight: 700; color: var(--violet); }
.cal-chips { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.cal-chip {
    display: block;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    padding: 3px 6px;
    border-radius: 5px;
    border: none;
    font-family: inherit;
    white-space: normal;
    overflow-wrap: anywhere;
}
.cal-chip-draft { opacity: 0.75; border: 1px dashed currentColor; padding: 2px 5px; }
.cal-draft-tag { font-weight: 700; opacity: 0.85; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.cal-legend-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-soft2); }
.cal-legend-swatch { width: 11px; height: 11px; border-radius: 3px; border: 1px solid; display: inline-block; }
.event-flash { animation: eventFlash 1.6s ease; }
@keyframes eventFlash {
    0%, 100% { box-shadow: var(--shadow-card); }
    20%, 60% { box-shadow: 0 0 0 3px var(--gold-bar); }
}
@media (max-width: 640px) {
    .cal-scroll .cal-grid { min-width: 560px; }
    .cal-cell, .cal-cell-blank { min-height: 76px; }
    .cal-grid { gap: 5px; }
    .cal-chip { font-size: 11px; padding: 4px 6px; }
    .cal-month { font-size: 22px; }
}

/* ============================================================
   Modal / popup (cost email chooser, reusable)
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(40, 30, 60, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(40, 30, 60, 0.25);
    padding: 1.5rem 1.75rem;
    max-width: 420px;
    width: 100%;
}
.modal-box h3 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0 0 0.25rem;
    color: var(--ink);
}
.modal-box p { color: var(--ink-soft2); font-size: 0.9rem; margin: 0 0 1.1rem; }
.modal-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}
.btn-link {
    background: none;
    border: none;
    color: var(--ink-soft2);
    cursor: pointer;
    font: inherit;
    padding: 0.4rem 0.5rem;
}
.btn-link:hover { color: var(--ink); text-decoration: underline; }


/* ============================================================
   Rebuilt-application extras (no legacy counterpart)
   ============================================================ */

/* Skip link (accessibility; visually hidden until focused) */
.skip-link {
    position: fixed;
    z-index: 100;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.6rem 0.85rem;
    color: #fff;
    background: var(--violet);
    border-radius: var(--radius-sm);
    transform: translateY(-160%);
}
.skip-link:focus { color: #fff; transform: translateY(0); }

/* Flash stack wrapper used by the shared flashes component. */
.flash-stack { margin-bottom: 1rem; }
.flash-stack .flash:last-child { margin-bottom: 0; }

/* WTForms field validation (shared ui.field macro) */
.field-help {
    margin: 0.3rem 0 0;
    font-size: 0.8rem;
    color: var(--ink-soft2);
}
.field-errors {
    list-style: none;
    margin: 0.35rem 0 0;
    padding: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--danger);
}
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea { border-color: var(--danger); }
/* Prominence (fixes item 39): an invalid control's own red border is easy to
   miss on a long form, so the errored row also carries a left accent and a
   red label. Amplifies the existing `has-error` class rather than adding a
   second one — `data-error-group` beside it is the scroll/focus marker only.
   `.form-fieldset.has-error` covers the hand-rendered radio groups, whose
   group element is a fieldset rather than a `.form-group`. */
.form-group.has-error,
.form-fieldset.has-error {
    border-left: 3px solid var(--danger);
    padding-left: 0.7rem;
}
.form-group.has-error > label,
.form-fieldset.has-error > legend { color: var(--danger); }

/* Pagination controls (capped page/per_page views) */
.pager {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: -0.5rem 0 1.5rem;
    font-size: 0.85rem;
}
.pager .muted { color: var(--ink-faint); }
.muted { color: var(--ink-faint); }

/* Empty state (shared ui.empty macro) — matches the legacy .empty-message. */
.empty-state {
    text-align: center;
    padding: 2.5rem 2rem;
    color: var(--ink-faint);
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    margin-bottom: 1.5rem;
}
.empty-state h2 { margin-bottom: 0.35rem; }
.empty-state p { margin: 0; }

/* Status badges emitted by the shared status() macro. Tones follow the
   legacy paid/partial/unpaid palette; unlisted statuses fall back to violet. */
.badge[class*="status-"] { background: var(--violet-soft); color: var(--violet); }
.badge.status-open,
.badge.status-committed,
.badge.status-paid,
.badge.status-published,
.badge.status-active,
.badge.status-finalized,
.badge.status-satisfied { background: var(--green-bg); color: var(--green-fg); }
.badge.status-draft,
.badge.status-staged,
.badge.status-in-review,
.badge.status-pending,
.badge.status-partial,
.badge.status-partially-satisfied,
.badge.status-needs-review { background: var(--amber-bg); color: var(--amber-fg); }
.badge.status-closed,
.badge.status-reversed,
.badge.status-cancelled,
.badge.status-canceled,
.badge.status-unpaid,
.badge.status-outstanding,
.badge.status-excluded { background: var(--rose-bg); color: var(--rose-fg); }
/* The two settled-but-unpaid charge states: `removed` is the durable removal
   flag, `waived` is a hand adjustment down to nothing. The violet fallback
   above already yields this — pinned so a change to that fallback cannot
   silently recolor either, and so both stay visibly matched to .badge-waived,
   which the templates use directly. They share a colour deliberately: the
   distinction is in the word, not the hue. */
.badge.status-removed,
.badge.status-waived { background: var(--violet-soft); color: var(--violet); }

/* Administrator page-ID badge (?pageids=on). */
.page-id-badge {
  position: fixed;
  bottom: 10px;
  left: 10px;
  z-index: 9999;
  padding: 6px 9px;
  border-radius: 7px;
  background: var(--violet);
  color: #fff;
  font: 600 11px/1.2 ui-monospace, Menlo, Consolas, monospace;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
  pointer-events: none;
  user-select: all;
}

/* ── Spirit Wear grids ──
   Director's size color code from the legacy app: colored column headers
   (.sw-size-* on th) with a lighter tint on body cells (.sw-size-* on td).
   Variant names outside the canonical size list get no class and render
   uncolored. CSP forbids inline style=, so the colors live here. */
th.sw-size-youth-medium { background: #9fd8d4; color: #333; }
td.sw-size-youth-medium { background: #e6f6f5; }
th.sw-size-s  { background: #f2afa5; color: #333; }
td.sw-size-s  { background: #fdeae7; }
th.sw-size-m  { background: #f8cd97; color: #333; }
td.sw-size-m  { background: #fdf1e0; }
th.sw-size-l  { background: #f7e79b; color: #333; }
td.sw-size-l  { background: #fdf9e3; }
th.sw-size-xl { background: #a9d8ad; color: #333; }
td.sw-size-xl { background: #e9f5ea; }
th.sw-size-2x { background: #a5c9f2; color: #333; }
td.sw-size-2x { background: #e6f0fb; }
th.sw-size-3x { background: #d3b3e8; color: #333; }
td.sw-size-3x { background: #f2e9f8; }

/* Legend chips on the bulk page mirror the header colors. */
.sw-legend {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 0.5rem 0 1rem;
    font-size: 0.85rem;
}
.sw-chip {
    display: inline-block;
    padding: 2px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #333;
}
.sw-chip.sw-size-youth-medium { background: #9fd8d4; }
.sw-chip.sw-size-s  { background: #f2afa5; }
.sw-chip.sw-size-m  { background: #f8cd97; }
.sw-chip.sw-size-l  { background: #f7e79b; }
.sw-chip.sw-size-xl { background: #a9d8ad; }
.sw-chip.sw-size-2x { background: #a5c9f2; }
.sw-chip.sw-size-3x { background: #d3b3e8; }

/* Catalog item card header: name/price/inactive badge on the left, Delete
   button pinned right — reuses .table-header's flex/space-between. */
.sw-item-head { margin-bottom: 1rem; }

/* Catalog edit/add-item field row (legacy spirit_wear_items.html layout,
   ported without inline styles). */
.sw-item-fields {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
/* The cards use .form-group labels (the app's form idiom) inside that flex
   row; .form-group's 100%-width inputs and 1rem bottom margin would blow the
   row apart, so they are pinned back here. The .sw-price/.sw-qty widths are
   restated rather than inherited: these selectors outrank the bare
   `input.sw-price` rules below on specificity, so leaving them out would make
   every field the same default width and wrap the row. */
.sw-item-fields .form-group { margin-bottom: 0; }
.sw-item-fields .form-group select { width: auto; }
.sw-item-fields .form-group input { width: 14rem; }
.sw-item-fields .form-group input.sw-price { width: 5.5rem; }
.sw-item-fields .form-group input.sw-qty { width: 3.4rem; }

/* Rollup size tables: equal fixed-width columns so they line up across the
   page regardless of how many sizes an item happens to show. Headers wrap
   to two lines ("Youth Medium") instead of forcing a wide min-width that
   caused horizontal scrolling at the page's 1040px content width. */
table.sw-size-table { table-layout: fixed; }

/* Bulk grid: student names stay on one line (legacy behavior) — the size
   columns squeeze the name column, and wrapped names inflate row heights. */
td.sw-student { white-space: nowrap; }

/* Bulk-edit accordions (native <details>; collapsed sections still save). */
.bulk-section > summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--violet);
    padding: 4px 0;
    list-style: revert;
}
.bulk-section[open] > summary { margin-bottom: 0.75rem; }
.summary-count {
    font-weight: 400;
    color: var(--ink-faint);
    font-size: 0.9rem;
}
.summary-value-note {
    font-weight: 600;
    margin-top: 0.2rem;
}

/* Alignment utilities replacing the legacy inline text-align styles. */
th.cell-right, td.cell-right { text-align: right; }
th.cell-center, td.cell-center { text-align: center; }

/* Preserve line breaks in free-text fields rendered as prose (replaces inline white-space styles). */
.pre-line { white-space: pre-line; }

/* Narrow quantity inputs inside the size grids (legacy used inline widths). */
input.sw-qty {
    width: 3.4rem;
    text-align: center;
}
/* Wider than sw-qty — dollar amounts need room for "0.00". */
input.sw-price {
    width: 5.5rem;
    text-align: center;
}
input.sw-note {
    width: 9rem;
}
.sw-item-inactive { opacity: 0.65; }
.sw-unit-line { font-size: 0.85rem; }
.sw-note { color: var(--ink-faint); font-size: 0.85rem; }

/* ============================================================
   Payment import: exception-first job review (job.html)
   ============================================================ */

/* Exceptions / All rows tabs. */
.import-review-tabs {
    display: flex;
    gap: 4px;
    margin: 0 0 1.1rem;
    background: #f1ebe1;
    border: 1px solid var(--violet-line);
    border-radius: var(--radius-sm);
    padding: 3px;
    width: fit-content;
}
.import-review-tab {
    padding: 0.4rem 0.9rem;
    border-radius: 7px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--ink-soft2);
    text-decoration: none;
    white-space: nowrap;
}
.import-review-tab.active { background: var(--surface); color: var(--violet); box-shadow: var(--shadow-card); }
.import-review-tab:not(.active):hover { color: var(--violet); }

/* All-rows per-row form: when the Decision select is "Skip", site.js flags
   the skip-reason form-group so the label announces the requirement before
   the administrator submits (the command and DB both reject a blank one). */
.skip-reason-required label::after {
    content: " — required when skipping";
    color: var(--violet);
    font-weight: 700;
}
.skip-reason-required input {
    border-color: var(--gold-bar);
}

/* One exception-group card (safe/ambiguous/missing student names, or a
   classification description) inside its section. */
.import-exception-group {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    padding: 1rem 1.1rem;
    margin-bottom: 0.9rem;
}
.import-exception-group:last-child { margin-bottom: 0; }
.import-exception-group:target {
    border-color: var(--gold-bar);
    box-shadow: 0 0 0 3px rgba(199, 154, 59, 0.25);
}
.import-exception-summary {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.import-exception-summary strong {
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: var(--ink);
    overflow-wrap: anywhere;
}

/* Case/punctuation variant descriptions or payer-name samples within a group. */
.import-variant-list {
    margin: 0 0 0.6rem;
    padding-left: 1.1rem;
    font-size: 0.85rem;
    color: var(--ink-soft2);
}
.import-variant-list li { margin-bottom: 0.15rem; }

/* Rule edit page: the unapplied-receipt count and the catch-up sweep button
   read as one statement-plus-action, so they share a row and wrap together
   rather than the button drifting off as a separate block. */
.sweep-preview {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-bottom: 1rem;
}
.sweep-preview p { margin: 0; }

/* The member rows of a student-match group, listed inside the group card so a
   row can be skipped without detouring to All rows. Plain rules rather than
   the page-level table chrome — this is a list inside a card, not a table the
   card contains. */
.import-group-rows {
    width: 100%;
    margin-bottom: 0.7rem;
    font-size: 0.85rem;
    border-collapse: collapse;
}
.import-group-rows td {
    padding: 0.35rem 0.5rem 0.35rem 0;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.import-group-rows tr:last-child td { border-bottom: none; }

/* Section 9.4/9.5 ambiguity and missing-name warnings. */
.import-ambiguity-warning {
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.6rem;
    background: var(--rose-bg);
    color: var(--rose-fg);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
}
/* Section 9.6 inactive/out-of-season exact-name context: informative, not a
   hard stop, so it stays visually distinct from the ambiguity warning. */
.import-inactive-match-warning {
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.6rem;
    background: var(--amber-bg);
    color: var(--amber-fg);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* Bulk-match / apply-rule / create-rule / accept-direct action forms stacked
   inside a classification group's card. */
.import-exception-actions {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.import-exception-actions > form,
.import-exception-actions > details,
.import-exception-actions > .import-choice-row {
    border-top: 1px solid var(--line-soft);
    padding-top: 0.85rem;
}
.import-exception-actions > form:first-child,
.import-exception-actions > details:first-child,
.import-exception-actions > .import-choice-row:first-child { border-top: none; padding-top: 0; }

/* Row/cents impact line shown above every group action's submit button. */
.import-impact {
    font-size: 0.8rem;
    color: var(--ink-faint);
    margin: 0.4rem 0 0.6rem;
}

/* Stage 3: the classification card's permanent-vs-one-time choice, rendered
   as two labeled boxes side by side instead of a <details> disclosure plus
   a bare secondary form. */
.import-choice-row {
    display: flex;
    align-items: stretch;
    gap: 1rem;
}
.import-choice {
    flex: 1 1 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    padding: 0.9rem 1rem;
}
.import-choice-permanent { border-left: 3px solid var(--violet); }
.import-choice-once { border-left: 3px solid var(--line); }
.import-choice-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--ink);
    margin: 0 0 0.3rem;
}
.import-choice-desc {
    font-size: 0.82rem;
    color: var(--ink-soft2);
    margin: 0 0 0.75rem;
}

/* Read-only display of the exact imported text a created rule will match
   (Finding 8(a)/Stage 3: never an editable input). */
.import-canonical-text {
    padding: 0.55rem 0.7rem;
    background: var(--surface-2);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--ink);
    word-break: break-word;
}

/* Section 9.7/10.6 "remember permanently" copy and the destination-change
   confirmation checkbox: call out that these are deliberate, sticky choices. */
.import-permanent-choice {
    font-size: 0.82rem;
    color: var(--ink-soft2);
}
.checkbox-group.import-permanent-choice { margin: 0.6rem 0; }

.import-filtered-link {
    display: inline-block;
    margin-top: 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--violet);
    text-decoration: none;
}
.import-filtered-link:hover { text-decoration: underline; }

.import-exception-summary-bar { margin: 0 0 0.5rem; }

/* All rows: the row a group action or a filtered link points at. */
.table-scroll tr:target { background: var(--violet-soft); }

@media (max-width: 390px) {
    .import-review-tabs { width: 100%; }
    .import-review-tab { flex: 1 1 auto; text-align: center; }
    .import-exception-summary { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
    .import-exception-group { padding: 0.85rem; }
    /* Only the All rows table scrolls horizontally on a narrow screen; every
       exception-group card and its forms stay in normal document flow. */
    .import-exception-actions form .form-row,
    .import-exception-actions form .form-row-3 { grid-template-columns: 1fr; }
    .import-choice-row { flex-direction: column; }
}
