/* ============================================================
   SBRS Employee Platform — Design System
   Mobile-first · Outdoor-legible · High-contrast
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Orbitron:wght@700&display=swap');

:root {
    /* Brand */
    --red:          #d71920;
    --red-dark:     #b01419;
    --red-glow:     rgba(215, 25, 32, 0.28);

    /* Surfaces */
    --page-bg:      #eef0f4;
    --surface:      #ffffff;
    --tile-bg:      #111214;
    --tile-bg-2:    #18191d;

    /* Text */
    --ink:          #0d0e10;
    --ink-muted:    #5c6170;
    --ink-faint:    #9299a6;
    --on-dark:      #f8f9fa;
    --on-dark-dim:  #8b919e;

    /* Borders */
    --border:       rgba(0, 0, 0, 0.08);
    --border-input: rgba(0, 0, 0, 0.14);

    /* Shadows */
    --sh-sm:        0 2px 6px rgba(0,0,0,0.06);
    --sh-md:        0 6px 20px rgba(0,0,0,0.08);
    --sh-lg:        0 16px 48px rgba(0,0,0,0.12);
    --sh-xl:        0 24px 64px rgba(0,0,0,0.15);

    /* Radii */
    --r-xs:  4px;
    --r-sm:  6px;
    --r-md:  8px;
    --r-lg:  10px;
    --r-xl:  12px;
    --r-2xl: 16px;
    --r-pill: 9999px;

    /* Status */
    --green:        #16a34a;
    --green-bg:     rgba(22, 163, 74, 0.09);
    --green-border: rgba(22, 163, 74, 0.22);
    --amber:        #d97706;
    --blue:         #2563eb;
    --blue-bg:      rgba(37, 99, 235, 0.08);
    --blue-border:  rgba(37, 99, 235, 0.2);

    /* Layout */
    --max-w:        100vw;
    --statusbar-h:  2.75rem;
}

/* ── Reset ──────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 16px;
    background: var(--page-bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ── Shell ──────────────────────────────────────── */

.shell {
    width: calc(100vw - 1.5rem);
    max-width: var(--max-w);
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    padding: 0.5rem 0 calc(var(--statusbar-h) + 0.75rem);
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 0.75rem;
    overflow: hidden;
}

/* ── Top Bar ────────────────────────────────────── */

.shell-topbar {
    display: flex;
    align-items: center;
    height: 4rem;
    padding: 0 1rem 0 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
}

.shell-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.shell-app-menu {
    position: relative;
    margin-left: auto;
}

.shell-app-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    transition: color 150ms, transform 100ms;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 32;
}

.shell-app-menu-button svg {
    width: 1.1rem;
    height: 1.1rem;
}

.shell-app-menu-button:hover,
.shell-app-menu-button[aria-expanded="true"] {
    color: var(--red);
}

.shell-app-menu-button:active {
    transform: scale(0.94);
    transition-duration: 60ms;
}

.shell-app-menu-panel {
    position: absolute;
    top: calc(100% + 0.55rem);
    right: 0;
    z-index: 30;
    width: min(21rem, calc(100vw - 2rem));
    padding: 0.45rem;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-lg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.shell-app-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 29;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: default;
}

.shell-app-menu-empty {
    padding: 0.9rem 1rem;
    color: var(--ink-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.shell-app-menu-separator {
    height: 1px;
    margin: 0.2rem 0.4rem;
    background: rgba(15, 23, 42, 0.1);
}

.shell-app-menu-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.shell-app-menu-item {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-align: left;
    border: none;
    border-radius: var(--r-lg);
    background: transparent;
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    transition: background 150ms ease, transform 100ms ease;
}

.shell-app-menu-item:hover,
.shell-app-menu-item:focus-visible,
.shell-app-menu-item.is-active {
    outline: none;
    background: rgba(0, 0, 0, 0.045);
}

.shell-app-menu-item:active {
    transform: scale(0.99);
    transition-duration: 60ms;
}

.shell-app-menu-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--r-md);
    flex-shrink: 0;
}

.shell-app-menu-item-icon svg {
    width: 1.2rem;
    height: 1.2rem;
}

.shell-app-menu-item-icon-red {
    background: rgba(215, 25, 32, 0.12);
    color: var(--red);
    border: 1px solid rgba(215, 25, 32, 0.2);
}

.shell-app-menu-item-icon-black {
    background: rgba(0, 0, 0, 0.08);
    color: var(--ink);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Dev-only "Go Offline" toggle — amber accent marks it as a debug tool. */
.shell-app-menu-item-icon-dev {
    background: rgba(217, 119, 6, 0.12);
    color: #b45309;
    border: 1px solid rgba(217, 119, 6, 0.24);
}

.shell-app-menu-item-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.shell-app-menu-item-title {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.shell-app-menu-item-meta {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.shell-app-version-panel {
    margin: 0.15rem 0.4rem 0.4rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: var(--r-lg);
    background: rgba(15, 23, 42, 0.035);
}

.shell-app-version-line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.25rem 0;
    color: var(--ink-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.shell-app-version-line strong {
    color: var(--ink);
    font-weight: 800;
    text-align: right;
}

.shell-app-version-error {
    color: var(--red);
    font-weight: 700;
}

.shell-app-version-status {
    margin-top: 0.45rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    font-size: 0.76rem;
    font-weight: 800;
}

.shell-app-version-status.is-current {
    color: var(--green);
}

.shell-app-version-status.is-pending {
    color: var(--amber);
}

.shell-app-menu-history-pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.04);
    color: var(--ink);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, transform 100ms ease;
}

.shell-app-menu-history-pill:hover,
.shell-app-menu-history-pill:focus-visible,
.shell-app-menu-history-pill.is-active {
    outline: none;
    background: rgba(15, 23, 42, 0.08);
    border-color: rgba(15, 23, 42, 0.18);
}

.shell-app-menu-history-pill:active {
    transform: scale(0.98);
}

.shell-app-menu-history-pill-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.95rem;
    height: 0.95rem;
}

.shell-app-menu-history-pill-icon svg {
    width: 0.95rem;
    height: 0.95rem;
}

.shell-brand img {
    width: 4rem;
    height: 4rem;
    object-fit: contain;
    flex-shrink: 0;
}

.shell-brand-eyebrow {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--red);
}

.shell-brand-title {
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--ink);
    line-height: 1.2;
}

.shell-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 0.25rem;
    transition: color 150ms, transform 100ms;
    -webkit-tap-highlight-color: transparent;
}

.shell-back svg { width: 1.1rem; height: 1.1rem; }

.shell-back:hover  { color: var(--red); }
.shell-back:active { transform: scale(0.92); transition-duration: 60ms; }

/* ── Status Bar (fixed footer) ──────────────────── */

.shell-statusbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: var(--statusbar-h);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0 1.25rem;
    background: rgba(38, 41, 48, 0.97);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--on-dark-dim);
    user-select: none;
}

