/* Träningsapp: mörkt fantasytema.
   Palett: blåsvart bläck, mässing, vinrött, pergament. Byt värdena i :root för nytt tema. */
:root {
  --ink: #0c0d15;
  --ink-2: #141626;
  --ink-3: #1d2036;
  --vellum: #e9dfc6;
  --muted: #a8a28f;
  --brass: #c9a24a;
  --brass-dim: rgba(201, 162, 74, 0.38);
  --wine: #b2414a;
  --wine-deep: #4a1a20;
  --verdigris: #6fb3a2;
  --radius: 4px;
  --display: 'Cinzel', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --body: 'Crimson Pro', 'Palatino Linotype', Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse 90% 50% at 50% -10%, #20213a 0%, transparent 70%),
    var(--ink);
  color: var(--vellum);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.55;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 16px 48px; }

h1, h2, h3 { font-family: var(--display); font-weight: 500; margin: 0; letter-spacing: 0.02em; }
h2 { font-size: 1.15rem; color: var(--brass); }
h3 { font-size: 1rem; color: var(--vellum); margin: 20px 0 8px; }
p { margin: 0; }
a { color: var(--brass); }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

/* ---------- huvud ---------- */
.head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 8px 4px 24px; border-bottom: 1px solid var(--brass-dim); margin-bottom: 24px;
}
.who h1 { font-size: clamp(1.6rem, 5vw, 2.6rem); font-weight: 700; line-height: 1.1; word-break: break-word; }
.who-sub { font-family: var(--display); color: var(--brass); font-size: 1.15rem; margin-top: 6px; }
.who-meta { color: var(--muted); font-style: italic; margin-top: 2px; }

.medallion {
  flex: none; width: 92px; height: 92px; border-radius: 50%;
  display: grid; place-content: center; text-align: center;
  background: radial-gradient(circle at 35% 30%, var(--ink-3), var(--ink-2));
  border: 2px solid var(--brass);
  box-shadow: inset 0 0 0 5px var(--ink-2), inset 0 0 0 6px var(--brass-dim), 0 0 24px rgba(201, 162, 74, 0.15);
}
.med-num { font-family: var(--display); font-weight: 700; font-size: 1.9rem; line-height: 1; }
.med-lbl { font-size: 0.85rem; color: var(--muted); font-style: italic; }

