    :root{--bg:#f5f7f8;--card:#fff;--ink:#18211f;--muted:#64706d;--line:#dce4e1;--brand:#0d6b55;--brand2:#0a5846;--soft:#e7f4ef;--warn:#8b5d00;--danger:#a72d2d;--shadow:0 6px 22px rgba(0,0,0,.06)}
    *{box-sizing:border-box} body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;background:var(--bg);color:var(--ink)}
    header{position:sticky;top:0;z-index:20;background:rgba(255,255,255,.94);backdrop-filter:blur(10px);border-bottom:1px solid var(--line)}
    .head{max-width:1100px;margin:auto;padding:13px 16px;display:flex;align-items:center;justify-content:space-between;gap:12px}
    .brand{display:flex;align-items:center;gap:10px;font-weight:800}.logo{width:38px;height:38px;border-radius:11px;background:var(--brand);color:#fff;display:grid;place-items:center;font-size:14px;box-shadow:var(--shadow)}
    .sub{font-size:12px;color:var(--muted);font-weight:600}
    nav{max-width:1100px;margin:auto;display:flex;overflow:auto;padding:0 8px 8px;gap:6px}.tab{white-space:nowrap;border:0;background:transparent;border-radius:9px;padding:9px 12px;font-weight:700;color:var(--muted)}.tab.active{background:var(--soft);color:var(--brand)}
    main{max-width:1100px;margin:0 auto;padding:18px 14px 70px}.view{display:none}.view.active{display:block}
    h1{font-size:26px;margin:0 0 6px}h2{font-size:18px;margin:0 0 12px}h3{font-size:15px;margin:0 0 8px}.lead{margin:0 0 18px;color:var(--muted)}
    .grid{display:grid;gap:12px}.grid.cards{grid-template-columns:repeat(4,minmax(0,1fr))}.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}.grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}
    .card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:16px;box-shadow:var(--shadow)}.kpi .n{font-size:29px;font-weight:850}.kpi .l{font-size:12px;color:var(--muted);font-weight:700}.kpi .d{font-size:12px;color:var(--brand);margin-top:4px}
    button,.btn{border:0;border-radius:11px;padding:11px 14px;font-weight:800;cursor:pointer}.primary{background:var(--brand);color:#fff}.primary:hover{background:var(--brand2)}.secondary{background:#eef2f1;color:#24302d}.danger{background:#fbecec;color:var(--danger)}.small{padding:7px 10px;font-size:12px}.wide{width:100%}
    label{font-size:12px;font-weight:800;color:#4f5b58;display:block;margin-bottom:5px}input,select,textarea{width:100%;border:1px solid #cfd9d6;border-radius:10px;background:#fff;padding:10px 11px;font:inherit;color:inherit}input:focus,select:focus,textarea:focus{outline:2px solid #b8dfd2;border-color:var(--brand)}
    .formrow{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}.mt{margin-top:12px}.mb{margin-bottom:12px}
    .players{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.playercheck{display:flex;gap:10px;align-items:center;border:1px solid var(--line);background:#fff;border-radius:12px;padding:10px;cursor:pointer}.playercheck input{width:auto}.playercheck strong{display:block}.meta{font-size:11px;color:var(--muted)}.chip{display:inline-flex;align-items:center;border-radius:999px;padding:3px 7px;font-size:10px;font-weight:800;background:#edf2f0;color:#4d5c58}.chip.bp1{background:#e7f0ff;color:#245591}.chip.bp2{background:#f4ecff;color:#6b3b91}.chip.subs{background:#fff1dc;color:#8a5a00}
    .round{margin-top:16px}.roundtitle{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:8px}.courts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.court{background:#fff;border:1px solid var(--line);border-radius:14px;overflow:hidden}.courthead{background:#eef4f2;padding:9px 11px;font-size:12px;font-weight:850;display:flex;justify-content:space-between}.match{padding:12px}.pair{display:grid;grid-template-columns:1fr 1fr;gap:6px}.p{border-radius:9px;background:#f7f9f9;padding:8px;font-size:13px}.side{font-size:9px;text-transform:uppercase;color:var(--muted);font-weight:800}.vs{text-align:center;font-size:11px;color:var(--muted);font-weight:900;padding:6px}.scoreline{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:10px}.scoreline input{width:66px;text-align:center;font-weight:800}.scoreline span{font-weight:900;color:var(--muted)}.court.missing-result{outline:3px solid #d98b00;outline-offset:2px}.court.missing-result .courthead{background:#fff2cf}
    .quality{font-size:10px;color:var(--muted);margin-top:8px;text-align:center}.good{color:var(--brand);font-weight:800}.bad{color:var(--warn);font-weight:800}.p.swapplayer{cursor:pointer;border:2px solid transparent;transition:.15s}.p.swapplayer:hover{border-color:#b8dfd2}.p.swapplayer.swapselected{border-color:var(--brand);background:var(--soft)}.lockrow{display:grid;grid-template-columns:1fr 1fr 160px auto;gap:8px;align-items:end}.siderow{display:grid;grid-template-columns:1fr 180px auto;gap:8px;align-items:end}.lockitem{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:8px 10px;border:1px solid var(--line);border-radius:10px;background:#fafcfc;margin-top:6px}.scroll{overflow:auto}.matrix th,.matrix td{text-align:center;min-width:42px;padding:6px}.matrix th:first-child,.matrix td:first-child{position:sticky;left:0;background:#fff;text-align:left;min-width:130px;z-index:1}.matrix .self{background:#f0f3f2;color:#98a29f}.generator-note{font-size:11px;color:var(--muted);margin-top:8px}
    table{width:100%;border-collapse:collapse;font-size:13px}th,td{text-align:left;padding:9px 8px;border-bottom:1px solid #e8eeec}th{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.03em}.num{text-align:right}.rank{font-weight:900;color:var(--brand)}
    .notice{background:#fff7e8;border:1px solid #f2dfb6;color:#6e4a00;border-radius:12px;padding:11px 12px;font-size:12px}.oknotice{background:#edf8f3;border:1px solid #cbe9dd;color:#185a47;border-radius:12px;padding:11px 12px;font-size:12px}
    .history-item{display:flex;justify-content:space-between;gap:12px;align-items:center;border-bottom:1px solid var(--line);padding:11px 0}.history-item:last-child{border:0}.muted{color:var(--muted)}.tiny{font-size:11px}.hidden{display:none!important}
    .info-btn{display:inline-grid;place-items:center;width:22px;height:22px;min-width:22px;padding:0;border-radius:999px;background:#edf3f1;color:var(--brand);font-size:12px;font-weight:900;vertical-align:middle}.info-btn:hover{background:var(--soft)}.info-heading{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.info-heading h2{margin-bottom:0}.info-dialog-body{font-size:13px;line-height:1.55;color:#34413e}.info-dialog-body h3{margin-top:14px}.info-dialog-body ul{padding-left:19px}.info-dialog-body li{margin:6px 0}.count-mode-wrap{display:inline-flex;align-items:center;justify-content:center;gap:5px;flex-wrap:wrap}.count-mode-wrap select{width:auto;min-width:112px;padding:5px 24px 5px 7px;border-radius:8px;font-size:10px;font-weight:800}.count-mode-normal{color:#185a47}.count-mode-history{color:#8a5a00}.count-mode-ignore{color:#8a2a2a}
    dialog{border:0;border-radius:16px;box-shadow:0 20px 70px rgba(0,0,0,.23);width:min(94vw,520px)}dialog::backdrop{background:rgba(15,25,22,.35)}
    .player-mobile-meta{display:none}.partner-toolbar{display:flex;gap:10px;align-items:end;justify-content:space-between;flex-wrap:wrap;margin-bottom:10px}.partner-toolbar>div{min-width:180px}.status-pill{display:inline-flex;align-items:center;border-radius:999px;padding:3px 8px;font-size:10px;font-weight:850;white-space:nowrap}.status-planned{background:#fff2dc;color:#8a5a00}.status-completed{background:#dff4e9;color:#126044}button:disabled{opacity:.45;cursor:not-allowed}.status-strong-up{background:#dff4e9;color:#126044}.status-up{background:#eaf6ef;color:#267154}.status-neutral{background:#eef2f1;color:#55625f}.status-down{background:#fff2dc;color:#8a5a00}.status-strong-down{background:#fbe7e7;color:#9d2a2a}.status-low{background:#f2f3f3;color:#7b8582}
    .pwa-update-banner{position:fixed;top:max(12px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));z-index:90;width:min(390px,calc(100vw - 24px));display:flex;align-items:center;justify-content:space-between;gap:14px;padding:13px 14px;border:1px solid rgba(13,107,85,.22);border-radius:16px;background:rgba(255,255,255,.98);box-shadow:0 16px 50px rgba(5,35,27,.18)}.pwa-update-banner[hidden]{display:none}.pwa-update-banner strong,.pwa-update-banner span{display:block}.pwa-update-banner strong{font-size:14px}.pwa-update-banner span{margin-top:2px;color:var(--muted);font-size:11px;line-height:1.35}.pwa-update-actions{display:flex;flex:0 0 auto;gap:7px}
    .double-team{border:1px solid var(--line);border-radius:14px;padding:12px;margin-top:9px;background:#fbfdfc}.double-team:first-child{margin-top:0}.double-rank{display:flex;align-items:center;justify-content:space-between;gap:10px}.double-rank strong{font-size:15px}.double-score{font-size:12px;font-weight:850;color:var(--brand)}.double-pair{font-size:16px;font-weight:850;margin-top:5px}.double-reason{font-size:11px;color:var(--muted);margin-top:4px;line-height:1.45}.doublebadge{display:inline-flex;padding:3px 7px;border-radius:999px;background:var(--soft);color:var(--brand);font-size:10px;font-weight:850}.double-warn{background:#fff4e3;color:#845500}.double-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:10px}.double-summary>div{border-radius:10px;background:#f6f9f8;padding:9px;text-align:center}.double-summary b{display:block;font-size:14px}.double-summary span{font-size:10px;color:var(--muted)}.double-team-select{transition:.15s ease}.double-team-select.active{background:var(--brand);color:#fff;box-shadow:0 0 0 2px rgba(13,107,85,.16)}
    @media(max-width:800px){.grid.cards{grid-template-columns:repeat(2,1fr)}.grid.two,.grid.three,.formrow{grid-template-columns:1fr 1fr}.players{grid-template-columns:1fr 1fr}.courts{grid-template-columns:1fr}.head{padding-top:max(10px,env(safe-area-inset-top))}}
    .side-summary{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:9px}.side-summary .pill{display:inline-flex;align-items:center;gap:5px;padding:6px 9px;border:1px solid var(--line);border-radius:999px;background:#f8fbfa;font-size:12px;font-weight:800}.side-summary .status{font-size:12px;font-weight:800}.side-summary .status.ok{color:var(--brand)}.side-summary .status.warn{color:var(--warn)}
    .round-viewbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 12px;border:1px solid var(--line);border-radius:13px;background:#fff;box-shadow:var(--shadow);margin-bottom:10px;position:sticky;top:110px;z-index:8}.round-viewbar .round-view-label{font-size:11px;font-weight:850;color:var(--muted);margin-right:2px}.round-toggle{display:inline-flex;align-items:center;gap:5px;padding:6px 9px;border:1px solid var(--line);border-radius:999px;background:#f8fbfa;font-size:11px;font-weight:850;cursor:pointer}.round-toggle input{width:auto;margin:0}.round-toggle.locked{background:#fff4df;border-color:#efd39d;color:#7a5200}.round-lock-btn{padding:6px 9px;font-size:11px}.roundtitle{gap:10px}.roundtitle-main{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.roundtitle-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}.round-lock-state{display:inline-flex;align-items:center;border-radius:999px;padding:4px 7px;font-size:10px;font-weight:850;background:#edf3f1;color:var(--muted)}.round-lock-state.is-locked{background:#fff0cf;color:#805500}.round-warning{margin:7px 0 9px;border-radius:10px;padding:8px 10px;font-size:11px;line-height:1.4}.round-warning.hard{background:#fbeaea;border:1px solid #efc5c5;color:#8e2525}.round-warning.soft{background:#fff5e4;border:1px solid #f0ddb6;color:#765000}.pair-insight{margin-top:6px;padding:6px 8px;border-radius:9px;background:#f7faf9;border:1px solid #e5ece9;font-size:10px;color:var(--muted);display:flex;align-items:center;gap:5px;flex-wrap:wrap}.pair-insight .newpair{color:var(--brand);font-weight:850}.pair-insight .repeatpair{color:#8a5a00;font-weight:850}.pair-insight .info-btn{width:18px;height:18px;min-width:18px;font-size:10px}.court.round-locked .p.swapplayer{cursor:default}.court.round-locked .p.swapplayer:hover{border-color:transparent}.round-empty{padding:18px;text-align:center;color:var(--muted);border:1px dashed var(--line);border-radius:13px;background:#fff}.round-help{font-size:10px;color:var(--muted);margin-left:auto}.round-lock-note{font-size:10px;color:var(--muted);margin-top:5px}.round-hidden{display:none!important}
    @media(max-width:520px){h1{font-size:22px}.grid.two,.grid.three,.formrow,.lockrow,.siderow{grid-template-columns:1fr}.focusrow>div{grid-column:span 1!important}.players{grid-template-columns:1fr}.card{padding:13px}.head .sub{display:none}
      .player-admin-table thead{display:none}.player-admin-table tbody,.player-admin-table tr{display:block;width:100%}.player-admin-table tr{position:relative;padding:12px 88px 12px 0;border-bottom:1px solid #e8eeec;min-height:64px}.player-admin-table tr:last-child{border-bottom:0}.player-admin-table td{display:none;border:0;padding:0}.player-admin-table td:first-child{display:block;min-width:0}.player-admin-table td:last-child{display:block;position:absolute;right:0;top:50%;transform:translateY(-50%)}.player-admin-table td:last-child button{white-space:nowrap}.player-mobile-meta{display:block;margin-top:5px;font-size:11px;color:var(--muted);line-height:1.45}
      .partner-toolbar{align-items:stretch}.partner-toolbar>div{width:100%;min-width:0}.courts{grid-template-columns:1fr}.round-viewbar{top:108px;gap:6px}.round-toggle{padding:6px 8px}.roundtitle{align-items:flex-start}.roundtitle-actions{justify-content:flex-start}.round-help{width:100%;margin-left:0}
    }

/* --------------------------------------------------------------------------
   v34 designsystem
   Det eksisterende klasselag ovenfor er beholdt som en kompatibilitetsbase for
   de uændrede render-funktioner. Dette lag ejer kun præsentation og responsivitet.
   -------------------------------------------------------------------------- */

:root {
  --bg: #f3f6f5;
  --card: #ffffff;
  --ink: #10231e;
  --muted: #687a74;
  --line: #dce6e2;
  --line-strong: #cbd9d4;
  --brand: #08755a;
  --brand2: #055a46;
  --brand-dark: #063c31;
  --soft: #e7f4ef;
  --soft-strong: #d4ebe2;
  --warn: #8b5d00;
  --danger: #a02c32;
  --success: #08755a;
  --shadow: 0 2px 3px rgba(7, 42, 33, .03), 0 12px 32px rgba(7, 42, 33, .06);
  --shadow-raised: 0 18px 50px rgba(7, 42, 33, .14);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --tap: 48px;
}

html {
  min-width: 0;
  background: var(--bg);
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  overflow-x: clip;
  background:
    radial-gradient(circle at 5% -10%, rgba(8, 117, 90, .08), transparent 28rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button,
.btn {
  min-height: 44px;
  border-radius: 12px;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

button:active,
.btn:active {
  transform: scale(.98);
}

button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(8, 117, 90, .28);
  outline-offset: 2px;
}

button:disabled {
  opacity: .48;
  transform: none;
}

.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 22px rgba(8, 117, 90, .16);
}

.primary:hover {
  background: var(--brand2);
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary:hover {
  border-color: var(--line-strong);
  background: #f8fbfa;
}

.danger {
  border: 1px solid #efd0d2;
  background: #fff1f1;
  color: var(--danger);
}

.danger.solid {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.small {
  min-height: 36px;
}

.text-button {
  min-height: 36px;
  padding: 6px 4px;
  background: transparent;
  color: var(--brand);
  font-size: 13px;
}

.icon-action {
  min-width: 44px;
  padding-inline: 11px;
}

input,
select,
textarea {
  min-height: var(--tap);
  border-color: var(--line-strong);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aebfb9;
}

label {
  margin-bottom: 7px;
  color: #52655f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1 {
  margin-bottom: 5px;
  font-size: clamp(25px, 5vw, 34px);
  line-height: 1.12;
  letter-spacing: -.035em;
}

h2 {
  font-size: 18px;
  letter-spacing: -.02em;
}

.lead {
  max-width: 720px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.tiny,
.generator-note {
  line-height: 1.5;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(203, 217, 212, .75);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(18px) saturate(150%);
}

.head {
  max-width: 1180px;
  min-height: 68px;
  padding: 12px 20px;
}

.brand {
  min-width: 0;
  gap: 11px;
}

.brand-name {
  display: block;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: -.015em;
}

.logo {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 13px;
  background: linear-gradient(145deg, #0a8567, #07513f);
  box-shadow: 0 8px 24px rgba(8, 117, 90, .2), inset 0 1px rgba(255,255,255,.25);
  font-size: 13px;
  letter-spacing: -.04em;
}

.sub {
  margin-top: 1px;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(8, 117, 90, .1);
}

.app-nav {
  position: relative;
  z-index: 31;
  max-width: 720px;
  margin: 8px auto 0;
  padding: 0 8px;
  justify-content: center;
  gap: 5px;
  overflow: visible;
}

.tab {
  min-width: 96px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.tab.active {
  background: var(--soft);
  color: var(--brand-dark);
  box-shadow: inset 0 0 0 1px rgba(8, 117, 90, .08);
}

.nav-icon {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
}

.nav-icon svg,
.dialog-icon svg,
.recent-state svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

main {
  width: 100%;
  max-width: 1180px;
  min-width: 0;
  padding: 34px 22px 90px;
}

.view {
  min-width: 0;
  animation: view-in 180ms ease both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.view-eyebrow,
.home-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--brand);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.card {
  min-width: 0;
  border: 1px solid rgba(203, 217, 212, .8);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.grid {
  min-width: 0;
  gap: 14px;
}

.home-hero {
  position: relative;
  isolation: isolate;
  min-height: 285px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  overflow: hidden;
  border-radius: 30px;
  padding: clamp(26px, 6vw, 48px);
  background:
    radial-gradient(circle at 88% 10%, rgba(88, 220, 169, .25), transparent 36%),
    linear-gradient(135deg, #07513f 0%, #06362d 100%);
  color: #fff;
  box-shadow: 0 25px 60px rgba(6, 60, 49, .18);
}

.home-hero::before,
.home-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%;
}

.home-hero::before {
  width: 310px;
  height: 310px;
  top: -165px;
  right: -55px;
}

.home-hero::after {
  width: 190px;
  height: 190px;
  top: -105px;
  right: 5px;
}

.home-hero .home-kicker {
  color: #9ee6cb;
}

.home-hero h1 {
  max-width: 650px;
  margin: 0 0 8px;
  color: #fff;
  font-size: clamp(30px, 7vw, 52px);
  letter-spacing: -.055em;
}

.home-hero p {
  margin: 0 0 24px;
  color: rgba(255,255,255,.7);
  font-size: 14px;
}

.home-primary {
  width: min(100%, 330px);
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 14px 32px rgba(0,0,0,.16);
}

.first-run-actions {
  width: min(100%, 680px);
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.first-run-actions .home-primary,
.home-secondary {
  min-height: 54px;
}

.first-run-actions .home-primary {
  flex: 1 1 330px;
}

.home-secondary {
  flex: 1 1 190px;
  border: 1px solid rgba(255,255,255,.3);
  padding: 0 18px;
  background: rgba(255,255,255,.1);
  color: #fff;
}

.home-secondary:hover {
  background: rgba(255,255,255,.17);
}

.home-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 15px;
  margin: 30px 2px 13px;
}

.home-section-head h2 {
  margin: 0;
}

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

.metric-card {
  min-width: 0;
  min-height: 126px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(7,42,33,.035);
}

.metric-featured {
  border-color: #c6dfd5;
  background: linear-gradient(145deg, #fff, #eef8f4);
}

.metric-label {
  margin-bottom: auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.metric-card strong {
  overflow: hidden;
  font-size: 17px;
  letter-spacing: -.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value {
  margin-top: 3px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 750;
}

.recent-training {
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  border: 1px solid var(--line);
  padding: 13px 16px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.recent-state {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--brand);
  padding: 8px;
}

.recent-training b,
.recent-training small {
  display: block;
}

.recent-training small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 600;
}

.chevron {
  color: #8fa09a;
  font-size: 24px;
}

/* Træningsopsætning */

#training > .card {
  padding: 0;
  overflow: hidden;
}

.setup-block,
.setup-section {
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.setup-block:last-child,
.setup-section:last-child {
  border-bottom: 0;
}

.setup-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.setup-heading h2,
.section-heading h2 {
  margin: 0;
}

.setup-step {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
}

.players {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.playercheck {
  position: relative;
  min-width: 0;
  min-height: 66px;
  gap: 9px;
  border-color: var(--line);
  padding: 10px;
  box-shadow: none;
}

.playercheck:has(input:checked) {
  border-color: rgba(8, 117, 90, .55);
  background: var(--soft);
  box-shadow: inset 0 0 0 1px rgba(8, 117, 90, .12);
}

.playercheck input {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  accent-color: var(--brand);
}

.playercheck strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playercheck .meta {
  margin-top: 3px;
  line-height: 1.35;
}

.chip {
  padding: 4px 7px;
  letter-spacing: .02em;
}

.side-summary {
  gap: 7px;
  margin: 0 0 12px;
}

.side-summary .pill,
.side-summary .status {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 11px;
  background: #f6f9f8;
}

.side-summary .status.ok {
  background: var(--soft);
}

.side-summary .status.warn {
  background: #fff5e3;
}

.lockitem {
  min-height: 46px;
  margin-top: 8px;
  border-color: var(--line);
  border-radius: 13px;
  padding: 8px 11px;
  background: #f8fbfa;
}

#trainingFinishActions {
  position: sticky;
  bottom: 8px;
  z-index: 12;
  justify-content: flex-end;
  border: 1px solid rgba(203,217,212,.9);
  border-radius: 18px;
  padding: 10px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-raised);
  backdrop-filter: blur(14px);
}

#finishTrainingBtn {
  min-height: 50px;
  padding-inline: 22px;
}

/* Kampplan */

.round-viewbar {
  top: 78px;
  z-index: 15;
  min-height: 58px;
  gap: 8px;
  border-color: var(--line);
  border-radius: 17px;
  padding: 9px 12px;
  box-shadow: 0 9px 25px rgba(7,42,33,.08);
}

.round-toggle {
  min-height: 38px;
  border-radius: 999px;
  padding: 7px 11px;
  background: #f6f9f8;
  font-size: 12px;
}

.round-toggle:has(input:checked) {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--brand-dark);
}

.round-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.round {
  margin-top: 25px;
}

.roundtitle {
  align-items: center;
  margin: 0 2px 11px;
}

.roundtitle-main h2 {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.round-lock-state {
  min-height: 28px;
  padding: 5px 9px;
}

.round-lock-state.is-locked {
  background: #fff0cf;
}

.round-lock-btn {
  min-height: 38px;
  font-size: 11px;
}

.courts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.court {
  min-width: 0;
  overflow: hidden;
  border-color: var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.courthead {
  min-height: 43px;
  align-items: center;
  padding: 10px 14px;
  background: linear-gradient(90deg, #edf5f2, #f7faf9);
  color: var(--brand-dark);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.match {
  padding: 15px;
}

.pair {
  gap: 8px;
}

.p {
  min-width: 0;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px;
  background: #f6f9f8;
  font-size: 13px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.p .side,
.side {
  margin-top: 2px;
  color: #7d8d88;
  font-size: 9px;
  letter-spacing: .08em;
}

.vs {
  position: relative;
  padding: 9px;
  font-size: 9px;
  letter-spacing: .14em;
}

.scoreline {
  gap: 10px;
  margin-top: 13px;
}

.scoreline input {
  width: 76px;
  min-height: 52px;
  padding: 8px;
  border-radius: 13px;
  font-size: 21px;
  font-weight: 850;
}

.scoreline span {
  font-size: 18px;
}

.count-mode-wrap {
  width: 100%;
  margin-top: 11px;
}

.count-mode-wrap select {
  min-width: 140px;
  min-height: 38px;
  border-radius: 999px;
  padding: 6px 29px 6px 12px;
  font-size: 11px;
}

.pair-insight {
  min-height: 31px;
  margin-top: 8px;
  border-color: #e2ebe7;
  border-radius: 11px;
  padding: 6px 9px;
  background: #fbfcfc;
}

.quality {
  margin-top: 10px;
  line-height: 1.45;
}

.balance-meter,
.balance-split {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  margin: 9px 0 4px;
  background: #e9efed;
}

.balance-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0b8b6a, #5bc6a1);
}

.balance-split {
  height: auto;
  display: grid;
  grid-template-columns: auto minmax(50px, 1fr) auto;
  align-items: center;
  gap: 7px;
  margin: 10px 0 3px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.balance-split i {
  position: relative;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e4;
}

.balance-split i::before {
  content: "";
  display: block;
  width: var(--balance);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0b8b6a, #5bc6a1);
}

.court.missing-result {
  outline: 3px solid #d79216;
  outline-offset: 2px;
}

.court.missing-result .courthead {
  background: #fff2cf;
  color: #755000;
}

.round-warning,
.notice,
.oknotice {
  border-radius: 14px;
  padding: 12px 14px;
  line-height: 1.5;
}

.round-warning.hard {
  border-left: 4px solid #b8373d;
}

.round-warning.soft,
.notice {
  border-left: 4px solid #d18b10;
}

.oknotice {
  border-left: 4px solid var(--brand);
}

/* Spillere */

#players > .lead {
  max-width: 680px;
}

.roster-list {
  display: grid;
  gap: 2px;
}

.roster-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 13px;
  min-height: 76px;
  border-bottom: 1px solid #e8eeec;
  padding: 11px 2px;
}

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

.player-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .02em;
}

.roster-main {
  min-width: 0;
}

.roster-name,
.roster-meta,
.roster-note,
.roster-rating {
  display: block;
}

.roster-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 7px;
}

.roster-rating {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.roster-name {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-meta,
.roster-note {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.roster-rating {
  color: var(--brand-dark);
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}

/* Statistik */

.stats-segments,
.stats-tabs {
  position: sticky;
  top: 78px;
  z-index: 14;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 4px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 8px 22px rgba(7,42,33,.06);
  backdrop-filter: blur(14px);
}

.stats-segment,
.stats-tabs [data-stats-tab] {
  min-height: 40px;
  border-radius: 11px;
  padding: 7px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.stats-segment.active,
.stats-tabs [data-stats-tab].active {
  background: var(--soft);
  color: var(--brand-dark);
}

.stats-panel[hidden] {
  display: none !important;
}

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

.stat-player-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: #fff;
}

.stat-player-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stat-player-top strong {
  font-size: 15px;
}

.stat-rating {
  display: block;
  margin-top: 2px;
  color: var(--brand-dark);
  font-size: 21px;
  font-weight: 900;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 14px;
}

.stat-grid div,
.stat-grid > span {
  border-radius: 10px;
  padding: 8px;
  background: #f6f9f8;
  text-align: center;
}

.stat-grid b,
.stat-grid small {
  display: block;
}

.stat-grid b {
  font-size: 13px;
}

.stat-grid small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.stat-details {
  margin-top: 10px;
  color: var(--muted);
  font-size: 10px;
}

.positive {
  color: var(--success) !important;
}

.negative {
  color: var(--danger) !important;
}

.partner-card-list,
.ranking-list {
  display: grid;
  gap: 8px;
}

.partner-card,
.ranking-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px 14px;
  background: #fff;
}

.partner-card b,
.partner-card span,
.partner-card small {
  display: block;
}

.partner-card small,
.partner-relation {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.partner-performance {
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.ranking-row {
  grid-template-columns: 34px minmax(0, 1fr) auto;
}

.ranking-position {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #f1f5f3;
  color: var(--brand-dark);
  font-weight: 900;
}

.ranking-value {
  color: var(--brand-dark);
  font-size: 16px;
  font-weight: 900;
}

.advanced-stats {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.advanced-stats summary {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  cursor: pointer;
  font-weight: 850;
  list-style: none;
}

.advanced-stats summary::-webkit-details-marker {
  display: none;
}

.advanced-stats-body {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 14px;
}

.advanced-stats-body .card {
  box-shadow: none;
}

.scroll {
  max-width: 100%;
  min-width: 0;
  overscroll-behavior-inline: contain;
}

.matrix {
  min-width: 650px;
}

/* Doubleanalyse, historik og Mere */

.double-team-select.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 7px 20px rgba(8,117,90,.18);
}

.double-team {
  border-radius: 17px;
  padding: 14px;
  background: #fff;
}

.double-rank strong {
  font-size: 18px;
}

.double-pair {
  margin-top: 8px;
  font-size: 16px;
}

.double-summary > div {
  border: 1px solid #edf1f0;
  background: #f7faf9;
}

.history-item {
  min-height: 66px;
  padding-block: 12px;
}

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

.more-card {
  min-width: 0;
  min-height: 112px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
}

.more-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
}

.more-card b,
.more-card small {
  display: block;
}

.more-card small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.4;
}

.back-to-more,
.back-button {
  min-height: 36px;
  margin-bottom: 14px;
  padding: 5px 4px;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
}

.empty-state {
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  padding: 22px;
  background: rgba(255,255,255,.5);
  text-align: center;
}

.empty-state.compact {
  min-height: 82px;
  justify-content: flex-start;
  margin-top: 12px;
  text-align: left;
}

.empty-state p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.empty-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  border-radius: 14px;
  background: var(--soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
}

/* Dialoger */

dialog {
  max-height: min(86vh, 760px);
  overflow: auto;
  border: 1px solid rgba(203,217,212,.8);
  border-radius: 24px;
  padding: 22px;
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(5, 35, 27, .26);
}

dialog::backdrop {
  background: rgba(5, 23, 18, .5);
  backdrop-filter: blur(3px);
}

.app-dialog {
  width: min(92vw, 440px);
  overflow: visible;
}

.dialog-handle {
  display: none;
}

.dialog-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  margin-bottom: 15px;
  padding: 10px;
  background: var(--soft);
  color: var(--brand);
}

.app-dialog[data-tone="danger"] .dialog-icon {
  background: #fff0f0;
  color: var(--danger);
}

.app-dialog h2 {
  margin-bottom: 9px;
  font-size: 22px;
}

.app-dialog-body {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.app-dialog-body p {
  margin: 0;
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.confirmation-list {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--ink);
}

.confirmation-list li {
  margin: 5px 0;
}

.dialog-note {
  margin-top: 12px !important;
  border-radius: 12px;
  padding: 10px;
  background: #f6f9f8;
  color: var(--ink);
}

@media (max-width: 900px) {
  .head {
    padding-inline: 16px;
  }

  .save-state {
    margin-left: auto;
  }

  .app-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: 100%;
    max-width: none;
    height: calc(68px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    border-top: 1px solid rgba(203,217,212,.9);
    padding: 5px max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
    background: rgba(255,255,255,.95);
    box-shadow: 0 -8px 28px rgba(5,35,27,.08);
    backdrop-filter: blur(18px) saturate(150%);
    overflow: visible;
  }

  .tab {
    width: 100%;
    min-width: 0;
    min-height: 58px;
    flex-direction: column;
    gap: 2px;
    border-radius: 12px;
    padding: 6px 2px;
    font-size: 10px;
  }

  .tab.active {
    background: transparent;
    color: var(--brand);
    box-shadow: none;
  }

  .tab.active .nav-icon {
    border-radius: 9px;
    background: var(--soft);
    box-shadow: 0 0 0 6px var(--soft);
  }

  .nav-icon {
    width: 20px;
    height: 20px;
  }

  main {
    padding: 25px 16px calc(100px + env(safe-area-inset-bottom));
  }

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

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

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

  .court {
    width: 100%;
  }

  .round-viewbar,
  .stats-segments,
  .stats-tabs {
    top: 76px;
  }

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

@media (max-width: 700px) {
  .head {
    min-height: 64px;
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .save-state span:last-child {
    display: none;
  }

  main {
    padding-inline: 13px;
  }

  .card,
  .setup-block,
  .setup-section {
    padding: 16px;
  }

  .formrow,
  .grid.two,
  .grid.three,
  .lockrow,
  .siderow {
    grid-template-columns: 1fr 1fr;
  }

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

  .stat-card-list {
    grid-template-columns: 1fr;
  }

  .round-viewbar,
  .stats-segments,
  .stats-tabs {
    top: 68px;
  }

  #trainingFinishActions {
    bottom: calc(73px + env(safe-area-inset-bottom));
  }

  .pwa-update-banner {
    top: auto;
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    width: auto;
  }

  #finishTrainingBtn,
  #newTrainingBtn {
    flex: 1 1 170px;
  }
}

@media (max-width: 520px) {
  body {
    background: var(--bg);
  }

  .head {
    padding-inline: 13px;
  }

  .sub {
    display: block !important;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  main {
    padding-top: 20px;
  }

  h1 {
    font-size: 27px;
  }

  .lead {
    margin-bottom: 18px;
    font-size: 13px;
  }

  .home-hero {
    min-height: 310px;
    border-radius: 24px;
    padding: 23px;
  }

  .home-hero h1 {
    font-size: 34px;
  }

  .home-primary {
    width: 100%;
  }

  .first-run-actions {
    flex-direction: column;
  }

  .first-run-actions .home-primary,
  .home-secondary {
    width: 100%;
    flex-basis: auto;
  }

  .home-section-head {
    margin-top: 24px;
  }

  .home-metrics {
    gap: 9px;
  }

  .metric-card {
    min-height: 116px;
    border-radius: 17px;
    padding: 13px;
  }

  .metric-card strong {
    font-size: 15px;
  }

  .formrow,
  .grid.two,
  .grid.three,
  .lockrow,
  .siderow {
    grid-template-columns: 1fr;
  }

  .focusrow > div {
    grid-column: span 1 !important;
  }

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

  .playercheck {
    min-height: 60px;
  }

  .round-viewbar {
    gap: 5px;
    margin-inline: -4px;
    padding: 8px;
  }

  .round-viewbar .round-view-label,
  .round-help {
    width: 100%;
    margin: 0 0 1px;
  }

  .round-toggle {
    flex: 1 1 58px;
    justify-content: center;
    padding-inline: 7px;
  }

  .roundtitle {
    align-items: flex-start;
  }

  .roundtitle-actions {
    justify-content: flex-start;
  }

  .match {
    padding: 13px;
  }

  .p {
    padding: 9px;
    font-size: 12px;
  }

  .scoreline input {
    width: 82px;
    min-height: 56px;
    font-size: 23px;
  }

  .stats-segments,
  .stats-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .roster-row {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .roster-row .roster-rating {
    grid-column: 2;
    margin-top: -8px;
  }

  .roster-row .icon-action {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .double-summary {
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 5px;
  }

  dialog {
    width: 100vw;
    max-width: none;
    max-height: 88vh;
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: 25px 25px 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  }

  .app-dialog {
    width: 100vw;
  }

  .dialog-handle {
    width: 42px;
    height: 4px;
    display: block;
    border-radius: 999px;
    margin: -8px auto 18px;
    background: #cbd5d1;
  }

  .app-dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .app-dialog-actions > :only-child {
    grid-column: 1 / -1;
  }

  .app-dialog-actions button {
    min-height: 50px;
  }
}

@media (max-width: 350px) {
  .brand-name {
    font-size: 14px;
  }

  .sub {
    max-width: 135px;
    font-size: 8px;
  }

  .home-hero {
    min-height: 292px;
    padding: 20px;
  }

  .home-hero h1 {
    font-size: 31px;
  }

  .metric-card {
    min-height: 112px;
    padding: 11px;
  }

  .metric-card strong {
    font-size: 14px;
  }

  .metric-value {
    font-size: 10px;
  }

  .tab {
    font-size: 9px;
  }

  .nav-icon {
    width: 19px;
    height: 19px;
  }

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

  .vs {
    padding: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Package A · træningsoverblik, spilleraften, print og rangeringsfilter */

.schedule-mode-switch,
.ranking-filter {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: #f2f6f4;
}

.schedule-mode-switch button,
.ranking-filter button {
  min-height: 36px;
  border-radius: 999px;
  padding: 7px 11px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.schedule-mode-switch button[aria-pressed="true"],
.ranking-filter button[aria-pressed="true"] {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 2px 9px rgba(7, 42, 33, .1);
}

.round-detail-filters {
  min-width: 0;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 7px;
  flex-wrap: wrap;
}

.round-detail-filters[hidden],
.round-overview-label[hidden],
#scheduleOverview[hidden],
#schedule[hidden] {
  display: none !important;
}

.round-overview-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.schedule-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.overview-round {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.overview-round > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  background: #f5f9f7;
}

.overview-round > header span,
.overview-round > header small {
  display: block;
}

.overview-round > header span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.overview-round > header small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.overview-courts {
  display: grid;
}

.overview-match {
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 2px 8px;
  border-bottom: 1px solid #e8eeec;
  padding: 9px 10px;
}

.overview-match:last-child {
  border-bottom: 0;
}

.overview-match > b {
  grid-row: 1 / span 3;
  align-self: center;
  color: var(--brand-dark);
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.overview-team {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.overview-vs {
  color: #8a9793;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.schedule-player-name {
  min-width: 0;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 9px;
  padding: 5px 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.schedule-player-name:hover,
.schedule-player-name:focus-visible {
  background: var(--soft);
  color: var(--brand-dark);
}

.schedule-player-name span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.schedule-player-name small {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  border-radius: 7px;
  background: #e7efec;
  color: var(--brand-dark);
  font-size: 9px;
  font-weight: 900;
}

.p .schedule-player-name {
  width: fit-content;
  max-width: 100%;
  min-height: 42px;
  margin: 0;
  padding-inline: 0;
  font-weight: 850;
}

.schedule-player-name.compact {
  min-height: 30px;
  padding: 3px 5px;
  font-size: 10px;
  font-weight: 800;
}

.player-evening-dialog {
  width: min(94vw, 680px);
  max-height: min(88vh, 760px);
  overflow: auto;
}

.player-evening-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
}

.player-evening-head h2 {
  margin: 3px 0 0;
}

.player-evening-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.player-evening-round {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px;
  background: #fbfdfc;
}

.player-evening-round > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #e5ece9;
  padding-bottom: 8px;
}

.player-evening-round > header span {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.player-evening-round > header small {
  color: var(--muted);
  font-size: 9px;
  text-align: right;
}

.player-evening-position {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 11px 0;
}

.side-badge {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.player-evening-position b,
.player-evening-position small,
.player-evening-balance {
  display: block;
}

.player-evening-position small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 8px;
}

.player-evening-balance {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.player-evening-round dl,
.player-evening-round dd {
  margin: 0;
}

.player-evening-round dl {
  display: grid;
  gap: 7px;
}

.player-evening-round dl > div {
  border-top: 1px solid #e8eeec;
  padding-top: 7px;
}

.player-evening-round dt {
  color: var(--muted);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.player-evening-round dd {
  margin-top: 2px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.player-evening-flags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 9px;
}

.player-evening-flags span {
  border-radius: 999px;
  padding: 4px 7px;
  background: #fff2dc;
  color: #805500;
  font-size: 8px;
  font-weight: 850;
}

.ranking-heading {
  align-items: flex-end;
}

.ranking-filter {
  flex-wrap: wrap;
}

.ranking-row small .chip {
  display: inline-flex;
  margin-right: 2px;
}

.ranking-row > span:nth-child(2) b,
.ranking-row > span:nth-child(2) small,
.ranking-value b,
.ranking-value small {
  display: block;
}

.ranking-row > span:nth-child(2) small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.ranking-value {
  text-align: right;
}

.ranking-value small {
  margin-top: 2px;
  font-size: 10px;
}

#printSchedule {
  display: none;
}

@media (max-width: 900px) {
  .schedule-overview-grid,
  .player-evening-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .round-viewbar {
    align-items: stretch;
  }

  .schedule-mode-switch {
    flex: 0 0 auto;
  }

  .round-detail-filters {
    flex-basis: 100%;
  }

  .overview-match {
    grid-template-columns: 55px minmax(0, 1fr);
    padding-block: 8px;
  }

  .schedule-player-name.compact {
    min-height: 42px;
    font-size: 11px;
  }

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

@media (max-width: 520px) {
  .schedule-mode-switch {
    width: 100%;
  }

  .schedule-mode-switch button {
    flex: 1 1 0;
    min-height: 42px;
  }

  .round-overview-label {
    padding: 3px 2px;
  }

  .player-evening-dialog {
    width: 100vw;
  }

  .player-evening-head {
    position: sticky;
    top: -20px;
    z-index: 2;
    margin-inline: -2px;
    padding: 8px 2px 10px;
    background: #fff;
  }

  .ranking-filter {
    width: 100%;
  }

  .ranking-filter button {
    flex: 1 1 130px;
    min-height: 42px;
  }
}

/* Package A.1 · foldbart træningsflow og tydelig autosave */

.training-workflow {
  display: grid;
  gap: 10px;
}

.training-collapsible {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(9, 40, 31, .055);
}

.training-collapsible.is-open {
  border-color: #cbdcd6;
}

.training-section-trigger {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 0;
  padding: 13px 16px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.training-section-trigger:hover,
.training-section-trigger:focus-visible {
  background: #f5f9f7;
}

.training-section-trigger > span:first-child,
.training-section-trigger b,
.training-section-trigger small {
  min-width: 0;
  display: block;
}

.training-section-trigger b {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -.01em;
}

.training-section-trigger small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.training-chevron {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #eef4f1;
}

.training-chevron::before {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--brand-dark);
  border-bottom: 2px solid var(--brand-dark);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 180ms ease;
}

.training-section-trigger[aria-expanded="true"] .training-chevron::before {
  transform: translateY(2px) rotate(225deg);
}

.training-section-panel {
  border-top: 1px solid #e7eeeb;
  padding: 16px;
  animation: training-panel-in 180ms ease both;
}

.training-section-panel[hidden] {
  display: none !important;
}

.training-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
  padding: 4px 0 2px;
}

.training-create-actions button {
  min-height: 48px;
}

.training-workflow > #trainingNotice:not(.hidden) {
  margin-top: 0;
}

.training-schedule-section {
  scroll-margin-top: 16px;
}

.autosave-confirmation {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding-block: 9px;
  font-weight: 800;
}

#savePlannedBtn {
  display: none !important;
}

@keyframes training-panel-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 520px) {
  .training-workflow {
    gap: 8px;
  }

  .training-collapsible {
    border-radius: 16px;
  }

  .training-section-trigger {
    min-height: 64px;
    padding: 11px 13px;
  }

  .training-section-panel {
    padding: 14px 12px;
  }

  .training-create-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .training-create-actions button {
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .training-chevron::before {
    transition: none;
  }

  .training-section-panel {
    animation: none;
  }
}

/* Training detail refinement: denser cards and an explicit placement-edit mode. */
.training-schedule-section .schedule-actions {
  gap: 7px;
  margin-bottom: 10px;
}

.placement-edit-toggle[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 7px 18px rgba(7, 95, 75, .18);
}

.placement-edit-notice {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 9px;
  border: 1px solid #91c9b9;
  border-radius: 11px;
  padding: 8px 10px;
  background: #eaf7f2;
  color: var(--brand-dark);
  font-size: 11px;
}

.placement-edit-notice[hidden] {
  display: none !important;
}

.placement-edit-notice b {
  flex: 0 0 auto;
  font-size: 11px;
}

.training-schedule-section #schedule .round {
  margin-top: 12px;
}

.training-schedule-section #schedule .roundtitle {
  margin-bottom: 6px;
}

.training-schedule-section #schedule .courts {
  gap: 10px;
}

.training-schedule-section #schedule .courthead {
  min-height: 38px;
  padding: 8px 11px;
}

.training-schedule-section #schedule .match {
  padding: 10px;
}

.training-schedule-section #schedule .pair {
  gap: 6px;
}

.training-schedule-section #schedule .p {
  min-height: 48px;
  border-width: 1px;
  border-radius: 10px;
  padding: 7px 8px;
  font-size: 12px;
  line-height: 1.18;
}

.training-schedule-section #schedule .p b {
  font-size: 12px;
  line-height: 1.16;
}

.training-schedule-section #schedule .p .side {
  margin-top: 0;
  font-size: 8px;
}

.training-schedule-section #schedule .p .tiny {
  margin-top: 2px;
  font-size: 8px;
  line-height: 1.18;
}

.training-schedule-section #schedule .v34-player-card {
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.training-schedule-section #schedule .v34-player-card:hover,
.training-schedule-section #schedule .v34-player-card:focus-visible {
  border-color: #9bcfbe;
  background: #eef8f4;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(11, 139, 106, .12);
}

.training-schedule-section.placement-edit-mode #schedule .v34-player-card.is-move-target {
  border-color: #83baa9;
  border-style: dashed;
  background: #edf8f4;
  box-shadow: inset 0 0 0 1px rgba(7, 95, 75, .05);
}

.training-schedule-section.placement-edit-mode #schedule .v34-player-card.is-move-target:active {
  transform: scale(.985);
}

.training-schedule-section.placement-edit-mode #schedule .v34-player-card.swapselected {
  border-style: solid;
  border-color: var(--brand);
  background: #dff3eb;
  box-shadow: 0 0 0 3px rgba(11, 139, 106, .16);
}

.training-schedule-section.placement-edit-mode #schedule .v34-player-card.is-move-locked {
  cursor: not-allowed;
  opacity: .58;
}

.training-schedule-section #schedule .vs {
  padding: 5px;
  font-size: 8px;
}

.training-schedule-section #schedule .pair-insight {
  min-height: 27px;
  margin-top: 4px;
  border-radius: 8px;
  padding: 4px 6px;
  gap: 4px;
  font-size: 9px;
  line-height: 1.2;
}

.training-schedule-section #schedule .pair-insight .newpair {
  color: #52746a;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .01em;
}

.training-schedule-section #schedule .pair-insight .info-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  margin: -2px -3px -2px auto;
  font-size: 10px;
}

.training-schedule-section #schedule .scoreline {
  gap: 8px;
  margin-top: 8px;
}

.training-schedule-section #schedule .scoreline input {
  width: 62px;
  min-height: 48px;
  border-radius: 11px;
  padding: 6px;
  font-size: 19px;
}

.training-schedule-section #schedule .scoreline span {
  font-size: 16px;
}

.training-schedule-section #schedule .balance-split {
  gap: 6px;
  margin: 6px 0 2px;
  font-size: 9px;
}

.training-schedule-section #schedule .quality {
  margin-top: 6px;
  font-size: 9px;
  line-height: 1.3;
}

.training-schedule-section #schedule .count-mode-wrap {
  margin-top: 7px;
}

.training-schedule-section #schedule .count-mode-wrap select {
  min-height: 36px;
  padding-block: 5px;
}

.overview-team {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.overview-team .schedule-player-name.compact {
  width: 100%;
  max-width: 100%;
  min-height: 38px;
  padding: 3px 4px;
  font-size: 10px;
}

.overview-team .schedule-player-name.compact span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 520px) {
  main {
    padding-bottom: calc(122px + env(safe-area-inset-bottom));
  }

  .training-schedule-section .schedule-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .training-schedule-section .schedule-actions button {
    width: 100%;
    min-width: 0;
  }

  .placement-edit-notice {
    align-items: flex-start;
    flex-direction: column;
    gap: 1px;
  }

  .training-schedule-section #schedule .match {
    padding: 9px;
  }

  .overview-match {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 2px 6px;
    padding: 7px 8px;
  }

  .overview-team .schedule-player-name.compact {
    min-height: 40px;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .training-schedule-section #schedule .v34-player-card {
    transition: none;
  }
}

