:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #eef3f8;
  --ink: #17212f;
  --muted: #667085;
  --line: #d8e0ea;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --green: #0f766e;
  --green-soft: #ccfbf1;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --violet: #6d28d9;
  --violet-soft: #ede9fe;
  --radius: 8px;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #eef3f8 0%, #f8fafc 100%);
}

.login-panel {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 16px;
}

.login-panel h1 {
  margin: 0;
  font-size: 28px;
}

.login-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-brand {
  color: var(--ink);
  border-bottom-color: var(--line);
  padding-left: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
}

button:hover {
  border-color: #a8b4c4;
}

button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

button.danger {
  border-color: #fecaca;
  background: var(--red-soft);
  color: #991b1b;
}

button.ghost {
  background: transparent;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 11px;
  outline: none;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.readonly-value {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  color: var(--ink);
  font-weight: 800;
  padding: 7px 8px;
}

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

.sidebar {
  background: #111827;
  color: #e5e7eb;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.72);
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand strong {
  display: block;
  font-size: 15px;
}

.brand span {
  display: block;
  color: #9ca3af;
  font-size: 12px;
  margin-top: 2px;
}

.role-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 10px;
}

.role-box label {
  color: #9ca3af;
  font-size: 12px;
}

.role-box select {
  margin-top: 6px;
  background: #1f2937;
  color: #fff;
  border-color: #374151;
}

.mobile-page-switcher {
  display: none;
}

.mobile-page-buttons {
  display: none;
}

.mobile-page-select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
  padding: 7px 10px;
  font-size: 14px;
}

.mobile-page-select option {
  color: #111827;
  background: #ffffff;
}

.nav {
  display: grid;
  gap: 12px;
}

.nav-group {
  display: grid;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.nav-group-label {
  padding: 0 11px;
  font-size: 12px;
  color: #94a3b8;
}

.nav button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  padding: 10px 11px;
  touch-action: manipulation;
}