.statusbar-connectivity {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.statusbar-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 400ms, box-shadow 400ms;
}

.statusbar-online .statusbar-dot {
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.7);
}

.statusbar-offline .statusbar-dot {
    background: var(--red);
}

.statusbar-label {
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.statusbar-online .statusbar-label  { color: #4ade80; }
.statusbar-offline .statusbar-label { color: #ff7b80; }

.statusbar-sep {
    width: 1px;
    height: 1rem;
    background: rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.statusbar-queued { color: var(--on-dark-dim); }

.statusbar-queued-button {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.statusbar-queued-button:hover,
.statusbar-queued-button:focus-visible {
    color: var(--on-dark);
    text-decoration: underline;
    outline: none;
}

.statusbar-failed {
    color: #ff7b80;
    font-weight: 700;
}

.statusbar-failed-button {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.statusbar-failed-button:hover,
.statusbar-failed-button:focus-visible {
    color: #ff9ba0;
    text-decoration: underline;
    outline: none;
}

.statusbar-sync-time {
    margin-left: auto;
    color: rgba(255, 255, 255, 0.28);
    font-size: 0.72rem;
    white-space: nowrap;
}

/* ── Shell Body ─────────────────────────────────── */

.shell-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.app-update-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-radius: var(--r-lg);
    border: 1px solid rgba(215, 25, 32, 0.18);
    background:
        linear-gradient(135deg, rgba(215, 25, 32, 0.1), rgba(17, 18, 20, 0.03)),
        var(--surface);
    box-shadow: var(--sh-sm);
}

.app-update-banner-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.app-update-banner-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.app-update-banner-message {
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--ink-muted);
}

.app-update-banner-action {
    border: none;
    border-radius: var(--r-pill);
    background: var(--red);
    color: #fff;
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    transition: background 150ms ease, transform 100ms ease;
    -webkit-tap-highlight-color: transparent;
}

.app-update-banner-action:hover {
    background: var(--red-dark);
}

.app-update-banner-action:active {
    transform: scale(0.98);
    transition-duration: 60ms;
}

/* ── Dashboard Layout ───────────────────────────── */

/* The dashboard fills the shell body so the hero stays pinned while only the
   app tiles scroll. Other feature pages are unaffected — they remain normal
   flow children of .shell-body and scroll as a whole. */
.dashboard-page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dashboard-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.dashboard-scroll::before,
.dashboard-scroll::after {
    content: none;
}

.dashboard-pull-refresh {
    display: none;
}

/* ── Dashboard Hero ─────────────────────────────── */

.dashboard-hero {
    flex: 0 0 auto;
    padding: 0.5rem 0.25rem 0;
}

.dashboard-date {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--red);
    margin-bottom: 0.55rem;
}

.dashboard-hero-heading {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.65rem;
}

.dashboard-hero h1 {
    font-size: clamp(1.75rem, 5.5vw, 2.6rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1.0;
    color: var(--ink);
}

.dashboard-info-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-faint);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 150ms ease, background 150ms ease;
}

.dashboard-info-button svg { width: 1.15rem; height: 1.15rem; }

.dashboard-info-button:hover,
.dashboard-info-button:focus-visible {
    color: var(--red);
    background: rgba(215, 25, 32, 0.1);
    outline: none;
}

.dashboard-info-button.is-active {
    color: var(--red);
    background: rgba(215, 25, 32, 0.12);
}

.dashboard-hero-info {
    margin-top: 0.1rem;
    padding: 0.7rem 0.85rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--ink-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: 0 6px 20px rgba(13, 14, 16, 0.08);
}

/* ── Dashboard Grid ─────────────────────────────── */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: 1rem;
}

/* ── App Tiles ──────────────────────────────────── */

.app-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    text-align: left;
    padding: 1.5rem;
    min-height: 15rem;
    border: none;
    border-radius: var(--r-xl);
    cursor: pointer;
    overflow: hidden;
    background: var(--tile-bg);
    color: var(--on-dark);
    width: 100%;
    transition: filter 180ms ease, box-shadow 180ms ease;
}

.app-tile-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
    position: relative;
}

.app-tile-main-content {
    flex: 1;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}


.app-tile-red   { background: #131012; }
.app-tile-black { background: var(--tile-bg); }

.app-tile:hover {
    filter: brightness(1.12);
}

.app-tile-red:hover   { box-shadow: 0 0 0 1.5px rgba(215, 25, 32, 0.6); }
.app-tile-black:hover { box-shadow: 0 0 0 1.5px rgba(255,255,255,0.2); }

.app-tile:active {
    filter: brightness(1.15);
    transition-duration: 60ms;
}

.app-tile-icon-wrap { margin-bottom: 0; }

.app-tile-icon-bg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: var(--r-md);
}

.app-tile-red .app-tile-icon-bg {
    background: rgba(215, 25, 32, 0.18);
    color: #ff7b80;
    border: 1px solid rgba(215, 25, 32, 0.28);
    box-shadow: 0 0 20px -4px rgba(215,25,32,0.35);
}

.app-tile-black .app-tile-icon-bg {
    background: rgba(255, 255, 255, 0.09);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.app-tile-icon-bg svg { width: 1.5rem; height: 1.5rem; }

.app-tile-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.app-tile-title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: var(--on-dark);
}

.app-tile-description {
    font-size: 0.86rem;
    font-weight: 400;
    color: var(--on-dark-dim);
    line-height: 1.55;
}

.app-tile-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.app-tile-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.app-tile-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.app-tile-availability-always { color: #4ade80; }
.app-tile-availability-always::before { background: #4ade80; box-shadow: 0 0 7px #4ade80; }
.app-tile-availability-online  { color: #86efac; }
.app-tile-availability-online::before  { background: #22c55e; box-shadow: 0 0 7px rgba(34, 197, 94, 0.8); }
.app-tile-availability-offline { color: #fca5a5; }
.app-tile-availability-offline::before { background: #ef4444; box-shadow: 0 0 7px rgba(239, 68, 68, 0.75); }

.app-tile-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    color: var(--on-dark);
    transition: background 200ms, transform 200ms;
    flex-shrink: 0;
}

.app-tile-arrow svg { width: 1rem; height: 1rem; }

.app-tile:hover .app-tile-arrow,
.app-tile:focus-visible .app-tile-arrow {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(3px);
}

.app-tile-history-link {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--on-dark);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, transform 100ms ease;
}

.app-tile-history-link:hover,
.app-tile-history-link:focus-visible {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.24);
}

.app-tile-history-link:active {
    transform: scale(0.98);
}

.app-tile-history-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.95rem;
    height: 0.95rem;
}

.app-tile-history-link-icon svg {
    width: 0.95rem;
    height: 0.95rem;
}

.app-tile-open-button {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--on-dark);
    padding: 0.72rem 1rem;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 180ms ease, border-color 180ms ease, transform 100ms ease;
}

.app-tile-open-button:hover,
.app-tile-open-button:focus-visible {
    outline: none;
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.2);
}

