:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7684;
  --border: #dde2e8;
  --input: #f8fafb;
  --primary: #2f6fde;
  --primary-text: #ffffff;
  --top: #1e2a3a;
  --top-text: #ffffff;
  --pb: #1f9d3a;
  --pb-bg: #e3f7e8;
  --reppb: #d9821f;
  --reppb-bg: #fff1df;
  --danger: #d23b3b;
  --chip: #eef1f5;
  --grid: #e7ebf0;
  --grad-l: 38%;
  --hm0: #e9edf2;
  --hm1: #b7dfc2;
  --hm2: #6cc285;
  --hm3: #22964a;
  --fruit-a: #ff8a3d;
  --fruit-b: #e8475f;
  --fruit-text: #ffffff;
  --fruit-muted: rgba(255, 255, 255, 0.8);
  --fruit-shadow: rgba(232, 71, 95, 0.25);
  --fruit-accent: #e0435a;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161d;
    --card: #1a212b;
    --text: #e6eaef;
    --muted: #8e99a7;
    --border: #2b3542;
    --input: #141a22;
    --primary: #3d78de;
    --top: #0c1015;
    --pb: #45c862;
    --pb-bg: #173322;
    --reppb: #f0a24a;
    --reppb-bg: #3a2a16;
    --chip: #232c38;
    --grid: #26303c;
    --grad-l: 62%;
    --hm0: #222b36;
    --hm1: #1f4a2c;
    --hm2: #2f7d46;
    --hm3: #4fc56f;
    --fruit-a: #c4561c;
    --fruit-b: #a8283f;
    --fruit-shadow: rgba(0, 0, 0, 0.4);
    --fruit-accent: #ff7d70;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #11161d;
  --card: #1a212b;
  --text: #e6eaef;
  --muted: #8e99a7;
  --border: #2b3542;
  --input: #141a22;
  --primary: #3d78de;
  --top: #0c1015;
  --pb: #45c862;
  --pb-bg: #173322;
  --reppb: #f0a24a;
  --reppb-bg: #3a2a16;
  --chip: #232c38;
  --grid: #26303c;
  --grad-l: 62%;
  --hm0: #222b36;
  --hm1: #1f4a2c;
  --hm2: #2f7d46;
  --hm3: #4fc56f;
  --fruit-a: #c4561c;
  --fruit-b: #a8283f;
  --fruit-shadow: rgba(0, 0, 0, 0.4);
  --fruit-accent: #ff7d70;
  color-scheme: dark;
}

:root[data-theme="dim"] {
  --bg: #2b3038;
  --card: #343a44;
  --text: #e6e9ee;
  --muted: #a3acb8;
  --border: #444b57;
  --input: #2f353e;
  --primary: #7aa7f0;
  --primary-text: #10203a;
  --pb: #5fd47c;
  --pb-bg: #2f4636;
  --reppb: #f2a65a;
  --reppb-bg: #4a3a29;
  --chip: #3b424d;
  --grid: #3d444f;
  --grad-l: 66%;
  --hm0: #363c46;
  --hm1: #355743;
  --hm2: #4f9a63;
  --hm3: #6fd18a;
  --fruit-a: #c66a3b;
  --fruit-b: #b44458;
  --fruit-text: #ffffff;
  --fruit-muted: rgba(255,255,255,0.8);
  --fruit-accent: #ff8f7d;
  --top: #22262c;
  --fruit-shadow: transparent;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--top);
  color: var(--top-text);
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 650; }

