:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #6c6c70; /* readable grey (4.5:1 on --bg), as iOS with Increase Contrast */
  --line: #e5e5ea;
  --fill: #eeeef3;
  --danger: #d70015; /* readable red on light backgrounds */
  --bar: rgba(242, 242, 247, 0.88);
  --tabbar: rgba(249, 249, 251, 0.9);
  --tab-h: 50px;
  color-scheme: light;
}

/* Themes. --accent is set from Settings in app.js. "Automatiskt" (no data-theme) follows the phone. */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f2f2f7;
    --muted: #8e8e93;
    --line: #2c2c2e;
    --fill: #2c2c2e;
    --danger: #ff453a;
    --bar: rgba(0, 0, 0, 0.82);
    --tabbar: rgba(22, 22, 24, 0.9);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --card: #1c1c1e;
  --text: #f2f2f7;
  --muted: #8e8e93;
  --line: #2c2c2e;
  --fill: #2c2c2e;
  --danger: #ff453a;
  --bar: rgba(0, 0, 0, 0.82);
  --tabbar: rgba(22, 22, 24, 0.9);
  color-scheme: dark;
}

:root[data-theme="midnatt"] {
  --bg: #0b1020;
  --card: #161d33;
  --text: #e8ecf8;
  --muted: #8b93ad;
  --line: #262f4d;
  --fill: #232b47;
  --danger: #ff6b6b;
  --bar: rgba(11, 16, 32, 0.85);
  --tabbar: rgba(14, 19, 36, 0.9);
  color-scheme: dark;
}

:root[data-theme="papper"] {
  --bg: #f3ede2;
  --card: #fffaf1;
  --text: #2b2620;
  --muted: #71685c;
  --line: #e5dac8;
  --fill: #ece3d4;
  --bar: rgba(243, 237, 226, 0.88);
  --tabbar: rgba(247, 242, 233, 0.92);
  color-scheme: light;
}

:root[data-theme="skog"] {
  --bg: #0f1a15;
  --card: #18271f;
  --text: #e6f0e9;
  --muted: #8ea597;
  --line: #24382d;
  --fill: #22362b;
  --danger: #ff7a6b;
  --bar: rgba(15, 26, 21, 0.85);
  --tabbar: rgba(17, 29, 23, 0.9);
  color-scheme: dark;
}

:root[data-theme="hav"] {
  --bg: #eaf3f8;
  --card: #ffffff;
  --text: #13232e;
  --muted: #5b6f7b;
  --line: #d6e5ee;
  --fill: #e1edf4;
  --bar: rgba(234, 243, 248, 0.88);
  --tabbar: rgba(240, 247, 251, 0.92);
  color-scheme: light;
}

/* Buttons, links and switches are monochrome: the theme's text color (white on dark themes, near-black on
   light ones), with the theme's background color for text on them. The goal's own color marks the goal. */
:root {
  --accent: var(--text);
  --on-accent: var(--bg);
  --accent-soft: color-mix(in srgb, var(--accent) 15%, transparent);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }

#view {
  padding: 0 16px calc(var(--tab-h) + 40px + env(safe-area-inset-bottom));
  max-width: 680px;
  margin: 0 auto;
}

/* Tab bar */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--tabbar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--line);
}
.tabbar button {
  flex: 1;
  height: var(--tab-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
}
.tabbar svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--accent); }

/* Navigation bar */

.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -16px;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 44px;
}
.bar .title { font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .left { justify-self: start; min-width: 0; max-width: 100%; }
.bar .right { justify-self: end; display: flex; gap: 4px; }
.bar-btn { color: var(--accent); display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 4px; max-width: 100%; }
.bar-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.bar-btn.icon svg { width: 26px; height: 26px; stroke-width: 2; }

.large-title { font-size: 34px; font-weight: 700; letter-spacing: 0.01em; margin: 4px 0 14px; }
.top-pad { height: calc(env(safe-area-inset-top) + 20px); }

/* Groups (iOS inset grouped lists) */

.section-label {
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin: 26px 16px 7px;
}
.section-hint { font-size: 13px; color: var(--muted); margin: 7px 16px 0; line-height: 1.4; }

.group { background: var(--card); border-radius: 12px; overflow: hidden; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 16px;
  position: relative;
  width: 100%;
  text-align: left;
}
.row + .row::before, .row + .text::before {
  content: "";
  position: absolute;
  top: 0; left: 16px; right: 0;
  border-top: 0.5px solid var(--line);
}
.row label, .row .label { flex: 1; }
.row .value { color: var(--muted); }
.row input[type="number"], .row input[type="time"], .row select, .date-wrap input {
  border: 0;
  background: var(--fill);
  border-radius: 8px;
  padding: 6px 10px;
  min-height: 34px;
  text-align: right;
  -webkit-appearance: none;
  appearance: none;
}
.row input[type="number"] { width: 80px; }
.row select { text-align: left; padding-right: 10px; }

/* Date field with an explicit clear button: iOS's own "Nollställ" can't always clear a value. */
.date-wrap { display: flex; align-items: center; gap: 6px; }
.date-wrap input { min-width: 130px; }
.date-wrap input.empty { color: var(--muted); }
.date-wrap .clear {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--muted);
  display: grid;
  place-items: center;
  flex: none;
}
.date-wrap .clear svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; }
.date-wrap:not(.has-value) .clear { visibility: hidden; }

.text {
  display: block;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 12px 16px;
  resize: none;
  min-height: 46px;
  line-height: 1.4;
  position: relative;
}
textarea.text { min-height: 92px; overflow: hidden; }
.text::placeholder { color: var(--muted); opacity: 0.75; }
.text.title-input { font-size: 22px; font-weight: 600; min-height: 56px; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) {
  .pair { grid-template-columns: 1fr; gap: 0; }
}

/* Swatches (accent and goal colors) */

.swatches { display: flex; flex-wrap: wrap; gap: 12px; padding: 14px 16px; }
.swatch {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--c);
  position: relative;
  display: grid;
  place-items: center;
}
.swatch.sel::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2.5px solid var(--c);
}
.swatch svg { width: 16px; height: 16px; stroke: #fff; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.swatch.sel svg { opacity: 1; }
.swatch.custom { background: conic-gradient(#ff3b30, #ff9500, #ffcc00, #34c759, #0a84ff, #5e5ce6, #af52de, #ff3b30); }
.swatch.custom.sel { background: var(--c); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; border: 0; padding: 0; }

/* Theme picker */

.theme-row .preview {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 0.5px solid rgba(128, 128, 128, 0.35);
  flex: none;
  display: grid;
  place-items: center;
}
.theme-row .preview i { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.theme-row .tick { color: var(--accent); width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; flex: none; }
.theme-row.sel .tick { visibility: visible; }
.theme-row small { display: block; color: var(--muted); font-size: 13px; }

/* Switch */

.row .switch, .switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--fill); 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 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { background: var(--on-accent); }
.switch input:checked + span::after { transform: translateX(20px); }

/* Buttons */

.primary {
  display: block;
  width: 100%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  border-radius: 12px;
  min-height: 50px;
  margin-top: 16px;
}
.secondary {
  display: block;
  width: 100%;
  background: var(--card);
  color: var(--accent);
  font-weight: 600;
  border-radius: 12px;
  min-height: 50px;
  margin-top: 10px;
}
.link-row { color: var(--accent); text-decoration: none; }
.link-row.danger { color: var(--danger); }
.chev { color: var(--muted); opacity: 0.6; font-size: 20px; }

/* Goal cards (achieved list) */

.goal-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-left: 4px solid var(--g, var(--accent));
}
.goal-card h2 { font-size: 18px; font-weight: 600; margin: 0 0 4px; overflow-wrap: anywhere; }
.goal-card h2.untitled { color: var(--muted); }
.meta { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: 2px;
  margin-left: 6px;
}
.badge.late { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.progress { height: 6px; background: var(--fill); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; background: var(--g, var(--accent)); border-radius: 99px; transition: width 0.25s; }

/* Home: one full-screen page per active goal, swiped sideways */

.pager {
  position: fixed;
  top: 0; left: 0; right: 0;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.pager::-webkit-scrollbar { display: none; }
.page {
  flex: 0 0 100%;
  height: 100%;
  overflow-y: auto;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overscroll-behavior-y: contain;
  padding: calc(env(safe-area-inset-top) + 18px) 16px 64px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--g) 26%, var(--bg)) 0, var(--bg) 420px);
}
.page-inner { max-width: 600px; margin: 0 auto; }
.page.plain { background: var(--bg); }

.page-dots {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 10px);
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 99px;
  background: var(--tabbar);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  z-index: 6;
}
.page-dots button { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: 0.4; transition: opacity 0.2s, background 0.2s; }
.page-dots button.on { opacity: 1; background: var(--text); }
.page-dots button.plus { border-radius: 2px; }

