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

:root {
    --brand: #0495C8;
    --brand-dark: #0378a0;
    --brand-tint: #E8F6FC;
    --text: #0A2540;
    --text-muted: #5a6a7a;
    --text-light: #8a99a8;
    --bg: #F5F7FA;
    --surface: #ffffff;
    --border: #e2e8f0;
    --success: #0e9f6e;
    --success-tint: #e8faf4;
    --danger: #e53e3e;
    --danger-tint: #fff5f5;
    --warning: #d97706;
    --warning-tint: #fffbeb;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-pill: 99px;
    --font-mono: 'Courier New', Courier, monospace;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(4, 149, 200, 0.10), 0 1px 4px rgba(0, 0, 0, 0.06);
    --focus-ring: 0 0 0 3px rgba(4, 149, 200, 0.1);
    --border-width: 1.5px;
}

/* Form controls don't inherit font-family from body by default in
   browsers — this makes every input/select/textarea/button match the
   page font without each one needing to redeclare it. */
button, input, select, textarea {
    font-family: inherit;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 12px;
    line-height: 1.5;
}

/* ─────────────────────────────────────────
   LOGIN
───────────────────────────────────────── */
#login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, var(--brand-tint) 0%, var(--bg) 60%);
}

.login-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 48px 40px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-md);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.login-logo {
    width: 60%;
}

.login-note {
    font-size: 12px !important;
    color: var(--danger) !important;
    background: var(--danger-tint);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    color: var(--text-light);
    font-size: 12px;
}

.login-divider::before, .login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.app-footer {
    text-align: center;
    font-size: 12.5px;
    color: var(--text-light);
    padding: 24px 20px 24px;
}

.app-footer i {
    margin-right: 2px;
}

.app-footer a {
    color: inherit;
    text-decoration: underline;
}

.login-card h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 20px;
    background: var(--brand);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.google-btn:hover {
    background: var(--brand-dark);
}

.google-btn svg {
    width: 20px;
    height: 20px;
}

/* ─────────────────────────────────────────
   APP SHELL
───────────────────────────────────────── */
#app-page {
    display: none;
    min-height: 100vh;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 18px;
    color: var(--text);
}

.topbar-brand-dot {
    width: 8px;
    height: 8px;
    background: var(--brand);
    border-radius: 50%;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 5px;
    background: var(--bg);
    border-radius: var(--radius-pill);
    font-size: 13px;
    color: var(--text);
}

#user-role-badges {
    display: inline-flex;
    gap: 4px;
}

.user-avatar {
    width: 26px;
    height: 26px;
    background: var(--brand);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 600;
}

.sign-out-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.sign-out-btn:hover {
    color: var(--danger);
    background: var(--danger-tint);
}

/* ─────────────────────────────────────────
   TOP NAV (volunteer + optional admin tab)
───────────────────────────────────────── */
.nav-tabs {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    gap: 0;
    overflow-x: auto;
    position: sticky;
    top: 56px;
    z-index: 19;
}

.nav-tab {
    padding: 14px 18px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

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

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

.nav-tab-admin {
    display: none; /* shown only for admins */
    margin-left: auto;
    color: var(--brand);
}

.nav-tab-admin.visible {
    display: block;
}

.nav-tab-admin.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

/* ─────────────────────────────────────────
   PAGES
───────────────────────────────────────── */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* volunteer main width */
.vol-main {
    max-width: 680px;
    margin: 0 auto;
    padding: 32px 20px 0px;
}

/* admin main width */
.adm-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 28px 0px;
}

/* ─────────────────────────────────────────
   HERO COUNTER
───────────────────────────────────────── */
.hero {
    background: var(--brand);
    border-radius: 18px;
    padding: 32px 28px;
    color: white;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: '';
    position: absolute;
    right: -30px;
    top: -30px;
    width: 160px;
    height: 160px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 50%;
    pointer-events: none;
}

