/* ============================================================
   Get Fit – mobil først. Lyst/mørkt tema følger telefonens indstilling.
   ============================================================ */

:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --card: #ffffff;
  --field: #f2f2f0;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #76756f;
  --hair: #e1e0d9;
  --axis: #c3c2b7;
  --accent: #256abf;
  --accent-ink: #ffffff;
  --accent-soft: #e3eefb;
  --link: #1f5fae;
  --good: #0ca30c;
  --good-ink: #006300;
  --good-soft: #e3f4e3;
  --warn: #fab219;
  --warn-soft: #fff3d1;
  --warn-ink: #5c3f00;
  --crit: #d03b3b;
  --crit-soft: #fdeaea;
  --crit-ink: #8f1d1d;
  /* Serier og pas (valideret for farveblindhed og kontrast) */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --pas-A: var(--s1);
  --pas-A-ink: #ffffff;
  --pas-B: var(--s2);
  --pas-B-ink: #0b0b0b;
  --pas-C: var(--s3);
  --pas-C-ink: #0b0b0b;
  --radius: 14px;
  --tabbar-h: 58px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --field: #2c2c2e;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #9a9991;
    --hair: #333331;
    --axis: #48484a;
    --accent: #2f74cc;
    --accent-ink: #ffffff;
    --accent-soft: #15283f;
    --link: #6da7ec;
    --good-ink: #3fcf3f;
    --good-soft: #0f2a10;
    --warn-soft: #3a2c05;
    --warn-ink: #ffd776;
    --crit-soft: #3b1414;
    --crit-ink: #ff9d9d;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --shadow: none;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

a {
  color: var(--link);
}

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

/* ---------- Ramme ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}

.topbar h1 {
  font-size: 22px;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .back {
  border: 0;
  background: none;
  color: var(--link);
  font-size: 17px;
  padding: 6px 4px;
  margin-left: -4px;
  cursor: pointer;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 4px 16px calc(var(--tabbar-h) + var(--safe-b) + 96px);
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  padding-bottom: var(--safe-b);
  background: var(--card);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--hair);
}

.tabbar a {
  flex: 1;
  height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}

.tabbar a svg {
  width: 26px;
  height: 26px;
}

.tabbar a.active {
  color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  .tabbar a.active {
    color: var(--link);
  }
}

/* ---------- Kort og tekst ---------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 12px;
  box-shadow: var(--shadow);
}

.card > h2 {
  font-size: 17px;
  margin-bottom: 10px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 20px 4px 8px;
}

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

.small {
  font-size: 14px;
}

.xsmall {
  font-size: 12px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row.wrap {
  flex-wrap: wrap;
}

.spacer {
  flex: 1;
}

.stack > * + * {
  margin-top: 10px;
}

.center {
  text-align: center;
}

/* ---------- Knapper ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
}

.btn:active {
  filter: brightness(0.92);
}

.btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.btn.small svg {
  width: 18px;
  height: 18px;
}

.btn.block {
  display: flex;
  width: 100%;
}

.btn.secondary {
  background: var(--accent-soft);
  color: var(--link);
}

.btn.ghost {
  background: transparent;
  color: var(--link);
  min-height: 44px;
  padding: 0 12px;
  font-weight: 500;
}

.btn.danger {
  background: var(--crit-soft);
  color: var(--crit-ink);
}

.btn.small {
  min-height: 40px;
  font-size: 15px;
  padding: 0 14px;
  border-radius: 10px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn-row {
  display: flex;
  gap: 10px;
}

.btn-row > .btn {
  flex: 1;
}

/* ---------- Badges og bannere ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--field);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.chip.accent {
  background: var(--accent-soft);
  color: var(--link);
}

.pas-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  flex: none;
}

.pas-dot.big {
  width: 56px;
  height: 56px;
  font-size: 26px;
}

.pas-A {
  background: var(--pas-A);
  color: var(--pas-A-ink);
}

.pas-B {
  background: var(--pas-B);
  color: var(--pas-B-ink);
}

.pas-C {
  background: var(--pas-C);
  color: var(--pas-C-ink);
}

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  margin: 0 0 12px;
  font-size: 15px;
}

.banner .ico {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
}

.banner b {
  display: block;
}

.banner.warn {
  background: var(--warn-soft);
  color: var(--warn-ink);
}

.banner.warn .ico {
  color: #c98500;
}

.banner.crit {
  background: var(--crit-soft);
  color: var(--crit-ink);
}

.banner.crit .ico {
  color: var(--crit);
}

.banner.info {
  background: var(--accent-soft);
  color: var(--ink);
}

.banner.info .ico {
  color: var(--s1);
}

.banner.good {
  background: var(--good-soft);
  color: var(--ink);
}

.banner.good .ico {
  color: var(--good);
}

.banner .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* ---------- I dag ---------- */

.hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero .label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.hero h2 {
  font-size: 28px;
  font-weight: 700;
}

.phase-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--field);
}

.phase-box .phase-title {
  font-weight: 700;
}

.week-dots {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.week-dots span {
  width: 26px;
  height: 6px;
  border-radius: 3px;
  background: var(--axis);
}

.week-dots span.done {
  background: var(--good);
}

.week-dots span.now {
  background: var(--accent);
}

.ex-list {
  list-style: none;
  margin: 14px 0 16px;
  padding: 0;
}

.ex-list li {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--hair);
}

.ex-list li:first-child {
  border-top: 0;
}

.ex-list .num {
  flex: none;
  width: 22px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ex-list .name {
  font-weight: 600;
}

.ex-list .meta {
  font-size: 14px;
  color: var(--ink-2);
}

.ex-list .hint {
  font-size: 13px;
  color: var(--good-ink);
  font-weight: 600;
}

/* ---------- Aktivt pas ---------- */

.session-head {
  position: sticky;
  top: calc(var(--safe-t) + 52px);
  z-index: 10;
  margin: 0 -16px 12px;
  padding: 8px 16px 10px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
}

.progress {
  height: 6px;
  border-radius: 3px;
  background: var(--axis);
  overflow: hidden;
  margin-top: 8px;
}

.progress > div {
  height: 100%;
  background: var(--good);
  border-radius: 3px;
  transition: width 0.25s;
}

.ex-card {
  padding: 0;
  overflow: hidden;
}

.ex-card .ex-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.ex-card .ex-head .n {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--field);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.ex-card.complete .ex-head .n {
  background: var(--good);
  color: #fff;
}

.ex-card .ex-head h3 {
  font-size: 18px;
}

.ex-card .ex-head .sub {
  font-size: 14px;
  color: var(--ink-2);
  margin-top: 2px;
}

.ex-card .ex-head .chev {
  margin-left: auto;
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: transform 0.2s;
  flex: none;
}

.ex-card.collapsed .ex-head .chev {
  transform: rotate(-90deg);
}

.ex-card.collapsed .ex-body {
  display: none;
}

.ex-body {
  padding: 0 16px 16px;
}

.ex-tip {
  margin: 12px 0 0;
  font-size: 15px;
}

.ex-tip b {
  color: var(--ink);
}

.ex-note {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.suggestion {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--good-soft);
  font-size: 15px;
}

.suggestion.neutral {
  background: var(--field);
}

.suggestion .ico {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--good);
}

.suggestion.neutral .ico {
  color: var(--muted);
}

.suggestion .btn {
  margin-top: 8px;
}

/* Illustration: to billeder, der skifter som et lille klip */

.illu {
  position: relative;
  margin: 0 -16px;
  aspect-ratio: 4 / 3;
  max-height: 300px;
  width: calc(100% + 32px);
  background: #ffffff;
  overflow: hidden;
  cursor: pointer;
}

.illu .frame {
  position: absolute;
  inset: 0;
}

.illu img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.illu .frame .tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.illu .frame + .frame {
  animation: flip 2.8s ease-in-out infinite;
}

.illu.paused .frame + .frame {
  animation-play-state: paused;
}

.illu .paused-tag {
  display: none;
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.illu.paused .paused-tag {
  display: block;
}

@keyframes flip {
  0%,
  38% {
    opacity: 0;
  }
  50%,
  88% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .illu.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    aspect-ratio: 8 / 3;
  }
  .illu.two .frame {
    position: relative;
  }
  .illu .frame + .frame {
    animation: none;
  }
}