.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.eyebrow { text-transform: uppercase; font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; color: color-mix(in srgb, var(--g) 60%, var(--text)); }
.brand { height: 22px; width: auto; flex: none; display: block; }
.hero-title { font-size: 34px; line-height: 1.12; font-weight: 800; letter-spacing: -0.01em; margin: 8px 0 8px; overflow-wrap: anywhere; }
.hero-title.untitled { color: var(--muted); }
.hero-desc { margin: 0 0 6px; color: var(--muted); font-size: 16px; line-height: 1.45; white-space: pre-line; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 16px 0 12px; }
.stat { background: var(--card); border-radius: 14px; padding: 12px 12px 10px; }
.stat b { display: block; font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--g) 75%, var(--text)); }
.stat span { font-size: 12.5px; color: var(--muted); }
.timeline { margin: 4px 2px 0; }
.timeline .progress { margin-top: 0; }
.timeline .ends { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.m-card { background: var(--card); border-radius: 16px; padding: 16px; margin-top: 12px; }
.m-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
.m-card h3 svg { width: 20px; height: 20px; flex: none; stroke: var(--g); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m-card .why { font-size: 20px; line-height: 1.4; font-weight: 600; margin: 0; white-space: pre-line; }
.m-card .missing { color: var(--muted); font-size: 15px; margin: 0; }
.m-card .missing button { color: var(--accent); font-weight: 600; }
.m-card ul { margin: 0; padding: 0; list-style: none; }
.m-card li { position: relative; padding-left: 20px; margin: 6px 0; line-height: 1.4; }
.m-card li::before { content: ""; position: absolute; left: 4px; top: 0.55em; width: 7px; height: 7px; border-radius: 50%; background: var(--g); }


.ob { display: grid; gap: 3px; padding: 10px 0; }
.ob:first-of-type { padding-top: 2px; }
.ob + .ob { border-top: 0.5px solid var(--line); }
.ob-h { font-size: 14px; color: var(--muted); }
.ob-l { font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.ob-l::before { content: "→"; color: var(--g); font-weight: 700; }

.now-sprint { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; width: 100%; text-align: left; }
.now-sprint b { font-size: 17px; }
.now-sprint span { font-size: 13px; color: var(--muted); white-space: nowrap; }
.mini-acts { margin-top: 6px; }
.mini-act { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 0; font-size: 15.5px; }
.mini-act .ring { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); flex: none; display: grid; place-items: center; }
.mini-act .ring svg { width: 12px; height: 12px; stroke: #fff; fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.mini-act.done .ring { background: var(--g); border-color: var(--g); }
.mini-act.done .ring svg { opacity: 1; }
.mini-act.done .t { color: var(--muted); text-decoration: line-through; }
.mini-act .d { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.mini-act .d.late { color: var(--danger); }
.text-btn { color: var(--accent); font-weight: 600; font-size: 15px; margin-top: 6px; min-height: 32px; }

.empty { text-align: center; padding: 40px 12px 10px; color: var(--muted); }
.empty svg { width: 72px; height: 72px; stroke: var(--accent); fill: none; stroke-width: 1.6; margin-bottom: 12px; }
.empty h2 { color: var(--text); font-size: 24px; margin: 0 0 8px; }
.empty p { line-height: 1.45; margin: 0 auto; max-width: 340px; }

/* Rating scales */

.scale { padding: 12px 16px 14px; }
.scale + .scale { border-top: 0.5px solid var(--line); }
.scale-q { font-size: 15px; margin-bottom: 10px; }
.scale-q small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.dots { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.dots button, .yesno button {
  min-height: 36px;
  border-radius: 8px;
  background: var(--fill);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s, color 0.15s;
}
.dots button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.dots button.sel { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.yesno { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.yesno button.sel { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* Sprint list inside goal */

.sprint-row { padding: 10px 16px; }
.sprint-row .num {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--g, var(--accent)) 16%, transparent);
  color: color-mix(in srgb, var(--g, var(--accent)) 60%, var(--text));
  font-weight: 700;
  font-size: 15px;
  display: grid;
  place-items: center;
}
.sprint-row .num.done { background: color-mix(in srgb, var(--g, var(--accent)) 72%, #000); color: #fff; }
.sprint-row .info { flex: 1; min-width: 0; }
.sprint-row .info b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sprint-row .info small { color: var(--muted); font-size: 13px; }

/* Activities (Plan) */

.activity { padding: 10px 12px 10px 10px; display: flex; gap: 8px; align-items: flex-start; position: relative; }
.activity + .activity::before { content: ""; position: absolute; top: 0; left: 52px; right: 0; border-top: 0.5px solid var(--line); }
.check { flex: none; width: 34px; height: 34px; display: grid; place-items: center; margin-top: 2px; }
.check span {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s;
}
.check svg { width: 14px; height: 14px; stroke: #fff; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.activity.done .check span { background: var(--accent); border-color: var(--accent); }
.activity.done .check svg { opacity: 1; stroke: var(--on-accent); }
.activity .body { flex: 1; min-width: 0; }
.activity .act-text { padding: 7px 0 4px; min-height: 0; font-size: 16px; }
.activity.done .act-text { color: var(--muted); text-decoration: line-through; }
.activity .sub { display: flex; gap: 8px; flex-wrap: wrap; }
.activity .sub input {
  border: 0;
  background: var(--fill);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 14px;
  min-height: 30px;
  -webkit-appearance: none;
  appearance: none;
}
.activity .sub .owner { width: 110px; }
.activity .sub .date-wrap input { min-width: 120px; text-align: left; }
.activity .sub .date-wrap .clear { width: 24px; height: 24px; }
.activity .sub input.late { color: var(--danger); }
.activity .del { flex: none; width: 34px; height: 34px; display: grid; place-items: center; color: var(--muted); margin-top: 2px; }
.activity .del svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.add-row { color: var(--accent); font-weight: 500; }
.add-row svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; }

.stat-line { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin: 0 4px; }

/* Calendar */

.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.cal-head h1 { font-size: 30px; font-weight: 700; margin: 0; }
.cal-head h1::first-letter { text-transform: uppercase; }
.cal-head h1 small { color: var(--muted); font-weight: 500; font-size: 22px; }
.cal-nav { display: flex; gap: 2px; align-items: center; }
.cal-nav button { color: var(--accent); min-width: 40px; min-height: 40px; display: grid; place-items: center; font-weight: 500; }
.cal-nav svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cal-nav .today-btn { padding: 0 8px; font-size: 16px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); margin: 0 4px 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--g); flex: none; }
.legend i.ring { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }
.legend i.big { width: 14px; height: 14px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--muted) 35%, transparent); background: var(--muted); }
.legend i.dot { background: var(--muted); }

.cal {
  background: var(--card);
  border-radius: 14px;
  padding: 8px 6px 6px;
  display: grid;
  grid-template-columns: 22px repeat(7, 1fr);
  row-gap: 2px;
}
.cal .wd { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 2px 0 6px; text-transform: uppercase; }
.cal .wk { font-size: 10px; color: var(--muted); display: grid; place-items: center; padding-bottom: 12px; font-variant-numeric: tabular-nums; }
.day {
  position: relative;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 4px;
  border-radius: 10px;
}
.day .n {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.day.other .n { color: var(--muted); opacity: 0.7; }
.day.today .n { color: var(--accent); font-weight: 700; }
.day.sel { background: var(--fill); }
.day.goal-day .n { background: color-mix(in srgb, var(--g) 72%, #000); color: #fff; font-weight: 700; box-shadow: 0 0 0 3px color-mix(in srgb, var(--g) 30%, transparent); }
.day .marks { display: flex; gap: 3px; margin-top: 3px; height: 7px; }
.day .marks i { width: 7px; height: 7px; border-radius: 50%; background: var(--g); }
.day .marks i.act { width: 5px; height: 5px; margin-top: 1px; background: transparent; box-shadow: inset 0 0 0 1.5px var(--g); }
.day .marks i.done { opacity: 0.4; }

.ev {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 16px 10px 12px;
  position: relative;
}
.ev + .ev::before { content: ""; position: absolute; top: 0; left: 64px; right: 0; border-top: 0.5px solid var(--line); }
.ev .date { flex: none; width: 40px; text-align: center; line-height: 1.05; }
.ev .date b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.ev .date small { font-size: 11.5px; color: var(--muted); text-transform: uppercase; }
.ev .bar-c { flex: none; width: 4px; align-self: stretch; border-radius: 4px; background: var(--g); }
.ev .info { flex: 1; min-width: 0; }
.ev .info b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .info small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.done .info b { color: var(--muted); text-decoration: line-through; }
.ev.goal { background: color-mix(in srgb, var(--g) 13%, transparent); }
.ev .kind { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: color-mix(in srgb, var(--g) 60%, var(--text)); }
.ev-empty { padding: 18px 16px; color: var(--muted); font-size: 15px; text-align: center; }

/* Action sheet + overview panel */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 8px calc(8px + env(safe-area-inset-bottom));
  animation: fade 0.2s;
}
.sheet {
  width: 100%; max-width: 520px; animation: up 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
  overflow-y: auto; overscroll-behavior: contain;
}
/* Choosing a sprint from the calendar: grouped per goal in its colour, the list scrolls and Avbryt stays. */
.sprint-pick { display: flex; flex-direction: column; overflow: hidden; }
.sprint-pick > .group:first-child { display: flex; flex-direction: column; min-height: 0; }
.sprint-pick > .group:last-child { flex: none; }
.pick-scroll { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; min-height: 0; }
.pick-goal { border-left: 4px solid var(--gc); }
.pick-goal + .pick-goal { border-top: 0.5px solid var(--line); }
.pick-goal-name {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px 6px;
  font-size: 13px; font-weight: 600; color: color-mix(in srgb, var(--gc) 60%, var(--text)); text-transform: uppercase; letter-spacing: 0.02em;
}
.pick-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gc); flex: none; }
.pick-sprint {
  width: 100%; min-height: 52px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 16px; text-align: left; color: var(--text); font-size: 17px; position: relative;
}
.pick-sprint + .pick-sprint::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--line); }
.pick-sprint:active { background: color-mix(in srgb, var(--gc) 12%, transparent); }
.pick-sprint-name { flex: 1 1 auto; min-width: 0; }
.pick-sprint-dates { font-size: 14px; color: var(--muted); }
.pick-now {
  font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  color: color-mix(in srgb, var(--gc) 60%, var(--text)); background: color-mix(in srgb, var(--gc) 15%, transparent);
}
/* Opaque even where cards are see-through (animated themes): the card colour laid over the theme background. */
.sheet .group { border-radius: 14px; background: linear-gradient(var(--card), var(--card)), var(--bg); }
.sheet .group + .group { margin-top: 8px; }
.sheet-btn { width: 100%; min-height: 56px; color: var(--accent); font-size: 19px; position: relative; }
.sheet-btn + .sheet-btn::before { content: ""; position: absolute; top: 0; left: 0; right: 0; border-top: 0.5px solid var(--line); }
.sheet-btn.danger { color: var(--danger); }
.sheet-btn.cancel { font-weight: 600; }
.sheet-note { font-size: 13px; color: var(--muted); text-align: center; padding: 14px 16px 12px; border-bottom: 0.5px solid var(--line); }

.backdrop.panel-wrap { padding: calc(env(safe-area-inset-top) + 40px) 0 0; }
.panel {
  width: 100%;
  max-width: 600px;
  max-height: 100%;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
  animation: up 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  overscroll-behavior: contain;
}
.panel .grab { width: 38px; height: 5px; border-radius: 99px; background: var(--muted); opacity: 0.4; margin: 0 auto 4px; }
.panel-top { display: flex; justify-content: flex-end; }
.panel-top button { color: var(--accent); font-weight: 600; min-height: 36px; }
.panel-goal {
  display: flex;
  gap: 12px;
  align-items: center;
  background: color-mix(in srgb, var(--g) 72%, #000);
  color: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  width: 100%;
  text-align: left;
}
.panel-goal svg { width: 34px; height: 34px; flex: none; stroke: #fff; fill: none; stroke-width: 1.8; }
.panel-goal small { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.85; }
.panel-goal b { display: block; font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
.panel-goal span { display: block; font-size: 13.5px; opacity: 0.9; margin-top: 2px; }
.panel h2 { font-size: 26px; margin: 0 0 4px; line-height: 1.15; overflow-wrap: anywhere; }
.panel .sub-meta { color: var(--muted); font-size: 15px; margin-bottom: 4px; }
.ov-act { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; position: relative; }
.ov-act + .ov-act::before { content: ""; position: absolute; top: 0; left: 48px; right: 0; border-top: 0.5px solid var(--line); }
.ov-act .ring { margin-top: 1px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); flex: none; display: grid; place-items: center; }
.ov-act .ring svg { width: 12px; height: 12px; stroke: #fff; fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.ov-act.done .ring { background: var(--g); border-color: var(--g); }
.ov-act.done .ring svg { opacity: 1; }
.ov-act.done .t > span { color: var(--muted); text-decoration: line-through; }
.ov-act.hl { background: color-mix(in srgb, var(--g) 12%, transparent); }
.ov-act .t { flex: 1; }
.ov-act small { display: block; color: var(--muted); font-size: 13px; }
.panel .retro { white-space: pre-line; padding: 12px 16px; line-height: 1.45; }

@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: rgba(30, 30, 32, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 30;
  max-width: calc(100% - 32px);
  text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.footer-note { text-align: center; font-size: 12px; color: var(--muted); margin-top: 28px; }
.steps { margin: 0; padding: 12px 16px 12px 36px; font-size: 14.5px; line-height: 1.45; }
.steps li + li { margin-top: 6px; }
.feed-url { font: 13px ui-monospace, Menlo, monospace; color: var(--muted); padding: 0 16px 12px; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }

@media print {
  :root { --bg: #fff; --card: #fff; --fill: #fff; --text: #000; color-scheme: light; }
  .bar, .tabbar, .primary, .secondary, .add-row, .del, .clear, #toast, #sheet-root, .footer-note, .section-hint { display: none !important; }
  #view { padding-bottom: 0; }
  .group { border: 1px solid #ccc; break-inside: avoid; }
  .text::placeholder { color: transparent; }
}

/* Measurable target: slider on the home page */

.row input.wide {
  border: 0;
  background: var(--fill);
  border-radius: 8px;
  padding: 6px 10px;
  min-height: 34px;
  width: 150px;
  text-align: right;
  -webkit-appearance: none;
  appearance: none;
}
.row input.wide::placeholder { color: var(--muted); opacity: 0.75; }

.measure { background: var(--card); border-radius: 14px; padding: 14px 16px 12px; margin: 0 0 12px; }
.measure-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 8px; }
.measure-pct { font-size: 30px; font-weight: 800; line-height: 1; color: color-mix(in srgb, var(--g) 75%, var(--text)); font-variant-numeric: tabular-nums; white-space: nowrap; }
.measure-pct small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.measure-val { display: flex; align-items: center; gap: 6px; margin-left: auto; font-size: 14.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 16px so iOS doesn't zoom in when the field gets focus. */
.measure-input {
  border: 0;
  outline: 0;
  background: var(--fill);
  border-radius: 8px;
  padding: 5px 9px;
  min-height: 34px;
  min-width: 64px;
  max-width: 50vw;
  font-size: 16px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.measure-input:focus { box-shadow: 0 0 0 2px var(--accent); }
.measure-hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; margin: 0; background: transparent; display: block; }
.slider:focus { outline: none; }
.slider::-webkit-slider-runnable-track { height: 10px; border-radius: 99px; background: linear-gradient(to right, var(--g) var(--p), var(--fill) var(--p)); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px; height: 30px;
  margin-top: -10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}
.slider::-moz-range-track { height: 10px; border-radius: 99px; background: var(--fill); }
.slider::-moz-range-progress { height: 10px; border-radius: 99px; background: var(--g); }
.slider::-moz-range-thumb { width: 30px; height: 30px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3); }


/* Widget preview in Settings (roughly a medium iOS widget) */

.wprev {
  max-width: 360px;
  aspect-ratio: 2.13;
  margin: 0 auto;
  border-radius: 22px;
  padding: 14px 16px;
  color: #fff;
  background: linear-gradient(180deg, var(--g), color-mix(in srgb, var(--g) 62%, #000));
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.wprev small { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.75; }
.wprev b { font-size: 17px; line-height: 1.2; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wprev p { font-size: 12px; line-height: 1.3; opacity: 0.85; margin: 4px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wrow { display: flex; justify-content: space-between; align-items: flex-end; margin-top: auto; }
.wrow strong { display: block; font: 700 26px/1 ui-rounded, -apple-system, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.wrow span { font-size: 11px; font-weight: 500; opacity: 0.8; }
.wrow div:last-child { text-align: right; }
.wbar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.28); margin-top: 6px; overflow: hidden; flex: none; }
.wbar i { display: block; height: 100%; border-radius: 99px; background: #fff; }

/* Opened from the widget in Safari */

.tabbar[hidden] { display: none; }
.wv { padding-top: 4px; }
.wv + .wv, .notice + .wv { margin-top: 28px; padding-top: 22px; border-top: 0.5px solid var(--line); }
.wv .hero-title { margin-top: 6px; }
.wv .measure .progress { margin-top: 4px; height: 10px; }
.notice { margin: 18px 0 0; }
.notice p { margin: 0; line-height: 1.45; color: var(--muted); font-size: 15px; }

/* Buttons at the bottom of each goal page */

.page-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.page-actions button { margin: 0; }

.side-brand { display: none; }

/* ---------- Computer: sidebar instead of the tab bar, goals side by side ---------- */

@media (min-width: 900px) {
  :root { --side-w: 232px; }
  body { font-size: 16px; }

  .tabbar {
    top: 0; right: auto; bottom: 0; left: 0;
    width: var(--side-w);
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    padding: 20px 12px;
    border-top: 0;
    border-right: 0.5px solid var(--line);
  }
  .side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; font-weight: 700; font-size: 18px; color: var(--text); }
  .side-brand img { width: 30px; height: 30px; border-radius: 8px; }
  .tabbar button {
    flex: none;
    height: 42px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 15px;
  }
  .tabbar button:hover { background: var(--fill); }
  .tabbar button.on { background: var(--accent-soft); }
  .tabbar svg { width: 22px; height: 22px; }

  #view { margin-left: var(--side-w); max-width: none; padding: 0 40px 48px; }
  #view > * { max-width: 860px; margin-left: auto; margin-right: auto; }
  #view > .bar { max-width: none; margin: 0 -40px; padding-left: 40px; padding-right: 40px; }
  #toast { left: calc(50% + var(--side-w) / 2); bottom: 32px; }

  /* Home: goals next to each other instead of swiping */
  #view > .pager { max-width: 1400px; }
  .pager {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
    gap: 24px;
    overflow: visible;
    padding: 32px 0 0;
  }
  .page {
    height: auto;
    overflow: visible;
    border-radius: 24px;
    padding: 24px 24px 28px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--g) 22%, var(--card)) 0, var(--bg) 380px);
    border: 0.5px solid var(--line);
  }
  .page.plain { grid-column: 1 / -1; border: 0; background: transparent; padding: 8px 0 0; }
  .page.plain .page-inner { max-width: 640px; margin: 0; }

  /* With goals: "Nytt mål" (and achieved goals) as a column to the right of them. */
  /* The goal columns may shrink (long words wrap), so two goals and "Nytt mål" fit on a 1280 px laptop too. */
  .pager.cols-1 { grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); }
  .pager.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(240px, 300px); }
  .pager.cols-1 .page.col-0, .pager.cols-1 .page.col-1,
  .pager.cols-2 .page.col-0 { grid-column: 1; }
  .pager.cols-2 .page.col-1 { grid-column: 2; }
  .pager[class*="cols-"] .page.today { grid-column: 1 / -2; grid-row: 1; }
  .pager:not([class*="cols-"]) .page.today { grid-column: 1 / -1; }
  .pager[class*="cols-"] .page.plain {
    grid-column: -2;
    grid-row: 1;
    align-self: start;
    position: sticky;
    top: 24px;
    padding: 20px;
    border-radius: 24px;
    border: 1.5px dashed var(--line);
  }
  .pager[class*="cols-"] .page.plain .large-title { font-size: 24px; margin-top: 0; }
  .pager[class*="cols-"] .page.plain .section-label { margin-left: 4px; }
  .pager[class*="cols-"] .page.plain .footer-note { text-align: left; }
  .page-dots { display: none; }
  .phone-only { display: none; }
  .hero-title { font-size: 32px; }

  /* Calendar: month and list side by side */
  #view > .cal-layout { max-width: 1200px; }
  .cal-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 32px; align-items: start; }
  .cal-side .section-label:first-child { margin-top: 0; }
  #view > .cal-head { max-width: 1200px; }
  .day { min-height: 64px; }
  .day:hover { background: var(--fill); }

  /* Overview opens as a centred dialog rather than a bottom sheet */
  .backdrop.panel-wrap { align-items: center; padding: 40px; }
  .panel { border-radius: 16px; max-height: 85vh; }
  .backdrop { padding-bottom: 40px; align-items: center; }

  button, .row, .ev, .goal-card { cursor: pointer; }
  .ev:hover, .row.link-row:hover, .sprint-row:hover { background: color-mix(in srgb, var(--fill) 60%, transparent); }
}

/* Device sync pairing code */

.pair-code { display: block; width: 100%; text-align: center; padding: 16px 16px 18px; position: relative; }
.pair-code small { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.pair-code b {
  font: 600 28px/1.1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.08em;
  color: var(--text);
  user-select: all;
  -webkit-user-select: all;
}
.pair-code + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--line); }

/* ---------- New activity form ---------- */

.act-form h2, .pdf-form h2 { margin-bottom: 8px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; margin-top: 18px; border-radius: 10px; background: var(--fill); }
.seg button { min-height: 34px; border-radius: 8px; font-size: 15px; font-weight: 500; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekdays button {
  min-height: 42px;
  border-radius: 10px;
  background: var(--card);
  font-size: 14px;
  font-weight: 600;
  text-transform: capitalize;
}
.weekdays button.on { background: var(--accent); color: var(--on-accent); }
.act-form .mode-once, .act-form .mode-repeat { margin-top: 14px; }
.act-form .group .text + .text { border-top: 0.5px solid var(--line); }
.act-form .row input[type="date"], .act-form .row input[type="time"] {
  border: 0; background: var(--fill); border-radius: 8px; padding: 6px 10px; min-height: 34px; min-width: 130px; text-align: right;
  -webkit-appearance: none; appearance: none;
}
.af-preview { min-height: 1.4em; }
[hidden] { display: none !important; }

/* Activity row: time field and repeat marker */
.activity .sub input.time { width: 116px; }
.activity .sub .repeat { display: grid; place-items: center; color: var(--muted); }
.activity .sub .repeat svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* PDF export dialog */
.check-row { cursor: pointer; }
.check-row input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.check-row .label small { display: block; color: var(--muted); font-size: 13px; }
.check-row .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--g); flex: none; }

.desktop-only { display: none; }
@media (min-width: 900px) {
  .desktop-only { display: block; }
}

/* ---------- Print layout for PDF export ---------- */

#print-root { display: none; }

@media print {
  @page { size: A4; margin: 0; }
  body.printing { background: #fff !important; color: #111 !important; min-height: 0; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
}

/* The print layout itself: only ever inside #print-root, which is hidden except when printing or drawing a PDF. */
.pg-page { width: 100%; border-collapse: collapse; break-after: page; }
.pg-page:last-child { break-after: auto; }
.pg-page > * > tr > td { padding: 0 14mm; }
.pg-space { height: 13mm; }
.pg { font: 10.5pt/1.4 -apple-system, "Segoe UI", system-ui, sans-serif; color: #111; }
.pg-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-bottom: 3px solid var(--g); padding-bottom: 8px; margin-bottom: 12px; }
.pg-head small { font-size: 9pt; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--g); }
.pg-head h1 { font-size: 20pt; line-height: 1.15; margin: 2px 0 0; }
.pg-head img { height: 16pt; width: auto; }
.pg dl { margin: 0; }
.pg dt { font-size: 7.5pt; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #666; }
.pg dd { margin: 1px 0 0; font-weight: 600; }
.pg-dates { display: flex; flex-wrap: wrap; gap: 6px 28px; margin-bottom: 10px; }
.pg-box { border: 1px solid #c9c9cf; border-radius: 6px; padding: 7px 10px 9px; margin-bottom: 8px; break-inside: avoid; }
.pg-box h3 { margin: 0 0 3px; font-size: 7.5pt; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #555; }
.pg-text { white-space: pre-line; min-height: 2.6em; }
.pg-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pg-assess div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.pg-assess b { white-space: nowrap; }
.pg-sprint { margin-top: 16px; break-inside: avoid-page; }
.pg-sprint-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-bottom: 1.5px solid var(--g); padding-bottom: 5px; margin-bottom: 8px; }
.pg-sprint-head small { font-size: 7.5pt; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--g); }
.pg-sprint-head h2 { font-size: 13pt; margin: 1px 0 0; }
.pg-sprint-head dl { display: flex; gap: 18px; }
.pg-plan { width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: 9.5pt; }
.pg-plan th { text-align: left; font-size: 7.5pt; letter-spacing: 0.06em; text-transform: uppercase; color: #555; border-bottom: 1px solid #999; padding: 3px 6px; }
.pg-plan td { border-bottom: 1px solid #ddd; padding: 4px 6px; vertical-align: top; }
.pg-plan tr { break-inside: avoid; }
.pg-plan td.c { text-align: center; font-weight: 700; color: var(--g); width: 3.5em; }
.pg-plan th:nth-child(2), .pg-plan td:nth-child(2) { width: 18%; }
.pg-plan th:nth-child(3), .pg-plan td:nth-child(3) { width: 20%; }
.pg-plan td.empty { color: #888; font-style: italic; }
.pg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* ---------- Animated themes ----------
   #ambient sits behind everything (fixed, z-index -1) and only shows for these themes. Only transform,
   opacity and background-position are animated, which the GPU handles cheaply. Cards stay solid enough
   to read on; the goal pages get a see-through version of their colored header. */

#ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; display: none; }
/* Text straight on the moving background (labels and hints between the cards) gets a soft halo in the theme's
   own background colour, so the sun, grid or light veils behind it can't swallow it. */
:root[data-animated] :is(.section-label, .section-hint, .settings-group-label, .footer-note) { text-shadow: 0 0 3px var(--bg), 0 0 10px var(--bg); }
#ambient i { position: absolute; display: block; }

:root[data-animated] #ambient { display: block; }
:root[data-animated] .page { background: linear-gradient(180deg, color-mix(in srgb, var(--g) 24%, transparent) 0, transparent 380px); }
:root[data-animated] .page.plain, :root[data-animated] .page.today { background: transparent; }

/* Norrsken */
:root[data-theme="norrsken"] {
  --bg: #050b1a; --card: rgba(15, 25, 47, 0.86); --text: #e9eefc; --muted: #93a3c6; --line: rgba(255, 255, 255, 0.09);
  --fill: rgba(255, 255, 255, 0.08); --danger: #ff6b6b; --bar: rgba(5, 11, 26, 0.6); --tabbar: rgba(7, 13, 30, 0.78);
  color-scheme: dark;
}
:root[data-theme="norrsken"] #ambient i {
  width: 80vmax; height: 42vmax; border-radius: 50%; filter: blur(70px); opacity: 0.42; mix-blend-mode: screen;
}
:root[data-theme="norrsken"] #ambient i:nth-child(1) { left: -20vmax; top: -6vmax; background: #2ee6a6; animation: aurora-a 26s ease-in-out infinite alternate; }
:root[data-theme="norrsken"] #ambient i:nth-child(2) { right: -25vmax; top: 18vmax; background: #1fb6ff; animation: aurora-b 32s ease-in-out infinite alternate; }
:root[data-theme="norrsken"] #ambient i:nth-child(3) { left: 5vmax; bottom: -16vmax; background: #8a5cff; animation: aurora-c 38s ease-in-out infinite alternate; }
@keyframes aurora-a { to { transform: translate(28vmax, 10vmax) rotate(18deg) scale(1.15); } }
@keyframes aurora-b { to { transform: translate(-30vmax, -8vmax) rotate(-22deg) scale(0.9); } }
@keyframes aurora-c { to { transform: translate(22vmax, -18vmax) rotate(25deg) scale(1.2); } }

/* Stjärnnatt */
:root[data-theme="stjarnnatt"] {
  --bg: #03040b; --card: rgba(16, 18, 32, 0.88); --text: #eef0ff; --muted: #9196b8; --line: rgba(255, 255, 255, 0.08);
  --fill: rgba(255, 255, 255, 0.08); --danger: #ff6b6b; --bar: rgba(3, 4, 11, 0.6); --tabbar: rgba(6, 7, 16, 0.8);
  color-scheme: dark;
}
:root[data-theme="stjarnnatt"] #ambient {
  background: radial-gradient(ellipse at 70% -10%, rgba(88, 80, 200, 0.28), transparent 60%), radial-gradient(ellipse at 10% 110%, rgba(40, 90, 160, 0.22), transparent 55%);
}
:root[data-theme="stjarnnatt"] #ambient i:nth-child(1), :root[data-theme="stjarnnatt"] #ambient i:nth-child(2) { inset: 0; }
:root[data-theme="stjarnnatt"] #ambient i:nth-child(1) {
  background-image:
    radial-gradient(1px 1px at 20px 30px, #fff, transparent), radial-gradient(1px 1px at 120px 80px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 60px 150px, #fff, transparent), radial-gradient(1px 1px at 190px 190px, #dfe4ff, transparent),
    radial-gradient(1px 1px at 160px 20px, #fff, transparent), radial-gradient(1px 1px at 90px 210px, #fff, transparent);
  background-size: 230px 230px;
  animation: twinkle 3.8s ease-in-out infinite alternate;
}
:root[data-theme="stjarnnatt"] #ambient i:nth-child(2) {
  background-image:
    radial-gradient(1.5px 1.5px at 50px 60px, #fff, transparent), radial-gradient(2px 2px at 260px 130px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 170px 300px, #ffeccf, transparent), radial-gradient(1px 1px at 320px 40px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 30px 280px, #dfe4ff, transparent);
  background-size: 370px 370px;
  background-position: 90px 40px;
  animation: twinkle 5.5s ease-in-out 1.5s infinite alternate;
}
:root[data-theme="stjarnnatt"] #ambient i:nth-child(3) {
  top: 12vh; left: 60vw; width: 140px; height: 2px; border-radius: 2px; opacity: 0;
  background: linear-gradient(90deg, transparent, #fff);
  transform: rotate(-28deg);
  animation: shooting-star 14s ease-in 4s infinite;
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 1; } }
@keyframes shooting-star {
  0% { opacity: 0; transform: rotate(-28deg) translateX(0); }
  2% { opacity: 1; }
  7% { opacity: 0; transform: rotate(-28deg) translateX(-55vw); }
  100% { opacity: 0; transform: rotate(-28deg) translateX(-55vw); }
}

/* Solnedgång */
:root[data-theme="solnedgang"] {
  --bg: #ffe6d4; --card: rgba(255, 252, 249, 0.86); --text: #2d1d17; --muted: #7e6256; --line: rgba(60, 30, 20, 0.1);
  --fill: rgba(60, 30, 20, 0.07); --bar: rgba(255, 236, 222, 0.7); --tabbar: rgba(255, 240, 230, 0.82);
  color-scheme: light;
}
:root[data-theme="solnedgang"] #ambient i:nth-child(1) {
  inset: 0;
  background: linear-gradient(160deg, #ffd6ae, #ffb8a4, #f8a7c7, #cdbcff, #ffc9a8);
  background-size: 300% 300%;
  animation: sunset-shift 40s ease-in-out infinite alternate;
}
:root[data-theme="solnedgang"] #ambient i:nth-child(2) {
  width: 60vmin; height: 60vmin; right: -12vmin; top: 8vh; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 244, 214, 0.95) 0, rgba(255, 196, 120, 0.55) 35%, transparent 70%);
  animation: sun-drift 30s ease-in-out infinite alternate;
}
@keyframes sunset-shift { from { background-position: 0% 30%; } to { background-position: 100% 70%; } }
@keyframes sun-drift { from { transform: translateY(0); } to { transform: translateY(28vh) scale(1.15); } }

/* Vågor */
:root[data-theme="vagor"] {
  --bg: #e4f3fa; --card: rgba(255, 255, 255, 0.86); --text: #10232e; --muted: #54707f; --line: rgba(16, 60, 90, 0.1);
  --fill: rgba(16, 60, 90, 0.07); --bar: rgba(228, 243, 250, 0.72); --tabbar: rgba(236, 247, 252, 0.84);
  color-scheme: light;
}
:root[data-theme="vagor"] #ambient { background: linear-gradient(180deg, #e9f6fc 0, #d2ecf7 60%, #b9e0f1 100%); }
:root[data-theme="vagor"] #ambient i:nth-child(1), :root[data-theme="vagor"] #ambient i:nth-child(2) {
  left: 0; right: 0; bottom: 0; height: 34vh;
  background-repeat: repeat-x; background-size: 1200px 100%;
}
:root[data-theme="vagor"] #ambient i:nth-child(1) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'%3E%3Cpath d='M0 60 C150 20 300 100 450 60 S750 20 900 60 S1150 100 1200 60 V200 H0Z' fill='%236cc4e6' fill-opacity='0.55'/%3E%3C/svg%3E");
  animation: waves 22s linear infinite;
}
:root[data-theme="vagor"] #ambient i:nth-child(2) {
  height: 26vh;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'%3E%3Cpath d='M0 80 C200 40 400 120 600 80 S1000 40 1200 80 V200 H0Z' fill='%232f97c7' fill-opacity='0.6'/%3E%3C/svg%3E");
  animation: waves 15s linear infinite reverse;
}
:root[data-theme="vagor"] #ambient i:nth-child(3) {
  left: 0; right: 0; bottom: 0; height: 12vh;
  background: linear-gradient(180deg, rgba(32, 120, 170, 0.35), rgba(20, 90, 140, 0.55));
}
@keyframes waves { from { background-position-x: 0; } to { background-position-x: 1200px; } }