.app-tile-open-button:active {
    transform: scale(0.99);
}

/* ── Feature Pages ──────────────────────────────── */

.feature-page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    overflow: hidden;
}

/* mobile-card on feature pages fills remaining height with a pinned action footer */
.feature-page .mobile-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* scrollable field area inside the card */
.card-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1.5rem;
}

.card-body-compact {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1rem 1.25rem 0.75rem;
}

.card-body-compact .text-area {
    min-height: 5.5rem;
}

.maintenance-card-body {
    min-height: 0;
}

.maintenance-photo-section {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.maintenance-photo-grid {
    min-height: 0;
}

/* pinned save/submit area — always visible at the bottom of the card */
.card-actions {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.section-heading { padding: 0.25rem 0.25rem 0; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--red);
}

.section-heading h1 {
    font-size: clamp(1.5rem, 5vw, 2.1rem);
    font-weight: 900;
    letter-spacing: -0.035em;
    line-height: 1.08;
    color: var(--ink);
}

/* ── Mobile Card (Form Container) ───────────────── */

.mobile-card {
    background: var(--surface);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

.field-group {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.field-group:last-child { border-bottom: none; }


/* ── Form Controls ──────────────────────────────── */

.field-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

/* Scan row: always inline — button stays right of input on all screen sizes.
   align-items: stretch ensures the button matches the input's exact height. */
.scan-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.65rem;
    align-items: stretch;
}

.scan-row .action-button {
    align-self: stretch;
    height: auto;
}

.scan-hint {
    margin-top: 0.4rem;
    font-size: 0.82rem;
    line-height: 1.25;
}

.scan-hint-success {
    color: #1b7a43;
}

.scan-hint-warning {
    color: #8a6100;
}

.text-input,
.text-area {
    width: 100%;
    border-radius: var(--r-sm);
    border: 1.5px solid var(--border-input);
    background: #f8f9fb;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    color: var(--ink);
    transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
    -webkit-appearance: none;
    appearance: none;
    line-height: 1.4;
}

.text-input:focus,
.text-area:focus {
    outline: none;
    border-color: var(--red);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.12);
}

.text-input[readonly] {
    background: #f2f3f6;
    color: var(--ink-muted);
    cursor: default;
}

.text-area {
    min-height: 7rem;
    resize: vertical;
    line-height: 1.6;
}

select.text-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235c6170' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* Grey out select when placeholder option is selected */
select.text-input:has(option[value="0"]:checked) {
    color: var(--ink-faint);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
}

.checkbox-row input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--red);
    cursor: pointer;
    flex-shrink: 0;
}

.sync-form-stack {
    gap: 0.9rem;
}

.sync-form-field {
    display: grid;
    gap: 0.45rem;
}

.sync-form-field-no-label {
    gap: 0;
}

.sync-form-scan-row .e-control-wrapper,
.sync-form-scan-row .e-input-group,
.sync-form-field .e-control-wrapper,
.sync-form-field .e-input-group,
.sync-form-field .e-ddl.e-input-group,
.sync-form-field .e-numeric.e-input-group,
.sync-form-field .e-input-group.e-control-wrapper,
.sync-form-field .e-textarea,
.sync-form-field .e-checkbox-wrapper {
    width: 100%;
}

.sync-form-field .e-input-group,
.sync-form-field .e-ddl.e-input-group,
.sync-form-field .e-numeric.e-input-group,
.sync-form-field .e-input-group.e-control-wrapper,
.sync-form-scan-row .e-input-group {
    min-height: 2.9rem;
    border-radius: var(--r-sm);
}

.sync-form-field .e-input-group input.e-input,
.sync-form-field .e-ddl .e-input,
.sync-form-field .e-numeric input.e-input,
.sync-form-scan-row .e-input-group input.e-input {
    min-height: 2.9rem;
}

.sync-form-field .e-textarea,
.sync-form-field textarea.e-input {
    min-height: 7rem;
    line-height: 1.55;
}

/* Incident reports need a roomy notes area — the detail captured here is the
   primary record of what happened, so give it noticeably more height. */
.incident-notes-field .e-textarea,
.incident-notes-field textarea.e-input {
    min-height: 22rem;
}

.sync-form-checkbox-field {
    padding-top: 0.2rem;
}

.sync-form-checkbox-field .e-checkbox-wrapper {
    min-height: 1.5rem;
}

.sync-form-scan-button,
.sync-form-submit {
    min-height: 2.9rem;
    border-radius: var(--r-sm);
}

.sync-form-scan-row .sync-form-scan-button {
    min-width: 6rem;
}

.sync-form-submit {
    width: 100%;
}

.sync-form-readonly.e-control-wrapper,
.sync-form-readonly .e-input-group,
.sync-form-readonly input.e-input {
    background: #f2f3f6;
}

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

.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: none;
    border-radius: var(--r-sm);
    padding: 0.85rem 1.1rem;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    white-space: nowrap;
    background: var(--tile-bg);
    color: var(--on-dark);
    min-width: 5.5rem;
    transition: background 150ms, transform 100ms;
    -webkit-tap-highlight-color: transparent;
}

.action-button:hover  { background: #1e2126; }
.action-button:active { transform: scale(0.95); transition-duration: 60ms; }

.primary-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    border: none;
    border-radius: var(--r-sm);
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
    background: var(--red);
    color: #fff;
    transition: background 150ms, transform 100ms;
    -webkit-tap-highlight-color: transparent;
}

.primary-button:hover:not(:disabled) {
    background: var(--red-dark);
}

.primary-button:active:not(:disabled) {
    transform: scale(0.98);
    transition-duration: 60ms;
}

.primary-button:disabled {
    opacity: 0.32;
    cursor: not-allowed;
    box-shadow: none;
}

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

.feedback-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border-radius: var(--r-sm);
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.5;
}

.feedback-banner-success {
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    color: #166534;
}

.feedback-banner-info {
    background: var(--blue-bg);
    border: 1px solid var(--blue-border);
    color: #1e40af;
}

.feedback-banner-error {
    background: rgba(215, 25, 32, 0.07);
    border: 1px solid rgba(215, 25, 32, 0.16);
    color: var(--red-dark);
}

/* ── Loading Overlay ───────────────────────────── */

.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(13, 14, 16, 0.22);
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
}

.loading-overlay-message {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 10rem;
    min-height: 3rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--r-pill);
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(17, 18, 20, 0.82);
    box-shadow: var(--sh-md);
    color: var(--on-dark);
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

/* ── Photo Picker ───────────────────────────────── */

.photo-field-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.photo-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-faint);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.photo-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--r-sm);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.06);
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 150ms;
}

.photo-remove:hover  { background: rgba(215, 25, 32, 0.88); }
.photo-remove:active { background: var(--red-dark); }