/* ---------- banner ---------- */
#databanner:empty { display: none; }
.banner { padding: 12px 16px; margin-bottom: 20px; border: 1px solid var(--wine); background: var(--wine-deep); border-radius: var(--radius); }
.banner strong { color: #f1c4c8; }

/* ---------- layout ---------- */
.layout { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
.col-a, .col-b { display: grid; gap: 20px; min-width: 0; }
@media (min-width: 980px) {
  .layout { grid-template-columns: minmax(340px, 430px) 1fr; gap: 28px; }
}

/* ---------- paneler ---------- */
.panel {
  background: var(--ink-2);
  border: 1px solid var(--brass-dim);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  box-shadow: inset 0 0 0 3px var(--ink-2), inset 0 0 0 4px rgba(201, 162, 74, 0.14);
}
.panel[hidden], [hidden] { display: none !important; }
details.panel > summary { cursor: pointer; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary h2 { display: inline; }
details.panel > summary::after { content: ' ▾'; color: var(--brass); }
details.panel[open] > summary::after { content: ' ▴'; }
details.panel[open] > summary { margin-bottom: 14px; }

/* ---------- formulär ---------- */
.form { display: grid; gap: 14px; }
.row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 440px) { .row { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; color: var(--muted); font-size: 1rem; }
input, select {
  width: 100%; min-height: 44px; padding: 8px 12px;
  background: var(--ink); color: var(--vellum);
  border: 1px solid var(--brass-dim); border-radius: var(--radius);
  font: inherit; font-size: 1.05rem;
}
input:focus-visible, select:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
input[type="file"] { display: none; }
.hint { color: var(--muted); font-size: 1rem; font-style: italic; }
.error { color: #f3b5ba; background: var(--wine-deep); border-left: 3px solid var(--wine); padding: 8px 12px; }
.result { margin-top: 14px; min-height: 1.5em; color: var(--vellum); }
.pb { color: var(--verdigris); font-weight: 600; }
.c-ex .pb { margin-left: 8px; padding: 1px 7px; border: 1px solid currentColor; border-radius: 3px; font-size: 0.78em; white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 18px;
  background: transparent; color: var(--vellum);
  border: 1px solid var(--brass-dim); border-radius: var(--radius);
  font: inherit; font-size: 1.05rem; cursor: pointer;
}
.btn:hover { border-color: var(--brass); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--brass-dim); }
.btn.primary { background: var(--brass); border-color: var(--brass); color: #1a1405; font-weight: 600; }
.btn.primary:hover { background: #d8b25a; }
.btn.danger { color: #f3b5ba; border-color: var(--wine); }
.btn.danger:hover { background: var(--wine-deep); }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* ---------- logga pass ---------- */
.l-date { max-width: 14rem; }
.l-rows { display: grid; gap: 10px; }
.l-row {
  display: grid; gap: 10px; align-items: end;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.2fr) minmax(0, 0.8fr) auto;
  padding: 12px; background: var(--ink-3);
  border: 1px solid rgba(201, 162, 74, 0.2); border-radius: var(--radius);
}
.l-row.invalid { border-color: var(--wine); }
.l-del {
  min-width: 44px; min-height: 44px; background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: var(--radius); font: inherit; font-size: 1.2rem; cursor: pointer;
}
.l-del:hover:not(:disabled) { color: #f3b5ba; border-color: var(--wine); }
.l-del:disabled { opacity: 0.3; cursor: not-allowed; }
.l-addrow { margin-top: 0; }
@media (max-width: 560px) {
  .l-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .l-f-ex { grid-column: 1 / -1; }
}

.res-head { font-weight: 600; }
.res-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.res-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.res-ex { font-weight: 600; }
.res-detail { color: var(--muted); font-size: 1rem; }
.res-sum { margin-top: 10px; color: var(--muted); font-size: 1rem; }

/* ---------- radarkartan ---------- */
#radar svg { width: 100%; height: auto; display: block; overflow: visible; }
.ring { fill: none; stroke: var(--brass-dim); stroke-width: 1; opacity: 0.5; }
.ring-median { opacity: 1; stroke: var(--brass); stroke-dasharray: 5 5; stroke-width: 1.4; }
.axis { stroke: var(--brass-dim); stroke-width: 1; opacity: 0.45; }
.shape { fill: rgba(201, 162, 74, 0.26); stroke: var(--brass); stroke-width: 2; stroke-linejoin: round; transform-box: view-box; transform-origin: 200px 200px; animation: unfurl 0.9s cubic-bezier(.2,.7,.2,1) both; }
.dot { fill: var(--vellum); stroke: var(--brass); stroke-width: 2; }
.lbl-name { font-family: var(--display); font-size: 15px; fill: var(--vellum); }
.lbl-score { font-family: var(--display); font-size: 13px; fill: var(--brass); }
.lbl-rune { font-size: 16px; fill: var(--muted); }
.caption { color: var(--muted); font-style: italic; font-size: 0.98rem; text-align: center; margin-top: 6px; }
@keyframes unfurl { from { transform: scale(0.05); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- muskelgrupper ---------- */
#groups { display: grid; gap: 12px; }
.group { background: var(--ink-2); border: 1px solid var(--brass-dim); border-radius: var(--radius); }
.group > summary {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px;
  padding: 14px 16px; cursor: pointer; list-style: none;
}
.group > summary::-webkit-details-marker { display: none; }
.group[open] > summary { border-bottom: 1px solid var(--brass-dim); }
.rune { font-size: 1.7rem; color: var(--brass); text-align: center; line-height: 1; }
.g-name { font-family: var(--display); font-size: 1.2rem; }
.g-score { font-family: var(--display); font-weight: 700; font-size: 1.7rem; min-width: 3ch; text-align: right; }
.g-main { display: grid; gap: 8px; min-width: 0; }

.meter { position: relative; height: 8px; background: var(--ink); border: 1px solid var(--brass-dim); border-radius: 2px; }
.meter .fill { position: absolute; inset: 0 auto 0 0; background: var(--brass); }
.meter .fill.low { background: var(--wine); }
.meter .mark { position: absolute; top: -4px; bottom: -4px; left: 50%; width: 2px; background: var(--vellum); opacity: 0.8; }

.exlist { list-style: none; margin: 0; padding: 6px 16px 14px; display: grid; }
.ex { padding: 12px 0; border-bottom: 1px solid rgba(201, 162, 74, 0.14); display: grid; gap: 6px; }
.ex:last-child { border-bottom: 0; }
.ex-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ex-name { font-weight: 600; }
.ex-tag { margin-left: 8px; padding: 1px 6px; border: 1px solid currentColor; border-radius: 3px; font-size: 0.7em; font-weight: 400; opacity: 0.7; vertical-align: middle; }
.ex-score { font-family: var(--display); font-weight: 700; font-size: 1.2rem; }
.ex-score.none { color: var(--muted); font-weight: 500; font-family: var(--body); font-style: italic; font-size: 1rem; }
.ex-detail { color: var(--muted); font-size: 1rem; }
.ex-detail b { color: var(--vellum); font-weight: 600; }

/* ---------- krönikan ---------- */
.chron { list-style: none; margin: 0; padding: 0; }
.chron li {
  display: grid; grid-template-columns: 5.5rem 1fr auto; gap: 4px 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid rgba(201, 162, 74, 0.14);
}
.chron li:last-child { border-bottom: 0; }
.c-date { color: var(--muted); font-size: 0.98rem; }
.c-ex { font-weight: 600; }
.c-set { color: var(--muted); font-size: 1rem; grid-column: 2; }
.c-del { grid-row: 1 / span 2; grid-column: 3; }
.c-del button {
  min-width: 44px; min-height: 44px; background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: var(--radius); font: inherit; font-size: 1.2rem; cursor: pointer;
}
.c-del button:hover { color: #f3b5ba; border-color: var(--wine); }
.empty { color: var(--muted); font-style: italic; }
.nolist { padding: 14px 16px; }

/* ---------- fot ---------- */
.foot { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--brass-dim); color: var(--muted); font-size: 0.98rem; display: grid; gap: 8px; max-width: 70ch; }

@media (prefers-reduced-motion: reduce) {
  .shape { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* ---------- utveckling ---------- */
.prog-ctl { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 10px; }
.prog-ctl .field[hidden] { display: none; }
.chart { margin-top: 12px; }
.ch-svg { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--brass-dim); stroke-width: 1; opacity: 0.35; }
.ch-ref { stroke: var(--brass); stroke-width: 1.2; stroke-dasharray: 5 5; opacity: 0.8; }
.ch-reftxt, .ch-tick { fill: var(--muted); font-family: var(--body); font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 0.98rem; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.lg b { color: var(--vellum); font-family: var(--display); font-weight: 500; }
.tbl { margin-top: 10px; color: var(--muted); }
.tbl summary { cursor: pointer; padding: 6px 0; }
.tbl[hidden] { display: none; }
.ch-table { border-collapse: collapse; width: 100%; font-size: 0.95rem; margin-top: 6px; }
.ch-table th, .ch-table td { text-align: right; padding: 4px 8px; border-bottom: 1px solid rgba(201, 162, 74, 0.14); }
.ch-table th[scope=row], .ch-table th:first-child { text-align: left; font-weight: 400; }
.check { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 1rem; }
.check input { margin-top: 6px; }
#bw-form[hidden] { display: none; }
#bw-list { margin-top: 12px; }
.check input { width: 20px; height: 20px; flex: none; accent-color: var(--brass); }

/* ---------- kroppsfiguren ---------- */
#body-fig svg { width: 100%; height: auto; display: block; max-width: 460px; margin: 8px auto 0; }
.bd-neutral { fill: #1d2036; stroke: var(--brass-dim); stroke-width: 1; }
.bd-shape { stroke: #0c0d15; stroke-width: 1.5; stroke-linejoin: round; transition: opacity 0.15s; }
.bd-zone:hover .bd-shape { opacity: 0.8; }
.bd-num { font-family: var(--display); font-weight: 700; font-size: 12.5px; pointer-events: none; }
.bd-view { font-family: var(--display); font-size: 13px; fill: var(--muted); }
.bd-scale { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 10px; color: var(--muted); font-size: 0.9rem; }
.bd-scale span, .bd-list li { display: inline-flex; align-items: center; gap: 6px; }
.bd-scale i, .bd-list i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--brass-dim); display: inline-block; }
.bd-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 6px 12px; }
.bd-list b { margin-left: auto; font-family: var(--display); font-weight: 500; }
.bd-shine { stroke: none; pointer-events: none; }
.bd-detail { fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 1; stroke-linecap: round; pointer-events: none; }
.bd-shape { stroke: #0c0d15; stroke-width: 1.2; }

/* ---------- dialogrutor ---------- */
.btn.big { width: 100%; padding: 16px; font-size: 1.15rem; font-family: var(--display); letter-spacing: 0.03em; }
.dlg { background: var(--ink-2); color: var(--vellum); border: 1px solid var(--brass); border-radius: var(--radius); padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.dlg::backdrop { background: rgba(5, 6, 12, 0.78); }
.dlg-in { padding: 20px; display: grid; gap: 14px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dlg-x { min-width: 44px; min-height: 44px; background: transparent; border: 1px solid transparent; color: var(--muted); font-size: 1.6rem; cursor: pointer; border-radius: var(--radius); }
.dlg-x:hover { color: var(--vellum); border-color: var(--brass-dim); }

/* ---------- framsteg: XP-mätare och sammanfattning ---------- */
.xp { display: grid; gap: 4px; }
.xp-bar { position: relative; height: 16px; background: var(--ink); border: 1px solid var(--brass-dim); border-radius: 8px; overflow: hidden; box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6); }
.xp-fill {
  height: 100%; border-radius: 8px; position: relative; overflow: hidden;
  background: linear-gradient(90deg, #8a6a22, var(--brass) 60%, #f1d98a);
  box-shadow: 0 0 10px rgba(201, 162, 74, 0.55);
  transition: width 1.4s cubic-bezier(.2, .8, .2, 1);
}
.xp-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%); transform: translateX(-100%); animation: xp-shine 2.8s ease-in-out 1.2s infinite; }
.xp-bar.up .xp-fill { background: linear-gradient(90deg, #2a9d8f, #8ec65a 60%, #f4e04d); box-shadow: 0 0 14px rgba(244, 224, 77, 0.6); }
.xp-bar.med::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: var(--vellum); opacity: 0.55; z-index: 1; }
.xp-lab { display: flex; justify-content: space-between; font-family: var(--display); font-size: 0.8rem; color: var(--muted); letter-spacing: 0.03em; }
.xp-pct { color: var(--muted); font-size: 0.95rem; font-style: italic; }
@keyframes xp-shine { 0%, 40% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.xp-list { display: grid; gap: 14px; margin-top: 4px; }
.xp-card { display: grid; gap: 10px; padding: 16px; background: var(--ink); border: 1px solid var(--brass-dim); border-radius: var(--radius); }
.xp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.xp-ex { margin: 0; font-size: 1.2rem; color: var(--vellum); }
.xp-head .pb { padding: 2px 9px; border: 1px solid currentColor; border-radius: 3px; font-size: 0.85rem; white-space: nowrap; }
.xp-set { color: var(--muted); font-size: 1rem; white-space: pre-wrap; }
.xp-none { color: var(--muted); font-style: italic; }
.xp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.xp-stat { display: grid; gap: 0; padding: 10px 12px; background: var(--ink-2); border: 1px solid var(--brass-dim); border-radius: var(--radius); text-align: center; }
.xp-k { font-size: 0.8rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.xp-v { font-family: var(--display); font-weight: 700; font-size: 1.35rem; color: var(--brass); line-height: 1.25; }
.xp-big { font-size: 2.2rem; color: var(--vellum); text-shadow: 0 0 14px rgba(201, 162, 74, 0.5); }
.xp-s { font-size: 0.88rem; color: var(--muted); }
.xp-next { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; padding-top: 10px; border-top: 1px dashed var(--brass-dim); }
.xp-next dt { color: var(--muted); font-size: 0.98rem; }
.xp-next dd { margin: 0; font-size: 1rem; }
.xp-next b { color: var(--verdigris); font-family: var(--display); font-weight: 500; }
.xp-top-tier { color: #f4e04d; font-family: var(--display); }
.xp-up {
  padding: 8px 12px; text-align: center; font-family: var(--display); letter-spacing: 0.06em; color: #1a1405;
  background: linear-gradient(90deg, #b88a1e, #f4e04d, #b88a1e); border-radius: var(--radius);
  animation: xp-pulse 1.6s ease-in-out infinite;
}
.xp-star { display: inline-block; animation: xp-spin 3s linear infinite; }
@keyframes xp-pulse { 0%, 100% { box-shadow: 0 0 6px rgba(244, 224, 77, 0.4); } 50% { box-shadow: 0 0 22px rgba(244, 224, 77, 0.9); } }
@keyframes xp-spin { to { transform: rotate(360deg); } }

.xp-char { display: grid; gap: 14px; padding: 16px; margin-top: 14px; border: 1px solid var(--brass); border-radius: var(--radius); background: linear-gradient(180deg, var(--ink-3), var(--ink)); }
.xp-char h3 { margin: 0; color: var(--brass); }
.xp-grp { display: grid; gap: 4px; }
.xp-grp-top, .xp-total-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.xp-grp-name { font-family: var(--display); }
.xp-grp-val b { font-family: var(--display); font-size: 1.15rem; }
.xp-delta { color: var(--verdigris); font-weight: 600; }
.xp-total { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--brass-dim); }
.xp-total-val { font-family: var(--display); font-size: 1.1rem; }
.xp-total-val b { font-size: 2rem; color: var(--vellum); text-shadow: 0 0 14px rgba(201, 162, 74, 0.5); }

.who-xp { margin-top: 10px; max-width: 360px; display: grid; gap: 2px; }
.xp-title .xp-bar { height: 10px; }
.ex .xp { margin-top: 2px; }
.ex .xp-bar { height: 10px; }
.ex .xp-next { font-size: 0.95rem; }

@media (prefers-reduced-motion: reduce) {
  .xp-fill { transition: none; }
  .xp-fill::after, .xp-up, .xp-star { animation: none; }
}

/* ---------- pass i historiken ---------- */
.l-name input { width: 100%; }
.res-name { font-family: var(--display); color: var(--brass); font-size: 1.1rem; }
.sess { border: 1px solid var(--brass-dim); border-radius: var(--radius); background: var(--ink-2); margin-bottom: 10px; }
.sess > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: grid; gap: 6px; position: relative; }
.sess > summary::-webkit-details-marker { display: none; }
.sess > summary::before { content: '▸'; position: absolute; left: 14px; top: 12px; color: var(--brass); }
.sess[open] > summary::before { content: '▾'; }
.sess[open] > summary { border-bottom: 1px solid var(--brass-dim); }
.s-main { display: grid; gap: 0; padding-left: 18px; }
.s-name { font-family: var(--display); font-size: 1.1rem; }
.s-meta { color: var(--muted); font-size: 0.95rem; }
.s-badges { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 18px; }
.s-badges .pb { padding: 1px 8px; border: 1px solid currentColor; border-radius: 3px; font-size: 0.85rem; }
.pb.pr { color: #f4e04d; }
.s-body { padding: 4px 14px 14px; display: grid; gap: 12px; }
.s-body .chron li { grid-template-columns: 1fr auto; }
.s-body .chron .c-set { grid-column: 1; }
.s-body .chron .c-del { grid-column: 2; grid-row: 1 / span 2; }
#chron > .btn { margin-top: 4px; }

/* ---------- översyn: layout, mål, mobilknapp ---------- */
[hidden] { display: none !important; }
.cta { margin: 4px 0 20px; }
.col-b[hidden] { display: none; }
@media (max-width: 979px) {
  .layout { gap: 20px; }
  .col-a, .col-b { display: contents; }
  #profile-details { order: 0; }
  #map-sec { order: 1; }
  #body-sec { order: 2; }
  #goal-sec { order: 3; }
  #groups { order: 4; }
  #prog-sec { order: 5; }
  #chron-sec { order: 6; }
  #tools-sec { order: 7; }
  .wrap { padding-bottom: 96px; }
  .cta { position: fixed; left: 12px; right: 12px; bottom: 12px; margin: 0; z-index: 30; }
  .cta .btn { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7); }
}
#radar svg { max-width: 300px; margin: 0 auto; }
.ch-reftxt { paint-order: stroke; stroke: var(--ink-2); stroke-width: 3px; }
.goal-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 0; }
.goal { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--brass-dim); }
.goal:first-child { border-top: 0; padding-top: 4px; }
.goal-k { font-size: 0.78rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.goal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.goal-name { font-family: var(--body); font-weight: 600; font-size: 1.15rem; color: var(--vellum); display: inline-flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.goal-val { font-family: var(--display); font-size: 1.15rem; color: var(--brass); white-space: nowrap; }
.goal-sub { margin: 0; color: var(--muted); font-size: 1rem; }
.goal-sub b { color: var(--vellum); font-weight: 600; }
.goal-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.goal-chip { padding: 1px 10px; border: 1px solid var(--brass-dim); border-radius: 999px; font-family: var(--body); font-weight: 400; font-size: 0.9rem; color: var(--brass); }
.goal .xp-bar { height: 8px; }
.g-tier { margin-left: 10px; font-size: 0.85rem; color: var(--brass); letter-spacing: 0.04em; }
.g-next { font-size: 0.85rem; color: var(--muted); font-style: italic; }
.welcome { color: var(--muted); font-style: italic; margin: 6px 0 4px; }

/* ---------- dashboard på stora skärmar ---------- */
details.drop > summary h2 { font-size: 1rem; }
@media (min-width: 1100px) and (min-height: 820px) {
  html, body { height: 100%; }
  body { overflow: hidden; }
  .wrap {
    position: relative; max-width: none; height: 100vh; padding: 14px 22px 8px; margin: 0;
    display: grid; gap: 14px;
    grid-template-columns: minmax(300px, 24%) minmax(0, 1fr) minmax(340px, 28%);
    /* rad 1 = huvud, 2 = banner, 3-12 = tio lika rader som panelerna fördelar sig över, 13 = fot */
    grid-template-rows: auto auto repeat(10, minmax(0, 1fr)) auto;
  }
  .layout, .col-a, .col-b { display: contents; }
  .head { grid-column: 1 / 3; grid-row: 1; margin: 0; padding: 0 0 6px; border-bottom: 0; justify-content: flex-start; gap: 22px; }
  .head .medallion { order: -1; width: 84px; height: 84px; }
  .cta { grid-column: 3; grid-row: 1; align-self: end; margin: 0; position: static; }
  .cta .btn { padding: 14px; box-shadow: none; }
  #databanner { grid-column: 1 / -1; grid-row: 2; }
  #databanner .banner { margin: 0; }
  #map-sec { grid-column: 1; grid-row: 3 / 8; }
  #body-sec { grid-column: 1; grid-row: 8 / 13; }
  #prog-sec { grid-column: 2; grid-row: 3 / 9; }
  #chron-sec { grid-column: 2; grid-row: 9 / 13; }
  #goal-sec { grid-column: 3; grid-row: 3 / 8; }
  #groups { grid-column: 3; grid-row: 8 / 13; overflow: auto; min-height: 0; display: grid; gap: 10px; align-content: start; padding-right: 2px; }
  .foot { grid-column: 1 / -1; grid-row: 13; margin: 0; padding-top: 6px; font-size: 0.9rem; max-width: none; }

  .panel { min-height: 0; overflow: auto; display: flex; flex-direction: column; padding: 14px 16px 14px; }
  .panel > h2 { margin-bottom: 8px; }
  .panel > * { flex: none; }

  #radar, #body-fig { flex: 1 1 0; min-height: 0; display: flex; justify-content: center; }
  #radar svg { width: 100%; height: 100%; max-width: none; margin: 0; }
  #body-fig svg { width: 100%; height: 100%; max-width: none; margin: 0; }
  #g-chart { flex: 1 1 0; min-height: 0; overflow: hidden; margin-top: 8px; }
  #g-chart .ch-svg { width: auto; height: auto; max-width: none; display: block; }
  #radar text { font-size: 15px; }
  #map-sec .caption, #body-sec .caption { font-size: 0.85rem; margin-top: 4px; }

  /* Profil och inställningar blir rullgardiner uppe till höger. */
  details.drop { position: absolute; top: 14px; z-index: 40; width: 150px; padding: 6px 12px; overflow: visible; display: block; }
  details.drop[open] { width: 380px; max-height: calc(100vh - 40px); overflow: auto; }
  #tools-sec { right: 22px; }
  #profile-details { right: 188px; }
  body.no-profile #profile-details { position: static; width: auto; max-width: 480px; grid-column: 1 / -1; grid-row: 3; justify-self: center; align-self: start; }
  body.no-profile #profile-details[open] { width: 100%; }
  .head { padding-right: 0; }
  .who-xp { max-width: 420px; }
  .prog-ctl { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 0; }
  .prog-ctl .field { gap: 2px; }
  .legend { margin-top: 8px; }
  #prog-sec .caption { font-size: 0.85rem; margin-top: 2px; }
  #prog-sec .tbl { margin-top: 0; }
  .goal { padding: 9px 0; gap: 5px; }
  .goal-sub { font-size: 0.92rem; }
  .goal-name { font-size: 1.05rem; }
  .group > summary { padding: 8px 12px; }
  .g-next { font-size: 0.8rem; }
  .bd-scale { margin-top: 4px; }
  #chron .sess { margin-bottom: 8px; }
  .foot details[open] #foot { max-height: 40vh; overflow: auto; }
  .foot summary { cursor: pointer; }
}
.foot summary { cursor: pointer; list-style: none; }
.foot summary::-webkit-details-marker { display: none; }
.foot #foot { margin-top: 8px; display: grid; gap: 8px; max-width: 80ch; }

@media (min-width: 1100px) and (min-height: 820px) {
  /* kompakt huvud */
  .head .who { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: baseline; }
  .head .who h1 { font-size: 1.9rem; }
  .head .who-sub { margin: 0; }
  .head .who-meta { grid-column: 1 / -1; margin: 0; font-size: 0.95rem; }
  .head .who-xp { grid-column: 1 / -1; margin-top: 4px; max-width: 360px; }
  .head .medallion { width: 72px; height: 72px; }
  .head .med-num { font-size: 1.6rem; }
  .head .med-lbl { font-size: 0.75rem; }
  .cta .btn { padding: 12px; font-size: 1.05rem; }
  /* utvecklingspanelen: reglage och förklaring på en rad var */
  #prog-sec { position: relative; }
  .prog-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
  .prog-top .prog-ctl { display: flex; gap: 10px; flex: none; }
  .prog-top .prog-ctl .field { min-width: 150px; }
  .prog-top .legend { margin: 0; justify-content: flex-end; }
  .prog-foot { display: flex; align-items: center; gap: 14px; }
  .prog-foot .caption { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
  .prog-foot .tbl { flex: none; margin: 0; }
  .prog-foot .tbl summary { padding: 0; white-space: nowrap; }
  .prog-foot .tbl[open] #g-table { position: absolute; right: 14px; bottom: 44px; max-height: 70%; max-width: calc(100% - 28px); overflow: auto; background: var(--ink-2); border: 1px solid var(--brass); border-radius: var(--radius); padding: 8px 12px; z-index: 5; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
}

@media (min-width: 1100px) and (min-height: 820px) {
  #body-sec .caption { display: none; }
  #map-sec .caption { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.8rem; margin: 2px 0 0; }
  .bd-scale { font-size: 0.8rem; gap: 2px 10px; }
}
@media (min-width: 1100px) and (min-height: 820px) and (max-height: 999px) {
  .goal-weak { display: none; }
}
@media (min-width: 1100px) and (min-height: 820px) {
  .group > summary { padding: 6px 12px; gap: 10px; grid-template-columns: 30px 1fr auto; }
  .group .rune { font-size: 1.4rem; }
  .g-main { gap: 3px; }
  .g-name { font-size: 1.05rem; }
  .g-score { font-size: 1.45rem; }
  .meter { height: 6px; }
}

/* ---------- progress i centrum ---------- */
.groups-h { color: var(--brass); margin: 0 0 2px; }
.group .xp-bar.grp { height: 12px; }
.group .xp-lab { font-size: 0.78rem; }
@media (min-width: 1100px) and (min-height: 820px) {
  .wrap { grid-template-columns: minmax(300px, 22%) minmax(0, 1fr) minmax(360px, 27%); }
  #map-sec { grid-column: 1; grid-row: 3 / 8; }
  #body-sec { grid-column: 1; grid-row: 8 / 13; }
  #goal-sec { grid-column: 2; grid-row: 3 / 6; }
  #groups { grid-column: 2; grid-row: 6 / 13; }
  #prog-sec { grid-column: 3; grid-row: 3 / 9; }
  #chron-sec { grid-column: 3; grid-row: 9 / 13; }

  /* Nästa mål som en rad av tre block */
  #goal-sec .goal-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 4px; }
  #goal-sec .goal { border-top: 0; border-left: 1px solid var(--brass-dim); padding: 2px 16px; align-content: start; }
  #goal-sec .goal:first-child { border-left: 0; padding-left: 0; }
  .goal-weak { display: grid; }

  /* Muskelgrupperna är dashboardens mitt */
  #groups { gap: 12px; padding: 0 4px 0 0; }
  .group > summary { padding: 14px 20px; gap: 16px; grid-template-columns: 44px 1fr auto; }
  .group .rune { font-size: 2rem; }
  .g-main { gap: 6px; }
  .g-name { font-size: 1.35rem; }
  .g-tier { font-size: 0.95rem; }
  .g-score { font-size: 2.3rem; }
  .group .xp-bar.grp { height: 16px; }
  .group .xp-lab { font-size: 0.85rem; }
  .g-next { font-size: 0.9rem; }
}

.g-name { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.g-name .g-next { margin-left: auto; }
@media (min-width: 1100px) and (min-height: 820px) {
  .group > summary { padding: 10px 18px; }
  .g-main { gap: 4px; }
  .group .xp-bar.grp { height: 14px; }
  #groups { gap: 10px; }
  #goal-sec .goal-list { align-items: start; }
}

/* Karaktär och Inställningar: ingen pil, mer kompakta */
details.drop > summary::after, details.drop[open] > summary::after { content: none; }
@media (min-width: 1100px) and (min-height: 820px) {
  details.drop { width: 124px; padding: 4px 10px; text-align: center; }
  details.drop[open] { width: 380px; text-align: left; padding: 8px 12px; }
  details.drop > summary h2 { font-size: 0.95rem; }
  #tools-sec { right: 22px; }
  #profile-details { right: 156px; }
}

/* Knapparna uppe till höger: alltid en rad, bredden följer texten */
details.drop > summary h2, details.drop > summary { white-space: nowrap; }
@media (min-width: 1100px) and (min-height: 820px) {
  details.drop { width: max-content; max-width: none; padding: 6px 14px; }
  details.drop[open] { width: 380px; }
  details.drop > summary { text-align: center; }
  details.drop[open] > summary { text-align: left; }
}

/* Karaktär/Inställningar: alltid en rad, lika breda, inom sin ruta (även med Cinzel) */
details.drop > summary { display: block; text-align: center; }
details.drop > summary h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.03em; font-size: 0.85rem; margin: 0; line-height: 1.6; }
@media (min-width: 1100px) and (min-height: 820px) {
  details.drop { width: 176px; padding: 4px 8px; box-sizing: border-box; }
  details.drop[open] { width: 380px; }
  details.drop[open] > summary { text-align: left; }
  #tools-sec { right: 22px; }
  #profile-details { right: 208px; }
}

/* Skala 1-10 (plats bland alla) */
.sc { display: grid; gap: 2px; margin: 2px 0 4px; }
.sc-track { position: relative; height: 8px; border-radius: 4px; overflow: hidden; border: 1px solid var(--brass-dim); }
.sc-dim { position: absolute; top: 0; bottom: 0; right: 0; background: rgba(12, 13, 21, 0.72); }
.sc-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(12, 13, 21, 0.55); }
.sc-med { position: absolute; top: -1px; bottom: -1px; left: 50%; width: 2px; margin-left: -1px; background: var(--vellum); opacity: 0.9; }
.sc-mark { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 6px #fff; border-radius: 2px; }
.sc-names { position: relative; height: 1.05em; font-family: var(--display); font-size: 0.68rem; color: var(--muted); letter-spacing: 0.02em; }
.sc-name { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.sc-name.cur { color: var(--brass); font-weight: 700; }
.sc-cap { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 4px; }
.sc-note { margin: 0 0 6px; color: var(--muted); font-size: 0.85rem; }
.ex .sc-track { height: 6px; }
.group .xp-lab { display: none; }
.group .ex .xp-lab { display: flex; }
.goal-sub:empty { display: none; }
@media (min-width: 1100px) and (min-height: 820px) {
  #goal-sec { grid-row: 3 / 5; }
  #groups { grid-row: 5 / 13; }
  #goal-sec > h2 { display: none; }
  #goal-sec .goal-list { margin-top: 0; }
  .goal { padding-top: 0; padding-bottom: 0; gap: 3px; }
}
.who-xp { min-width: min(300px, 100%); }
.sc-dim { left: auto; }
@media (min-width: 1100px) and (min-height: 820px) {
  .group > summary { padding: 8px 18px; }
  .g-main { gap: 3px; }
  .group .xp-bar.grp { height: 10px; }
  .sc-note { display: none; }
  .groups-h { display: flex; align-items: baseline; gap: 12px; }
  .groups-h::after { content: 'skalan 1–10 · vit linje = median (5) · randigt fält = kvar till nästa nivå'; font-family: var(--body); font-size: 0.8rem; color: var(--muted); }
}
.goal .xp-lab { display: none; }
.goal-sub { font-size: 0.95rem; }
@media (min-width: 1100px) and (min-height: 820px) {
  .head .who-xp { width: 320px; max-width: none; }
  #goal-sec { padding-top: 10px; padding-bottom: 10px; }
}
@media (min-width: 1100px) and (min-height: 820px) {
  #goal-sec { grid-row: 3 / 4; align-self: start; }
  #groups { grid-row: 4 / 13; }
}
@media (min-width: 1100px) and (min-height: 820px) {
  #goal-sec { grid-row: 3 / 5; align-self: stretch; }
  #groups { grid-row: 5 / 13; align-content: start; }
}

/* Skala v2: gamla stapeln (röd < 5, guld >= 5) + mål-zon */
.sc-track { height: 12px; border-radius: 2px; background: var(--ink); border: 1px solid var(--brass-dim); overflow: visible; }
.group .sc-track { height: 12px; }
.ex .sc-track { height: 9px; }
.sc-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brass); }
.sc-fill.low { background: #b94a48; }
.sc-goal { position: absolute; top: 0; bottom: 0; box-sizing: border-box; border: 1px dashed #f4e04d; border-left: 0; background: repeating-linear-gradient(45deg, rgba(244,224,77,.2) 0 4px, transparent 4px 8px); }
.sc-tick { background: rgba(240,232,208,.35); }
.sc-med { top: -4px; bottom: -4px; opacity: 1; }
.sc-dim, .sc-mark { display: none; }
.sc-names { font-size: 0.72rem; }
.who-xp .sc-track { height: 10px; }

/* ---------- rekord och prestationer ---------- */
.top-icons { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; z-index: 30; }
.top-ic { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; background: var(--ink-2); border: 1px solid var(--brass-dim); border-radius: 999px; color: var(--vellum); font-family: var(--display); cursor: pointer; min-height: 40px; }
.top-ic:hover { border-color: var(--brass); box-shadow: 0 0 14px rgba(201, 162, 74, 0.25); }
.ti-g { font-size: 1.15rem; line-height: 1; color: var(--brass); }
.ti-b { font-size: 0.9rem; letter-spacing: 0.04em; }
.rec-t { width: 100%; border-collapse: collapse; font-size: 1rem; }
.rec-t th { text-align: left; color: var(--muted); font-weight: 400; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 6px; border-bottom: 1px solid var(--brass-dim); }
.rec-t td { padding: 7px 6px; border-bottom: 1px solid rgba(201, 162, 74, 0.15); }
.rec-v { font-family: var(--display); color: var(--brass); white-space: nowrap; }
.rec-new { margin-left: 8px; background: #f4e04d; color: var(--ink); border-radius: 8px; padding: 0 6px; font-size: 0.7rem; font-weight: 700; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px 10px; }
.ach { text-align: center; }
.ach-ic { width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 6px; display: grid; place-items: center; font-size: 1.5rem; border: 2px solid var(--brass); background: #1f1d12; color: #f4e04d; box-shadow: 0 0 12px rgba(244, 224, 77, 0.3); }
.ach.lock .ic, .ach.lock .ach-ic { border-color: #3a3a50; background: var(--ink-3); filter: grayscale(1); opacity: 0.55; box-shadow: none; }
.ach-n { font-family: var(--display); font-size: 0.85rem; line-height: 1.2; }
.ach-d { font-size: 0.85rem; color: var(--muted); }
.ach.lock .ach-n { color: var(--muted); }
.ach-how { font-size: 0.78rem; font-style: italic; }
@media (max-width: 979px) { .top-icons { position: static; transform: none; justify-content: center; margin: 0 0 14px; } }
@media (max-width: 560px) { .who-xp .sc-name:not(.cur) { display: none; } }

/* ---------- notis: prestation upplåst ---------- */
.toast { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 12px; max-width: min(92vw, 420px); padding: 10px 18px 10px 12px; background: var(--ink-2); color: var(--vellum); border: 1px solid #f4e04d; border-radius: 999px; box-shadow: 0 0 24px rgba(244, 224, 77, 0.35), 0 10px 30px rgba(0, 0, 0, 0.6); cursor: pointer; font: inherit; text-align: left; }
.toast[hidden] { display: none; }
.toast.show { animation: toast-in 0.5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -24px) scale(0.9); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.toast-ic { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 1.3rem; border: 2px solid var(--brass); background: #1f1d12; color: #f4e04d; }
.toast-t { display: grid; line-height: 1.2; }
.toast-t small { color: #f4e04d; font-family: var(--display); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.7rem; }
.toast-t b { font-family: var(--display); font-size: 1rem; }
.ach-new { display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: center; padding: 8px 0; animation: ach-glow 1.6s ease-out 0.4s both; }
.ach-new .ach-ic { margin: 0; }
@keyframes ach-glow { from { filter: brightness(2.2); transform: scale(0.96); } to { filter: none; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast.show, .ach-new { animation: none; } }

/* ======================================================================
   Blandning 1: fast scen, chips i mitten, uppdrag/kalender/historik till höger
   ====================================================================== */
.col-c { display: grid; gap: 20px; min-width: 0; }
.chips { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: thin; }
.chip { flex: none; padding: 6px 14px; border: 1px solid var(--brass-dim); border-radius: 999px; background: transparent; color: var(--muted); font-family: var(--display); font-size: 0.85rem; letter-spacing: 0.04em; cursor: pointer; white-space: nowrap; }
.chip:hover { color: var(--vellum); border-color: var(--brass); }
.chip.on { background: var(--brass); color: var(--ink); border-color: var(--brass); font-weight: 700; }
.views { display: grid; gap: 20px; min-width: 0; }
.vhide { display: none !important; }
.views[hidden], .col-c [hidden] { display: none; }

@media (max-width: 979px) {
  .col-c, .views { display: contents; }
  .chips { order: 3; }
  #goal-sec { order: 4; } #groups { order: 5; }
  .views > .panel { order: 6; }
  #prog-sec { order: 6; }
  #quest-sec { order: 7; } #cal-sec { order: 8; } #chron-sec { order: 9; } #tools-sec { order: 10; }
}
@media (min-width: 1100px) and (min-height: 820px) {
  .col-b { display: flex; flex-direction: column; grid-column: 2; grid-row: 3 / 13; min-height: 0; gap: 8px; }
  .col-b[hidden] { display: none; }
  .chips { padding-bottom: 2px; }
  .views { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
  .views > .panel { flex: 1 1 0; min-height: 0; }
  #goal-sec { flex: none; }
  .views > #groups { flex: 1 1 0; min-height: 0; grid-column: auto; grid-row: auto; }
  #goal-sec, #prog-sec, #groups { grid-column: auto; grid-row: auto; }
  .col-c { grid-column: 3; grid-row: 3 / 13; min-height: 0; grid-template-rows: auto auto minmax(0, 1fr); gap: 12px; }
  .col-c > * { grid-column: auto !important; grid-row: auto !important; min-height: 0; }
  #chron-sec { overflow: auto; }
  #goal-sec .goal-list { grid-template-columns: repeat(3, 1fr); }
  #goal-sec { grid-template-rows: none; }
}

/* ---------- nya vyer ---------- */
.v-note { color: var(--muted); font-size: 0.95rem; margin: 0 0 8px; }
.v-grid { display: grid; gap: 14px; }
.v-two { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 760px) { .v-two { grid-template-columns: 1fr; } }
.card { border: 1px solid var(--brass-dim); border-radius: 8px; background: var(--ink-3); padding: 12px 14px; }
.card.warn { border-color: #b94a48; background: rgba(185, 74, 72, 0.12); }
.card.ok { border-color: #2a9d8f; background: rgba(42, 157, 143, 0.1); }
.card h3 { margin: 0 0 4px; font-size: 1rem; color: var(--brass); }
.card p { margin: 0; color: var(--muted); }
.card p b { color: var(--vellum); }

.bal-row { display: grid; grid-template-columns: 90px 1fr 56px; gap: 10px; align-items: center; margin: 6px 0; }
.bal-name { font-family: var(--display); text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.05em; }
.bal-track { position: relative; height: 14px; background: var(--ink); border: 1px solid var(--brass-dim); border-radius: 2px; }
.bal-mid { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--vellum); }
.bal-fill { position: absolute; top: 0; bottom: 0; }
.bal-fill.up { background: var(--brass); }
.bal-fill.down { background: #b94a48; }
.bal-val { font-family: var(--display); text-align: right; white-space: nowrap; }
.bal-val.dn { color: #e07a78; }
.bal-val.upc { color: var(--brass); }

.cls { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; }
.cls-crest { width: 64px; height: 72px; border: 2px solid var(--brass); border-radius: 6px 6px 32px 32px; display: grid; place-items: center; font-size: 1.9rem; color: var(--brass); background: #1f1d12; }
.cls-name { font-family: var(--display); font-size: 1.3rem; color: var(--vellum); }

.fc-line { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 1.1rem; }
.fc-line b { color: var(--brass); font-family: var(--display); }
.fc-chart { height: 240px; margin: 8px 0; }
.fc-chart .ch-svg { display: block; }
.v-tbl { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.v-tbl th { text-align: left; color: var(--muted); font-weight: 400; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 6px; border-bottom: 1px solid var(--brass-dim); }
.v-tbl td { padding: 6px; border-bottom: 1px solid rgba(201, 162, 74, 0.15); }
.up { color: #8ec65a; } .dn { color: #e07a78; } .flat { color: var(--muted); }

.dist-ctl { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 8px; }
.dist-svg { width: 100%; height: auto; max-height: 300px; display: block; }
.dist-svg text { fill: var(--muted); font-size: 12px; font-family: var(--body); }
.dist-big { font-family: var(--display); font-size: 1.5rem; color: var(--brass); }

.cmp-ctl { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cmp-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp-figs svg { width: 100%; max-height: 230px; }
.cmp-figs h3 { margin: 0 0 2px; text-align: center; font-size: 0.95rem; color: var(--brass); }

.vol-legend { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0; font-size: 0.9rem; color: var(--muted); }
.vol-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.vol-svg { width: 100%; height: auto; max-height: 280px; display: block; }
.vol-svg text { fill: var(--muted); font-size: 11px; }

.ev-day { margin: 10px 0 2px; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.ev { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(201, 162, 74, 0.12); }
.ev-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--brass-dim); color: var(--brass); font-size: 0.95rem; }
.ev.k-pr .ev-ic, .ev.k-ach .ev-ic, .ev.k-lvl .ev-ic { border-color: #f4e04d; color: #f4e04d; }
.ev-t { font-size: 1.02rem; } .ev-t small { display: block; color: var(--muted); font-size: 0.85rem; }
.last-ev { margin: 0 0 8px; color: var(--muted); font-size: 0.95rem; }
.last-ev b { color: var(--vellum); font-weight: 600; }

.q-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid rgba(201, 162, 74, 0.15); }
.q-cb { width: 18px; height: 18px; border: 1.5px solid var(--brass); border-radius: 3px; display: grid; place-items: center; font-size: 0.8rem; color: #f4e04d; }
.q-row.done .q-cb { background: #1f1d12; box-shadow: 0 0 8px rgba(244, 224, 77, 0.4); }
.q-row.done .q-t { color: var(--muted); text-decoration: line-through; }
.q-t small { display: block; color: var(--muted); font-size: 0.82rem; text-decoration: none; }
.q-xp { font-size: 0.8rem; color: #f4e04d; border: 1px solid #8a6a1f; border-radius: 9px; padding: 0 8px; white-space: nowrap; }
.q-total { margin-top: 8px; display: flex; gap: 10px; align-items: center; font-size: 0.9rem; color: var(--muted); }
.q-total .xp-bar { flex: 1; height: 9px; }

.cal-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.cal-cell { aspect-ratio: 1; min-width: 6px; max-height: 18px; border-radius: 2px; background: #1b1d33; }
.cal-cell.l1 { background: #4a3f24; } .cal-cell.l2 { background: #8a6a1f; } .cal-cell.l3 { background: #c9a24a; }
.cal-cell.fut { background: transparent; border: 1px dashed rgba(201, 162, 74, 0.12); }
.cal-last { margin-top: 8px; display: grid; gap: 2px; font-size: 0.9rem; }
.cal-last div { display: flex; justify-content: space-between; gap: 8px; }
.cal-last .old { color: #e07a78; }

.rest { margin-top: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--brass-dim); padding-top: 10px; }
.rest-time { font-family: var(--display); font-size: 1.4rem; min-width: 4ch; color: var(--brass); }
.rest .btn { padding: 4px 12px; }
.l-sug { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 0.88rem; }
.l-sug button { background: transparent; color: #f4e04d; border: 1px dashed #8a6a1f; border-radius: 9px; padding: 0 9px; cursor: pointer; font: inherit; font-size: 0.85rem; }
.q-total .xp { flex: 1; } .q-total .xp-lab { display: none; }

/* ---------- äventyrare (XP-nivå) ---------- */
.adv-big { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center; margin-bottom: 10px; }
.adv-lvl { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 2rem; color: #f4e04d; border: 2px solid var(--brass); background: #1f1d12; box-shadow: 0 0 16px rgba(244, 224, 77, 0.3); }
.q-adv { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(201, 162, 74, 0.15); }
.top-ic.ti-adv .ti-g { color: #f4e04d; }
.adv-big + .xp, .adv-big + div { margin-bottom: 4px; } #info-body .hint { margin: 12px 0; }

/* Välj övningar */
.xs-body { max-height: min(52vh, 460px); overflow: auto; display: grid; gap: 2px; align-content: start; border: 1px solid var(--brass-dim); border-radius: var(--radius); padding: 8px; }
.xs-gh { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.xs-gh:first-child { margin-top: 0; }
.xs-gb { display: flex; gap: 6px; }
.xs-b { min-height: 32px; padding: 2px 10px; }
.xs-row { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 4px; cursor: pointer; }
.xs-row input { width: 20px; height: 20px; flex: none; }
.xs-n { flex: 1; }
.xs-t { color: var(--muted); font-size: 0.8rem; }

/* Min utrustning */
.xs-miss .xs-n { color: var(--muted); }
.gear-presets { margin-top: 0; }
.gear-row { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 2px 4px; }
.gear-main { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.gear-main input { width: 20px; height: 20px; flex: none; }
.gear-amtl { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 0 6px 30px; flex-wrap: wrap; }
.gear-amt { width: 7.5em; min-height: 40px; }
.gear-warn { margin: 8px 0 0; padding: 6px 10px; color: #f3d9a4; background: rgba(201, 162, 74, 0.12); border-left: 3px solid var(--brass); font-size: 0.95rem; }

/* Metadata i övningsväljaren */
.xs-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.xs-filters[hidden] { display: none; }
.xs-nn { flex: 1; display: grid; gap: 0; min-width: 0; }
.xs-m { color: var(--muted); font-size: 0.82rem; line-height: 1.2; }

/* Träningsmål */
.plan-goals { display: grid; gap: 6px; margin: 8px 0; }
.plan-goal { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--line, rgba(255,255,255,0.12)); border-radius: 6px; cursor: pointer; min-height: 44px; }
.plan-goal input { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.plan-goal-t { display: grid; gap: 2px; }
.plan-goal:has(input:checked) { border-color: var(--brass); }
.plan-inputs { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0; }
.plan-in { display: grid; gap: 4px; }
.plan-in input { width: 7em; min-height: 40px; }
.plan-in input[aria-invalid="true"] { outline: 2px solid #c0504d; }
.plan-out h3 { margin: 14px 0 6px; font-size: 1rem; }
.plan-tbl { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.plan-tbl th, .plan-tbl td { text-align: left; padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line, rgba(255,255,255,0.12)); font-weight: normal; }
.plan-tbl thead th { color: var(--muted); font-size: 0.82rem; }
.plan-tbl tbody th { font-weight: 600; }
.plan-weekly { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.plan-weekly li { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--line, rgba(255,255,255,0.08)); }
.plan-weekly li b { margin-left: auto; }
.plan-src ul { margin: 6px 0 0; padding-left: 18px; }

/* Planerade pass */
.pl-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 8px 0; }
.pl-bar input { min-height: 40px; }
.pl-notes { margin: 8px 0; padding-left: 18px; color: var(--muted); font-size: 0.95rem; }
.pl-card { border: 1px solid var(--line, rgba(255,255,255,0.12)); border-radius: 6px; padding: 10px 12px; margin: 10px 0; }
.pl-off { opacity: 0.7; }
.pl-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pl-badge { font-size: 0.8rem; padding: 1px 8px; border: 1px solid var(--brass); border-radius: 10px; color: var(--brass); }
.pl-meta { display: flex; gap: 10px; align-items: center; margin: 6px 0; }
.pl-meta input { min-height: 36px; }
.pl-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pl-items li { display: grid; gap: 2px; padding: 6px 0; border-bottom: 1px solid var(--line, rgba(255,255,255,0.08)); }
.pl-ex { font-weight: 600; }
.pl-swap { min-height: 36px; max-width: 100%; justify-self: start; }
.pl-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pl-acts .btn { min-height: 44px; }
.pl-groups { margin: 4px 0 0; }
.pl-mus { color: var(--brass); font-size: 0.85rem; line-height: 1.25; }

/* Veckans set mot målet */
.vg { margin: 0 0 16px; }
.vg h3 { margin: 0 0 8px; font-size: 1rem; }
.vg-row { margin: 8px 0; }
.vg-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.vg-track { position: relative; height: 12px; border-radius: 6px; background: rgba(255,255,255,0.08); overflow: hidden; margin: 4px 0; }
.vg-track i { position: absolute; top: 0; bottom: 0; }
.vg-done { left: 0; background: var(--brass); }
.vg-plan { background: repeating-linear-gradient(45deg, rgba(201,162,74,0.55) 0 4px, rgba(201,162,74,0.2) 4px 8px); }
.vg-band { top: 0; bottom: 0; border-left: 2px solid #f6f0de; border-right: 2px solid #f6f0de; box-sizing: border-box; }
.vg-behind .vg-top b::after { content: ' ⚠'; color: #f3d9a4; }