.hero-label {
    font-size: 13px;
    font-weight: 500;
    opacity: .8;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.hero-hours {
    margin-top: 4px;
}

.hero-sub {
    font-size: 14px;
    opacity: .75;
    margin-bottom: 20px;
}

.hero-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.hero-stat {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 10px 16px;
    flex: 1;
}

.hero-stat-val {
    font-size: 18px;
    font-weight: 600;
}

.hero-stat-lbl {
    font-size: 12px;
    opacity: .75;
    margin-top: 1px;
}

/* ─────────────────────────────────────────
   VOLUNTEER CARDS
───────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: var(--border-width) solid var(--border);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title-icon {
    color: var(--brand-dark);
}

/* ─────────────────────────────────────────
   CHECK IN / OUT
───────────────────────────────────────── */
.checkin-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 14px;
    color: var(--text-muted);
}

.checkin-status.active {
    background: var(--success-tint);
    color: var(--success);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}

.status-dot.active {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(14, 159, 110, 0.2);
}

/* ─────────────────────────────────────────
   INPUTS (shared)
───────────────────────────────────────── */
.input, .sel, .textarea {
    width: 100%;
    padding: 10px 13px;
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color 0.15s;
}

.input:focus, .sel:focus, .textarea:focus {
    border-color: var(--brand);
    box-shadow: var(--focus-ring);
}

/* Log-hours tabs stack these fields directly (no wrapping .modal-field to
   space them out), so each needs its own bottom margin like its cat-picker
   and hms-input-row siblings already have. */
#date-input, #manual-notes, #checkin-notes,
#event-nonmembers, #event-date-input, #event-notes {
    margin-bottom: 10px;
}

.textarea {
    resize: vertical;
    min-height: 72px;
    margin-bottom: 0;
}

/* ─────────────────────────────────────────
   BUTTONS (shared)
───────────────────────────────────────── */
.btn {
    padding: 9px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.2;
}

.btn-primary {
    background: var(--brand);
    color: white;
}

.btn-primary:hover {
    background: var(--brand-dark);
}

.btn-success {
    background: var(--success);
    color: white;
    flex: 1;
}

.btn-success:hover {
    background: #0c8c61;
}

.btn-outline {
    background: none;
    color: var(--text-muted);
    border: var(--border-width) solid var(--border);
}

.btn-outline:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.btn-danger-ghost {
    background: none;
    color: var(--danger);
    border: var(--border-width) solid var(--border);
}

.btn-danger-ghost:hover {
    background: var(--danger-tint);
    border-color: var(--danger);
}

.btn-sm {
    padding: 12px;
    font-size: 12px;
    background: var(--surface);
}

.btn-row {
    display: flex;
    gap: 10px;
}

.btn-full {
    width: 100%;
    padding: 11px 16px;
    font-size: 14px;
}

/* ─────────────────────────────────────────
   LOG/CHECK-IN TABS (volunteer)
───────────────────────────────────────── */
/* .seg-tabs/.seg-tab is a segmented toggle, visually identical to
   .tabs/.tab — kept as a separate class only so it isn't affected by
   switchTab()'s global .tab query; declarations are shared here. */
.tabs, .seg-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.seg-tabs {
    margin-bottom: 14px;
}

.tab, .seg-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.seg-tab {
    white-space: nowrap;
}

.tab.active, .seg-tab.active {
    background: var(--surface);
    color: var(--brand);
    box-shadow: var(--shadow);
}

