@font-face {
  font-family: "Dubai FutApp";
  src: url("../assets/dubai-regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand: #f4a900;
  --brand-strong: #bd7c00;
  --ink: #1b2733;
  --muted: #647080;
  --line: #d9e0e8;
  --surface: #ffffff;
  --surface-soft: #f5f7fa;
  --surface-warm: #fff7df;
  --sidebar: #2f4f4f;
  --teal: #24766f;
  --blue: #315f8c;
  --green: #2f7d54;
  --red: #b84444;
  --radius: 8px;
  --shadow: 0 18px 42px rgba(27, 39, 51, 0.1);
  color-scheme: light;
  font-family: Inter, "Dubai FutApp", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #eef2f5;
  overflow-x: hidden;
}

body.modal-open { overflow: hidden; }

button, input, select, textarea { font: inherit; max-width: 100%; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: 0.55; }

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 22px 18px;
  color: #f9fbfc;
  background: var(--sidebar);
  border-right: 1px solid rgba(255,255,255,0.14);
}

.brand {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 62px;
}

.brand-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: #ffffff;
  border-radius: var(--radius);
}

.brand strong, .brand span { display: block; overflow-wrap: anywhere; }
.brand strong { font-size: 1.05rem; font-weight: 900; }
.brand span { color: #d7e0e0; font-size: 0.88rem; }

.nav-list { display: grid; gap: 8px; }

.nav-button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  color: #edf3f3;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.glyph {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #243f3f;
  background: var(--brand);
  border-radius: 50%;
  font-weight: 900;
}

.nav-button:hover, .nav-button.active {
  color: #ffffff;
  background: rgba(255,255,255,0.11);
  border-color: rgba(255,255,255,0.18);
}

.nav-button.active { box-shadow: inset 4px 0 0 var(--brand); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.14);
}

.sidebar-footer img {
  max-width: 138px;
  max-height: 46px;
  object-fit: contain;
  opacity: 0.95;
}

.workspace { min-width: 0; max-width: 100vw; overflow-x: hidden; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 78px;
  padding: 14px 24px;
  background: rgba(247, 249, 251, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.title-block { min-width: 0; }
.topbar h1 { margin: 0; font-size: 1.15rem; font-weight: 900; line-height: 1.2; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 0.82rem; font-weight: 800; }

.institution-brand {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.institution-brand > img {
  width: 54px;
  height: 54px;
  padding: 4px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.institution-meta {
  max-width: 680px;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.status-pill, .count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  max-width: 230px;
  padding: 6px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.count-pill { color: #ffffff; background: var(--teal); border-color: var(--teal); }

.context-key-picker { display:grid; gap:3px; min-width:min(320px,34vw); }
.context-key-picker span { color:var(--muted); font-size:.66rem; font-weight:800; text-transform:uppercase; }
.context-key-picker select { min-height:36px; padding:6px 10px; border:1px solid var(--line); border-radius:999px; background:#fff; color:var(--ink); font-weight:800; }

.mobile-menu { display: none; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.icon-button span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
}

.icon-button span + span { margin-top: 4px; }

.app-root {
  min-height: calc(100vh - 78px);
  padding: 24px;
  min-width: 0;
}

.view-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  min-width: 0;
  max-width: 100%;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: 1 / -1; }

.panel-title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.25;
}

.metric {
  display: grid;
  gap: 6px;
  min-height: 104px;
  border-top: 5px solid var(--brand);
}

.metric.teal { border-top-color: var(--teal); }
.metric.blue { border-top-color: var(--blue); }
.metric.green { border-top-color: var(--green); }
.metric strong { font-size: 2rem; line-height: 1; }
.metric span { color: var(--muted); font-weight: 800; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.toolbar.between { justify-content: space-between; }

.roster-actions { justify-content: flex-end; }

.roster-guide {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 3fr);
  align-items: center;
  gap: 18px 24px;
  background: linear-gradient(135deg, #ffffff 0%, var(--surface-warm) 100%);
  border-left: 5px solid var(--brand);
}

.roster-guide-heading {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.roster-guide-heading h2 { margin: 0; font-size: 1rem; line-height: 1.25; }
.roster-guide-heading p { margin: 5px 0 0; color: var(--muted); font-size: 0.78rem; font-weight: 700; line-height: 1.4; }

.roster-guide-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  color: var(--ink);
  background: var(--brand);
  border-radius: 50%;
  font-weight: 900;
}

.roster-guide-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.roster-guide-steps li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-width: 0;
  min-height: 72px;
  padding: 9px;
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(244,169,0,0.3);
  border-radius: var(--radius);
}

.roster-guide-steps > li > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--ink);
  background: var(--brand);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 900;
}

.roster-guide-steps strong,
.roster-guide-steps small { display: block; }
.roster-guide-steps strong { font-size: 0.78rem; line-height: 1.25; }
.roster-guide-steps small { margin-top: 3px; color: var(--muted); font-size: 0.69rem; font-weight: 700; line-height: 1.35; }

.attendance-guide-note {
  grid-column: 1 / -1;
  margin: 0;
  padding: 9px 11px;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
}

.attendance-guide-note strong { color: var(--ink); }

.section-kicker {
  margin: 0 0 6px;
  color: var(--brand-strong);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tests-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(420px, 1fr);
  align-items: center;
  gap: 24px;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff 0%, var(--surface-warm) 100%);
  border-top: 5px solid var(--brand);
}

.tests-hero h2 { margin: 0; font-size: clamp(1.35rem, 2.4vw, 2rem); line-height: 1.15; }
.tests-hero p:not(.section-kicker), .section-heading p { margin: 8px 0 0; color: var(--muted); font-weight: 700; line-height: 1.45; }

.test-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.test-steps li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 8px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(244,169,0,0.32);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 900;
}

.test-steps span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--ink);
  background: var(--brand);
  border-radius: 50%;
}

