:root{
  --bg:#0d0f14;
  --surface:#171a22;
  --surface-2:#1e222c;
  --surface-3:#242936;
  --border:#2a2f3b;
  --border-soft:#20242e;
  --text:#eef0f5;
  --text-muted:#8a8fa3;
  --text-faint:#5b6072;
  /* TBTK brand: yellow + red from the club logo (badges.svenskalag.se) and
     tbtk.se's own site palette (#B80000). --accent uses the logo's yellow;
     --danger uses the logo's own red-orange rather than the site's deeper
     #B80000, which read a little muddy for small text on this dark a
     background -- same brand hue family, just tuned for this UI. */
  --accent:#fdd400;
  --accent-dim:#b89400;
  --accent-ink:#241900;
  --danger:#e8391a;
  --danger-soft:rgba(232,57,26,0.12);
  --ok:#7be08a;
  --radius-lg:18px;
  --radius-md:12px;
  --radius-sm:8px;
  --shadow-lg:0 20px 40px -20px rgba(0,0,0,0.55);
  --shadow-sm:0 8px 20px -12px rgba(0,0,0,0.5);
}

*, *::before, *::after{ box-sizing:border-box; }

html{ -webkit-text-size-adjust:100%; }

body{
  margin:0;
  min-height:100vh;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Roboto,sans-serif;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(253,212,0,0.06), transparent 60%),
    var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
}

a{ color:inherit; }

h1,h2,h3{ margin:0; letter-spacing:-0.01em; }

button, input, select, textarea{ font-family:inherit; color:inherit; }

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

/* ---------- header / nav ---------- */

.site-header{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(13,15,20,0.86);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border);
  padding:14px 24px 0;
}
.site-header__row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:10px 16px;
  max-width:920px;
  margin:0 auto;
  padding-bottom:12px;
}
.brand{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:800;
  font-size:18px;
  text-transform:uppercase;
  letter-spacing:.04em;
  text-decoration:none;
  white-space:nowrap;
}
.brand span{ color:var(--accent); }
.brand-logo{ width:28px; height:28px; border-radius:50%; }

.header-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.header-user{
  font-size:13px;
  font-weight:700;
  color:var(--text);
}

[x-cloak]{ display:none !important; }

.site-nav{
  display:flex;
  gap:4px;
  max-width:920px;
  margin:0 auto;
  overflow-x:auto;
  scrollbar-width:none;
}
.site-nav::-webkit-scrollbar{ display:none; }
.site-nav a{
  flex:0 0 auto;
  padding:10px 14px;
  font-size:13px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.03em;
  text-decoration:none;
  color:var(--text-muted);
  border-bottom:2px solid transparent;
  white-space:nowrap;
}
.site-nav a.active{ color:var(--accent); border-bottom-color:var(--accent); }
.site-nav a:hover{ color:var(--text); }

.page{
  max-width:920px;
  margin:0 auto;
  padding:28px 20px 100px;
}

/* ---------- headings / toolbars ---------- */

.toolbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:14px;
  margin-bottom:22px;
  flex-wrap:wrap;
}
.toolbar h1{ font-size:22px; font-weight:800; }
.sub{ margin:4px 0 0; color:var(--text-muted); font-size:13.5px; }
.bank-section-divider{ margin-top:40px; padding-top:24px; border-top:1px solid var(--border); }

.section-title{
  font-size:12.5px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--text-muted);
  margin:32px 0 12px;
}

/* ---------- cards ---------- */

.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  padding:20px;
  margin-bottom:14px;
  box-shadow:var(--shadow-sm);
}

/* ---------- drill cards ---------- */

.drill-list{ display:flex; flex-direction:column; gap:12px; margin-bottom:14px; }
.drill-card{ padding:16px 18px; margin-bottom:0; }
.drill-card--edit{ background:var(--surface-2); }
.drill-card__head{
  display:flex; justify-content:space-between; align-items:flex-start; gap:10px;
  margin-bottom:10px; flex-wrap:wrap;
}
.drill-card__title{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.drill-card__name{ font-weight:800; font-size:15px; }
.drill-card__duration{
  font-size:11.5px; font-weight:700; letter-spacing:.02em;
  color:var(--accent-dim);
  background:rgba(253,212,0,0.08);
  padding:4px 10px;
  border-radius:999px;
  white-space:nowrap;
}
.drill-card__description{ margin:0; font-size:14px; line-height:1.5; white-space:pre-wrap; }
.add-drill-btn{ display:block; margin:4px 0 4px; }

.field label{
  display:block; font-size:10.5px; text-transform:uppercase; letter-spacing:.05em;
  color:var(--text-muted); margin-bottom:6px; font-weight:700;
}
.field input, .field select, .field textarea{
  width:100%;
  padding:11px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--surface-2);
  color:var(--text);
  font-size:14px;
  font-weight:600;
  min-height:44px;
  font-family:inherit;
}
.field textarea{ font-weight:500; resize:vertical; }
.field input::placeholder, .field textarea::placeholder{ color:var(--text-faint); font-weight:500; }
.field input:focus, .field select:focus, .field textarea:focus{ outline:none; border-color:var(--accent); background:var(--surface-3); }
.field-error{ color:var(--danger); font-size:12px; margin-top:6px; font-weight:600; }