/* Package A.2 · compact mobile schedule controls and overview editing. */
.participant-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.participant-helpers {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.participant-helpers .text-button {
  min-height: 44px;
  padding: 5px 8px;
  color: var(--brand-dark);
  font-size: 10px;
}

.training-create-actions {
  padding-top: 2px;
}

.training-create-actions #generateBtn {
  min-width: 184px;
}

.training-schedule-section .training-section-panel {
  padding-top: 10px;
}

.training-schedule-section .autosave-confirmation {
  min-height: 32px;
  justify-content: flex-end;
  margin-bottom: 4px;
  border: 0;
  padding: 4px 2px;
  background: transparent;
  box-shadow: none;
  color: #648078;
  font-size: 9px;
}

.training-schedule-section .round-viewbar {
  top: 70px;
  min-height: 0;
  display: grid;
  gap: 5px;
  margin: 0 -2px 8px;
  border: 0;
  border-radius: 13px;
  padding: 5px;
  background: rgba(247, 250, 249, .96);
  box-shadow: 0 5px 16px rgba(7, 42, 33, .06);
  backdrop-filter: blur(12px);
}

.schedule-toolbar-primary {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.training-schedule-section .schedule-mode-switch {
  flex: 0 1 176px;
  gap: 2px;
  border: 0;
  border-radius: 10px;
  padding: 2px;
  background: #eaf0ed;
}

.training-schedule-section .schedule-mode-switch button {
  min-height: 44px;
  flex: 1 1 0;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 11px;
}

.training-schedule-section .schedule-mode-switch button[aria-pressed="true"] {
  background: #fff;
  box-shadow: 0 1px 5px rgba(7, 42, 33, .1);
}

.schedule-share-button {
  min-height: 44px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 9px;
  padding: 6px 9px;
  background: transparent;
  color: var(--brand-dark);
  font-size: 10px;
}

.training-schedule-section .round-detail-filters {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
  border-radius: 11px;
  padding: 3px;
  background: #edf2f0;
}

.training-schedule-section .round-toggle,
.training-schedule-section .round-all-chip {
  min-width: 0;
  min-height: 44px;
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  border-radius: 9px;
  padding: 4px 10px;
  background: transparent;
  color: #60706a;
  font-size: 11px;
  font-weight: 780;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.training-schedule-section .round-toggle {
  position: relative;
}

.training-schedule-section .round-toggle::before {
  display: none;
  content: none;
}

.training-schedule-section .round-toggle:has(input:checked) {
  border-color: transparent;
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 1px 5px rgba(7, 42, 33, .1);
}

.training-schedule-section .round-toggle.locked:not(:has(input:checked)) {
  color: #7a5a18;
}

.training-schedule-section .round-toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.training-schedule-section .round-all-chip[aria-pressed="true"] {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 1px 5px rgba(7, 42, 33, .1);
}

.training-schedule-section .round-toggle:has(input:focus-visible),
.training-schedule-section .round-all-chip:focus-visible {
  outline: 3px solid rgba(11, 139, 106, .24);
  outline-offset: 1px;
}

.placement-action-bar {
  position: fixed;
  right: auto;
  left: max(16px, env(safe-area-inset-left));
  bottom: 18px;
  z-index: 44;
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(187, 205, 199, .9);
  border-radius: 15px;
  padding: 4px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 30px rgba(5, 35, 27, .18);
  backdrop-filter: blur(15px);
}

.placement-action-bar[hidden] {
  display: none !important;
}

.placement-action-bar button {
  min-height: 46px;
  border-radius: 11px;
  padding: 7px 11px;
  font-size: 11px;
}

body.has-placement-actions #trainingFinishActions {
  bottom: 78px;
}

.placement-action-bar .placement-undo {
  border-color: transparent;
  background: #f1f5f3;
}

.placement-edit-notice {
  min-height: 36px;
  margin-bottom: 5px;
  border: 0;
  padding: 6px 8px;
  background: #e9f5f0;
}

.training-schedule-section.placement-edit-mode #scheduleOverview .v34-overview-player.is-move-target {
  border-color: #83baa9;
  border-style: dashed;
  background: #edf8f4;
}