/* ─────────────────────────────────────────
   HISTORY ENTRIES
───────────────────────────────────────── */
.log-entry {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.log-entry-data {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 12px;
    flex: 1;
}

.log-time-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.log-entry-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-cat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.log-cat {
    display: inline-block;
    padding: 3px 10px;
    background: var(--brand-tint);
    color: var(--brand);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
}

.log-cat-tag {
    background: var(--border);
    color: var(--text-muted);
}

.log-date {
    font-size: 12px;
    color: var(--text-light);
    min-width: 70px;
}

.log-notes {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    padding-left: 8px;
}

.log-hours {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.stat-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}

.stat-card-accent {
    border-bottom: 3px solid var(--brand);
}

.stat-card-val {
    font-size: 28px;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 4px;
    font-family: var(--font-mono);
}

.stat-card-lbl {
    font-size: 13px;
    color: var(--text-muted);
}

/* ─────────────────────────────────────────
   ADMIN — CSV IMPORT PREVIEW
───────────────────────────────────────── */
.import-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.import-stat {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.import-stat-val {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.import-stat-lbl {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.import-note {
    font-size: 12.5px;
    color: var(--brand);
    background: var(--brand-tint);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 12px;
}

.info-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--brand-dark);
    background: var(--brand-tint);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.info-box i {
    margin-top: 2px;
}

.import-error-list {
    max-height: 220px;
    overflow-y: auto;
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-sm);
}

.import-error-row {
    font-size: 12.5px;
    color: var(--text-muted);
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
}

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

.import-error-row strong {
    color: var(--danger);
    font-weight: 600;
}

/* ─────────────────────────────────────────
   ADMIN — CARDS WITH HEADER
───────────────────────────────────────── */
.acard {
    background: var(--surface);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.acard-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.acard-title {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.acard-body {
    padding: 20px 24px;
}

/* ─────────────────────────────────────────
   ADMIN — SUB TABS
───────────────────────────────────────── */
.adm-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.adm-tab {
    padding: 8px 16px;
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-pill);
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.adm-tab:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.adm-tab.active {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
}

.adm-section {
    display: none;
}

.adm-section.active {
    display: block;
}

/* ─────────────────────────────────────────
   ADMIN — TABLE
───────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    text-align: left;
    padding: 11px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}

td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #fafbfc;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-brand {
    background: var(--brand-tint);
    color: var(--brand);
}

.badge-success {
    background: var(--success-tint);
    color: var(--success);
}

.action-btns {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* ─────────────────────────────────────────
   ADMIN — FILTER ROW
───────────────────────────────────────── */
.filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: baseline;
}

.filter-row .input, .filter-row .sel {
    flex: 1;
    min-width: 140px;
    margin-bottom: 0;
}

/* ─────────────────────────────────────────
   ADMIN — VOLUNTEER + CATEGORY ROWS
───────────────────────────────────────── */
.vol-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

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

.vol-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.vol-avatar {
    width: 36px;
    height: 36px;
    background: var(--brand-tint);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand);
    flex-shrink: 0;
}

.vol-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.vol-meta {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.vol-name {
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Volunteers admin list — name + Admin/Co-lead badges on one line,
   stacked onto their own row on mobile (see .vol-name-line below). */
.vol-name-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.vol-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.vol-email {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vol-last-login {
    font-size: 11px;
    color: var(--text-light);
    flex-shrink: 0;
}

.vol-hrs {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

.vol-date {
    color: var(--text-muted);
    font-size: 13px;
}

.cat-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 16px;
}

.cat-card {
    background: var(--bg);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.cat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.cat-card-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.cat-card-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.cat-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.cat-subcats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.subcat-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: var(--surface);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 12px;
    color: var(--text-muted);
}

.subcat-chip-add {
    border-style: solid;
    background: var(--brand);
    color: white;
    cursor: pointer;
    min-height: 26px;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.subcat-chip-add:hover {
    background: var(--brand-dark);
}

.subcat-chip-del {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--text-light);
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
}

.subcat-chip-del:hover {
    color: var(--danger);
}

/* Row in the subcategory-manager modal (renderSubcatList) — rename and
   view modes each add their own layout property on top of this. */
.subcat-list-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

/* ─────────────────────────────────────────
   CATEGORY PICKER (merged category + subcategory)
───────────────────────────────────────── */
.cat-picker {
    position: relative;
    margin-bottom: 10px;
}

.modal-field .cat-picker {
    margin-bottom: 0;
}

.cat-picker-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 14px;
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s;
}

.cat-picker.open .cat-picker-trigger {
    border-color: var(--brand);
    box-shadow: var(--focus-ring);
}

.cat-picker-trigger-label.cat-picker-placeholder {
    color: var(--text-light);
}

.cat-picker-chevron {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.15s;
}

.cat-picker.open .cat-picker-chevron {
    transform: rotate(180deg);
}

.cat-picker-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--surface);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
}

.cat-picker.open .cat-picker-panel {
    display: block;
}

.cat-picker-group + .cat-picker-group {
    margin-top: 2px;
}

.cat-picker-row {
    display: flex;
    align-items: center;
    gap: 2px;
}

.cat-picker-option {
    flex: 1;
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    border: none;
    background: none;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
}

.cat-picker-option:hover {
    background: var(--bg);
}

.cat-picker-option.selected {
    background: var(--brand-tint);
    color: var(--brand);
    font-weight: 600;
}

.cat-picker-suboption {
    font-size: 13px;
    padding-left: 45px;
    color: var(--text-muted);
}

/* Top-level category names — not the favourites list or subcategory rows */
.cat-picker-group > .cat-picker-row > .cat-picker-option {
    font-weight: 600;
}

/* Shared icon-button base for the subcategory-expand chevron and the
   favourite star — same size/shape/reset, each keeps its own color and
   transition since they animate different things (rotation vs. color). */
.cat-picker-expand, .cat-picker-star {
    flex-shrink: 0;
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.cat-picker-expand {
    height: 32px;
    color: var(--text-muted);
    transition: transform 0.15s, background 0.15s;
}

.cat-picker-expand:active {
    background: none;
}

.cat-picker-expand.open {
    transform: rotate(180deg);
}

.cat-picker-expand:disabled {
    opacity: .3;
    cursor: default;
}

.cat-picker-expand:disabled:hover {
    background: none;
}

.cat-picker-favorites-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-light);
    padding: 6px 10px 4px;
}

.cat-picker-favorites .cat-picker-option {
    font-size: 13px;
}

.cat-picker-fav-sep {
    color: var(--text-light);
}

.cat-picker-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 4px;
}