.tests-filters { flex: 1 1 520px; }
.tests-filters .field:first-child { flex: 1 1 300px; }
.tests-filters .field:last-child { flex: 0 1 220px; }
.tests-filter-toolbar { height: 100%; }

.result-count {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 11px;
  color: var(--teal);
  background: #edf8f3;
  border: 1px solid rgba(47,125,84,0.25);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.tests-summary-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.test-stat {
  display: grid;
  align-content: center;
  min-height: 72px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.test-stat span { color: var(--muted); font-size: 0.72rem; font-weight: 900; line-height: 1.25; }
.test-stat strong { margin-top: 4px; font-size: 1.6rem; line-height: 1; }
.section-heading { align-items: flex-end; margin-bottom: 14px; }
.section-heading .panel-title { margin-bottom: 0; }
.section-heading p { margin-top: 4px; font-size: 0.85rem; }
.danger-outline { color: var(--red); border-color: rgba(184,68,68,0.38); }
.danger-outline:hover:not(:disabled) { background: #fff2f2; border-color: var(--red); }

.attendance-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.attendance-filters .field:first-child { grid-column: 1 / -1; }

.attendance-list {
  display: grid;
  gap: 8px;
  max-height: 560px;
  overflow: auto;
}

.attendance-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  padding: 10px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.attendance-row.marked.present { border-color: rgba(47, 125, 84, 0.48); }
.attendance-row.marked.absent { border-color: rgba(184, 68, 68, 0.48); }

.attendance-row img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  background: #e8edf2;
  border-radius: var(--radius);
}

.attendance-row strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.94rem;
  line-height: 1.2;
}

.attendance-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.35;
}