.photo-add-tile {
    aspect-ratio: 1;
    border-radius: var(--r-sm);
    border: 2px dashed var(--border-input);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    cursor: pointer;
    color: var(--ink-faint);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: background 150ms, border-color 150ms, color 150ms;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.photo-add-tile:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: var(--ink-muted);
    color: var(--ink-muted);
}

.photo-add-tile:active { background: rgba(0, 0, 0, 0.08); }

.photo-add-tile svg { width: 1.4rem; height: 1.4rem; }

@media (min-width: 681px) {
    /* The incident review page has six toolbar items (Student, Vehicle, Created By,
       Status, Date Range, Search) — two more than the shared 4-column layout — so it
       needs its own template to keep them on one row on desktop. The max-width:680px
       rule below still collapses the toolbar to a single column on mobile. */
    .incident-review-page .vehicle-log-toolbar {
        grid-template-columns:
            minmax(10rem, 1fr)
            minmax(9rem, 0.9fr)
            minmax(10rem, 1fr)
            minmax(8rem, 0.7fr)
            minmax(15rem, 1.3fr)
            auto;
    }

    .maintenance-card-body {
        display: flex;
        flex-direction: column;
    }

    .maintenance-photo-section {
        flex: 1;
        min-height: 14rem;
    }

    .maintenance-photo-grid {
        flex: 1;
        grid-auto-rows: minmax(0, 1fr);
        align-content: stretch;
        min-height: 0;
    }

    .maintenance-photo-grid .photo-thumb,
    .maintenance-photo-grid .photo-add-tile {
        aspect-ratio: auto;
        min-height: 0;
        height: 100%;
    }
}

/* ── Field-group separator suppression ─────────── */

.field-group-no-sep { border-bottom: none !important; }

/* ── Last Saved Scan (Pit Lane) ─────────────────── */

.last-scan-section {
    padding: 1.25rem 1.5rem 1rem;
}

.last-scan-title {
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 1rem;
}

.last-scan-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.last-scan-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-muted);
}

.last-scan-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
}

.last-scan-time-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    margin-top: 0.25rem;
}

.last-scan-timestamp {
    font-family: 'Orbitron', 'Courier New', monospace;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--red);
    letter-spacing: 0.04em;
    line-height: 1;
}

.last-scan-ampm {
    font-family: 'Orbitron', 'Courier New', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ink-muted);
    margin-left: 0.35rem;
    letter-spacing: 0.06em;
}

/* ── Empty / Error States ───────────────────────── */

.empty-state {
    background: var(--surface);
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
    box-shadow: var(--sh-md);
    padding: 2rem 1.75rem;
}

.empty-state h2 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.55rem;
    color: var(--ink);
}

.empty-state p {
    font-size: 0.92rem;
    color: var(--ink-muted);
    line-height: 1.65;
}

.empty-state-detail {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--r-xs);
    background: rgba(0, 0, 0, 0.04);
    color: #333;
    font-family: 'SF Mono', ui-monospace, Consolas, 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.65;
    word-break: break-all;
    border: 1px solid var(--border);
}

/* ── Auth Error ──────────────────────────────────── */

.auth-error {
    background: var(--surface);
    border-radius: var(--r-xl);
    border: 1px solid rgba(215, 25, 32, 0.14);
    padding: 2.5rem 1.75rem;
    text-align: center;
    max-width: 28rem;
    margin: 4rem auto;
}

.auth-error-title {
    font-size: 1.2rem;
    line-height: 1.25;
    font-weight: 900;
    color: var(--ink);
    margin-bottom: 0.65rem;
}

.auth-error-message {
    color: var(--ink-muted);
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.55;
}

.auth-recovery {
    margin-top: 1rem;
    border-color: rgba(37, 99, 235, 0.2);
}

.auth-diagnostics {
    display: grid;
    gap: 0.55rem;
    margin: 0 0 1.25rem;
    text-align: left;
}

.auth-diagnostics div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0.8rem;
    border-radius: var(--r-sm);
    background: rgba(15, 23, 42, 0.04);
}

.auth-diagnostics dt {
    color: var(--ink-muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-diagnostics dd {
    color: var(--ink);
    font-size: 0.85rem;
    font-weight: 800;
    text-align: right;
}

.auth-recovery-note {
    color: var(--ink-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

/* ── Error Boundary ─────────────────────────────── */

.error-boundary {
    background: var(--surface);
    border-radius: var(--r-xl);
    border: 1px solid rgba(215, 25, 32, 0.14);
    padding: 2.5rem 1.75rem;
    text-align: center;
}

.error-boundary p {
    color: var(--ink-muted);
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}

/* ── Scanner Overlay ────────────────────────────── */

.scanner-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    display: grid;
    gap: 1.25rem;
    align-content: center;
    justify-items: center;
    padding: 1.5rem;
}

.scanner-overlay video {
    width: min(100%, 28rem);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.1), var(--sh-xl);
}

.scanner-title {
    color: var(--on-dark);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.scanner-cancel {
    border: none;
    border-radius: var(--r-md);
    padding: 0.875rem 2.25rem;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    color: var(--on-dark);
    backdrop-filter: blur(12px);
    transition: background 150ms;
    -webkit-tap-highlight-color: transparent;
}

.scanner-cancel:hover { background: rgba(255,255,255,0.18); }

/* ── Saving Overlay ─────────────────────────────── */

.saving-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.55);
    display: grid;
    align-content: center;
    justify-items: center;
}

.saving-label {
    color: var(--on-dark);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ── Sync Issues ────────────────────────────────── */

.sync-issues-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.46);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 1rem;
}

.sync-issues-panel {
    width: min(100%, 42rem);
    max-height: min(80vh, 44rem);
    background: var(--surface);
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
    box-shadow: var(--sh-xl);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
}

.sync-issues-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.sync-issues-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.sync-issues-header p:last-child {
    color: var(--ink-muted);
    line-height: 1.5;
    font-size: 0.92rem;
}

.sync-issues-close {
    border: none;
    background: rgba(0, 0, 0, 0.06);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sync-issues-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ink-muted);
}

.sync-issues-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.sync-issue-card {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: #fbfbfc;
}

.sync-issue-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sync-issue-type {
    color: var(--red);
}

.sync-issue-summary {
    font-size: 1rem;
    font-weight: 800;
    color: var(--ink);
}

.sync-issue-status {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--red-dark);
}

.sync-issue-message {
    color: var(--ink-muted);
    line-height: 1.55;
    font-size: 0.9rem;
}

.sync-issue-actions {
    display: flex;
    gap: 0.65rem;
}

.sync-issue-dismiss {
    background: rgba(0, 0, 0, 0.08);
    color: var(--ink);
}

.sync-issue-dismiss:hover {
    background: rgba(0, 0, 0, 0.14);
}

/* ── Vehicle Log History ───────────────────────── */

.vehicle-log-history-page {
    gap: 1.25rem;
}