.cat-picker-star {
    color: var(--text-light);
    transition: color 0.15s, background 0.15s;
}

.cat-picker-star:hover {
    background: var(--bg);
    color: var(--text-muted);
}

.cat-picker-star.active {
    color: var(--brand);
}

.cat-picker-star.active:hover {
    color: var(--brand);
}

.add-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.add-row .input {
    flex: 1;
    margin-bottom: 0;
}

/* ─────────────────────────────────────────
   MODALS
───────────────────────────────────────── */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 37, 64, 0.35);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: 16px;
    padding: 28px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-field {
    margin-bottom: 12px;
}

.modal-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ─────────────────────────────────────────
   TUTORIAL MODAL
───────────────────────────────────────── */
.tutorial-step-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--brand);
}

.tutorial-step-body {
    margin-bottom: 14px;
}

/* ─────────────────────────────────────────
   EMPTY STATES
───────────────────────────────────────── */
.empty {
    text-align: center;
    padding: 36px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: .35;
}

.empty-state {
    text-align: center;
    padding: 32px 0;
    color: var(--text-muted);
    font-size: 14px;
}

.empty-state-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: .4;
}

/* ─────────────────────────────────────────
   TOAST
───────────────────────────────────────── */
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--text);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    transition: transform .3s ease;
    z-index: 100;
    white-space: nowrap;
    pointer-events: none;
}

#toast.show {
    transform: translateX(-50%) translateY(0);
}

#toast.success {
    background: var(--success);
}

#toast.error {
    background: var(--danger);
}

/* ─────────────────────────────────────────
   HH:MM:SS INPUT ROW
───────────────────────────────────────── */
.hms-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.hms-field {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.hms-input {
    width: 100%;
    padding: 11px 8px;
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    outline: none;
    text-align: center;
    transition: border-color 0.15s;
    -moz-appearance: textfield;
}

.hms-input::-webkit-outer-spin-button,
.hms-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.hms-input:focus {
    border-color: var(--brand);
    box-shadow: var(--focus-ring);
}

.hms-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    flex-shrink: 0;
}

.hms-sep {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    line-height: 1;
    padding-bottom: 2px;
}

/* ─────────────────────────────────────────
   DURATION DISPLAY STYLES
───────────────────────────────────────── */

/* 00h 00m — used everywhere a logged duration is shown */
.dur-hm {
    font-weight: 700;
    font-family: var(--font-mono);
}

.dur-hm .dur-unit {
    font-weight: 500;
    color: var(--text-light);
    margin-left: 1px;
}

/* the hero card sits on a colored background — keep its unit light */
.hero-hours .dur-hm .dur-unit {
    color: rgba(255,255,255,0.7);
}

/* hero sizing */
.hero-hours .dur-hm {
    font-size: 42px;
    line-height: 1;
}

/* hero sub-stats */
.hero-stat-val .dur-hm {
    font-size: 18px;
}
.hero-stat-val .dur-hm .dur-unit {
    color: rgba(255,255,255,0.65);
}