.training-schedule-section.placement-edit-mode #scheduleOverview .v34-overview-player.swapselected {
  border-style: solid;
  border-color: var(--brand);
  background: #dff3eb;
  box-shadow: 0 0 0 3px rgba(11, 139, 106, .16);
}

.training-schedule-section.placement-edit-mode #scheduleOverview .v34-overview-player.is-move-locked {
  cursor: not-allowed;
  opacity: .56;
}

.training-schedule-section #schedule .scoreline {
  gap: 6px;
  margin-top: 6px;
}

.training-schedule-section #schedule .scoreline input {
  width: 56px;
  min-height: 48px;
  padding: 4px;
}

.training-schedule-section #schedule .balance-split {
  margin: 4px 0 1px;
}

.training-schedule-section #schedule .compact-result-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px 6px;
  flex-wrap: wrap;
  margin-top: 3px;
  line-height: 1.25;
}

.training-schedule-section #schedule .compact-result-meta br {
  display: none;
}

.training-schedule-section #schedule .compact-result-meta .count-mode-wrap {
  width: auto;
  margin: 0;
  gap: 3px;
}

.training-schedule-section #schedule .compact-result-meta .count-mode-wrap select {
  min-width: 104px;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  padding: 4px 24px 4px 7px;
  background-color: #f2f6f4;
  font-size: 9px;
}