.feature-page .vehicle-log-sync-card {
    flex: 0 0 auto;
    display: block;
    min-height: auto;
    overflow: visible;
    padding: 0.7rem 1rem;
}

/* Toggle strip — hidden on desktop, shown on mobile */
.vehicle-log-filter-toggle {
    display: none;
}

/* CSS-only chevron (no icon-font dependency) */
.vehicle-log-chevron {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
}
.vehicle-log-chevron-up   { transform: rotate(225deg); margin-bottom: -0.15rem; }
.vehicle-log-chevron-down { transform: rotate(45deg);  margin-top: -0.15rem; }

.vehicle-log-toolbar {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(12rem, 1fr) minmax(16rem, 1.2fr) minmax(12rem, 0.9fr) auto;
    align-items: end;
}

.vehicle-log-filter {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.vehicle-log-filter-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    line-height: 1.1;
}

.vehicle-log-filter .e-input-group,
.vehicle-log-filter .e-ddl.e-input-group,
.vehicle-log-filter .e-date-range-wrapper.e-input-group {
    min-height: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
}

.vehicle-log-filter .e-control-wrapper,
.vehicle-log-filter .e-date-range-wrapper {
    width: 100%;
}

.vehicle-log-filter .e-input-group-icon,
.vehicle-log-filter .e-ddl .e-clear-icon,
.vehicle-log-filter .e-ddl .e-input-group-icon,
.vehicle-log-filter .e-date-range-wrapper .e-range-icon {
    align-self: center;
}

.vehicle-log-filter .e-input,
.vehicle-log-filter .e-range-input,
.vehicle-log-filter .e-ddl .e-input-value,
.vehicle-log-filter .e-ddl .e-input {
    height: 2.75rem;
    line-height: 2.75rem;
    display: flex;
    align-items: center;
}

.vehicle-log-filter .e-input-group input.e-input,
.vehicle-log-filter .e-ddl .e-input,
.vehicle-log-filter .e-date-range-wrapper input.e-input {
    padding-top: 0;
    padding-bottom: 0;
    padding-inline: 0.85rem;
}

.vehicle-log-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
}

.vehicle-log-actions .e-btn {
    min-width: 8rem;
    min-height: 2.6rem;
    border-radius: 0.8rem;
}

.vehicle-log-results-meta {
    display: flex;
    align-items: center;
    min-height: 3rem;
    padding: 0 1.25rem;
    color: var(--ink-muted);
    font-size: 0.92rem;
    border-bottom: 1px solid var(--border);
}

.vehicle-log-results-card {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vehicle-log-grid-shell {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: auto;
}

.vehicle-log-grid {
    height: 100%;
    min-width: 1100px;
}

.vehicle-log-grid.e-grid {
    height: 100%;
    border: none;
}

.history-mobile-results-card {
    min-height: 0;
}

.history-mobile-results-shell {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.history-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.75rem;
}

.history-mobile-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 0.9rem 0.65rem;
    background: var(--surface);
}

.history-mobile-card-header,
.history-mobile-card-row,
.history-mobile-card-footer,
.history-mobile-card-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
}

.history-mobile-card-header {
    margin-bottom: 0.35rem;
}

.history-mobile-card-header > div {
    min-width: 0;
}

.history-mobile-card-title {
    min-width: 0;
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.history-mobile-card-subtitle,
.history-mobile-card-meta,
.history-mobile-card-footer {
    color: var(--ink-muted);
    font-size: 0.8rem;
    line-height: 1.35;
}

.history-mobile-card-footer {
    align-items: center;
    margin-top: 0.7rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
}

.history-mobile-card-who {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-mobile-card-when {
    flex: 0 0 auto;
    text-align: right;
    white-space: nowrap;
}

.history-mobile-card-row {
    margin-top: 0.35rem;
    color: var(--ink-muted);
    font-size: 0.86rem;
}

.history-mobile-card-value {
    color: var(--ink);
    font-weight: 700;
    white-space: nowrap;
}

.history-mobile-card-notes {
    margin-top: 0.45rem;
    color: var(--ink-muted);
    font-size: 0.84rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.history-mobile-fact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.history-mobile-fact {
    min-width: 0;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
}

.history-mobile-fact:last-child {
    min-width: 7.35rem;
}

.history-mobile-fact-label {
    display: block;
    color: var(--ink-muted);
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.15;
    text-transform: uppercase;
}

.history-mobile-fact-value {
    display: block;
    margin-top: 0.2rem;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.history-mobile-card-actions {
    align-items: center;
    margin-top: 0.6rem;
}

.pr-history-mobile-card {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.pr-history-card-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.85rem;
    align-items: start;
}

.pr-history-card-primary {
    min-width: 0;
}

.pr-history-card-amount-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    min-width: max-content;
}

.pr-history-card-amount {
    color: var(--ink);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.pr-history-card-chip-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.pr-history-outline-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.45rem;
    padding: 0.15rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--ink-muted);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
}

.pr-history-card-photos {
    display: flex;
    justify-content: flex-end;
}

.incident-review-notes {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--ink);
    white-space: pre-wrap;
}

.incident-review-handled-note {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-muted);
}

.incident-review-disclaimer {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.6rem;
}

.incident-review-disclaimer-email {
    font-size: 0.8rem;
    color: var(--ink-muted);
    word-break: break-all;
}

.pr-history-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 2.35rem;
}

.pr-history-card-actions:empty {
    display: none;
}

.pr-history-decision-button {
    min-width: 7.25rem;
}

.history-mobile-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0 0.75rem 0.75rem;
}

.history-mobile-page-info {
    color: var(--ink-muted);
    font-size: 0.82rem;
}

.vehicle-log-grid .e-rowcell {
    vertical-align: top;
}

.vehicle-log-notes-cell {
    color: var(--ink-muted);
    line-height: 1.45;
    white-space: normal;
}

.vehicle-log-pill,
.vehicle-log-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.vehicle-log-pill {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--ink);
}

.vehicle-log-flag.is-warning {
    background: #fef3c7;
    color: #92400e;
}

.vehicle-log-flag.is-clear {
    background: #dcfce7;
    color: #166534;
}

.vehicle-log-no-photos {
    color: var(--ink-faint);
    font-size: 0.9rem;
}

.vehicle-log-photo-stack {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    flex-wrap: wrap;
}

.vehicle-log-thumb {
    width: 3.5rem;
    height: 3.5rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0.85rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.vehicle-log-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vehicle-log-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(8, 13, 18, 0.88);
    backdrop-filter: blur(8px);
}

.vehicle-log-lightbox-dialog {
    position: relative;
    display: grid;
    gap: 0.85rem;
    width: min(56rem, 100%);
    max-height: calc(100dvh - 2rem);
    padding: 1rem;
    border-radius: var(--r-lg);
    background: #111922;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.vehicle-log-lightbox-dialog img {
    width: 100%;
    max-height: calc(100dvh - 9rem);
    object-fit: contain;
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, 0.04);
}