/* Sæt-tabel */

.sets {
  margin-top: 14px;
}

.set-head,
.set-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) minmax(0, 0.8fr) 52px 48px;
  gap: 8px;
  align-items: center;
}

.set-head.timed > :nth-child(2),
.set-row.timed > :nth-child(2) {
  grid-column: 2 / 4;
}

.set-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 0 4px;
}

.set-row {
  padding: 5px 0;
}

.set-row .idx {
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.set-row input {
  width: 100%;
  height: 46px;
  padding: 0 10px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: var(--field);
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -webkit-appearance: none;
  appearance: none;
}

.set-row input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
}

.set-row input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.set-row .rir {
  font-size: 13px;
  color: var(--ink-2);
  text-align: center;
  line-height: 1.15;
}

.set-row .rir b {
  display: block;
  font-size: 15px;
  color: var(--ink);
}

.set-row .rir.hard b {
  color: var(--crit-ink);
}

.check {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--axis);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.check svg {
  width: 24px;
  height: 24px;
}

.set-row.done .check {
  background: var(--good);
  border-color: var(--good);
  color: #fff;
}

.set-row.done input {
  background: var(--good-soft);
}

.set-row .del {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--crit);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.set-row .del svg {
  width: 22px;
  height: 22px;
}

.set-tools {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Meget smalle telefoner (fx iPhone SE 1. gen.) */
@media (max-width: 360px) {
  .set-head,
  .set-row {
    grid-template-columns: 22px minmax(0, 1fr) minmax(0, 0.8fr) 40px 46px;
    gap: 6px;
  }
  .set-row input {
    padding: 0 4px;
    font-size: 17px;
  }
}

/* ---------- Pausetimer ---------- */

.timer {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px);
  z-index: 40;
  max-width: 616px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: #1c1c1e;
  color: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  .timer {
    background: #2c2c2e;
  }
}

.timer[hidden] {
  display: none;
}

.timer .t-main {
  flex: 1;
  min-width: 0;
}

.timer .t-label {
  font-size: 12px;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer .t-time {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.timer .t-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  margin-top: 4px;
  overflow: hidden;
}

.timer .t-bar div {
  height: 100%;
  background: #3fcf3f;
}

.timer button {
  min-width: 48px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.timer.finished {
  background: var(--good);
  animation: pulse 0.6s ease-in-out 3;
}

@keyframes pulse {
  50% {
    transform: scale(1.03);
  }
}

/* ---------- Formularer ---------- */

.field {
  display: block;
  margin: 0 0 14px;
}

.field:last-child {
  margin-bottom: 0;
}

.field > span {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.field small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.input,
select.input,
textarea.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: var(--field);
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}

select.input {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

textarea.input {
  min-height: 80px;
  resize: vertical;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
}

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

.set-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--hair);
}

.set-line:first-of-type {
  border-top: 0;
}

.set-line .input {
  width: 110px;
  text-align: right;
  flex: none;
}

.switch {
  position: relative;
  width: 51px;
  height: 31px;
  flex: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--axis);
  transition: background 0.2s;
}

.switch span::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}

.switch input:checked + span {
  background: var(--good);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.switch input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.day-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.day-picker button {
  height: 44px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--field);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.day-picker button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ---------- Historik ---------- */

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cal-nav h2 {
  font-size: 18px;
  text-transform: capitalize;
}

.cal-nav button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--field);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cal-nav button svg {
  width: 20px;
  height: 20px;
}

.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.cal .dow {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding-bottom: 4px;
}

.cal .day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  position: relative;
  border: 0;
  background: none;
  padding: 0;
}

.cal .day.planned {
  box-shadow: inset 0 0 0 1.5px var(--axis);
}

.cal .day.today {
  font-weight: 800;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.cal .day.has {
  font-weight: 700;
  cursor: pointer;
}

.cal .day.pas-A {
  background: var(--pas-A);
  color: var(--pas-A-ink);
}

.cal .day.pas-B {
  background: var(--pas-B);
  color: var(--pas-B-ink);
}

.cal .day.pas-C {
  background: var(--pas-C);
  color: var(--pas-C-ink);
}

.cal .day.has .num {
  display: none;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-2);
}