.attendance-mark-buttons {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mark-button.active.present {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.mark-button.active.absent {
  color: #ffffff;
  background: var(--red);
  border-color: var(--red);
}

.mark-button {
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.attendance-actions {
  margin-top: 12px;
}

.attendance-actions > * {
  width: 100%;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  gap: 16px;
}

.radio-card {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 56px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
}

.radio-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-card:has(input:checked) {
  background: var(--surface-warm);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(244, 169, 0, 0.18);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field.full { grid-column: 1 / -1; }
.field span, .field-label { color: var(--muted); font-size: 0.82rem; font-weight: 900; }

.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(244,169,0,0.2);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 10px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.switch-row input { width: 20px; height: 20px; accent-color: var(--brand); }

.primary-button, .secondary-button, .danger-button, .small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 14px;
  border-radius: var(--radius);
  font-weight: 900;
  text-decoration: none;
  border: 1px solid transparent;
}

.primary-button { color: #263543; background: var(--brand); border-color: var(--brand); }
.primary-button:hover { background: #ffc13a; }
.secondary-button { color: var(--ink); background: var(--surface); border-color: var(--line); }
.danger-button { color: #ffffff; background: var(--red); border-color: var(--red); }
.small-button { min-height: 34px; min-width: 34px; padding: 6px 9px; color: var(--ink); background: #fff; border-color: var(--line); }
.small-button.danger { color: #fff; background: var(--red); border-color: var(--red); }
.photo-choice { position: relative; overflow: hidden; cursor: pointer; }
.photo-choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.photo-capture-fallback {
  position: fixed;
  left: -100vw;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.camera-box {
  width: min(100%, 360px);
  overflow: hidden;
  background: #101820;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.camera-box video {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}
.photo-file-name { color: var(--muted); font-size: 0.8rem; font-weight: 800; }

.av-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 4px;
  color: var(--ink);
  background: transparent;
}

.test-guidance {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--surface-warm);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
}

.test-guidance strong { font-size: 0.84rem; }
.test-guidance span { color: var(--muted); font-size: 0.84rem; font-weight: 700; line-height: 1.4; }

.av-subtitle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding: 6px 18px;
  color: var(--teal);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.2px;
}

.av-clock-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px 56px 56px;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.av-clock {
  color: var(--ink);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 900;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  line-height: 1;
  letter-spacing: -1px;
}

.av-icon-button {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  color: #1b2733;
  background: var(--brand);
  border: 1px solid var(--brand-strong);
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(244, 169, 0, 0.25);
  transition: all 0.15s ease;
}

.av-icon-button,
.av-letter-button {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.av-icon-button small,
.av-letter-button small {
  font-size: 0.58rem;
  font-weight: 900;
}

.av-icon-button:hover:not(:disabled) {
  background: #ffc13a;
  transform: translateY(-1px);
}

.av-letter-button {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  color: var(--teal);
  background: var(--surface);
  border: 2px solid var(--teal);
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 900;
  transition: all 0.15s ease;
}

.av-letter-button:hover:not(:disabled) {
  background: rgba(36, 118, 111, 0.08);
  transform: translateY(-1px);
}

.av-icon-button:disabled,
.av-letter-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.av-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.av-inputs .field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.av-inputs .field input {
  width: 100%;
  min-height: 64px;
  padding: 12px 16px;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font-size: 1.8rem;
  font-weight: 900;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.av-inputs .field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(244, 169, 0, 0.2);
}

.av-status {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 12px 18px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  font-size: 0.95rem;
  font-weight: 800;
}

.av-form footer.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.av-form footer.toolbar > * {
  width: auto;
}

.illinois-clock-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px auto;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.illinois-save-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  min-height: 54px;
  color: #ffffff;
  background: var(--teal);
  border: 1px solid var(--teal);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.15s ease;
}

.illinois-save-button span {
  font-size: 1.2rem;
  line-height: 1;
}

.illinois-save-button:hover:not(:disabled) {
  background: #1d5f59;
}

.illinois-save-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.illinois-time-field {
  width: 100%;
}

.illinois-time-field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.illinois-time-field input {
  min-height: 64px;
  color: var(--ink);
  text-align: center;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font-size: 2rem;
  font-weight: 900;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}


.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.player-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding: 12px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.player-card img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  background: #e8edf2;
  border-radius: var(--radius);
}

.player-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.18;
}

.player-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.player-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tests-player-grid { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
.test-player-card { align-content: start; padding: 14px; background: var(--surface); }
.test-player-card:hover { border-color: rgba(244,169,0,0.55); box-shadow: 0 10px 24px rgba(27,39,51,0.08); }
.test-player-info { min-width: 0; }

.test-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.test-choice-wrap {
  position: relative;
  min-width: 0;
}

.test-choice {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 54px;
  padding: 9px 42px 9px 10px;
  color: var(--ink);
  text-align: left;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.test-choice:hover,
.test-choice:focus-visible {
  background: var(--surface-warm);
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px rgba(244,169,0,0.16);
}

.test-choice strong { font-size: 0.84rem; }
.test-choice span { color: var(--muted); font-size: 0.72rem; font-weight: 800; }
.test-info-button {
  position: absolute;
  top: 9px;
  right: 9px;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--brand-strong);
  background: var(--surface-warm);
  border: 1px solid rgba(244,169,0,0.55);
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}
.test-info-button:hover,
.test-info-button:focus-visible {
  color: var(--ink);
  background: #fff2c7;
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px rgba(244,169,0,0.16);
}
.test-entry-form { max-width: 720px; margin: 0 auto; }
.test-entry-form .context-note { padding: 12px 14px; background: var(--surface-warm); border-left: 4px solid var(--brand); border-radius: var(--radius); }

.test-help {
  display: grid;
  gap: 18px;
  max-width: 760px;
  margin: 0 auto;
}
.test-help-purpose {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.18rem);
  font-weight: 850;
  line-height: 1.45;
}
.test-help-graphic {
  min-height: 210px;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, #fffdf8, var(--surface-warm));
  border: 1px solid rgba(244,169,0,0.35);
  border-radius: var(--radius);
}
.test-help ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 24px;
  line-height: 1.45;
  font-weight: 750;
}
.test-help-tip {
  margin: 0;
  padding: 12px 14px;
  color: var(--muted);
  background: #f7f9fb;
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  line-height: 1.45;
}
.test-help footer { display: flex; justify-content: flex-end; }

.speed-diagram {
  width: min(100%, 620px);
  display: grid;
  grid-template-columns: auto auto 1fr auto 1fr auto;
  align-items: center;
  gap: 8px;
}
.diagram-runner { color: var(--brand-strong); font-size: 1.5rem; }
.speed-diagram i { height: 4px; background: repeating-linear-gradient(90deg, var(--brand) 0 12px, transparent 12px 20px); }
.track-mark { display: grid; gap: 3px; justify-items: center; }
.track-mark::before { content: ""; width: 3px; height: 54px; background: var(--ink); border-radius: 4px; }
.track-mark b { font-size: 0.9rem; }
.track-mark small { color: var(--muted); font-weight: 800; }

.illinois-diagram {
  position: relative;
  width: min(100%, 380px);
  height: 230px;
  border: 3px solid #d8dee5;
  border-radius: var(--radius);
}
.cone { position: absolute; width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 22px solid var(--brand); }
.c1 { left: 12%; top: 15%; } .c2 { right: 12%; top: 15%; }
.c3 { left: 44%; top: 18%; } .c4 { left: 44%; top: 44%; }
.c5 { left: 44%; top: 70%; } .c6 { right: 12%; bottom: 10%; }
.course-path { position: absolute; inset: 35px 25% 32px; color: var(--blue); text-align: center; font-size: 1.55rem; font-weight: 900; line-height: 1.25; }
.course-label { position: absolute; color: var(--muted); font-size: 0.76rem; font-weight: 900; }
.course-label.start { left: 6%; bottom: 8%; } .course-label.finish { right: 5%; bottom: 8%; }

.jump-diagram,
.ai-jump-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 6vw, 58px);
  width: 100%;
}
.jump-diagram > div { display: grid; justify-items: center; gap: 7px; }
.jump-person { display: inline-block; color: var(--ink); text-align: center; font-size: 1.35rem; font-weight: 900; line-height: 1.05; }
.jump-person.crouch { transform: translateY(10px); }
.jump-diagram small { color: var(--muted); font-weight: 800; }
.jump-arrow { color: var(--brand-strong); font-size: 3.2rem; font-weight: 900; }
.phone-shape { padding: 9px 12px; color: var(--blue); text-align: center; background: #eef4ff; border: 3px solid var(--blue); border-radius: 12px; font-size: 1.3rem; line-height: 1; }
.camera-line { color: var(--brand-strong); font-size: 1.25rem; font-weight: 900; letter-spacing: 2px; }
.ai-height-arrow { display: grid; justify-items: center; color: var(--green); font-size: 1.7rem; font-weight: 900; line-height: 0.8; }
.ai-height-arrow small { color: var(--muted); font-size: 0.66rem; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-warm);
  color: var(--brand-strong);
  border: 1px solid rgba(244,169,0,0.35);
  font-size: 0.76rem;
  font-weight: 900;
}

.badge.ok { color: #fff; background: var(--green); border-color: var(--green); }
.badge.warn { color: #fff; background: var(--red); border-color: var(--red); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
th { color: var(--muted); background: #f8fafc; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0; }
td { vertical-align: top; }

.summary-list { display: grid; gap: 10px; }
.summary-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 8px 10px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.summary-row span { color: var(--muted); font-size: 0.82rem; font-weight: 900; }
.summary-row strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.context-fixed {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
  padding: 16px;
  background: var(--surface-warm);
  border: 1px solid rgba(244,169,0,0.38);
  border-radius: var(--radius);
}
.context-fixed span,.context-fixed small,.context-note { color: var(--muted); font-size: 0.8rem; font-weight: 800; }
.context-fixed strong { font-size: 1.05rem; }
.context-note { grid-column: 1 / -1; margin: 0; line-height: 1.45; }
.session-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 12px;
  background: #edf8f3;
  border: 1px solid rgba(47,125,84,.28);
  border-radius: var(--radius);
}
.session-strip strong,.session-strip small { display: block; }
.session-strip small { margin-top: 2px; color: var(--muted); font-size: .76rem; font-weight: 800; }
.session-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(47,125,84,.14); }
.context-logout { width: 100%; margin-top: 12px; }
.context-loading { display: grid; gap: 8px; min-height: 180px; place-content: center; text-align: center; }
.context-loading span { color: var(--muted); }

.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-weight: 800;
}

.empty-state strong, .empty-state span { display: block; }
.empty-state span { margin-top: 5px; font-size: 0.84rem; }
.empty-state.compact { min-height: 116px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(47,79,79,0.44);
}

.modal-backdrop.hidden { display: none; }
.modal-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 80vw;
  height: 80vh;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal-panel:focus { outline: none; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 { margin: 0; font-size: 1.05rem; }
.modal-body { min-height: 0; overflow: auto; padding: 16px; }

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 110;
  display: grid;
  gap: 8px;
  width: min(390px, calc(100vw - 36px));
}

.toast {
  padding: 12px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 800;
}

.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }
.hidden { display: none !important; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .topbar { grid-template-columns: minmax(0, 1fr); }
  .topbar-status { grid-column: 1 / -1; justify-content: flex-start; }
  .context-key-picker { min-width:min(100%,420px); }
  .app-root { padding: 16px; }
  .span-3, .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: 1 / -1; }
  .roster-guide { grid-template-columns: 1fr; }
  .roster-guide-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tests-hero { grid-template-columns: 1fr; }
  .attendance-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .day-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
  }
  .form-grid { grid-template-columns: 1fr; }
  .modal-panel { width: 90vw; height: 90vh; }
}