.training-schedule-section #schedule .compact-result-meta .info-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
}

/* Package A.2 mobile density polish: keep every control while removing empty vertical space. */
.training-schedule-section #schedule .p b {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-schedule-section #schedule .pair-insight {
  min-height: 34px;
  margin-top: 2px;
  padding: 0 4px;
  gap: 3px;
  line-height: 1.1;
}

.training-schedule-section #schedule .pair-insight .info-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  margin: 0 -2px 0 auto;
}

.training-schedule-section #schedule .scoreline {
  gap: 5px;
  margin-top: 4px;
}

.training-schedule-section #schedule .score-entry {
  position: relative;
  display: block;
  width: 58px;
  min-width: 58px;
  height: 44px;
  margin: 0;
  color: inherit;
}

.training-schedule-section #schedule .score-entry .score-team-label {
  position: absolute;
  z-index: 1;
  top: 4px;
  right: 3px;
  left: 3px;
  color: #6d7b77;
  font-size: 7px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: .05em;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
}

.training-schedule-section #schedule .scoreline .score-entry input {
  width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 13px 4px 2px;
  font-size: 18px;
}

.training-schedule-section #schedule .balance-split {
  margin: 2px 0 0;
  font-size: 8px;
  line-height: 1.1;
}

.training-schedule-section #schedule .compact-result-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 5px;
  margin-top: 2px;
  line-height: 1.15;
}

