/* Banekontrol – Forslag 5 "Liste-først i TestLab-stil". Farver/mål fra tokens.css. */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #DCDDE2;
  color: var(--tl-ink);
  font-family: var(--tl-font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--tl-navy); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--tl-mono); text-transform: uppercase; letter-spacing: var(--tl-mono-tracking); }

.app {
  height: 100vh; height: 100dvh;
  max-width: 430px; margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--tl-bg);
  overflow: hidden;
}

/* 1 · Topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 0; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 30px; height: 32px; flex: none; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 17px; font-weight: 500; line-height: 1.1; white-space: nowrap; }
.brand-sub { font-size: 10px; color: var(--tl-text-3); }
.conn { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 18px;
  background: var(--tl-surface); flex: none; }
.conn .mono { font-size: 10px; color: var(--tl-text-2); white-space: nowrap; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 4px; background: #9A9EA8; }
.pulse { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .2; } }

/* 2 · Overskrift */
.heading { padding: 14px 16px 0; display: flex; flex-direction: column; gap: 4px; }
.kicker { font-size: 10px; color: var(--tl-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h1 { margin: 0; font-size: 38px; line-height: 1.05; font-weight: 400; letter-spacing: -.02em; }

/* 3 · Søg */
.search-wrap { padding: 12px 16px 0; }
.search { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 18px;
  background: var(--tl-surface); border-radius: var(--tl-r-pill); color: var(--tl-text-3); }
.search:focus-within { box-shadow: 0 0 0 2px var(--tl-navy); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 17px; color: var(--tl-ink); }
.search input::placeholder { color: #6A6E79; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* 4 · Holdfilter */
.chips { display: flex; align-items: center; gap: 8px; padding: 10px 16px; overflow-x: auto; scrollbar-width: none; flex: none; }
.chips::-webkit-scrollbar { display: none; }
.chips .mono { flex: none; font-size: 10px; color: var(--tl-text-3); padding: 0 4px; }
.chip { flex: none; height: var(--tl-touch-min); padding: 0 18px; border-radius: 22px;
  border: 1px solid var(--tl-border); background: var(--tl-surface); color: var(--tl-ink); font-size: 16px; }
.chip[aria-pressed="true"] { background: var(--tl-ink); border-color: var(--tl-ink); color: #fff; }

/* 5 · Atletliste */
.list { flex: 1; min-height: 0; margin: 0 12px; border-radius: var(--tl-r-card); background: var(--tl-surface);
  overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
.sect { padding: 16px 20px 6px; font-size: 10px; color: var(--tl-text-3); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; height: var(--tl-row-h); padding: 0 16px;
  border: 0; border-radius: var(--tl-r-row); background: transparent; text-align: left; }
.row[aria-pressed="true"] { background: var(--tl-periwinkle); }
.row:disabled { opacity: 1; }
.row:disabled:not([aria-pressed="true"]) .row-name { color: var(--tl-text-4); }
.init { flex: none; width: 40px; height: 40px; border-radius: 20px; border: 1.5px dashed var(--tl-ring);
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; color: var(--tl-ink); }
.row[aria-pressed="true"] .init { border-style: solid; border-color: var(--tl-navy); background: var(--tl-navy); color: #fff; }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-name { font-size: 18px; color: var(--tl-navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-team { font-size: 10px; color: var(--tl-text-4); }
.badge { flex: none; height: 26px; display: flex; align-items: center; padding: 0 10px; border-radius: 13px;
  background: var(--tl-ink); color: var(--tl-lime); font-size: 10px; }
.empty { margin: 0; padding: 32px 20px; text-align: center; color: var(--tl-text-3); font-size: 16px; line-height: 1.4; }

/* 6 · Bundpanel */
.panel { margin-top: 10px; background: var(--tl-surface); border-radius: var(--tl-r-panel) var(--tl-r-panel) 0 0;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; flex: none; }
.segrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.seggroup { display: flex; flex-direction: column; gap: 6px; }
.seglabel { font-size: 10px; color: var(--tl-text-3); padding-left: 6px; }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; padding: 3px;
  border-radius: 26px; background: var(--tl-track); }
.seg button { height: var(--tl-segment-h); border-radius: 23px; border: 0; background: transparent;
  color: var(--tl-text-2); font-size: 16px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--tl-ink); color: #fff; }
.seg button:disabled:not([aria-pressed="true"]) { color: var(--tl-text-4); }

.status { display: flex; align-items: center; gap: 10px; min-height: 22px; padding: 0 6px; }
.status[hidden] { display: none; }
.st-txt { flex: 1; min-width: 0; font-size: 11px; color: var(--tl-text-2); letter-spacing: .1em; line-height: 1.35; }
.st-timer { font-size: 13px; font-weight: 500; letter-spacing: .06em; }
.status.big .st-timer { font-size: 22px; }

.errcard { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 22px;
  background: var(--tl-error-bg); color: var(--tl-error-fg); }
.errcard[hidden] { display: none; }
.err-body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.err-body .mono { font-size: 10px; }
.err-body span:last-child { font-size: 14px; line-height: 1.35; }
.err-cancel { flex: none; height: var(--tl-touch-min); padding: 0 16px; border-radius: 22px;
  border: 1px solid rgba(110, 31, 16, .35); background: transparent; color: var(--tl-error-fg); font-size: 15px; }

.cta { height: var(--tl-cta-h); border-radius: 34px; border: 0; display: flex; align-items: center; justify-content: center;
  gap: 12px; font-size: 26px; font-weight: 500; letter-spacing: -.01em;
  background: var(--tl-ink); color: var(--tl-lime); transition: transform .08s ease; }
.cta:active:not(:disabled) { transform: scale(.985); }
.cta .cta-arrow { display: none; }
.cta.is-ready .cta-arrow { display: block; }
.cta.is-off { background: var(--tl-disabled); color: var(--tl-text-4); }
.cta.is-abort { background: var(--tl-periwinkle); color: var(--tl-navy); }
.cta.is-abort-armed { background: var(--tl-navy); color: #fff; font-size: 21px; }
.cta.is-saved { background: var(--tl-lime); color: var(--tl-ink); }

/* Adgang mangler */
.gate { position: fixed; inset: 0; background: var(--tl-bg); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; padding: 32px; text-align: center; }
.gate[hidden] { display: none; }
.gate h2 { margin: 8px 0 0; font-weight: 400; font-size: 28px; letter-spacing: -.01em; }
.gate p { margin: 0; color: var(--tl-text-2); max-width: 30ch; line-height: 1.45; }

@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
  .cta { transition: none; }
}
@media (max-width: 374px) {
  .conn { padding: 0 11px; gap: 7px; }
  .conn .mono { letter-spacing: .08em; }
  .brand { gap: 8px; }
}
@media (max-height: 700px) {
  h1 { font-size: 32px; }
  .heading { padding-top: 10px; }
}
