/* Skapad av scripts/bygg.mjs från src/css/ – ändra där och kör npm run bygg. */
/* ===== 00-grund.css ===== */
:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #f8f6f2;
  --border: #e3ded5;
  --text: #1d1b18;
  --muted: #6f6a62;
  --accent: #e8590c;
  --accent-soft: #fde8db;
  --accent-text: #ffffff;
  --warm: #e8590c;
  --brief: #8a8378;
  --main: #1d1b18;
  --cool: #2f7d6d;
  --danger: #c92a2a;
  --warn-bg: #fff4d6;
  --warn-text: #7a5a00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412;
    --surface: #1f1d1a;
    --surface-2: #26241f;
    --border: #36322c;
    --text: #f1ede6;
    --muted: #a39d93;
    --accent: #ff7a2f;
    --accent-soft: #3a2416;
    --main: #f1ede6;
    --brief: #7d776d;
    --cool: #4fb39d;
    --warn-bg: #3a3014;
    --warn-text: #f0d68a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
h2 { font-size: 18px; margin: 0 0 16px; }
h3 { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.spacer { flex: 1; }

/* ===== 01-meny.css ===== */
/* --- Topbar --- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.logo {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  background: var(--accent); color: var(--accent-text); border-radius: 8px; font-size: 13px; letter-spacing: .5px;
}
/* Menyn: de vanligaste flikarna i raden, resten under Mer. På smala skärmar blir hela menyn en knapp
   som visar var man är och öppnar en lista (se längre ned). */
.tabs { position: relative; min-width: 0; }
.nav-list { display: flex; align-items: center; gap: 4px; }
.nav-toggle { display: none; }
.tab-more { position: relative; }
.tab-more-btn { display: inline-flex; align-items: center; gap: 4px; }
.tab-more-btn svg, .nav-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.tab-more.open .tab-more-btn svg, .tabs.open .nav-toggle svg { transform: rotate(180deg); }
.tab-more-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 200px; padding: 6px;
  flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
}
.tab-more.open .tab-more-menu { display: flex; }
.tab-more-menu .tab { text-align: left; width: 100%; }
.nav-version { margin: 4px 0 0; padding: 6px 14px 2px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); white-space: nowrap; }
.tab {
  border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; flex: none;
}
.brand { flex: none; }
.tab:hover { color: var(--text); background: var(--surface-2); }
/* Vyer som gymmet stängt av för personen (allowedViews i form.js). */
.tab.view-off { display: none !important; }
.tab.active { color: var(--accent); background: var(--accent-soft); }

/* Notisbricka på en flik (chatten, Drift) */
.tab-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.tab-badge[hidden] { display: none; }

/* Menyn på smala skärmar: en knapp med vyns namn som öppnar alla val i en lista. */
@media (max-width: 860px) {
  .tabs { flex: 1; }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 8px 12px; border-radius: 10px; cursor: pointer;
    border: 1px solid var(--border); background: var(--accent-soft); color: var(--accent); font: inherit; font-weight: 700;
  }
  #nav-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-list {
    display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: min(280px, calc(100vw - 24px)); padding: 6px;
    flex-direction: column; align-items: stretch; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
  }
  .tabs.open .nav-list { display: flex; }
  .nav-list .tab { text-align: left; width: 100%; padding: 10px 12px; font-size: 15px; }
  .tab-more-btn { display: none; }
  .nav-version { padding: 8px 12px 2px; }
  .tab-more-menu { display: flex; position: static; padding: 0; border: 0; box-shadow: none; min-width: 0; border-top: 1px solid var(--border); padding-top: 4px; margin-top: 2px; border-radius: 0; }
}
@media print { .tab-more-menu, .nav-list { display: none !important; } }

.nav-dot { min-width: 8px; width: 8px; height: 8px; padding: 0; margin-left: 0; }
.nav-dot[hidden], .tab-badge[hidden] { display: none; }

.tab:focus-visible, .nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Länken till webbplatsen sist i menyn: en tunn linje ovanför och en pil som visar att den leder bort från appen. */
.tab-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-decoration: none; border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; margin-top: 2px; }
.tab-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }

/* Appen för iOS och Android (nativeapp.js): bara appens vyer i menyn, inga länkar till webbplatsen
   (Om TrainMax, provperioden) och i kontomenyn bara Mitt konto och Logga ut. Integritetspolicyn och
   villkoren nås från Mitt konto. */
.native-app .tab.app-off, .native-app .tab-link, .native-app .tab-more-btn, .native-app .site-footer,
.native-app .trial-cta, .native-app [data-my="gyms"],
.native-app [data-account-action]:not([data-account-action="my-account"], [data-account-action="logout"], [data-account-action="exit-demo"]) { display: none !important; }
.native-app #result > .empty-state { display: none; }
.native-app .tab-more-menu { display: flex; position: static; padding: 0; border: 0; box-shadow: none; min-width: 0; background: none; }
/* iOS zoomar in när ett fält med mindre text än 16 px får fokus – och sidan blir förskjuten i appen. */
.native-app :is(input, select, textarea) { font-size: 16px; }