@media (max-width: 620px) {
  .modal-backdrop { padding: 10px; }
  .modal-header { padding: 12px; }
  .modal-header h2 { min-width: 0; overflow-wrap: anywhere; }
  .modal-body { overflow-x: hidden; padding: 12px; }
  .institution-meta { white-space: normal; }
  .player-grid { grid-template-columns: 1fr; }
  .roster-guide-steps { grid-template-columns: 1fr; }
  .test-steps { grid-template-columns: 1fr; }
  .tests-summary-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .test-actions { grid-template-columns: 1fr; }
  .test-record-actions { width: 100%; }
  .player-card {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
  }
  .player-card img {
    width: 92px;
    height: 92px;
  }
  .attendance-filters { grid-template-columns: 1fr; }
  .attendance-filters .field:first-child { grid-column: auto; }
  .attendance-row { grid-template-columns: 64px minmax(0, 1fr); }
  .attendance-row img { width: 64px; height: 64px; }
  .attendance-mark-buttons { gap: 10px; }
  .mark-button {
    min-height: 48px;
    font-size: 0.95rem;
  }
  .day-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .radio-card { min-height: 52px; }
  .toolbar > * { width: 100%; }
  .roster-actions { width: 100%; }
  .context-key-picker { width:100%; }
  .status-pill, .count-pill { max-width: 100%; }
  .av-form { min-width: 0; padding: 0; gap: 16px; }
  .av-subtitle { width: 100%; padding: 10px 12px; overflow-wrap: anywhere; }
  .test-guidance { min-width: 0; }
  .av-clock-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
    padding: 14px 10px;
  }
  .av-clock {
    grid-column: 1 / -1;
    min-width: 0;
    text-align: center;
    font-size: clamp(2.15rem, 14vw, 3.2rem);
  }
  .av-icon-button, .av-letter-button {
    justify-self: center;
    width: 58px;
    height: 58px;
    font-size: 0.76rem;
  }
  .av-inputs { grid-template-columns: 1fr; }
  .av-inputs .field input { min-height: 54px; font-size: 1.5rem; }
  .av-form footer.toolbar { flex-direction: column; align-items: stretch; }
  .av-form footer.toolbar > * { width: 100%; }
  .illinois-clock-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
    padding: 14px 10px;
  }
  .illinois-clock-row .av-clock { grid-column: 1 / -1; }
  .illinois-clock-row .av-icon-button {
    width: 100%;
    max-width: none;
    height: 52px;
    border-radius: var(--radius);
  }
  .illinois-save-button { width: 100%; min-width: 0; min-height: 52px; padding-inline: 8px; font-size: 0.8rem; }
  .illinois-save-button span { font-size: 1.1rem; }
}
