/* Mobile first, dark first. Base styles = phone; min-width queries widen the layout.
   Spacing uses one 4px scale so every gap, padding and margin lines up. */
/* Inter, self-hosted. Swedish letters live in the latin subset. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/inter-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/inter-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* Palette taken from the app icon: night-sky charcoal, snow-white text, tent orange, window-glow yellow. Dark is the only theme. */
  --background: oklch(0.2400 0.0090 270);
  --foreground: oklch(0.9570 0.0090 75);
  --card: oklch(0.2800 0.0100 270);
  --popover: oklch(0.3100 0.0110 270);
  --primary: oklch(0.6800 0.1650 47);
  --primary-foreground: oklch(0.1700 0.0200 45);
  --muted: oklch(0.2100 0.0085 270);
  --muted-foreground: oklch(0.7600 0.0150 270);
  --destructive: oklch(0.6368 0.2078 25.3313);
  --border: oklch(0.3600 0.0120 270);
  --input: oklch(0.4300 0.0130 270);
  --ring: oklch(0.6800 0.1650 47);
  --chart-2: oklch(0.6898 0.1581 290.4107);
  /* status colours, tuned to sit on the same warm greys */
  --good: oklch(0.78 0.13 150);
  --warn: oklch(0.88 0.12 92);
  --cool: oklch(0.78 0.07 255);

  /* semantic aliases used by the components */
  --bg: var(--background); --surface: var(--card); --raised: var(--popover); --ink: var(--foreground);
  --muted-ink: var(--muted-foreground); --line: var(--border);
  --accent: var(--primary); --accent-ink: var(--primary-foreground); --warm: var(--warn); --bad: var(--destructive);
  --cell-empty: var(--muted);
  --shadow: 0 1px 3px 0 hsl(0 0% 0% / .25), 0 1px 2px -1px hsl(0 0% 0% / .25);
  --radius: 1rem; --radius-sm: .75rem;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* the whole type scale: five sizes */
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-base: 1rem; --fs-lg: 1.375rem; --fs-xl: 1.75rem;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --gutter: 20px; --pad: 20px; --gap: 16px;
  --nav-h: 88px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; min-height: 100dvh; background: radial-gradient(900px 520px at 50% -8%, color-mix(in oklch, var(--accent) 13%, transparent), transparent 64%), radial-gradient(700px 420px at 105% 4%, color-mix(in oklch, var(--chart-2) 9%, transparent), transparent 60%), var(--bg); color: var(--ink); font: var(--fs-base)/1.5 var(--font-sans);  }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }

/* page frame */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter) calc(var(--nav-h) + var(--sp-6) + env(safe-area-inset-bottom)); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); align-content: start; }
.wrap.form { padding-bottom: calc(96px + env(safe-area-inset-bottom)); max-width: 640px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: calc(var(--sp-5) + env(safe-area-inset-top)) 0 var(--sp-2); }
header.top h1 { font-size: var(--fs-xl);  line-height: 1.2; }
header.top p { color: var(--muted-ink); font-size: var(--fs-sm); margin-top: var(--sp-1); }
.back { display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--muted-ink); text-decoration: none; min-height: 44px; font-size: var(--fs-sm); }

/* controls */
.btn { appearance: none; border: 1px solid var(--line); background: var(--raised); color: var(--ink); min-height: 48px; padding: 0 var(--sp-5); border-radius: var(--radius-sm); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: transparent; }
.btn.small { min-height: 40px; padding: 0 var(--sp-4); font-size: var(--fs-sm); }
.btn.ghost { background: transparent; }
/* 16px inputs: iOS Safari zooms the page on anything smaller */
select, input, textarea { min-width: 0; font: inherit; font-size: var(--fs-base); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-3); width: 100%; min-height: 48px; }
textarea { resize: vertical; }
select.inline { width: auto; min-width: 104px; }
input[type="checkbox"] { min-height: 0; width: 22px; height: 22px; accent-color: var(--accent); }
input[aria-invalid="true"], input[aria-invalid="true"]:focus { border-color: var(--bad); }
/* focus: quiet and neutral, never a coloured ring */
:focus-visible { outline: 2px solid color-mix(in oklch, var(--ink) 45%, transparent); outline-offset: 2px; }
select:focus, input:focus, textarea:focus { outline: none; border-color: color-mix(in oklch, var(--ink) 40%, var(--line)); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ink) 9%, transparent); }