.vehicle-log-lightbox-caption {
    display: grid;
    gap: 0.15rem;
}

.vehicle-log-lightbox-caption strong {
    color: var(--on-dark);
}

.vehicle-log-lightbox-close {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    width: 2.2rem;
    height: 2.2rem;
    border: 0;
    border-radius: 999px;
    background: rgba(8, 13, 18, 0.72);
    color: white;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.vehicle-log-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.8rem;
    height: 2.8rem;
    border: 0;
    border-radius: 999px;
    background: rgba(8, 13, 18, 0.72);
    color: white;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.vehicle-log-lightbox-nav-prev {
    left: 0.75rem;
}

.vehicle-log-lightbox-nav-next {
    right: 0.75rem;
}

/* ── Misc ───────────────────────────────────────── */

#blazor-error-ui { display: none; }

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

@media (max-width: 680px) {
    .shell {
        width: min(calc(100vw - 1rem), var(--max-w));
        padding-top: 0.5rem;
        gap: 1rem;
    }

    .shell-topbar {
        border-radius: var(--r-md);
        padding: 0.65rem 0.85rem;
    }

    .shell-app-menu-panel {
        right: -0.15rem;
        width: min(20rem, calc(100vw - 1.5rem));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-scroll {
        position: relative;
        overscroll-behavior-y: contain;
        --dashboard-pull-distance: 0px;
    }

    .dashboard-scroll::before,
    .dashboard-scroll::after {
        content: '';
        position: sticky;
        left: 0;
        right: 0;
        z-index: 2;
        display: block;
        height: 1.2rem;
        margin-right: -1px;
        margin-left: -1px;
        pointer-events: none;
        opacity: 0;
        transition: opacity 160ms ease;
    }

    .dashboard-scroll::before {
        top: 0;
        margin-bottom: -1.2rem;
        background: linear-gradient(to bottom, rgba(238, 240, 244, 0.98), rgba(238, 240, 244, 0));
        box-shadow: 0 10px 18px -18px rgba(0, 0, 0, 0.9);
    }

    .dashboard-scroll::after {
        bottom: 0;
        margin-top: -1.2rem;
        background: linear-gradient(to top, rgba(238, 240, 244, 0.98), rgba(238, 240, 244, 0));
        box-shadow: 0 -10px 18px -18px rgba(0, 0, 0, 0.9);
    }

    .dashboard-scroll.can-scroll-up::before,
    .dashboard-scroll.can-scroll-down::after {
        opacity: 1;
    }

    .dashboard-pull-refresh {
        position: sticky;
        top: 0;
        z-index: 3;
        display: flex;
        justify-content: center;
        height: 2.25rem;
        margin-bottom: -2.25rem;
        pointer-events: none;
        opacity: 0;
        transform: translateY(-0.65rem);
        transition: opacity 140ms ease, transform 140ms ease;
    }

    .dashboard-pull-refresh span {
        display: inline-flex;
        align-items: center;
        min-height: 1.8rem;
        padding: 0.35rem 0.7rem;
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: var(--r-pill);
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 8px 20px rgba(13, 14, 16, 0.12);
        color: var(--ink-muted);
        font-size: 0.72rem;
        font-weight: 800;
    }

    .dashboard-scroll.is-pulling-update .dashboard-pull-refresh,
    .dashboard-scroll.is-ready-update .dashboard-pull-refresh,
    .dashboard-scroll.is-checking-update .dashboard-pull-refresh,
    .dashboard-scroll.is-update-found .dashboard-pull-refresh,
    .dashboard-scroll.is-update-current .dashboard-pull-refresh {
        opacity: 1;
        transform: translateY(0);
    }

    .dashboard-scroll.is-ready-update .dashboard-pull-refresh span,
    .dashboard-scroll.is-update-found .dashboard-pull-refresh span {
        color: var(--red);
    }

    .dashboard-scroll.is-pulling-update .dashboard-grid,
    .dashboard-scroll.is-ready-update .dashboard-grid,
    .dashboard-scroll.is-checking-update .dashboard-grid,
    .dashboard-scroll.is-update-found .dashboard-grid,
    .dashboard-scroll.is-update-current .dashboard-grid {
        transform: translateY(var(--dashboard-pull-distance));
    }

    .app-tile {
        min-height: auto;
        padding: 0.9rem 1rem;
    }

    .app-tile-main {
        align-items: center;
        gap: 0.7rem;
        margin-bottom: 0;
    }

    .app-tile-main-content {
        align-items: center;
        flex-direction: row;
        gap: 0.85rem;
    }

    .app-tile-body {
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
        gap: 0.18rem;
    }

    .app-tile-title {
        font-size: 1.02rem;
        margin-bottom: 0;
        line-height: 1.08;
    }

    .app-tile-description {
        display: none;
    }

    .app-tile-footer {
        display: none;
    }

    .app-tile-mobile-meta {
        display: flex !important;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.68rem;
        font-weight: 600;
    }

    .app-tile-mobile-meta::before {
        content: '';
        width: 5px;
        height: 5px;
        border-radius: 50%;
    }

    .app-tile-icon-bg {
        width: 2.8rem;
        height: 2.8rem;
    }

    .app-tile-icon-bg svg {
        width: 1.28rem;
        height: 1.28rem;
    }

    .app-tile-history-link {
        position: static;
        padding: 0.45rem;
        min-width: 2rem;
        min-height: 2rem;
        gap: 0;
    }

    .app-tile-history-link-label {
        display: none;
    }

    .field-group  { padding: 1.1rem 1.25rem; }
    .card-actions { padding: 0.9rem 1.25rem; }
    .app-update-banner {
        align-items: stretch;
        flex-direction: column;
    }
    .app-update-banner-action {
        width: 100%;
    }
    .sync-issues-overlay { padding: 0.75rem; }
    .sync-issues-panel { max-height: calc(100dvh - 1.5rem); padding: 1rem; }
    .sync-issue-actions { flex-direction: column; }
    .feature-page .vehicle-log-sync-card { padding: 0.75rem 0.9rem 0; }
    .vehicle-log-toolbar { grid-template-columns: 1fr; }
    .vehicle-log-actions { justify-content: stretch; }
    .vehicle-log-actions .e-btn { width: 100%; }
    .vehicle-log-grid { min-width: 980px; }

    /* Collapsible filter body */
    .vehicle-log-filter-body {
        overflow: hidden;
        max-height: 600px;
        transition: max-height 0.25s ease;
    }
    .vehicle-log-filter-body.is-collapsed {
        max-height: 0;
    }

    /* Toggle strip */
    .vehicle-log-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        width: 100%;
        padding: 0.45rem 0.9rem 0.75rem;
        background: transparent;
        border: none;
        border-top: 1px solid var(--border);
        cursor: pointer;
        color: var(--ink-muted);
        font-size: 0.72rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }
    .vehicle-log-filter-toggle:hover { color: var(--ink); }
}

/* ─── Purchase Request ─────────────────────────────────────────────────────── */

.pr-payment-pill,
.pr-status-pill {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    color: #333;
}

.pr-status-pill-large {
    font-size: 0.9rem;
    padding: 0.25rem 0.75rem;
}

.pr-action-buttons {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .app-tile { transition: none; }
}

/* Touch devices: suppress hover filter (no real hover on touch) */
@media (hover: none) {
    .app-tile:hover { filter: none; box-shadow: none; }
    .app-tile:active { filter: brightness(1.15); transition-duration: 60ms; }
}

/* ----- Dirt Sheet ----- */
.dirt-sheet-student-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dirt-sheet-student-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.dirt-sheet-student-card.is-complete {
    border-color: #16a34a;
    border-width: 2px;
    padding: calc(0.75rem - 1px) calc(1rem - 1px);
}

.dirt-sheet-student-main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1 1 auto;
    min-width: 0;
}