.training-schedule-section #schedule .compact-result-meta .quality-summary {
  min-width: 0;
  color: #6d7b77;
  font-size: 8px;
  text-align: left;
  white-space: nowrap;
}

.training-schedule-section #schedule .compact-result-meta .count-mode-wrap {
  flex-wrap: nowrap;
  white-space: nowrap;
}

@media (max-width: 350px) {
  .training-schedule-section #schedule .compact-result-meta {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .training-schedule-section #schedule .compact-result-meta .quality-summary {
    text-align: center;
  }
}

.share-export-dialog {
  width: min(390px, calc(100vw - 24px));
  border: 0;
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 24px 70px rgba(4, 28, 22, .24);
}

.share-export-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.share-export-head h2 {
  margin: 2px 0 0;
}

.share-export-actions {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.share-export-actions button {
  min-height: 62px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  text-align: left;
}

.share-export-actions button > span:first-child {
  font-size: 18px;
  text-align: center;
}

.share-export-actions b,
.share-export-actions small {
  display: block;
}

.share-export-actions small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

@media (max-width: 900px) {
  .placement-action-bar {
    right: auto;
    left: max(10px, env(safe-area-inset-left));
    bottom: calc(75px + env(safe-area-inset-bottom));
  }

  body.has-placement-actions main {
    padding-bottom: calc(158px + env(safe-area-inset-bottom));
  }

  body.has-placement-actions #trainingFinishActions {
    bottom: calc(132px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 520px) {
  .participant-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 1px;
  }

  .participant-helpers {
    align-self: stretch;
    justify-content: flex-end;
  }

  .training-create-actions {
    display: flex;
  }

  .training-create-actions #generateBtn {
    width: 100%;
  }

  .training-schedule-section .round-viewbar {
    top: 66px;
    margin-inline: -5px;
  }

  .training-schedule-section .schedule-mode-switch {
    width: auto;
    flex-basis: 164px;
  }

  .training-schedule-section .schedule-mode-switch button {
    min-height: 44px;
    padding-inline: 8px;
  }

  .schedule-share-button {
    padding-inline: 7px;
    font-size: 9px;
  }

  .placement-edit-notice {
    align-items: center;
    flex-direction: row;
    gap: 5px;
  }

  .placement-edit-notice span {
    min-width: 0;
  }

  .share-export-dialog {
    width: 100vw;
    max-width: none;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }
}