/* cards */
.card { grid-template-columns: minmax(0, 1fr); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--pad); border: 1px solid var(--line); min-width: 0; display: grid; gap: 18px; align-content: start; }
.card-head h2 { font-size: var(--fs-base); font-weight: 650; line-height: 1.3; }
.card-head p { color: var(--muted-ink); font-size: var(--fs-sm); margin-top: var(--sp-1); }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.hint { font-size: var(--fs-sm); color: var(--muted-ink); }
.empty { color: var(--muted-ink); padding: var(--sp-5); text-align: center; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.pill.warn { background: color-mix(in srgb, var(--warm) 20%, transparent); color: var(--warm); }
.pill.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }

/* bottom navigation: four tabs around a raised "new booking" button */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; view-transition-name: tabbar; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); border-top: 1px solid var(--line); padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom)); }
.tabbar nav { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr 76px 1fr 1fr; align-items: end; column-gap: var(--sp-1); }
.tab { position: relative; display: grid; justify-items: center; align-content: center; gap: var(--sp-1); padding: var(--sp-2) var(--sp-1) var(--sp-3); border-radius: var(--radius-sm); color: var(--muted-ink); text-decoration: none; font-size: var(--fs-xs); font-weight: 600; line-height: 1.2; min-height: 56px; transition: color .2s, transform .15s; }
.tab:active { transform: scale(.92); }
.tab svg { width: 24px; height: 24px; transition: transform .3s cubic-bezier(.3, 1.7, .5, 1); }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"] svg { transform: translateY(-2px) scale(1.1); }
.tab[aria-current="page"]::after { content: ""; position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: pop .35s cubic-bezier(.3, 1.7, .5, 1) both; }
.tab.new { padding: 0; min-height: 0; align-self: start; }
.tab.new .plus { display: grid; place-items: center; width: 60px; height: 60px; margin-top: -30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); border: 4px solid var(--bg); box-shadow: 0 8px 22px color-mix(in oklch, var(--accent) 40%, transparent); transition: transform .25s cubic-bezier(.3, 1.7, .5, 1), box-shadow .2s; }
.tab.new svg { width: 28px; height: 28px; transform: none; }
.tab.new:active .plus { transform: scale(.88) rotate(90deg); }
@media (hover: hover) { .tab.new:hover .plus { transform: scale(1.06) rotate(90deg); } }
.flash { animation: toast 2.6s cubic-bezier(.2,.8,.2,1) both; position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--sp-4) + env(safe-area-inset-bottom)); background: var(--good); color: var(--accent-ink); padding: var(--sp-3) var(--sp-5); border-radius: 999px; font-weight: 600; z-index: 30; box-shadow: 0 6px 20px rgba(0,0,0,.4); }