/* ===== 02-konto.css ===== */
/* --- Konto --- */
.account { margin-left: auto; position: relative; display: flex; align-items: center; gap: 8px; }
.lang-btn {
  font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .04em; cursor: pointer; min-width: 36px; height: 30px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 0 8px;
}
.lang-btn:hover { border-color: var(--accent); color: var(--text); }
.account-btn {
  display: flex; align-items: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 14px 5px 6px;
}
.account-btn:hover, .account-btn[aria-expanded="true"] { border-color: var(--accent); }
.account-btn svg {
  width: 26px; height: 26px; padding: 4px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.account-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 320px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 16px 48px rgba(0,0,0,.3);
}
.account-form { padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.account-form h3 { margin-bottom: 8px; }
.account-form .field { margin-bottom: 10px; }
.account-form > .btn:not(.big) { width: 100%; margin-top: 6px; }
.account-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
/* Logga in med Apple och Google (bara i appen). Apple: svart knapp enligt Apples riktlinjer. */
.oauth-buttons { display: grid; gap: 8px; margin-top: 10px; }
.oauth-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.oauth-or::before, .oauth-or::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.oauth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.oauth-btn svg { width: 18px; height: 18px; flex: none; }
.btn.oauth-btn.oauth-apple { background: #000; color: #fff; border-color: #000; }
.btn.oauth-btn.oauth-google { background: #fff; color: #1f1f1f; border-color: #747775; }
.identity-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.account-who-block { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.role-badge {
  align-self: flex-start; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.role-badge.reset { background: var(--warn-bg); color: var(--warn-text); }
body:not(.is-admin) .admin-only { display: none !important; }
body:not(.is-logged-in) .requires-login { display: none !important; }
body.is-logged-in .logged-out-only { display: none !important; }
.login-gate { text-align: center; padding: 48px 24px; }
.login-gate p { margin: 0 0 16px; }

/* --- Användare (administratör) --- */
.users-layout { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
.users-table-panel { grid-column: 1 / -1; }
.request-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.request-list li { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }
.request-info p { margin: 4px 0 0; font-size: 13px; }
.request-actions, .user-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.new-user-form .btn { width: 100%; }
.temp-password { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--accent); margin: 8px 0; }
.temp-password code { flex: 1; font-size: 22px; font-weight: 700; letter-spacing: 1px; user-select: all; }

main { padding: 24px; max-width: 1480px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }
#view-create.active { display: grid; grid-template-columns: 400px 1fr; gap: 24px; align-items: start; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}

/* --- Drift --- */
.drift-layout { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.drift-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.drift-head h2 { margin: 0; }
.error-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.error-list > li:not(.error-none) { border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.error-list summary { display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
.error-list summary::-webkit-details-marker { display: none; }
.error-source { flex: none; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-text); }
.error-source.server { background: var(--danger); color: #fff; }
.error-message { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.error-count { flex: none; font-weight: 700; }
.error-when { flex: none; font-size: 13px; }
.error-detail { margin: 0 12px 10px; display: grid; grid-template-columns: 120px 1fr; gap: 4px 12px; font-size: 13px; }
.error-detail dt { color: var(--muted); }
.error-detail dd { margin: 0; overflow-wrap: anywhere; }
.error-detail pre { margin: 0; white-space: pre-wrap; font-size: 12px; max-height: 240px; overflow: auto; }
.error-list details > .btn { margin: 0 12px 12px; }
.drift-facts { margin: 0; padding-left: 1.1em; display: grid; gap: 10px; line-height: 1.5; }
@media (max-width: 980px) { .drift-layout { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .error-list summary { flex-wrap: wrap; }
  .error-detail { grid-template-columns: 1fr; }
}

/* --- Kontosidan (länkar i mejl) --- */
.konto { max-width: 460px; margin: 24px auto; padding: 0 16px; }
.konto-panel h1 { margin-top: 0; font-size: 24px; }
.konto-panel .btn.big { width: 100%; }

/* --- Mitt konto --- */
.account-page { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; align-items: start; max-width: 1040px; }
.account-page h2 { margin-top: 0; }
.account-page .hint { margin-top: 0; }
.account-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.my-gyms { list-style: none; margin: 0 0 12px; padding: 0; }
.my-gyms li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.my-gyms li:last-child { border-bottom: 0; }
.my-shares { list-style: none; margin: 0 0 12px; padding: 0; max-height: 420px; overflow-y: auto; }
.my-shares li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.my-shares li:last-child { border-bottom: 0; }
.my-shares li > div { min-width: 0; display: grid; gap: 2px; }
.my-shares a { font-weight: 600; overflow-wrap: anywhere; }

/* --- Demoläge och provperiod --- */
.mode-banner {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; font-size: 14px; background: var(--accent-soft); color: var(--text); border-bottom: 1px solid var(--border);
}
.mode-banner[hidden] { display: none; }
.mode-banner.demo { background: var(--warn-bg); color: var(--warn-text); }
.mode-banner.soon { background: var(--warn-bg); color: var(--warn-text); }
.trial-cta { width: 100%; margin-top: 12px; }

/* --- Översikt (master) --- */
.master-page { display: grid; gap: 20px; }
.master-head .field { max-width: 420px; margin-top: 8px; }
.master-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0; }
.master-stats strong { font-size: 20px; }
.master-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.master-list > summary { cursor: pointer; list-style: none; }
.master-list > summary::-webkit-details-marker { display: none; }
.master-list > summary h2 { display: inline; }
.master-list > summary h2::before { content: '▸ '; color: var(--muted); }
.master-list[open] > summary h2::before { content: '▾ '; }
.master-list .table-wrap { margin-top: 12px; }
.master-table td { vertical-align: top; }
.trial-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.trial-list li { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: 14px; }
.chain-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
@media (max-width: 860px) {
  .master-grid { grid-template-columns: 1fr; }
  .trial-list li { flex-direction: column; }
}

/* --- Guiden för ett nytt gym --- */
.onboard-dialog { width: min(720px, 94vw); }
.onboard-dialog h2 { margin-top: 4px; }
.onboard-dialog h3 { margin: 16px 0 8px; }
.onboard-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 16px; counter-reset: step; flex-wrap: wrap; }
.onboard-steps li {
  counter-increment: step; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 4px 10px; border-radius: 999px; background: var(--surface-2);
}
.onboard-steps li::before { content: counter(step) '. '; }
.onboard-steps li.active { background: var(--accent); color: var(--accent-text); }
.onboard-steps li.done { background: var(--accent-soft); color: var(--accent); }
.onboard-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.onboard-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.onboard-equipment { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; margin-bottom: 10px; }
.onboard-eq { margin: 0; }
.onboard-eq span { font-size: 13px; }
.onboard-eq.zero span { color: var(--muted); }
.onboard-invites { display: grid; gap: 8px; }
.onboard-invite { display: grid; grid-template-columns: 1fr 220px; gap: 8px; }
.onboard-tips { padding-left: 20px; display: grid; gap: 6px; }
@media (max-width: 560px) {
  .onboard-invite { grid-template-columns: 1fr; }
}

/* --- Statistik --- */
.stats-page { display: grid; gap: 20px; }
.stats-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 20px; }
.stats-controls h2 { margin: 0 auto 6px 0; }
.stats-controls .field { margin: 0; min-width: 200px; }
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 8px; }
.stats-cards > div { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; }
.stats-cards strong { font-size: 26px; line-height: 1.1; }
.stats-cards span { color: var(--muted); font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.stats-grid h3 { margin: 0 0 10px; }
.stats-grid h3:not(:first-child) { margin-top: 18px; }
.stats-wide { grid-column: 1 / -1; }
.sbars { display: grid; gap: 6px; }
.sbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.sbar.inline { grid-template-columns: minmax(80px, 1fr) auto; min-width: 180px; }
.sbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sbar-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.sbar-track i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.sbar-val { font-weight: 700; white-space: nowrap; }
.sbar-val small { color: var(--muted); font-weight: 600; }
.scols { display: flex; align-items: flex-end; gap: 4px; height: 170px; padding-top: 18px; }
.scol { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.scol i { display: block; width: 100%; max-width: 44px; background: var(--accent); border-radius: 5px 5px 0 0; min-height: 2px; }
.scol-val { font-size: 12px; font-weight: 700; }
.scol-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.stats-table .stats-tip { color: var(--muted); font-size: 13px; }
.stats-table tr.inactive td { color: var(--muted); }
@media (max-width: 860px) {
  .stats-grid { grid-template-columns: 1fr; }
  .scols { gap: 2px; }
  .scol-label { font-size: 9px; }
}

/* --- Tvåstegsverifiering --- */
.twofa-dialog { width: min(560px, 94vw); }
.twofa-steps { padding-left: 20px; display: grid; gap: 14px; line-height: 1.5; }
.twofa-secret { display: flex; align-items: center; gap: 10px; margin: 8px 0 6px; flex-wrap: wrap; }
.twofa-secret code { font-size: 18px; font-weight: 700; letter-spacing: 1px; padding: 6px 10px; background: var(--surface-2); border-radius: 8px; user-select: all; }
.twofa-code-form { display: flex; gap: 8px; margin-top: 8px; }
.twofa-code-form input { width: 140px; font-size: 20px; letter-spacing: 2px; text-align: center; }
.twofa-codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; margin: 12px 0; }
.twofa-codes code { font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.twofa-panel-form { margin-top: 8px; }

/* ===== 03-skapa-pass.css ===== */
/* --- Form --- */
.form-panel { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > span, .field > summary { font-weight: 600; font-size: 13px; }
.row { display: flex; gap: 12px; }
.row > .field { flex: 1; }
input, select, textarea {
  font: inherit; color: inherit; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field > label { font-weight: 600; font-size: 13px; }
.format-note { font-size: 12px; color: var(--accent); font-weight: 600; }
@keyframes flash-select { 0%, 60% { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); } 100% { box-shadow: none; } }
select.flash { animation: flash-select 1.6s ease-out; }
.select-info { display: flex; align-items: center; gap: 8px; }
.info {
  position: relative; flex: none; display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%; cursor: help;
  border: 1.5px solid var(--muted); color: var(--muted);
  font: italic 700 13px/1 Georgia, serif;
}
.info:hover, .info:focus { border-color: var(--accent); color: var(--accent); outline: none; }
.tooltip {
  position: absolute; right: -6px; bottom: calc(100% + 10px); z-index: 20; width: 280px;
  padding: 10px 12px; border-radius: 8px; background: var(--text); color: var(--bg);
  font: 400 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .15s, transform .15s, visibility .15s; pointer-events: none;
}
.tooltip strong { display: block; margin-bottom: 2px; }
.tooltip::after {
  content: ''; position: absolute; right: 12px; top: 100%;
  border: 6px solid transparent; border-top-color: var(--text);
}
.info:hover .tooltip, .info:focus .tooltip { opacity: 1; visibility: visible; transform: none; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: auto; }
.field.check { flex-direction: row; font-weight: 400; }

.segmented { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.segmented button {
  flex: 1; border: 0; background: none; font: inherit; font-size: 14px; color: var(--muted);
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
/* Träningsformerna (och gymmets passkoncept) i tre kolumner – de är fler än som ryms på en rad. */
.segmented[data-name="category"] { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }

details.equipment summary { cursor: pointer; margin-bottom: 4px; }
.equipment-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.eq-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.eq-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.eq-label { font-size: 13px; font-weight: 600; }
.eq-total { font-size: 12px; color: var(--accent); font-weight: 600; }
.eq-total.zero { color: var(--muted); }
.eq-simple { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.eq-simple .eq-label { flex: 1; }
.mini-field { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.mini-field input { width: 64px; }
.eq-load { flex-basis: 100%; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.equipment-list input { padding: 5px 8px; font-size: 13px; background: var(--surface); }
.equipment-list input.zero { opacity: .55; }
.stock-rows { display: flex; flex-direction: column; gap: 4px; }
.stock-row { display: grid; grid-template-columns: 72px auto 60px auto 1fr; align-items: center; gap: 6px; font-size: 13px; }
.stock-row .icon-btn { justify-self: end; }
.link-btn { border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 0 0; cursor: pointer; }

.combo { position: relative; }
.suggestions {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 5; margin: 4px 0 0; padding: 4px;
  list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  max-height: 260px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.suggestions li { padding: 6px 10px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.suggestions li small { color: var(--muted); }
.suggestions li.active, .suggestions li:hover { background: var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; font-size: 13px;
  background: var(--accent-soft); color: var(--text); border-radius: 999px;
}
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 6px; }

.btn {
  font: inherit; font-weight: 600; font-size: 14px; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.big { width: 100%; padding: 12px; font-size: 16px; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary:disabled { filter: saturate(.5); }

/* --- Kända pass --- */
.benchmark-info { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; line-height: 1.5; }
.benchmark-info ul { margin: 6px 0; padding-left: 1.2em; }
.benchmark-info p { margin: 6px 0 0; }
.disabled-by-benchmark { opacity: .5; }
.disabled-by-benchmark::after { content: 'Bestäms av det kända passet'; font-size: 12px; color: var(--muted); }
.tag.accent-soft { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.paste-dialog { width: min(820px, 96vw); }
.paste-parts { display: grid; gap: 6px; margin: 6px 0; }
.paste-part { display: grid; grid-template-columns: minmax(160px, 2fr) 80px 70px 80px 80px 32px; gap: 6px; align-items: center; }
.paste-part.unknown select { border-color: var(--danger); }
.paste-part input, .paste-part select { min-width: 0; }
.paste-label { font-weight: 600; font-size: 13px; }
.paste-numbers { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.paste-numbers [hidden], #paste-scope-field[hidden], #paste-bank-field[hidden] { display: none; }
.warn-box { padding: 8px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-text); font-size: 13px; }
@media (max-width: 600px) {
  .paste-part { grid-template-columns: 1fr 1fr 1fr; }
  .paste-part select[data-k="ex"] { grid-column: 1 / -1; }
}

/* Löpning */
#session-form.running-mode .no-run, #session-form.spin-mode .no-run { display: none; }
.equipment[hidden], .equipment-missing[hidden], .equipment-missing-form[hidden], #missing-kg-field[hidden],
.run-only[hidden], .spin-only[hidden], .wheel-only[hidden], .concept-only[hidden], #concept-workout-field[hidden], .test-field[hidden] { display: none; }
#session-form.wheel-mode .no-run { display: none; }
.wheel-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.wheel-row .field { margin: 0; }

/* Passlängd och deltagare som passkonceptet bestämmer */
.field input[readonly] { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }

/* Kända pass: dolt när träningsformen saknar sådana */
.benchmark-field.no-benchmarks { display: none; }

/* Skapa pass: snabbläget visar bara det viktigaste */
.form-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 4px; }
.form-head h2 { margin: 0; }
.form-mode button { padding: 6px 12px; font-size: 13px; }
.quick-only { display: none; }
#session-form.quick .quick-only { display: block; }
#session-form.quick .adv-only { display: none !important; }

/* Hjälpmedel eller vikt saknas: ett litet formulär under knappen. */
.equipment-missing { gap: 6px; }
.equipment-missing > .link-btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; }
.equipment-missing > .link-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.equipment-missing > .link-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.equipment-missing-form { display: grid; grid-template-columns: 1fr 110px 90px; gap: 8px; align-items: end; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.equipment-missing-form .field { margin: 0; }
.equipment-missing-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 520px) { .equipment-missing-form { grid-template-columns: 1fr 1fr; } .equipment-missing-form .field:first-child { grid-column: 1 / -1; } }

/* ===== 04-pass.css ===== */
/* --- Result --- */
.result { min-width: 0; }
.empty-state {
  text-align: center; padding: 80px 40px; color: var(--muted);
  border: 2px dashed var(--border); border-radius: var(--radius);
}
.empty-state h3 { color: var(--text); margin-bottom: 8px; }
.empty-icon { font-size: 40px; margin-bottom: 12px; }

.session { display: flex; flex-direction: column; gap: 16px; }
.session-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.session-head h1 { margin: 0 0 8px; font-size: 26px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.tag.accent { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.session > div.panel:first-of-type { position: relative; }
/* Ikonraden flyter till höger: rubriken och taggarna tar platsen bredvid, och blir raden lång bryts den. */
.icon-actions { float: right; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 100%; margin: 0 0 8px 16px; }
/* Rubriken flyter runt ikonraden; taggarna börjar under den så att de får hela bredden. */
.session > div.panel:first-of-type .session-head { display: block; }
.session > div.panel:first-of-type .session-head .tags { clear: right; }
.icon-actions { gap: 6px; }
.icon-action {
  position: relative; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted);
}
.icon-action:hover:not(:disabled), .icon-action:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.icon-action:disabled { opacity: .4; cursor: default; }
.icon-action:disabled::after { display: none; }
.icon-action.done { color: var(--cool); border-color: var(--cool); cursor: default; }
.icon-action.board-start-btn {
  width: auto; padding: 0 14px 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-size: 14px; font-weight: 700; line-height: 1;
  background: var(--accent); border-color: var(--accent); color: var(--accent-text);
}
.icon-action.board-start-btn:hover, .icon-action.board-start-btn:focus-visible { color: var(--accent-text); filter: brightness(1.08); }
.icon-action svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Etikett som visas direkt när man håller pekaren över ikonen */
.icon-action[data-tip]::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 8px); right: 0; z-index: 30;
  white-space: nowrap; font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 6px;
  background: var(--text); color: var(--bg); box-shadow: 0 4px 14px rgba(0,0,0,.2);
  opacity: 0; transform: translateY(-3px); transition: opacity .12s, transform .12s; pointer-events: none;
}
.icon-action:hover::after, .icon-action:focus-visible::after { opacity: 1; transform: none; }

.timeline { margin-top: 16px; clear: both; }
.timeline-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; }
.timeline-bar .seg { min-width: 4px; }
.timeline-legend {
  list-style: none; margin: 10px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px;
}
.timeline-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.timeline-legend .tl-name { font-weight: 600; }
.timeline-legend .tl-min { color: var(--muted); white-space: nowrap; }
.timeline-legend .tl-time { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.timeline .warmup { background: var(--warm); }
.timeline .brief, .timeline .rest { background: var(--brief); }
.timeline .main { background: var(--main); }
.timeline .main.finisher { background: var(--accent); }
.timeline .cooldown { background: var(--cool); }

.warnings { background: var(--warn-bg); color: var(--warn-text); border-radius: var(--radius); padding: 12px 16px; font-size: 14px; }
.warnings ul { margin: 6px 0 0; padding-left: 20px; }
.time-warning { margin-bottom: 12px; font-weight: 600; }
@media print { .time-warning { display: none; } }

.blocks { display: grid; gap: 12px; }
.block { border-left: 5px solid var(--border); }
.block.warmup { border-left-color: var(--warm); }
.block.main { border-left-color: var(--main); }
.block.cooldown { border-left-color: var(--cool); }
.block.brief, .block.rest { border-left-color: var(--brief); padding: 12px 20px; }
.block-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.block-head h3 { font-size: 17px; }
.block-min { font-weight: 700; color: var(--muted); white-space: nowrap; }
.block-format { font-size: 20px; font-weight: 700; margin: 8px 0 2px; }
.block-desc { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
.block.brief .block-desc, .block.rest .block-desc { margin: 2px 0 0; }
.section-head { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 14px 0 6px; }
.items { list-style: none; margin: 0; padding: 0; }
.items li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.items li:last-child { border-bottom: 0; }
.item-label { font-size: 12px; font-weight: 700; color: var(--accent); min-width: 68px; }
.item-text { flex: 1 1 220px; min-width: 0; font-weight: 500; }
.item-people {
  font-size: 12px; font-weight: 600; white-space: nowrap; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--text); min-width: 92px; text-align: center;
}
.item-people small { font-weight: 400; color: var(--muted); }
.item-people.placeholder { visibility: hidden; padding-top: 0; padding-bottom: 0; }
@media (max-width: 600px) { .item-people.placeholder { display: none; } }
.main .item-text { font-size: 16px; }
.item-weight { margin-left: auto; font-size: 13px; color: var(--muted); text-align: right; }

.explain h2 { margin-bottom: 10px; }
.explain p { margin: 0 0 10px; }
.explain .lead { font-size: 15px; }
.explain { position: relative; }
.explain h2 { padding-right: 44px; }
.expand-btn {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px;
  display: grid; place-items: center; list-style: none; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; color: var(--muted); background: var(--surface);
}
.expand-btn::-webkit-details-marker { display: none; }
.expand-btn:hover, .expand-btn:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.expand-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.explain-more .icon-min, .explain-more[open] .icon-max { display: none; }
.explain-more[open] .icon-min { display: block; }
.explain-more[open] > p:first-of-type { margin-top: 4px; }
.reasons { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.reasons li { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }
.reasons strong { font-size: 14px; }
.reasons p { grid-column: 1 / -1; margin: 0; font-size: 14px; color: var(--muted); }
.ratings { display: flex; gap: 14px; font-size: 12px; color: var(--muted); align-items: center; }
.dots { display: inline-flex; gap: 2px; vertical-align: middle; margin-left: 4px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border); display: inline-block; }
.dots i.on { background: var(--accent); }
.load { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 4px; font-size: 14px; }
.load b { font-size: 20px; }

/* --- Övningsbilder --- */
.items li.has-image { cursor: zoom-in; border-radius: 6px; }
.items li.has-image:hover, .items li.has-image:focus { background: var(--surface-2); outline: none; }
.img-hint {
  display: inline-block; width: 14px; height: 11px; margin-left: 8px; vertical-align: middle; opacity: .45;
  border: 1.5px solid currentColor; border-radius: 3px; position: relative;
}
.img-hint::after { content: ''; position: absolute; left: 2px; bottom: 1px; border: 3px solid transparent; border-bottom: 4px solid currentColor; }
.ex-preview {
  position: fixed; z-index: 40; width: 380px; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0,0,0,.3); overflow: hidden;
}
.ex-preview img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--surface-2); }
.preview-body { padding: 10px 14px 12px; }
.preview-name { font-weight: 700; }
.preview-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.preview-credit { font-size: 11px; color: var(--muted); margin-top: 6px; opacity: .8; }
.ex-cell { display: flex; gap: 10px; align-items: flex-start; }
.thumb { width: 48px; height: 32px; border-radius: 4px; object-fit: cover; flex: none; background: var(--surface-2); }
.thumb.empty { display: inline-block; border: 1px dashed var(--border); }

/* --- Byt övning --- */
.items li.swappable { cursor: pointer; border-radius: 6px; position: relative; padding-right: 30px; }
.items li.swappable:hover, .items li.swappable:focus-visible { background: var(--surface-2); outline: none; }
.items li.swappable::after {
  content: '⇄'; position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  color: var(--accent); font-weight: 700; opacity: 0; transition: opacity .12s;
}
.items li.swappable:hover::after, .items li.swappable:focus-visible::after { opacity: 1; }
.manual-tag {
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--accent); color: var(--accent); white-space: nowrap;
}
.swap-dialog { width: min(680px, 94vw); }
.swap-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.swap-tools input[type=search] { flex: 1; min-width: 200px; }
.swap-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: min(52vh, 520px); overflow-y: auto; display: grid; gap: 4px; }
.swap-row {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; color: inherit;
  background: none; border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; cursor: pointer;
}
.swap-row:hover:not(:disabled), .swap-row:focus-visible { background: var(--surface-2); border-color: var(--border); outline: none; }
.swap-row:disabled { opacity: .45; cursor: not-allowed; }
.swap-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.swap-name { font-weight: 600; }
.swap-sub { font-size: 12px; color: var(--muted); }
.similar { font-size: 11px; font-weight: 600; margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.swap-empty { padding: 16px; text-align: center; }

/* --- Ändra mängd --- */
.amount {
  font: inherit; font-weight: 700; color: inherit; background: none; cursor: text;
  border: 0; border-bottom: 1.5px dashed var(--muted); padding: 0 1px; border-radius: 0;
}
.amount:hover, .amount:focus-visible { color: var(--accent); border-bottom-color: var(--accent); outline: none; }
.amount.changed { color: var(--accent); border-bottom-style: solid; border-bottom-color: var(--accent); }
.weight-btn { font-size: 13px; font-weight: 600; color: var(--muted); text-align: right; }
.weight-btn.empty { font-weight: 500; opacity: .7; }
.weight-input { width: 11em; font-size: 13px; }
.weight-warning { color: var(--warn-text); margin-right: 6px; cursor: help; }
.amount-input {
  width: 4.5em; padding: 1px 6px; font: inherit; font-weight: 700; display: inline-block;
  border: 1.5px solid var(--accent); border-radius: 6px; background: var(--surface);
}

/* --- Stationer med flera övningar --- */
.station-options { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px; }
.station-options select { width: auto; }
.station-options select:disabled { opacity: .5; }
.station-options .hint { flex-basis: 100%; margin: 0; }
.item-note { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.items li.station-cont { border-top: 0; }
.items li.station-cont .item-label { color: var(--muted); text-align: center; }
.items li.station-start:not(:first-child) { border-top: 2px solid var(--border); }
.items li:has(+ li.station-cont) { border-bottom-style: dashed; }

/* --- Lägga till och ta bort --- */
.item-remove {
  border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer;
  padding: 2px 6px; border-radius: 6px; opacity: 0; transition: opacity .12s; order: 10;
}
.items li:hover .item-remove, .items li:focus-within .item-remove { opacity: 1; }
.item-remove:hover, .item-remove:focus-visible { color: var(--danger); background: var(--surface-2); outline: none; opacity: 1; }
.add-exercise {
  margin-top: 6px; border: 1px dashed var(--border); background: none; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer; width: 100%; text-align: left;
}
.add-exercise:hover, .add-exercise:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
/* Ny huvudpassdel: en streckad rad mellan delarna, där den nya delen hamnar. */
.add-main-part {
  width: 100%; padding: 12px 16px; border: 1.5px dashed var(--border); border-radius: var(--radius); background: none;
  color: var(--muted); font: inherit; font-weight: 700; text-align: left; cursor: pointer;
}
.add-main-part:hover, .add-main-part:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
@media print { .add-main-part { display: none; } }
@media (hover: none) { .item-remove { opacity: .7; } }

/* --- Ändra tid på block --- */
.block-min.editable {
  font: inherit; font-weight: 700; color: var(--muted); background: none; cursor: text;
  border: 0; border-bottom: 1.5px dashed var(--muted); padding: 0 1px;
}
.block-min.editable:hover, .block-min.editable:focus-visible { color: var(--accent); border-bottom-color: var(--accent); outline: none; }
.block-min.editable.changed { color: var(--accent); border-bottom-style: solid; border-bottom-color: var(--accent); }
.block-min-edit { font-weight: 700; color: var(--muted); white-space: nowrap; }
.block-min-input { width: 4em; }

/* --- Flytta övningar --- */
.drag-handle {
  cursor: grab; color: var(--muted); user-select: none; touch-action: none;
  font-weight: 700; letter-spacing: -3px; padding: 4px 6px 4px 2px; margin-left: -2px; line-height: 1; opacity: .6;
}
.drag-handle:hover { color: var(--accent); opacity: 1; }
.is-dragging, .is-dragging * { cursor: grabbing !important; user-select: none; }
.items li.dragging { opacity: .35; }
.items li.drop-target { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.drag-ghost {
  position: fixed; z-index: 60; margin: 0; padding: 0 10px; pointer-events: none; list-style: none;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,.35); opacity: .95;
}
.drag-ghost li { border-bottom: 0 !important; }
.drag-ghost li::after { display: none; }

/* Ändringar i ett sparat pass som inte sparats än */
.unsaved-bar {
  position: sticky; top: 72px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 10px 14px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn-text);
  border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 14px; font-weight: 600;
}
@media print { .unsaved-bar { display: none; } }

/* --- Affisch för väggen --- */
.poster-dialog { width: min(1000px, 96vw); }
.poster-options { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 20px; margin-bottom: 12px; }
.poster-options .field { margin: 0; min-width: 180px; }
.poster-preview { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 8px; }
.poster-page { position: absolute; top: 0; transform-origin: top left; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.25); box-sizing: border-box; }
.poster-sheet {
  display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box;
  background: #fff; color: #111; line-height: 1.18; font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.poster-sheet .p-head { display: flex; align-items: center; gap: .6em; padding-bottom: .35em; margin-bottom: .45em; border-bottom: .12em solid var(--accent); }
.poster-sheet .p-head img { height: 2.6em; width: auto; object-fit: contain; }
.poster-sheet .p-head h1 { font-size: 2.1em; line-height: 1.05; margin: 0; color: #000; }
.poster-sheet .p-head p { margin: .15em 0 0; font-size: .75em; color: #555; font-weight: 600; }
.poster-sheet .p-blocks { flex: 1; min-height: 0; }
.poster-sheet[data-columns="2"] .p-blocks { column-count: 2; column-gap: 1.4em; }
.poster-sheet .p-block { break-inside: avoid; margin: 0 0 .6em; padding-left: .45em; border-left: .22em solid var(--accent); }
.poster-sheet .p-side { font-size: .72em; border-left-color: #bbb; }
.poster-sheet .p-mini { font-size: .62em; display: flex; justify-content: space-between; gap: 1em; border-left-color: #ddd; color: #555; }
.poster-sheet .p-block header { display: flex; justify-content: space-between; align-items: baseline; gap: .5em; }
.poster-sheet h3 { margin: 0; font-size: 1.15em; color: #000; }
.poster-sheet .p-mini h3 { font-size: 1em; color: #555; }
.poster-sheet .p-min { font-weight: 700; white-space: nowrap; }
.poster-sheet .p-min small { color: #777; font-weight: 600; font-size: .7em; margin-left: .3em; }
.poster-sheet .p-format { font-size: .78em; font-weight: 700; color: var(--accent); margin: .1em 0 .2em; }
.poster-sheet ul { list-style: none; margin: 0; padding: 0; }
.poster-sheet li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .35em; padding: .08em 0; font-weight: 600; }
.poster-sheet li.p-sec { font-size: .62em; text-transform: uppercase; letter-spacing: .05em; color: #777; margin-top: .3em; }
.poster-sheet .p-label { font-weight: 800; color: var(--accent); min-width: 1.2em; }
.poster-sheet .item-weight { color: #444; font-weight: 700; font-size: .85em; }
.poster-sheet .item-weight .weight-warning { display: none; }
.poster-sheet .item-people { font-size: .6em; color: #555; font-weight: 700; background: none; border: .08em solid #bbb; padding: 0 .4em; border-radius: 1em; }
.poster-sheet .item-people.placeholder { display: none; }
#poster-print { display: none; }
@media print {
  body.printing-poster > *:not(#poster-print) { display: none !important; }
  body.printing-poster { background: #fff !important; }
  body.printing-poster #poster-print { display: block; }
}

/* Skalningsalternativ: lättare och svårare variant */
.item-scale { display: block; color: var(--muted); font-size: 12px; }
.b-scale { color: var(--muted); font-size: .8em; margin-top: 2px; }
.b-list .b-scale { display: block; }

/* Tom plats i ett pass med bara mallen – klicka och välj övningen. */
.items li.placeholder-item .item-text { color: var(--muted); font-style: italic; }
.items li.placeholder-item { border: 1px dashed var(--border); border-radius: 6px; }

/* Kort sammanfattning av passet och delar som kan minimeras */
.session-summary { display: grid; gap: 10px; }
.sum-chips { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.sum-chip { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); font-weight: 700; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.sum-chip svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sum-lead { font-size: 17px; font-weight: 600; margin: 0; }
.sum-text { margin: 0; color: var(--muted); line-height: 1.5; }
.sum-text strong { color: inherit; }
.sum-equip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.sum-sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }
.sum-tool { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; }
.block-head:has(.block-toggle) { align-items: center; }
.block-head-end { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.block-toggle {
  display: grid; place-items: center; flex: none; width: 34px; height: 34px; padding: 0; line-height: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted);
}
.block-toggle:hover, .block-toggle:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.block-toggle svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transform-origin: 50% 50%; transition: transform .15s; }
.block.collapsed .block-toggle svg { transform: rotate(-90deg); }
.block.collapsed .block-body { display: none; }
@media print {
  .block-toggle { display: none; }
  .block.collapsed .block-body { display: block; }
}
/* Övning för övning: minimerad tills man öppnar den, och aldrig med i utskriften. */
.exercise-explain > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; }
.exercise-explain > summary::-webkit-details-marker { display: none; }
.exercise-explain > summary h2 { margin: 0; padding-right: 0; }
.exercise-explain[open] > summary { margin-bottom: 10px; }
.exercise-explain:not([open]) .block-toggle svg { transform: rotate(-90deg); }
.exercise-explain > summary:hover .block-toggle, .exercise-explain > summary:focus-visible .block-toggle { color: var(--accent); border-color: var(--accent); }
.exercise-explain > summary:focus-visible { outline: none; }
@media print { .exercise-explain { display: none !important; } }

/* TrainMax egna tecknade övningsbilder: visas hela (beskärs inte) på ljus botten */
img[src^="/figures/"] { object-fit: contain; background: #fff; }
.thumb[src^="/figures/"] { width: 40px; height: 40px; }

/* ===== 05-ovningsdatabas.css ===== */
/* --- Database --- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; }
.table-wrap { overflow-x: auto; }
.db-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.db-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.db-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.db-table tr.inactive td { opacity: .45; }
.db-table .ex-name { font-weight: 600; }
.db-table .ex-sub { font-size: 12px; color: var(--muted); }
.mini { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); margin: 0 3px 3px 0; white-space: nowrap; }
.mini.hyrox { background: #fde8db; border-color: #f7c4a5; color: #8a3200; }
.mini.hiit { background: #e3f1ff; border-color: #b6d7f7; color: #0b4f8a; }
.mini.crossfit { background: #e8f6ee; border-color: #b7e1c7; color: #1c6b3c; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 4px 6px; border-radius: 6px; font-size: 14px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* --- Egna övningsbilder --- */
.photo-dialog { width: min(640px, 94vw); }
.photo-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 4px 0 8px; }
.photo-slot { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.photo-slot.busy { opacity: .5; pointer-events: none; }
.photo-label { font-weight: 700; font-size: 13px; }
.photo-slot img, .photo-empty { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #fff; }
.photo-empty { display: grid; place-items: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); }
.photo-origin { font-size: 12px; }
.photo-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.photo-actions label.btn { cursor: pointer; }
@media (max-width: 600px) { .photo-slots { grid-template-columns: 1fr; } }
.drift-sub { margin: 20px 0 4px; font-size: 15px; }
.rate-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.rate-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.rate-list li.blocked { border-left: 3px solid var(--danger); }
.rate-status { font-weight: 700; color: var(--warn-text); }
.rate-list li.blocked .rate-status { color: var(--danger); }

.mini.warn { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; font-weight: 600; }

/* ===== 06-planering.css ===== */
/* --- Saved --- */
.saved-layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
.saved-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.saved-list li { padding: 10px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.saved-list li:hover { background: var(--surface-2); }
.saved-list li.active { border-color: var(--accent); background: var(--accent-soft); }
.saved-list .s-name { font-weight: 600; }
.saved-list .s-meta { font-size: 12px; color: var(--muted); }

/* --- Planering --- */
.date-row { display: grid; grid-template-columns: 1fr 120px; gap: 8px; }
.planning { display: grid; gap: 16px; }
.planning-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.week-nav { display: flex; align-items: center; gap: 8px; }
.week-nav h2 { margin: 0 6px; font-size: 18px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day { min-height: 140px; padding: 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.week-day.today { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.week-day-head { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.week-day-head strong { font-size: 16px; color: var(--text); }
.week-empty { color: var(--border); font-size: 13px; }
.plan-card { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.plan-card:hover, .plan-card.active { border-color: var(--accent); }
.plan-card strong { font-size: 13px; line-height: 1.25; overflow-wrap: anywhere; }
.plan-card small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.plan-time { font-size: 11px; font-weight: 700; color: var(--accent); }
/* Flytta pass genom att dra */
.plan-card.movable { touch-action: manipulation; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.plan-card.dragging { opacity: .35; }
.plan-ghost { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; box-shadow: 0 12px 30px rgba(0,0,0,.3); border-color: var(--accent); }
body.plan-dragging, body.plan-dragging * { cursor: grabbing !important; user-select: none; }
.week-day.drop-target { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
body.plan-dragging #week-prev, body.plan-dragging #week-next { outline: 2px dashed var(--accent); outline-offset: 2px; }
.week-hint { margin: 8px 0 0; }
.toast-action { margin-left: 10px; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.planning-bottom { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.planning-bottom h2 { margin-top: 0; }
.program-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.program-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.program-list .muted { font-size: 13px; }
.program-actions { display: flex; gap: 6px; flex: none; }
.program-dialog { width: min(680px, 96vw); }
.weekday-row { display: flex; flex-wrap: wrap; gap: 6px; }
.day-check { display: inline-flex; }
.day-check input { position: absolute; opacity: 0; pointer-events: none; }
.day-check span { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; font-weight: 600; cursor: pointer; }
.day-check input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.day-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.test-field select { margin-top: 6px; }
@media (max-width: 980px) {
  .week-grid { grid-template-columns: 1fr; }
  .week-day { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .week-day-head { width: 60px; }
  .planning-bottom { grid-template-columns: 1fr; }
}

/* --- Till bokningssystemet och kalenderlänken --- */
.booking-options { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 4px 0 12px; }
#booking-text { width: 100%; font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.planning-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.planning-actions { align-items: center; }
.plan-filter select { width: auto; }
.plan-filter select.filtered { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.week-copy-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; max-height: 320px; overflow-y: auto; }
.week-copy-list .check { align-items: flex-start; }
.week-copy-list strong { text-transform: capitalize; }
.ical-link { display: flex; gap: 8px; margin: 10px 0 6px; }
.ical-link input { flex: 1; font-size: 13px; }
.ical-help { margin: 8px 0; font-size: 14px; }
.ical-help summary { cursor: pointer; font-weight: 600; }
.ical-help ul { padding-left: 20px; line-height: 1.6; }

/* --- Sök bland sparade pass --- */
.plan-search { flex: 1 1 260px; max-width: 420px; }
.plan-search input { width: 100%; }
.week-nav.dimmed { opacity: .45; }
.search-results h2 { margin-top: 0; }
.search-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.search-hit {
  width: 100%; display: grid; grid-template-columns: 170px 1fr; gap: 2px 14px; align-items: baseline; text-align: left;
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); border-left: 3px solid var(--accent);
  background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer;
}
.search-hit:hover, .search-hit.active { border-color: var(--accent); }
.search-when { grid-row: span 3; color: var(--muted); font-size: 13px; font-weight: 600; }
.search-hit small { color: var(--muted); }
.search-ex { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.search-ex .tag { font-size: 11px; }
@media (max-width: 640px) {
  .search-hit { grid-template-columns: 1fr; }
  .search-when { grid-row: auto; }
  .plan-search { max-width: none; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.week-grid[hidden], .planning-bottom[hidden], .search-results[hidden], .week-hint[hidden] { display: none; }

/* --- Duplicera och mallar --- */
.save-repeat { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.save-repeat[hidden] { display: none; }
.save-repeat input[type=number] { width: 64px; }
.icon-action.starred { color: #e0a100; border-color: #e0a100; }
.icon-action.starred svg { fill: currentColor; }
.template-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* Anteckningar för coacher */
.coach-notes h3 { margin: 0 0 4px; font-size: 16px; }
.coach-notes.muted-panel { opacity: .85; }
.note-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.note-list li { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border-left: 3px solid var(--accent); }
.note-list li.muted { background: none; border: 0; padding: 0; }
.note-list p { margin: 4px 0 0; white-space: normal; }
.note-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.note-head .link-btn { margin-left: auto; font-size: 12px; }
.note-form { display: flex; gap: 8px; align-items: flex-end; }
.note-form textarea { flex: 1; font: inherit; resize: vertical; }
.note-badge { font-weight: 600; color: var(--muted); }
@media print { .coach-notes { display: none !important; } }

/* Min träning: månadskalender med mina pass och historiken */
.mt-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.mt-head .muted { margin: 0; }
.mt-calendar { flex: 1 1 100%; margin-top: 8px; }
#mine-title::first-letter, #events-title::first-letter, .mt-month::first-letter { text-transform: uppercase; }
.mt-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.mt-dow { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0 4px; }
.mt-day { min-height: 92px; padding: 6px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mt-day.other { opacity: .45; }
.mt-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.mt-date { font-size: 13px; font-weight: 700; color: var(--muted); }
.mt-day.today .mt-date { color: var(--accent); }
.mt-dow-inline { display: none; }
.mt-pass { display: flex; flex-direction: column; gap: 1px; text-align: left; padding: 5px 7px; border-radius: 7px; border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; min-width: 0; }
.mt-pass strong, .mt-pass small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-pass small { color: var(--muted); }
.mt-pass:hover, .mt-pass:focus-visible { border-color: var(--accent); outline: none; }
.mt-day.past .mt-pass { border-left-color: var(--muted); }
.mt-time { font-weight: 700; color: var(--accent); font-size: 11px; }
.mt-history-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.mt-history-head h2 { margin: 0; }
.mt-history-head .muted { margin: 2px 0 0; }
.mt-month { font-size: 15px; margin: 18px 0 6px; }
.mt-month .muted { font-weight: 400; font-size: 13px; }
.mt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mt-row { width: 100%; display: grid; grid-template-columns: 130px minmax(0, 1fr) minmax(0, 180px); gap: 12px; align-items: center; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.mt-row:hover, .mt-row:focus-visible { border-color: var(--accent); outline: none; }
.mt-when, .mt-what { display: flex; flex-direction: column; min-width: 0; }
.mt-when small, .mt-what small { color: var(--muted); font-size: 12px; }
.mt-what strong, .mt-what small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-where { color: var(--muted); font-size: 13px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#mine-older { margin-top: 14px; }
#mine-older[hidden] { display: none; }
@media (max-width: 720px) {
  .mt-grid { grid-template-columns: 1fr; }
  .mt-dow { display: none; }
  .mt-day { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .mt-day.empty, .mt-day.other { display: none; }
  .mt-dow-inline { display: inline; }
  .mt-date { min-width: 64px; }
  .mt-pass { flex: 1 1 180px; }
  .mt-row { grid-template-columns: 96px minmax(0, 1fr); }
  .mt-where { grid-column: 2; text-align: left; }
}

/* Event: gymmens eventkalender (samma månadsvy som Min träning) */
#event-new[hidden] { display: none; }
.ev-pass { border-left-color: var(--cool); }
.ev-pass .mt-time { color: var(--cool); }
#events-upcoming .mt-row { border-left: 3px solid var(--cool); }
#event-view { max-width: 520px; width: calc(100vw - 32px); padding: 22px 24px; }
#event-view h2 { margin-top: 0; }
.ev-when { margin: 4px 0; }
.ev-desc { white-space: pre-line; line-height: 1.5; }
.ev-by { font-size: 12px; }

/* Min träning: kom igång-rutan för nya användare */
.panel.welcome { position: relative; border: 1px solid var(--accent); background: linear-gradient(135deg, var(--accent-soft), var(--surface) 60%); }
.welcome[hidden] { display: none; }
.welcome h2 { margin: 0 32px 10px 0; }
.welcome-close { position: absolute; top: 10px; right: 10px; font-size: 20px; }
.welcome-steps { margin: 0 0 14px; padding-left: 22px; display: grid; gap: 8px; }
.welcome-steps li strong { display: block; }
.welcome-steps li span { color: var(--muted); font-size: 14px; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== 07-dialoger.css ===== */
/* --- Dialogs --- */
dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0; width: min(760px, 94vw);
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog form, .dialog-body { padding: 24px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; align-items: center; }
.error { color: var(--danger); font-size: 14px; }
.status { font-weight: 600; min-height: 1.5em; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px; font-size: 14px; z-index: 50;
}

/* ===== 08-chatt.css ===== */
/* --- Chattassistent --- */
.chat-toggle {
  position: fixed; right: 20px; bottom: 20px; z-index: 45; width: 56px; height: 56px; border-radius: 50%;
  border: 0; background: var(--accent); color: var(--accent-text); cursor: pointer; display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.3); transition: transform .15s;
}
.chat-toggle:hover { transform: scale(1.06); }
.chat-toggle[aria-disabled="true"] { background: var(--surface-2); color: var(--muted); box-shadow: none; cursor: not-allowed; opacity: .7; }
.chat-toggle[aria-disabled="true"]:hover { transform: none; }
.chat-toggle svg, .chat-send svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-toggle.open { transform: scale(.9); }
.chat-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 46; width: min(400px, calc(100vw - 40px)); height: min(620px, calc(100vh - 120px));
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden;
}
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.chat-head div { display: flex; flex-direction: column; }
.chat-head small { font-size: 11px; }
.chat-head .icon-btn { font-size: 20px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; }
.chat-msg p { margin: 0 0 6px; }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-msg ul { margin: 4px 0 6px; padding-left: 18px; }
.chat-msg li { margin-bottom: 4px; }
.chat-msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.chat-msg.bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.ex-chip { font-weight: 700; color: var(--accent); }
.chat-cards { display: grid; gap: 6px; margin-top: 8px; }
.chat-card { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; }
.chat-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chat-card-body strong { font-size: 13px; }
.chat-card-body small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-card .ratings { font-size: 10px; gap: 8px; }
.chat-must {
  border: 1px solid var(--accent); background: none; color: var(--accent); font: inherit; font-size: 12px; font-weight: 600;
  padding: 4px 8px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.chat-must.on { background: var(--accent); color: var(--accent-text); }
.typing { display: flex; gap: 4px; padding: 12px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--border); }
.chat-form textarea { resize: none; max-height: 120px; font-size: 14px; }
.chat-send { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-text); cursor: pointer; display: grid; place-items: center; }
.chat-send svg { width: 20px; height: 20px; }

/* ---------- Instruktörschatt ---------- */
body:not(.is-logged-in) .logged-in-only { display: none !important; }
.tab-badge.dot { min-width: 8px; height: 8px; padding: 0; line-height: 8px; vertical-align: middle; }
.chat-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.chat-sidebar { position: sticky; top: 80px; display: grid; gap: 10px; max-height: calc(100vh - 110px); overflow: auto; }
.chat-gym summary { cursor: pointer; font-weight: 700; padding: 4px 0; list-style-position: outside; }
.chat-channels { list-style: none; margin: 4px 0 6px; padding: 0 0 0 12px; display: grid; gap: 2px; }
.chat-channel { width: 100%; display: flex; align-items: center; gap: 6px; border: 0; background: none; font: inherit; color: var(--muted); padding: 6px 8px; border-radius: 6px; cursor: pointer; text-align: left; }
.chat-channel:hover { background: var(--surface-2); color: var(--text); }
.chat-channel.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.chat-channel.unread { color: var(--text); font-weight: 700; }
.chat-channel > span:first-child { flex: 1; }
.chat-mine { color: var(--cool); font-size: 12px; }
.chat-count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 11px; line-height: 18px; text-align: center; color: var(--text); }
.chat-count.mention { background: var(--danger); border-color: var(--danger); color: #fff; }
.chat-my { margin-left: 12px; }
.chat-main { display: flex; flex-direction: column; min-height: 60vh; max-height: calc(100vh - 110px); padding: 0; overflow: hidden; }
.panel.chat-main { padding: 0; } /* vinner över panelernas utfyllnad på mobilen */
.chat-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.chat-head h2 { margin: 0; font-size: 18px; }
.chat-who { font-size: 13px; max-width: 60%; }
.chat-messages { flex: 1; overflow: auto; padding: 12px 16px; display: grid; gap: 10px; align-content: start; }
.chat-empty { text-align: center; padding: 40px 0; }
.chat-msg { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
.chat-msg.reply { margin-left: 44px; }
.chat-msg.tagged .chat-body { border-left: 3px solid var(--danger); padding-left: 8px; }
.chat-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.chat-msg.mine .chat-avatar { background: var(--surface-2); color: var(--text); }
.chat-meta { font-size: 13px; display: flex; align-items: baseline; gap: 6px; }
.chat-more { margin-left: auto; padding: 0 8px; font-size: 18px; line-height: 1; }
.chat-msg-quote { margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 9em; overflow: auto; }
.chat-msg-actions { display: grid; gap: 8px; margin-bottom: 12px; }
.chat-msg-actions .btn { justify-content: flex-start; text-align: left; }
.chat-msg-actions[hidden], #chat-report-form[hidden] { display: none; }
.chat-blocks-btn { margin-left: 12px; }
.chat-block-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.chat-text { white-space: normal; overflow-wrap: anywhere; margin-top: 2px; }
.chat-quote { font-size: 12px; }
.chat-swap { margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); display: grid; gap: 4px; font-size: 14px; }
.chat-swap.open { border-color: var(--accent); background: var(--accent-soft); }
.chat-swap-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-status { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.chat-status.open { border-color: var(--accent); color: var(--accent); }
.chat-status.taken { border-color: var(--cool); color: var(--cool); }
.chat-swap-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chat-compose { border-top: 1px solid var(--border); padding: 10px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.chat-compose textarea { resize: vertical; min-height: 44px; font: inherit; }
.chat-replying { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.chat-replying[hidden] { display: none; }
.chat-mine-list { display: grid; gap: 6px; margin: 10px 0; }
@media (max-width: 760px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { position: static; max-height: none; }
  .chat-main { max-height: none; min-height: 50vh; }
  .chat-who { max-width: 100%; }
}

/* ===== 09-tavla.css ===== */
/* ---------- Tavelläge ---------- */

body.board-open { overflow: hidden; }
.board {
  --b-bg: #0f0e0c; --b-surface: #1c1a17; --b-border: #34302a; --b-text: #f6f2ea; --b-muted: #a39d93;
  --b-work: var(--brand, #ff7a2f); --b-work-text: var(--brand-text, #1a0d04); --b-rest: #4fb39d; --b-switch: #f2c94c;
  position: fixed; inset: 0; z-index: 1000; background: var(--b-bg); color: var(--b-text);
  display: flex; flex-direction: column; overflow: auto; color-scheme: dark;
}
.board button { font: inherit; color: inherit; }
.board svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.board kbd { font: inherit; font-size: .85em; padding: 1px 6px; border: 1px solid var(--b-border); border-radius: 5px; background: var(--b-surface); }

/* Startskärm */
.board-start { position: relative; margin: auto; width: min(640px, 100%); padding: 48px 16px; text-align: center; }
.board-start h1 { margin: 4px 0 6px; font-size: clamp(28px, 5vw, 44px); }
.b-kicker { margin: 0; text-transform: uppercase; letter-spacing: .12em; font-size: 13px; font-weight: 700; color: var(--b-work); }
.b-meta { margin: 0 0 24px; color: var(--b-muted); }
.b-close { position: fixed; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--b-border); background: var(--b-surface); cursor: pointer; display: grid; place-items: center; }
.b-blocks { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 6px; text-align: left; }
.b-block {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer; text-align: left;
  border: 1px solid var(--b-border); border-radius: 10px; background: var(--b-surface);
}
.b-block:hover, .b-block:focus-visible { border-color: var(--b-work); outline: none; }
.b-block::after { content: 'Starta här'; font-size: 12px; color: var(--b-muted); opacity: 0; }
.b-block:hover::after, .b-block:focus-visible::after { opacity: 1; }
.b-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--b-muted); flex: none; }
.b-block.warmup .b-dot { background: var(--b-work); }
.b-block.main .b-dot { background: var(--b-text); }
.b-block.finisher .b-dot { background: var(--b-switch); }
.b-block.cooldown .b-dot { background: var(--b-rest); }
.b-bname { flex: 1; font-weight: 600; }
.b-bmin { color: var(--b-muted); font-variant-numeric: tabular-nums; }
.b-option { display: flex; justify-content: center; gap: 8px; align-items: center; margin-bottom: 20px; color: var(--b-muted); cursor: pointer; }
.b-option input { width: 18px; height: 18px; accent-color: var(--b-work); }
.b-go { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; padding: 14px 32px; border-radius: 14px; }
.b-go svg { fill: currentColor; stroke: none; }
.b-hint { margin-top: 22px; color: var(--b-muted); font-size: 14px; line-height: 1.9; }

/* Pågående pass */
.board-run { flex: 1; display: flex; flex-direction: column; height: 100%; min-height: 0; padding: clamp(14px, 2vw, 28px); gap: clamp(10px, 2vh, 24px); }
.b-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.b-title { font-size: clamp(18px, 2.2vw, 30px); font-weight: 800; }
.b-title span { font-weight: 500; color: var(--b-muted); }
.b-sub { margin-top: 4px; color: var(--b-muted); font-size: clamp(14px, 1.4vw, 20px); }
.b-tools { display: flex; gap: 8px; flex: none; }
.b-tools button, .b-controls button {
  width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--b-border); border-radius: 12px; background: var(--b-surface);
}
.b-tools button:hover, .b-controls button:hover { border-color: var(--b-work); }

.b-main { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(16px, 3vw, 48px); align-items: center; min-height: 0; overflow: auto; }
.b-main.stacked { grid-template-columns: 1fr; grid-template-rows: auto 1fr; align-items: start; gap: clamp(8px, 1.5vh, 20px); }
.b-main.stacked .b-clockwrap { display: flex; justify-content: center; align-items: baseline; gap: .4em; }
.b-main.stacked .b-phase { font-size: clamp(20px, 2.6vw, 40px); }
.b-main.stacked .b-clock { font-size: clamp(56px, 9vw, 150px); }
.b-main.stacked .b-content { font-size: clamp(13px, 1.25vw, 22px); }
.b-clockwrap { text-align: center; }
.b-phase { font-size: clamp(22px, 3.2vw, 48px); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; min-height: 1.2em; color: var(--b-work); }
.b-clock { font-size: clamp(88px, 15vw, 260px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.phase-rest .b-phase, .phase-rest .b-clock { color: var(--b-rest); }
.phase-switch .b-phase, .phase-switch .b-clock { color: var(--b-switch); }
.phase-prep .b-phase, .phase-prep .b-clock, .phase-hold .b-phase { color: var(--b-switch); }
.phase-block .b-phase { display: none; }
.b-holdhint { margin-top: 10px; color: var(--b-muted); font-size: clamp(14px, 1.4vw, 22px); }
.b-main.stacked .b-holdhint { display: none; }
.board-run.paused .b-phase { color: var(--b-muted); }
.board-run.paused .b-clock { opacity: .55; }
.board-run.ending .b-clock { animation: b-pulse 1s ease-in-out infinite; }
@keyframes b-pulse { 50% { transform: scale(1.05); } }

.b-content { min-width: 0; font-size: clamp(16px, 1.6vw, 26px); }
.b-desc { margin: 0 0 14px; color: var(--b-muted); line-height: 1.45; }
.b-sections { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.b-section h3 { margin: 0 0 6px; font-size: .8em; text-transform: uppercase; letter-spacing: .06em; color: var(--b-work); }
.b-section ul { margin: 0; padding-left: 1.1em; line-height: 1.5; }
.b-section small { color: var(--b-muted); }

.b-item.big { display: flex; gap: 20px; align-items: center; }
.b-img { width: clamp(120px, 18vw, 280px); aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; background: #fff; flex: none; }
.b-item.big .b-text { font-size: clamp(30px, 3.8vw, 64px); font-weight: 800; line-height: 1.1; }
.b-weight { margin-top: 6px; color: var(--b-switch); font-weight: 600; }
.b-note { margin-top: 4px; color: var(--b-muted); font-size: .85em; }
.b-people { margin-top: 8px; color: var(--b-muted); }
.b-group { display: inline-block; white-space: nowrap; padding: 2px 10px; border-radius: 999px; background: var(--b-work); color: var(--b-work-text); font-weight: 800; font-size: .8em; }

.b-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 10px; }
.b-station { padding: 12px 14px; border-radius: 12px; background: var(--b-surface); border: 1px solid var(--b-border); }
.b-station-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; white-space: nowrap; margin-bottom: 6px; color: var(--b-muted); font-size: .8em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.b-station .b-text { font-weight: 700; }
.b-station .b-text + .b-text { margin-top: 4px; }
.b-station .b-weight { font-size: .8em; }

.b-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; counter-reset: b; }
.b-list li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 10px 14px; border-radius: 12px; background: var(--b-surface); border: 1px solid var(--b-border); }
.b-list .b-text { font-weight: 700; font-size: 1.15em; }
.b-list .b-weight { margin: 0; font-size: .85em; }
.b-label { color: var(--b-muted); font-size: .8em; font-weight: 700; }

.b-bottom { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'next controls' 'progress progress' 'times times'; gap: 10px 16px; align-items: center; }
.b-next { grid-area: next; font-size: clamp(18px, 2vw, 32px); font-weight: 700; }
.b-controls { grid-area: controls; display: flex; gap: 8px; }
.b-controls .b-play { width: 56px; background: var(--b-work); border-color: var(--b-work); color: var(--b-work-text); }
.b-controls .b-play svg { fill: currentColor; stroke: none; }
.b-progress { grid-area: progress; display: flex; gap: 3px; height: 12px; }
.b-seg { position: relative; padding: 0; border: 0; border-radius: 4px; background: var(--b-surface); overflow: hidden; cursor: pointer; }
.b-seg.current { outline: 2px solid var(--b-muted); outline-offset: 1px; }
.b-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--b-muted); }
.b-seg.warmup .b-fill { background: var(--b-work); }
.b-seg.main .b-fill { background: var(--b-text); }
.b-seg.finisher .b-fill { background: var(--b-switch); }
.b-seg.cooldown .b-fill { background: var(--b-rest); }
.b-times { grid-area: times; color: var(--b-muted); font-size: 14px; font-variant-numeric: tabular-nums; }

/* Kontrollerna tonas ut när musen är still */
.board.idle .b-tools, .board.idle .b-controls { opacity: 0; transition: opacity .6s; }
.board.idle { cursor: none; }

@media (max-width: 900px), (orientation: portrait) {
  .b-main { grid-template-columns: 1fr; align-items: start; }
  .b-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 600px) {
  .b-item.big { flex-direction: column; align-items: flex-start; }
  .b-bottom { grid-template-columns: 1fr; grid-template-areas: 'next' 'controls' 'progress' 'times'; }
  .b-controls { justify-content: center; }
  .icon-action.board-start-btn span { display: none; }
  .icon-action.board-start-btn { width: 38px; padding: 0; }
}

/* TV-koppling på tavlans startskärm */
.b-tv { margin: 0 auto 22px; padding: 14px 16px; max-width: 460px; border: 1px solid var(--b-border); border-radius: 12px; background: var(--b-surface); text-align: left; }
.b-tv-status { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.b-tv-status span { flex: 1; }
.b-link { background: none; border: 0; padding: 0; color: var(--b-muted); text-decoration: underline; cursor: pointer; font-size: 14px; }
.b-tv-form { display: flex; gap: 8px; margin-top: 10px; }
.b-tv-form input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--b-border); background: var(--b-bg); color: var(--b-text);
  font: inherit; font-size: 18px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase;
}
.b-tv-form input:focus { outline: none; border-color: var(--b-work); }
.b-tv-help { margin: 8px 0 0; font-size: 13px; color: var(--b-muted); line-height: 1.5; }
.b-tv-msg { margin: 6px 0 0; font-size: 14px; font-weight: 600; color: var(--b-switch); }
.b-tv-msg:empty { display: none; }

/* Tavlan på TV:n: inga kontroller */
.board.display .b-tools, .board.display .b-controls, .board.display .b-close, .board.display .b-holdhint { display: none; }
.board.display .b-seg { cursor: default; pointer-events: none; }
.board.display { cursor: none; }

/* TV-sidan */
body.tv-page { background: #0f0e0c; color: #f6f2ea; color-scheme: dark; }
.tv-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 32px 16px; text-align: center; }
.tv-brand { font-size: clamp(20px, 2.4vw, 34px); }
.tv-lead { margin: 0; font-size: clamp(24px, 3.4vw, 54px); font-weight: 800; }
.tv-code {
  margin: 24px 0; font-size: clamp(64px, 13vw, 220px); font-weight: 800; letter-spacing: .08em; font-variant-numeric: tabular-nums;
  color: #ff7a2f; line-height: 1;
}
.tv-code span { display: inline-block; width: .35em; }
.tv-steps { display: inline-block; margin: 0 0 18px; padding-left: 1.3em; text-align: left; font-size: clamp(16px, 1.8vw, 28px); line-height: 1.6; }
.tv-small { margin: 10px 0 0; color: #a39d93; font-size: clamp(14px, 1.4vw, 22px); }
/* Ingen kontakt under ett pass: en liten markering – passet fortsätter enligt schemat. */
.tv-offline-badge {
  position: fixed; top: 12px; right: 16px; z-index: 1100; margin: 0; /* ovanpå tavlan, utan att skymma tidslinjen */
  padding: 6px 14px; border-radius: 999px; background: rgba(0, 0, 0, .65); color: #f1c27d;
  font-size: clamp(12px, 1.1vw, 18px); font-weight: 600; pointer-events: none;
}
.tv-sound { position: fixed; bottom: 16px; left: 0; right: 0; margin: 0; color: #a39d93; font-size: 14px; }
.tv-sound kbd { font: inherit; padding: 1px 6px; border: 1px solid #34302a; border-radius: 5px; }

/* ---------- Wheel of Suffer (tavelläget) ---------- */
.b-wheel { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4vmin; align-items: center; width: 100%; }
/* Nästa övning bredvid hjulet: bara texten – bilden visas när övningen körs. */
.w-result .b-img { display: none; }
.w-result .b-item.big { display: block; }
/* Övningen bredvid hjulet: mindre text som bryts mellan ord – aldrig mitt i ett ord. */
.w-result .b-item.big .b-text { font-size: clamp(20px, 3.6vmin, 48px); line-height: 1.12; overflow-wrap: break-word; word-break: normal; hyphens: manual; }
.w-wrap { position: relative; width: min(54vmin, 42vw); aspect-ratio: 1; margin: 0 auto; }
.w-pointer { position: absolute; top: -2.2vmin; left: 50%; transform: translateX(-50%); width: 0; height: 0; z-index: 2;
  border-left: 2.6vmin solid transparent; border-right: 2.6vmin solid transparent; border-top: 4.4vmin solid var(--b-work); filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.board .w-disc { display: block; width: 100%; height: 100%; max-width: none; border-radius: 50%; box-shadow: 0 0 0 1.2vmin var(--b-surface), 0 10px 40px rgba(0,0,0,.5); }
.w-disc.spinning { animation-name: w-spin; animation-timing-function: cubic-bezier(.1, .65, .12, 1); animation-fill-mode: both; }
.board-run.paused .w-disc.spinning, .board-run.paused .w-result { animation-play-state: paused; }
@keyframes w-spin { from { transform: rotate(0deg); } to { transform: rotate(var(--to)); } }
.w-slice path { stroke: var(--b-bg); stroke-width: 1; }
.w-slice path { fill: hsl(calc(var(--i) * 60 + 15) 70% 52%); }
.w-slice text { fill: #fff; font-size: 7.5px; font-weight: 700; paint-order: stroke; stroke: rgba(0,0,0,.35); stroke-width: 1.4px; }
.w-slice.done path { fill: var(--b-surface); }
.w-slice.done text { fill: var(--b-muted); stroke: none; text-decoration: line-through; }
.w-slice.hit path { stroke: #fff; stroke-width: 2.5; }
.w-hub { fill: var(--b-bg); stroke: #fff; stroke-width: 2; }
.w-result { animation: w-show .5s ease-out both; }
.w-result[hidden] { display: none; }
.w-kicker { color: var(--b-muted); text-transform: uppercase; letter-spacing: .08em; font-size: clamp(14px, 2vmin, 22px); margin-bottom: 1vmin; }
@keyframes w-show { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@media (max-width: 760px), (orientation: portrait) {
  .b-wheel { grid-template-columns: 1fr; }
  .w-wrap { width: min(80vw, 52vh); }
}

/* ===== 10-gym.css ===== */
/* --- Passbank --- */
.bank-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; margin-bottom: 14px; }
.bank-head h2 { margin-bottom: 4px; }
.bank-head p { margin: 0; max-width: 60ch; }
.bank-photo { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bank-photo .btn { cursor: pointer; }
.bank-photo.busy { opacity: .6; pointer-events: none; }
.bank-photo[hidden], .bank-photo .btn[hidden] { display: none; }
.bank-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bank-bar { margin-bottom: 16px; }
.bank-bar p { margin: 0 0 10px; }
.bank-bar .warnings { margin: 12px 0 0; }
.bank-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#bank-detail .icon-actions { display: none; }
#save-bank-field[hidden] { display: none; }

/* --- Gym --- */
.gym-field[hidden] { display: none; }
.gym-field select { width: 100%; }
#gym-hint.changed { color: var(--warn-text); }
.gym-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; }
.gym-actions:empty { display: none; }
.gyms-layout { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
.gym-list { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 6px; }
.gym-list li[data-gym] { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.gym-list li[data-gym]:hover, .gym-list li[data-gym]:focus-visible { border-color: var(--accent); outline: none; }
.gym-list li.active { border-color: var(--accent); background: var(--accent-soft); }
.gym-name { font-weight: 700; }
.gym-meta { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-top: 6px; font-size: 13px; }
.new-gym-form { border-top: 1px solid var(--border); padding-top: 16px; }
.new-gym-form h3 { margin: 0 0 10px; font-size: 15px; }
.new-gym-form .btn { width: 100%; }
.gym-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.gym-head h2 { margin: 0; }
#gym-detail h3 { margin: 22px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.gym-equipment { margin: 0; line-height: 1.6; }
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.member-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }
.member-views { flex-basis: 100%; font-size: 14px; }
.member-views summary { cursor: pointer; }
.member-views .check-row { margin-top: 8px; }
.member-list .muted { font-size: 13px; }
.member-actions { display: flex; gap: 6px; align-items: center; }
.add-member-form { display: grid; grid-template-columns: 1fr 160px auto; gap: 8px; align-items: end; margin-top: 16px; }
.add-member-form .field { margin: 0; }
@media (max-width: 980px) {
  .gyms-layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .add-member-form { grid-template-columns: 1fr; }
  .member-list li { flex-direction: column; align-items: flex-start; }
}
.segmented button[hidden] { display: none; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }
fieldset.gym-categories { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
fieldset.gym-categories legend { padding: 0; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
#category-hint { margin-top: 6px; }

/* --- Dela --- */
.share-link { display: flex; gap: 8px; margin: 14px 0 4px; }
.share-link input { flex: 1; min-width: 0; font-size: 14px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.share-actions a.btn { text-decoration: none; }

/* --- Gymlogga --- */
.gym-logo-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gym-logo { max-height: 64px; max-width: 220px; object-fit: contain; padding: 6px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--border); }
.gym-logo-row label.btn { cursor: pointer; }

/* --- Varumärke (gymkedja) --- */
.brand-logo { height: 32px; max-width: 140px; object-fit: contain; }
.brand-name { font-weight: 800; }
.brand-by { font-size: 11px; font-weight: 600; color: var(--muted); align-self: flex-end; margin-bottom: 3px; white-space: nowrap; }
.chains-panel { grid-column: 1 / -1; }
.chains-panel[hidden] { display: none; }
.chain-section { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.chain-members { list-style: none; margin: 6px 0 10px; padding: 0; }
.chain-members li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; }
.chain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: 1fr; }
.chain-list li { padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.chain-top { display: flex; align-items: center; gap: 10px; }
.chain-top input[type=color] { width: 34px; height: 34px; padding: 2px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.chain-logo { height: 28px; max-width: 100px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px 4px; }
.chain-gyms { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; margin: 8px 0 10px; }
.chain-gyms-label { font-weight: 700; margin-right: 2px; }
.chain-gym { border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; cursor: pointer; }
.chain-gym:hover { border-color: var(--accent); color: var(--accent); }
.chain-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 2px 8px 2px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.chain-badge::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--chain, var(--accent)); }
.gym-head .chain-badge { margin-top: 6px; }
.chain-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.chain-actions label.btn { cursor: pointer; }
.new-chain-form { display: grid; grid-template-columns: 1fr 90px auto; gap: 10px; align-items: end; margin-bottom: 16px; }
.new-chain-form[hidden] { display: none; }
.new-chain-form .field { margin: 0; }
.new-chain-form input[type=color] { height: 40px; padding: 2px; }
.gym-chain-select { width: 100%; max-width: 360px; }
@media (max-width: 600px) {
  .new-chain-form { grid-template-columns: 1fr; }
  .brand-by { display: none; }
  .brand-name { display: none; }
}
.tv-brand .brand-logo { height: clamp(32px, 4vw, 60px); max-width: 260px; }
.tv-code { color: var(--brand, #ff7a2f); }
.icon-action.danger:hover, .icon-action.danger:focus-visible { color: var(--danger); border-color: var(--danger); }

/* Kedjekortet täcker hela bredden: namn och knappar överst, tre spalter under. */
.chain-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.chain-top strong { font-size: 18px; }
.chain-actions { justify-content: flex-end; }
.chain-body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-top: 12px; }
.chain-body .chain-section { margin: 0; padding: 0; border: 0; min-width: 0; }
.chain-body .chain-gyms { margin: 8px 0 4px; }
.chain-body .add-member-form { grid-template-columns: 1fr auto; margin-top: 8px; }
.chain-list li.chain-card { padding: 16px 18px; }
@media (max-width: 960px) {
  .chain-body { grid-template-columns: 1fr; gap: 16px; }
  .chain-body .chain-section + .chain-section { padding-top: 14px; border-top: 1px solid var(--border); }
  .chain-actions { justify-content: flex-start; }
}
.chain-actions a.btn, .dpa-row a.btn { text-decoration: none; }

/* --- Passkoncept --- */
#session-form.concept-mode .no-concept { display: none; }
.segmented .concept-btn { border-style: dashed; }
.segmented .concept-btn.active { border-style: solid; }
.concept-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.concept-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.concept-dialog { width: min(860px, 96vw); }
.concept-dialog textarea { width: 100%; font: inherit; }
.concept-editor { display: grid; gap: 12px; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.concept-editor .field.wide { grid-column: 1 / -1; }
/* Byggaren: en egen vy (öppnas från Gym) – samma redigerare som granskningen, utan höjdgräns. */
.concept-builder { display: grid; gap: 16px; max-width: 1100px; margin: 0 auto; }
.cb-head { display: grid; gap: 10px; }
.cb-head > .link-btn { justify-self: start; }
.cb-head h1 { margin: 0; }
.cb-editor { max-height: none; overflow: visible; padding-right: 0; }
.cb-tools { display: inline-flex; gap: 4px; margin-left: auto; }
.cb-tools .icon-btn { width: 30px; height: 30px; }
.cb-add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.cb-preview-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px; }
.cb-preview-head h2 { margin: 0; }
.cb-preview-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cb-preview:not(:empty) { margin-top: 12px; }
/* Förhandsvisningen är bara för att titta – passets knappar (dela, skriv ut, starta) och redigering syns inte. */
.cb-preview .icon-actions, .cb-preview .block-toggle, .cb-preview .add-exercise, .cb-preview .add-main-part { display: none; }
.cb-preview .block-min.editable { pointer-events: none; border-bottom: 0; }
.cb-actions { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 76px 12px 0; /* plats för chattknappen */ background: var(--bg); border-top: 1px solid var(--border); }
.concept-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cb-export { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cb-texts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cb-texts .field { margin: 0; }
/* Förslag ur övningsdatabasen under fältet man skriver i (placeras med JS). */
.cb-suggest { position: fixed; right: auto; margin: 0; z-index: 40; max-width: 360px; }
/* En fast övning som inte finns i övningsdatabasen (visas som den står i passet). */
.cb-editor input.cb-unknown { border-color: var(--warn-text, #b7791f); border-style: dashed; }
.cb-texts textarea { width: 100%; font: inherit; resize: vertical; }
@media (max-width: 720px) { .cb-texts { grid-template-columns: 1fr; } }
.concept-workout { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; }
.concept-workout-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.concept-workout-head .field { flex: 1; min-width: 200px; margin: 0; }
.concept-variant { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.concept-variant h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 15px; }
.concept-variant h3 .field { margin: 0; flex-direction: row; align-items: center; gap: 4px; }
.concept-variant h3 input { width: 70px; }
.concept-part { border-left: 3px solid var(--accent); padding: 6px 0 6px 10px; display: grid; gap: 6px; }
.concept-part-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.concept-part-head input { flex: 1 1 180px; font-weight: 600; }
.concept-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.concept-fields .small-field { margin: 0; }
.concept-fields .small-field input { width: 80px; }
.with-unit { display: inline-flex; align-items: center; gap: 4px; }
.concept-slots { flex-basis: 100%; display: grid; gap: 6px; }
.concept-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.concept-slot input { width: 160px; }
.concept-slot input.rpe { width: 70px; }
.concept-slot select, .concept-editor .concept-fields select { width: auto; }
.concept-fixed { flex-basis: 100%; display: grid; gap: 6px; }
.concept-fixed-list { display: flex; flex-wrap: wrap; gap: 6px; }
.concept-fixed-list input { width: 200px; }
.concept-fixed-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.concept-fixed-row > strong { min-width: 100px; font-size: .9em; }
.concept-fixed-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.concept-fixed-slot input { width: 170px; }
.concept-fixed-item { display: flex; flex-direction: column; gap: 2px; flex: 1 1 100%; }
.concept-fixed-item input { width: 220px; }
.program-dialog .field[hidden] { display: none; }

/* Gymmets utrustning (dialog under Gym) */
.gym-equipment-dialog { width: min(900px, 96vw); }
#gym-equipment-body { display: grid; gap: 12px; max-height: 65vh; overflow-y: auto; padding-right: 4px; }
.geq-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.geq-item { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: grid; gap: 6px; background: var(--surface-2); }
.geq-item.zero { opacity: .6; }
.geq-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.geq-stock { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.geq-row { display: inline-flex; align-items: center; gap: 4px; }
.geq-row input { width: 64px; }
.geq-simple { display: flex; gap: 8px; flex-wrap: wrap; }
.geq-simple label { display: grid; gap: 2px; }
.geq-simple input[data-count] { width: 80px; }
.geq-loads { flex: 1; min-width: 140px; }
.geq-name { font-weight: 600; flex: 1; min-width: 0; }
.geq-add { display: flex; gap: 8px; }
.geq-add input { flex: 1; }
#gym-equipment-body h3 { margin: 8px 0 0; font-size: 15px; }

/* ===== 11-webbplats.css ===== */
/* --- Delat pass (deltagarnas sida) --- */
.shared { max-width: 760px; margin: 0 auto; padding: 16px; }
.shared-loading { text-align: center; padding: 40px 0; }
.shared-brand { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 0 16px; }
.shared-logo { max-height: 56px; max-width: 200px; object-fit: contain; }
.shared-gym { font-weight: 800; font-size: 18px; }
.share-page .session > div.panel:first-of-type .session-head h1 { padding-right: 0; }
.shared-item { cursor: pointer; flex-wrap: wrap; }
.shared-img { flex-basis: 100%; margin-top: 8px; order: 10; }
.shared-img img { width: 100%; max-width: 420px; border-radius: 10px; background: #fff; display: block; }
.shared-footer { text-align: center; font-size: 13px; margin: 16px 0 8px; }
.explain details summary { cursor: pointer; display: inline-block; }

/* --- Integritetspolicy och villkor --- */
.legal-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 820px; margin: 0 auto; padding: 16px; }
.legal-top a { color: inherit; text-decoration: none; }
.legal-top a:last-child { color: var(--accent); font-weight: 600; font-size: 14px; }
.legal-links { display: flex; align-items: center; gap: 16px; }
.legal { max-width: 820px; margin: 0 auto; padding: 8px 16px 32px; line-height: 1.6; }
.legal h1 { margin: 8px 0 4px; }
.legal h2 { margin: 28px 0 8px; font-size: 18px; }
.legal a { color: var(--accent); }
.legal-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.legal-table th { color: var(--muted); font-weight: 600; }
.site-footer { text-align: center; padding: 20px 16px 28px; font-size: 13px; color: var(--muted); }
.site-footer a { color: var(--muted); }
@media (max-width: 600px) {
  .legal-table thead { display: none; }
  .legal-table tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .legal-table td { display: block; border: 0; padding: 2px 0; }
  .legal-table td:first-child { font-weight: 500; }
}
.terms-check { align-items: flex-start; font-size: 13px; line-height: 1.45; margin: 4px 0 10px; }
.terms-check input { margin-top: 2px; }
.terms-check a, .account-legal a { color: var(--accent); }
.terms-check[hidden] { display: none; }
.account-data { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; }
.account-data .link-btn { text-align: left; padding: 2px 0; text-decoration: none; }
.danger-link { color: var(--danger) !important; }
.account-legal { margin-top: 4px; color: var(--muted); font-size: 12px; }
@media print { .site-footer { display: none; } }
.chat-undo { margin-top: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.chat-undo:hover { border-color: var(--accent); color: var(--accent); }
.chat-undone { margin: 6px 0 0; font-size: 12px; }

/* --- Webbplatsen (/om och /priser) --- */
.site-page { background: var(--bg); }
.site-top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px;
  padding: 12px max(16px, calc((100vw - 1200px) / 2)); background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.site-top .brand { color: var(--text); text-decoration: none; }
.site-nav { display: flex; gap: 20px; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--text); }
.site-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.site-login { color: var(--text); font-weight: 600; text-decoration: none; font-size: 15px; }
.site-actions .btn { text-decoration: none; }
.site { max-width: 1200px; margin: 0 auto; padding: 0 16px 48px; }
.site h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 16px; }
.site h2 { font-size: clamp(26px, 3.4vw, 38px); line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 24px; text-align: center; }
.site h3 { font-size: 20px; margin: 0 0 8px; }
.site p { line-height: 1.6; }
.site a.btn { text-decoration: none; }
.site-kicker { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 13px; margin: 0 0 12px; }
.site-lead { font-size: 19px; color: var(--muted); margin: 0 0 24px; }
.site-lead strong { color: var(--text); }
.site-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.site-fine { color: var(--muted); font-size: 14px; margin-top: 14px; }
.site-hero { display: grid; grid-template-columns: 1fr 1.25fr; gap: 48px; align-items: center; padding: 56px 0 48px; }
.site-shot { margin: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); box-shadow: 0 24px 60px rgba(0,0,0,.14), 0 4px 12px rgba(0,0,0,.06); background: var(--surface); }
.site-shot img { display: block; width: 100%; height: auto; }
.site-shot.phone { max-width: 280px; margin: 0 auto; border-radius: 32px; border: 8px solid #1a1916; }
.site-why { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; padding: 32px 0 64px; }
.site-why > div, .site-grid.cards > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.site-why h3 { font-size: 18px; }
.site-why p, .site-grid.cards p { color: var(--muted); margin: 0; font-size: 15px; }
.site-features { padding: 32px 0; }
.site-feature { display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; align-items: center; margin: 0 0 72px; }
.site-feature.reverse > figure { order: 2; }
.site-feature.phone { grid-template-columns: 1fr 1.3fr; }
.site-feature.phone.reverse { grid-template-columns: 1.3fr 1fr; }
.site-feature h3 { font-size: 26px; line-height: 1.2; }
.site-feature p { color: var(--muted); font-size: 17px; }
.site-feature ul { padding-left: 20px; line-height: 1.8; }
.site-all, .site-who, .site-steps, .site-faq { padding: 40px 0; }
.site-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; list-style: none; padding: 0; margin: 0; }
.site-grid.cards { grid-template-columns: repeat(5, 1fr); }
.site-all li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.site-all li strong, .site-steps li strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.site-steps ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; list-style: none; padding: 0; margin: 0; counter-reset: step; }
.site-steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; color: var(--muted); line-height: 1.5; }
.site-steps li::before { content: counter(step); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 800; margin-bottom: 12px; }
.site-faq { max-width: 780px; margin: 0 auto; }
/* Appen för Android (APK) och iPhone */
.site-apps { max-width: 780px; margin: 0 auto; padding: 40px 0; text-align: center; }
.site-apps > p { color: var(--muted); line-height: 1.5; }
.site-apps-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 20px; margin: 18px 0 8px; }
.site-apps-soon { color: var(--muted); font-weight: 600; }
.site-faq details { border-bottom: 1px solid var(--border); padding: 14px 0; }
.site-faq summary { cursor: pointer; font-weight: 700; font-size: 17px; }
.site-faq details p { color: var(--muted); margin: 10px 0 0; }
.site-final { text-align: center; background: var(--accent-soft); border-radius: 20px; padding: 48px 24px; margin: 40px 0 0; }
.site-final h2 { margin-bottom: 8px; }
.site-final > p:first-of-type { font-size: 18px; color: var(--muted); margin: 0 0 20px; }
.site-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; padding: 24px 16px 40px; }
.site-pricing-head { text-align: center; padding: 56px 0 24px; max-width: 720px; margin: 0 auto; }
.site-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; padding: 16px 0 40px; }
.site-plan { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; }
.site-plan.featured { border: 2px solid var(--accent); box-shadow: 0 16px 40px rgba(0,0,0,.1); }
.site-plan h2 { text-align: left; font-size: 24px; margin: 0 0 8px; }
.site-price { font-size: 22px; font-weight: 800; margin: 0 0 6px; }
.site-plan ul { padding-left: 20px; line-height: 1.8; margin: 16px 0 24px; flex: 1; }
.site-plan .btn { text-align: center; }
.site-price small { font-size: 15px; font-weight: 600; color: var(--muted); }
.site-price-sub { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
/* Pilotprogrammet för de första gymmen */
.site-pilot { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; margin: 8px 0 40px; padding: 32px 28px 28px; border: 2px dashed var(--accent); border-radius: 16px; background: var(--accent-soft); }
.site-pilot > div { flex: 1 1 420px; }
.site-pilot h2 { text-align: left; margin: 0 0 8px; }
.site-pilot ul { padding-left: 20px; line-height: 1.8; margin: 12px 0; }
.site-pilot .site-plan-tag { top: -12px; left: 24px; }
.site-pilot .btn { flex: none; width: auto; }
.site-plan-tag { position: absolute; top: -12px; left: 24px; background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
@media (max-width: 960px) {
  .site-nav { display: none !important; }
  .site-hero, .site-feature, .site-feature.phone, .site-feature.phone.reverse { grid-template-columns: 1fr; gap: 24px; }
  .site-feature.reverse > figure { order: 0; }
  .site-why, .site-grid.cards { grid-template-columns: 1fr 1fr; }
  .site-grid, .site-steps ol, .site-plans { grid-template-columns: 1fr; }
  .site-hero { padding-top: 32px; }
  .site-feature { margin-bottom: 48px; }
}
@media (max-width: 560px) {
  .site-top { gap: 10px; }
  .site-login { display: none; }
  .site-why, .site-grid.cards { grid-template-columns: 1fr; }
}
.site-cta .btn.big, .site-final .btn.big { width: auto; padding: 14px 26px; }
.site-page [hidden] { display: none !important; }
.site-hero-shots { position: relative; padding-bottom: 40px; }
.site-hero-shots .site-shot.phone { position: absolute; right: -12px; bottom: 0; width: 26%; max-width: 190px; border-width: 6px; border-radius: 24px; }
.site section[id] { scroll-margin-top: 80px; }
@media (max-width: 560px) { .site-hero-shots .site-shot.phone { right: 0; } }

/* --- PUB-avtalet --- */
.pub-acceptance { display: flex; flex-direction: column; gap: 2px; margin: 0 auto 8px; padding: 14px 18px; border: 2px solid #2f7d6d; border-radius: 10px; background: color-mix(in srgb, #2f7d6d 10%, var(--surface)); }
.pub-acceptance.pending { border-color: var(--accent); background: var(--accent-soft); }
.pub-acceptance[hidden] { display: none; }
@media print { .legal-top { display: none; } .pub-acceptance { border-width: 1px; } }
.dpa-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.dpa-row a.btn { text-decoration: none; }
.dpa-ok { color: #2f7d6d; font-weight: 600; }
.dpa-todo { color: var(--accent); font-weight: 600; }

/* Fem målgruppskort: en rad på bred skärm, 3 + 2 på mellanstor och ett per rad i mobilen. */
@media (max-width: 1100px) {
  .site-grid.cards { grid-template-columns: repeat(6, 1fr); }
  .site-grid.cards > div { grid-column: span 2; }
  .site-grid.cards > div:nth-child(n+4) { grid-column: span 3; }
}
@media (max-width: 560px) {
  .site-grid.cards { grid-template-columns: 1fr; }
  .site-grid.cards > div, .site-grid.cards > div:nth-child(n+4) { grid-column: auto; }
}

/* ===== 12-responsivt.css ===== */
/* --- Responsivt --- */
.ex-preview { max-width: calc(100vw - 24px); }
.tooltip { max-width: calc(100vw - 48px); }

/* Surfplatta och mindre: en kolumn */
@media (max-width: 980px) {
  #view-create.active, .saved-layout, .users-layout { grid-template-columns: 1fr; }
  .form-panel { position: static; max-height: none; overflow: visible; }
  /* Simulera-knappen följer med när man scrollar genom det långa formuläret */
  .form-panel .btn.big { position: sticky; bottom: 12px; z-index: 5; box-shadow: 0 6px 20px rgba(0,0,0,.25); width: calc(100% - 66px); }
}

/* Övningsdatabasen som kort när tabellen inte får plats */
@media (max-width: 900px) {
  .table-wrap { overflow: visible; }
  .db-table thead { display: none; }
  .db-table, .db-table tbody { display: block; }
  .db-table tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; position: relative;
    padding: 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
  }
  .db-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .db-table td[data-label]::before {
    content: attr(data-label); display: block; font-size: 11px; color: var(--muted);
    text-transform: uppercase; letter-spacing: .4px; margin-bottom: 2px;
  }
  .db-table .cell-name { grid-column: 1 / -1; padding-right: 110px; }
  .db-table .cell-active { position: absolute; top: 12px; right: 76px; }
  .db-table .cell-active::before { display: none !important; }
  .db-table .row-actions { position: absolute; top: 8px; right: 8px; }
  .db-table td[data-label="Kategorier"], .db-table td[data-label="Rörelsemönster"], .db-table td[data-label="Utrustning"] { grid-column: 1 / -1; }
}

/* Mobil */
@media (max-width: 600px) {
  main { padding: 12px; }
  .panel { padding: 16px; }
  .topbar { gap: 10px; padding: 8px 12px; }
  .brand { font-size: 0; gap: 0; }
  .logo { font-size: 13px; width: 30px; height: 30px; }
  .account-label { display: none; }
  .account-btn { padding: 4px; }
  .users-layout { grid-template-columns: 1fr; }
  .request-list li { flex-direction: column; }
  .tab { white-space: nowrap; padding: 7px 10px; font-size: 14px; }
  .row { flex-wrap: wrap; }
  .row > .field { min-width: 120px; }

  /* Passet */
  .session-head h1 { font-size: 22px; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; }
  .icon-actions { float: none; justify-content: flex-end; margin: 0 0 8px; }
  .block-format { font-size: 17px; }
  .items li { flex-wrap: wrap; gap: 4px 8px; padding: 9px 0; }
  .items li.swappable, .items li.has-image { padding-left: 6px; padding-right: 28px; }
  .item-label { min-width: 0; }
  .item-text { flex-basis: 100%; order: 3; }
  .item-weight { flex-basis: 100%; order: 4; white-space: normal; }
  .manual-tag { order: 2; }
  .items li .item-remove { position: absolute; top: 4px; right: 24px; }
  .main .item-text { font-size: 15px; }
  .timeline-legend { grid-template-columns: 1fr; gap: 4px; }
  .reasons li { grid-template-columns: 1fr; }

  /* Databasverktyg */
  .toolbar input[type=search] { max-width: none; flex-basis: 100%; }
  .toolbar select { flex: 1 1 28%; min-width: 0; font-size: 14px; padding: 8px 6px; }
  .toolbar .spacer { display: none; }
  .toolbar .btn { flex: 1 1 100%; }
  #db-count { flex-basis: 100%; order: -1; }

  /* Dialoger nästan i helskärm */
  dialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto auto 0; border-radius: 16px 16px 0 0; }
  dialog form, .dialog-body { padding: 18px 16px; }
  .swap-list { max-height: 55vh; }
  .swap-row .ratings { display: none; }
  .dialog-actions { position: sticky; bottom: 0; background: var(--surface); padding-top: 10px; }
  .chat-panel { right: 0; left: 0; bottom: 0; width: 100vw; height: 85vh; border-radius: 16px 16px 0 0; }
  .chat-toggle { right: 14px; bottom: 14px; }
}

/* Pekskärm: ingen hover, så visa bytesikonen hela tiden */
@media (hover: none) {
  .items li.swappable::after { opacity: .55; }
}

/* Mellanstora skärmar (gäller även mobilen – står sist så att den vinner) */
@media (max-width: 1100px) {
  .topbar { gap: 12px; }
  .tab { padding: 8px 10px; }
}

/* ===== 13-utskrift.css ===== */
/* --- Utskrift --- */
@media print {
  .amount { border: 0 !important; color: inherit !important; padding: 0; }
  :root { --bg: #fff; --surface: #fff; --surface-2: #f6f6f6; --text: #000; --main: #000; --border: #d8d8d8; --muted: #555; --accent: #e8590c; --accent-soft: #fde8db; --brief: #8a8378; --cool: #2f7d6d; --warn-bg: #fff; --warn-text: #000; color-scheme: light; }
  .topbar, .form-panel, .actions, .icon-actions, .board, .saved-list-panel, .toast, .ex-preview, .img-hint, .expand-btn, .chat-toggle, .chat-panel, .manual-tag, .drag-handle, .item-remove, .add-exercise, .weight-btn.empty, .weight-warning { display: none !important; }
  .block-min.editable { border: 0 !important; color: inherit !important; }
  main { padding: 0; }
  #view-create.active, .saved-layout { display: block; }
  .panel { box-shadow: none; break-inside: avoid; }
  .timeline-bar .seg, .timeline .dot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* Sidhuvud med gymmets logga, och en stramare layout för papper/PDF */
  @page { margin: 14mm 14mm 16mm; }
  body { background: #fff; font-size: 11pt; }
  .print-header { display: flex !important; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 10px; margin-bottom: 12px; border-bottom: 2px solid #000; }
  .print-logo { max-height: 18mm; max-width: 70mm; object-fit: contain; }
  .print-meta { text-align: right; margin-left: auto; }
  .print-gym { font-weight: 800; font-size: 13pt; }
  .print-date { color: #555; font-size: 9.5pt; }
  .print-footer { display: block !important; margin-top: 10px; text-align: center; color: #777; font-size: 8.5pt; }
  .session { gap: 10px; }
  .session > div.panel:first-of-type .session-head h1 { padding-right: 0; font-size: 20pt; }
  .panel { border: 1px solid #ccc; padding: 12px 14px; border-radius: 6px; }
  .block { break-inside: avoid; }
  .blocks { gap: 10px; }
  .items li { padding: 4px 0; }
  .item-people { background: none !important; border: 1px solid #999; color: #000 !important; }
  .warnings { border: 1px solid #c90; background: #fff !important; color: #000 !important; }
  a { color: inherit; text-decoration: none; }
}
.print-header, .print-footer { display: none; }

/* Utskrift i passmallens form (pass från ett passkoncept) – visas bara på papper/PDF. */
.concept-sheet { display: none; }
@media print {
  .session.has-sheet > :not(.print-header):not(.concept-sheet):not(.print-footer) { display: none !important; }
  .concept-sheet { display: block; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .concept-sheet table { width: 100%; border-collapse: collapse; font-size: 10pt; color: #000; }
  .concept-sheet td, .concept-sheet th { border: 1px solid #000; padding: 3px 6px; text-align: center; vertical-align: top; }
  .concept-sheet thead th { background: #eee; font-size: 15pt; padding: 8px; }
  .concept-sheet .cs-sub { font-size: 10pt; font-weight: 400; color: #444; }
  .concept-sheet tr { break-inside: avoid; }
  .concept-sheet .cs-part td, .concept-sheet .cs-workout td { background: #8c8c8c; color: #000; }
  .concept-sheet .cs-workout td { background: #6e6e6e; color: #fff; }
  .concept-sheet .cs-station td { background: #ffd86b; }
  .concept-sheet .cs-slot td, .concept-sheet .cs-iv td, .concept-sheet .cs-note td, .concept-sheet .cs-rest td { background: #fff3cd; }
  .concept-sheet .cs-rest.grey td, .concept-sheet .cs-text td { background: #f2f2f2; }
  .concept-sheet .cs-finisher td { background: #f4b183; }
  .concept-sheet .cs-finisher-iv td { background: #fbe3d6; }
  .concept-sheet .cs-ex td { text-align: left; background: #fff; }
  .concept-sheet .cs-ex td.cs-side { background: #fff3cd; text-align: center; }
  .concept-sheet .cs-side { width: 26%; }
  .concept-sheet .cs-n { font-weight: 700; display: inline-block; min-width: 1.6em; }
  .concept-sheet .cs-weight { color: #444; font-size: 9pt; }
  /* Blockmall: översikt och en tabell per block */
  .cs-blocks .cs-h1 { font-weight: 800; font-size: 20pt; margin: 0 0 4px; color: #1f3864; text-decoration: underline; }
  .cs-blocks .cs-h2 { font-weight: 700; font-size: 12pt; margin: 0 0 10px; color: #1f3864; }
  .cs-blocks .cs-h3 { font-weight: 700; font-size: 13pt; margin: 14px 0 4px; color: #1f3864; text-decoration: underline; break-after: avoid; }
  .cs-blocks p { margin: 4px 0; font-size: 10pt; color: #1f3864; }
  .cs-blocks table { margin: 6px 0 10px; }
  .cs-blocks td, .cs-blocks th { text-align: left; color: #1f3864; }
  .cs-blocks thead th { font-size: 10pt; padding: 4px 6px; text-align: left; }
  .cs-blocks .cs-summary thead th { background: #f8cbad; }
  .cs-blocks .cs-intro td { font-weight: 700; }
  .cs-blocks .cs-table td:first-child { width: 14%; }
  .cs-blocks .cs-table td:nth-child(3) { width: 18%; }
  .cs-blocks .cs-table td:last-child { width: 38%; }
  .cs-blocks .cs-c0 th { background: #9dc3e6; }
  .cs-blocks .cs-c1 th { background: #00b050; }
  .cs-blocks .cs-c2 th { background: #ffc000; }
  .cs-blocks .cs-c3 th { background: #ff0000; color: #fff; }
  .cs-blocks .cs-c4 th { background: #2f75b5; color: #fff; }
  .cs-blocks .cs-c5 th { background: #00b0f0; }
  .cs-blocks .cs-cf th { background: #7030a0; color: #fff; }
  .cs-blocks .cs-block { break-inside: auto; }
  .cs-blocks .cs-example { color: #555; font-size: 9pt; font-style: italic; }
}

/* Passkoncept som utbildningsmaterial (byggaren → Skriv ut eller spara som PDF): bara dokumentet. */
#concept-print { display: none; }
@media print {
  body.printing-concept > *:not(#concept-print) { display: none !important; }
  body.printing-concept { background: #fff !important; }
  body.printing-concept #concept-print { display: block; }
  @page { margin: 16mm 16mm 18mm; }
  .concept-doc { color: #1d1b18; font-size: 10.5pt; line-height: 1.45; }
  .concept-doc h1 { font-size: 24pt; margin: 0; }
  .concept-doc .cd-sub { margin: 2px 0 14px; padding-bottom: 6px; border-bottom: 2px solid #e8590c; color: #6f6a62; }
  .concept-doc h3 { color: #e8590c; font-size: 15pt; margin: 16px 0 8px; break-after: avoid; }
  .concept-doc h4 { font-size: 12pt; margin: 14px 0 4px; break-after: avoid; }
  .concept-doc p { margin: 0 0 8px; }
  .concept-doc .cd-muted { color: #6f6a62; font-style: italic; font-size: 9pt; }
  .concept-doc .cd-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; padding: 5px 8px; background: #f6f3ee; font-size: 9pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; break-after: avoid; }
  .concept-doc .cd-facts div { display: flex; gap: 4px; }
  .concept-doc .cd-facts dt { font-weight: 700; }
  .concept-doc .cd-facts dt::after { content: ':'; }
  .concept-doc .cd-facts dd { margin: 0; }
  .concept-doc .cd-table { width: 100%; border-collapse: collapse; margin: 0 0 10px; font-size: 9.5pt; }
  .concept-doc .cd-table th, .concept-doc .cd-table td { border: 1px solid #d8d2c8; padding: 4px 6px; text-align: left; vertical-align: top; }
  .concept-doc .cd-table th { background: #f3e2d7; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .concept-doc .cd-table tr { break-inside: avoid; }
  .concept-doc .cd-overview td:nth-child(2) { white-space: nowrap; }
  .concept-doc .cd-break { break-after: page; }
  .concept-doc .cd-foot { margin-top: 16px; text-align: center; color: #8a8378; font-size: 8pt; }
}
