/* ================================================================
   El Camino Fire Academy — Skills Ledger v2
   Academy colors: dark teal #102f3a / #1d7880
   iPad-first, large-type, big-button
   ================================================================ */

:root {
  --ink: #17343c;
  --muted: #71848a;
  --line: #dfe7e7;
  --cream: #f5f7f5;
  --white: #fff;
  --orange: #db6c3d;
  --orange-dark: #ba542c;
  --teal: #1d7880;
  --teal-dark: #102f3a;
  --green: #3b996b;
  --shadow: 0 8px 24px #17343c0d;
  --shell-footer-offset: 88px;
}
* { box-sizing: border-box; }
html { height: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }

/* ── Login gate (full-viewport overlay; not a page section) ─── */
body.is-gated { overflow: hidden; height: 100%; }
body.is-gated .app-shell,
.app-shell[hidden] {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
}
.login-screen {
  display: none;
}
body.is-gated .login-screen {
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  z-index: 2000;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: linear-gradient(135deg, #102f3a 0%, #1d7880 100%);
  padding: 24px;
}
body.is-authenticated {
  overflow: hidden;
  height: 100%;
  height: 100dvh;
  overscroll-behavior: none;
}
body.is-authenticated .login-screen {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: -1 !important;
  inset: auto !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}
body.is-authenticated .app-shell {
  display: flex;
  visibility: visible;
  pointer-events: auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding-bottom: var(--shell-footer-offset);
}
.login-card {
  background: var(--white); border-radius: 16px; padding: 48px 40px 36px;
  width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
  text-align: center;
}
.login-brand { margin-bottom: 32px; }
.brand-logo {
  display: block; object-fit: contain; background: transparent;
  border: 0; box-shadow: none;
}
.brand-logo-login { width: 88px; height: 88px; margin: 0 auto 16px; }
.brand-logo-sidebar { width: 40px; height: 40px; flex-shrink: 0; }
.login-brand h1 { font-size: 22px; margin: 0; color: var(--teal-dark); }
.login-brand p { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
.login-card form { text-align: left; }
.login-card label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 16px; color: var(--ink); }
.login-card input[type="text"],
.login-card input[type="password"] {
  display: block; width: 100%; margin-top: 6px;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 12px; font: inherit; font-size: 16px;
  background: #f9fbfb;
}
.login-card input:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
.login-button { width: 100%; min-height: 52px; font-size: 16px; margin-top: 8px; }
.login-button:disabled,
.primary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.login-sync-panel {
  display: grid;
  gap: 10px;
  margin: 4px 0 12px;
}
.login-sync-panel[hidden] { display: none !important; }
.login-sync-copy {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
}
.login-sync-button {
  min-height: 64px;
  font-size: 18px;
  font-weight: 800;
  background: var(--teal);
  border-color: var(--teal);
}
.login-sync-button:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.login-error { color: #c0392b; font-size: 13px; margin: 12px 0 0; min-height: 20px; text-align: center; }
.login-footer { color: var(--muted); font-size: 11px; margin-top: 24px; }
.login-change-copy { text-align: left; font-size: 14px; color: var(--ink); margin: 0 0 16px; }

/* ── Idle / session lock (covers app; does not unmount it) ───── */
#session-lock[hidden] { display: none !important; }
body.is-gated #session-lock { display: none !important; }
body.is-session-locked { overflow: hidden; }
body.is-session-locked #session-lock,
#session-lock:not([hidden]) {
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  z-index: 10001;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: linear-gradient(135deg, #102f3a 0%, #1d7880 100%);
  padding: 24px;
}
body.is-session-locked .app-shell {
  pointer-events: none;
}

.session-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.session-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 0;
  line-height: 1.2;
}
.session-user-meta strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.session-user-meta small {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.session-signout {
  flex-shrink: 0;
  padding: 8px 12px;
  min-height: 40px;
}

.logout-button {
  margin-top: 8px;
  color: #f0d4c4 !important;
  border: 1px solid #4a6a70;
  border-radius: 8px;
  text-align: center !important;
  background: #1a3d46;
}
.logout-button:hover { color: #fff !important; border-color: #f18a59; }

.admin-form-group input[type="number"] {
  display: block;
  width: 88px;
  margin-top: 5px;
  border: 1px solid #d5dfdf;
  border-radius: 8px;
  padding: 12px 10px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

/* ── App shell ────────────────────────────────────────────────── */
.app-shell { display: none; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: 250px; background: #102f3a; color: #d6e2e1;
  padding: 27px 18px 22px; display: flex; flex-direction: column; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 11px 38px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; letter-spacing: .2px; }
.brand span { font-size: 11px; color: #8fa8a9; margin-top: 2px; }
.sidebar-label, .eyebrow { font-size: 10px; letter-spacing: 1.3px; font-weight: 800; color: #91a8aa; }
.sidebar-label { padding: 0 12px 13px; }
.nav { display: grid; gap: 5px; }
.nav-item {
  border: 0; background: transparent; color: #a9bcbd; text-align: left;
  padding: 14px 12px; border-radius: 8px; font: inherit; font-size: 15px; cursor: pointer;
}
.nav-item.active, .nav-item:hover { background: #234751; color: white; }
.nav-icon { display: inline-block; width: 28px; color: #9eb5b6; font-size: 17px; }
.nav-item.active .nav-icon { color: #f18a59; }
.shell-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  flex: 0 0 0;
  width: auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  background: #102f3a;
  color: #d6e2e1;
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #315159;
  box-shadow: 0 -8px 20px #102f3a22;
}
.shell-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sync-status {
  display: flex; gap: 9px; align-items: center;
  padding: 4px 8px; font-size: 13px; min-width: 0;
}
.sync-status strong, .sync-status small { display: block; }
.sync-status small { color: #829b9d; margin-top: 2px; }
.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #59ba82; box-shadow: 0 0 0 3px #59ba8222;
}
.sync-status[data-state="offline"] .status-dot { background: #8aa0a2; box-shadow: 0 0 0 3px #8aa0a222; }
.sync-status[data-state="failed"] .status-dot { background: #d96b4a; box-shadow: 0 0 0 3px #d96b4a22; }
.sync-status[data-state="syncing"] .status-dot,
.sync-status[data-state="pending"] .status-dot { background: #e0b14a; box-shadow: 0 0 0 3px #e0b14a22; }
.settings-button {
  background: transparent; border: 1px solid #315159; color: #d6e2e1;
  padding: 10px 16px; cursor: pointer; font-size: 14px; display: inline-flex;
  align-items: center; justify-content: center; min-height: 48px; width: auto;
  text-align: center; border-radius: 8px; font-weight: 700;
}
.settings-button:hover { color: white; border-color: #8fa8a9; }
.shell-footer .session-signout {
  margin-top: 0;
  min-height: 48px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
}

/* ── Main content ─────────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.topbar {
  height: 74px; background: white; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 40px;
}
.breadcrumbs { color: #839598; font-size: 13px; }
.breadcrumbs b { padding: 0 11px; color: #c1cdcd; }
.breadcrumbs strong { color: var(--ink); }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.date-chip { font-size: 12px; color: #4d7e6a; background: #ecf7ee; border-radius: 30px; padding: 7px 14px; }
.avatar { border: 0; background: #e9eff0; color: var(--teal); font-weight: 700; border-radius: 50%; width: 36px; height: 36px; font-size: 12px; cursor: pointer; }
.mobile-menu { display: none; }
.view { display: none; padding: 36px 40px 32px; max-width: 1440px; margin: auto; }
.active-view { display: block; }
h1, h2, p { margin: 0; }
h1 { font: 700 30px/1.2 Georgia, serif; letter-spacing: -.6px; }

/* ── Buttons ──────────────────────────────────────────────────── */
.primary-button, .secondary-button, .outline-button, .filter-button {
  border-radius: 8px; padding: 13px 20px; font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.primary-button { border: 1px solid var(--orange); background: var(--orange); color: #fff; box-shadow: 0 3px 7px #db6c3d33; }
.primary-button:hover { background: var(--orange-dark); }
.secondary-button, .outline-button, .filter-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.outline-button:hover, .secondary-button:hover { border-color: var(--orange); color: var(--orange); }
.text-button { border: 0; background: none; color: var(--orange); font-weight: 700; cursor: pointer; font-size: 13px; }

/* ── Layout helpers ───────────────────────────────────────────── */
.welcome-row, .page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 27px; }
#grade-page-title { line-height: 1.15; }
#grade-page-copy { font-variant-numeric: tabular-nums; }
.welcome-row .muted { margin-top: 8px; }
.window-banner {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px;
  margin: -8px 0 18px; padding: 16px 20px; border-radius: 10px;
  border: 1px solid #cfe3e1; background: #e8f4f3; color: var(--teal-dark);
}
.window-banner strong { font-size: 20px; }
.window-banner span { font-size: 14px; color: var(--muted); }
.window-banner[data-window="midterm"] { background: #fff4dc; border-color: #ead6a2; color: #6d5420; }
.window-banner[data-window="finals"] { background: #fff0e9; border-color: #f0c8b4; color: #8a3d22; }
.battery-panel { margin-bottom: 18px; padding-top: 16px; }
.battery-accordion {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.battery-accordion-copy { flex: 1; min-width: 0; }
.battery-accordion-copy h2 { margin: 0; font-size: 16px; }
.battery-accordion-copy p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.battery-count { font-weight: 700; color: var(--teal); font-size: 16px; white-space: nowrap; }
.battery-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border-right: 2px solid #3d6568;
  border-bottom: 2px solid #3d6568;
  transform: rotate(-45deg);
  margin-top: -4px;
}
.battery-panel.is-expanded .battery-chevron {
  transform: rotate(45deg);
  margin-top: 2px;
}
.battery-list { display: grid; gap: 0; max-height: 240px; margin-top: 10px; }
.battery-list[hidden] { display: none; }
.battery-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid #edf1f1;
}
.battery-row:first-child { border-top: 0; padding-top: 0; }
.battery-row strong { font-size: 14px; }
.window-flip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.window-flip-btn {
  min-height: 64px; border: 2px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font-size: 16px; font-weight: 700;
  cursor: pointer;
}
.window-flip-btn:hover { border-color: var(--teal); }
.window-flip-btn.is-selected {
  background: var(--teal); border-color: var(--teal); color: #fff;
}
.muted { color: var(--muted); }
.eyebrow { color: var(--orange); margin-bottom: 7px; }

/* ── Stat grid ────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 23px; }
.stat-card { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; }
.stat-icon.amber { background: #fff3df; color: #db9432; }
.stat-icon.green { background: #e8f6ec; color: #45a16d; }
.stat-icon.blue { background: #e8f1fa; color: #4885ac; }
.stat-icon.plum { background: #f3ebf5; color: #9564a0; }
.stat-card span, .stat-card small { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; font-size: 26px; line-height: 1.2; margin: 2px 0; }
.stat-card small { font-size: 11px; }

/* ── Panels ───────────────────────────────────────────────────── */
.content-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; margin-bottom: 18px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 24px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 21px; }
.panel h2 { font-size: 16px; }
.panel-heading p { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ── Activity ─────────────────────────────────────────────────── */
.activity-list { display: grid; }
.activity-item { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid #edf1f1; align-items: center; }
.activity-item:first-child { border-top: 0; padding-top: 0; }
.initials { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 800; flex-shrink: 0; }
.orange { background: #fff0e9; color: #cc6b44; }
.teal { background: #e5f3f2; color: #337e80; }
.purple { background: #f1eaf4; color: #8a6195; }
.activity-item div:nth-child(2) { flex: 1; }
.activity-item strong, .activity-item small { display: block; }
.activity-item strong { font-size: 13px; }
.activity-item small { font-size: 12px; color: var(--muted); margin-top: 2px; }
.activity-result { font-size: 11px; padding: 5px 10px; border-radius: 5px; color: #428762; background: #e9f7ed; white-space: nowrap; }
.activity-result.fail-result { color: #943030; background: #fbe9e9; }

/* ── Progress ─────────────────────────────────────────────────── */
.class-progress { margin: 6px 0 28px; }
.progress-percent { font-weight: 700; color: var(--teal); font-size: 20px; }
.progress-track { height: 8px; background: #edf1f1; border-radius: 10px; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0%; background: var(--teal); border-radius: 10px; transition: width .3s; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 8px; }
.mini-recruits, .class-recruit-list { display: grid; gap: 14px; }
.scroll-list {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}
.recruit-row { display: flex; align-items: center; gap: 10px; }
.recruit-row div { min-width: 120px; }
.recruit-row strong, .recruit-row small { display: block; }
.recruit-row strong { font-size: 12px; }
.recruit-row small { font-size: 11px; color: var(--muted); }
.mini-bar { height: 5px; background: #edf1f1; border-radius: 5px; flex: 1; overflow: hidden; }
.mini-bar i { display: block; background: #70aaa1; height: 100%; border-radius: 5px; }
.retest-queue { display: grid; gap: 8px; }
.retest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  font: inherit;
  color: inherit;
}
.retest-item.is-available { cursor: pointer; }
.retest-item.is-available:hover { border-color: var(--teal); }
.retest-item.is-blocked { cursor: default; opacity: .85; }
.retest-item strong, .retest-item small { display: block; }
.retest-item small { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ── Grade view ───────────────────────────────────────────────── */
.save-indicator { color: #4b8b68; font-size: 12px; display: flex; align-items: center; gap: 8px; }
.stepper { display: flex; align-items: center; max-width: 490px; margin: -4px 0 26px; }
.step { display: flex; align-items: center; gap: 8px; color: #95a3a5; font-size: 12px; font-weight: 700; border: 0; background: transparent; cursor: pointer; }
.step b { width: 28px; height: 28px; border: 1px solid #ccd8d8; border-radius: 50%; display: grid; place-items: center; font-size: 13px; }
.step.active { color: var(--teal); }
.step.active b { background: var(--teal); border-color: var(--teal); color: white; }
.step.locked { cursor: not-allowed; opacity: .45; }
.stepper i { height: 1px; background: #d8e2e2; width: 75px; margin: 0 12px; }
.grade-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
  width: 100%;
}
.setup-panel.phase-visible { max-width: 640px; }
.skill-directions {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #d5dfdf;
  border-radius: 8px;
  background: #f7faf9;
}
.skill-directions h3 {
  margin: 0 0 10px;
  font-size: 15px;
}
.direction-block { margin: 0 0 12px; }
.direction-block:last-child { margin-bottom: 0; }
.direction-block p {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 400;
  color: var(--ink);
}
.direction-block strong {
  font-weight: 700;
  background: none;
  color: inherit;
}
.criteria-panel.phase-visible,
.signature-panel.phase-visible {
  width: 100%;
  max-width: none;
}
.criteria-panel .phase-next,
.criteria-panel .auto-fail-options,
.criteria-panel .result-banner {
  width: 100%;
}
.required { color: var(--muted); font-size: 11px; }
.setup-panel label { font-size: 13px; font-weight: 700; display: block; margin-bottom: 18px; }
.setup-panel select { display: block; width: 100%; margin-top: 7px; border: 1px solid #d5dfdf; border-radius: 8px; padding: 14px 10px; background: white; color: var(--ink); font: inherit; font-size: 14px; }
.evaluator-field { margin-bottom: 18px; }
.evaluator-label { display: block; font-size: 13px; font-weight: 700; color: var(--ink); }
.evaluator-readonly {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  border: 1px solid #d5dfdf;
  border-radius: 8px;
  padding: 14px 10px;
  background: #f2f5f5;
  color: var(--ink);
  font-size: 14px;
  pointer-events: none;
  user-select: none;
}
.evaluator-readonly strong { font-size: 14px; }
.evaluator-readonly small {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.evaluator-hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.station-note { display: flex; gap: 10px; background: #f2f7f6; border-radius: 8px; padding: 12px; font-size: 12px; margin-bottom: 12px; }
.station-note > span { background: #b6d9d2; color: #28716f; border-radius: 50%; width: 20px; height: 20px; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; font-size: 11px; }
.station-note p { font-size: 11px; color: var(--muted); margin-top: 3px; }
.station-note.completed { background: #eaf7ed; }

/* ── Criteria ─────────────────────────────────────────────────── */
.phase-panel { display: none; }
.phase-panel.phase-visible { display: block; }
.phase-next { margin-top: 18px; min-height: 52px; }
.criteria-count { font-size: 11px; color: var(--muted); }
.criteria-toolbar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #d5dfdf;
  border-radius: 10px;
  box-shadow: 0 10px 24px #102f3a18;
}
.criteria-toolbar.has-timer {
  padding: 12px 14px;
}
.criteria-select-all {
  min-height: 52px;
  min-width: 168px;
  padding: 12px 18px;
  border: 1px solid #1d7880;
  border-radius: 8px;
  background: #e7f3f2;
  color: #14565c;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}
.criteria-select-all:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.criteria-select-hint {
  margin: 0;
  flex: 1;
  min-width: 180px;
  font-size: 13px;
  color: var(--muted);
}
.skill-timer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-left: auto;
}
#select-all-criteria[hidden] ~ .skill-timer {
  margin-left: 0;
}
.skill-timer-clock {
  display: flex;
  align-items: baseline;
  gap: 10px 12px;
  min-width: 0;
}
.skill-timer-digits {
  font-variant-numeric: tabular-nums;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  min-width: 4.2ch;
  color: var(--ink);
}
.skill-timer.is-over .skill-timer-digits {
  color: #b42318;
}
.skill-timer-meta {
  display: grid;
  gap: 2px;
}
.skill-timer-limit {
  font-size: 14px;
  font-weight: 800;
  color: #3d6568;
}
.skill-timer-over {
  font-size: 13px;
  font-weight: 800;
  color: #b42318;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.skill-timer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.skill-timer-btn {
  min-height: 56px;
  min-width: 92px;
  padding: 12px 16px;
  border: 1px solid #1d7880;
  border-radius: 8px;
  background: #e7f3f2;
  color: #14565c;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.skill-timer-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.skill-timer-stop {
  border-color: #b42318;
  background: #fdecec;
  color: #8a1c14;
}
.criteria-list { display: grid; gap: 9px; }
.criteria-grid-head, .criteria-row { display: grid; grid-template-columns: 64px 64px minmax(0, 1fr); align-items: center; gap: 12px; }
.criteria-grid-head { padding: 0 12px 8px; color: #71848a; font-size: 11px; text-transform: uppercase; letter-spacing: .7px; }
.criteria-grid-head strong { text-align: center; }
.criteria-grid-head strong:last-child { text-align: left; }
.criteria-grid-head .col-head-meta {
  display: block;
  margin-top: 3px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 10px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}
.criteria-row { border: 1px solid #dfe7e7; border-radius: 8px; padding: 12px; min-height: 60px; }
.criteria-row.is-editable { cursor: pointer; }
.criteria-row.is-editable:active { background: #e7f1ef; }
.attempt-check { text-align: center; }
.attempt-check input { width: 24px; height: 24px; accent-color: #1d7880; }
.criteria-task { min-width: 0; font-size: 14px; }
.criteria-task small { display: block; color: #71848a; font-size: 11px; margin-top: 3px; }
.criteria-row.done { background: #f0f8f6; }
.prior-signature-images { display: flex; gap: 12px; }
.prior-signature-slot { flex: 1; min-width: 0; }
.prior-signature-slot img,
.prior-signature-slot canvas {
  display: block;
  width: 100%;
  height: 88px;
  object-fit: contain;
  background: #f4f8f7;
  border: 1px solid #d5e0df;
  border-radius: 6px;
  pointer-events: none;
}
.prior-signatures [hidden] { display: none !important; }
.prior-signature-slot small { display: block; color: #71848a; font-size: 11px; margin-top: 6px; font-weight: 700; }
.prior-signature-lead { margin: 0 0 10px; color: #4d5f64; font-size: 13px; }
.prior-signature-missing { color: #8a4d4d; font-size: 12px; margin-top: 4px; }
.prior-signature-meta { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.attempt-heading { font-size: 12px; font-weight: 800; color: #71848a; margin: 8px 0; }
.attempt-history {
  background: #f2f7f6;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 16px;
  font-size: 13px;
}
.attempt-history p { margin: 0 0 6px; }
.attempt-history p:last-child { margin: 0; }
.activity-item.is-reviewable { cursor: pointer; }
.activity-item.is-reviewable:hover { background: #f4f8f7; }
.prior-signatures { margin-bottom: 12px; }

/* ── Auto-fail ────────────────────────────────────────────────── */
.auto-fail-options { border: 1px solid var(--line); padding: 18px; margin: 18px 0 0; border-radius: 8px; }
.auto-fail-options legend { font-weight: 800; padding: 0 5px; font-size: 14px; }
.auto-fail-options label { display: block; padding: 10px 0; font-size: 15px; }
.auto-fail-options input { width: 22px; height: 22px; vertical-align: middle; margin-right: 10px; }
.auto-fail-options small { display: block; margin-top: 10px; color: var(--muted); }

.confirm-dialog[hidden] { display: none !important; }
.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 47, 58, 0.55);
}
.confirm-card {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 24px 22px 20px;
  box-shadow: 0 20px 50px rgba(16, 47, 58, 0.28);
}
.confirm-card h2 { margin: 0 0 8px; font-size: 18px; color: var(--ink); }
.confirm-card p { margin: 0 0 20px; font-size: 16px; font-weight: 600; color: var(--ink); }
.tw-options { display: grid; gap: 10px; margin: 0 0 20px; }
.tw-options label { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; min-height: 44px; }
.tw-options input { width: 22px; height: 22px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.confirm-actions .primary-button,
.confirm-actions .outline-button { min-height: 48px; min-width: 96px; }

/* ── Result banner ────────────────────────────────────────────── */
.result-banner { display: flex; gap: 10px; align-items: center; margin-top: 17px; padding: 14px; border-radius: 8px; }
.result-banner.pending { background: #fff8ea; color: #9a7131; }
.result-banner.pass { background: #eaf7ed; color: #397a58; }
.result-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: currentColor; color: white; font-size: 12px; }
.result-banner strong, .result-banner small { display: block; font-size: 13px; }
.result-banner small { font-size: 11px; opacity: .8; margin-top: 2px; }

/* ── Signatures ───────────────────────────────────────────────── */
.signature-box { border-top: 1px solid #edf1f1; padding-top: 14px; margin-top: 14px; }
.signature-title { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.clear-signature { background: none; border: 0; color: var(--orange); font-size: 12px; cursor: pointer; }
.signature-box canvas { display: block; width: 100%; height: 90px; background: #fbfcfb; border: 1px dashed #cddada; border-radius: 6px; margin: 8px 0 4px; touch-action: none; }
.signature-box small { font-size: 11px; color: var(--muted); }
.signature-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
#record-failure.is-final-fail {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
  box-shadow: 0 3px 7px #c0392b33;
}
#record-failure.is-final-fail:hover { background: #a33026; border-color: #a33026; }

/* ── Roster ───────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; margin-bottom: 17px; }
.search-box { border: 1px solid var(--line); background: white; border-radius: 8px; padding: 12px 14px; color: #9babad; display: flex; align-items: center; gap: 8px; width: 300px; }
.search-box input { border: 0; outline: 0; width: 100%; font: inherit; font-size: 14px; }
.roster-panel { padding: 0; }
.table-head, .roster-row { display: grid; grid-template-columns: 1.5fr 1.1fr 1fr .7fr; gap: 15px; align-items: center; padding: 16px 20px; }
.table-head { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: .8px; background: #f8faf9; border-radius: 10px 10px 0 0; }
.roster-row { border-top: 1px solid #edf1f1; }
button.roster-row {
  width: 100%;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
}
button.roster-row:disabled { cursor: default; opacity: 1; }
.roster-person { display: flex; align-items: center; gap: 10px; }
.roster-person strong, .roster-person small { display: block; }
.roster-person strong { font-size: 13px; }
.roster-person small { font-size: 11px; color: var(--muted); }
.row-progress { height: 6px; background: #edf1f1; border-radius: 5px; max-width: 110px; }
.row-progress i { display: block; background: var(--teal); height: 100%; border-radius: 5px; }
.row-progress + small { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.roster-active-test { font-weight: 600; color: var(--ink); line-height: 1.25; min-width: 0; }
.roster-active-test strong { display: block; font-size: 13px; }
.roster-active-test small { display: block; font-size: 11px; font-weight: 700; color: #5b6d72; margin-top: 2px; }
.row-date { font-size: 12px; color: var(--muted); }
.status-pill { font-size: 11px; padding: 5px 10px; border-radius: 20px; display: inline-block; white-space: nowrap; }
.status-pill.is-complete { color: #3c845e; background: #eaf7ed; }
.status-pill.is-progress { color: #8a6a2a; background: #fff4dc; }
.status-pill.is-unscored { color: #5b6d72; background: #eef2f2; }
.status-pill.is-failed { color: #a33026; background: #fdecea; }
.roster-row.is-admin-open { cursor: pointer; }
.roster-row.is-admin-open:hover { background: #f4f8f8; }
.recruit-skill-head, .recruit-skill-row { display: grid; grid-template-columns: 1.6fr .9fr .7fr; gap: 15px; align-items: center; padding: 16px 20px; }
.recruit-skill-row { border-top: 1px solid #edf1f1; }
.audit-head, .audit-row { display: grid; grid-template-columns: 1.1fr 1fr 1.3fr 1.2fr; gap: 12px; align-items: start; padding: 14px 20px; }
.audit-row { border-top: 1px solid #edf1f1; }
.audit-row strong, .audit-row small { display: block; }
.audit-row small { color: var(--muted); font-size: 11px; }
.archives-head, .archive-row { display: grid; grid-template-columns: .8fr 1.4fr 1.2fr .6fr; gap: 12px; align-items: center; padding: 16px 20px; }
.archive-row {
  width: 100%;
  border: 0;
  border-top: 1px solid #edf1f1;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.archive-row:hover { background: #f4f8f8; }
.archive-row strong, .archive-row small { display: block; }
.archive-row small { color: var(--muted); font-size: 11px; }
.archive-sheet-heading { padding: 16px 20px; margin: 0; border-bottom: 1px solid var(--line); align-items: center; gap: 12px; }
.archive-sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.archive-sheet-item { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-top: 1px solid #edf1f1; }
.archive-sheet-item:first-child { border-top: 0; }
.archive-sheet-item label { display: flex; align-items: center; gap: 12px; flex: 1; cursor: pointer; }
.archive-sheet-item input { width: 20px; height: 20px; }
.archive-sheet-item strong, .archive-sheet-item small { display: block; }
.archive-sheet-item small { color: var(--muted); font-size: 11px; }

/* ── Sheets ───────────────────────────────────────────────────── */
.sheets-panel { padding: 0; }
.sheets-panel > .panel-heading { padding: 21px 24px; margin: 0; border-bottom: 1px solid var(--line); align-items: center; }
.search-box.small { width: 220px; padding: 8px 10px; }
.sheet-item { display: flex; align-items: center; gap: 14px; padding: 18px 24px; border-bottom: 1px solid #edf1f1; }
.sheet-item:last-child { border: 0; }
.sheet-icon { width: 38px; height: 38px; display: grid; place-items: center; color: var(--orange); background: #fff0e9; border-radius: 8px; font-size: 18px; }
.sheet-item div:nth-child(2) { flex: 1; }
.sheet-item strong, .sheet-item small { display: block; }
.sheet-item strong { font-size: 13px; }
.sheet-item small { font-size: 11px; color: var(--muted); margin-top: 3px; }
.sheet-status { font-size: 11px; color: #3e865f; margin-right: 13px; white-space: nowrap; }
.sheet-action { border: 1px solid var(--line); background: white; border-radius: 6px; padding: 8px 14px; color: var(--ink); font-size: 12px; cursor: pointer; }

/* ── Admin panel ──────────────────────────────────────────────── */
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.admin-accordion { padding: 0; overflow: hidden; }
.admin-accordion-trigger {
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  padding: 18px 20px;
  align-items: center;
}
.admin-accordion-trigger:hover { background: #f4f8f8; }
.admin-accordion-chevron {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--teal);
  font-size: 18px;
}
.admin-accordion-chevron::after { content: "▾"; display: block; transition: transform .15s ease; }
.admin-accordion.is-open .admin-accordion-chevron::after { transform: rotate(-180deg); }
.admin-accordion-body { padding: 0 20px 20px; }
.admin-accordion-body[hidden] { display: none !important; }
.admin-accordion-body > .admin-form-group:first-child { border-top: 0; margin-top: 0; padding-top: 4px; }
.admin-list { margin-bottom: 20px; }
.admin-list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0; border-bottom: 1px solid #edf1f1; gap: 12px; flex-wrap: wrap;
}
.admin-list-item strong { font-size: 13px; display: block; }
.admin-list-item small { font-size: 11px; color: var(--muted); display: block; }
.admin-list-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-list-actions .outline-button { font-size: 11px; padding: 6px 10px; }
.admin-list-item.is-inactive { opacity: 0.78; }
.user-active-field { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.user-active-select { font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); border: 1px solid #d5dfdf; border-radius: 8px; padding: 8px 10px; background: #fff; min-height: 40px; }
#add-skill-station-panel[hidden],
#upload-skill-sheet-panel[hidden] { display: none !important; }
.admin-form-group { border-top: 1px solid #edf1f1; padding-top: 18px; margin-top: 12px; }
.admin-form-group h3 { font-size: 14px; margin: 0 0 12px; }
.admin-form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.admin-form-group input[type="text"],
.admin-form-group input[type="password"],
.admin-form-group select,
.admin-form-group textarea {
  display: block; width: 100%; margin-top: 5px;
  border: 1px solid #d5dfdf; border-radius: 8px; padding: 12px 10px;
  background: white; color: var(--ink); font: inherit; font-size: 14px;
}
.admin-form-group textarea { resize: vertical; }
#add-user-credential-wrap { display: block; }
.form-error { color: #c0392b; font-size: 13px; min-height: 18px; margin: 0 0 12px; }
.admin-list-item.just-added { background: #eaf7ed; outline: 2px solid #3b996b; border-radius: 8px; padding-left: 10px; padding-right: 10px; }
.roster-preview { margin-top: 16px; padding: 16px; background: #f2f7f6; border-radius: 8px; }
.roster-mapping { display: grid; gap: 10px; margin: 12px 0; }
.roster-mapping label { font-size: 13px; font-weight: 600; }
.roster-mapping select { padding: 8px; border-radius: 6px; border: 1px solid var(--line); font-size: 13px; margin-left: 8px; }
button.skill-sheet-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button.skill-sheet-item:hover { background: #f4f8f8; }
.skill-window-pill { font-size: 11px; padding: 5px 10px; border-radius: 20px; background: #eef2f2; color: #5b6d72; white-space: nowrap; }

/* ── Toast ────────────────────────────────────────────────────── */
.form-error { color: #c0392b; font-size: 13px; min-height: 18px; margin: 0 0 12px; }
.admin-list-item.just-added { background: #eaf7ed; outline: 2px solid #3b996b; border-radius: 8px; padding-left: 10px; padding-right: 10px; }
.toast {
  position: fixed; bottom: calc(16px + var(--shell-footer-offset)); left: 50%; transform: translate(-50%, 20px);
  opacity: 0; background: #17343c; color: white; padding: 14px 20px;
  border-radius: 8px; font-size: 14px; transition: .25s; pointer-events: none;
  box-shadow: 0 4px 18px #102f3a33; z-index: 3000; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Print ────────────────────────────────────────────────────── */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .shell-footer, .toast, .page-heading .primary-button, .save-indicator, .toolbar, .criteria-toolbar, .login-screen, #session-lock, #confirm-dialog, #testing-window-dialog { display: none !important; }
  .view { padding: 0; max-width: none; }
  .active-view { display: block; }
  .panel { box-shadow: none; border: 1px solid #9aa; padding: 18px; }
  .sheet-action { display: none; }
}

/* ── iPad tablet (641–1100px) ─────────────────────────────────── */
@media (min-width: 641px) and (max-width: 1100px) {
  body { font-size: 16px; }
  .sidebar {
    position: fixed; z-index: 20; inset: 0 auto 0 0; width: 290px;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 12px 0 28px #17343c33;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { width: 100%; }
  .topbar { height: 80px; padding: 0 24px; }
  .mobile-menu {
    display: grid !important; place-items: center;
    width: 52px; height: 52px; margin-right: 14px; font-size: 24px;
    border: 0; background: none; color: var(--ink); cursor: pointer;
  }
  .breadcrumbs { flex: 1; }
  .date-chip { display: none; }
  .view { padding: 28px 24px 20px; }
  .page-heading h1, .welcome-row h1 { font-size: 30px; }
  .panel { padding: 22px; }
  .nav { gap: 8px; }
  .nav-item { min-height: 52px; padding: 14px 12px; font-size: 16px; }
  .settings-button { min-height: 52px; font-size: 15px; }
  .primary-button, .secondary-button, .outline-button, .text-button, .filter-button, .sheet-action { min-height: 52px; padding: 13px 18px; font-size: 15px; }
  .setup-panel select, .setup-panel .evaluator-readonly, .search-box input { min-height: 52px; font-size: 16px; }
  .criteria-row { min-height: 64px; padding: 12px; }
  .criteria-toolbar.has-timer { padding: 14px 16px; }
  .skill-timer-digits { font-size: 52px; }
  .skill-timer-btn { min-height: 64px; min-width: 104px; font-size: 18px; }
  .attempt-check input { width: 30px; height: 30px; }
  .criteria-task { font-size: 16px; }
  .criteria-task small { font-size: 12px; }
  .signature-box canvas { min-height: 150px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .grade-layout { grid-template-columns: 1fr; }
  .setup-panel { grid-row: auto; }
  .admin-grid { grid-template-columns: 1fr; }
  .menu-backdrop {
    display: block; position: fixed; z-index: 19; inset: 0;
    background: #102f3a66; border: 0; opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .sidebar.open ~ .menu-backdrop { opacity: 1; pointer-events: auto; }
}

/* ── Phone (≤640px) ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .sidebar {
    position: fixed; z-index: 20; inset: 0 auto 0 0; width: 80vw; max-width: 300px;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 12px 0 28px #17343c33;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { width: 100%; }
  .mobile-menu {
    display: grid !important; place-items: center;
    width: 52px; height: 52px; margin-right: 12px; font-size: 20px;
    border: 0; background: none; color: var(--ink); cursor: pointer;
  }
  .topbar { height: 64px; padding: 0 16px; justify-content: flex-start; }
  .topbar-actions { margin-left: auto; }
  .date-chip { display: none; }
  .session-user-meta { display: none; }
  .session-signout { padding: 8px 10px; font-size: 12px; }
  .shell-footer .session-signout { min-height: 48px; padding: 10px 16px; font-size: 14px; }
  .view { padding: 22px 16px 20px; }
  .welcome-row, .page-heading { display: block; }
  .welcome-row .primary-button, .page-heading .primary-button { margin-top: 16px; }
  .window-banner { margin-top: 4px; }
  .window-banner strong { font-size: 18px; }
  .window-flip { gap: 8px; }
  .window-flip-btn { min-height: 56px; font-size: 15px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .stat-card { padding: 14px 12px; gap: 8px; }
  .stat-card strong { font-size: 20px; }
  .stat-card small { display: none; }
  .content-grid { grid-template-columns: 1fr; }
  .grade-layout { grid-template-columns: 1fr; gap: 12px; }
  .setup-panel { grid-row: auto; }
  .admin-grid { grid-template-columns: 1fr; }
  .criteria-row { min-height: 56px; padding: 10px 8px; }
  .criteria-grid-head, .criteria-row { grid-template-columns: 48px 48px minmax(0, 1fr); gap: 7px; }
  .attempt-check input { width: 26px; height: 26px; }
  .signature-box canvas { min-height: 130px; }
  .search-box { width: 100%; }
  .table-head, .roster-row { grid-template-columns: 1.3fr .9fr .8fr; padding: 12px 14px; }
  .table-head span:nth-child(2),
  .roster-row .roster-progress { display: none; }
  .recruit-skill-head, .recruit-skill-row { grid-template-columns: 1.2fr .8fr .6fr; padding: 12px 14px; }
  .audit-head, .audit-row { grid-template-columns: 1fr 1fr; padding: 12px 14px; }
  .audit-head span:nth-child(3), .audit-head span:nth-child(4),
  .audit-row .audit-action, .audit-row .audit-target { display: none; }
  .archives-head, .archive-row { grid-template-columns: 1fr 1fr; padding: 12px 14px; }
  .archives-head span:nth-child(3), .archives-head span:nth-child(4),
  .archive-row .archive-date, .archive-row .archive-sheets { display: none; }
  .archive-sheet-heading { flex-direction: column; align-items: stretch; }
  .menu-backdrop {
    display: block; position: fixed; z-index: 19; inset: 0;
    background: #102f3a66; border: 0; opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .sidebar.open ~ .menu-backdrop { opacity: 1; pointer-events: auto; }
}