.nav button.active {
  background: #2563eb;
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.sidebar-footer button {
  color: #e5e7eb;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 68px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  margin: 0;
  font-size: 21px;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.content {
  padding: 20px 22px 34px;
  display: grid;
  gap: 16px;
}

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

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}

.check-chip input {
  width: 16px;
  height: 16px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

.card-header h2,
.card-header h3 {
  margin: 0;
  font-size: 16px;
}

.card-body {
  padding: 16px;
}

.metric {
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 5px;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: #f8fafc;
  color: #475467;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:hover td {
  background: #f8fbff;
}

td.sorted-cell {
  background: #eef6ff;
  color: #1d4ed8;
  font-weight: 700;
}

tr:hover td.sorted-cell {
  background: #dbeafe;
}

.note-cell {
  min-width: 180px;
  max-width: 320px;
  white-space: normal;
  line-height: 1.45;
  color: #344054;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
}

.pill.red {
  background: var(--red-soft);
  color: #991b1b;
}

.pill.blue {
  background: var(--blue-soft);
  color: #1d4ed8;
}

.pill.green {
  background: var(--green-soft);
  color: #115e59;
}

.pill.amber {
  background: var(--amber-soft);
  color: #92400e;
}

.pill.violet {
  background: var(--violet-soft);
  color: #5b21b6;
}

.rank-row {
  display: grid;
  grid-template-columns: 44px 1fr 74px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #eef2f7;
}

.rank-row:last-child {
  border-bottom: 0;
}

.bar {
  height: 9px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #14b8a6);
}

.match-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.scouter-picker {
  display: grid;
  gap: 8px;
}

.match-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.match-dropdown {
  position: relative;
  width: 330px;
}

.match-dropdown-trigger,
.match-dropdown-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.match-dropdown-label {
  flex: 0 0 auto;
  min-width: 68px;
  text-align: left;
}

.match-dropdown-trigger {
  min-height: 41px;
}

.match-dropdown-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.match-dropdown-menu button {
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #eef2f7;
}

.match-dropdown-menu button.active {
  background: var(--blue-soft);
  color: #1d4ed8;
}

.match-progress-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 6px;
}

.match-progress {
  flex: 0 0 auto;
  display: grid;
  gap: 4px;
  min-width: 58px;
  padding: 6px 7px;
  border-radius: 8px;
  background: #fff;
}

.match-progress.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dot-row {
  display: flex;
  gap: 3px;
}

.current-match-dots {
  min-width: 64px;
  padding: 0;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  opacity: 0.22;
  border: 1px solid currentColor;
}

.dot.red {
  color: var(--red);
}

.dot.blue {
  color: var(--blue);
}

.dot.filled {
  opacity: 1;
  background: currentColor;
}

.match-dropdown-status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.match-team-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  max-width: 235px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-team-group {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.match-team-number {
  font-weight: 800;
  line-height: 1;
  padding: 0;
}

.match-team-number.red {
  color: #b91c1c;
}

.match-team-number.blue {
  color: #1d4ed8;
}

.match-team-number.pending {
  opacity: 0.26;
}

.match-team-number.submitted {
  opacity: 1;
}

.match-team-separator {
  color: var(--muted);
}

.compact-scouter {
  gap: 8px;
}

.compact-scouter .notice {
  padding: 8px 10px;
}

.scouter-route-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.scouter-route-preview .field-canvas {
  min-height: 160px;
}

.scouter-form-compact {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
}

.scouter-form-compact section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  padding: 8px;
  display: grid;
  gap: 7px;
  align-content: start;
}

.scouter-form-compact section.wide {
  grid-column: span 2;
}

.scouter-form-compact section.route-section {
  grid-column: 1 / -1;
}

.scouter-form-compact section.route-section .field-canvas {
  min-height: 280px;
}

.scouter-form-compact h3 {
  margin: 0;
  font-size: 13px;
}

.scouter-form-compact .field {
  gap: 3px;
}

.scouter-form-compact .field label {
  font-size: 12px;
}

.scouter-form-compact input,
.scouter-form-compact select,
.scouter-form-compact textarea {
  padding: 7px 8px;
}

.scouter-form-compact textarea {
  min-height: 88px;
}

.compact-hint {
  line-height: 1.45;
}

.submitted-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.submitted-summary .metric strong {
  font-size: 17px;
}

.assignment-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 220px;
}

.assignment-checks label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff;
  font-size: 12px;
}

.assignment-checks input {
  width: auto;
}

.match-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
}

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

.segmented button {
  padding: 7px 10px;
}

.segmented button.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: #1d4ed8;
}

.team-detail {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.48);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-panel {
  width: min(1120px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 14px;
}

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

.modal-header h2 {
  margin: 0 0 8px;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.notice {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 11px 12px;
  border-radius: var(--radius);
}

.notice.success {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #115e59;
}

.toast-message {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  min-width: 160px;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  text-align: center;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.22);
  font-weight: 700;
}

.toast-message.success {
  background: #166534;
}

.toast-message.warning {
  background: #92400e;
}

.hidden-file {
  display: none;
}

.photo-import {
  display: grid;
  gap: 12px;
}

.photo-preview {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.parse-preview {
  max-height: 300px;
  overflow: auto;
}

.video-lab {
  display: grid;
  gap: 12px;
}

.review-video {
  width: 100%;
  min-height: 260px;
  max-height: 520px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f172a;
}

.video-events {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.video-events button {
  justify-content: center;
  min-height: 42px;
  font-weight: 700;
}

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

.alliance-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.alliance-card.ours {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 111, 70, 0.14);
}

.alliance-title,
.alliance-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid #eef2f7;
}

.alliance-title {
  background: #f8fafc;
}

.alliance-slot:last-child {
  border-bottom: 0;
}

.alliance-slot span {
  color: var(--muted);
  font-size: 12px;
}

.alliance-slot em {
  color: #98a2b3;
  font-style: normal;
  font-size: 12px;
}

.alliance-slot button {
  padding: 5px 8px;
}

.alliance-slot.drop-ready {
  outline: 2px dashed var(--blue);
  outline-offset: -4px;
  background: #f8fbff;
  cursor: pointer;
}

.alliance-slot.drop-ready em {
  color: var(--blue);
  font-weight: 700;
}

.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;
}