.cal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cal-legend i {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--hair);
  text-decoration: none;
  color: inherit;
}

.list-item:first-child {
  border-top: 0;
}

.list-item .grow {
  flex: 1;
  min-width: 0;
}

.list-item .title {
  font-weight: 600;
}

.list-item .sub {
  font-size: 14px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item .chev {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex: none;
}

.list-card {
  padding: 0;
  overflow: hidden;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.stat .v {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
}

.stat .l {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- Grafer ---------- */

.chart {
  position: relative;
  margin-top: 8px;
  touch-action: pan-y;
}

.chart svg {
  display: block;
  width: 100%;
  overflow: visible;
  outline: none;
}

.chart svg:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.chart .grid line {
  stroke: var(--hair);
  stroke-width: 1;
}

.chart .baseline {
  stroke: var(--axis);
  stroke-width: 1;
}

.chart text {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart text.end-label {
  fill: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

.chart .series path {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart .series circle {
  stroke: var(--card);
  stroke-width: 2;
}

.chart .crosshair {
  stroke: var(--axis);
  stroke-width: 1;
}

.chart .tip {
  position: absolute;
  top: 0;
  pointer-events: none;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
  z-index: 2;
}

.chart .tip .d {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.chart .tip .r {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart .tip .r b {
  font-size: 15px;
}

.chart .tip .r span {
  color: var(--ink-2);
}

.key {
  display: inline-block;
  width: 14px;
  height: 2px;
  border-radius: 1px;
  vertical-align: middle;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--ink-2);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data th,
table.data td {
  text-align: left;
  padding: 8px 6px;
  border-top: 1px solid var(--hair);
  vertical-align: top;
}

table.data th {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-top: 0;
}

table.data td.num,
table.data th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Dialog og toast ---------- */

dialog {
  width: min(92vw, 440px);
  max-height: 86vh;
  border: 0;
  border-radius: 18px;
  padding: 20px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

dialog h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

dialog p {
  margin: 0 0 12px;
  color: var(--ink-2);
}

dialog .btn-row {
  margin-top: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--safe-t) + 12px);
  z-index: 60;
  transform: translate(-50%, -150%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: #1c1c1e;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  transition: transform 0.25s;
  pointer-events: none;
}

.toast.show {
  transform: translate(-50%, 0);
}

.toast.error {
  background: var(--crit);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 12px;
}

.credits {
  font-size: 13px;
  color: var(--ink-2);
}

.credits p {
  margin: 0 0 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Profil, login og synkronisering ---------- */

.loading {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

body.auth-mode .tabbar,
body.auth-mode .topbar {
  display: none;
}

body.auth-mode main {
  padding-bottom: 48px;
}

.auth {
  max-width: 420px;
  margin: 0 auto;
  padding-top: calc(var(--safe-t) + 32px);
  text-align: center;
}

.auth > h2 {
  font-size: 30px;
  font-weight: 800;
  margin-top: 12px;
}

.auth > p {
  margin: 4px 0 20px;
}

.auth-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

.auth form {
  text-align: left;
}

.auth .banner {
  text-align: left;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--field);
}

.segmented button {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-2);
  cursor: pointer;
}

.segmented button[aria-selected='true'] {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.form-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--crit-soft);
  color: var(--crit-ink);
  font-size: 15px;
}

.form-error[hidden] {
  display: none;
}

.sync-badge {
  flex: none;
  width: 40px;
  height: 40px;
  margin-right: -6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sync-badge[hidden] {
  display: none;
}

.sync-badge svg {
  width: 26px;
  height: 26px;
}

.sync-badge.ok {
  color: var(--muted);
}

.sync-badge.busy {
  color: var(--link);
}

.sync-badge.busy svg {
  animation: sync-pulse 1s ease-in-out infinite alternate;
}

.sync-badge.warn {
  color: #c98500;
}

.sync-badge.crit {
  color: var(--crit);
}

@keyframes sync-pulse {
  to {
    opacity: 0.35;
  }
}

.profile-ico {
  width: 36px;
  height: 36px;
  padding: 6px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--link);
  flex: none;
}