.stack-form .field{ margin-bottom:14px; }

.mini-fields{ display:flex; gap:6px; }
.mini-fields .field{ flex:1; min-width:0; }

.toolbar-add{ padding:10px 12px; background:var(--surface-2); border-radius:var(--radius-md); }

/* ---------- buttons ---------- */

.btn-primary{
  background:var(--accent);
  color:var(--accent-ink);
  border:none;
  padding:13px 24px;
  border-radius:12px;
  font-weight:800;
  font-size:13.5px;
  cursor:pointer;
  text-transform:uppercase;
  letter-spacing:.03em;
  min-height:46px;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transition:filter .15s ease, transform .1s ease;
}
.btn-primary:hover{ filter:brightness(1.08); }
.btn-primary:active{ transform:translateY(1px); }

.btn-outline{
  background:transparent;
  color:var(--accent);
  border:1px solid var(--accent);
  padding:10px 18px;
  border-radius:10px;
  font-weight:700;
  font-size:13px;
  cursor:pointer;
  min-height:42px;
}
.btn-outline:hover{ background:rgba(253,212,0,0.08); }

.add-plan-buttons{ display:flex; gap:8px; flex-wrap:wrap; }
.panel-reveal{ margin-top:16px; }

.btn-label-short{ display:none; }

.save-row{ display:flex; justify-content:flex-end; align-items:center; gap:12px; margin-top:18px; flex-wrap:wrap; }