.sync-badge {
  border: 0;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.15);
  color: var(--top-text);
  cursor: pointer;
}
.sync-badge:empty { display: none; }
.sync-badge.ok::before { content: "● "; color: #5fd47c; }
.sync-badge.warn::before { content: "● "; color: #ffb547; }
.sync-badge.err::before { content: "● "; color: #ff6b6b; }

main { max-width: 640px; margin: 0 auto; padding: 12px 12px 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}
.card-title { margin: 0 0 10px; font-size: 15px; font-weight: 650; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 550; }

input[type="text"], input[type="url"], input[type="date"], input[type="number"], select {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input);
  min-height: 44px;
}
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input);
  resize: vertical;
}
.field[hidden] { display: none; }
.list-main.wrap { white-space: normal; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
input[type="file"] { max-width: 100%; margin-bottom: 8px; }
select.compact { width: auto; min-height: 36px; padding: 4px 8px; font-size: 13px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

.stepper { display: flex; gap: 4px; }
.stepper input { text-align: center; font-size: 20px; font-weight: 600; padding: 8px 4px; }
.btn.step { min-width: 44px; padding: 0; font-size: 20px; }

.btn {
  border: 1px solid var(--border);
  background: var(--chip);
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  font-weight: 550;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.big { width: 100%; font-size: 17px; min-height: 52px; margin-top: 4px; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: 13px; }

.icon-btn {
  border: 0;
  background: transparent;
  min-width: 40px;
  min-height: 40px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
}
.icon-btn:disabled { opacity: 0.3; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
p { margin: 6px 0; }

.chips { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 10px; padding-bottom: 2px; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  border: 1px solid var(--border);
  background: var(--chip);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
  cursor: pointer;
  font-size: 13.5px;
  min-height: 34px;
}
.chip.on { background: var(--primary); color: var(--primary-text); border-color: transparent; }
.chip.done:not(.on) { color: var(--pb); border-color: var(--pb); background: var(--pb-bg); }

.hints { display: flex; gap: 8px; margin: 0 0 10px; }
.hint { flex: 1; padding: 6px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 600; }
.hint.pb { background: var(--pb-bg); color: var(--pb); }
.hint.reppb { background: var(--reppb-bg); color: var(--reppb); }
.hint.muted { opacity: 0.6; }

.more { margin: 0 0 10px; }
.more summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 0 8px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 10px; }
.check input { width: 20px; height: 20px; }

.set-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.set-chip {
  border: 1px solid var(--border);
  background: var(--chip);
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
}
.set-chip.warmup { opacity: 0.6; font-weight: 400; }

.ex-group { margin-bottom: 10px; }
.ex-name { font-weight: 650; margin: 4px 0; }
.set-rows { display: flex; flex-direction: column; gap: 3px; }
.set-row {
  display: grid;
  grid-template-columns: 26px 1fr auto auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  border: 0;
  border-radius: 8px;
  padding: 7px 8px;
  background: var(--chip);
  cursor: pointer;
  min-height: 38px;
}
.set-row.warmup { opacity: 0.6; }
.set-row.pb { background: var(--pb-bg); color: var(--pb); }
.set-row.reppb { background: var(--reppb-bg); color: var(--reppb); }
.set-no { color: var(--muted); font-size: 12px; text-align: center; }
.set-val { font-weight: 600; }
.set-meta { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.badge { font-size: 12px; font-weight: 700; }

.pr-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pr-table th { font-size: 12px; color: var(--muted); text-align: left; font-weight: 550; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.pr-table td { padding: 5px 6px; border-bottom: 1px solid var(--grid); }
.pr-table tr.empty td { color: var(--muted); }
.pr-table td.dominated { color: var(--muted); opacity: 0.6; }
.pr-table td.weakest { font-weight: 700; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.tab { border: 0; background: transparent; padding: 8px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap; color: var(--muted); font-weight: 550; }
.tab.on { background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--border); }

.list-row { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--grid); padding: 4px 0; }
.list-main { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 8px 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-open { border: 1px solid var(--border); border-radius: 10px; padding: 0 10px 6px; margin: 6px 0; }
.ex-list { padding-left: 22px; margin: 6px 0 10px; }
.ex-list li { display: flex; align-items: center; }
.ex-list .grow { flex: 1; }

.session { padding: 0; overflow: hidden; }
.session > .ex-group { padding: 0 14px; }
.session > .ex-group:last-child { padding-bottom: 12px; }
.session-head { width: 100%; display: flex; justify-content: space-between; align-items: center; border: 0; background: transparent; padding: 12px 14px; text-align: left; cursor: pointer; }
.session-date { font-weight: 650; }
.chev { color: var(--muted); }
.pb-text { color: var(--pb); font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.tiles.small { margin: 10px 0 0; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.tiles.small .tile { background: var(--chip); border: 0; }
.tile-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tiles.small .tile-value { font-size: 17px; }
.tile-label { font-size: 12px; color: var(--muted); }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(4, 1fr); } }

.chart { width: 100%; height: auto; display: block; touch-action: pan-y; user-select: none; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; }
.chart .axis.small { font-size: 10px; }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; }
.chart .dot { fill: var(--card); stroke: var(--primary); stroke-width: 2; }
.chart .dot-active { fill: var(--primary); stroke: var(--card); stroke-width: 2; }
.chart .tip-bg { fill: var(--text); opacity: 0.92; }
.chart .tip { fill: var(--bg); font-size: 13px; font-weight: 600; }
.chart .tip.sub { font-weight: 400; font-size: 11.5px; }
.chart .bar { fill: var(--primary); opacity: 0.55; }
.chart .bar.current { opacity: 1; }
.chart-empty { fill: var(--muted); font-size: 14px; }
.hm.l0, .hm-swatch.l0 { fill: var(--hm0); background: var(--hm0); }
.hm.l1, .hm-swatch.l1 { fill: var(--hm1); background: var(--hm1); }
.hm.l2, .hm-swatch.l2 { fill: var(--hm2); background: var(--hm2); }
.hm.l3, .hm-swatch.l3 { fill: var(--hm3); background: var(--hm3); }
.hm.today { stroke: var(--text); stroke-width: 1.5; }
.legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: 11px; color: var(--muted); margin-top: 6px; }
.hm-swatch { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }

.pb-list { display: flex; flex-direction: column; }
.pb-row { display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }

.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
}
.nav button.on { color: var(--primary); font-weight: 650; }
.nav-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav button[data-view=more] .nav-icon { stroke-width: 3.2; }

.timer {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(66px + env(safe-area-inset-bottom));
  z-index: 15;
  max-width: 616px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  border-radius: 14px;
  background: var(--top);
  color: var(--top-text);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.timer[hidden] { display: none; }
.timer.done { background: var(--pb); }
.timer-label { flex: 1; font-weight: 600; }
.timer-time { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 4px; }
.timer .btn { background: rgba(255, 255, 255, 0.15); color: inherit; border: 0; }
.timer .icon-btn { color: inherit; }

.toast {
  position: fixed;
  left: 50%;
  top: calc(60px + env(safe-area-inset-top));
  transform: translate(-50%, -20px);
  opacity: 0;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  transition: all 0.2s;
  z-index: 50;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { background: var(--pb); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: var(--card);
  width: 100%;
  max-width: 520px;
  border-radius: 16px 16px 0 0;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 90vh;
  overflow-y: auto;
}
@media (min-width: 560px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 16px; }
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 17px; }

/* --- Loggvy: övning → lägst hängande frukt → logga --- */
.ex-picker {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 6px 2px 14px;
  cursor: pointer;
}
.ex-picker-main { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 8px; }
.ex-picker-name { font-size: 26px; font-weight: 750; line-height: 1.15; letter-spacing: -0.01em; }
.ex-picker-eq { display: block; font-size: 13px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.ex-picker .chev { font-size: 18px; }

.fruit {
  background: linear-gradient(135deg, var(--fruit-a), var(--fruit-b));
  color: var(--fruit-text);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px var(--fruit-shadow);
}
.fruit .muted { color: var(--fruit-muted); }
.fruit-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.85; }
.fruit-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 6px 0 10px;
  cursor: pointer;
}
.fruit-target { font-size: 40px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fruit-sub { font-size: 14px; opacity: 0.92; }
.fruit-main:active .fruit-target { opacity: 0.75; }
.fruit-empty { font-size: 17px; font-weight: 600; padding: 8px 0 12px; }
.fruit-alts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fruit-alt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 0;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  min-width: 0;
}
.fa-target { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fa-e1rm { font-size: 12px; }
.fa-e1rm::before { content: "1RM "; }
.fruit-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.fruit-config, .fruit .text-btn {
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.85;
  font-size: 13px;
  padding: 6px 0;
  cursor: pointer;
}
.fruit .text-btn { text-decoration: underline; text-underline-offset: 3px; }
.fruit p { margin: 8px 0 0; }

.entry { padding: 12px; }
.entry-row { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.entry-row .stepper { flex: 1; min-width: 0; }
.entry-row .stepper input { font-size: 22px; }
.entry-row .btn.step { min-width: 38px; }
.times { color: var(--muted); font-size: 18px; }
.entry .btn.big { margin-top: 0; }
.entry .more { margin: 10px 0 0; }

.live { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13.5px; margin: -2px 0 10px; padding: 0 2px; }
.live[hidden] { display: none; }
.live-targets { color: var(--muted); }
.reppb-text { color: var(--reppb); font-weight: 650; }
.verdict { font-weight: 700; color: var(--muted); }
.verdict.pb { color: var(--pb); }
.verdict.reppb { color: var(--reppb); }

.text-link { display: block; text-align: center; color: var(--primary); text-decoration: none; padding: 10px; font-size: 14px; font-weight: 600; }
.text-link[hidden] { display: none; }

.picker-top { display: flex; gap: 6px; }
.picker-top input { flex: 2; }
.picker-top select { flex: 1; min-height: 44px; }
.picker-list { margin-top: 10px; display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; }
.picker-head { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin: 10px 0 4px; }
.picker-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--grid);
  background: transparent;
  padding: 10px 2px;
  cursor: pointer;
  min-height: 44px;
}
.picker-row .small { white-space: nowrap; }
.picker-row.on { font-weight: 700; color: var(--primary); }
.picker-row.new { color: var(--primary); font-weight: 600; }

/* --- Passväljare på loggsidan --- */
.pass-bar { display: flex; align-items: stretch; gap: 8px; margin: 0 -12px 4px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.pass-bar::-webkit-scrollbar { display: none; }
.pass-bar:empty { display: none; }
.pass-select {
  flex: none;
  width: auto;
  min-height: 0;
  align-self: center;
  border: 0;
  background-color: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  padding: 6px 4px;
}
.pass-list { display: flex; gap: 6px; }
.pass-item {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 12px;
  padding: 6px 10px;
  cursor: pointer;
  max-width: 170px;
}
.pass-item.on { border-color: var(--fruit-accent); box-shadow: inset 0 0 0 1px var(--fruit-accent); }
.pass-item.done { opacity: 0.6; }
.pass-item.done.on { opacity: 1; }
.pi-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pi-fruit { font-size: 15px; font-weight: 750; color: var(--fruit-accent); font-variant-numeric: tabular-nums; }
.pi-new { font-size: 11px; color: var(--muted); }

/* --- Förra passet på loggsidan --- */
.last-session { padding: 10px 12px; }
.ls-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.ls-session.compact { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--grid); padding-top: 6px; margin-top: 8px; }
.ls-session.compact .ls-head { margin: 0; flex: none; width: 92px; }
.ls-session.compact .ls-title { display: none; }
.ls-session.compact .set-chips { gap: 4px; flex: 1; min-width: 0; }
.ls-session.compact .set-chip { padding: 3px 7px; min-height: 28px; font-size: 13px; font-weight: 550; }
.ls-session.compact p { display: none; }
.ls-title { font-weight: 650; font-size: 14px; }
.set-chip.top { border-color: var(--text); }
.set-chip.up { border-style: dashed; border-color: var(--fruit-accent); color: var(--fruit-accent); background: transparent; }

/* --- Avskalad förstasida: ingen titelrad, synkprick, dockad inmatning --- */
.nav button { position: relative; }
.sync-badge, [data-design] .sync-badge { position: absolute; top: 4px; left: calc(50% + 8px); width: 14px; height: 14px; padding: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; }
.sync-badge::before, .sync-badge.ok::before, .sync-badge.warn::before, .sync-badge.err::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); opacity: 0.6;
}
.sync-badge.ok::before { background: #3fcf6e; opacity: 1; }
.sync-badge.warn::before { background: #ffb020; opacity: 1; }
.sync-badge.err::before { background: #ff5555; opacity: 1; }
.sync-badge.busy::before { background: var(--muted); opacity: 1; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: 0.3; } }
main { padding-top: calc(12px + env(safe-area-inset-top)); }

.ex-picker { padding: 4px 2px 10px; }
.ex-picker-main { justify-content: flex-start; }
.ex-picker .chev { color: var(--muted); font-size: 16px; }

.fruit-label { display: flex; justify-content: space-between; align-items: center; }
.fruit-details { border: 0; background: rgba(255, 255, 255, 0.18); color: inherit; border-radius: 999px; width: 30px; height: 30px; font-size: 14px; cursor: pointer; }
.fruit-main { padding: 4px 0 6px; }

.last-session { padding: 4px 2px 10px; border-bottom: 1px solid var(--grid); margin-bottom: 12px; }
.ls-row { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.ls-row .grow { flex: 1; }
.ls-title { font-weight: 650; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ls-top { border: 0; background: none; padding: 4px 0; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; cursor: pointer; }
.up-btn { border: 1px dashed var(--fruit-accent); color: var(--fruit-accent); background: transparent; border-radius: 8px; padding: 5px 9px; font-weight: 650; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.ls-session { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--grid); }
.ls-session .ls-date { flex: none; width: 104px; }
.ls-session .set-chips { gap: 4px; }
.ls-session .set-chip { padding: 3px 7px; min-height: 30px; font-size: 13px; }
.ls-session p { display: none; }

.today { padding: 0 2px; }
.section-title { font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 4px 0 8px; }

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(58px + env(safe-area-inset-bottom));
  z-index: 18;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 8px 12px 10px;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
}
.dock > * { max-width: 616px; margin-left: auto; margin-right: auto; }
.dock .entry-row { margin-bottom: 8px; }
.dock .live { margin: 0 0 6px; }
.dock-actions { display: flex; gap: 8px; }
.dock-actions .btn.big { flex: 1; min-height: 50px; margin: 0; }
.dock-more { min-width: 50px; font-size: 20px; position: relative; }
.dock-more.on::after { content: ""; position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--fruit-accent); }
body[data-view="log"] { padding-bottom: calc(var(--dock-h, 130px) + 66px + env(safe-area-inset-bottom)); }
body[data-view="log"] .timer { bottom: calc(var(--dock-h, 130px) + 66px + env(safe-area-inset-bottom)); }
.nav { height: calc(58px + env(safe-area-inset-bottom)); }
.nav button { padding: 6px 0 8px; }
.pass-bar { margin-bottom: 6px; }
.pass-item { flex-direction: row; align-items: center; padding: 7px 12px; font-size: 13.5px; font-weight: 600; white-space: nowrap; border-radius: 999px; max-width: none; }
.ls-row > .small { white-space: nowrap; }

/* Passets övningar på en rad; långa namn radbryts inuti knappen så att fler får plats */
.pass-bar { align-items: center; }
.pass-list { align-items: center; }
.pass-item { min-height: 0; white-space: normal; max-width: 108px; padding: 5px 10px; font-size: 12.5px; font-weight: 550; line-height: 1.2; border-radius: 12px; text-align: left; }

/* Hopfällbar rekordlista i fruktblocket; varje rad ger ett mål att slå */
.fruit-toggle { border: 0; background: none; color: inherit; opacity: 0.85; font: inherit; font-size: 13px; font-weight: 600; padding: 6px 0 0; cursor: pointer; }
.fruit-expand { display: block; margin-top: 4px; font-weight: 550; opacity: 0.75; }
.fruit-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 14px; font-variant-numeric: tabular-nums; }
.fruit-table th { text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.75; padding: 4px 6px; border-bottom: 1px solid color-mix(in srgb, currentColor 30%, transparent); }
.fruit-table td { padding: 6px; border-bottom: 1px solid color-mix(in srgb, currentColor 14%, transparent); }
.fruit-table tr:last-child td { border-bottom: 0; }
.fruit-table tr.pick { cursor: pointer; }
.fruit-table tr.pick:active td { background: color-mix(in srgb, currentColor 14%, transparent); }
.fruit-table tr.out td { opacity: 0.55; }
.fruit-table tr.best td { background: color-mix(in srgb, currentColor 14%, transparent); font-weight: 700; }
.fruit-table tr.untested td { font-size: 13px; opacity: 0.85; }
.fruit-table .fruit-beat { font-weight: 700; white-space: nowrap; }
.fruit-strength { width: 64px; }
.str-bar { display: block; height: 6px; border-radius: 3px; background: color-mix(in srgb, currentColor 22%, transparent); overflow: hidden; }
.str-bar > span { display: block; height: 100%; border-radius: 3px; background: currentColor; opacity: 0.9; }
.str-tag { display: block; font-size: 10.5px; font-weight: 600; opacity: 0.8; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.04em; }
.fruit-date { display: block; font-size: 11px; opacity: 0.75; font-weight: 400; }

/* --- Hierarki på förstasidan: förslaget ska synas mest, resten är neutralt --- */
.fruit { box-shadow: 0 10px 28px var(--fruit-shadow); }
.pass-item.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); background: var(--card); color: var(--text); }
.up-btn { border: 1px solid var(--border); background: var(--chip); color: var(--text); }
.ls-top { color: var(--text); }
.text-link { color: var(--muted); font-weight: 500; }
.today .set-row.pb, .today .set-row.reppb { background: var(--chip); color: var(--text); }
.today .set-row.pb .badge { color: var(--pb); }
.today .set-row.reppb .badge { color: var(--reppb); }
.today .set-row { min-height: 34px; padding: 5px 8px; }
/* Spara är neutral tills vikt och reps är ifyllda */
.dock .btn.primary { background: var(--chip); color: var(--muted); border: 1px solid var(--border); box-shadow: none; transition: background 0.15s, color 0.15s; }
.dock .btn.primary.ready { background: var(--primary); color: var(--primary-text); border-color: transparent; }
/* Vilotimern är neutral; den gröna "klar"-signalen får synas */
.timer:not(.done) { background: var(--card); color: var(--text); border: 1px solid var(--border); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); }
.timer:not(.done) .btn { background: var(--chip); color: var(--text); }
.timer:not(.done) .icon-btn { color: var(--muted); }