.button-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 600;
}

.robot-photo-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.robot-photo-item {
  display: grid;
  gap: 7px;
}

.robot-photo-item strong {
  font-size: 13px;
}

.photo-field {
  display: grid;
  gap: 8px;
}

.photo-frame {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.photo-actions button,
.photo-actions .button-like {
  flex: 1;
  min-width: 68px;
}

.detail-section {
  display: grid;
  gap: 10px;
}

.detail-section h3 {
  margin: 0;
  font-size: 16px;
}

.scale-guide {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  padding: 10px;
  line-height: 1.5;
}

.scale-guide div {
  display: grid;
  gap: 2px;
}

.scale-guide span {
  color: var(--muted);
  font-size: 13px;
}

.route-editor {
  display: grid;
  gap: 10px;
}

.route-toolbar,
.route-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.route-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 4px;
}

.route-chip.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.route-chip button {
  border: 0;
  padding: 5px 8px;
}

.route-chip input[type="color"] {
  width: 34px;
  height: 30px;
  padding: 2px;
}

.field-canvas {
  width: 100%;
  max-width: 960px;
  aspect-ratio: 2 / 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eef3f8;
  touch-action: none;
  display: block;
}

.field-canvas.preview {
  max-height: 360px;
}

.route-fullscreen-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.96);
}

.route-fullscreen-head,
.route-fullscreen-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #ffffff;
}

.route-fullscreen-actions {
  justify-content: center;
  flex-wrap: wrap;
}

.route-fullscreen-hint {
  color: #fde68a;
  font-size: 13px;
  text-align: center;
}

.route-fullscreen-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.route-fullscreen-close {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  padding: 0;
}

.route-fullscreen-canvas {
  align-self: center;
  justify-self: center;
  width: min(calc(100vw - 24px), calc((100vh - 142px) * 2));
  max-width: calc(100vw - 24px);
  height: auto;
  max-height: calc(100vh - 142px);
  aspect-ratio: 2 / 1;
  border-color: rgba(255, 255, 255, 0.25);
  background: #f8fafc;
}

@media (orientation: landscape) {
  .route-fullscreen-modal {
    padding: 8px;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .route-fullscreen-hint {
    display: none;
  }

  .route-fullscreen-canvas {
    width: min(calc(100vw - 16px), calc((100vh - 108px) * 2));
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 108px);
  }
}

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

.route-gallery-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.route-gallery-item .field-canvas.preview {
  min-height: 170px;
}

