:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2a37;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #1d4ed8;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body:not(.auth-ready) [data-page] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.muted {
  color: var(--muted);
}

.top-nav {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-brand {
  font-weight: 600;
}

.nav-brand-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-unit,
.nav-language {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.nav-unit label,
.nav-language label {
  display: inline;
  gap: 0;
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.nav-unit select,
.nav-language select {
  min-height: 36px;
  padding: 0.3rem 0.45rem;
  font-size: 0.9rem;
  width: auto;
  min-width: 160px;
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  min-width: 0;
}

.nav-links a,
.nav-links button,
.nav-brand-group .pwa-update-button {
  flex: 0 0 auto;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.2;
  padding: 0.35rem 0.45rem;
  border-radius: 0.45rem;
  border: 1px solid transparent;
  white-space: nowrap;
}

.nav-links button,
.nav-brand-group .pwa-update-button {
  appearance: none;
  background: none;
  cursor: pointer;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: #eef2ff;
  color: #1e3a8a;
}

.nav-links button:hover,
.nav-links button:focus-visible,
.nav-brand-group .pwa-update-button:hover,
.nav-brand-group .pwa-update-button:focus-visible {
  background: #eef2ff;
  color: #1e3a8a;
}

.pwa-install-button {
  background: #e0f2fe;
  color: #075985;
  border-color: #7dd3fc;
}

.pwa-update-button {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.pwa-update-button[data-tone='idle'] {
  background: #eff6ff;
  color: #1e3a8a;
  border-color: #bfdbfe;
}

.pwa-update-button[data-tone='checking'] {
  background: #f8fafc;
  color: #475569;
  border-color: #cbd5e1;
}

.pwa-update-button[data-tone='current'] {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.pwa-update-button[data-tone='warning'] {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.pwa-update-button[data-tone='ready'] {
  background: #fde68a;
  color: #78350f;
  border-color: #f59e0b;
}

.pwa-sync-button {
  background: #f8fafc;
  color: var(--text);
  border-color: var(--border);
}

.pwa-sync-button[data-tone='warning'] {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.pwa-sync-button[data-tone='success'] {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.pwa-network-status {
  min-height: 36px;
  padding: 0.35rem 0.55rem;
  border-radius: 0.45rem;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.pwa-network-status[data-tone='success'] {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.pwa-network-status[data-tone='warning'] {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.pwa-network-status[data-tone='info'] {
  background: #eff6ff;
  color: #1e3a8a;
  border-color: #bfdbfe;
}

body > .pwa-install-button,
body > .pwa-update-button,
body > .pwa-sync-button,
body > .pwa-network-status {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

body > .pwa-network-status {
  left: 1rem;
  right: auto;
}

body > .pwa-sync-button {
  right: 1rem;
  bottom: 4.25rem;
}

body > .pwa-update-button:not([hidden]) + .pwa-install-button:not([hidden]) {
  bottom: 4.25rem;
}

body > .pwa-sync-button:not([hidden]) ~ .pwa-install-button:not([hidden]) {
  bottom: 7.5rem;
}

.pwa-sync-panel {
  position: fixed;
  right: 1rem;
  bottom: 4.25rem;
  width: min(420px, calc(100vw - 2rem));
  max-height: min(680px, calc(100vh - 6rem));
  overflow: auto;
  z-index: 30;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.pwa-sync-panel-header,
.pwa-sync-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.pwa-sync-panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.pwa-sync-close {
  min-height: 36px;
  padding: 0.35rem 0.55rem;
}

.pwa-sync-summary {
  margin: 0.75rem 0;
  color: var(--muted);
  font-weight: 700;
}

.pwa-sync-summary[data-tone='success'] {
  color: #166534;
}

.pwa-sync-summary[data-tone='warning'] {
  color: #92400e;
}

.pwa-sync-list {
  display: grid;
  gap: 0.5rem;
}

.pwa-sync-group {
  display: grid;
  gap: 0.45rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: #f8fafc;
}

.pwa-sync-group[data-count='0'] {
  opacity: 0.72;
}

.pwa-sync-group > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.pwa-sync-group span,
.pwa-sync-group li {
  color: var(--muted);
  font-size: 0.9rem;
}

.pwa-sync-group ul {
  margin: 0;
  padding-left: 1.1rem;
}

.pwa-sync-actions {
  margin-top: 0.75rem;
}

.offline-shell {
  align-content: center;
}

.offline-card {
  text-align: center;
}

.offline-icon {
  width: 72px;
  height: 72px;
  justify-self: center;
}

.button-link {
  min-height: 44px;
  padding: 0.55rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.auth-status-notice {
  padding: 0.75rem 0.85rem;
  border-radius: 0.6rem;
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
  font-weight: 700;
}

.auth-status-notice[data-tone='error'] {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.app-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.app-shell > * {
  min-width: 0;
}

.equipment-page {
  max-width: 1440px;
}

h1,
h2,
h3 {
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: min(100%, calc(100vw - 2rem));
  max-width: 420px;
  display: grid;
  gap: 0.75rem;
}

.login-form {
  display: grid;
  gap: 0.75rem;
}

.landing {
  min-height: 100vh;
  align-content: start;
}

.landing-hero {
  padding: 1.5rem 0 0.5rem;
}

.landing-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.landing-subtitle {
  color: var(--muted);
  margin-top: 0.35rem;
}

.landing-links .link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
  gap: 0.75rem;
}

.link-card {
  display: grid;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
  padding: 1rem;
  border-radius: 0.65rem;
  border: 1px solid var(--border);
  background: #f8fafc;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.link-card:hover,
.link-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.link-card h2 {
  margin: 0;
  font-size: 1.1rem;
}

.link-card p {
  margin: 0;
  color: var(--muted);
}

.dashboard {
  max-width: 1120px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  padding: 1.25rem 0 0.25rem;
}

.dashboard-header h1 {
  margin: 0;
}

.dashboard-eyebrow,
.dashboard-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.dashboard-date {
  display: grid;
  gap: 0.15rem;
  justify-items: end;
  color: var(--muted);
}

.dashboard-date strong {
  color: var(--text);
  font-size: 1rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.dashboard-tile {
  min-height: 178px;
  display: grid;
  align-content: space-between;
  gap: 0.8rem;
  text-decoration: none;
  color: inherit;
  padding: 1rem;
  border-radius: 0.7rem;
  border: 1px solid var(--border);
  background: #ffffff;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.dashboard-tile:hover,
.dashboard-tile:focus-visible {
  transform: translateY(-2px);
  border-color: #bfdbfe;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.dashboard-tile h2 {
  margin: 0;
  font-size: 1.4rem;
}

.dashboard-tile p {
  margin: 0;
  color: var(--muted);
}

.dashboard-tile-primary {
  color: #ffffff;
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.dashboard-tile-primary .dashboard-kicker,
.dashboard-tile-primary p {
  color: #dbeafe;
}

.dashboard-action {
  justify-self: start;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 0.45rem;
  font-weight: 700;
  background: #eef2ff;
  color: #1e3a8a;
}

.dashboard-tile-primary .dashboard-action {
  background: #ffffff;
  color: #1d4ed8;
}

.dashboard-panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.dashboard-panel {
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.dashboard-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.dashboard-panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.dashboard-action-list {
  display: grid;
  gap: 0.5rem;
}

.dashboard-action-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: #f8fafc;
  text-decoration: none;
  color: inherit;
}

.dashboard-action-list a:hover,
.dashboard-action-list a:focus-visible {
  background: #eef2ff;
  border-color: #bfdbfe;
}

.dashboard-action-list span {
  color: var(--muted);
  font-size: 0.9rem;
}

.dashboard-action-list strong {
  text-align: right;
}

.tutorial-page {
  gap: 1rem;
}

.tutorial-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.tutorial-hero h1 {
  margin-bottom: 0.35rem;
}

.tutorial-hero p:last-child {
  margin: 0;
  color: var(--muted);
}

.tutorial-progress-card {
  min-width: 180px;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: #ffffff;
  display: grid;
  gap: 0.45rem;
}

.tutorial-progress-card span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tutorial-progress-card strong {
  font-size: 1.7rem;
  line-height: 1;
}

.tutorial-progress-card meter {
  width: 100%;
  height: 0.8rem;
}

.tutorial-controls {
  display: grid;
  gap: 0.85rem;
}

.tutorial-role-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: max-content;
  max-width: 100%;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: #f8fafc;
  overflow-x: auto;
}

.tutorial-role-tabs button {
  min-height: 38px;
  padding: 0.45rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.tutorial-role-tabs button[aria-selected='true'] {
  background: #ffffff;
  border-color: #bfdbfe;
  color: #1e3a8a;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.tutorial-filter-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.tutorial-search {
  flex: 1 1 280px;
  max-width: 460px;
}

.tutorial-actions {
  margin: 0;
}

.tutorial-lessons {
  display: grid;
  gap: 0.85rem;
}

.tutorial-lesson {
  padding: 0;
  overflow: hidden;
}

.tutorial-lesson summary {
  min-height: 58px;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  font-weight: 800;
}

.tutorial-lesson[data-complete='true'] summary {
  background: #f0fdf4;
}

.tutorial-lesson-title {
  min-width: 0;
}

.tutorial-lesson-count {
  min-width: 52px;
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: #ffffff;
  font-size: 0.82rem;
  text-align: center;
  white-space: nowrap;
}

.tutorial-lesson-purpose {
  margin-top: 0;
  color: var(--muted);
}

.tutorial-step-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding-left: 1.35rem;
}

.tutorial-step-list li::marker {
  font-weight: 800;
  color: #2563eb;
}

.tutorial-step-list label {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.55rem;
  margin: 0;
  color: var(--text);
  font-weight: 500;
  line-height: 1.35;
}

.tutorial-step-list input {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.1rem;
}

.tutorial-lesson-actions {
  margin-top: 1rem;
}

.tutorial-empty {
  color: var(--muted);
  font-weight: 700;
}

header p { color: var(--muted); margin-top: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
}

.collapsible-card {
  padding: 0;
}

.collapsible-card > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  font-weight: 600;
  font-size: 1.05rem;
}

.collapsible-card > summary::-webkit-details-marker {
  display: none;
}

.collapsible-card > summary::after {
  content: '+';
  color: var(--muted);
}

.collapsible-card[open] > summary::after {
  content: '-';
}

.collapsible-card[open] > summary {
  border-bottom: 1px solid var(--border);
}

.collapsible-content {
  padding: 1rem;
}

.field-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
}

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

.field-break {
  grid-column: 1 / -1;
  height: 0.5rem;
}

.field-right {
  justify-items: end;
  text-align: right;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.section-title-row h2 {
  margin: 0;
}

.compact-text {
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.active-device-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-weight: 700;
  font-size: 0.85rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
}

.field-grid > label,
.field-grid > .inline-toggle,
.field-grid > .field-break {
  min-width: 0;
}

input:not([type='checkbox']):not([type='radio']),
select {
  width: 100%;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  min-height: 44px;
}

.inline-toggle input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin: 0;
}

input,
select,
button {
  min-height: 44px;
  padding: 0.55rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  font-size: 1rem;
  max-width: 100%;
}

.actions {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

button { cursor: pointer; border: none; }

button.primary {
  background: var(--accent);
  color: white;
}

.status {
  min-height: 1.2rem;
  color: var(--muted);
  margin-bottom: 0;
}

.status[data-tone='success'] { color: #166534; }
.status[data-tone='warning'] { color: #92400e; }
.status[data-tone='error'] { color: #b91c1c; }
.status[data-tone='info'] { color: var(--muted); }

.sync-status-bar {
  margin-top: -0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.sync-status-bar[data-tone='success'] {
  color: #166534;
}

.sync-status-bar[data-tone='warning'] {
  color: #92400e;
}

.attendance-active-bar {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0.55rem 0.75rem;
  border: 1px solid #bfdbfe;
  border-radius: 0.6rem;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 700;
}

.roster-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.roster-header h2 {
  margin: 0;
}

.roster-search {
  flex: 1 1 240px;
  max-width: 360px;
  font-weight: 600;
}

.present-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text);
  cursor: pointer;
}

.present-toggle input[type='checkbox'] {
  width: 22px;
  height: 22px;
  margin: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.5rem;
}

.summary.card {
  padding: 0;
}

.summary.card > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  font-weight: 600;
  font-size: 1.15rem;
}

.summary.card > summary::-webkit-details-marker {
  display: none;
}

.summary.card > summary::after {
  content: '+';
  color: var(--muted);
}

.summary.card[open] > summary::after {
  content: '-';
}

.summary.card[open] > summary {
  border-bottom: 1px solid var(--border);
}

.summary-content {
  padding: 1rem;
}

.summary-block + .summary-block {
  margin-top: 1rem;
}

.summary-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.summary-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.summary-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.summary-grid p {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.65rem;
  background: #f8fafc;
}

.summary-grid strong {
  display: block;
  font-size: 1.25rem;
}

.summary-grid span { color: var(--muted); }

.import-summary {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.import-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.import-status[data-status='new'] {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.import-status[data-status='update'] {
  background: #dbeafe;
  color: #1e3a8a;
  border-color: #93c5fd;
}

.import-status[data-status='duplicate'] {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.import-status[data-status='invalid'],
.import-status[data-status='error'] {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.import-table tr[data-status='duplicate'],
.import-table tr[data-status='invalid'] {
  background: #fff7ed;
}

.supply-section {
  padding: 0;
}

.supply-filter {
  display: grid;
  gap: 0.35rem;
  margin-top: 1rem;
  max-width: 520px;
  font-weight: 600;
}

.supply-filter input {
  width: 100%;
}

.supply-section > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  font-weight: 600;
  font-size: 1.05rem;
}

.supply-summary-label {
  flex: 1 1 auto;
}

.supply-drag-handle {
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.2rem 0.45rem;
  background: #f8fafc;
  cursor: grab;
}

.supply-section.dragging {
  opacity: 0.6;
}

.supply-section > summary::-webkit-details-marker {
  display: none;
}

.supply-section > summary::after {
  content: '+';
  color: var(--muted);
}

.supply-section[open] > summary::after {
  content: '-';
}

.supply-section[open] > summary {
  border-bottom: 1px solid var(--border);
}

.supply-content {
  padding: 1rem;
}

.supply-qty {
  max-width: 120px;
}

.supply-notes {
  width: 100%;
}

.supply-size {
  width: 100%;
}

.supply-add,
.supply-delete {
  min-height: 40px;
  padding: 0.35rem 0.6rem;
  border-radius: 0.45rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.supply-add {
  background: var(--accent);
  color: #fff;
}

.supply-delete {
  background: #fee2e2;
  color: #991b1b;
}

.supply-add-row td {
  border-top: 1px dashed var(--border);
}

.equipment-summary {
  margin-top: 1rem;
}

.equipment-table,
.equipment-issue-table {
  border-collapse: separate;
  border-spacing: 0;
}

.equipment-table {
  min-width: 1320px;
  table-layout: fixed;
}

.equipment-table th,
.equipment-table td,
.equipment-issue-table th,
.equipment-issue-table td {
  padding: 0.8rem 0.75rem;
  vertical-align: middle;
}

.equipment-table th:nth-child(1),
.equipment-table td:nth-child(1) {
  width: 130px;
}

.equipment-table th:nth-child(2),
.equipment-table td:nth-child(2) {
  width: 175px;
}

.equipment-table th:nth-child(3),
.equipment-table td:nth-child(3) {
  width: 125px;
}

.equipment-table th:nth-child(4),
.equipment-table td:nth-child(4) {
  width: 150px;
}

.equipment-table th:nth-child(5),
.equipment-table td:nth-child(5),
.equipment-table th:nth-child(6),
.equipment-table td:nth-child(6),
.equipment-table th:nth-child(7),
.equipment-table td:nth-child(7) {
  width: 72px;
}

.equipment-table th:nth-child(8),
.equipment-table td:nth-child(8) {
  width: 135px;
}

.equipment-table th:nth-child(9),
.equipment-table td:nth-child(9) {
  width: 100px;
  text-align: center;
}

.equipment-table th:nth-child(10),
.equipment-table td:nth-child(10) {
  width: 170px;
}

.equipment-table th:nth-child(11),
.equipment-table td:nth-child(11) {
  width: 130px;
}

.equipment-table input[type='text'],
.equipment-table input[type='number'],
.equipment-table select {
  min-width: 0;
}

.equipment-table input[type='number'] {
  text-align: right;
}

.equipment-issue-table {
  min-width: 1040px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.35rem;
}

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

.issue-page {
  max-width: 1200px;
}

.issue-form {
  background: #ffffff;
  border: 2px solid #111111;
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
}

.issue-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.issue-actions .status {
  margin: 0;
}

.issue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.issue-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.issue-flag {
  width: 36px;
  height: 24px;
  border: 1px solid #111111;
  position: relative;
}

.issue-flag::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 30%;
  background: #111111;
}

.issue-brand-text {
  display: grid;
  gap: 0.15rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.issue-header-meta {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.issue-title {
  margin: 0;
  text-align: center;
  font-size: 1.1rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.issue-title span {
  display: inline-block;
  font-weight: 500;
}

.issue-field-table,
.issue-items,
.issue-ack {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
}

.issue-field-table td,
.issue-items th,
.issue-items td,
.issue-ack th,
.issue-ack td {
  border: 1px solid #111111;
  padding: 0.4rem 0.5rem;
  vertical-align: top;
}

.issue-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.issue-form input {
  border: 0;
  border-bottom: 1px solid #111111;
  border-radius: 0;
  padding: 0.1rem 0;
  min-height: 26px;
  font-size: 0.95rem;
  background: transparent;
}

.issue-form select {
  border: 0;
  border-bottom: 1px solid #111111;
  border-radius: 0;
  padding: 0.1rem 0;
  min-height: 26px;
  font-size: 0.95rem;
  background: transparent;
}

.issue-select {
  width: 100%;
}

.issue-form select:disabled {
  color: #6b7280;
}

.issue-form input[type='radio'] {
  border: none;
  border-bottom: 0;
  min-height: auto;
  padding: 0;
}

.issue-input {
  width: 100%;
}

.issue-items {
  min-width: 980px;
}

.issue-items th {
  text-align: center;
  font-size: 0.8rem;
}

.issue-items th span {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.issue-items td {
  height: 28px;
}

.issue-qty-cell {
  text-align: center;
}

.issue-qty-cell input[type='radio'] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.issue-items td:first-child,
.issue-items td:nth-child(2) {
  text-align: left;
}

.issue-qty-header th {
  font-size: 0.75rem;
}

.issue-note {
  font-size: 0.8rem;
  line-height: 1.3;
  margin: 0;
}

.issue-ack-title {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.issue-ack-title span {
  display: inline-block;
  font-weight: 500;
}

.issue-ack th {
  font-size: 0.7rem;
  text-transform: uppercase;
}

.issue-ack td {
  height: 26px;
}

.issue-footnotes {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  gap: 1rem;
  flex-wrap: wrap;
}

.roster-table {
  min-width: 0;
}

th,
td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.link-row {
  cursor: pointer;
}

.link-row:hover,
.link-row:focus-visible {
  background: #eef2ff;
}

td input[type='checkbox'] {
  width: 22px;
  height: 22px;
  margin: 0;
}

.uniform-score {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(48px, auto) auto;
  align-items: center;
  gap: 0.65rem;
  width: min(100%, 520px);
  padding: 0.15rem 0;
  background: transparent;
}

.uniform-slider-wrap {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.uniform-range-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.uniform-slider {
  width: 100%;
  min-width: 220px;
  accent-color: var(--accent);
}

.uniform-score-value {
  min-width: 42px;
  text-align: center;
  font-weight: 700;
  color: var(--text);
}

.uniform-clear {
  min-height: 32px;
  padding: 0.25rem 0.5rem;
  border-radius: 0.4rem;
  font-size: 0.85rem;
}

.uniform-last-score {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

@media (max-width: 900px) {
  .nav-inner,
  .app-shell {
    max-width: 100%;
  }

  .nav-inner {
    align-items: flex-start;
  }

  .nav-links {
    width: 100%;
    gap: 0.45rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
  }

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

  .attendance-active-bar {
    position: sticky;
    top: 0;
    z-index: 6;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
  }

  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-tile-primary {
    grid-column: 1 / -1;
  }

  .dashboard-panels {
    grid-template-columns: 1fr 1fr;
  }

  .tutorial-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .tutorial-progress-card {
    min-width: 0;
  }

  table {
    min-width: 620px;
  }

  .issue-page {
    padding-inline: 0.75rem;
  }

  .issue-form {
    padding: 1rem;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .app-shell {
    padding: 0.75rem;
    gap: 0.75rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .card {
    padding: 0.85rem;
    border-radius: 0.6rem;
  }

  .nav-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 0.7rem 0.75rem;
  }

  .nav-brand-group {
    width: 100%;
    align-items: stretch;
  }

  .nav-brand-group .pwa-update-button {
    width: 100%;
  }

  .nav-unit,
  .nav-language {
    width: 100%;
    align-items: stretch;
  }

  .nav-unit select,
  .nav-language select {
    width: 100%;
    min-width: 0;
  }

  .nav-links {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.4rem;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
  }

  .nav-links a,
  .nav-links button {
    flex: 0 0 auto;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--border);
    background: #f8fafc;
  }

  .landing-hero {
    padding-top: 0.5rem;
  }

  .landing-links .link-grid {
    grid-template-columns: 1fr;
  }

  .roster-header {
    align-items: stretch;
  }

  .roster-search {
    max-width: none;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: start;
    padding-top: 0.5rem;
  }

  .dashboard-date {
    justify-items: start;
  }

  .dashboard-grid,
  .dashboard-panels {
    grid-template-columns: 1fr;
  }

  .dashboard-tile-primary {
    grid-column: auto;
  }

  .dashboard-tile {
    min-height: 148px;
    padding: 0.9rem;
  }

  .dashboard-action-list a {
    min-height: 48px;
  }

  .tutorial-role-tabs {
    width: 100%;
  }

  .tutorial-filter-row {
    align-items: stretch;
  }

  .tutorial-search {
    flex-basis: 100%;
    max-width: none;
  }

  .tutorial-actions {
    width: 100%;
  }

  .tutorial-actions button {
    flex: 1 1 120px;
  }

  .tutorial-lesson summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.45rem;
  }

  .tutorial-lesson-actions {
    align-items: stretch;
  }

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

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

  .field-grid {
    grid-template-columns: 1fr;
  }

  .field-right {
    justify-items: start;
    text-align: left;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions button {
    width: 100%;
    white-space: normal;
  }

  .summary.card > summary {
    font-size: 1.05rem;
  }

  .table-wrap:not(.issue-table-wrap),
  .roster-wrap {
    overflow-x: visible;
  }

  .responsive-table thead,
  .roster-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td,
  .roster-table,
  .roster-table tbody,
  .roster-table tr,
  .roster-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .responsive-table tr,
  .roster-table tr {
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    padding: 0.65rem;
    margin-bottom: 0.75rem;
    background: #fff;
  }

  .responsive-table td,
  .roster-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border-bottom: 1px dashed var(--border);
    text-align: right;
    overflow-wrap: anywhere;
  }

  .responsive-table td:last-child,
  .roster-table td:last-child {
    border-bottom: none;
  }

  .responsive-table td::before,
  .roster-table td::before {
    content: attr(data-label);
    flex: 0 0 min(42%, 12rem);
    font-weight: 600;
    color: var(--muted);
    padding-right: 0.75rem;
    text-align: left;
  }

  .responsive-table td[colspan]::before,
  .responsive-table td:not([data-label])::before {
    display: none;
  }

  .responsive-table td:has(input, select, button, .actions) {
    align-items: flex-start;
  }

  .responsive-table td > input:not([type='checkbox']):not([type='radio']),
  .responsive-table td > select {
    width: min(100%, 220px);
  }

  .responsive-table td > .actions {
    margin-top: 0;
    justify-content: flex-end;
  }

  .responsive-table td > .actions button {
    width: auto;
  }

  .equipment-table,
  .equipment-issue-table {
    min-width: 0;
  }

  .equipment-table tr,
  .equipment-issue-table tr {
    padding: 0.85rem;
  }

  .equipment-table td,
  .equipment-issue-table td {
    align-items: stretch;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.6rem 0;
    text-align: left;
  }

  .responsive-table.equipment-table td,
  .responsive-table.equipment-issue-table td {
    width: 100%;
  }

  .equipment-table td::before,
  .equipment-issue-table td::before {
    flex: none;
    padding-right: 0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .equipment-table td > input:not([type='checkbox']):not([type='radio']),
  .equipment-table td > select,
  .equipment-issue-table td > input:not([type='checkbox']):not([type='radio']),
  .equipment-issue-table td > select {
    width: 100%;
  }

  .equipment-table td > .actions,
  .equipment-issue-table td > .actions {
    width: 100%;
    justify-content: stretch;
  }

  .equipment-table td > .actions button,
  .equipment-issue-table td > .actions button {
    flex: 1 1 120px;
    width: auto;
  }

  .equipment-table td > .actions {
    flex-direction: row;
  }

  .equipment-table td > .actions button {
    flex: 1 1 0;
    min-height: 44px;
  }

  .roster-table td[data-label="Uniform Score"] .uniform-score {
    justify-content: flex-start;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }

  .roster-table td[data-label="Present"] {
    align-items: center;
  }

  .roster-table td[data-label="Uniform Score"] {
    align-items: stretch;
    flex-direction: column;
    text-align: left;
  }

  .roster-table td[data-label="Uniform Score"]::before {
    flex: none;
    padding-right: 0;
  }

  .roster-table td[data-label="Uniform Score"] .uniform-slider-wrap {
    grid-column: 1 / -1;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .roster-table td[data-label="Uniform Score"] .uniform-slider {
    min-width: 0;
  }

  .present-toggle {
    min-height: 48px;
    padding: 0.45rem 0.65rem;
  }

  .issue-form {
    padding: 1rem;
  }

  .issue-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .issue-title {
    text-align: left;
  }

  .issue-items {
    min-width: 720px;
  }
}

@media print {
  @page {
    size: letter;
    margin: 0.35in;
  }

  body {
    background: #ffffff;
  }

  body,
  .issue-form {
    font-size: 10px;
    line-height: 1.12;
  }

  .top-nav,
  .issue-actions {
    display: none;
  }

  .app-shell {
    max-width: none;
    padding: 0;
  }

  .issue-form {
    border: 2px solid #111111;
    box-shadow: none;
    display: block;
    padding: 0.4rem;
    gap: 0;
  }

  .table-wrap {
    overflow: visible;
  }

  .issue-items {
    min-width: 0;
    break-inside: auto;
    page-break-inside: auto;
  }

  .issue-form > * {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .issue-items tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .issue-title {
    font-size: 0.9rem;
  }

  .issue-header-meta {
    font-size: 0.65rem;
  }

  .issue-field-table td,
  .issue-items th,
  .issue-items td,
  .issue-ack th,
  .issue-ack td {
    padding: 0.18rem 0.28rem;
  }

  .issue-label {
    font-size: 0.6rem;
    margin-bottom: 0.2rem;
  }

  .issue-form input,
  .issue-form select {
    min-height: 18px;
    font-size: 0.8rem;
  }

  .issue-items {
    font-size: 0.78rem;
  }

  .issue-items td {
    height: 20px;
  }

  .issue-ack td {
    height: 20px;
  }

  .issue-note {
    font-size: 0.68rem;
  }

  .issue-ack-title {
    font-size: 0.68rem;
  }

  .issue-footnotes {
    font-size: 0.6rem;
  }
}
