:root {
  --ink: #e9e6da;
  --muted: #999b90;
  --paper: #151711;
  --panel: #1c1f18;
  --line: #383b30;
  --olive: #a8ad73;
  --orange: #d96e42;
  --green: #8fa85e;
  --red: #b95b47;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--paper); color-scheme: dark; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, sans-serif; min-height: 100vh; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 76% 8%, #43483044, transparent 35%), linear-gradient(115deg, transparent 0 47%, #ffffff04 47% 48%, transparent 48%); }
.grain { position: fixed; inset: 0; opacity: .17; pointer-events: none; z-index: 10; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E"); }
.topbar { height: 82px; padding: 0 clamp(22px, 5vw, 72px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 2; }
.brand { color: inherit; text-decoration: none; display: flex; gap: 13px; align-items: center; font: 600 23px/1 Barlow Condensed, sans-serif; letter-spacing: .08em; }
.brand b { color: var(--olive); }
.brand small { display: block; margin-top: 6px; font: 500 9px/1 Inter, sans-serif; letter-spacing: .24em; color: var(--muted); }
.brand-mark { width: 52px; height: 52px; object-fit: contain; filter: drop-shadow(0 3px 8px #0008); }
.status { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--olive); box-shadow: 0 0 0 4px #a8ad7318; }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.topbar-actions form { margin: 0; }
.logout-button { border: 1px solid var(--line); padding: 7px 9px; color: var(--muted); background: transparent; cursor: pointer; text-transform: uppercase; letter-spacing: .1em; font: 600 8px Inter; }
.logout-button:hover { color: var(--ink); border-color: var(--olive); }

main { width: min(1440px, 100%); margin: auto; padding: 0 clamp(22px, 5vw, 72px) 80px; position: relative; z-index: 1; }
.hero { min-height: 390px; padding: 72px 0 58px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--olive); font: 600 11px/1 Inter, sans-serif; letter-spacing: .2em; margin: 0 0 17px; }
h1,h2,h3 { font-family: Barlow Condensed, sans-serif; text-transform: uppercase; }
h1 { font-size: clamp(62px, 9vw, 122px); line-height: .76; letter-spacing: -.025em; margin: 0; max-width: 800px; }
h1 em { font-style: normal; color: transparent; -webkit-text-stroke: 1px var(--olive); }
.hero-copy { color: var(--muted); max-width: 530px; line-height: 1.65; margin: 32px 0 0; }
.hero-emblem { width: clamp(180px, 22vw, 290px); height: auto; object-fit: contain; filter: drop-shadow(0 22px 28px #0009); transform: rotate(2deg); }
.section-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 55px; }
.tab { border: 0; border-bottom: 2px solid transparent; padding: 22px 5px 20px; margin-right: 36px; background: none; color: var(--muted); cursor: pointer; font: 600 14px Inter; }
.tab span { margin-left: 7px; padding: 3px 7px; background: #292c23; font-size: 10px; }
.tab.active { color: var(--ink); border-bottom-color: var(--orange); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 27px; }
.section-heading h2 { margin: 0; font-size: 48px; line-height: 1; }
.section-heading > p { color: var(--muted); max-width: 470px; font-size: 13px; line-height: 1.6; margin: 0; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.ops-card { padding: 25px; background: linear-gradient(145deg, #20231b, var(--panel)); border: 1px solid var(--line); position: relative; overflow: hidden; transition: border-color .2s, transform .2s; }
.ops-card:hover { border-color: #666b53; transform: translateY(-2px); }
.ops-card::after { content: attr(data-index); position: absolute; right: 18px; top: 10px; color: #ffffff08; font: 700 90px Barlow Condensed; }
.card-top { display: flex; justify-content: space-between; gap: 16px; position: relative; z-index: 1; }
.card-kicker { color: var(--muted); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; }
.card-top h3 { font-size: 29px; margin: 8px 0 0; }
.badge { height: fit-content; padding: 6px 9px; border: 1px solid var(--line); font-size: 9px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.badge.warn { color: #eaaa80; border-color: #714735; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); margin-top: 27px; border: 1px solid var(--line); }
.stat { background: #191b16; padding: 15px; }
.stat strong { display: block; font: 600 27px Barlow Condensed; }
.stat small { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.progress { height: 3px; background: #3b3e32; margin: 22px 0; }
.progress span { display: block; height: 100%; background: var(--olive); }
.card-footer { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.detail-button, #retry { border: 0; background: none; color: var(--ink); padding: 4px 0; cursor: pointer; font: 600 11px Inter; text-transform: uppercase; letter-spacing: .1em; text-decoration: none; }
.detail-button::after { content: "  →"; color: var(--orange); }
.loading-state,.error-state { min-height: 260px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.loader { width: 28px; height: 28px; margin: auto; border: 2px solid var(--line); border-top-color: var(--olive); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-state h2 { color: var(--ink); font-size: 34px; margin: 0; }
#retry { margin: 10px auto; border-bottom: 1px solid var(--orange); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 12px 14px; color: var(--muted); text-align: left; text-transform: uppercase; letter-spacing: .1em; font-size: 9px; background: #24271e; position: sticky; top: 0; }
td { padding: 12px 14px; border-top: 1px solid var(--line); }
.state { display: inline-flex; gap: 7px; align-items: center; text-transform: capitalize; }
.state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.state.attending::before,.state.current::before,.state.complete::before { background: var(--green); }
.state.other-rollcall::before { background: #d19a52; }
.checks { display: flex; flex-wrap: wrap; gap: 5px; }
.check { padding: 4px 7px; color: #777a6e; border: 1px solid #383b30; font-size: 9px; }
.check.done { color: var(--green); border-color: #52613b; }
.trainee-name { display: grid; gap: 4px; }
.trainee-name small { color: var(--muted); font-size: 10px; font-weight: 400; }
.report-main { min-height: calc(100vh - 140px); padding-top: 42px; }
.back-link { display: inline-flex; gap: 8px; color: var(--muted); text-decoration: none; text-transform: uppercase; font-size: 10px; letter-spacing: .14em; }
.back-link:hover { color: var(--ink); }
.report-heading { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin: 38px 0 30px; }
.report-heading h1 { font-size: clamp(48px, 7vw, 82px); line-height: .85; }
#report-description { color: var(--muted); max-width: 470px; line-height: 1.6; font-size: 12px; margin: 0; }
.report-summary { display: grid; justify-items: start; gap: 17px; max-width: 470px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.export-button { padding: 10px 13px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; text-transform: uppercase; letter-spacing: .1em; font: 600 9px Inter; }
.export-button:hover { border-color: var(--olive); }
.export-button.primary { color: #151711; background: var(--olive); border-color: var(--olive); }
.report-section { margin-top: 38px; }
.report-section-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 13px; }
.report-section-title h2 { margin: 0; font-size: 27px; }
.report-section-title span { color: var(--muted); font-size: 11px; }
.report-table { min-width: 760px; }
.report-table th { padding: 0; white-space: nowrap; }
.sort-button { width: 100%; border: 0; padding: 12px 14px; color: var(--muted); background: transparent; text-align: left; cursor: pointer; text-transform: uppercase; letter-spacing: .1em; font: 600 9px Inter; }
.sort-button:hover, .sort-button.active { color: var(--ink); background: #303329; }
.sort-arrow { display: inline-block; width: 12px; color: var(--orange); }
.report-table td { white-space: nowrap; }
.report-table td:last-child .checks { min-width: 260px; }
.report-table .current-week { background: #34372a; }
.rank-cell { color: var(--olive); font-weight: 600; letter-spacing: .05em; }
.flag-left { color: #e08b6b; font-size: 9px; letter-spacing: .1em; }
.attendance { display: inline-grid; min-width: 22px; place-items: center; }
.empty-cell { color: #5f6258; }
.report-updated { color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
footer { padding: 28px clamp(22px, 5vw, 72px); border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: #707268; font-size: 9px; letter-spacing: .15em; position: relative; z-index: 1; }
.login-page { display: grid; place-items: center; }
.login-shell { width: 100%; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(480px, 100%); padding: clamp(28px, 6vw, 54px); background: linear-gradient(145deg, #20231b, var(--panel)); border: 1px solid var(--line); box-shadow: 0 28px 90px #0008; position: relative; }
.login-emblem { width: 86px; height: 86px; object-fit: contain; margin-bottom: 30px; filter: drop-shadow(0 8px 14px #0009); }
.login-card h1 { font-size: clamp(58px, 14vw, 84px); line-height: .78; }
.login-copy { margin: 28px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-form { display: grid; gap: 10px; }
.login-form label { color: var(--muted); text-transform: uppercase; letter-spacing: .14em; font-size: 9px; }
.login-form input { width: 100%; border: 1px solid var(--line); padding: 14px; color: var(--ink); background: #11130e; outline: none; font: 500 18px Inter; letter-spacing: .12em; }
.login-form input:focus { border-color: var(--olive); box-shadow: 0 0 0 3px #a8ad7318; }
.login-form button { border: 1px solid var(--olive); padding: 13px; color: #151711; background: var(--olive); cursor: pointer; text-transform: uppercase; letter-spacing: .14em; font: 700 10px Inter; }
.login-error { min-height: 16px; margin: 0; color: #e08b6b; font-size: 10px; }
.login-note { display: block; margin-top: 25px; color: #6f7168; text-transform: uppercase; letter-spacing: .15em; font-size: 8px; }

@media (max-width: 760px) {
  .topbar { height: 70px; }
  .status span:last-child { display: none; }
  .topbar-actions { gap: 9px; }
  .hero { min-height: 340px; padding: 55px 0 45px; }
  .hero-emblem { display: none; }
  h1 { font-size: 66px; }
  .section-heading { align-items: start; flex-direction: column; }
  .card-grid { grid-template-columns: 1fr; }
  .ops-card { padding: 20px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat { padding: 12px 9px; }
  .report-heading { align-items: start; flex-direction: column; }
  .report-main { padding-left: 12px; padding-right: 12px; }
  .report-table { min-width: 650px; font-size: 10px; }
  .sort-button { padding: 9px 8px; font-size: 8px; }
  .report-table td { padding: 9px 8px; }
  .check { padding: 3px 5px; font-size: 8px; }
}
