.site-header {
    background: #1e4d2b;
    border-bottom: 4px solid #c8d32b;
    color: white;
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    margin: 0;
}

.logo-box {
    width: 42px;
    height: 42px;
    background: white;
    color: #1e4d2b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 4px;
    font-size: 0.7rem;
}

.title-group {
    display: flex;
    flex-direction: column;
}

.title-group strong {
    font-size: 0.95rem;
    letter-spacing: 0.05em;
}

.subtitle {
    font-size: 0.75rem;
    color: #d1d5db;
}

.header-nav {
    display: flex;
    align-items: center;
}

.header-nav a {
    color: white;
    margin-left: 18px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.header-nav a:hover {
    text-decoration: underline;
}
.logo-img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 50%;
}
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #ffffff;
    color: #1f2933;
}

a {
    color: #1e4d2b;
    text-decoration: none;
    font-weight: 600;
}

a:hover {
    text-decoration: underline;
}

.nav {
    background: #1e4d2b;
    color: white;
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid #c8d32b;
}

.nav strong {
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.nav a {
    color: white;
    margin-left: 18px;
    font-size: 0.9rem;
}

.container {
    max-width: 960px;
    margin: 34px auto;
    padding: 0 24px;
}

.narrow {
    max-width: 620px;
}

.landing,
.auth-wrapper {
    min-height: 82vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #ffffff;
}

.card {
    background: white;
    border-radius: 4px;
    padding: 26px;
    border: 1px solid #d7d7d7;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.landing-card {
    max-width: 680px;
    text-align: center;
}

.form-card {
    width: 100%;
    max-width: 460px;
}

h1,
h2,
h3 {
    color: #1e4d2b;
}

h1 {
    font-size: 2rem;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

label {
    display: block;
    font-weight: bold;
    margin-top: 16px;
    color: #1e4d2b;
}

input,
select {
    width: 100%;
    padding: 11px;
    margin-top: 6px;
    border: 1px solid #b8b8b8;
    border-radius: 3px;
    background: #ffffff;
}

.button {
    display: inline-block;
    background: #c8d32b;
    color: #1e4d2b;
    border: none;
    border-radius: 3px;
    padding: 11px 18px;
    margin-top: 18px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.button:hover {
    background: #dbe442;
    text-decoration: none;
}

.button.small {
    padding: 8px 12px;
    margin-top: 0;
}

.button.secondary {
    background: #1e4d2b;
    color: white;
}

.error {
    color: #8b0000;
    background: #f8d7da;
    padding: 10px;
    border-radius: 3px;
}

.row {
    border-top: 1px solid #e5e5e5;
    padding: 14px 0;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.row:first-of-type {
    border-top: none;
}

.muted {
    color: #6b7280;
}

.pill {
    background: #1e4d2b;
    color: white;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    text-transform: capitalize;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th,
td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #e5e5e5;
}

th {
    background: #1e4d2b;
    color: white;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.78rem;
    font-weight: bold;
    color: #1e4d2b;
    margin-bottom: 8px;
}

.hero-card {
    background: #ffffff;
    border-radius: 4px;
    padding: 32px;
    border: 1px solid #d7d7d7;
    border-top: 6px solid #1e4d2b;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.hero-card h1 {
    margin-top: 0;
    color: #1e4d2b;
}

.hero-card p {
    max-width: 720px;
    line-height: 1.55;
}

.hero-badge {
    background: #1e4d2b;
    color: white;
    padding: 18px 22px;
    border-radius: 4px;
    font-weight: bold;
    letter-spacing: 0.08em;
    border-bottom: 4px solid #c8d32b;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}
@media (max-width: 1100px) {
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 650px) {
    .quick-actions {
        grid-template-columns: 1fr;
    }
}
.action-card {
    display: block;
    background: white;
    color: #1f2933;
    border-radius: 4px;
    padding: 22px;
    border: 1px solid #d7d7d7;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.action-card:hover {
    border-color: #1e4d2b;
    text-decoration: none;
}

.action-card h2 {
    margin-top: 0;
    color: #1e4d2b;
}

.action-card p {
    color: #555;
    line-height: 1.45;
}

.stat-row {
    border-top: 1px solid #e5e5e5;
    padding: 14px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-row:first-of-type {
    border-top: none;
}

.stat-row strong {
    color: #1e4d2b;
    font-size: 1.15rem;
}

body::after {
    content: "";
    display: block;
    height: 70px;
    margin-top: 50px;
    background: #1e4d2b;
    border-top: 4px solid #c8d32b;
}

@media (max-width: 900px) {
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .hero-card {
        display: block;
    }

    .hero-badge {
        display: inline-block;
        margin-top: 12px;
    }
}

@media (max-width: 800px) {
    .grid,
    .page-header {
        grid-template-columns: 1fr;
        display: block;
    }

    .page-header .button {
        margin-top: 10px;
    }

    .nav {
        display: block;
    }

    .nav a {
        display: inline-block;
        margin-top: 8px;
        margin-left: 0;
        margin-right: 12px;
    }
}
.home-hero {
    background: linear-gradient(135deg, #ffffff 0%, #f4f7f2 100%);
    border: 1px solid #d7d7d7;
    border-top: 7px solid #1e4d2b;
    padding: 34px;
    margin-bottom: 26px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 28px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
}

.home-hero h1 {
    font-size: 2.3rem;
    margin: 8px 0;
}

.home-hero p {
    max-width: 720px;
    line-height: 1.6;
}

.role-card {
    background: #1e4d2b;
    color: white;
    min-width: 170px;
    padding: 22px;
    border-bottom: 5px solid #c8d32b;
    text-align: center;
}

.role-card span {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.role-card strong {
    display: block;
    font-size: 1.5rem;
    margin-top: 8px;
}

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

.stat-card {
    background: white;
    border: 1px solid #d7d7d7;
    padding: 22px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}

.stat-card span {
    display: block;
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.stat-card strong {
    color: #1e4d2b;
    font-size: 2rem;
}

.dashboard-layout {
    display: block;
}

.event-list-item {
    border-top: 1px solid #e5e5e5;
    padding: 16px 0;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
}

.event-list-item:first-of-type {
    border-top: none;
}

.event-list-item p {
    margin: 5px 0;
    color: #555;
}

.event-list-item span:not(.pill) {
    color: #777;
    font-size: 0.9rem;
}

.note-list {
    padding-left: 20px;
    line-height: 1.7;
}

.note-list li {
    margin-bottom: 10px;
}

@media (max-width: 900px) {
    .home-hero,
    .dashboard-layout {
        display: block;
    }

    .role-card {
        margin-top: 18px;
    }

    .stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}
/* ── Back button ──────────────────────────────────────────────────────────── */
#back-btn {
    position: fixed;
    top: 80px;
    left: 220px;
    z-index: 100;
    background: #1e4d2b;
    color: white;
    border: none;
    border-bottom: 3px solid #c8d32b;
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 0.03em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

#back-btn:hover {
    background: #286038;
}

/* ── Settings dropdown ────────────────────────────────────────────────────── */
.settings-wrapper {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: 200;
}

.settings-icon {
    background: #1e4d2b;
    border: none;
    border-bottom: 3px solid #c8d32b;
    border-radius: 4px;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px 12px;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transition: background 0.15s;
}

.settings-icon:hover {
    background: #286038;
}

.settings-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: white;
    border: 1px solid #d7d7d7;
    border-top: 3px solid #1e4d2b;
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.14);
    min-width: 220px;
    z-index: 500;
}

.settings-dropdown.open {
    display: block;
}

.settings-user-info {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.settings-user-info strong {
    color: #1e4d2b;
    font-size: 0.95rem;
}

.settings-user-info span {
    font-size: 0.8rem;
    color: #777;
}

.settings-role {
    display: inline-block;
    background: #1e4d2b;
    color: white !important;
    font-size: 0.7rem !important;
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: 0.06em;
    margin-top: 2px;
    width: fit-content;
}

.settings-dropdown a {
    display: block;
    padding: 11px 16px;
    color: #1f2933;
    font-weight: normal;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
}

.settings-dropdown a:hover {
    background: #f4f7f2;
    text-decoration: none;
}

.settings-logout {
    color: #8b0000 !important;
}

/* ── Roster rate pills ────────────────────────────────────────────────────── */
.rate-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: bold;
    min-width: 48px;
    text-align: center;
}

.rate-good { background: #1e4d2b; color: white; }
.rate-warn { background: #c8d32b; color: #1e4d2b; }
.rate-bad  { background: #8b0000; color: white; }
.rate-none { background: #e5e5e5; color: #777; }

/* ── Cadet profile ────────────────────────────────────────────────────────── */
.profile-hero {
    background: linear-gradient(135deg, #ffffff 0%, #f4f7f2 100%);
    border: 1px solid #d7d7d7;
    border-top: 7px solid #1e4d2b;
    padding: 28px 34px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.07);
}

.profile-hero h1 { margin: 6px 0; }

.profile-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 800px) {
    .profile-layout { grid-template-columns: 1fr; }
    .profile-hero   { display: block; }
}

/* ── Status select in event_view ──────────────────────────────────────────── */
.status-select {
    padding: 5px 8px;
    border-radius: 3px;
    border: 1px solid #b8b8b8;
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
}

.status-select.status-present { background: #1e4d2b; color: white; border-color: #1e4d2b; }
.status-select.status-excused { background: #3b7d3b; color: white; border-color: #3b7d3b; }
.status-select.status-absent  { background: #8b0000; color: white; border-color: #8b0000; }

/* ── Stat card color variants ─────────────────────────────────────────────── */
.stat-card strong.rate-good { color: #1e4d2b; background: none; }
.stat-card strong.rate-warn { color: #7a7d00; background: none; }
.stat-card strong.rate-bad  { color: #8b0000; background: none; }

.default-password-banner {
    background: #fff8e1;
    border-left: 5px solid #c8d32b;
    padding: 14px 24px;
    font-size: 0.95rem;
}

.default-password-banner a {
    margin-left: 8px;
    font-weight: bold;
    color: #1e4d2b;
}

textarea {
    width: 100%;
    padding: 11px;
    margin-top: 6px;
    border: 1px solid #b8b8b8;
    border-radius: 3px;
    font-family: Arial, Helvetica, sans-serif;
    resize: vertical;
}

.success {
    color: #1e4d2b;
    background: #e7f3e7;
    padding: 10px;
    border-radius: 3px;
}

.memo-card {
    border-top: 1px solid #e5e5e5;
    padding: 20px 0;
}

.memo-card:first-of-type {
    border-top: none;
}

.memo-card h2 {
    margin-bottom: 8px;
}
.button-row {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.button.danger {
    background: #8b0000;
    color: white;
}

.button.danger:hover {
    background: #a40000;
}

.review-form {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #e5e5e5;
}
.filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-form select {
    padding: 6px;
}

/* ── Excusal filter bar ───────────────────────────────────────────────────── */
.excusal-filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    border-radius: 999px;
    border: 1px solid #d7d7d7;
    background: white;
    color: #1f2933;
    font-size: 0.85rem;
    font-weight: normal;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s;
}

.chip:hover {
    background: #f4f7f2;
    border-color: #1e4d2b;
    text-decoration: none;
}

.chip.active {
    background: #1e4d2b;
    color: white;
    border-color: #1e4d2b;
}

.chip-count {
    display: inline-block;
    background: #e5e5e5;
    color: #555;
    border-radius: 999px;
    padding: 0 6px;
    font-size: 0.75rem;
    line-height: 1.5;
}

.chip.active .chip-count {
    background: rgba(255,255,255,0.25);
    color: white;
}

/* Pending — amber */
.chip-pending              { border-color: #b45309; color: #92400e; background: #fffbeb; }
.chip-pending:hover        { background: #fef3c7; }
.chip-pending .chip-count  { background: #fde68a; color: #92400e; }
.chip-pending.active       { background: #b45309; color: white; border-color: #b45309; }

/* Approved — green */
.chip-approved             { border-color: #1e4d2b; color: #1e4d2b; background: #f0faf2; }
.chip-approved:hover       { background: #e8f5e9; }
.chip-approved .chip-count { background: #c8e6c9; color: #1e4d2b; }
.chip-approved.active      { background: #1e4d2b; color: white; border-color: #1e4d2b; }

/* Denied — red */
.chip-denied               { border-color: #8b0000; color: #8b0000; background: #fff5f5; }
.chip-denied:hover         { background: #ffe4e4; }
.chip-denied .chip-count   { background: #fecaca; color: #8b0000; }
.chip-denied.active        { background: #8b0000; color: white; border-color: #8b0000; }
.pill {
    color: white;   /* force white text */
    font-weight: bold;
}

.status-present {
    background: #1e4d2b;
    color: white;
}

.status-excused {
    background: #3b7d3b;
    color: white;
}

.status-absent {
    background: #8b0000;
    color: white;
}

.status-pending {
    background: #c8d32b;
    color: #1e4d2b;  /* keep dark for contrast */
}

.status-approved,
.status-reviewed {
    background: #1e4d2b;
    color: white;
}

.status-denied {
    background: #8b0000;
    color: white;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.excusal-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}

.excusal-main-form {
    width: 100%;
}

.excusal-sidebar {
    display: grid;
    gap: 24px;
}

.side-list-item {
    border-top: 1px solid #e5e5e5;
    padding: 14px 0;
}

.side-list-item:first-of-type {
    border-top: none;
}

.side-list-item p {
    margin: 6px 0;
    color: #555;
    line-height: 1.4;
}

.memo-topline {
    margin-bottom: 8px;
}

@media (max-width: 900px) {
    .excusal-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Cadet search ─────────────────────────────────────────────────────────── */
.header-search {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    margin-left: 18px;
}

.cadet-search-input {
    width: 180px;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 3px;
    background: rgba(255,255,255,0.12);
    color: white;
    font-size: 0.85rem;
    outline: none;
    transition: background 0.15s, width 0.2s;
}

.cadet-search-input::placeholder { color: rgba(255,255,255,0.55); }

.cadet-search-input:focus {
    background: rgba(255,255,255,0.2);
    width: 220px;
    border-color: rgba(255,255,255,0.6);
}

.cadet-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: white;
    border: 1px solid #d7d7d7;
    border-top: 3px solid #1e4d2b;
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.14);
    min-width: 260px;
    z-index: 600;
}

.cadet-search-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    color: #1f2933;
    font-weight: normal;
    text-decoration: none;
    font-size: 0.9rem;
}

.cadet-search-result:last-child { border-bottom: none; }

.cadet-search-result:hover {
    background: #f4f7f2;
    text-decoration: none;
}

.sr-name { font-weight: bold; color: #1e4d2b; }

.sr-flight {
    font-size: 0.75rem;
    background: #1e4d2b;
    color: white;
    padding: 2px 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

/* ── Ops dashboard ────────────────────────────────────────────────────────── */
.quick-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.quick-actions-bar .button {
    margin-top: 0;
}

.btn-badge {
    display: inline-block;
    background: #8b0000;
    color: white;
    border-radius: 999px;
    font-size: 0.7rem;
    padding: 1px 7px;
    margin-left: 4px;
    font-weight: bold;
    line-height: 1.5;
    vertical-align: middle;
}

.ops-layout {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 24px;
    margin-bottom: 24px;
    align-items: stretch;
}

.ops-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.ops-grow {
    flex: 1;
}

@media (max-width: 900px) {
    .ops-layout { grid-template-columns: 1fr; }
}

/* Needs Attention */
.attention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-top: 1px solid #f0f0f0;
}

.attention-item:first-of-type { border-top: none; }

.attention-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8b0000;
    flex-shrink: 0;
}

/* Today's Schedule */
.schedule-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-top: 1px solid #e5e5e5;
}

.schedule-item:first-of-type { border-top: none; }

.schedule-time {
    font-weight: bold;
    color: #1e4d2b;
    font-size: 1rem;
    min-width: 55px;
    font-variant-numeric: tabular-nums;
}

.schedule-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.schedule-details span { font-size: 0.85rem; }

/* Flight breakdown */
.flight-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-top: 1px solid #f0f0f0;
}

.flight-row:first-of-type { border-top: none; }

.flight-name {
    min-width: 72px;
    font-weight: bold;
    color: #1e4d2b;
    font-size: 0.9rem;
}

.flight-bar-wrap {
    flex: 1;
    height: 10px;
    background: #f0f0f0;
    border-radius: 999px;
    overflow: hidden;
}

.flight-bar-fill {
    height: 100%;
    border-radius: 999px;
}

/* Recent Activity */
.activity-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 0;
    border-top: 1px solid #f0f0f0;
    font-size: 0.88rem;
}

.activity-item:first-of-type { border-top: none; }
.activity-actor { font-weight: bold; color: #1e4d2b; }
.activity-action { color: #555; }
.activity-ts { font-size: 0.78rem; }

/* ── Mini calendar ────────────────────────────────────────────────────────── */
.mini-cal {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-top: 4px;
}

.mini-cal th {
    background: none;
    color: #6b7280;
    font-size: 0.72rem;
    font-weight: bold;
    text-align: center;
    padding: 0 0 10px;
    border-bottom: 1px solid #e5e5e5;
    letter-spacing: 0.03em;
}

.mini-cal td {
    text-align: center;
    padding: 5px 0;
    border: none;
    font-size: 0.88rem;
    color: #1f2933;
}

.mini-cal td span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.mini-cal td.cal-event { cursor: default; }

.mini-cal td.cal-event span {
    background: #e8f5e9;
    color: #1e4d2b;
    font-weight: 600;
}

.mini-cal td.cal-today span {
    background: #1e4d2b;
    color: white;
    font-weight: bold;
}

.mini-cal td.cal-today.cal-event span {
    background: #1e4d2b;
    outline: 3px solid #c8d32b;
    outline-offset: 2px;
}

#cal-tooltip {
    display: none;
    position: fixed;
    background: white;
    border: 1px solid #d7d7d7;
    border-top: 3px solid #1e4d2b;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.14);
    padding: 8px 0;
    font-size: 0.82rem;
    z-index: 1000;
    min-width: 200px;
    max-width: 260px;
    pointer-events: none;
}

.cal-tip-item {
    padding: 6px 14px;
    color: #1f2933;
    border-bottom: 1px solid #f0f0f0;
}

.cal-tip-item:last-child { border-bottom: none; }

/* ── Recurring event form ─────────────────────────────────────────────────── */
.recur-toggle {
    display: flex;
    gap: 0;
    margin-top: 18px;
    border: 1px solid #b8b8b8;
    border-radius: 3px;
    overflow: hidden;
}

.recur-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-weight: normal;
    color: #1f2933;
    cursor: pointer;
    background: #f9f9f9;
    border-right: 1px solid #b8b8b8;
    margin-top: 0;
    transition: background 0.12s;
}

.recur-option:last-child {
    border-right: none;
}

.recur-option input[type="radio"] {
    width: auto;
    margin: 0;
    padding: 0;
    accent-color: #1e4d2b;
}

.recur-option:has(input:checked) {
    background: #1e4d2b;
    color: white;
    font-weight: bold;
}

/* ── Day-of-week checkboxes ───────────────────────────────────────────────── */
.day-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.day-check {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f4f7f2;
    border: 1px solid #b8b8b8;
    border-radius: 3px;
    padding: 7px 12px;
    cursor: pointer;
    font-weight: normal;
    color: #1f2933;
    margin-top: 0;
    transition: background 0.12s, border-color 0.12s;
    user-select: none;
}

.day-check:has(input:checked) {
    background: #1e4d2b;
    color: white;
    border-color: #1e4d2b;
}

.day-check input[type="checkbox"] {
    width: auto;
    margin: 0;
    padding: 0;
    accent-color: #c8d32b;
}

/* ── Preset buttons ───────────────────────────────────────────────────────── */
.recur-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 12px 14px;
    background: #f4f7f2;
    border: 1px dashed #b8b8b8;
    border-radius: 3px;
}

.preset-btn {
    background: white;
    color: #1e4d2b;
    border: 1px solid #1e4d2b;
    border-radius: 3px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background 0.12s, color 0.12s;
}

.preset-btn:hover {
    background: #1e4d2b;
    color: white;
}

/* ── Start / End date row ─────────────────────────────────────────────────── */
.recur-date-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

@media (max-width: 560px) {
    .recur-date-row { grid-template-columns: 1fr; }
}

/* ── Live preview list ────────────────────────────────────────────────────── */
.recur-preview-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
}

.recur-preview-list li {
    background: #f4f7f2;
    border: 1px solid #d7d7d7;
    border-left: 3px solid #1e4d2b;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 0.85rem;
    color: #1f2933;
}
/* ── Check-in cards ──────────────────────────────────────────────────────── */
.checkin-card {
    background: white;
    border: 1px solid #dde3e0;
    border-left: 5px solid #aaa;
    border-radius: 6px;
    padding: 22px 24px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.checkin-card.checkin-done {
    border-left-color: #1e4d2b;
    background: #f4f9f5;
}

.checkin-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.checkin-card-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.checkin-badge {
    flex-shrink: 0;
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.checkin-badge.present  { background: #d4edda; color: #155724; }
.checkin-badge.excused  { background: #cce5ff; color: #004085; }
.checkin-badge.absent   { background: #f8f9fa; color: #6c757d; border: 1px solid #dee2e6; }

.checkin-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    padding: 14px 18px;
}

.checkin-detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.checkin-detail-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #888;
}

/* Upcoming list rows */
.event-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #eee;
}

.event-list-item:last-child { border-bottom: none; }

/* ── Check-in window badges ──────────────────────────────────────────────── */
.checkin-badge.window-open     { background: #d4edda; color: #155724; }
.checkin-badge.window-upcoming { background: #fff3cd; color: #856404; }
.checkin-badge.window-closed   { background: #f8d7da; color: #721c24; }

/* ── Check-in code panel (cadre event_view) ──────────────────────────────── */
.checkin-code-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    background: #f4f9f5;
    border: 1px solid #c3dbc9;
    border-radius: 6px;
    padding: 16px 22px;
    margin-bottom: 20px;
}

.checkin-code-display {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: .25em;
    color: #1e4d2b;
    font-variant-numeric: tabular-nums;
}

/* ── Absence threshold alert banner ─────────────────────────────────────── */
.absence-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 6px;
    font-weight: 600;
    margin-bottom: 20px;
    font-size: .95rem;
}

.absence-alert-warn {
    background: #fff8e1;
    border: 1px solid #f59e0b;
    color: #92400e;
}

.absence-alert-danger {
    background: #fef2f2;
    border: 1px solid #dc2626;
    color: #7f1d1d;
}

/* ── PWA / Mobile ─────────────────────────────────────────────────────────── */

/* Safe-area padding for iPhone home bar */
body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Tables scroll horizontally on small screens instead of overflowing */
@media (max-width: 720px) {
    .card table,
    .container table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
}

@media (max-width: 620px) {
    /* Container */
    .container {
        padding: 0 14px;
        margin: 16px auto;
    }

    .card {
        padding: 18px 14px;
    }

    /* Header: stack nav below logo on phones */
    .header-inner {
        flex-wrap: wrap;
        padding: 10px 12px;
    }

    .header-left {
        flex: 1;
        min-width: 0;
    }

    .header-nav {
        width: 100%;
        flex-wrap: wrap;
        padding-top: 8px;
        margin-top: 6px;
        border-top: 1px solid rgba(255,255,255,0.2);
        gap: 2px 0;
    }

    .header-nav a {
        margin-left: 0;
        margin-right: 16px;
        padding: 6px 0;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .header-search {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
    }

    .cadet-search-input {
        width: 100% !important;
    }

    /* Reposition back button to left edge (not 220px in) */
    #back-btn {
        left: 16px;
        top: auto;
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }

    /* Settings gear: keep top-right but pull in from edge of wider header */
    .settings-wrapper {
        top: 12px;
        right: 10px;
    }

    /* Hero sections */
    .home-hero {
        padding: 20px 16px;
    }

    .home-hero h1 {
        font-size: 1.65rem;
    }

    .role-card {
        display: none; /* redundant on a phone — they know their role */
    }

    .profile-hero {
        padding: 18px 16px;
    }

    /* Page header: stack vertically */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    /* Stat grid: force 2 columns even if overridden inline */
    .stat-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px;
    }

    /* Buttons: minimum tap target */
    .button,
    a.button,
    button.button {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Form inputs: bigger tap targets */
    input,
    select,
    textarea {
        min-height: 44px;
        font-size: 16px; /* prevents iOS auto-zoom on focus */
    }

    /* Check-in code: scale down on mobile */
    .checkin-code-display {
        font-size: 1.6rem;
    }

    /* Import steps: compact */
    .import-step {
        padding: 8px 10px;
        font-size: .78rem;
    }

    /* Recur toggle on event create: stack vertically */
    .recur-toggle {
        flex-direction: column;
    }

    .recur-option {
        border-right: none;
        border-bottom: 1px solid #b8b8b8;
    }

    .recur-option:last-child {
        border-bottom: none;
    }
}