/* overview: next arrival + KPIs */
.hero { grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 14px; align-items: center; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.hero .label { color: var(--muted-ink); font-size: var(--fs-xs); }
.hero .big { font-size: var(--fs-lg); font-weight: 700;  line-height: 1.25; }
.hero .meta { color: var(--muted-ink); font-size: var(--fs-sm); }
.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi { gap: var(--sp-1); padding: 18px; text-decoration: none; color: inherit; }
.kpi .label { color: var(--muted-ink); font-size: var(--fs-xs); }
.kpi .value { font-size: var(--fs-xl); font-weight: 700;  font-variant-numeric: tabular-nums; line-height: 1.25; }
.kpi .note { color: var(--muted-ink); font-size: var(--fs-xs); line-height: 1.35; }
.two { grid-template-columns: minmax(0, 1fr); }
.chart-box { position: relative; height: 230px; }

/* season calendar: one row per week, 7 day cells */
.strip { display: grid; gap: 2px; grid-template-columns: 1fr; }
.wkrow { display: grid; grid-template-columns: 44px 1fr; gap: var(--sp-2); align-items: center; padding: 3px var(--sp-1); border-radius: 10px; border: 1px solid transparent; background: none; font: inherit; color: var(--ink); cursor: pointer; text-align: left; min-height: 44px; }
.wkrow.sel { border-color: var(--muted-ink); background: var(--bg); }
.wkrow .lab { font-size: var(--fs-sm); font-weight: 700; line-height: 1.1; padding-left: var(--sp-1); }
.wkrow .lab small { display: block; font-weight: 400; color: var(--muted-ink); font-size: var(--fs-xs); }
.wkrow.peak .lab { box-shadow: inset 0 -3px 0 var(--good); }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.day, .seg { height: 36px; border-radius: 7px; font-size: var(--fs-xs); min-width: 0; }
.day { background: var(--cell-empty); color: var(--muted-ink); display: flex; align-items: center; justify-content: center; }
.seg { padding: 0 6px; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 36px; text-align: center; color: var(--accent-ink); background: oklch(0.76 0.11 var(--h, 250)); cursor: pointer; }
.seg.nodeposit { box-shadow: inset 0 0 0 2px var(--warm); }
.seg.one { padding: 0 1px; font-size: var(--fs-xs);  }
.seg.contl { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.seg.contr { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.legend { display: flex; gap: var(--sp-2) var(--sp-4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted-ink); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.cust { background: oklch(0.76 0.11 var(--h, 250)); }
.legend i.ring { background: transparent; border: 2px solid var(--warm); }
.toggle { display: flex; gap: var(--sp-3); align-items: center; min-height: 36px; }

/* heatmap: scrolls sideways, season label stays put */
.heat { overflow-x: auto; margin: 0 calc(var(--sp-1) * -1); padding: 0 var(--sp-1); -webkit-overflow-scrolling: touch; }
.heat table { border-collapse: separate; border-spacing: 2px; font-size: var(--fs-xs); }
.heat th { font-weight: 500; color: var(--muted-ink); padding: 0 3px; white-space: nowrap; }
.heat th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; padding-right: var(--sp-2); }
.heat td { width: 22px; height: 28px; border-radius: 5px; background: var(--cell-empty); padding: 0; }
.heat td[data-n] { cursor: pointer; }

/* popularity tiles */
.poptiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; }
.ptile { border: 2px solid transparent; border-radius: 10px; padding: 6px 2px; text-align: center; font: inherit; color: var(--ink); cursor: pointer; min-height: 58px; display: flex; flex-direction: column; justify-content: center; line-height: 1.2; }
.ptile b { font-size: var(--fs-xs); }
.ptile span { font-size: var(--fs-xs); opacity: .85; }
.ptile small { font-size: var(--fs-xs); opacity: .8; font-variant-numeric: tabular-nums; }
.ptile.hi { color: var(--accent-ink); }
.ptile.up { border-color: var(--good); }
.ptile.sel { outline: 2px solid var(--ink); outline-offset: 1px; }

/* weather */
.wx { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.wx div { background: var(--bg); border-radius: var(--radius-sm); padding: var(--sp-3); }
.wx b { display: block; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.wx span { color: var(--muted-ink); font-size: var(--fs-xs); display: block; line-height: 1.3; }
.verdict { font-weight: 600; }
.daypick { display: grid; gap: 6px; font-size: var(--fs-sm); color: var(--muted-ink); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
.list li:first-child { padding-top: 0; }
.list li:last-child { border-bottom: 0; padding-bottom: 0; }
.list small { color: var(--muted-ink); display: block; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: oklch(0.76 0.11 var(--h, 250)); margin-right: var(--sp-2); }
.subhead { font-size: var(--fs-xs); font-weight: 650; color: var(--muted-ink); text-transform: uppercase;  }

.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: var(--fs-base); flex: none; background: oklch(0.76 0.11 var(--h, 250) / .16); color: oklch(0.86 0.1 var(--h, 250)); border: 1px solid oklch(0.76 0.11 var(--h, 250) / .35); }

/* booking list */
.toolbar { display: grid; gap: var(--sp-3); }
.chips { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 0 var(--sp-4); border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
.season-head { font-size: var(--fs-xs); font-weight: 650; color: var(--muted-ink); text-transform: uppercase;  padding: var(--sp-2) 0 0; }
.bklist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.bk { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.bk.past { opacity: .6; }
.bk-main { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 14px; align-items: start; padding: var(--sp-4); color: inherit; text-decoration: none; min-width: 0; }
.bk-body { display: grid; gap: 3px; min-width: 0; }
.bk-main .row { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: baseline; }
.bk-main .name { font-weight: 650; overflow-wrap: anywhere; }
.bk-main .price { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bk-main .when { color: var(--muted-ink); font-size: var(--fs-sm); }
.bk-main .pills { margin-top: var(--sp-1); display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.bk-call { display: grid; place-items: center; width: 60px; border-left: 1px solid var(--line); color: var(--accent); text-decoration: none; }
.bk-call svg { width: 22px; height: 22px; }

/* booking form */
.steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--muted-ink); }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-3); }
.stepper { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: var(--sp-2); }
.stepper button { min-height: 48px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--raised); color: var(--ink); font-size: var(--fs-lg); cursor: pointer; }
.stepper button:active { transform: scale(.95); }
.stepper input { text-align: center; font-weight: 650; font-size: var(--fs-lg); padding: 0; }
.summary { background: var(--bg); border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4); display: grid; gap: var(--sp-2); }
.summary .big { font-weight: 650; }
.summary .sub { color: var(--muted-ink); font-size: var(--fs-sm); }
.moneyfield { position: relative; }
.moneyfield input { padding-right: 44px; font-size: var(--fs-lg); font-weight: 650; }
.moneyfield::after { content: "kr"; position: absolute; right: var(--sp-4); top: 50%; transform: translateY(-50%); color: var(--muted-ink); pointer-events: none; }
.suggest { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.suggest .chip { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 48px; cursor: pointer; font-weight: 600; }
.switch input { appearance: none; -webkit-appearance: none; width: 52px; min-height: 0; height: 30px; border-radius: 999px; border: 0; background: var(--cell-empty); position: relative; padding: 0; transition: background .15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--good); }
.switch input:checked::after { transform: translateX(22px); }
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: var(--sp-3) var(--gutter) calc(var(--sp-3) + env(safe-area-inset-bottom)); }
.actionbar .inner { max-width: 640px; margin: 0 auto; display: grid; gap: var(--sp-2); }
.actionbar .btns { display: grid; grid-template-columns: 1fr 2fr; gap: var(--sp-3); }
.msg { padding: var(--sp-3); border-radius: var(--radius-sm); font-size: var(--fs-sm); }
.msg.err { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.msg.ok { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }

/* dialog / sheet */
dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); padding: 0; width: min(92vw, 420px); }
dialog::backdrop { background: rgba(0,0,0,.6); }
.sheet { padding: 24px; display: grid; gap: var(--sp-4); border-radius: 18px; }
.sheet-head { display: flex; align-items: center; gap: 14px; }
.sheet h3 { font-size: var(--fs-lg); }
.sheet .rows { display: grid; gap: var(--sp-2); font-size: var(--fs-sm); }
.sheet .rows .k { display: inline-block; }
.sheet .btns { display: grid; gap: var(--sp-3); margin-top: var(--sp-2); }

