/* cache-bust: 2026-08-14 import create-path hardening (isolation, pending numbering, failed count) */
/* ──────────────────────────────────────────────────────────────
   Design tokens (P0 — "manuscript / scholarly" direction).
   All new work and migrations key off these variables; avoid
   hardcoding hexes in templates. Financial semantics (due / clear)
   are intentionally unchanged. See AGENTS.md §4 + the frontend
   review note in planning/.
   ────────────────────────────────────────────────────────────── */
:root {
    /* canvas + structure */
    --bg: #f4f1e9;            /* parchment (was #f5f5f5) */
    --surface: #fffdf8;       /* card / panel, warm white (was #fff) */
    --surface-2: #f6f3ea;     /* subtle inset panel (was #f8fafc) */
    --ink: #20283d;           /* primary text (was #333) */
    --ink-muted: #6b6f7a;     /* secondary text (was #666/#888/#64748b) */
    --ink-faint: #9aa0ac;     /* tertiary text (was #999/#94a3b8) */
    --line: #e7e1d4;          /* hairlines (was #ddd/#eee/#e5e7eb/#e2e8f0) */

    /* brand + accent */
    --brand: #283655;         /* ink-indigo — primary actions, links */
    --brand-hover: #1c2740;
    --brand-soft: #eef1f7;    /* tinted primary backgrounds (was #eff6ff) */
    --sidebar-bg: #20283d;
    --accent: #b45309;        /* marigold — active nav, sparing highlights */
    --accent-soft: #fdf6ec;

    /* financial + feature semantics (values unchanged on purpose) */
    --due: #dc2626;   --due-bg: #fef2f2;  --due-border: #fca5a5;
    --clear: #16a34a; --clear-bg: #f0fdf4; --clear-border: #bbf7d0;
    --remind: #7c3aed; --remind-bg: #faf5ff; --remind-border: #e9d5ff;

    /* system */
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(32,40,61,.06);
    --shadow: 0 1px 2px rgba(32,40,61,.04), 0 6px 18px rgba(32,40,61,.07);
    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--bg); color: var(--ink); }

/* Header */
.header { background: var(--surface); color: var(--ink); padding: 12px 16px; position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.header h1 { font-size: 20px; font-family: var(--font-display); font-weight: 600; letter-spacing: 0.01em; }

/* Hamburger toggle (mobile only) */
.sidebar-toggle { display: none; background: none; border: none; color: var(--ink); font-size: 22px; cursor: pointer; padding: 4px 8px; }

/* Layout: sidebar + content */
.layout { display: flex; min-height: calc(100vh - 48px); }

/* Sidebar */
.sidebar {
    width: 200px;
    min-width: 200px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    position: sticky;
    top: 48px;
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    overflow-y: auto;
    z-index: 15;
}
.sidebar a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 12px 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}
.sidebar a:hover {
    background: rgba(255,255,255,0.06);
    color: #f1f5f9;
}
.sidebar a.active {
    background: rgba(180,83,9,0.16);
    color: #f0b366;
    border-left-color: var(--accent);
    font-weight: 600;
}

/* Sidebar user section (bottom) */
.sidebar-spacer { flex: 1; }

/* Email-remove button on add/edit forms.
   - Sits on the LEFT of the row (order:-1 in the flex container).
   - Red by default so the destructive intent is unmistakable.
   - Deeper red on hover/focus.
   - 36×36 hit target so phones can land taps reliably.
   - JS handler asks for confirmation before deleting a non-empty
     email (see template scripts). */
.email-remove {
    order: -1; /* moves to the start of the flex row */
    flex: 0 0 auto;
    width: 36px; height: 36px;
    border: 1px solid #fecaca;
    background: #fee2e2;
    border-radius: 8px;
    cursor: pointer;
    color: #b91c1c;
    font-size: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    padding: 0;
    margin-right: 2px;
}
.email-remove:hover, .email-remove:focus {
    background: #fecaca;
    color: #7f1d1d;
    border-color: #fca5a5;
    outline: none;
}
.email-remove:active { transform: scale(0.94); }

/* Section labels group related links (e.g. Messaging → Compose, Outbox).
   Quiet caps-style header; the entries underneath get a small inset so
   the grouping reads visually. */