.dirt-sheet-student-name {
    font-weight: 600;
    font-size: 1rem;
    color: #111;
}

.dirt-sheet-group-pill {
    display: inline-block;
    align-self: flex-start;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.dirt-sheet-check {
    flex: 0 0 auto;
    color: #16a34a;
    width: 1.5rem;
    height: 1.5rem;
}

.dirt-sheet-check svg {
    width: 100%;
    height: 100%;
}

.dirt-sheet-header {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.dirt-sheet-note {
    width: 100%;
    min-height: 5rem;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font: inherit;
    resize: vertical;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.muted {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Dirt Sheet — combined program/student page */
.dirt-sheet-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    gap: 0.5rem;
}

.dirt-sheet-program-bar {
    flex: 0 0 auto;
    padding: 0.5rem 0.25rem;
    overflow: visible;
}

.dirt-sheet-program-bar .e-input-group,
.dirt-sheet-program-bar .e-ddl {
    overflow: visible !important;
}

.dirt-sheet-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1rem;
}

.dirt-sheet-group-header {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0.5rem 0 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 700;
    font-size: 0.875rem;
}

/* Dirt Sheet — entry page header */
.dirt-sheet-entry-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.dirt-sheet-entry-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.dirt-sheet-entry-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.dirt-sheet-entry-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 1rem 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.dirt-sheet-entry-name {
    font-weight: 700;
    font-size: 1.25rem;
    color: #111;
    text-align: center;
}

.dirt-sheet-entry-group-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Notes textarea fills remaining vertical space on the entry page. */
.dirt-sheet-note-group {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.dirt-sheet-entry-page .dirt-sheet-note {
    flex: 1 1 auto;
    min-height: 5rem;
}

/* Dirt Sheet program dropdown — date + track on top, program pill below. */
.ds-program-row {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    width: 100%;
    padding: 0;
    text-indent: 0;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
}

.ds-program-meta {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.8125rem;
}

.ds-program-date {
    font-weight: 700;
    color: #111;
}

.ds-program-track {
    color: #6b7280;
}

.ds-program-pill {
    display: inline-block;
    align-self: flex-start;
    max-width: 100%;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
}

/* Closed-state value: same template, with vertical breathing room and proper left padding on every line. */
.ds-program-row-value {
    gap: 0.5rem;
    padding: 0.5rem 0 0.5rem 0.75rem;
    box-sizing: border-box;
    width: 100%;
}

/* Let the input wrapper grow vertically to fit the padded value template. */
.e-input-group:has(.ds-program-row-value),
.e-ddl:has(.ds-program-row-value) {
    height: auto !important;
    min-height: unset !important;
}

/* Popup list items: auto-height, consistent left padding on every wrapped line. */
.e-popup .e-list-item:has(.ds-program-row) {
    height: auto !important;
    min-height: unset !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    text-indent: 0 !important;
    padding: 0.625rem 0.875rem !important;
}

/* Closed-dropdown input: padding lives on .ds-program-row-value so wrapped lines align. */
.e-input-group:has(.ds-program-row-value) .e-input,
.e-ddl:has(.ds-program-row-value) .e-input {
    padding-left: 0 !important;
    text-indent: 0 !important;
    height: auto !important;
}

/* Dirt Sheet entry — strip separators between fields; keep the header divider. */
.dirt-sheet-entry-page .field-group {
    border-bottom: none;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* ===== Event Schedule ===== */
.event-schedule-page { display: flex; flex-direction: column; gap: 0.75rem; }

.event-schedule-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem 0.5rem;
}

.event-schedule-date {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.event-schedule-date-picker { flex: 1; }
.event-schedule-date-picker .e-input {
    text-align: center;
    font-size: 1.0625rem;
    font-weight: 600;
}

.event-schedule-date-nav {
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    width: 2.125rem;
    height: 2.125rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #374151;
}

.event-schedule-date-nav svg {
    width: 1rem;
    height: 1rem;
    stroke-width: 1.75;
}

.event-schedule-date-nav:disabled { opacity: 0.5; cursor: not-allowed; }

.event-schedule-date .e-input-group { height: 2.125rem; }
.event-schedule-date-picker .e-input { cursor: pointer; }

.event-schedule-cache-note {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: right;
}

/* Always-visible footer: subtle hyperlink-style export actions pinned below the scroll area. */
.event-schedule-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e5e7eb;
}

.event-schedule-link-btn {
    background: none;
    border: none;
    padding: 0.25rem 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.event-schedule-link-btn:hover { color: #1d4ed8; }

.event-schedule-link-btn:disabled {
    color: #9ca3af;
    text-decoration: none;
    cursor: not-allowed;
}

.event-schedule-footer-sep { color: #d1d5db; }

/* Transient result overlay (success/error) shown after an export; click anywhere to dismiss. */
.event-schedule-toast-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.event-schedule-toast {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    max-width: 22rem;
    padding: 0.8rem 1.15rem;
    border-radius: var(--r-pill, 9999px);
    background: rgba(17, 18, 20, 0.92);
    box-shadow: var(--sh-md, 0 10px 25px rgba(0, 0, 0, 0.25));
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: left;
}

.event-schedule-toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    flex: 0 0 auto;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 800;
}

.event-schedule-toast.is-success .event-schedule-toast-icon { background: #16a34a; }
.event-schedule-toast.is-error .event-schedule-toast-icon { background: #dc2626; }

.event-schedule-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem 1rem;
}

.event-schedule-table {
    width: 100%;
    max-width: 56rem;
    border-collapse: collapse;
    table-layout: fixed;
    margin: 0 auto;
    font-size: 0.8125rem;
}

.event-schedule-table + .event-schedule-table { margin-top: 0.25rem; }

.event-schedule-col-time { width: 3rem; }
.event-schedule-col-location { width: 5rem; }
.event-schedule-col-session { width: auto; }

@media (min-width: 768px) {
    .event-schedule-col-time { width: 3.5rem; }
    .event-schedule-col-location { width: 6rem; }
}

.event-schedule-table th,
.event-schedule-table td {
    padding: 0.25rem 0.5rem;
    vertical-align: middle;
    text-align: left;
}

.event-schedule-track-banner {
    background: #555;
    color: #fff;
    font-weight: 600;
    padding: 0.4rem 0.625rem !important;
    border: none;
    box-shadow: inset 0 0 0 1px #444;
    position: sticky;
    top: 0;
    z-index: 2;
}

.event-schedule-time {
    font-weight: 700;
    border-bottom: 1px dotted #d1d5db;
    white-space: nowrap;
}

.event-schedule-location {
    background: #f5f5f5;
    border-bottom: 1px dotted #d1d5db;
    white-space: nowrap;
}

.event-schedule-session {
    border: 1px solid transparent;
    line-height: 1.2;
}

/* ===== Event Calendar ===== */
.event-calendar-page { display: flex; flex-direction: column; gap: 0.75rem; height: 100%; }

.event-calendar-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem 0.5rem;
}

.event-calendar-range .e-input-group { height: 2.25rem; }

.event-calendar-cache-note {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: right;
}

.event-calendar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.75rem 1.5rem;
}

.event-calendar-day {
    margin: 0 auto 0.75rem;
    max-width: 56rem;
}

.event-calendar-day-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #1f2937;
    color: #fff;
    border-radius: 0.375rem 0.375rem 0 0;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.event-calendar-day-dow {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    opacity: 0.85;
}

.event-calendar-day-date { font-size: 1rem; }
.event-calendar-day-year { font-size: 0.75rem; opacity: 0.7; margin-left: auto; }

.event-calendar-day-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
}

.event-calendar-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid #f1f5f9;
}

.event-calendar-card:last-child { border-bottom: none; }

.event-calendar-card-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0.625rem;
    border-radius: 0.375rem;
    border: 1px solid transparent;
    line-height: 1.2;
    font-weight: 600;
    font-size: 0.875rem;
}

.event-calendar-card-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-calendar-card-day-badge {
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid currentColor;
}

.event-calendar-card-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #4b5563;
    padding: 0 0.125rem;
}