/* wider screens */
@media (min-width: 640px) {
  :root { --gutter: 28px; --pad: 24px; --gap: 20px; }
  header.top h1 { font-size: var(--fs-xl); }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero .big { font-size: var(--fs-xl); }
  .two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-box { height: 270px; }
  .strip { grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 4px var(--sp-5); }
  .wx { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .daypick { display: flex; align-items: center; gap: var(--sp-3); }
  .daypick input { width: auto; }
  .bklist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- helpers --------------------------------------------------------------------------- */
.center { display: flex; justify-content: center; }
.skel { background: linear-gradient(100deg, var(--surface) 30%, var(--raised) 50%, var(--surface) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; border-color: transparent; }

/* ---- login ------------------------------------------------------------------------------------ */
body.login { display: grid; place-items: center; padding: var(--sp-6) var(--gutter) calc(var(--sp-6) + env(safe-area-inset-bottom)); overflow-x: hidden; background: radial-gradient(70% 45% at 50% 100%, color-mix(in oklch, var(--accent) 24%, transparent), transparent 70%), radial-gradient(60% 40% at 50% 28%, color-mix(in oklch, var(--accent) 12%, transparent), transparent 70%), linear-gradient(180deg, oklch(0.215 0.012 268) 0%, oklch(0.2 0.009 45) 100%); }
.peaks { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: 34vh; min-height: 160px; z-index: 0; pointer-events: none; animation: fade 1.2s .2s both; }
.loginbox { position: relative; z-index: 1; width: min(100%, 380px); display: grid; gap: var(--sp-5); justify-items: center; text-align: center; animation: rise .7s cubic-bezier(.2,.8,.2,1) both; }
.loginbox .logo { border-radius: 24px; box-shadow: 0 0 0 1px var(--line), 0 16px 40px hsl(0 0% 0% / .45), 0 0 60px color-mix(in oklch, var(--accent) 22%, transparent); animation: float 5s ease-in-out infinite; }
.hello { display: grid; gap: var(--sp-1); }
.logincard { width: 100%; display: grid; gap: var(--sp-4); padding: var(--sp-5); background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow), 0 20px 50px hsl(0 0% 0% / .3); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); text-align: left; }
.logincard .field > .label { font-weight: 600; color: var(--muted-ink); font-size: var(--fs-sm); }
.pwwrap { position: relative; display: block; }
.pwwrap input { padding-right: 52px; }
.eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; color: var(--muted-ink); cursor: pointer; border-radius: var(--radius-sm); transition: color .2s; }
.eye:hover, .eye[aria-pressed="true"] { color: var(--accent); }
.eye svg { width: 22px; height: 22px; }
.logincard .btn { width: 100%; }
.logincard .hint { text-align: center; }
.shake { animation: shake .4s; }