@media (max-width: 1180px) {
  .scouter-form-compact {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .scouter-form-compact section.wide {
    grid-column: span 3;
  }

  .alliance-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 8px 10px;
    gap: 8px;
  }

  .brand {
    padding: 4px 4px 8px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .role-box {
    display: none;
  }

  .mobile-page-switcher {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  .mobile-page-switcher label {
    color: #94a3b8;
    font-size: 11px;
  }

  .nav {
    display: none;
  }

  .nav-group {
    display: contents;
  }

  .nav-group-label {
    display: none;
  }

  .nav button {
    flex: 0 0 auto;
    width: auto;
    min-width: 92px;
    text-align: center;
    padding: 9px 10px;
    scroll-snap-align: start;
  }

  .sidebar-footer {
    display: none;
  }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .scouter-form-compact,
  .robot-photo-grid,
  .alliance-board,
  .video-events,
  .form-grid,
  .team-detail {
    grid-template-columns: 1fr;
  }

  .scouter-form-compact section.wide {
    grid-column: auto;
  }

  .submitted-summary {
    grid-template-columns: 1fr 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    position: static;
    min-height: auto;
    padding: 10px 12px;
    gap: 8px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .topbar p {
    display: none;
  }

  .topbar .toolbar {
    gap: 6px;
  }

  .content {
    padding: 10px 10px 86px;
    gap: 10px;
  }

  .card-header,
  .card-body {
    padding: 10px;
  }

  .toolbar {
    gap: 7px;
  }

  .toolbar > div[style] {
    width: 100% !important;
    min-width: 0 !important;
  }

  .match-dropdown {
    width: 100%;
  }

  .match-team-inline {
    max-width: 62vw;
    font-size: 10px;
    gap: 2px;
  }

  .match-team-group {
    gap: 3px;
  }

  .match-dropdown-menu {
    max-height: 55vh;
  }

  .match-select-wrap {
    width: 100%;
  }

  .scouter-picker .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .scouter-form-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scouter-form-compact section.wide {
    grid-column: 1 / -1;
  }

  .match-card {
    padding: 9px;
  }

  .match-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .submitted-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    padding: 10px;
  }

  .metric strong {
    font-size: 21px;
  }

  .table-wrap {
    max-width: calc(100vw - 20px);
  }

  .alliance-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .alliance-title,
  .alliance-slot {
    padding: 8px;
  }

  .alliance-slot {
    min-height: 44px;
  }

  .robot-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-frame {
    min-height: 120px;
  }

  .route-toolbar button,
  .route-list .route-chip {
    flex: 1 1 120px;
  }

  .field-canvas {
    min-height: 190px;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 13px;
  }

  button {
    min-height: 36px;
    padding: 7px 9px;
  }

  input,
  select,
  textarea {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 16px;
  }

  .login-page {
    padding: 12px;
    place-items: start center;
  }

  .login-panel {
    padding: 16px;
  }

  .brand span {
    display: none;
  }

  .nav button {
    min-width: 76px;
    font-size: 12px;
    padding: 7px 8px;
  }

  .topbar .toolbar .pill:nth-of-type(n + 3) {
    display: none;
  }

  .grid {
    gap: 8px;
  }

  .notice {
    padding: 8px;
    font-size: 12px;
  }

  .scouter-form-compact {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .scouter-form-compact section {
    gap: 6px;
    padding: 7px;
  }

  .scouter-form-compact textarea {
    min-height: 64px;
  }

  .compact-hint,
  .hint {
    font-size: 11px;
    line-height: 1.35;
  }

  .match-card {
    padding: 7px;
  }

  .match-title {
    gap: 5px;
  }

  .readonly-value {
    padding: 7px 8px;
  }

  .submitted-summary {
    grid-template-columns: 1fr;
  }

  .alliance-board {
    grid-template-columns: 1fr;
  }

  .route-gallery {
    grid-template-columns: 1fr;
  }

  .alliance-card {
    border-radius: 8px;
  }

  .alliance-title {
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .table-wrap table {
    min-width: 620px;
  }

  .modal-backdrop {
    align-items: stretch;
    padding: 8px;
  }

  .modal-panel {
    max-height: calc(100vh - 16px);
    border-radius: 8px;
    padding: 10px;
  }

  .modal-header {
    flex-direction: column;
  }

  .modal-header button {
    width: 100%;
  }

  .robot-photo-grid {
    grid-template-columns: 1fr;
  }

  .field-canvas {
    min-height: 150px;
  }

  .route-toolbar,
  .route-list {
    gap: 5px;
  }

  .route-toolbar button,
  .route-list .route-chip {
    flex: 1 1 92px;
    font-size: 12px;
  }

  .assignment-checks {
    min-width: 0;
  }
}

@media (max-width: 430px) {
  .content {
    padding: 8px 7px 76px;
  }

  .sidebar {
    padding: 8px 7px;
  }

  .topbar {
    padding: 8px;
  }

  .topbar h1 {
    font-size: 16px;
  }

  .card-header,
  .card-body {
    padding: 8px;
  }

  .match-dropdown-label {
    min-width: 58px;
  }

  .match-team-inline {
    max-width: 58vw;
    font-size: 9px;
  }

  .match-team-group {
    gap: 2px;
  }

  .scouter-form-compact .field label {
    font-size: 11px;
  }

  .metric {
    padding: 8px;
  }

  .metric strong {
    font-size: 18px;
  }

  .field-canvas {
    min-height: 132px;
  }
}