@page {
  size: A4 portrait;
  margin: 8mm;
}

@media print {
  html,
  body {
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #000 !important;
    font-family: Arial, Helvetica, sans-serif;
    -webkit-print-color-adjust: economy;
    print-color-adjust: economy;
  }

  body > *:not(#printSchedule) {
    display: none !important;
  }

  #printSchedule {
    display: block !important;
    color: #000;
    font-size: 9pt;
    line-height: 1.25;
  }

  .print-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8mm;
    border-bottom: 1.5pt solid #000;
    padding-bottom: 3mm;
  }

  .print-header span,
  .print-header b {
    display: block;
  }

  .print-header > div:last-child {
    text-align: right;
  }

  .print-header h1 {
    margin: 1mm 0 0;
    color: #000;
    font-size: 18pt;
  }

  .print-rounds {
    display: grid;
    gap: 3.5mm;
    margin-top: 4mm;
  }

  .print-round,
  .print-match {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-round > header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    border-bottom: .75pt solid #555;
    padding-bottom: 1.5mm;
  }

  .print-round h2,
  .print-match h3 {
    margin: 0;
    color: #000;
  }

  .print-round h2 {
    font-size: 12pt;
    text-transform: uppercase;
  }

  .print-courts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.5mm;
    margin-top: 2mm;
  }

  .print-match {
    border: .75pt solid #555;
    padding: 2.5mm;
  }

  .print-match h3 {
    margin-bottom: 1.5mm;
    font-size: 9pt;
    text-transform: uppercase;
  }

  .print-team {
    display: grid;
    gap: 1mm;
  }

  .print-team span {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2mm;
    align-items: baseline;
  }

  .print-team b {
    overflow-wrap: anywhere;
    font-size: 9.5pt;
  }

  .print-team i {
    font-style: normal;
    font-weight: 900;
  }

  .print-vs {
    margin: 1.5mm 0;
    border-block: .5pt solid #bbb;
    padding: 1mm 0;
    font-size: 7pt;
    font-weight: 900;
    letter-spacing: .12em;
    text-align: center;
  }

  #printSchedule > footer {
    margin-top: 3mm;
    border-top: .5pt solid #777;
    padding-top: 2mm;
    font-size: 7.5pt;
  }
}