/* ---- motion ------------------------------------------------------------------------------------ */
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: none; } }
@keyframes grow { from { opacity: 0; transform: scaleX(.2); } to { opacity: 1; transform: none; } }
@keyframes cellIn { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes sheetIn { from { opacity: 0; transform: translateY(28px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 16px); } 12%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }

@view-transition { navigation: auto; }
.wrap > * { animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
.card, .btn, .chip, .wkrow, .ptile, .bk, .tab, .stepper button { transition: transform .18s cubic-bezier(.2,.8,.2,1), background-color .2s, border-color .2s, box-shadow .2s, opacity .2s; }
.card.kpi:active, .hero:active, .bk:active, .chip:active, .ptile:active, .wkrow:active { transform: scale(.97); }
@media (hover: hover) {
  .card.kpi:hover, .hero:hover, .bk:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
  .wkrow:hover { background: var(--bg); }
  .ptile:hover { transform: scale(1.06); }
}
.seg { transition: filter .15s, transform .15s; }
.seg:active { transform: scale(.96); filter: brightness(1.1); }
.strip.intro .wkrow { animation: rise .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--n, 0) * 22ms); }
.strip.intro .seg { animation: grow .55s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--n, 0) * 22ms + 180ms); transform-origin: left center; }
.heat.intro td { animation: cellIn .4s cubic-bezier(.3,1.5,.5,1) both; animation-delay: calc(var(--c, 0) * 14ms); }
.poptiles.intro .ptile { animation: cellIn .45s cubic-bezier(.3,1.5,.5,1) both; animation-delay: calc(var(--n, 0) * 18ms); }
.pill { animation: pop .4s cubic-bezier(.3,1.6,.5,1) both; }
dialog[open] { animation: sheetIn .32s cubic-bezier(.2,.8,.2,1) both; }
dialog[open]::backdrop { animation: fade .25s both; }
.btn.busy { position: relative; color: transparent; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, var(--accent-ink) 30%, transparent); border-top-color: var(--accent-ink); animation: spin .7s linear infinite; }
.summary .pill { animation-duration: .3s; }
.msg:not([hidden]) { animation: rise .3s both; }
.switch input, .switch input::after { transition: background .2s, transform .25s cubic-bezier(.3, 1.6, .5, 1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  @view-transition { navigation: none; }
}

/* ---- tool features ------------------------------------------------------------------------- */
.pill.neutral { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.warn-text { color: var(--warm); }
.badge { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #1d0905; font-size: var(--fs-xs); font-weight: 700; display: grid; place-items: center; animation: pop .4s cubic-bezier(.3,1.7,.5,1) both; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 10px; background: var(--cell-empty); color: var(--ink); font-size: var(--fs-xs); letter-spacing: 0; text-transform: none; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.segmented button { min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted-ink); font: inherit; font-weight: 600; cursor: pointer; transition: background .2s, color .2s; }
.segmented button[aria-selected="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.rowbtn { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); width: 100%; background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; min-height: 44px; }
.rowbtn small { color: var(--muted-ink); display: block; }
.bk-main { background: none; border: 0; font: inherit; text-align: left; cursor: pointer; width: 100%; }
.contactbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--sp-2); }
.contactbar .btn { padding: 0 var(--sp-3); }
.contactbar svg { width: 18px; height: 18px; }
.sheet { max-height: 86dvh; overflow-y: auto; }
.sheet .rows > div { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: var(--sp-2); }
.sheet .rows .k { color: var(--muted-ink); }
.sheet .rows .val { color: var(--ink); min-width: 0; }

/* ---- type hierarchy (five sizes only) ---------------------------------------------------------- */
h1 { font-size: var(--fs-xl); font-weight: 700; }
.kpi .value, .hero .big, .sheet h3, .wx b { font-size: var(--fs-lg); }
.moneyfield input { font-size: var(--fs-lg); }
.stepper input { font-size: var(--fs-base); }
.summary .big, .card-head h2 { font-size: var(--fs-base); font-weight: 650; }
.pill, .chip, .badge, .tab, .legend, .hint, .kpi .label, .kpi .note, .wkrow .lab small, .subhead, .season-head { font-size: var(--fs-xs); }
.kpi .label, .kpi .note { line-height: 1.4; }
.btn.small, .bk-main .when, .card-head p, .list small { font-size: var(--fs-sm); }
.pill { font-weight: 600; }
.bk-main .name, .bk-main .price, .list li, .rowbtn { font-size: var(--fs-base); }
.seg, .day { font-size: var(--fs-xs); }
.seg { font-weight: 600; }
.wkrow .lab { font-size: var(--fs-sm); }
.heat table, .heat th { font-size: var(--fs-xs); }
.ptile b, .ptile span, .ptile small { font-size: var(--fs-xs); line-height: 1.25; }
.ptile small { opacity: .75; }
.avatar { font-size: var(--fs-base); }

/* ---- line breaking: no orphans, no clipped pills ------------------------------------------------ */
h1, h2, h3, .card-head p, .hint, .msg, .verdict, .empty, .bk-main .name, .hero .big { text-wrap: balance; }
p, small, .when, .note, .sheet .rows span, .sheet .rows div, .list li span { text-wrap: pretty; }
.pill, .btn, .chip, .tab, .badge, .kpi .label, .segmented button, .count, .price, .subhead, .season-head, .legend span, .avatar, .seg, .day, .wkrow .lab, .ptile { white-space: nowrap; }
.seg { overflow: hidden; text-overflow: ellipsis; }
.kpi .note, .hero .meta, .bk-main .when { overflow-wrap: break-word; }
.legend { row-gap: var(--sp-2); }
.pills { row-gap: var(--sp-2); }

/* ---- improvements from the Jev review ------------------------------------------------------------ */
/* overflow: every card is one shrinkable column */
.card > * { min-width: 0; }
.summary .pill { white-space: normal; text-wrap: balance; line-height: 1.35; }
/* money: digits right-aligned next to the "kr" suffix */
.moneyfield input { text-align: right; padding-right: 48px; }
/* climate tiles: short standalone values read best centred */
.wx div { text-align: center; }
.wx .range { display: block; margin-top: 2px; opacity: .8; }
.legend { justify-content: center; }
/* hero: name gets the full width, countdown sits in the label row */
.hero { grid-template-columns: 44px minmax(0, 1fr); }
.hero .toprow { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.hero .big { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero .meta { display: block; }
/* tab bar: label under the raised plus so its purpose is explicit */
.tab.new { align-self: end; min-height: 56px; padding: 0 var(--sp-1) var(--sp-3); gap: var(--sp-1); display: grid; justify-items: center; align-content: end; color: var(--accent); }
.tab.new .plus { margin-top: -34px; }
.tab.new > span:last-child { font-size: var(--fs-xs); font-weight: 600; line-height: 1.2; }
/* heatmap: empty cells get a hairline so the grid reads on dark */
.heat td { box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--ink) 7%, transparent); }
.heat td[data-n] { box-shadow: none; }
/* popularity: "can be raised" is a small green marker, selection stays a white outline */
.ptile { position: relative; }
.ptile.up { border-color: transparent; }
.ptile.up::after, .up-mark { content: "▲"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); color: var(--good); font-size: var(--fs-xs); line-height: 1; font-style: normal; }
.ptile.up::after { position: absolute; top: 3px; right: 3px; }
.up-mark { display: inline-grid; margin-right: 6px; vertical-align: -4px; }
/* lists: names clamp to two lines, phone button reads as a button */
.bk-main .name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bk-call { background: color-mix(in oklch, var(--accent) 12%, transparent); width: 60px; }
.bk-call svg { width: 22px; height: 22px; }
.suggest .chip { min-height: 40px; }
/* login: brighter secondary text */
.login .hint { color: color-mix(in oklch, var(--ink) 74%, transparent); }
/* sheet: roomier, clearer separation from the page */
.sheet { padding: 28px 24px 24px; gap: 20px; }
.sheet .rows { gap: 14px; }
dialog::backdrop { background: rgba(10, 10, 14, .72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet .rows b, .nowrap { white-space: nowrap; }
/* small avatar for list rows */
.avatar.sm { width: 32px; height: 32px; font-size: var(--fs-sm); }
.rowbtn { border-radius: var(--radius-sm); }
.rowbtn > span:first-child { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: nowrap; flex: 1; min-width: 0; }
.rowbtn > span:last-child { flex: none; }
.rowbtn .avatar { flex: none; }
.rowbtn .rowtext { display: block; flex: 1; min-width: 0; text-wrap: balance; }
.rowbtn:focus-visible { outline-offset: 2px; }
/* toast with an undo action */
.flash.undo { display: flex; align-items: center; gap: var(--sp-4); }
.flash.undo button { background: none; border: 0; color: var(--accent-ink); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0 var(--sp-1); min-height: 32px; }
.sectionrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3); }
.cmp { display: grid; gap: var(--sp-1); background: var(--bg); border-radius: var(--radius-sm); padding: var(--sp-3); text-align: center; }
.cmp b { font-size: var(--fs-lg); }
.cmp span { font-size: var(--fs-xs); color: var(--muted-ink); }
.cmp .delta { font-size: var(--fs-xs); font-weight: 600; }
.cmp .delta.up { color: var(--good); } .cmp .delta.down { color: var(--bad); }
.actions-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: center; }
.flash.undo { animation-duration: 7s; }

/* ---- second pass ---------------------------------------------------------------------------- */
.heat table { width: max-content; }
.heat td { min-width: 22px; width: 22px; }
.heat th { min-width: 22px; text-align: center; }
.heat th:first-child { text-align: left; min-width: 56px; }
.ptile.up::after { top: -6px; right: -6px; width: 20px; height: 20px; box-shadow: 0 0 0 2px var(--surface); }

/* phone button: a quiet round button inside the card, so every card keeps the same text width */
.bk { grid-template-columns: minmax(0, 1fr) auto; }
.bk-call { width: 44px; height: 44px; align-self: center; margin-right: var(--sp-3); border-left: 0; border-radius: 50%; }
.bk-call svg { width: 20px; height: 20px; }
.advice { color: var(--ink); font-size: var(--fs-sm); line-height: 1.5; text-wrap: pretty; }
.advice b { font-weight: 650; }

.bk-main .pills { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-1); }
.bk-main .name { text-wrap: pretty; }