@media (prefers-reduced-motion: reduce) {
  #ambient, #ambient i { animation: none !important; }
}
@media print {
  #ambient { display: none !important; }
}

/* Retrospective on the home page when a sprint's activities are all done */
.retro-box { margin-top: 10px; }
.retro-box .retro-done { margin: 0 0 10px; font-weight: 600; }
.retro-box label { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.retro-box textarea {
  display: block; width: 100%; min-height: 88px; resize: none; overflow: hidden;
  border: 0; outline: 0; border-radius: 12px; padding: 10px 12px; background: var(--fill); line-height: 1.4;
}
.retro-box textarea:focus { box-shadow: 0 0 0 2px var(--accent); }
.retro-box .primary { margin-top: 10px; min-height: 46px; }

/* Goal achieved: retrospective form and card */
.achieve-hero { display: flex; align-items: center; gap: 14px; background: color-mix(in srgb, var(--g) 72%, #000); color: #fff; border-radius: 16px; padding: 16px 18px; margin-bottom: 8px; }
.achieve-hero svg { width: 40px; height: 40px; flex: none; stroke: #fff; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.achieve-hero small { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.85; }
.achieve-hero h2 { margin: 2px 0 0; font-size: 22px; line-height: 1.2; color: #fff; }
.achieve-form textarea.text { min-height: 130px; }
.goal-retro { border: 1.5px solid color-mix(in srgb, var(--g) 55%, transparent); }
.goal-retro .retro-text { margin: 0; white-space: pre-line; line-height: 1.45; font-size: 17px; }

.pg-goal-retro {
  border: 1.5px solid var(--g); border-left-width: 5px; border-radius: 6px;
  background: var(--tint, #f4f4f4);
  padding: 9px 12px 11px; margin: 4px 0 10px; break-inside: avoid;
}
.pg-goal-retro h3 { margin: 0; font-size: 12pt; color: #111; }
.pg-goal-retro .pg-sub { margin: 1px 0 6px; font-size: 8pt; color: #666; }
.pg-goal-retro .pg-text { min-height: 3.5em; }

/* Password forms (encrypted backup) */
.pw-form .group .text + .text { border-top: 0.5px solid var(--line); }

/* Security and privacy page */
.doc { padding: 6px 18px 16px; }
.doc h2 { font-size: 20px; margin: 12px 0 6px; }
.doc h3 { font-size: 16px; margin: 18px 0 4px; }
.doc p, .doc li { font-size: 15.5px; line-height: 1.5; margin: 0; }
.doc ul { margin: 4px 0 0; padding-left: 20px; }
.doc li + li { margin-top: 6px; }
.row .chev { margin-left: auto; }

/* ---------- Settings layout ---------- */

.settings-h { font-size: 22px; font-weight: 700; margin: 34px 4px 0; }
.settings-h + .section-label, .settings-h + .group { margin-top: 10px; }
/* Folded settings: each main heading is a full-width button with an arrow that turns down when open. */
button.settings-h {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  margin: 0; padding: 16px 4px; background: none; border: 0; border-bottom: 0.5px solid var(--line);
  color: var(--text); font: inherit; font-size: 20px; font-weight: 700; text-align: left; cursor: pointer;
}
button.settings-h:first-of-type { margin-top: 8px; }
.fold-chev { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s; }
button.settings-h[aria-expanded="true"] .fold-chev { transform: rotate(90deg); }
.settings-body { padding: 4px 0 22px; border-bottom: 0.5px solid var(--line); }
.settings-body[hidden] { display: none; }
.settings-body > :first-child { margin-top: 6px; }
/* The small "Förklaring" button that shows an explanation. */
.hint-toggle {
  display: flex; align-items: center; gap: 3px; margin: 6px 12px 0; padding: 4px;
  background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.hint-toggle .fold-chev { width: 12px; height: 12px; transform: rotate(90deg); }
.hint-toggle[aria-expanded="true"] .fold-chev { transform: rotate(-90deg); }
.hint-toggle + .section-hint { margin-top: 2px; }
.section-hint.notice { color: var(--text); }
@media (prefers-reduced-motion: reduce) { .fold-chev { transition: none; } }
.section-label.sub { margin-top: 14px; }
.row .label small { display: block; color: var(--muted); font-size: 13px; line-height: 1.3; margin-top: 1px; }
.row:has(.label small) { padding-top: 8px; padding-bottom: 8px; }
.theme-head .value { margin-left: auto; color: var(--accent); }
.theme-head .chev { margin-left: 4px; }
details.howto { margin-top: 12px; }
details.howto summary {
  cursor: pointer; list-style: none; color: var(--accent); font-weight: 500;
  padding: 12px 16px; background: var(--card); border-radius: 12px;
}
details.howto summary::-webkit-details-marker { display: none; }
details.howto summary::after { content: "›"; float: right; color: var(--muted); transition: transform 0.2s; }
details.howto[open] summary { border-radius: 12px 12px 0 0; }
details.howto[open] summary::after { transform: rotate(90deg); }
details.howto > .group { border-radius: 0 0 12px 12px; border-top: 0.5px solid var(--line); }
details.howto > .section-hint { margin-bottom: 4px; }

/* ---------- More animated themes ---------- */

/* Particle themes: buildAmbient() gives each <i> --x, --y, --s (size), --o (opacity), --d and --delay
   (0–1, scaled per theme) and --drift. */
#ambient i { will-change: transform; }

/* Workflow */
:root[data-theme="workflow"] {
  --bg: #120a24; --card: rgba(30, 17, 54, 0.86); --text: #f1ebff; --muted: #a596c8; --line: rgba(255, 255, 255, 0.09);
  --fill: rgba(255, 255, 255, 0.08); --danger: #ff6b8b; --bar: rgba(18, 10, 36, 0.6); --tabbar: rgba(20, 11, 40, 0.8);
  color-scheme: dark;
}
:root[data-theme="workflow"] #ambient i { width: 75vmax; height: 45vmax; border-radius: 50%; filter: blur(80px); opacity: 0.5; mix-blend-mode: screen; }
:root[data-theme="workflow"] #ambient i:nth-child(1) { left: -25vmax; top: -10vmax; background: #8b2fef; animation: aurora-a 24s ease-in-out infinite alternate; }
:root[data-theme="workflow"] #ambient i:nth-child(2) { right: -25vmax; top: 30vh; background: #d42ce0; animation: aurora-b 30s ease-in-out infinite alternate; }
:root[data-theme="workflow"] #ambient i:nth-child(3) { left: 10vmax; bottom: -20vmax; background: #4b2bd6; animation: aurora-c 36s ease-in-out infinite alternate; }

/* Snöfall */
:root[data-theme="snofall"] {
  --bg: #0b1a2e; --card: rgba(18, 34, 58, 0.86); --text: #eef4ff; --muted: #9db0cc; --line: rgba(255, 255, 255, 0.09);
  --fill: rgba(255, 255, 255, 0.08); --danger: #ff7a7a; --bar: rgba(11, 26, 46, 0.6); --tabbar: rgba(12, 28, 50, 0.8);
  color-scheme: dark;
}
:root[data-theme="snofall"] #ambient { background: linear-gradient(#0b1a2e, #1d3352); }
:root[data-theme="snofall"] #ambient i {
  left: var(--x); top: -5vh; width: calc(7px * var(--s)); height: calc(7px * var(--s)); border-radius: 50%;
  background: #fff; opacity: var(--o); filter: blur(calc(0.6px * var(--s)));
  animation: fall calc(9s + 9s * var(--d)) linear calc(-18s * var(--delay)) infinite;
}
@keyframes fall {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(var(--drift), 55vh, 0); }
  100% { transform: translate3d(calc(var(--drift) * -0.5), 112vh, 0); }
}

/* Höstlöv */
:root[data-theme="hostlov"] {
  --bg: #fbefe0; --card: rgba(255, 251, 245, 0.88); --text: #2e1e12; --muted: #84664e; --line: rgba(60, 30, 10, 0.1);
  --fill: rgba(60, 30, 10, 0.07); --bar: rgba(251, 239, 224, 0.72); --tabbar: rgba(252, 243, 232, 0.86);
  color-scheme: light;
}
:root[data-theme="hostlov"] #ambient { background: linear-gradient(#fbefe0, #f3d3ad); }
:root[data-theme="hostlov"] #ambient i, :root[data-theme="sakura"] #ambient i {
  left: var(--x); top: -6vh; width: calc(20px * var(--s)); height: calc(13px * var(--s));
  border-radius: 0 80% 0 80%; opacity: calc(0.55 + var(--o) * 0.45);
  animation: leaf calc(10s + 8s * var(--d)) linear calc(-18s * var(--delay)) infinite;
}
:root[data-theme="hostlov"] #ambient i { background: #d9622b; }
:root[data-theme="hostlov"] #ambient i:nth-child(3n) { background: #e8a33d; }
:root[data-theme="hostlov"] #ambient i:nth-child(4n) { background: #b8402a; }
:root[data-theme="hostlov"] #ambient i:nth-child(5n) { background: #c9892f; }
@keyframes leaf {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  25% { transform: translate3d(var(--drift), 28vh, 0) rotate(110deg); }
  50% { transform: translate3d(calc(var(--drift) * -0.6), 56vh, 0) rotate(200deg); }
  75% { transform: translate3d(var(--drift), 84vh, 0) rotate(290deg); }
  100% { transform: translate3d(0, 112vh, 0) rotate(380deg); }
}

/* Körsbärsblom */
:root[data-theme="sakura"] {
  --bg: #fff1f5; --card: rgba(255, 252, 253, 0.88); --text: #3a1d29; --muted: #8e6272; --line: rgba(90, 20, 50, 0.1);
  --fill: rgba(90, 20, 50, 0.06); --bar: rgba(255, 241, 245, 0.72); --tabbar: rgba(255, 244, 248, 0.86);
  color-scheme: light;
}
:root[data-theme="sakura"] #ambient { background: linear-gradient(#fff1f5, #fbd9e4); }
:root[data-theme="sakura"] #ambient i { width: calc(14px * var(--s)); height: calc(11px * var(--s)); border-radius: 150% 0 150% 0; background: #f6b6c8; }
:root[data-theme="sakura"] #ambient i:nth-child(3n) { background: #f39bb6; }
:root[data-theme="sakura"] #ambient i:nth-child(4n) { background: #fde0e9; }

/* Bubblor */
:root[data-theme="bubblor"] {
  --bg: #032430; --card: rgba(6, 46, 58, 0.86); --text: #e6fbff; --muted: #8fbac6; --line: rgba(255, 255, 255, 0.09);
  --fill: rgba(255, 255, 255, 0.08); --danger: #ff7a7a; --bar: rgba(3, 36, 48, 0.6); --tabbar: rgba(4, 38, 50, 0.8);
  color-scheme: dark;
}
:root[data-theme="bubblor"] #ambient {
  background: radial-gradient(ellipse at 50% -20%, rgba(120, 220, 255, 0.25), transparent 60%), linear-gradient(#063b4a, #021a22);
}
:root[data-theme="bubblor"] #ambient i {
  left: var(--x); top: 104vh; width: calc(16px * var(--s)); height: calc(16px * var(--s)); border-radius: 50%;
  border: 1.5px solid rgba(220, 250, 255, 0.55);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.05) 45%, transparent 60%);
  opacity: calc(0.4 + var(--o) * 0.6);
  animation: rise calc(8s + 8s * var(--d)) ease-in calc(-16s * var(--delay)) infinite;
}
@keyframes rise {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(calc(var(--drift) * 0.4), -58vh, 0); }
  100% { transform: translate3d(calc(var(--drift) * -0.3), -116vh, 0); }
}

/* Eldflugor */
:root[data-theme="eldflugor"] {
  --bg: #07130d; --card: rgba(14, 30, 21, 0.86); --text: #eef7e6; --muted: #98ad8f; --line: rgba(255, 255, 255, 0.08);
  --fill: rgba(255, 255, 255, 0.07); --danger: #ff7a6b; --bar: rgba(7, 19, 13, 0.6); --tabbar: rgba(8, 22, 15, 0.8);
  color-scheme: dark;
}
:root[data-theme="eldflugor"] #ambient { background: radial-gradient(ellipse at 50% 120%, rgba(40, 90, 50, 0.45), transparent 60%), #07130d; }
:root[data-theme="eldflugor"] #ambient i {
  left: var(--x); top: var(--y); width: calc(5px * var(--s)); height: calc(5px * var(--s)); border-radius: 50%;
  background: #e7ff7a; box-shadow: 0 0 calc(12px * var(--s)) calc(3px * var(--s)) rgba(200, 255, 90, 0.55);
  animation:
    wander calc(10s + 10s * var(--d)) ease-in-out calc(-20s * var(--delay)) infinite alternate,
    glow calc(2s + 3s * var(--o)) ease-in-out calc(-4s * var(--delay)) infinite alternate;
}
@keyframes wander {
  0% { transform: translate3d(0, 0, 0); }
  33% { transform: translate3d(var(--drift), -6vh, 0); }
  66% { transform: translate3d(calc(var(--drift) * -1), 4vh, 0); }
  100% { transform: translate3d(calc(var(--drift) * 0.5), -10vh, 0); }
}
@keyframes glow { 0% { opacity: 0.05; } 60% { opacity: 1; } 100% { opacity: 0.2; } }

/* Regn */
:root[data-theme="regn"] {
  --bg: #0e141c; --card: rgba(22, 30, 41, 0.88); --text: #e8eef6; --muted: #93a1b3; --line: rgba(255, 255, 255, 0.08);
  --fill: rgba(255, 255, 255, 0.07); --danger: #ff7a7a; --bar: rgba(14, 20, 28, 0.6); --tabbar: rgba(16, 22, 31, 0.82);
  color-scheme: dark;
}
:root[data-theme="regn"] #ambient { background: linear-gradient(#141c27, #0b1016); }
:root[data-theme="regn"] #ambient::after {
  content: ""; position: absolute; inset: 0; background: rgba(200, 220, 255, 0.5); opacity: 0;
  animation: lightning 11s linear 3s infinite;
}
:root[data-theme="regn"] #ambient i {
  left: var(--x); top: -15vh; width: 1.5px; height: calc(70px * var(--s));
  background: linear-gradient(transparent, rgba(170, 200, 255, 0.65)); opacity: var(--o);
  animation: rain calc(0.55s + 0.6s * var(--d)) linear calc(-1.2s * var(--delay)) infinite;
}
@keyframes rain { from { transform: translate3d(0, 0, 0) rotate(12deg); } to { transform: translate3d(-28vh, 130vh, 0) rotate(12deg); } }
@keyframes lightning { 0%, 93%, 100% { opacity: 0; } 94% { opacity: 0.7; } 95% { opacity: 0.1; } 96.5% { opacity: 0.5; } 98% { opacity: 0; } }