.sidebar-section {
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 20px 4px;
}
.sidebar a.sidebar-sub {
    padding-left: 32px;
    font-size: 13px;
}
.sidebar-user {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 0;
    cursor: pointer;
    user-select: none;
    display: flex;
    flex-direction: column;
}
.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}
.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.sidebar-user-name { color: #f1f5f9; font-size: 13px; font-weight: 600; }
.sidebar-user-role { color: #94a3b8; font-size: 11px; text-transform: capitalize; }
.sidebar-user-arrow {
    margin-left: auto;
    color: #94a3b8;
    font-size: 12px;
    transition: transform 0.2s;
}
.sidebar-user.open .sidebar-user-arrow { transform: rotate(90deg); }
.sidebar-user-menu {
    display: none;
    flex-direction: column;
    background: rgba(0,0,0,0.15);
    order: -1;
}
.sidebar-user.open .sidebar-user-menu { display: flex; }
.sidebar-user-menu a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 10px 20px 10px 58px;
    font-size: 13px;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}
.sidebar-user-menu a:hover {
    background: rgba(255,255,255,0.06);
    color: #f1f5f9;
}

/* Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 14;
}

/* Content area */
.content {
    flex: 1;
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* Opt-in wide column, for pages that are genuinely tabular rather than
   readable prose. The import page's 4-line grid is ~970px, so the 700px
   reading column squeezed it into a sideways scroll on a desktop window.
   Declared BEFORE the mobile override below so full-width still wins there. */
.content-wide { max-width: 1600px; }

/* Mobile: sidebar off-canvas */
@media (max-width: 768px) {
    .sidebar-toggle { display: block; }
    .sidebar {
        position: fixed;
        top: 48px;
        left: -220px;
        width: 220px;
        min-width: 220px;
        height: calc(100vh - 48px);
        height: calc(100dvh - 48px);
        transition: left 0.25s ease;
        box-shadow: 4px 0 16px rgba(0,0,0,0.2);
    }
    body.sidebar-open .sidebar { left: 0; }
    body.sidebar-open .sidebar-overlay { display: block; }
    .content { max-width: 100%; }
}

/* Search bar */
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.search-bar input { flex: 1; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; background: var(--surface); color: var(--ink); }
.search-bar button { padding: 10px 16px; background: var(--brand); color: white; border: none; border-radius: 8px; font-size: 16px; cursor: pointer; }

/* Filter & Sort toolbar */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.filter-pills { display: flex; gap: 4px; }
.filter-pill { padding: 5px 10px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; cursor: pointer; color: var(--ink-muted); transition: all 0.15s; }
.filter-pill span { font-weight: 700; }
.filter-pill:hover { border-color: var(--brand); color: var(--brand); }
.filter-pill.active { background: var(--brand); color: white; border-color: var(--brand); }
.toolbar-selects { display: flex; gap: 6px; flex-wrap: wrap; }
.toolbar-select { padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; color: var(--ink); cursor: pointer; }
.toolbar-select:focus { outline: none; border-color: var(--brand); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card h3 { font-size: 17px; margin-bottom: 4px; font-family: var(--font-display); font-weight: 600; }
.card .meta { font-size: 13px; color: var(--ink-muted); margin-bottom: 4px; }
.card .subjects { font-size: 13px; color: var(--brand); }
.card .student-id { font-size: 12px; color: var(--ink-faint); font-family: monospace; font-variant-numeric: tabular-nums; }
.card .actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.card .balance { font-size: 14px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.balance-due { color: var(--due); }
.balance-clear { color: var(--clear); }

/* Compact student cards */
.card-compact { padding: 10px 14px; margin-bottom: 8px; }
.card-compact h3 { font-size: 15px; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-family: var(--font-display); font-weight: 600; }
.card-row-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-name-block { flex: 1; min-width: 0; }
.dues-col { flex-shrink: 0; font-size: 13px; font-weight: 700; text-align: right; max-width: 48%; }
/* board·school + phone share one line — snug on desktop; phone jumps to the
   right edge on phones (see the 480px block). */
.card-contact-line { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card-contact-line .cc-school { min-width: 0; }
.card-contact-line .cc-phone { flex-shrink: 0; }
.card-meta-line { font-size: 12px; color: var(--ink-muted); line-height: 1.5; word-break: break-word; }
.card-balance { font-size: 14px; font-weight: 700; white-space: nowrap; padding-top: 2px; font-variant-numeric: tabular-nums; }
.card-balance-btn { font-size: 14px; font-weight: 700; white-space: nowrap; padding: 4px 10px; border-radius: 8px; text-decoration: none; transition: background 0.15s; display: inline-block; font-variant-numeric: tabular-nums; }
.card-balance-btn.balance-due { color: var(--due); background: var(--due-bg); border: 1px solid var(--due-border); }
.card-balance-btn.balance-due:hover { background: #fee2e2; }
.card-balance-btn.balance-clear { color: var(--clear); background: var(--clear-bg); border: 1px solid var(--clear-border); }
.card-balance-btn.balance-clear:hover { background: #dcfce7; }
.card-actions-compact { display: flex; gap: 4px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.card-actions-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); margin-left: 62px; }
@media (max-width: 480px) { .card-actions-row { margin-left: 0; } }
.badge-checked-in { background: #dbeafe; color: #1d4ed8; }
/* Inactive student: the whole card carries it (no status word) */
.card-inactive { background: #fbf1ef; border-color: var(--due-border); box-shadow: none; }
.card-inactive .card-name-block a, .card-inactive .card-meta-line { color: #9a8f8c; }
/* Clickable phone number (card, and reused app-wide later) */
.phone-link { color: #1d4ed8; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; white-space: nowrap; }
/* Unbilled-months inline expander (R2b) */
.unbilled-toggle { background: var(--remind-bg); color: var(--remind); border: 1px solid var(--remind-border); font-weight: 700; cursor: pointer; }
.unbilled-caret { font-size: 10px; }
.unbilled-panel { margin: 6px 0 2px; padding: 8px 10px; background: var(--remind-bg); border: 1px solid var(--remind-border); border-radius: 8px; }
.unbilled-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--remind-border); }
.unbilled-title { font-weight: 700; color: var(--remind); font-size: 13px; }
.unbilled-sub { display: block; font-size: 11px; color: var(--ink-muted); font-weight: 400; margin-top: 1px; }
.unbilled-hide { background: none; border: none; color: var(--remind); font-weight: 700; font-size: 12px; cursor: pointer; padding: 2px 4px; white-space: nowrap; }
.unbilled-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; }
.unbilled-row + .unbilled-row { border-top: 1px dashed var(--remind-border); }
.unbilled-mon { font-size: 13px; font-weight: 600; color: var(--ink); }
.unbilled-foot { font-size: 11px; color: var(--ink-muted); margin-top: 6px; }
.unbilled-foot a { color: var(--brand); }

/* Pill buttons (compact with short text labels) */
.pill { display: inline-flex; align-items: center; gap: 2px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 12px; text-decoration: none; color: var(--ink); transition: background 0.15s; white-space: nowrap; line-height: 1.3; }
.pill:hover { background: var(--surface-2); }
.pill-primary { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.pill-primary:hover { background: #e2e7f1; }
.pill-danger { border-color: var(--due-border); color: var(--due); background: var(--due-bg); }
.pill-danger:hover { background: #fee2e2; }
.pill-green { border-color: var(--clear-border); color: var(--clear); background: var(--clear-bg); }
.pill-green:hover { background: #dcfce7; }

/* Quick modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: white; border-radius: 12px; padding: 24px; width: 100%; max-width: 380px; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 8px 30px rgba(0,0,0,0.2); }
.modal-box h3 { font-size: 16px; margin-bottom: 16px; font-family: var(--font-display); font-weight: 600; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-active { background: var(--clear-bg); color: #166534; }
.badge-inactive { background: var(--due-bg); color: #991b1b; }

/* Buttons */
.btn { padding: 8px 16px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-danger { background: var(--due); color: white; }
.btn-outline { background: var(--surface); color: var(--brand); border: 1px solid var(--brand); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* FAB */
.fab { position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px; background: var(--accent); color: white; border: none; border-radius: 50%; font-size: 28px; cursor: pointer; box-shadow: 0 6px 16px rgba(180,83,9,0.4); z-index: 10; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.form-group input, .form-group select { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; background: var(--surface); color: var(--ink); }
.form-group input:focus, .form-group select:focus, .search-bar input:focus, .search-wrap > input:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(40,54,85,0.14);
}
/* Checkboxes/radios inside .form-group are sized for inline rows;
   the 100%-width rule above is for text fields, not toggles. */
.form-group input[type="checkbox"], .form-group input[type="radio"] {
    width: auto; padding: 0; border: 0; margin: 0;
    flex: 0 0 auto;
}
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-group label { font-weight: normal; display: flex; align-items: center; gap: 4px; font-size: 14px; }
.checkbox-all { font-weight: 600 !important; color: #2563eb; }

/* Misc */
.empty { text-align: center; padding: 40px 16px; color: var(--ink-faint); }
.back-link { display: inline-block; margin-bottom: 16px; color: var(--brand); text-decoration: none; font-size: 14px; }
.count { font-size: 13px; color: var(--ink-muted); margin-bottom: 12px; }
.readonly-field { background: var(--surface-2) !important; color: var(--ink-muted); }

/* Login (no sidebar, centered) */
.login-container { max-width: 360px; margin: 80px auto; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 24px; box-shadow: var(--shadow); }
.login-card h2 { text-align: center; margin-bottom: 24px; color: var(--brand); font-family: var(--font-display); font-weight: 600; }
.error { background: var(--due-bg); color: #991b1b; padding: 10px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; text-align: center; }

/* Container (for non-logged-in pages like login) */
.container { max-width: 600px; margin: 0 auto; padding: 16px; }

/* Hide FAB behind sidebar overlay on mobile */
body.sidebar-open .fab { z-index: 5; }

@media (max-width: 480px) {
    /* Stack, and stretch each row to full width so right-aligned content can
       reach the card's right edge (align-items defaults to flex-start above,
       which would shrink each block to its content width). */
    .card-row-top { flex-direction: column; align-items: stretch; }
    .card-row-top > div:last-child { width: 100%; max-width: none; }
    .card-row-top > div:last-child > div:first-child { flex-wrap: wrap; }
    /* Phone jumps to the card's right edge, on the same line as board·school
       (no standalone phone line / dead space). School truncates if long so the
       phone always fits. Dues sit right below, also right-aligned. */
    .card-contact-line { flex-wrap: nowrap; justify-content: space-between; }
    .card-contact-line .cc-school { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ── Clearable search bars ──
   A small ✕ appears at the right of a search input whenever it has
   text; clicking it (handled in base.html / base_library.html) clears
   the input and re-runs its input listener. Visibility is pure-CSS via
   :not(:placeholder-shown), so no per-keystroke JS is needed. Markup:
   <div class="search-wrap"><input placeholder="…"><button class="search-clear">✕</button></div> */
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap > input { flex: 1; padding-right: 32px; }
.search-clear {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    border: none; background: transparent; cursor: pointer;
    color: #9ca3af; font-size: 18px; line-height: 1; padding: 0 5px;
    border-radius: 50%; display: none;
}
.search-clear:hover { color: #4b5563; background: #f1f5f9; }
.search-wrap > input:not(:placeholder-shown) + .search-clear { display: block; }
.search-wrap > input:not(:placeholder-shown) ~ .search-icon { display: none; }

/* Shared month/year picker (templates/_month_picker.html) — used on the
   salary and staff-attendance pages. 2026-07-11. */
.year-pill, .month-cell {
    display: inline-block; text-align: center; padding: 6px 10px; border-radius: 8px;
    border: 1px solid #ddd; background: #fff; color: #333; font-size: 13px;
    text-decoration: none; cursor: pointer;
}
.month-cell { padding: 8px 0; }
.year-pill.active, .month-cell.active { background: #2563eb; color: #fff; border-color: #2563eb; font-weight: 700; }
.year-pill:hover, .month-cell:hover { border-color: #2563eb; }
.month-cell.disabled { opacity: 0.35; cursor: default; pointer-events: none; background: #f8f8f8; }
.step-arrow { text-decoration: none; }
.step-arrow.disabled { opacity: 0.35; pointer-events: none; }

/* ──────────────────────────────────────────────────────────────
   Sticker sheet (templates/sticker_sheet.html) — 2026-08-19.
   The grid deliberately mirrors the physical pre-cut A4: 2 x 4,
   NO gaps between cells (the real sheet has none), and each cell
   carries the true 105 : 74.25 landscape aspect so what the owner
   clicks matches what they peel.
   ────────────────────────────────────────────────────────────── */
.sheet-layout {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 24px; align-items: start; margin-top: 14px;
}
@media (max-width: 860px) { .sheet-layout { grid-template-columns: 1fr; } }

.warn-strip {
    background: var(--accent-soft); border: 1px solid var(--accent);
    border-left-width: 4px; border-radius: 6px;
    padding: 8px 12px; margin: 12px 0 0; font-size: 14px; color: var(--ink);
}

/* Multi-author chips (static/library/author_chips.js). Lives in the SHARED
   sheet, not library.css: the import page loads only this one, and the chips
   are now the same component on every page that takes an author. */
.author-tag {
    display: inline-flex; align-items: center; gap: 4px;
    background: #e0e7ff; color: #3730a3;
    padding: 3px 8px; border-radius: 12px; font-size: 13px; font-weight: 500;
}
.author-tag button {
    background: none; border: none; cursor: pointer; color: #6366f1;
    font-size: 14px; padding: 0 2px; line-height: 1;
}
.author-chips-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.author-chips-row { display: flex; gap: 4px; }
.author-chips-input { flex: 1; min-width: 0; }

.sheet-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0;
    background: #fff; border: 1px solid var(--ink-faint);
    max-width: 420px;
}

.sheet-slot {
    aspect-ratio: 105 / 74.25;
    position: relative; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    padding: 6px; text-align: center; cursor: pointer;
    background: transparent; color: var(--ink-faint);
    border: 1px dashed var(--line); font: inherit; font-size: 12px;
}
.sheet-slot:hover { background: var(--surface-2); }
.sheet-slot.armed {
    border: 2px solid var(--accent); background: var(--accent-soft);
    color: var(--accent);
}
.sheet-slot.filled {
    border-style: solid; border-color: var(--brand);
    background: var(--brand-soft); color: var(--ink);
}
.sheet-slot-no {
    position: absolute; top: 3px; left: 5px;
    font-size: 10px; color: var(--ink-faint);
}
.sheet-slot-body { font-weight: 600; line-height: 1.25; word-break: break-word; }
.sheet-slot-sub { font-size: 10px; font-weight: 400; color: var(--ink-muted); }
.sheet-slot-clear {
    position: absolute; top: 2px; right: 3px;
    border: 0; background: transparent; cursor: pointer;
    color: var(--ink-faint); font-size: 13px; line-height: 1; padding: 2px 4px;
}
.sheet-slot-clear:hover { color: var(--due); }

/* Sticker sheet — peeled slots and selected-person feedback. 2026-08-20.
   A peeled slot is struck through, not merely dimmed: "already gone" must be
   unmistakable, because printing onto bare backing wastes the run. */
.sheet-slot.peeled {
    background: repeating-linear-gradient(
        45deg, var(--surface-2), var(--surface-2) 5px, var(--line) 5px, var(--line) 6px);
    border-style: solid; border-color: var(--ink-faint);
    color: var(--ink-muted); text-decoration: line-through;
}
.sheet-slot.peeled:hover { opacity: 0.8; }

/* Drag-select preview (import page, 2026-08-23). Press a slot and drag: the
   whole reading-order run between anchor and pointer shows what releasing
   would do. Nothing is committed until the pointer is released, so the
   preview must be clearly distinct from the settled `peeled` state. */
.sheet-grid { touch-action: none; }   /* a drag must not scroll the page */
.sheet-slot.peel-preview {
    outline: 2px dashed var(--ink-muted); outline-offset: -3px;
    background: var(--surface-2); opacity: 0.75;
}
.sheet-slot.peel-preview-off {
    outline: 2px dashed var(--brand); outline-offset: -3px;
    background: transparent; text-decoration: none; opacity: 0.75;
}
.pill.stk-picked {
    background: var(--brand); color: #fff; border-color: var(--brand);
}

/* Sticker sheet — sheet navigation. 2026-08-20. */
.sheet-nav {
    display: flex; align-items: center; gap: 10px; margin-bottom: 4px;
}
.sheet-nav .btn { padding: 2px 10px; line-height: 1.6; }

/* ──────────────────────────────────────────────────────────────
   Day views — collections on a date, attendance register. 2026-08-20.
   Shared by templates/_date_picker.html and both day pages.
   ────────────────────────────────────────────────────────────── */
.day-picker {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin: 10px 0 14px;
}
.day-picker .btn { padding: 4px 10px; line-height: 1.5; }
.day-picker-form { margin: 0; }
.day-picker-form input[type="date"] {
    padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px;
    background: var(--surface); color: var(--ink); font: inherit;
}
.day-picker-label { color: var(--ink-muted); font-size: 14px; }

.day-totals {
    display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px;
}
.day-total {
    flex: 1 1 110px; padding: 8px 12px; border-radius: 8px;
    background: var(--surface-2); border: 1px solid var(--line);
}
.day-total-label {
    display: block; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--ink-muted);
}
.day-total-value { font-size: 20px; color: var(--ink); }

/* Shared data table. Introduced 2026-08-20 with the day views — until now
   every template inlined its own border-collapse/padding, so a third copy
   would have been the wrong move. Existing inline tables can migrate here
   opportunistically; nothing is forced. */
.data-table {
    width: 100%; border-collapse: collapse; font-size: 14px;
}
.data-table th, .data-table td {
    padding: 7px 10px; text-align: left;
    border-bottom: 1px solid var(--line);
}
.data-table th {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--ink-muted); font-weight: 600; white-space: nowrap;
}
.data-table td.num, .data-table th.num { text-align: right; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }

/* Register filter pills. 2026-08-20.
   The scan station has its own inline copy of .att-filters/.fpill with
   hardcoded hexes. Deliberately NOT deduped: that would mean editing
   reception's live page for a cosmetic gain. These are token-based per the
   design-token convention; merge the two when scan_station.html is next
   touched for a real reason. */
.att-filters { display: flex; gap: 16px; flex-wrap: wrap; margin: 4px 0 12px; }
.att-filters .grp { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.att-filters .lbl { font-size: 12px; color: var(--ink-muted); }
.att-filters select {
    padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px;
    background: var(--surface); color: var(--ink); font: inherit; font-size: 13px;
}
.att-filters select:disabled { opacity: 0.5; cursor: not-allowed; }
.fpill {
    padding: 4px 12px; border: 1px solid var(--line); border-radius: 20px;
    background: var(--surface); color: var(--ink); cursor: pointer;
    font: inherit; font-size: 13px;
}
.fpill:hover { border-color: var(--brand); }
.fpill.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Expense entry form. 2026-08-20. */
.expense-form {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px; align-items: end; margin: 12px 0 4px;
}
.expense-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.expense-form label.wide { grid-column: 1 / -1; }
.expense-form input, .expense-form select {
    padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
    background: var(--surface); color: var(--ink); font: inherit;
}

/* ──────────────────────────────────────────────────────────────
   Book barcode sheet — 40-up A4 (4 across x 10 down). 2026-08-21.
   Reuses .sheet-slot / .peeled / .filled from the 8-up QR sheet; only the
   grid shape and the label's proportions differ.
   ────────────────────────────────────────────────────────────── */
.sheet-grid-40 {
    grid-template-columns: repeat(4, 1fr);
    max-width: 460px;
}
.sheet-grid-40 .sheet-slot {
    /* the real label: 52.5 x 29.7 mm */
    aspect-ratio: 52.5 / 29.7;
    padding: 2px;
    font-size: 10px;
    gap: 0;
}
.sheet-grid-40 .sheet-slot-no { top: 1px; left: 2px; font-size: 8px; }
.sheet-grid-40 .sheet-slot-body {
    font-size: 10px; font-weight: 600; line-height: 1.15;
    word-break: break-all;
}

/* ──────────────────────────────────────────────────────────────
   Import rows — prospective barcode, sticker tick, per-row commit. 2026-08-21.
   The preview shows the code a row WOULD get; it is only printable once the
   row is committed, so the tick and the commit button sit side by side.
   ────────────────────────────────────────────────────────────── */
.imp-barcode {
    display: inline-flex; align-items: center; gap: 6px;
    margin-left: 8px; padding: 2px 6px;
    border: 1px solid var(--line); border-radius: 6px;
    background: #fff;
}
.imp-barcode-img { height: 22px; width: 76px; display: block; }
.imp-barcode-code {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 12px; font-weight: 600; letter-spacing: .04em; color: #000;
}
.imp-barcode-none { font-size: 12px; color: var(--ink-muted); font-style: italic; }
.imp-sticker-label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.imp-sticker-tick { margin: 0; cursor: pointer; }
.imp-commit-one { margin-left: 6px; }

/* The sticker run, listed so it is never a mystery what is in it. */
.imp-tray-chip {
    display: inline-flex; align-items: center; gap: 5px;
    margin: 0 6px 6px 0; padding: 3px 6px 3px 9px;
    border: 1px solid var(--line); border-radius: 999px;
    background: #fff; font-size: 12px; font-weight: 600;
    font-family: ui-monospace, Consolas, monospace;
}
.imp-tray-remove {
    border: 0; background: transparent; cursor: pointer;
    color: var(--ink-faint); font-size: 13px; line-height: 1;
    padding: 0 2px; font-family: inherit;
}
.imp-tray-remove:hover { color: var(--due); }

/* A committed row stays on screen, greyed, so the owner can see what has
   already gone in without reloading and losing their place. */
.imp-block.imp-committed { opacity: .55; }
.imp-block.imp-committed .imp-grid { pointer-events: none; }
.imp-commit-why {
    margin: 6px 0 0; padding: 5px 8px;
    background: var(--accent-soft); border-left: 3px solid var(--accent);
    border-radius: 4px; font-size: 12px; color: var(--ink);
}