.link-btn{
  background:none;
  border:none;
  color:var(--accent);
  font:inherit;
  font-weight:700;
  font-size:12.5px;
  cursor:pointer;
  padding:6px 4px;
  text-decoration:none;
}
.link-btn:hover{ color:#ffe873; }
.link-btn.danger{ color:var(--danger); }
.link-btn.danger:hover{ color:#ff7a5c; }

.icon-btn{
  border:1px solid var(--border);
  background:var(--surface-2);
  border-radius:8px;
  width:30px; height:30px;
  min-width:30px;
  cursor:pointer;
  color:var(--text-muted);
  font-size:13px;
  line-height:1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.icon-btn:hover{ color:var(--text); border-color:#3a4152; }

.row-actions{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }

.import-confirm{
  color:var(--ok);
  font-size:12px;
  font-weight:700;
  white-space:nowrap;
}

/* ---------- empty states ---------- */

.empty-state{
  background:var(--surface);
  border:1px dashed var(--border);
  border-radius:var(--radius-lg);
  padding:36px 24px;
  text-align:center;
}
.empty-state.small{ padding:20px; }
.empty-state h1{ font-size:20px; margin-bottom:8px; }
.empty-state p{ color:var(--text-muted); margin:0 0 16px; font-size:14px; }

.welcome-hero{ padding:48px 28px; }
.welcome-logo{
  display:block;
  width:130px;
  height:130px;
  margin:0 auto 22px;
  border-radius:50%;
  filter:drop-shadow(0 0 18px rgba(253,212,0,0.35));
}
.welcome-hero h1{
  font-size:clamp(22px, 5vw, 28px);
  text-transform:uppercase;
  letter-spacing:.03em;
  margin-bottom:20px;
}
.welcome-quote{
  margin:0 auto 22px;
  max-width:440px;
  font-size:15px;
  font-style:italic;
  line-height:1.5;
  color:var(--text);
  border:none;
  padding:0;
}
.welcome-quote cite{
  display:block;
  margin-top:10px;
  font-style:normal;
  font-size:12px;
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--accent-dim);
}

/* ---------- row cards (user list, bank import list) ---------- */

.user-list{ display:flex; flex-direction:column; gap:10px; }
.row-card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  padding:14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.row-card--edit{ align-items:flex-end; }
.row-card--import{ flex-direction:column; align-items:flex-start; }
.row-card--edit .field{ margin:0 10px 0 0; }
.row-title{ font-weight:700; font-size:14.5px; }
.row-sub{ font-size:12px; color:var(--text-muted); margin-top:2px; }

/* ---------- session plan cards (setup) ---------- */

.session-plan-list{ display:flex; flex-direction:column; gap:16px; }
.session-plan-card{ padding:0; overflow:hidden; }
.session-plan-card__body{ padding:16px 18px 0; }
.session-plan-card__body > .drill-list{ margin-bottom:16px; }
.session-plan-card__body > .add-drill-buttons{ margin-bottom:16px; }
.session-plan-card__head{
  display:flex; flex-direction:column; align-items:flex-start; gap:10px;
  padding:16px 18px;
  border-bottom:1px solid var(--border);
}
.session-plan-card__head-row{
  display:flex; align-items:flex-start; justify-content:space-between; gap:10px;
  width:100%;
}
.session-plan-card__head--edit{ background:var(--surface-2); }
.session-plan-card__head--edit input{
  padding:9px 11px; border-radius:8px; border:1px solid var(--border);
  background:var(--surface); color:var(--text); font-size:14px; min-width:0; flex:1;
}
.session-plan-card__name{ font-weight:800; font-size:15.5px; }
.card-toggle-btn{ flex:0 0 auto; font-size:15px; }
.add-drill-buttons{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.drill-import-panel{
  display:flex; flex-direction:column; gap:8px;
  padding:12px; margin:0 0 16px;
  background:var(--surface-2); border-radius:var(--radius-md);
}

/* ---------- start-pass picker ---------- */

.start-pass-row{ margin-bottom:20px; }
.start-pass-picker{
  display:flex;
  align-items:flex-end;
  gap:12px;
  flex-wrap:wrap;
}
.start-pass-field{ margin:0; flex:1 1 220px; }
.start-pass-group-field{ margin:0; flex:1 1 160px; }
.start-pass-date-field{ margin:0; flex:0 0 160px; }
.start-pass-btn{ flex:0 0 auto; }
.start-pass-btn:disabled{
  opacity:.45;
  cursor:not-allowed;
  filter:none;
}
.active-pass-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.active-pass-name{ font-weight:800; }
.active-pass-group{ font-weight:600; color:var(--text-muted); }
.cancel-pass-btn{ padding:6px 0; }

/* ---------- live pass checklist ---------- */

.pass-log-card{ padding:20px; }
.pass-log-head{ margin-bottom:16px; display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; }
.pass-log-name{ font-weight:800; font-size:17px; }
.pass-log-group{
  font-size:11.5px; font-weight:700; letter-spacing:.02em;
  color:var(--accent-dim);
  background:rgba(253,212,0,0.08);
  padding:3px 9px;
  border-radius:999px;
  margin-left:6px;
  white-space:nowrap;
}
.pass-log-date-info{ font-size:12.5px; color:var(--text-muted); margin-top:2px; }
.pass-date-hint{ color:var(--accent-dim); font-weight:600; }
.pass-log-timer-block{ display:flex; flex-direction:column; align-items:flex-end; gap:4px; }
.pass-log-timer{
  font-size:22px; font-weight:800; font-variant-numeric:tabular-nums;
  color:var(--accent); white-space:nowrap;
}
.pass-log-timer-controls{ display:flex; gap:12px; }
.pass-log-timer-controls .link-btn{ font-size:12.5px; padding:2px 0; }

.drill-timer{
  display:flex; align-items:center; gap:12px;
  margin-top:10px; padding-top:10px;
  border-top:1px solid var(--border-soft);
}
.drill-timer__display{
  font-size:15px; font-weight:800; font-variant-numeric:tabular-nums;
  color:var(--text-muted); min-width:44px;
}
.drill-timer__display--over{ color:var(--danger); }
.drill-timer__btn{ padding:4px 0; }

.drill-checklist{ display:flex; flex-direction:column; gap:12px; margin-bottom:4px; }
.drill-checklist-item{ padding:16px 18px; }
.drill-checklist-check{
  display:flex; align-items:center; gap:10px;
  cursor:pointer;
  margin-bottom:10px;
}
.drill-checklist-check input[type=checkbox]{ width:20px; height:20px; accent-color:var(--accent); flex:0 0 auto; }
.drill-checklist-note{
  width:100%;
  margin-top:10px;
  padding:9px 11px;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--surface-2);
  color:var(--text);
  font-size:13.5px;
  font-family:inherit;
  resize:vertical;
}
.drill-checklist-note::placeholder{ color:var(--text-faint); }
.drill-checklist-note:focus{ outline:none; border-color:var(--accent); }

/* ---------- toasts ---------- */

.toast-ok{
  background:rgba(123,224,138,0.1);
  color:var(--ok);
  border:1px solid rgba(123,224,138,0.3);
  padding:10px 14px;
  border-radius:10px;
  font-weight:700;
  font-size:13px;
  margin-bottom:14px;
  display:inline-block;
}

/* ---------- history (tidigare pass) ---------- */

.history-pass__head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:14px;
  flex-wrap:wrap;
}
.history-pass__info{ display:flex; flex-direction:column; gap:2px; }
.history-pass__name{ font-weight:800; font-size:15px; }
.history-pass__group{
  font-size:11px; font-weight:700; letter-spacing:.02em;
  color:var(--accent-dim);
  background:rgba(253,212,0,0.08);
  padding:2px 8px;
  border-radius:999px;
  align-self:flex-start;
}
.history-pass__date{ color:var(--text-muted); font-size:12.5px; font-weight:600; }
.history-pass__coach{ font-weight:500; color:var(--text-faint); }

.history-filter{ margin-bottom:18px; max-width:260px; }
.history-filter-field{ margin:0; }

.history-drill-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; }
.history-drill-item{
  display:flex; align-items:baseline; gap:8px; flex-wrap:wrap;
  font-size:13.5px;
  color:var(--text-muted);
}
.history-drill-item--checked{ color:var(--text); }
.history-drill-item__check{
  font-weight:800;
  color:var(--text-faint);
  width:14px;
  flex:0 0 auto;
}
.history-drill-item--checked .history-drill-item__check{ color:var(--ok); }
.history-drill-item__name{ font-weight:600; }
.history-drill-item__note{ color:var(--text-muted); font-style:italic; }

/* ---------- htmx loading affordance ---------- */

.htmx-request{ opacity:.55; transition:opacity .15s ease; }
.htmx-request.htmx-swapping{ opacity:.3; }

/* ---------- groups ---------- */

.new-group-form{ margin-bottom:18px; max-width:360px; }
.group-list{ display:flex; flex-direction:column; gap:10px; }
.group-row{ padding:14px 18px; }
.group-row__head{ display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:10px; }
.group-row__name{ font-weight:800; font-size:15px; }
.group-row__coaches{ display:flex; flex-wrap:wrap; gap:8px; }
.coach-chip{
  display:inline-flex; align-items:center; gap:6px;
  background:var(--surface-2);
  border:1px solid var(--border);
  border-radius:999px;
  padding:5px 6px 5px 12px;
  font-size:12.5px; font-weight:600;
}
.coach-chip__remove{
  background:none; border:none; color:var(--text-muted);
  cursor:pointer; font-size:15px; line-height:1; padding:2px 6px;
  border-radius:50%;
}
.coach-chip__remove:hover{ color:var(--danger); background:var(--danger-soft); }
.group-row__assign{ display:flex; gap:10px; align-items:center; margin-top:12px; flex-wrap:wrap; }
.group-row__assign select{
  padding:8px 10px; border-radius:8px; border:1px solid var(--border);
  background:var(--surface-2); color:var(--text); font-size:13px; font-family:inherit;
}
.group-row__confirm{ margin-top:12px; padding-top:12px; border-top:1px solid var(--border-soft); }
.group-row__confirm-hint{ margin:0 0 10px; font-size:13px; color:var(--text-muted); line-height:1.5; }
.group-row__confirm-row{ display:flex; gap:10px; flex-wrap:wrap; }
.group-row__confirm-input{
  flex:1; min-width:140px;
  padding:9px 11px;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--surface-2);
  color:var(--text);
  font-size:13.5px;
  font-family:inherit;
}
.group-row__confirm-input:focus{ outline:none; border-color:var(--danger); }

.btn-danger{
  background:var(--danger);
  color:#fff;
  border:none;
  padding:10px 16px;
  border-radius:10px;
  font-weight:700;
  font-size:13px;
  cursor:pointer;
  min-height:42px;
}
.btn-danger:hover:not(:disabled){ filter:brightness(1.08); }
.btn-danger:disabled{ opacity:0.35; cursor:not-allowed; }

/* ---------- responsive ---------- */

@media (max-width: 640px){
  .site-header{ padding:12px 16px 0; }
  .page{ padding:20px 14px 90px; }
  .toolbar{ flex-direction:column; align-items:flex-start; }
  .toolbar--inline{ flex-direction:row; align-items:center; }
  .btn-label-full{ display:none; }
  .btn-label-short{ display:inline; }
  .btn-outline{ padding:8px 12px; font-size:12px; min-height:36px; }
  .row-card--edit{ flex-direction:column; align-items:stretch; }
  .row-card--edit .field{ margin:0 0 10px; }
  .mini-fields{ flex-direction:column; }
}

@media (max-width: 420px){
  .brand{ font-size:16px; }
  .toolbar--inline .add-plan-buttons{ gap:6px; }
  .btn-outline{ padding:7px 9px; font-size:11px; }
}