/* Synthwave */
:root[data-theme="synthwave"] {
  --bg: #12002a; --card: rgba(30, 6, 56, 0.86); --text: #ffeefc; --muted: #c193d6; --line: rgba(255, 120, 220, 0.14);
  --fill: rgba(255, 255, 255, 0.08); --danger: #ff6b8b; --bar: rgba(18, 0, 42, 0.6); --tabbar: rgba(20, 2, 44, 0.82);
  color-scheme: dark;
}
:root[data-theme="synthwave"] #ambient { background: linear-gradient(#12002a 0, #2d0050 55%, #12002a 56%); }
:root[data-theme="synthwave"] #ambient i:nth-child(1) {
  left: 50%; top: 22vh; width: 56vmin; height: 56vmin; margin-left: -28vmin; border-radius: 50%;
  background: linear-gradient(#ffd23f, #ff6b5c 50%, #ff2fa0);
  -webkit-mask: linear-gradient(#000 52%, transparent 52% 56%, #000 56% 63%, transparent 63% 67%, #000 67% 73%, transparent 73% 78%, #000 78% 83%, transparent 83% 88%, #000 88%);
  mask: linear-gradient(#000 52%, transparent 52% 56%, #000 56% 63%, transparent 63% 67%, #000 67% 73%, transparent 73% 78%, #000 78% 83%, transparent 83% 88%, #000 88%);
  box-shadow: 0 0 80px rgba(255, 60, 160, 0.5);
  animation: sun-pulse 6s ease-in-out infinite alternate;
}
:root[data-theme="synthwave"] #ambient i:nth-child(2) {
  left: -50%; right: -50%; bottom: -10vh; height: 55vh;
  background-image: linear-gradient(rgba(255, 47, 160, 0.8) 2px, transparent 2px), linear-gradient(90deg, rgba(255, 47, 160, 0.8) 2px, transparent 2px);
  background-size: 60px 60px;
  transform: perspective(300px) rotateX(62deg);
  transform-origin: 50% 0;
  animation: grid 2.2s linear infinite;
  -webkit-mask: linear-gradient(transparent, #000 25%);
  mask: linear-gradient(transparent, #000 25%);
}
:root[data-theme="synthwave"] #ambient i:nth-child(3) { display: none; }
@keyframes grid { to { background-position: 0 60px; } }
@keyframes sun-pulse { to { filter: brightness(1.15); transform: translateY(-1.5vh); } }

/* Lavalampa */
:root[data-theme="lavalampa"] {
  --bg: #2a0a1e; --card: rgba(48, 14, 36, 0.84); --text: #fff1ea; --muted: #d4a5a0; --line: rgba(255, 255, 255, 0.1);
  --fill: rgba(255, 255, 255, 0.09); --danger: #ffd0c0; --bar: rgba(42, 10, 30, 0.6); --tabbar: rgba(44, 11, 32, 0.82);
  color-scheme: dark;
}
:root[data-theme="lavalampa"] #ambient { background: linear-gradient(#3a0d26, #1c0614); }
:root[data-theme="lavalampa"] #ambient i { width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(46px); opacity: 0.75; }
:root[data-theme="lavalampa"] #ambient i:nth-child(1) { left: -8vmax; bottom: -20vmax; background: #ff6b3d; animation: lava-a 19s ease-in-out infinite alternate; }
:root[data-theme="lavalampa"] #ambient i:nth-child(2) { right: -10vmax; top: -16vmax; background: #ff2d7a; animation: lava-b 23s ease-in-out infinite alternate; }
:root[data-theme="lavalampa"] #ambient i:nth-child(3) { left: 25vw; top: 40vh; width: 30vmax; height: 30vmax; background: #ffb13d; animation: lava-c 17s ease-in-out infinite alternate; }
@keyframes lava-a { to { transform: translate3d(12vw, -70vh, 0) scale(0.8, 1.15); } }
@keyframes lava-b { to { transform: translate3d(-15vw, 75vh, 0) scale(1.2, 0.85); } }
@keyframes lava-c { 50% { transform: translate3d(-20vw, -30vh, 0) scale(1.25); } to { transform: translate3d(15vw, 25vh, 0) scale(0.85); } }

@media (prefers-reduced-motion: reduce) {
  #ambient::after { animation: none !important; }
}

/* Pace and progress curve (opt-in) */
.pace { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; background: var(--card); border-radius: 14px; padding: 10px 14px; margin: -2px 0 12px; }
.pace b { font-size: 15px; }
.pace span { font-size: 13px; color: var(--muted); }
.pace.ahead b { color: color-mix(in srgb, #1fae6d 65%, var(--text)); }
.pace.behind b { color: color-mix(in srgb, #e8833a 65%, var(--text)); }
.pace.on b { color: color-mix(in srgb, var(--g) 60%, var(--text)); }
.chart { margin-top: 12px; }
.chart svg { display: block; width: 100%; height: 96px; overflow: visible; }
.chart .plan { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; opacity: 0.8; }
.chart .now { stroke: var(--line); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart .you { fill: none; stroke: var(--g); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .area { fill: color-mix(in srgb, var(--g) 16%, transparent); stroke: none; }
.chart-legend { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart-legend i { display: inline-block; width: 14px; height: 0; vertical-align: middle; margin: 0 4px 0 8px; }
.chart-legend i.you { border-top: 2.5px solid var(--g); }
.chart-legend i.plan { border-top: 1.5px dashed var(--muted); }

/* Today's focus page */
.page.today { background: var(--bg); }
.today-act .t small { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); text-decoration: none; margin-top: 1px; }
.today-act .t small .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--g); flex: none; }
.today-act { padding: 9px 0; }
.today-act + .today-act { border-top: 0.5px solid var(--line); }
.today-empty { margin: 4px 0; font-size: 17px; font-weight: 600; }
.page-dots button.today { border-radius: 2px; transform: rotate(45deg) scale(0.9); }

/* Undo bar */
#undo {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); z-index: 31;
  display: flex; align-items: center; gap: 14px;
  background: rgba(30, 30, 32, 0.95); color: #fff; padding: 8px 8px 8px 18px; border-radius: 99px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; max-width: calc(100% - 32px);
}
#undo.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#undo button { flex: none; white-space: nowrap; color: #fff; font-weight: 700; padding: 6px 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); }
#undo.show ~ #toast, #undo.show + #toast { bottom: calc(var(--tab-h) + 80px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { #undo { left: calc(50% + var(--side-w) / 2); bottom: 32px; } }

/* Shared goal (read-only view) and sharing */
.page-inner.shared { padding: 0 0 40px; }
.shared-banner { display: flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--g) 14%, var(--card)); color: var(--text); border-radius: 12px; padding: 10px 14px; margin: 0 0 18px; font-size: 14px; }
.shared-banner svg { width: 20px; height: 20px; flex: none; stroke: var(--g); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shared .eyebrow { color: color-mix(in srgb, var(--g) 60%, var(--text)); }
.shared-sprint { display: block; font-size: 17px; margin-bottom: 2px; }
.shared-retro { margin: 10px 0 0; font-size: 15px; line-height: 1.45; white-space: pre-line; }
.share-url { padding: 12px 16px; font-size: 13px; }
.secondary.danger-text { color: var(--danger); }
#undo span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Buttons, links and switches all follow the accent color from Settings → Färg. The goal's own color is
   kept for what identifies the goal: headings, tint, numbers, icons, progress bars and the curve. */

/* "Mål uppnått!" keeps the goal's own color. */
.page-actions [data-action="achieve-home"] { background: color-mix(in srgb, var(--g) 72%, #000); color: #fff; }

/* ---------- Motivator (hidden feature) ---------- */

.secret-toggle { display: block; margin: 6px auto 0; font-size: 11px; color: var(--muted); opacity: 0.55; padding: 6px 10px; }
.secret-toggle:hover { opacity: 0.9; }

/* The zone ends at the tab bar (on a computer: at the sidebar), so he hides exactly behind its edge, and starts below
   the status bar, so coming from the top his face isn't hidden under it. */
#peek-zone {
  position: fixed; top: env(safe-area-inset-top); left: 0; right: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  overflow: hidden; pointer-events: none; z-index: 9;
}
@media (min-width: 900px) { #peek-zone { left: var(--side-w); bottom: 0; } }

/* The walker's bottom-center sits on the edge point (--x, --y); rotating turns his head into the screen, and
   translateY along that direction moves him out of (100%) or into (--show) the edge, head first. Its own box
   stays at the zone's top-left corner and everything happens in the transform: Safari can clip a rotated
   element by where its box was before rotating, which cut off his hair when he came from the top. */
#walker {
  position: absolute; left: 0; top: 0; width: var(--w); height: var(--h);
  transform-origin: 50% 100%;
  transform: translate(calc(var(--x) - var(--w) / 2), calc(var(--y) - var(--h))) rotate(var(--rot)) translateY(100%);
  pointer-events: none; will-change: transform;
}
#walker[hidden] { display: none; }
#walker.in { transform: translate(calc(var(--x) - var(--w) / 2), calc(var(--y) - var(--h))) rotate(var(--rot)) translateY(var(--show)); }
#walker.peek { transition: transform 2.6s ease-in-out; }
#walker.talk { transition: transform 0.9s cubic-bezier(0.25, 1.15, 0.45, 1); }
#walker.talk:not(.in) { transition-duration: 0.6s; transition-timing-function: ease-in; }
#walker img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35)); }
#walker.talk img {
  pointer-events: auto; cursor: pointer;
  -webkit-mask-image: linear-gradient(#000 77%, transparent);
  mask-image: linear-gradient(#000 77%, transparent);
}
/* Clearing his throat: a quick little vibration. */
#walker.ahem img { animation: jitter 0.07s linear 10; }
@keyframes jitter {
  0% { transform: translate(1.5px, -1px) rotate(0.6deg); }
  50% { transform: translate(-1.5px, 1px) rotate(-0.6deg); }
  100% { transform: translate(1px, 1.5px); }
}

#mot-bubble {
  position: absolute; pointer-events: auto; cursor: pointer;
  max-width: min(240px, 62vw);
  background: #fff; color: #1c1c1e; font-size: 15px; font-weight: 600; line-height: 1.35;
  padding: 10px 14px; border-radius: 18px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  opacity: 0; transform: scale(0.85); transition: opacity 0.2s, transform 0.25s cubic-bezier(0.3, 1.4, 0.5, 1);
}
#mot-bubble[hidden] { display: none; }
#mot-bubble.in { opacity: 1; transform: scale(1); }
#mot-bubble.ahem { font-style: italic; color: #6b6b70; }

@media (prefers-reduced-motion: reduce) {
  #walker.peek, #walker.talk { transition: none; }
  #walker.ahem img { animation: none; }
}
@media print { #peek-zone { display: none !important; } }

/* Guided goal card */
.panel.guide { min-height: 70vh; display: flex; flex-direction: column; }
.guide-progress { height: 4px; border-radius: 99px; background: var(--fill); overflow: hidden; margin: 2px 0 14px; }
.guide-progress div { height: 100%; background: var(--accent); transition: width 0.3s; }
.guide .eyebrow { color: var(--muted); }
.guide h2 { margin-top: 4px; }
.guide-body { margin-top: 14px; flex: 1; }
.guide-body textarea.text { min-height: 120px; }
.guide-body textarea.title-input { min-height: 56px; }
.guide-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.guide-nav button { margin: 0; }
.guide-ref { background: var(--card); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
.guide-ref small { display: block; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.guide .row input[type="date"] { border: 0; background: var(--fill); border-radius: 8px; padding: 6px 10px; min-height: 34px; -webkit-appearance: none; appearance: none; }

/* Assessment over time */
.assess-history { padding: 12px 16px 14px; border-top: 0.5px solid var(--line); }
.assess-history table { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; margin-top: 6px; }
.assess-history th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.assess-history td { padding: 5px 0; border-top: 0.5px solid var(--line); }
.assess-history td:not(:first-child), .assess-history th:not(:first-child) { text-align: center; width: 28%; }
.panel.reassess .eyebrow { color: color-mix(in srgb, var(--g) 60%, var(--text)); }
.pg-over-time b { font-weight: 600; }

/* Bullet lists and obstacle/solution pairs in the goal card and the guide */
.list-edit, .pair-edit { padding: 4px 0; }
.li-row { display: flex; align-items: flex-start; gap: 10px; padding: 0 16px; position: relative; }
.li-row + .li-row::before, .pair-row + .pair-row::before {
  content: ""; position: absolute; top: 0; left: 34px; right: 0; border-top: 0.5px solid var(--line);
}
.li-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--g, var(--accent)); flex: none; margin-top: 18px; }
.li-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; resize: none; overflow: hidden;
  padding: 11px 0; line-height: 1.4; min-height: 44px; font: inherit; color: inherit;
}
.li-input::placeholder { color: var(--muted); opacity: 0.75; }
.li-row:last-child .li-dot { opacity: 0.35; }
.pair-row { position: relative; padding: 2px 16px 6px; }
.pair-row + .pair-row::before { left: 16px; }
.pr-o { display: flex; align-items: flex-start; gap: 8px; }
.pr-o .pr-arrow { margin-top: 10px; color: var(--muted); }
/* A thin line between the obstacle and its solution (indented, so it's not mistaken for the line between pairs) */
.pr-o { position: relative; }
.pr-o::after { content: ""; position: absolute; left: 22px; right: 38px; bottom: 0; border-bottom: 0.5px dashed color-mix(in srgb, var(--muted) 55%, transparent); }
.pr-s { padding-top: 4px; }
.pr-o .li-input { font-size: 15px; color: var(--muted); padding-bottom: 2px; min-height: 36px; }
.pr-s { display: flex; align-items: flex-start; gap: 8px; }
.pr-s .li-input { font-weight: 600; padding-top: 2px; min-height: 32px; }
.pr-arrow { flex: none; color: var(--g, var(--accent)); font-weight: 700; margin-top: 2px; }
.pr-del { flex: none; width: 30px; height: 30px; margin-top: 6px; display: grid; place-items: center; color: var(--muted); border-radius: 50%; }
.pr-del svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.pair-row:last-child .pr-del { visibility: hidden; }

/* Values as bullets in the widget preview and the widget's Safari page */
.wprev .wvals { margin: 4px 0 0; padding: 0; list-style: none; font-size: 12px; line-height: 1.35; opacity: 0.88; }
.wprev .wvals li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wprev .wvals li::before { content: "•  "; }
.wv-values { margin: 0 0 6px; padding-left: 20px; color: var(--muted); font-size: 16px; line-height: 1.45; }

/* Shared goals */
.team-badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 99px; font-size: 11px; letter-spacing: 0.04em; background: color-mix(in srgb, var(--g) 20%, transparent); color: color-mix(in srgb, var(--g) 60%, var(--text)); vertical-align: 1px; }

/* Sync status */
.tabbar button { position: relative; }
.sync-dot { display: none; position: absolute; top: 6px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--bg); }
body[data-sync="offline"] .sync-dot { display: block; background: #8e8e93; }
body[data-sync="error"] .sync-dot { display: block; background: #ff9f0a; }
@media (min-width: 900px) { .sync-dot { left: 30px; top: 8px; } }
.sync-status { display: flex; align-items: center; gap: 8px; margin: 10px 4px 0; font-size: 14px; color: var(--muted); }
.sync-status i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #34c759; }
.sync-status.pending i { background: #ffd60a; }
.sync-status.offline i { background: #8e8e93; }
.sync-status.error i { background: #ff9f0a; }

/* "Lägg Målkort på hemskärmen" (first visit on a phone). */
.panel.install { text-align: left; }
.install-icon { display: block; width: 64px; height: 64px; border-radius: 15px; margin: 4px auto 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); }
.panel.install h2 { text-align: center; }
.panel.install .sub-meta { text-align: center; margin-bottom: 14px; }
.panel.install .group { margin-bottom: 4px; }
.panel.install .primary, .panel.install .secondary { width: 100%; margin-top: 14px; }
.inline-ico { display: inline-block; width: 20px; height: 20px; vertical-align: -4px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* What quick entry understood from the text ("Förstått: fre 10 okt kl. 14:00"). */
.quick-parse { display: flex; align-items: center; gap: 6px; margin: 8px 6px 0; font-size: 13.5px; color: var(--muted); }
.quick-parse[hidden] { display: none; }
.quick-parse svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--g, var(--accent)); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.quick-parse b { color: var(--text); font-weight: 600; }

/* Swiping an activity: the row follows the finger over a background saying what letting go will do. */
.swiping { position: relative; overflow: hidden; }
.swipe-row { position: relative; z-index: 1; background: var(--card); touch-action: pan-y; }
.swipe-bg {
  position: absolute; left: 0; right: 0; z-index: 0; display: flex; align-items: center; padding: 0 22px;
  background: var(--fill); color: var(--muted); font-weight: 600; font-size: 15px; transition: background 0.15s, color 0.15s;
}
.swipe-bg.left { justify-content: flex-end; }
.swipe-bg.on { color: #fff; }
.swipe-bg.on.today { background: #0a84ff; }
.swipe-bg.on.later { background: #ff9f0a; }
.swipe-bg.on.del { background: var(--danger); }

/* Confetti when a sprint or goal is done. */
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }

/* Week review */
.week-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 4px; }
.week-stats div { background: var(--card); border-radius: 14px; padding: 12px; }
.week-stats b { display: block; font-size: 26px; font-weight: 700; }
.week-stats span { font-size: 12.5px; color: var(--muted); line-height: 1.25; display: block; }
.week-stats .late b { color: var(--danger); }
.week-list .week-act { padding: 2px 14px; }
.week-list .week-act + .week-act { border-top: 0.5px solid var(--line); }
.week-act .mini-act .t small { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.week-act .mini-act .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--g); display: inline-block; }

/* Example goal: the read-only card inside a panel */
.panel.example .page-inner.shared { padding: 0; }
.panel.example .top-pad { display: none; }

/* Text size (Settings → Utseende): everything in the page and the panels grows; the tab bar stays as it is. */
html[data-text="large"] #view, html[data-text="large"] #sheet-root { zoom: 1.12; }
html[data-text="larger"] #view, html[data-text="larger"] #sheet-root { zoom: 1.25; }

/* Search */
.search-box { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 12px; padding: 0 12px; margin: 8px 0 14px; }
.search-box svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; }
.search-box input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: inherit; font-size: 17px; padding: 12px 0; outline: none; }
.search-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.search-filter button { min-height: 32px; padding: 0 12px; border-radius: 16px; background: var(--fill); color: var(--muted); font-size: 14px; font-weight: 500; }
.search-filter button.on { background: var(--accent); color: var(--on-accent); }
#search-filters { margin-bottom: 10px; }
.search-hit .label { font-size: 15px; line-height: 1.35; }
.search-hit .hit-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.search-hit .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--g); flex: none; }
.search-hit mark { background: color-mix(in srgb, var(--g) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Reordering */
.reorder { list-style: none; margin: 12px 0 0; padding: 0; }
.reorder li { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 4px; background: var(--card); position: relative; transition: transform 0.15s; }
.reorder li + li { border-top: 0.5px solid var(--line); }
.reorder li.dragging { z-index: 2; transition: none; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); border-radius: 10px; }
.reorder .grip { width: 36px; height: 36px; display: grid; place-items: center; touch-action: none; cursor: grab; flex: none; }
.reorder .grip svg, .reorder button svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.reorder .label { flex: 1; min-width: 0; font-size: 15.5px; }
.reorder .label small { display: block; color: var(--muted); font-size: 12.5px; }
.reorder button { width: 34px; height: 34px; display: grid; place-items: center; background: none; border: 0; border-radius: 8px; flex: none; }
.reorder button:disabled { opacity: 0.25; }

.cal-side .cal-add { margin-bottom: 4px; }

.week-btn { margin-bottom: 12px; }
.today .week-btn { margin-top: 14px; margin-bottom: 0; }

/* A goal followed as a coach (#/coach/<id>) */
.coach-view .top-pad { display: none; }
.coach-view .page-inner.shared { padding-top: 4px; }
.coach-view > .secondary { margin-top: 18px; }
.tabbar button[hidden] { display: none; }

/* Entering a code: field with a "Klistra in" button */
.code-field { display: flex; align-items: center; margin-top: 14px; }
.code-field input { flex: 1; min-width: 0; font-size: 20px; letter-spacing: 1.5px; font-family: ui-monospace, Menlo, monospace; text-transform: uppercase; }
.code-field .paste { flex: none; margin-right: 8px; padding: 8px 12px; border-radius: 10px; background: var(--fill); color: var(--text); border: 0; font: inherit; font-weight: 600; font-size: 14px; }
.panel.invite .steps { margin-top: 0; }
.panel.invite .group + .section-hint { margin-bottom: 4px; }
.panel.invite .group + .group { margin-top: 12px; }

/* Followed goals grouped by person */
.coach-person { display: flex; align-items: center; gap: 7px; margin: 16px 6px 7px; font-weight: 600; font-size: 15px; }
.coach-person svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.coach-view > .secondary + .secondary { margin-top: 10px; }

.team-line { display: flex; align-items: center; gap: 6px; margin: -4px 0 10px; font-size: 14px; color: var(--muted); }
.team-line svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Who a shared goal is with, beside its name on the card */
.member-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; margin-left: 8px; padding: 0; background: none; border: 0; cursor: pointer; }
.member-chips span { font-size: 12.5px; font-weight: 600; letter-spacing: 0; line-height: 1; padding: 5px 9px; border-radius: 999px; background: color-mix(in srgb, var(--g, var(--accent)) 22%, transparent); color: var(--text); }

.member-chips.coaches span { background: color-mix(in srgb, #ff9f0a 24%, transparent); }

/* Coach comments on the goal card */
.coach-notes { display: grid; gap: 8px; margin: 4px 0 12px; }
.coach-note { background: color-mix(in srgb, #ff9f0a 14%, var(--card)); border: 0.5px solid color-mix(in srgb, #ff9f0a 40%, transparent); border-radius: 14px; padding: 11px 14px; }
.coach-note .cn-head { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.coach-note .cn-head svg { width: 16px; height: 16px; fill: none; stroke: #ff9f0a; stroke-width: 2; stroke-linejoin: round; }
.coach-note .cn-head b { color: var(--text); font-weight: 600; }
.coach-note .cn-head span { margin-left: auto; }
.coach-note p { margin: 0; font-size: 15.5px; line-height: 1.4; white-space: pre-wrap; }
.comment-form .seg { margin-top: 12px; }
.comment-form .group.until { margin-top: 12px; }
.coach-comments .label { white-space: pre-wrap; }

/* The page shakes when the coach clears his throat */
.quake { animation: quake 0.09s linear 9; }
/* Only moves, never rotates: rotating a tall page would push its corners out past the screen's edges. */
@keyframes quake {
  0% { transform: translate(3px, -1px); }
  25% { transform: translate(-3px, 2px); }
  50% { transform: translate(2px, 1px); }
  75% { transform: translate(-2px, -2px); }
  100% { transform: translate(0, 0); }
}
@media (prefers-reduced-motion: reduce) { .quake { animation: none; } }

.coach-view > .section-label:first-child { margin-top: 8px; }
.coach-view .coach-comments + .section-hint { margin-bottom: 14px; }

/* Drawing a PDF on a phone: the print layout is laid out off screen at A4 width (see makePdf). */
#print-root.rendering { display: block; position: fixed; left: -12000px; top: 0; width: 794px; background: #fff; color: #111; }
#print-root.rendering .pdf-sheet { width: 794px; padding: 0 53px; box-sizing: border-box; background: #fff; }

/* While typing on a phone, the tab bar steps aside (iOS would otherwise move it with the keyboard). */
@media (pointer: coarse) { body.typing .tabbar { display: none; } }

.pdf-panel .pdf-open { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.pdf-panel .primary, .pdf-panel .secondary { width: 100%; margin-top: 12px; }

/* ---------- Getting started ---------- */
.text-btn.center { display: block; margin: 10px auto 0; text-align: center; }
.settings-group-label { margin: 26px 4px 2px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.large-title + .settings-group-label { margin-top: 6px; }

/* The ⋯ menu on a goal's page */
.hero-top { position: relative; }
.hero-more { flex: none; width: 36px; height: 36px; margin-left: 4px; display: grid; place-items: center; background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; }
.hero-more svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* "?" beside a section label, and its panel */
.section-label .help { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 4px; vertical-align: 1px; border-radius: 50%; border: 0; background: var(--fill); color: var(--muted); font-size: 11.5px; font-weight: 700; cursor: pointer; padding: 0; }
.help-panel .help-text { font-size: 17px; line-height: 1.5; margin: 6px 0 4px; }

/* A tip, shown once, above the tab bar but under sheets and panels (z 20), so an opened menu covers it */
#tip {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px); z-index: 19;
  display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 14px;
  background: var(--card); color: var(--text); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3); font-size: 14.5px; line-height: 1.35;
  opacity: 0; transform: translateY(16px); transition: opacity 0.25s, transform 0.25s;
}
#tip.show { opacity: 1; transform: none; }
#tip svg { width: 22px; height: 22px; flex: none; fill: none; stroke: #ffcc00; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#tip span { flex: 1; }
#tip button { flex: none; border: 0; border-radius: 10px; padding: 8px 12px; background: var(--fill); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
@media (min-width: 900px) { #tip { left: calc(var(--side-w) + 24px); right: auto; max-width: 440px; bottom: 24px; } }
.tip-inline { margin: 8px 6px 0 !important; }

/* Welcome */
.panel.welcome { text-align: center; }
.welcome-icon { width: 64px; height: 64px; margin: 10px auto 12px; display: grid; place-items: center; border-radius: 18px; background: var(--fill); }
.welcome-icon svg { width: 34px; height: 34px; fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.panel.welcome .sub-meta { font-size: 16px; line-height: 1.5; }
.welcome-list { text-align: left; margin-top: 10px; }
.welcome-list .emoji { font-size: 20px; width: 26px; flex: none; }
.welcome-list .label { font-size: 15px; line-height: 1.35; }
.welcome-dots { display: flex; justify-content: center; gap: 6px; margin: 16px 0 4px; }
.welcome-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.welcome-dots i.on { background: var(--text); }
.panel.welcome .primary { width: 100%; margin-top: 12px; }

/* "Kom igång" on the start page */
.onboard { background: var(--card); border-radius: 16px; padding: 12px 14px 6px; margin: 4px 0 14px; }
.onboard-head { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.onboard-head span { color: var(--muted); font-size: 13px; }
.onboard-head button { margin-left: auto; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 4px; }
.onboard .progress { margin: 8px 0 4px; }
.onboard-step { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 0; border: 0; background: none; color: var(--text); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.onboard-step + .onboard-step { border-top: 0.5px solid var(--line); }
.onboard-step .ring { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center; }
.onboard-step .ring svg { width: 12px; height: 12px; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.onboard-step.done { color: var(--muted); text-decoration: line-through; cursor: default; }
.onboard-step.done .ring { background: #34c759; border-color: #34c759; }
.onboard-step .chev { margin-left: auto; color: var(--muted); }
.link-btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }

/* Very long words without spaces (a web address, a pasted code) wrap instead of making the page wider. */
#view, #sheet-root, #toast, #undo, #tip, #mot-bubble { overflow-wrap: anywhere; }

/* Nothing may make the page wider than the screen (a long word, a shaking page, a coach at the edge). */
html, body { overflow-x: clip; }
.leave-shared { display: block; max-width: 640px; margin: 18px auto 30px; }

/* Dag för dag: a box per day, filled in the goal's colour */
.day-today {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; border-radius: 12px;
  border: 1.5px solid var(--g); color: color-mix(in srgb, var(--g) 60%, var(--text)); font-weight: 600; font-size: 16px; background: transparent;
}
.day-today.on { background: color-mix(in srgb, var(--g) 72%, #000); border-color: transparent; color: #fff; }
.day-today svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.day-sum { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.day-others { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.day-grid { display: grid; grid-template-columns: 2.6em repeat(7, 1fr); gap: 5px; margin-top: 12px; align-items: center; }
.dg-head { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); }
.dg-week { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dg-day {
  aspect-ratio: 1; max-height: 40px; border-radius: 8px; display: grid; place-items: center; padding: 0;
  background: var(--fill); border: 0; color: #fff;
}
.dg-day.on { background: color-mix(in srgb, var(--g) 72%, #000); }
.dg-day.today { box-shadow: inset 0 0 0 2px var(--g); }
.dg-day.future { opacity: 0.35; }
.dg-day svg { width: 60%; height: 60%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.daily-full { padding: 4px 16px 14px; }
.daily-full .day-others { margin-top: 8px; }

/* A nudge when the next sub-goal is far off */
.near-hint { margin: 8px 0 0; font-size: 14px; color: var(--muted); line-height: 1.4; }

/* The coach's view: the assessment answers */
.ro-assess div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 15px; }
.ro-assess div + div { border-top: 0.5px solid var(--line); }
.ro-assess b { white-space: nowrap; color: color-mix(in srgb, var(--g) 60%, var(--text)); }

/* The printout's day grid */
.pg-days { margin-top: 12px; break-inside: avoid; }
.pg-days h3 { margin: 0 0 4px; font-size: 7.5pt; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #555; }
.pg-daytable th, .pg-daytable td { width: auto !important; text-align: center; }

/* "Erfaren målanvändare": explanations and tips are hidden. Information (dates, counts, status), warnings
   that ask for something (.notice) and texts marked .keep stay, and so do the ? buttons. */
:root[data-expert] :is(.section-hint:not(.notice):not(.keep), .desc, .scale-q small, .measure-hint, .near-hint, .hint-toggle) { display: none !important; }

/* "Kom ihåg varför": the user's own words under the goal's name */
.why-line { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; font-size: 15px; line-height: 1.4; color: var(--text); }
.why-line svg { width: 18px; height: 18px; flex: none; margin-top: 1px; fill: none; stroke: var(--g); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.why-line b { font-weight: 600; color: color-mix(in srgb, var(--g) 60%, var(--text)); }

/* The goal's symbol */
.hero-emoji { margin-right: 10px; }
.emoji-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; padding: 10px; }
.emoji-pick button { height: 44px; border-radius: 12px; border: 0; background: var(--fill); font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }
.emoji-pick button.sel { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }

/* Din vecka */
.week-card { margin: 10px 0 12px; padding: 16px; border-radius: 16px; background: var(--card); }
.week-card h2 { margin: 2px 0 4px; font-size: 22px; }
.week-card p { margin: 0; font-size: 15px; line-height: 1.45; }
.week-card .week-high { margin-top: 8px; color: var(--muted); font-size: 14px; }
.week-card .week-high b { color: var(--text); font-weight: 600; }
.year-row { margin: 0 0 12px; border-radius: 12px; background: var(--card); width: 100%; }

/* Ditt år */
.year-title { font-size: 44px; margin: 0 0 10px; }
.year-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.year-stats div { background: var(--card); border-radius: 14px; padding: 12px 14px; }
.year-stats b { display: block; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.year-stats span { font-size: 13px; color: var(--muted); }
.year-goal { gap: 12px; }
.trophy-mark { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: color-mix(in srgb, var(--g) 16%, transparent); }
.trophy-mark svg { width: 22px; height: 22px; fill: none; stroke: color-mix(in srgb, var(--g) 70%, var(--text)); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* The image (drawn by html2canvas: plain colours only) */
.year-card { position: fixed; left: -10000px; top: 0; width: 520px; padding: 36px; background: #ffffff; color: #1c1c1e; font-family: -apple-system, system-ui, sans-serif; }
.yc-top { font-size: 15px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #6c6c70; }
.yc-year { font-size: 72px; font-weight: 800; line-height: 1; margin: 6px 0 22px; }
.yc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.yc-stats div { background: #f2f2f7; border-radius: 14px; padding: 14px 16px; }
.yc-stats b { display: block; font-size: 34px; line-height: 1.1; }
.yc-stats span { font-size: 15px; color: #6c6c70; }
.yc-goal { border-left: 6px solid #14936b; border-radius: 10px; padding: 12px 14px; margin-top: 8px; display: flex; justify-content: space-between; gap: 12px; font-size: 17px; }
.yc-goal span { color: #6c6c70; white-space: nowrap; font-size: 15px; }
.yc-foot { margin-top: 22px; font-size: 14px; color: #6c6c70; text-align: right; }
.yc-foot img { height: 22px; width: auto; display: inline-block; vertical-align: middle; }

/* The trophy shelf */
.shelf .large-title { margin-bottom: 2px; }
.trophies { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 16px; }
.trophy {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border-radius: 16px; border: 0; text-align: left;
  background: linear-gradient(160deg, color-mix(in srgb, var(--g) 18%, var(--card)), var(--card) 70%); color: var(--text); font: inherit; cursor: pointer;
}
.trophy b { font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.trophy small { font-size: 13px; color: var(--muted); }
.trophy i { font-size: 13.5px; line-height: 1.35; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.trophy .trophy-mark { margin-bottom: 4px; }

/* A sprint's highlights */
.hl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; }
.hl-chips span { padding: 6px 12px; border-radius: 99px; font-size: 14px; font-weight: 600; background: color-mix(in srgb, var(--g) 14%, transparent); color: color-mix(in srgb, var(--g) 60%, var(--text)); }
.hl-retro { margin: 14px 4px 0; font-size: 16px; line-height: 1.45; font-style: italic; }

/* Checking something off: a small pop */
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
.pop, .mini-act.done .ring { animation: pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
@media (prefers-reduced-motion: reduce) { .pop, .mini-act.done .ring { animation: none; } }

/* "Ta bort allt": a red main button (a deeper shade, so white text reads in every theme) */
.primary.danger-fill { background: color-mix(in srgb, var(--danger) 85%, #000); color: #fff; }

/* Goal and sprint pictures (drawn by html2canvas: plain colours only) */
.yc-title { font-size: 40px; font-weight: 800; line-height: 1.1; margin: 8px 0 6px; }
.yc-sub { font-size: 18px; color: #6c6c70; margin-bottom: 18px; }
.yc-stats + .yc-sub { margin-top: 18px; }
.yc-why { font-style: italic; color: #3a3a3c; }
.yc-bar { height: 14px; border-radius: 7px; overflow: hidden; margin: 14px 0 18px; }
.yc-bar i { display: block; height: 100%; border-radius: 7px; }
.yc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.yc-chips span { padding: 10px 16px; border-radius: 99px; font-size: 18px; font-weight: 600; }

/* The Workflow logo, plain */
.brand-wrap { display: block; flex: none; }

/* Templates: the picker in the guide, and suggestions as buttons */
.tpl-chosen { display: flex; align-items: center; gap: 12px; margin: 0 4px 10px; font-size: 15px; font-weight: 600; }
.tpl-chosen span { flex: 1; }
.tpl-chosen .text-btn { padding: 4px 0; }
.tpl-row { gap: 12px; }
.tpl-emoji { font-size: 24px; width: 32px; text-align: center; flex: none; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 2px 4px; align-items: center; }
.suggest-label { width: 100%; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 99px; border: 0; cursor: pointer;
  background: var(--card); color: var(--text); font: inherit; font-size: 14.5px; line-height: 1.25; text-align: left;
  box-shadow: inset 0 0 0 1px var(--line);
}
.chip svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.chip:active { background: var(--fill); }

/* Stödmål */
.m-card.reinforce h3 { color: color-mix(in srgb, var(--g) 60%, var(--text)); }
.reinforce-row { padding-left: 0; padding-right: 0; gap: 10px; width: 100%; text-align: left; }
.reinforce-row + .reinforce-row { border-top: 0.5px solid var(--line); }
.reinforce-row.done .label { color: var(--muted); }
.reinforce-progress { margin-left: auto; font-size: 14px; color: color-mix(in srgb, var(--g) 60%, var(--text)); white-space: nowrap; font-weight: 600; }
.reinforce-of { display: block; margin: 8px 0 0; padding: 0; border: 0; background: none; font: inherit; font-size: 15px; color: var(--text); cursor: pointer; text-align: left; }
.reinforce-of b { color: color-mix(in srgb, var(--g) 60%, var(--text)); }
.reinforce-hint .label { color: color-mix(in srgb, var(--g) 60%, var(--text)); }
.ro-reinforce { margin: 0 0 10px; }
.ro-reinforce + .ro-reinforce { border-top: 0.5px solid var(--line); padding-top: 10px; }
.ro-reinforce p { margin: 4px 0 0; }

/* The goal's menu (⋯): grouped, each kind of sharing in its own colour */
.goal-menu > .group:first-child { display: flex; flex-direction: column; min-height: 0; }
.goal-menu { display: flex; flex-direction: column; overflow: hidden; }
.goal-menu > .group:last-child { flex: none; }
.menu-scroll { overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding-bottom: 6px; }
.menu-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; border-bottom: 0.5px solid var(--line); font-size: 15px; }
.menu-head span { font-size: 20px; }
.menu-head b { color: color-mix(in srgb, var(--g) 60%, var(--text)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-section { padding: 12px 16px 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.menu-section:empty { padding: 6px 0 0; border-top: 0.5px solid var(--line); margin-top: 6px; }
.menu-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 7px 16px; border: 0; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.menu-row:active { background: var(--fill); }
.menu-row .label { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.menu-label { font-size: 16.5px; }
.menu-row small { font-size: 13px; color: var(--muted); margin-top: 1px; }
.menu-row .chev { margin-left: 8px; }
.menu-row.danger .menu-label { color: var(--danger); font-weight: 600; }
.menu-ico { flex: none; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--c); }
.menu-ico svg { width: 19px; height: 19px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Räknehjälp for the measurable goal */
.calc { padding: 0 0 10px; background: color-mix(in srgb, var(--g, var(--accent)) 6%, transparent); }
.calc .row { gap: 8px; }
.calc .row label { flex: none; min-width: 92px; }
.calc input, .calc select { font: inherit; color: var(--text); background: var(--fill); border: 0; border-radius: 8px; padding: 7px 10px; min-width: 0; }
.calc .calc-n { width: 80px; text-align: right; }
.calc .calc-u { flex: 1; }
.calc select { flex: 1; }
.calc-out { padding: 4px 16px 0; display: grid; gap: 8px; }
.calc-note { margin: 4px 0 2px; font-size: 13.5px; color: var(--muted); }
.calc-use { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 10px 14px; border-radius: 12px; font: inherit; text-align: left; cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--g, var(--accent)) 55%, transparent); background: var(--card); color: var(--text); }
.calc-use b { font-size: 17px; color: color-mix(in srgb, var(--g, var(--accent)) 60%, var(--text)); }
.calc-use small { font-size: 13px; color: var(--muted); }
.calc-use:active { background: var(--fill); }
.calc-open[aria-expanded=true] .chev { transform: rotate(90deg); }

/* QR codes for codes and invites */
.qr-wrap { margin-top: 10px; }
.group .qr-wrap { padding: 0 16px 12px; }
.qr { margin: 4px auto 0; text-align: center; }
.qr svg { width: min(240px, 70vw); height: auto; display: block; margin: 0 auto; border-radius: 12px; border: 0.5px solid var(--line); }
.qr figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* Vanliga frågor */
.faq-link { margin: 4px 0 18px; }
.group.faq details { border-bottom: 0.5px solid var(--line); }
.group.faq details:last-child { border-bottom: 0; }
.group.faq summary { list-style: none; cursor: pointer; padding: 13px 40px 13px 16px; font-size: 16.5px; position: relative; }
.group.faq summary::-webkit-details-marker { display: none; }
.group.faq summary::after { content: '›'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 20px; transition: transform 0.2s; }
.group.faq details[open] summary::after { transform: translateY(-50%) rotate(90deg); }
.group.faq details[open] { background: color-mix(in srgb, var(--accent) 4%, var(--card)); }
.group.faq details[open] summary { font-weight: 650; color: color-mix(in srgb, var(--accent) 70%, var(--text)); }
.group.faq p { margin: 0 16px 14px; padding: 11px 13px; border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 4px 10px 10px 4px;
  background: var(--bg); color: color-mix(in srgb, var(--text) 85%, var(--muted)); font-size: 15px; line-height: 1.5; }
.faq-count { margin: 0 4px 6px; }

/* Dagens fokus: Gjort idag, per goal under its name in the goal's colour */
.done-label { margin-top: 18px; }
.done-card { padding-top: 10px; border-top: 3px solid var(--g); }
.done-card + .done-card { margin-top: 10px; }
.done-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 4px; }
.done-name { font-weight: 700; font-size: 15.5px; color: color-mix(in srgb, var(--g) 60%, var(--text)); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.done-n { flex: none; font-size: 12.5px; color: var(--muted); }
.done-card .mini-act.done .t { text-decoration: none; color: var(--text); }
.done-card .today-act .d { color: var(--muted); }

/* The guide's first step: start from a template, or fill in the whole goal card yourself */
.guide-alt { display: flex; gap: 10px; margin-top: 14px; }
.guide-alt button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 9px 10px; margin: 0;
  font-size: 14.5px; font-weight: 600; border-radius: 12px; line-height: 1.2; }
.guide-alt svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Semester: the line on the goal card, and holiday days in the calendar */
.break-line { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 6px; padding: 4px 10px; border-radius: 99px; font: inherit; font-size: 13px;
  background: color-mix(in srgb, #30b0c7 14%, transparent); color: color-mix(in srgb, #30b0c7 55%, var(--text)); cursor: pointer; border: 0; }
.cal .day.on-break { background-image: linear-gradient(color-mix(in srgb, #30b0c7 16%, transparent), color-mix(in srgb, #30b0c7 16%, transparent)); }
.break-day { margin: 0 4px 6px; }
.break-panel input[type=date] { font: inherit; color: var(--text); background: var(--fill); border: 0; border-radius: 8px; padding: 6px 10px; }

.legend .break-mark { display: inline-block; width: 14px; height: 10px; border-radius: 3px; background: color-mix(in srgb, #30b0c7 30%, transparent); margin-right: 5px; vertical-align: middle; }

/* Between a goal's sprints: dots like the home page on a phone, buttons on a computer */
.sprint-nav { display: none; justify-content: space-between; gap: 12px; margin: 18px 4px 0; }
.sprint-nav .text-btn { font-size: 15px; }
@media (min-width: 900px) { .sprint-nav { display: flex; } }
.sprint-dots { z-index: 5; }

/* While swiping between sprints the dots stay out of the way (they'd move with the page) */
body.sprint-swiping .sprint-dots { opacity: 0; }

/* A sprint's state (not started, going on, past its date, finished) */
.sprint-state { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; line-height: 1.5;
  background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.sprint-state.active { background: color-mix(in srgb, #34c759 18%, transparent); color: color-mix(in srgb, #34c759 55%, var(--text)); }
.sprint-state.upcoming { background: color-mix(in srgb, #0a84ff 16%, transparent); color: color-mix(in srgb, #0a84ff 60%, var(--text)); }
.sprint-state.late { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.sprint-row .info small .sprint-state { margin-right: 4px; }
.sprint-state-line { margin: 4px 4px -4px; }
/* The home page's sprint card: switching sprint, and all activities */
.sprint-head { display: flex; align-items: center; gap: 8px; }
.sprint-head .now-sprint { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.sprint-switch { flex: none; display: flex; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); }
.sprint-switch button { width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; color: var(--text); }
.sprint-switch button:disabled { opacity: 0.25; }
.sprint-links { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.sync-status.off i { background: var(--muted); opacity: 0.6; }
/* The week's highlights */
.week-highs { margin-top: 12px; display: grid; gap: 8px; }
.week-highs-h { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.week-hl { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: color-mix(in srgb, var(--g) 10%, transparent); border-left: 3px solid var(--g); }
.week-hl b { display: block; font-size: 15px; }
.week-hl small { display: block; font-size: 13px; color: var(--muted); }