.event-calendar-card-eid {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 600;
    color: #1f2937;
}

.event-calendar-card-capacity {
    margin-left: auto;
    font-weight: 600;
}

/* ===== Classroom Presentations ===== */
.classroom-presentations-page {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
}

.classroom-presentations-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0.25rem 0;
}

.classroom-presentations-header h1 {
    font-size: clamp(1.5rem, 5vw, 2.1rem);
    font-weight: 900;
    letter-spacing: -0.035em;
    line-height: 1.08;
    color: var(--ink);
}

.classroom-presentations-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.1rem;
    padding: 0.42rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: #fff;
    border: 1px solid var(--border);
}

.classroom-presentations-status::before {
    content: '';
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 999px;
}

.classroom-presentations-status.is-online {
    color: #166534;
}

.classroom-presentations-status.is-online::before {
    background: #22c55e;
}

.classroom-presentations-status.is-offline {
    color: #b91c1c;
}

.classroom-presentations-status.is-offline::before {
    background: #ef4444;
}

.classroom-presentations-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.25rem 1.5rem;
}

.classroom-presentations-empty {
    max-width: 48rem;
    margin: 0 auto;
}

.classroom-presentations-retry {
    margin-top: 1rem;
}

.classroom-presentation-group {
    max-width: 58rem;
    margin: 0 auto 0.85rem;
}

.classroom-presentation-group-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    background: #1f2937;
    color: #fff;
    border-radius: 0.375rem 0.375rem 0 0;
}

.classroom-presentation-group-header h2 {
    min-width: 0;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.2;
}

.classroom-presentation-group-header span {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.72;
    white-space: nowrap;
}

.classroom-presentation-list {
    display: grid;
    gap: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    overflow: hidden;
}

.classroom-presentation-card {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    min-height: 4rem;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--ink);
    transition: background 150ms ease;
}

.classroom-presentation-card:last-child {
    border-bottom: none;
}

.classroom-presentation-card:hover,
.classroom-presentation-card:focus-visible {
    outline: none;
    background: #f8fafc;
}

.classroom-presentation-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--r-sm);
    background: rgba(215, 25, 32, 0.1);
    color: var(--red);
    border: 1px solid rgba(215, 25, 32, 0.18);
}

.classroom-presentation-card-icon svg {
    width: 1.2rem;
    height: 1.2rem;
}

.classroom-presentation-card-title {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.25;
}

.classroom-presentation-card-open {
    color: var(--red);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@media (max-width: 480px) {
    .classroom-presentations-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .classroom-presentation-card {
        grid-template-columns: 2.25rem minmax(0, 1fr);
    }

    .classroom-presentation-card-open {
        display: none;
    }

    .classroom-presentation-card-icon {
        width: 2.25rem;
        height: 2.25rem;
    }
}

/* Student Feedback — feedback count badge on student card */
.student-feedback-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.5rem;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: #eef1f5;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

.student-feedback-count-badge.has {
    background: #dcfce7;
    color: #166534;
}

.student-feedback-view-all-bar {
    display: flex;
    justify-content: flex-end;
    padding: 0.875rem 0.25rem 1.25rem;
}

.student-feedback-entry-actions-bar {
    display: flex;
    justify-content: flex-end;
    padding: 0 1.5rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 480px) {
    .student-feedback-entry-actions-bar {
        padding: 0 1.25rem;
    }
}

.student-feedback-card-actions-row {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Modal list of feedback rows */
.student-feedback-modal-body {
    padding: 0.5rem 1rem 1rem;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.student-feedback-card {
    border: 1px solid #d9dee7;
    border-radius: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: #fff;
    margin: 0.5rem 0;
}

.student-feedback-card.is-mine {
    border-color: #1f4ed8;
    background: #f8faff;
}

.student-feedback-card.is-pending {
    border-color: #f59e0b;
    background: #fffbeb;
}

.student-feedback-card-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.student-feedback-author {
    font-weight: 700;
    font-size: 0.9375rem;
    color: #111827;
}

.student-feedback-date {
    color: #6b7280;
    font-size: 0.75rem;
}

.student-feedback-student {
    color: #374151;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.student-feedback-text {
    font-size: 0.9375rem;
    line-height: 1.4;
    white-space: pre-wrap;
    color: #1f2937;
}

.student-feedback-pill {
    margin-left: auto;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
}

.student-feedback-pill-mine {
    background: #e0e7ff;
    color: #1f4ed8;
}

.student-feedback-pill-pending {
    background: #fef3c7;
    color: #92400e;
}

.student-feedback-card-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.student-feedback-edit-text {
    width: 100%;
    min-height: 6rem;
    border: 1px solid #d9dee7;
    border-radius: 0.5rem;
    padding: 0.5rem;
    font: inherit;
    font-size: 0.9375rem;
    resize: vertical;
}