/* admin stat strip */
.stat-card-val .dur-hm {
    font-size: 26px;
}

@media (max-width: 640px) {
    .topbar-brand {
        font-size: inherit;
    }

    .login-card {
        padding: 36px 24px;
    }

    .stat-strip {
        grid-template-columns: repeat(2, 1fr);
    }

    .vol-main, .adm-main {
        padding: 20px 16px;
    }

    th, td {
        padding: 10px 12px;
    }

    .user-pill{
        display: none;
    }

    .cat-card-meta {
        display: none;
    }

    .sign-out-btn {
        color: var(--danger);
        background: var(--danger-tint);
    }

    .input {
        width: 100%;
        box-sizing: border-box;  /* Critical for mobile */
        max-width: 100%;
        overflow: hidden;
        -webkit-appearance: none;  /* Remove iOS default styling */
        -moz-appearance: none;
        appearance: none;
    }

    /* Target the date input specifically */
    input[type="date"] {
        width: 100%;
        box-sizing: border-box;
        max-width: 100%;
    }

    /* My history — time, category and description each on their own row */
    .log-entry-data {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    /* Volunteers list — email/last-login stack instead of one line.
       align-items: stretch (not the base rule's center, and not
       flex-start) so .vol-email fills the row's width and its ellipsis
       can actually trigger — center/flex-start size it to its own
       content instead, which never overflows. */
    .vol-meta {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .vol-last-login {
        margin-top: 1px;
    }

    /* Volunteers list — Admin/Co-lead badges move to their own row
       instead of squeezing onto the name's line (same align-items note
       as .vol-meta above — needed for .vol-name's ellipsis to trigger) */
    .vol-name-line {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
    }

    .log-date {
        min-width: 0;
    }

    /* iOS Safari auto-zooms the page on focus if the focused field's font
       is under 16px — bump every text-entry field up to avoid that. */
    .input, .sel, .textarea {
        font-size: 16px;
    }
}
/* ─────────────────────────────────────────
   PAGINATION
───────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 100px;
    text-align: center;
}

/* ─────────────────────────────────────────
   HISTORY — CALENDAR VIEW
───────────────────────────────────────── */
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.cal-header-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.cal-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 6px;
}

.cal-weekday {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

.cal-cell-daynum {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.cal-cell.has-entries {
    background: var(--bg);
    border-color: var(--border);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.cal-cell.has-entries:hover {
    border-color: var(--brand);
}

.cal-cell.today .cal-cell-daynum {
    color: var(--brand);
    font-weight: 700;
}

.cal-cell.selected {
    background: var(--brand-tint);
    border-color: var(--brand);
}

.cal-cell-hours {
    font-size: 10px;
    font-weight: 600;
    color: var(--brand);
    background: var(--brand-tint);
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}

.cal-cell.selected .cal-cell-hours {
    background: var(--brand);
    color: white;
}

.cal-day-detail {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.cal-day-detail-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 10px;
}

/* ─────────────────────────────────────────
   REPORTS — "Hours over time" bars
───────────────────────────────────────── */
.timeline-row {
    margin-bottom: 10px;
}

.timeline-row-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    align-items: baseline;
}

.timeline-row-name {
    font-size: 14px;
    color: var(--text-muted);
}

.timeline-row-hrs {
    font-size: 14px;
    font-weight: 600;
}

/* Match the "hours" value size across all 3 Reports panels (Top
   volunteers/Hours over time/Hours by category) — scoped so it doesn't
   affect .vol-hrs's other uses (Volunteers tab, All logs, "Log for" picker). */
#report-top-vols .vol-hrs {
    font-size: 14px;
}

.timeline-bar-track {
    height: 6px;
    background: var(--border);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.timeline-bar-fill {
    height: 100%;
    background: var(--brand);
    border-radius: var(--radius-pill);
}

/* ─────────────────────────────────────────
   REPORTS — "Hours by category" breakdown
───────────────────────────────────────── */
.cat-breakdown-item {
    margin-bottom: 14px;
}

.cat-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    gap: 8px;
}

.cat-hrs {
    font-size: 14px;
    font-weight: 600;
}

.overview-cat-subs {
    display: none;
    flex-direction: column;
    gap: 5px;
    margin-top: 8px;
}

.overview-cat-subs.open {
    display: flex;
}

.cat-sub-caption {
    font-size: 12px;
    color: var(--text-muted);
}

/* ─────────────────────────────────────────
   PRINT — Reports "Export PDF" (window.print())
───────────────────────────────────────── */
.print-report-header {
    display: none;
}

.print-report-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: baseline;
}

.print-report-meta {
    font-size: 13px;
    margin-top: 4px;
}

@media print {
    /* Chrome drops plain background-color (no border/image) from printouts
       by default unless told otherwise — without this, the timeline and
       category bars (which are just colored divs) render invisible. */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .topbar, .nav-tabs, .adm-tabs, .filter-row, .app-footer {
        display: none !important;
    }

    .print-report-header {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 28px;
    }

    .print-report-title {
        font-size: 15px;
    }

    .print-report-meta {
        margin-top: 0;
        position: relative;
        top: 2px;
        flex: 1;
        display: flex;
        justify-content: space-between;
        align-items: baseline;
    }

    body, .adm-main {
        background: white;
        font-size: 11px;
    }

    .stat-strip {
        gap: 8px;
        margin-bottom: 14px;
    }

    .stat-card {
        padding: 10px 12px;
    }

    .stat-card-val {
        font-size: 22px;
        margin-bottom: 2px;
    }

    /* Same specificity as the screen-only 26px rule for .dur-hm inside a
       stat card — this one wins in print since it comes later in the
       cascade, keeping all 4 numbers (plain or "00h 00m") the same size. */
    .stat-card-val .dur-hm {
        font-size: 22px;
    }

    .stat-card-lbl {
        font-size: 10px;
    }

    .acard {
        box-shadow: none;
        border: var(--border-width) solid var(--border);
        break-inside: avoid;
        margin-bottom: 0;
    }

    .acard-header {
        padding: 8px 12px;
    }

    .acard-title, .card-title {
        font-size: 12px;
    }

    .acard-body {
        padding: 10px 12px;
    }

    /* Fold the three report cards into one compact page: top volunteers
       and the category breakdown side by side, the hours-over-time trend
       as a thin strip spanning the full width underneath. */
    .report-cards {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    #report-card-topvols {
        order: 1;
    }

    #report-card-timeline {
        order: 2;
    }

    #report-card-catbreakdown {
        order: 3;
        grid-column: 1 / -1;
    }

    /* Top volunteers — top 10 only, email dropped to save a line each */
    #report-top-vols .vol-row:nth-child(n+11) {
        display: none;
    }

    /* :last-child alone won't drop the border here — rows 11+ are still in
       the DOM (just hidden above), so the 10th is never the true last child. */
    #report-top-vols .vol-row:nth-child(10) {
        border-bottom: none;
    }

    #report-top-vols .vol-row {
        padding: 3px 0;
    }

    #report-top-vols .vol-avatar {
        width: 20px;
        height: 20px;
        font-size: 9px;
    }

    #report-top-vols .vol-name {
        font-size: 11px;
    }

    #report-top-vols .vol-email {
        display: none;
    }

    /* Hours by category — top 10, subcategories collapsed regardless of
       what's expanded on screen (the old rule forced them all open — a
       one-pager has no room for that level of detail). The category/
       subcategory toggle is dropped too — whichever view was active on
       screen prints as-is, with no interactive control to switch it. */
    #report-card-catbreakdown .seg-tabs {
        display: none !important;
    }

    #report-cat-breakdown .cat-breakdown-item:nth-child(n+11) {
        display: none;
    }

    #report-cat-breakdown .cat-breakdown-item {
        margin-bottom: 6px !important;
    }

    .cat-picker-expand {
        display: none !important;
    }

    .overview-cat-subs {
        display: none !important;
    }

    /* Hours over time — thin sparkline instead of a full chart */
    .timeline-row {
        margin-bottom: 3px;
    }

    .timeline-row-label {
        margin-bottom: 1px;
    }

    .timeline-row-name {
        font-size: 11px;
    }

    /* Same font size for every "hours" value across all three panels */
    #report-top-vols .vol-hrs,
    .timeline-row-hrs,
    .cat-hrs {
        font-size: 14px !important;
    }

    .timeline-bar-track {
        height: 3px;
    }
}