/* --- "Slå förra passet": andra blocket, tydligt men under förslaget i hierarkin --- */
.beat { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--fruit-accent); border-radius: 16px; padding: 12px 12px 12px 14px; margin-bottom: 12px; }
.beat-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.beat-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.beat-prev { flex: 1; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.beat .ls-toggle { margin-left: auto; min-width: 32px; min-height: 32px; }
.beat-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.beat-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; border: 1px solid var(--border); background: var(--chip); color: var(--text); border-radius: 12px; padding: 8px 12px; cursor: pointer; min-width: 0; }
.beat-opt:active { border-color: var(--fruit-accent); }
.beat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.beat-target { font-size: 26px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.beat-sub { font-size: 12px; color: var(--muted); }
.beat-sessions { margin-top: 8px; }
.beat-sessions .ls-session:first-child { border-top: 1px solid var(--grid); }
.beat-head { row-gap: 0; }
.beat-prev { order: 3; flex-basis: 100%; white-space: normal; }


/* Skivlastning: en symmetrisk stång med det egna skivförrådets färger. */
.loading-card { margin: 2px 0 12px; padding: 10px 2px; border-top: 1px solid var(--border); color: var(--text); overflow: hidden; }
.loading-card[hidden] { display: none; }
.loading-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.loading-eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); }
.loading-equipment { margin-top: 2px; font-size: 11px; color: var(--muted); }
.loading-total { font-size: 18px; font-weight: 650; letter-spacing: -.02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.loading-total > span { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.barbell-scene { position: relative; display: flex; align-items: center; height: 72px; width: 100%; max-width: 300px; margin: 4px auto; padding: 0 6px; isolation: isolate; }
.barbell-scene::after { content: ""; position: absolute; bottom: 0; left: 8%; right: 8%; height: 6px; background: radial-gradient(ellipse, #0003, transparent 70%); z-index: -1; }
.barbell-shaft { position: absolute; left: 0; right: 0; height: 4px; border: 1px solid #77828d; border-radius: 3px; background: linear-gradient(#eef3f6, #a0aab4 50%, #d2d9df 60%, #818c97); z-index: -1; }
.barbell-side { flex: 1; min-width: 0; height: 64px; display: flex; align-items: center; gap: 1px; }
.barbell-left { justify-content: flex-end; }
.barbell-right { justify-content: flex-start; }
.barbell-grip { width: 30%; max-width: 90px; min-width: 34px; height: 3px; flex-shrink: 0; background: repeating-linear-gradient(110deg, #88939d 0 1px, #c6cfd6 1px 3px); }
.barbell-collar { height: 13px; width: 3px; flex-shrink: 0; border: 1px solid #7b8791; border-radius: 2px; background: linear-gradient(90deg, #909ba6, #e5eaf0, #8e99a3); }
.plate-blue { --plate-color: #2875d4; --plate-ink: #fff; }
.plate-yellow { --plate-color: #e6bb2e; --plate-ink: #342a09; }
.plate-green { --plate-color: #269468; --plate-ink: #fff; }
.plate-gray { --plate-color: #707984; --plate-ink: #fff; }
.plate-silver { --plate-color: #b8c2cc; --plate-ink: #28333d; }
.plate-red { --plate-color: #d63b3b; --plate-ink: #fff; }
.barbell-plate { display: flex; align-items: center; justify-content: center; height: 64px; width: 14px; min-width: 14px; flex-shrink: 0; border-radius: 4px; color: var(--plate-ink); background: linear-gradient(90deg, #ffffff35, transparent 35%, #0002), var(--plate-color); border: 1px solid #0002; box-shadow: inset 1px 0 #ffffff40, 1px 2px 3px #0002; }
.barbell-plate > span { font-size: 9px; line-height: 1; font-weight: 700; white-space: nowrap; writing-mode: vertical-rl; text-orientation: mixed; }
.barbell-plate.plate-silver { width: 14px; border-radius: 3px; }
.loading-caption { color: var(--muted); font-size: 10px; font-weight: 500; }
.loading-plates { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 12px; }
.loading-chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 0; font-weight: 500; font-variant-numeric: tabular-nums; }
.plate-dot { display: inline-block; width: 6px; height: 11px; background: var(--plate-color); border-radius: 3px; box-shadow: inset 1px 0 #ffffff60; }
.loading-footnote { font-size: 11px; color: var(--muted); margin: 10px 0 0; }
.loading-warning { font-size: 13px; padding: 10px 12px; border-left: 3px solid #e6bb2e; background: var(--chip); border-radius: 6px; margin-bottom: 0; }


.barbell-scroll { overflow-x: auto; }
.loading-status { margin: 4px 0; font-size: 12px; color: var(--muted); }

/* Uppvärmningssteg i skivlastningskortet */
.warmup-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 8px 0 2px; }
.warmup-arrow { color: var(--muted); font-size: 12px; }
.warmup-step { border: 1px solid var(--border); background: var(--card); color: var(--muted); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; min-height: 0; }
.warmup-step.top { color: var(--text); }
.warmup-step.on { border-color: var(--text); color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.loading-status strong { color: var(--text); font-weight: 650; }

/* Viktskivor under Utrustning */
.plates-edit { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.plates-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.plates-w { font-weight: 650; font-variant-numeric: tabular-nums; }
.plates-row .stepper { flex: none; width: 140px; align-items: center; }
.plates-row .btn.step { min-width: 40px; min-height: 36px; height: 36px; font-size: 18px; margin: 0; }
.plates-n { flex: 1; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.plates-add { flex-wrap: nowrap; }
.plates-add input { flex: 1; min-width: 0; }
.plates-add .btn { flex: none; margin: 0; }

/* Specialstänger och hantel i skivlastningskortet */
.bar-mid { display: block; width: 36%; max-width: 124px; min-width: 96px; height: 64px; flex-shrink: 0; }
.bar-mid svg { display: block; overflow: visible; }
.bar-axle .barbell-shaft { height: 10px; border-radius: 5px; }
.barbell-grip.grip-axle { height: 12px; border: 1px solid #77828d; border-radius: 5px; background: linear-gradient(#eef3f6, #a0aab4 50%, #d2d9df 60%, #818c97); }
.bar-axle .barbell-collar { height: 20px; width: 4px; }
.bar-log .barbell-side, .bar-swiss .barbell-side, .bar-transformer .barbell-side { max-width: 34%; }
.dumbbell-scene { max-width: 300px; margin: 4px auto 0; }
.dumbbell-scene svg { display: block; }
/* Svartlackade stänger (Apollon/Axle, Swiss bar, Transformer) */
.bar-axle .barbell-shaft, .bar-axle .barbell-grip.grip-axle, .bar-swiss .barbell-shaft, .bar-transformer .barbell-shaft { border-color: #1f2327; background: linear-gradient(#8a929b, #50565d 40%, #33383e); }
.bar-axle .barbell-collar, .bar-swiss .barbell-collar, .bar-transformer .barbell-collar { border-color: #1f2327; background: linear-gradient(90deg, #50565d, #8a929b, #50565d); }
/* Stänger med egen mittdel: stången syns bara ute på hylsorna, inte genom ramen */
.bar-svg .barbell-shaft { display: none; }
.bar-svg .barbell-side { background: linear-gradient(transparent calc(50% - 2.5px), #77828d calc(50% - 2.5px), #eef3f6 calc(50% - 1.5px), #a0aab4 50%, #818c97 calc(50% + 1.5px), #77828d calc(50% + 2.5px), transparent calc(50% + 2.5px)); }
.bar-swiss .barbell-side, .bar-transformer .barbell-side { background: linear-gradient(transparent calc(50% - 2.5px), #1f2327 calc(50% - 2.5px), #8a929b calc(50% - 1.5px), #50565d 50%, #33383e calc(50% + 2.5px), transparent calc(50% + 2.5px)); }
