/* Blekkhus. Et lyst, rolig skrivebord med ting som ligner det de er:
   - papir bare for dokumenter (fakturaen, kvitteringer), med ekte dybde
   - stempel på selve arket, merker med prikk i lister
   - felt er trykket inn i flaten, taster stikker ut
   - Agnes er alltid gul
   Verdiene kommer fra Blekkhus-temaet i Graphical (GUI.md, gui/themes/blekkhus.md). Temaets
   variabler står øverst; appens egne navn (--ink, --paper …) peker på dem. Komponentene bruker
   navnene, aldri tallene. Fonten (Inter) ligger i /fonts. Laget for telefon først. */

@font-face { font-family: "Inter"; src: url(/fonts/inter-latin-wght-normal.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

/* ── Temaet fra Graphical (lys modus; Blekkhus har ikke mørk modus) ─────── */
:root {
  /* Farger */
  --color-1: #cf432c;
  --color-1-transparent: #cf432c33;
  --color-2: #2460b7;
  --color-2-transparent: #2460b733;
  --color-3: #fff7d5;
  --color-4: #267b4c;
  --color-5: #b86b00;
  --neutral-1: #ffffff;
  --neutral-2: #f9fafb;
  --neutral-3: #f1f4f6;
  --neutral-4: #e5e8eb;
  --neutral-4-transparent: #e5e8eb33;
  --neutral-5: #c1c6ce;
  --neutral-6: #90959c;
  --neutral-6-transparent: #90959c33;
  --neutral-7: #6a6f76;
  --neutral-7-transparent: #6a6f7633;
  --neutral-8: #4c5157;
  --neutral-10: #192029;
  --neutral-10-transparent: #19202933;
  --success: #267b4c;
  --warning: #b86b00;
  --error: #9a210c;
  --on-color-1: #ffffff;
  --on-error: #ffffff;

  /* Typografi: Inter i alle tre roller. Temaet kaller familien «Sidebar Inter»; her er det Inter fra /fonts. */
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-body);
  --font-data: var(--font-body);
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-heavy: 600;
  --size-xxs: 10px; --line-xxs: 14px; --letter-spacing-xxs: 0.02em;
  --size-xs: 12px; --line-xs: 16px; --letter-spacing-xs: 0.01em;
  --size-s: 14px; --line-s: 20px; --letter-spacing-s: 0.01em;
  --size-m: 16px; --line-m: 24px; --letter-spacing-m: 0em;
  --size-l: 24px; --line-l: 32px; --letter-spacing-l: -0.01em;
  --size-xl: 36px; --line-xl: 40px; --letter-spacing-xl: -0.01em;
  --size-xxl: 48px; --line-xxl: 52px; --letter-spacing-xxl: -0.02em;

  /* Avstand, hjørner, kanter, skygger */
  --space-xxs: 4px; --space-xs: 8px; --space-s: 12px; --space-m: 16px; --space-l: 24px; --space-xl: 32px; --space-xxl: 48px;
  --radius-xs: 3px; --radius-s: 6px; --radius-m: 10px; --radius-l: 14px; --radius-xl: 20px; --radius-full: 9999px;
  --border-s: 1px; --border-l: 2px;
  --border-shadow-s: 0 0 0 1px var(--neutral-6-transparent);
  --shadow-s: 0px 0.25px 0.75px 0px #1920290d, 0px 1px 3px 0px #19202913;
  --shadow-m: 0px 1px 4px 0px #1920290b, 0px 4px 16px 0px #19202910;
  --shadow-l: 0px 3px 9px 0px #1920290f, 0px 12px 36px 0px #19202916;
  --surface-raised-image: linear-gradient(180deg, #ffffff1f 0%, #ffffff00 48%, #1920290d 100%);
  --surface-raised-shadow: inset 0px 1px 0px 0px #ffffffb3, inset 0px -1px 0px 0px #19202929;
  --surface-recessed-image: linear-gradient(180deg, #1920290d 0%, #19202900 55%);
  --surface-recessed-shadow: inset 0px 1px 2px 0px #19202914, inset 0px -1px 0px 0px #ffffff59;
  --button-bevel-shadow: inset 0px 1px 0px 0px #ffffffb3, inset 0px -1px 0px 0px #19202929, inset 0px 0px 0px 1px #ffffff2d;
  --button-image: linear-gradient(180deg, #ffffff1f 0%, #1920290d 100%);

  /* Bevegelse og fokus */
  --motion-duration: 160ms;
  --motion-easing: cubic-bezier(0.16, 1, 0.3, 1);
  --motion-large-duration: 300ms;
  --motion-large-easing: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-press-distance: 1px;
  --focus-ring-outline: 2px solid color-mix(in srgb, var(--color-2) 55%, transparent);

  /* ── Blekkhus' egne navn, lagt på temaet ─────────────────────────────── */
  --desk: var(--neutral-3);
  --paper: var(--neutral-1);
  --ink: var(--neutral-10);
  --ink-soft: var(--neutral-7);
  --ink-faint: var(--neutral-6);
  --rule: var(--neutral-6-transparent);
  --red: var(--color-1);
  --red-deep: var(--error);
  --blue: var(--color-2);
  --green: var(--color-4);
  --amber: var(--color-5);
  --note: var(--color-3);
  /* Teksten på Agnes' gule lapper. Temaet har ingen mørk gul; dette er et hull i temaet. */
  --note-ink: #5e4925;
  /* Giroen har blankettens gule farge, ikke temaets (fakturaen og den lille på forsida). */
  --giro-yellow: oklch(0.96 0.08 98);
  --sans: var(--font-body);
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  /* Viseren i MVA-måleren svinger forbi og tilbake; temaet har bare vanlige kurver. */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --lift: var(--border-shadow-s), var(--shadow-m);
  --lift-sm: var(--border-shadow-s), var(--shadow-s);
  --sheet-shadow: var(--border-shadow-s), var(--shadow-l);
  --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M9 13h14l2 13a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2z' fill='%232460b7'/%3E%3Crect x='11' y='8' width='10' height='5' rx='1.5' fill='%231b3f7a'/%3E%3Cpath d='M16 3c3 3 3 6 0 9' fill='none' stroke='%23192029' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  color-scheme: light;
}


*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body); font-weight: var(--weight-regular);
  font-size: var(--size-m); line-height: var(--line-m); letter-spacing: var(--letter-spacing-m);
  text-wrap: pretty;
  color: var(--ink);
  background: var(--desk);
  padding-bottom: calc(5.75rem + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: var(--weight-heavy); margin: 0; }
p { margin: 0 0 var(--space-s); }
a { color: inherit; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
img, svg { max-width: 100%; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 99; inset-block-start: var(--space-xs); inset-inline-start: var(--space-xs); background: var(--paper); padding: var(--space-xs) var(--space-s); border-radius: var(--radius-s); box-shadow: var(--lift); }
:focus-visible { outline: var(--focus-ring-outline); outline-offset: 2px; }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Toppen: navneskilt og fanebryter ──────────────────────────────────── */
.machine {
  position: sticky; inset-block-start: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--space-s);
  padding: calc(var(--space-xs) + env(safe-area-inset-top)) max(var(--space-m), env(safe-area-inset-right)) var(--space-xs) max(var(--space-m), env(safe-area-inset-left));
  background: color-mix(in oklch, var(--paper) 85%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: inset 0 -1px 0 var(--rule);
}
.nameplate { display: inline-flex; align-items: center; gap: var(--space-xs); text-decoration: none; color: var(--ink); border-radius: var(--radius-s); }
.nameplate b { font-size: var(--size-m); line-height: var(--line-xs); font-weight: var(--weight-heavy); letter-spacing: var(--letter-spacing-m); }
.nameplate-text { display: grid; }
/* Slagordet får plass først på brede skjermer, der fanene ellers trenger raden. */
.nameplate-tagline { display: none; font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); color: var(--ink-soft); }
@media (min-width: 1200px) { .nameplate-tagline { display: block; } }
.nameplate-mark { inline-size: 28px; block-size: 28px; flex: none; background: var(--mark) center / contain no-repeat; }
.tabs { display: none; }
.machine-tools { margin-inline-start: auto; display: flex; gap: var(--space-xs); align-items: center; }
.machine-tools form { display: contents; }

.loading-bar { position: fixed; z-index: 60; inset: 0 0 auto 0; height: 3px; background: var(--blue); transform: scaleX(0); transform-origin: left; opacity: 0; pointer-events: none; }
:root[data-loading="busy"] .loading-bar { opacity: 1; transform: scaleX(0.85); transition: transform 8s cubic-bezier(0.1, 0.6, 0.2, 1) 0.2s, opacity 0s 0.2s; }
:root[data-loading="done"] .loading-bar { opacity: 0; transform: scaleX(1); transition: transform 0.2s, opacity 0.3s 0.15s; }

/* Beskjed etter en handling. */
.telegram { margin: var(--space-m) auto 0; width: fit-content; max-width: calc(100% - 2 * var(--space-m)); }
.telegram span {
  display: flex; align-items: center; gap: var(--space-xs); padding: var(--space-xs) var(--space-m);
  font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-medium);
  background: var(--ink); color: var(--paper); border-radius: var(--radius-m); box-shadow: var(--shadow-l);
  animation: telegram-in var(--motion-large-duration) var(--motion-large-easing) both, telegram-out var(--motion-large-duration) var(--motion-large-easing) 5s forwards;
}
.telegram span::before { content: ""; inline-size: var(--space-xs); block-size: var(--space-xs); border-radius: 50%; background: var(--success); box-shadow: 0 0 0 2px var(--paper); flex: none; }
@keyframes telegram-in { from { translate: 0 -12px; opacity: 0; } }
@keyframes telegram-out { to { opacity: 0; translate: 0 -8px; } }

/* Lappen om abonnementet: blir stående til det er ordnet. Gul når det haster, rød når bøkene bare kan leses. */
.notice {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: var(--space-xxs) var(--space-s);
  margin: var(--space-m) auto 0; width: fit-content; max-width: calc(100% - 2 * var(--space-m)); padding: var(--space-xs) var(--space-m);
  font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-medium); text-align: center;
  color: var(--ink); background: var(--note); border-radius: var(--radius-m); box-shadow: 0 0 0 1px color-mix(in oklch, var(--note-ink) 18%, transparent), var(--shadow-s);
}
.notice a { color: var(--blue); font-weight: var(--weight-heavy); text-underline-offset: 3px; }
.notice-red { color: var(--on-error); background: var(--error); box-shadow: var(--shadow-s); }
.notice-red a { color: var(--on-error); }

/* ── Siden ───────────────────────────────────────────────────────────────── */
.page { max-width: 1120px; margin: 0 auto; padding: var(--space-l) max(var(--space-m), env(safe-area-inset-right)) var(--space-xl) max(var(--space-m), env(safe-area-inset-left)); }
.page-head { display: flex; flex-wrap: wrap; gap: var(--space-s) var(--space-m); align-items: flex-end; justify-content: space-between; margin: var(--space-xxs) 0 var(--space-l); }
.page-head h1 { font-size: var(--size-l); line-height: var(--line-l); letter-spacing: var(--letter-spacing-l); }
.page-head .lead { margin: var(--space-xxs) 0 0; color: var(--ink-soft); }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.page-actions form { display: contents; }
.back { display: inline-flex; align-items: center; gap: var(--space-xxs); font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); color: var(--ink-soft); text-decoration: none; margin-bottom: var(--space-xs); }
.desk-foot { color: var(--ink-soft); font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); margin: var(--space-m) 0 0; display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; }
.desk-foot .link { color: var(--blue); }

/* ── Flater ──────────────────────────────────────────────────────────────── */
.sheet { position: relative; background: var(--paper); border-radius: var(--radius-l); box-shadow: var(--lift); padding: var(--space-m); }
.sheet + .sheet { margin-top: var(--space-m); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-s); margin-bottom: var(--space-s); }
.sheet-head h2 { font-size: var(--size-m); line-height: var(--line-m); letter-spacing: var(--letter-spacing-m); }
.kicker { margin: 0; font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-medium); color: var(--ink-soft); }
.sheet .fine, .fine { font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); color: var(--ink-soft); margin: var(--space-xs) 0 0; }
.empty { color: var(--ink-soft); margin: var(--space-xxs) 0; }
.link {
  color: var(--blue); background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in oklch, var(--blue) 40%, transparent);
  font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s);
}
.hint { font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); color: var(--ink-soft); }
/* Feilmelding: samme rolle som feltets feil, men som en hel lapp over skjemaet. */
.error {
  background: color-mix(in oklch, var(--error) 6%, var(--paper)); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--error) 30%, transparent);
  color: var(--error); padding: var(--space-xs) var(--space-s); border-radius: var(--radius-m);
  font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-medium);
}
.form-error { display: contents; }
.page > .form-error > .error { margin-bottom: var(--space-m); }

.desk-grid { display: grid; gap: var(--space-m); }
.desk-grid > .sheet { margin: 0; min-width: 0; }

/* ── Taster (Graphical: knapp, sekundær og primær) ─────────────────────────
   Kanten tegnes med skygge, og den lyse fasen ligger på et eget lag over (::before) med halv styrke. */
.key, .lamp {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  padding: var(--space-xs) var(--space-m);
  font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-medium);
  text-decoration: none; cursor: pointer; user-select: none; white-space: nowrap;
  color: var(--ink); background-color: var(--paper); background-image: var(--button-image);
  border: 0; border-radius: var(--radius-m);
  box-shadow: var(--border-shadow-s), var(--shadow-s);
}
.key::before, .lamp::before {
  content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
  border-radius: calc(var(--radius-m) - 1px); box-shadow: var(--button-bevel-shadow); opacity: 0.5;
}
.key:active, .key.pressed, .lamp:active { translate: 0 var(--motion-press-distance); }
.key[disabled] { cursor: not-allowed; background-color: var(--neutral-3); background-image: none; color: var(--neutral-6); box-shadow: 0 0 0 1px var(--neutral-4-transparent); }
.key[disabled]::before { content: none; }
.key-red { color: var(--on-color-1); background-color: var(--red); box-shadow: inset 0 0 0 1px var(--neutral-6-transparent), var(--shadow-s); }
.key.wide { width: 100%; }
.buttons { display: flex; flex-wrap: wrap; gap: var(--space-s); align-items: center; }
/* Ikontastene i toppen: samme tast, bare ikonet. */
.lamp { inline-size: calc(var(--line-s) + 2 * var(--space-xs)); block-size: calc(var(--line-s) + 2 * var(--space-xs)); padding: 0; }
:root[data-sound="on"] .lamp[data-sound-toggle] { color: var(--paper); background-color: var(--ink); background-image: none; }

/* Tasteraden nederst på telefon. */
.keys {
  position: fixed; z-index: 30; inset: auto 0 0 0;
  display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr; align-items: end; gap: var(--space-xxs);
  padding: var(--space-xs) max(var(--space-s), env(safe-area-inset-right)) calc(var(--space-s) + env(safe-area-inset-bottom)) max(var(--space-s), env(safe-area-inset-left));
  background: color-mix(in oklch, var(--paper) 90%, transparent); backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: inset 0 1px 0 var(--rule);
}
.keycap {
  display: grid; justify-items: center; gap: var(--space-xxs); padding: var(--space-xs) 2px var(--space-xxs); text-decoration: none; color: var(--ink-soft);
  font-size: var(--size-xxs); line-height: var(--line-xxs); letter-spacing: var(--letter-spacing-xxs); font-weight: var(--weight-medium); border-radius: var(--radius-m);
}
.keycap:active { translate: 0 var(--motion-press-distance); }
.keycap[aria-current] { color: var(--ink); font-weight: var(--weight-heavy); }
.keycap[aria-current] .ico { stroke-width: 2.1; }
.keycap-red {
  inline-size: 62px; block-size: 62px; border-radius: var(--radius-full); place-content: center; margin: -22px var(--space-xxs) 0; padding: 0; color: var(--on-color-1);
  background-color: var(--red); background-image: var(--button-image);
  box-shadow: 0 0 0 5px var(--paper), var(--shadow-m), var(--button-bevel-shadow);
}

/* ── Skjema (Graphical: felt). Feltene er trykket inn i flaten ───────────── */
.form { display: grid; gap: var(--space-m); }
.form label:not(.key) {
  display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--space-xs); min-width: 0;
  font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-medium); color: var(--ink);
}
.form small { font-weight: var(--weight-regular); color: var(--ink-soft); }
input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea {
  width: 100%; min-width: 0; padding: var(--space-xs) var(--space-s);
  font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-regular); color: var(--ink);
  background-color: var(--paper); background-image: var(--surface-recessed-image);
  border: 0; border-radius: var(--radius-s); box-shadow: 0 0 0 1px var(--neutral-4), var(--surface-recessed-shadow);
}
/* Nedtrekkslister er knapper, ikke felt: de stikker ut. */
select { background-image: var(--surface-raised-image); box-shadow: 0 0 0 1px var(--neutral-4), var(--surface-raised-shadow); }
textarea { resize: vertical; min-height: calc(3 * var(--line-s) + 2 * var(--space-xs)); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: var(--focus-ring-outline); outline-offset: 0; box-shadow: 0 0 0 1px var(--color-1-transparent), var(--surface-recessed-shadow); }
::placeholder { color: var(--ink-faint); opacity: 1; }
.row-2, .row-3 { display: grid; gap: var(--space-s); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
/* Datofelt har egen minstebredde i Safari og Chrome; la dem følge kolonnen. */
input[type="date"] { -webkit-appearance: none; appearance: none; padding-inline: var(--space-s) var(--space-xs); font-variant-numeric: tabular-nums; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.row-3 > :last-child { grid-column: 1 / -1; }
.grid-form { grid-template-columns: 1fr; }
.check { display: flex !important; align-items: center; gap: var(--space-xs); }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
/* En del av skjemaet: skilt med en strek, ikke en egen boks. */
.card { padding: var(--space-xxs) 0 var(--space-m); box-shadow: inset 0 -1px 0 var(--rule); }
.card > legend { float: left; width: 100%; padding: 0; margin-bottom: var(--space-xs); font-size: var(--size-m); line-height: var(--line-m); letter-spacing: var(--letter-spacing-m); font-weight: var(--weight-heavy); color: var(--ink); }
.card > legend + * { clear: both; }
.card > * + * { margin-top: var(--space-s); }
.card > legend + * { margin-top: 0; }
/* Bryter: utgift / inntekt (Graphical: faner). Den valgte stikker opp av sporet. */
.switch { display: grid; grid-template-columns: 1fr 1fr; background: var(--neutral-3); border-radius: var(--radius-m); padding: var(--space-xxs); gap: var(--space-xxs); }
.switch label { display: block; }
.switch input { position: absolute; opacity: 0; }
.switch span {
  display: block; text-align: center; padding: var(--space-xxs) var(--space-s); border-radius: var(--radius-s); cursor: pointer;
  font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-medium); color: var(--ink-soft);
}
.switch input:checked + span { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-s); }
.switch input:focus-visible + span { outline: var(--focus-ring-outline); outline-offset: 2px; }
details.danger { margin-top: var(--space-m); font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); }
details.danger summary { cursor: pointer; color: var(--ink-soft); }
details.danger[open] > :not(summary) { margin-top: var(--space-s); }

/* ── Hilsen og notat fra Agnes ───────────────────────────────────────────── */
.hello { margin: var(--space-xxs) 0 var(--space-m); }
.hello-date { margin: 0 0 var(--space-xxs); color: var(--ink-soft); }
.typed { font-family: var(--font-display); font-weight: var(--weight-heavy); font-size: var(--size-l); line-height: var(--line-l); letter-spacing: var(--letter-spacing-l); }

/* Agnes er alltid gul. */
.memo {
  display: grid; gap: var(--space-xs); position: relative; text-decoration: none; margin: 0 0 var(--space-m); padding: var(--space-s) var(--space-m);
  background: var(--note); color: var(--ink); border-radius: var(--radius-l); border-start-start-radius: var(--radius-xs);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--note-ink) 15%, transparent), var(--shadow-s);
}
.memo-clip { display: none; }
.memo-from { display: flex; align-items: center; gap: var(--space-xs); font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-heavy); color: var(--note-ink); }
.memo-from::before {
  content: "A"; display: grid; place-items: center; inline-size: var(--space-l); block-size: var(--space-l); border-radius: var(--radius-full);
  background: var(--note-ink); color: var(--note); font-size: var(--size-xs); line-height: var(--line-xs); font-weight: var(--weight-heavy);
}
.memo-text { margin: 0; }
.memo-more { font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-medium); color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }

/* ── Telleverk: tallene ruller opp ───────────────────────────────────────── */
.counters { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-s); margin-bottom: var(--space-m); }
.counter { background: var(--paper); border-radius: var(--radius-l); padding: var(--space-s) var(--space-m); box-shadow: var(--lift); min-width: 0; }
.counter-label { margin: 0 0 var(--space-xxs); font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-medium); color: var(--ink-soft); }
.counter-note { margin: var(--space-xxs) 0 0; font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); color: var(--ink-soft); }
.odometer { display: flex; align-items: baseline; font-family: var(--font-data); font-weight: var(--weight-heavy); font-size: var(--size-l); line-height: 1; letter-spacing: var(--letter-spacing-l); font-variant-numeric: tabular-nums; }
.odo-window { block-size: 1.2em; inline-size: 0.64em; overflow: clip; }
.odo-window.lead { display: none; }
.odo-window.group { margin-inline-start: 0.22em; }
.odo-wheel { display: block; transform: translateY(calc(var(--d) * -1.2em)); }
.odo-wheel i { display: block; block-size: 1.2em; line-height: 1.2em; text-align: center; font-style: normal; }
.odo-sign { margin-inline-end: 1px; }
.odo-unit { color: var(--ink-soft); font-size: var(--size-s); font-weight: var(--weight-medium); margin-inline-start: var(--space-xxs); letter-spacing: var(--letter-spacing-s); }
.counter-red .odometer { color: var(--red); }
.counter-blue .odometer { color: var(--blue); }

/* ── Diagrammer (SVG; størrelsene er i diagrammets egne enheter) ─────────── */
.chart { margin: 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--rule); stroke-width: 0.75; stroke-dasharray: 3 4; }
.chart .baseline { stroke: color-mix(in oklch, var(--ink) 30%, transparent); stroke-width: 1; }
.chart .axis { font-family: var(--font-data); font-size: 11px; font-weight: var(--weight-regular); fill: var(--ink-soft); }
.chart .axis.strong { font-weight: var(--weight-heavy); fill: var(--ink); font-size: 12px; }
.chart .hit { fill: transparent; }
.chart .month { outline: none; cursor: default; }
.chart .month:focus-visible .hit { fill: color-mix(in oklch, var(--blue) 8%, transparent); }
.chart .month.now .axis { fill: var(--ink); font-weight: var(--weight-heavy); }
.c-income, .c-income-fill { fill: var(--blue); background-color: var(--blue); }
.c-expense, .c-expense-fill { fill: var(--red); background-color: var(--red); }
.hatch-bg { fill: var(--paper); }
.bar.c-income.planned { fill: url(#hatch-income); stroke: var(--blue); stroke-width: 1; }
.bar.c-expense.planned { fill: url(#hatch-expense); stroke: var(--red); stroke-width: 1; }
.line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.line.dashed { stroke-dasharray: 2 6; }
.dot { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
.dot.hollow { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-xxs) var(--space-m); list-style: none; padding: 0; margin: 0 0 var(--space-xs); font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); color: var(--ink-soft); }
.legend li { display: flex; align-items: center; gap: var(--space-xxs); }
.swatch { width: 11px; height: 11px; border-radius: var(--radius-xs); display: inline-block; }
.swatch.c-planned { background: repeating-linear-gradient(45deg, var(--ink-soft) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--ink-soft); }
.chart-table { margin-top: var(--space-xs); font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); overflow-x: auto; }
.chart-table summary { cursor: pointer; color: var(--ink-soft); padding-block: var(--space-xxs); }
.figures { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-s) var(--space-m); margin: var(--space-s) 0 0; }
.figures dt { font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); color: var(--ink-soft); }
.figures dd { margin: 0; font-family: var(--font-data); font-size: var(--size-m); line-height: var(--line-m); font-weight: var(--weight-heavy); font-variant-numeric: tabular-nums; }

.tip {
  position: fixed; z-index: 70; pointer-events: none; max-width: 240px; white-space: pre-line;
  background: var(--ink); color: var(--paper); padding: var(--space-xxs) var(--space-xs); border-radius: var(--radius-s); box-shadow: var(--shadow-m);
  font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs);
}

/* Viserinstrument: en bue som fylles, med viser og rødt felt mot grensa. */
.gauge { max-width: 300px; margin: 0 auto; }
.gauge svg { display: block; width: 100%; }
.gauge-arc { fill: none; stroke: var(--neutral-4); stroke-width: 13; stroke-linecap: round; }
.gauge-arc.warn { stroke: color-mix(in oklch, var(--red) 28%, var(--paper)); stroke-linecap: butt; }
.gauge-fill { fill: none; stroke: var(--blue); stroke-width: 13; stroke-linecap: round; }
.gauge-tick { display: none; }
.gauge-num { font-family: var(--font-data); font-size: 9px; font-weight: var(--weight-medium); fill: var(--ink-soft); }
.gauge-unit { font-family: var(--font-data); font-size: 6.5px; fill: var(--ink-faint); }
.gauge-needle { transform-origin: 100px 100px; transform: rotate(var(--angle)); fill: var(--ink); }
.gauge-hub { fill: var(--paper); stroke: var(--ink); stroke-width: 2.5; }
.gauge-read { text-align: center; font-variant-numeric: tabular-nums; margin: var(--space-xs) 0 0; }

/* Kalenderblad. */
.calendar { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-s); }
.calendar a, .calendar div { display: flex; gap: var(--space-s); align-items: center; text-decoration: none; }
.leaf { flex: none; inline-size: 46px; display: flex; flex-direction: column; text-align: center; border-radius: var(--radius-s); overflow: clip; background: var(--paper); box-shadow: var(--lift-sm); }
.leaf i { display: block; order: -1; background: var(--ink); color: var(--paper); font-size: var(--size-xxs); line-height: var(--line-xxs); letter-spacing: var(--letter-spacing-xxs); font-weight: var(--weight-heavy); font-style: normal; padding-block: 2px; }
.leaf b { font-family: var(--font-data); font-size: var(--size-m); line-height: var(--line-l); font-weight: var(--weight-heavy); font-variant-numeric: tabular-nums; }
.leaf.late i { background: var(--red); }
.cal-text { display: grid; min-width: 0; }
.cal-text b { font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-heavy); }
.cal-text span { font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); color: var(--ink-soft); }

/* Rader og kategori-stolper. */
.strips { list-style: none; margin: 0 calc(-1 * var(--space-xs)); padding: 0; }
.strip { display: grid; grid-template-columns: minmax(54px, auto) minmax(0, 1fr) auto; gap: var(--space-s); align-items: center; padding: var(--space-xs); text-decoration: none; border-radius: var(--radius-s); }
.strip-date { font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.strip-what { display: grid; min-width: 0; }
.strip-what b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-heavy); }
.strip-what span { font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-sum { font-family: var(--font-data); font-size: var(--size-s); line-height: var(--line-s); font-weight: var(--weight-heavy); white-space: nowrap; font-variant-numeric: tabular-nums; }
.strip-inntekt .strip-sum { color: var(--blue); }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-s); }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: var(--space-xxs) var(--space-s); align-items: baseline; outline: none; }
.bars-label { font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bars-sum { font-family: var(--font-data); font-size: var(--size-s); line-height: var(--line-s); font-weight: var(--weight-heavy); font-variant-numeric: tabular-nums; }
.bars-track { order: 3; grid-column: 1 / -1; height: var(--space-xs); background: var(--neutral-4); border-radius: var(--radius-full); overflow: clip; }
.bars-track i { display: block; height: 100%; background: var(--red); border-radius: var(--radius-full); }
.bars-in .bars-track i { background: var(--blue); }
.bars-label a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in oklch, var(--blue) 40%, transparent); }

/* Snarveier: taster med ikon (Graphical: sekundær knapp). */
.drawers { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-s); margin-top: var(--space-l); }
.drawer {
  position: relative; isolation: isolate;
  display: grid; justify-items: center; gap: var(--space-xxs); padding: var(--space-s) var(--space-xxs); text-decoration: none; text-align: center; min-width: 0;
  font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); font-weight: var(--weight-medium); color: var(--ink);
  background-color: var(--paper); background-image: var(--button-image); border-radius: var(--radius-m); box-shadow: var(--border-shadow-s), var(--shadow-s);
}
.drawer::before { content: ""; position: absolute; inset: 1px; z-index: -1; pointer-events: none; border-radius: calc(var(--radius-m) - 1px); box-shadow: var(--button-bevel-shadow); opacity: 0.5; }
.drawer .ico { color: var(--blue); }
.drawer:active { translate: 0 var(--motion-press-distance); }

/* Merker: en prikk og et ord. */
.dymo, .stamp.small {
  --tone: var(--ink-soft);
  display: inline-flex; align-items: center; gap: var(--space-xxs); padding: 2px var(--space-xs); border: 0; border-radius: var(--radius-full);
  font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); font-weight: var(--weight-medium); white-space: nowrap;
  color: var(--tone); background: color-mix(in oklch, var(--tone) 9%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--tone) 30%, transparent);
}
.dymo::before, .stamp.small::before { content: ""; inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; flex: none; }
.dymo-red { --tone: var(--amber); }
.dymo-blue { --tone: var(--blue); }
/* Forslag i samtalen: små taster, ikke merker. */
button.dymo {
  cursor: pointer; padding: var(--space-xxs) var(--space-s); border-radius: var(--radius-m); color: var(--ink);
  font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s);
  background-color: var(--paper); background-image: var(--button-image); box-shadow: var(--border-shadow-s), var(--shadow-s);
}
button.dymo::before { display: none; }
button.dymo:active { translate: 0 var(--motion-press-distance); }

/* ── Status: merke i lister, gummistempel på arket ─────────────────────────
   Gummistempelet er en tegning, ikke en del av temaet: tykk ramme, sperret og skrått. */
.stamp {
  display: inline-block; padding: 5px 14px; rotate: -8deg; border: 3px solid currentColor; border-radius: 7px;
  font: 800 1.25rem/1 var(--font-display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue); opacity: 0.8;
  mix-blend-mode: multiply; white-space: nowrap;
}
.stamp.small { rotate: none; opacity: 1; mix-blend-mode: normal; text-transform: none; color: var(--tone); }
.stamp.small::first-letter { text-transform: uppercase; }
.stamp-utkast { --tone: var(--ink-soft); color: var(--ink-soft); }
.stamp-sendt, .stamp-prøvetid { --tone: var(--blue); color: var(--blue); }
.stamp-forfalt, .stamp-kreditert, .stamp-kreditnota, .stamp-utløpt { --tone: var(--red); color: var(--red); }
.stamp-betalt, .stamp-gratis { --tone: var(--green); color: var(--green); }
.paper > .stamp { position: absolute; z-index: 2; top: clamp(150px, 22%, 240px); left: 30%; font-size: clamp(1.4rem, 6vw, 2.2rem); }
@keyframes stamp { from { scale: 3.2; opacity: 0; rotate: 6deg; } 70% { opacity: 0.9; } }
@keyframes thump { 30% { translate: 0 3px; scale: 0.995; } }

/* ── Fakturalista ───────────────────────────────────────────────────────── */
.pile { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-xs); }
.pile-sheet {
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-xxs) var(--space-s); align-items: center; padding: var(--space-s) var(--space-m); text-decoration: none; position: relative;
  background: var(--paper); border-radius: var(--radius-l); box-shadow: var(--lift-sm);
}
.pile-no { font-family: var(--font-data); font-size: var(--size-s); line-height: var(--line-s); font-weight: var(--weight-medium); color: var(--ink-soft); min-width: 3.2ch; font-variant-numeric: tabular-nums; grid-row: 1 / span 2; }
.pile-who { display: grid; min-width: 0; grid-row: 1 / span 2; }
.pile-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--weight-heavy); }
.pile-who span { font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); color: var(--ink-soft); }
.pile-sum { font-family: var(--font-data); font-size: var(--size-m); line-height: var(--line-m); font-weight: var(--weight-heavy); font-variant-numeric: tabular-nums; }
.pile-sheet .pile-sum { grid-column: 3; grid-row: 1; justify-self: end; }
.pile-sheet .stamp { grid-column: 3; grid-row: 2; justify-self: end; }

/* ── Fakturaarket: det ene stedet papir tegnes som papir ───────────────────
   Arket er en kopi av PDF-en fra Typst (app/pdf/invoice.typ), så målene følger den, ikke temaets
   skala. Fargene kommer fra temaet. */
.paper {
  --pad: clamp(18px, 5vw, 34px); position: relative; padding: var(--pad); font-size: 0.92rem; line-height: 1.5; container-type: inline-size;
  background: var(--paper); border-radius: var(--radius-xs); box-shadow: var(--sheet-shadow);
}
.paper p { margin: 0; }
.paper-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1.5px solid var(--ink); }
.paper-seller { font: 700 1.2rem/1.15 var(--font-display); letter-spacing: -0.01em; }
.paper-kind { font: 600 0.8rem/1 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.paper-kind b { font-weight: 700; color: var(--ink); letter-spacing: 0; }
.paper-kind.credit, .paper-kind.credit b { color: var(--red); }
.paper-parties { display: grid; gap: 14px; margin: 18px 0 20px; }
.paper-label, .paper-meta dt, .paper-lines th { font: 500 0.76rem/1.3 var(--font-body); color: var(--ink-soft); }
.paper-buyer { font-weight: 650; font-size: 1.02rem; }
.paper-meta { margin: 0; display: grid; gap: 4px; }
.paper-meta div { display: flex; justify-content: space-between; gap: 16px; }
.paper-meta dd { margin: 0; font-variant-numeric: tabular-nums; }
.paper-lines { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.paper-lines th { text-align: left; padding: 0 0 6px; border-bottom: 1px solid color-mix(in oklch, var(--ink) 25%, transparent); }
.paper-lines th.num { text-align: right; }
.paper-lines td { padding: 9px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.paper-lines td + td, .paper-lines th + th { padding-left: 12px; }
.paper-lines small { color: var(--ink-faint); }
.ghost { color: var(--ink-faint); font-style: italic; }
.paper-total { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 16px 0 0 auto !important; padding: 11px 14px; max-width: 320px; background: var(--desk); border-radius: var(--radius-s); font-weight: 500; }
.paper-total b { font: 700 1.3rem var(--font-data); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.paper-total small { font: 500 0.8rem var(--font-body); color: var(--ink-soft); }
.paper-note { margin-top: 14px !important; white-space: pre-line; }
.paper-foot { margin-top: 26px; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 0.72rem; color: var(--ink-soft); }
.paper-thanks { font: 500 0.95rem var(--font-body); text-align: center; color: var(--ink-soft); margin-bottom: 10px !important; }
@container (max-width: 400px) {
  .paper-lines { font-size: 0.82rem; }
  .paper-lines td + td, .paper-lines th + th { padding-left: 6px; }
  .paper-lines td:first-child { overflow-wrap: anywhere; }
}
@container (min-width: 460px) { .paper-parties { grid-template-columns: 1fr auto; } .paper-meta { min-width: 200px; } }

/* ── Giroen: den gule blanketten nederst, til kanten av arket ─────────────
   En norsk giro har faste farger og mål; de følger blanketten, ikke temaet. */
.giro {
  --giro-line: oklch(0.88 0.13 98);
  --giro-ink: oklch(0.2 0 none);
  --giro-mono: "DejaVu Sans Mono", var(--mono);
  margin: 26px calc(-1 * var(--pad)) calc(-1 * var(--pad));
  padding-top: 6px;
  border-top: 1px dashed color-mix(in oklch, var(--ink) 30%, transparent);
  background: var(--paper);
  font: 400 0.78rem/1.35 var(--font-body);
  color: var(--giro-ink);
}
.giro small, .giro dt { display: block; font: 650 0.62rem/1.3 var(--font-body); }
.giro p { margin: 0; }
.giro-value { font: 400 0.85rem/1.2 var(--giro-mono); }
.giro-band { background: var(--giro-yellow); padding: 8px var(--pad); }
.giro-receipt { display: grid; gap: 6px 16px; align-items: end; }
.giro-receipt-title { font-size: 0.85rem; }
.giro-box { display: block; padding: 5px 8px; background: var(--paper); }
.giro-body { display: grid; gap: 12px 24px; padding: 12px var(--pad); }
.giro-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.giro-title { font: 700 1.1rem/1 var(--font-body); letter-spacing: 0.04em; }
.giro-head > div { display: flex; align-items: center; gap: 8px; }
.giro-corners {
  display: block; min-height: 2.2em; padding: 6px 9px;
  /* bare hjørnene, som på blanketten */
  background:
    linear-gradient(var(--giro-ink) 0 0) top left / 9px 1px, linear-gradient(var(--giro-ink) 0 0) top left / 1px 9px,
    linear-gradient(var(--giro-ink) 0 0) top right / 9px 1px, linear-gradient(var(--giro-ink) 0 0) top right / 1px 9px,
    linear-gradient(var(--giro-ink) 0 0) bottom left / 9px 1px, linear-gradient(var(--giro-ink) 0 0) bottom left / 1px 9px,
    linear-gradient(var(--giro-ink) 0 0) bottom right / 9px 1px, linear-gradient(var(--giro-ink) 0 0) bottom right / 1px 9px;
  background-repeat: no-repeat;
}
.giro-debit { display: flex; align-items: center; gap: 10px; }
.giro-boxes { display: flex; gap: 3px; }
.giro-boxes i { inline-size: 12px; block-size: 16px; background: var(--paper); }
.giro-ocr { display: grid; grid-template-columns: 1fr auto auto auto; margin: 0; padding: 8px var(--pad) 10px; }
.giro-ocr > div { padding-inline: 8px; border-inline-start: 1.5px solid var(--giro-ink); }
.giro-ocr > div:nth-child(3) { border-inline-start-color: var(--giro-line); }
.giro-ocr > div:last-child { border-inline-start: 0; }
.giro-ocr dd { margin: 2px 0 0; min-height: 1.2em; font: 400 0.85rem/1.2 var(--giro-mono); white-space: nowrap; }
.giro-stripe { height: 10px; background: var(--giro-yellow); }
@container (min-width: 520px) {
  .giro-receipt { grid-template-columns: auto 1fr minmax(9rem, auto); }
  .giro-receipt-title { grid-column: 1 / -1; }
  .giro-body { grid-template-columns: 1fr 1fr; }
}
@container (max-width: 519px) {
  .giro-ocr { grid-template-columns: 1fr 1fr; row-gap: 8px; }
  .giro-ocr > div:nth-child(odd) { border-inline-start: 0; padding-inline-start: 0; }
  .giro-debit { display: none; }
}

.show { display: grid; gap: var(--space-m); }
.show-side .sheet { display: grid; gap: var(--space-s); }
.show-side .sheet-head { margin-bottom: 0; }
.show-side form { display: grid; gap: var(--space-s); }
@keyframes deal { from { translate: 0 24px; opacity: 0; } }

/* ── Ny faktura: skjema til venstre, arket fylles ut til høyre ───────────── */
.editor { display: grid; gap: var(--space-l); }
.editor-form { background: var(--paper); border-radius: var(--radius-l); box-shadow: var(--lift); padding: var(--space-m); align-content: start; }
.line-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-s); }
.line-row { display: grid; grid-template-columns: 1fr 1fr 1fr 36px; gap: var(--space-xs); padding-bottom: var(--space-s); box-shadow: inset 0 -1px 0 var(--rule); }
.line-desc { grid-column: 1 / -1; }
.line-remove { border: 0; background: none; font-size: var(--size-l); line-height: 1; color: var(--ink-faint); cursor: pointer; border-radius: var(--radius-s); }
.line-remove:active:not([disabled]) { translate: 0 var(--motion-press-distance); }
.line-remove[disabled] { color: var(--neutral-5); cursor: not-allowed; }
.editor-total { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.editor-total b { font-family: var(--font-data); font-weight: var(--weight-heavy); color: var(--ink); }
.preview { min-width: 0; }
.preview-label { display: flex; align-items: center; gap: var(--space-xs); margin: 0 0 var(--space-s); font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); color: var(--ink-soft); }
.preview-label::before { content: ""; inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--green); }
.typing .typed-line::after { content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; vertical-align: -0.15em; background: transparent; }
.typing tbody tr:last-child .typed-line::after { background: var(--blue); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes line-in { from { opacity: 0; translate: 0 6px; } }

/* ── Bilag: kvitteringer med avrevet kant ────────────────────────────────── */
/* Filtrene er faner (Graphical: faner). De ligger rett på skrivebordet, så sporet er ett hakk mørkere enn i toppen. */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-xxs); margin: 0 0 var(--space-m); align-items: center; inline-size: fit-content; max-inline-size: 100%; padding: var(--space-xxs); background: var(--neutral-4); border-radius: var(--radius-m); }
.chip { padding: var(--space-xxs) var(--space-s); border-radius: var(--radius-s); text-decoration: none; font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-medium); color: var(--ink-soft); }
.chip[aria-current] { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-s); }
.chip-gap { inline-size: 1px; block-size: var(--line-s); background: var(--rule); margin-inline: var(--space-xxs); }
.receipts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); gap: var(--space-m) var(--space-s); }
.receipts li { min-width: 0; }
.receipt {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-xxs); padding: var(--space-s) var(--space-s) var(--space-l); text-decoration: none; height: 100%; align-content: start; min-width: 0;
  font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); background: var(--paper); color: var(--ink);
  filter: drop-shadow(0 1px 1px color-mix(in srgb, var(--ink) 10%, transparent)) drop-shadow(0 6px 10px color-mix(in srgb, var(--ink) 10%, transparent));
  /* Avrevet kant nederst. */
  --tooth: 7px;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x, linear-gradient(#000 0 0) top / 100% calc(100% - var(--tooth)) no-repeat;
}
.receipt-top { display: flex; flex-wrap: wrap; gap: var(--space-xxs) var(--space-xs); justify-content: space-between; align-items: center; color: var(--ink-soft); font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); min-height: 22px; }
.receipt-top > span:first-child { white-space: nowrap; }
.receipt b { font-size: var(--size-s); line-height: var(--line-s); font-weight: var(--weight-heavy); overflow-wrap: anywhere; hyphens: auto; }
.receipt-who, .receipt-cat { color: var(--ink-soft); font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-sum { margin-top: var(--space-xs); padding-top: var(--space-xs); border-top: 1px dashed color-mix(in oklch, var(--ink) 25%, transparent); font-family: var(--font-data); font-weight: var(--weight-heavy); font-size: var(--size-m); line-height: var(--line-m); letter-spacing: var(--letter-spacing-m); display: grid; font-variant-numeric: tabular-nums; }
.receipt-sum small { font-weight: var(--weight-regular); font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); color: var(--ink-soft); }
.receipt-inntekt .receipt-sum { color: var(--blue); }

.entry-form { gap: var(--space-m); }
.entry-fields { display: grid; gap: var(--space-m); }
.scanner { display: grid; gap: var(--space-s); justify-items: center; }
.printer { position: relative; width: min(100%, 340px); padding-top: var(--space-m); filter: drop-shadow(0 6px 10px color-mix(in srgb, var(--ink) 15%, transparent)); }
.printer-slot { position: absolute; z-index: 2; inset: 0 calc(-1 * var(--space-xs)) auto calc(-1 * var(--space-xs)); height: 18px; border-radius: var(--radius-m); background: var(--ink); box-shadow: inset 0 -3px 0 oklch(0 0 none / 0.4), var(--shadow-m); }
.printout { position: relative; display: grid; background: var(--paper); min-height: 150px; overflow: clip; --tooth: 8px;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x, linear-gradient(#000 0 0) top / 100% calc(100% - var(--tooth)) no-repeat; padding-bottom: var(--space-xs); }
.printout img { display: block; width: 100%; }
.printout-file { place-items: center; padding: var(--space-xl) var(--space-m); }
.printout-empty { place-items: center; align-content: center; gap: var(--space-xs); padding: var(--space-xl) var(--space-m); text-align: center; cursor: pointer; color: var(--ink-soft); }
.printout-empty b { color: var(--ink); font-weight: var(--weight-heavy); }
.scan-frame { position: relative; width: 74px; height: 74px; margin-bottom: var(--space-xs); }
.scan-frame i { position: absolute; width: 20px; height: 20px; border: 3px solid var(--red); }
.scan-frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-start-start-radius: var(--radius-s); }
.scan-frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-start-end-radius: var(--radius-s); }
.scan-frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-end-start-radius: var(--radius-s); }
.scan-frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-end-end-radius: var(--radius-s); }
@keyframes breathe { 50% { scale: 0.9; } }
@keyframes print { from { clip-path: inset(0 0 100% 0); translate: 0 -30%; } to { clip-path: inset(0); translate: 0 0; } }
@keyframes sweep { to { translate: 0 400px; } }
.scanner-tools { display: flex; flex-wrap: wrap; gap: var(--space-s); align-items: center; justify-content: center; color: var(--ink-soft); }
.scanner-status { margin: 0; min-height: var(--line-s); text-align: center; font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); color: var(--ink-soft); }

/* ── Kort: faste poster og kunder ────────────────────────────────────────── */
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: var(--space-s); }
.index-card {
  display: grid; gap: var(--space-xxs); height: 100%; padding: var(--space-s) var(--space-m); text-decoration: none; position: relative; border-radius: var(--radius-l);
  font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); color: var(--ink-soft);
  background: var(--paper); box-shadow: var(--lift-sm);
}
.index-card b { color: var(--ink); font-size: var(--size-m); line-height: var(--line-m); letter-spacing: var(--letter-spacing-m); font-weight: var(--weight-heavy); }
.index-card form { justify-self: end; }
.index-card form .link { padding: var(--space-xs) 0 var(--space-xs) var(--space-m); }
/* Kort inne i en flate ligger på skrivebordsfargen, så de ikke forsvinner i det hvite. */
.sheet .index-card { background: var(--desk); box-shadow: none; }

/* Planen: tolv måneder fram. */
.ahead { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--space-xxs); height: 150px; align-items: end; box-shadow: inset 0 -1px 0 color-mix(in oklch, var(--ink) 30%, transparent); }
.ahead-col { display: grid; grid-template-rows: 1fr auto; height: 100%; outline: none; position: relative; border-radius: var(--radius-s) var(--radius-s) 0 0; }
.ahead-col:focus-visible { background: color-mix(in oklch, var(--blue) 8%, transparent); }
.ahead-bars { display: flex; gap: 2px; align-items: flex-end; justify-content: center; }
.ahead-bars i { width: 38%; max-width: 14px; min-height: 0; border-radius: var(--radius-xs) var(--radius-xs) 0 0; }
.ahead-bars i.c-income { background: repeating-linear-gradient(45deg, var(--blue) 0 2.5px, var(--paper) 2.5px 5px); box-shadow: 0 0 0 1px var(--blue) inset; }
.ahead-bars i.c-expense { background: repeating-linear-gradient(45deg, var(--red) 0 2.5px, var(--paper) 2.5px 5px); box-shadow: 0 0 0 1px var(--red) inset; }
.ahead-label { text-align: center; font-size: var(--size-xxs); line-height: var(--line-xxs); letter-spacing: var(--letter-spacing-xxs); color: var(--ink-soft); translate: 0 18px; height: 0; }
.ahead + .legend { margin-top: var(--space-l); }

/* ── Regnskapstabell ────────────────────────────────────────────────────── */
.ledger { width: 100%; border-collapse: collapse; font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-variant-numeric: tabular-nums; }
.ledger th, .ledger td { padding: var(--space-xs) var(--space-xxs); text-align: left; border-bottom: 1px solid var(--rule); }
.ledger th.num, .ledger td.num { text-align: right; }
.ledger thead th { font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); font-weight: var(--weight-medium); color: var(--ink-soft); border-bottom: 1px solid color-mix(in oklch, var(--ink) 30%, transparent); }
.ledger .group th { padding-top: var(--space-m); font-size: var(--size-m); line-height: var(--line-m); letter-spacing: var(--letter-spacing-m); font-weight: var(--weight-heavy); border-bottom: 0; }
.ledger .sum td { font-weight: var(--weight-heavy); border-top: 1px solid color-mix(in oklch, var(--ink) 30%, transparent); }
.ledger .total td { font-weight: var(--weight-heavy); font-size: var(--size-m); line-height: var(--line-m); border-top: var(--border-l) solid var(--ink); border-bottom: var(--border-l) solid var(--ink); padding-block: var(--space-s); }
.report { overflow-x: auto; }

/* ── Import: forslaget eieren ser over før noe føres ─────────────────────── */
/* Filvelgeren ser ut som en tast (.key); filnavnet står ved siden av. */
.import-upload input[type="file"] { font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); color: var(--ink-soft); max-inline-size: 100%; }
.import-upload input[type="file"]::file-selector-button {
  margin-inline-end: var(--space-s); padding: var(--space-xs) var(--space-m); cursor: pointer;
  font: inherit; font-weight: var(--weight-medium); color: var(--ink);
  background-color: var(--paper); background-image: var(--button-image);
  border: 0; border-radius: var(--radius-m); box-shadow: var(--border-shadow-s), var(--shadow-s);
}
.import-upload input[type="file"]:active::file-selector-button { translate: 0 var(--motion-press-distance); }
.import-form { display: grid; gap: var(--space-m); }
.import-form > .sheet { margin: 0; }
.import-warnings { list-style: none; margin: 0 0 var(--space-m); padding: 0; display: grid; gap: var(--space-xs); }
.import-warnings li {
  display: flex; align-items: baseline; gap: var(--space-xs); padding: var(--space-xs) var(--space-s);
  background: var(--paper); border-radius: var(--radius-m); box-shadow: var(--lift-sm);
  font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s);
}
.import-warnings .dymo { flex: none; }
.import-groups { list-style: none; margin: 0; padding: 0; }
.import-group {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-xxs) var(--space-s); align-items: baseline;
  padding-block: var(--space-s); border-block-end: 1px solid var(--rule);
}
.import-group:first-child { padding-block-start: 0; }
.import-group:last-child { padding-block-end: 0; border-block-end: 0; }
.import-take b { font-weight: var(--weight-heavy); overflow-wrap: anywhere; }
.import-sum { font-variant-numeric: tabular-nums; font-weight: var(--weight-heavy); white-space: nowrap; }
/* Det under navnet står i linje med teksten, ikke med avkrysningsboksen (20 px, som i .check). */
.import-group > :not(.import-take, .import-sum) { grid-column: 1 / -1; margin-inline-start: calc(20px + var(--space-xs)); }
.import-group > select { justify-self: start; inline-size: min(18rem, 100% - 20px - var(--space-xs)); }
.import-count { font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); color: var(--ink-soft); }
.import-reason { margin: 0; }
/* Det som ikke blir med, strykes ut med en gang, uten skript. */
.import-group:has(> .import-take input:not(:checked)) .import-sum { color: var(--ink-faint); text-decoration: line-through; }
.import-rows summary { inline-size: fit-content; cursor: pointer; color: var(--blue); font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); }
.import-rows[open] summary { margin-block-end: var(--space-xs); }
.import-rows { overflow-x: auto; }
.import-rows td { overflow-wrap: anywhere; }
.import-rows td.num { white-space: nowrap; overflow-wrap: normal; }
.import-row-meta { display: block; color: var(--ink-soft); font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); font-variant-numeric: tabular-nums; }
.import-rows input { inline-size: 20px; block-size: 20px; margin: 0; accent-color: var(--red); vertical-align: middle; }
.import-rows tr:has(input:checked) td:not(:last-child) { color: var(--ink-faint); text-decoration: line-through; }
.import-fill { font-size: var(--size-s) !important; line-height: var(--line-s) !important; font-weight: var(--weight-medium) !important; overflow-wrap: anywhere; }
.import-go { margin-block-start: var(--space-xs); }
.import-discard { margin-block-start: var(--space-s); }
.import-next { margin-block-start: var(--space-m); }
.import-history { list-style: none; margin: 0; padding: 0; }
.import-history a {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-s);
  padding-block: var(--space-xs); text-decoration: none; border-block-end: 1px solid var(--rule);
}
.import-history li:last-child a { border-block-end: 0; }
.import-history a > span { display: grid; min-inline-size: 0; }
.import-history .hint { white-space: nowrap; overflow: clip; text-overflow: ellipsis; }
.import-history .dymo { flex: none; }
.import-history a:active b { color: var(--blue); }

/* ── Agnes: hennes lapper er gule, dine er hvite ─────────────────────────── */
.chat { display: grid; gap: var(--space-s); }
.chat-log { display: grid; gap: var(--space-m); align-content: start; max-height: calc(100dvh - 420px); min-height: 220px; overflow-y: auto; padding: var(--space-xxs) var(--space-xxs) var(--space-s); scrollbar-width: thin; scrollbar-color: color-mix(in oklch, var(--ink) 20%, transparent) transparent; }
.note { max-width: min(85%, 620px); padding: var(--space-s) var(--space-m); border-radius: var(--radius-l); }
.note p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-agnes { justify-self: start; background: var(--note); border-start-start-radius: var(--radius-xs); box-shadow: 0 0 0 1px color-mix(in oklch, var(--note-ink) 15%, transparent), var(--shadow-s); }
.note-head { display: flex; align-items: center; gap: var(--space-xs); font-size: var(--size-xs) !important; line-height: var(--line-xs) !important; letter-spacing: var(--letter-spacing-xs); font-weight: var(--weight-heavy); color: var(--note-ink); margin-bottom: var(--space-xxs) !important; }
.note-user { justify-self: end; background: var(--paper); border-start-end-radius: var(--radius-xs); box-shadow: var(--lift-sm); }
.caret { display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; vertical-align: -0.18em; background: var(--note-ink); animation: blink 0.8s steps(1) infinite; }
.chat-suggest { display: flex; gap: var(--space-xs); overflow-x: auto; padding: var(--space-xxs) 2px var(--space-xs); scrollbar-width: none; }
.chat-suggest .dymo { flex: none; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: var(--space-s); align-items: end; }
.chat-form textarea { min-height: calc(var(--line-s) + 2 * var(--space-xs)); max-height: 160px; field-sizing: content; }

/* ── Innlogging ─────────────────────────────────────────────────────────── */
body.door { display: grid; place-items: center; padding: var(--space-l); }
.login { width: min(100%, 360px); display: grid; gap: var(--space-l); }
.login-plate { text-align: center; display: grid; justify-items: center; gap: var(--space-xxs); }
.login-plate .nameplate-mark { inline-size: 56px; block-size: 56px; margin-bottom: var(--space-xs); }
.login-plate h1 { font-size: var(--size-xl); line-height: var(--line-xl); letter-spacing: var(--letter-spacing-xl); }
.login-plate p { margin: 0; color: var(--ink-soft); }
.login-form { display: grid; gap: var(--space-s); background: var(--paper); padding: var(--space-l); border-radius: var(--radius-l); box-shadow: var(--lift); }
.login-google { display: flex; text-decoration: none; }
.login-form form .key { width: 100%; }
.login-note { margin: 0; text-align: center; font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); color: var(--ink-soft); }

a.login-plate { text-decoration: none; color: inherit; border-radius: var(--radius-m); }
.login-note a { color: var(--blue); text-underline-offset: 3px; }
.login-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-xs) var(--space-m); font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); }
.login-links a { color: var(--ink-soft); text-underline-offset: 3px; }

/* ── Utenfor døra: forsida, vilkårene og personvernet ───────────────────────
   Ingen tasterad nederst, så bunnteksten ligger nederst i vinduet. */
body.outside { display: flex; flex-direction: column; padding-bottom: 0; }
body.outside .page { flex: 1; inline-size: 100%; }
.outside-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--space-xs) var(--space-l);
  inline-size: 100%; max-width: 1120px; margin: 0 auto;
  padding: var(--space-l) max(var(--space-m), env(safe-area-inset-right)) calc(var(--space-l) + env(safe-area-inset-bottom)) max(var(--space-m), env(safe-area-inset-left));
  font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); color: var(--ink-soft);
}
.outside-foot p { margin: 0; }
.outside-foot nav { display: flex; gap: var(--space-m); }
.outside-foot a { color: var(--ink); text-underline-offset: 3px; }

.front-hero { display: grid; gap: var(--space-xl); align-items: center; padding-block: var(--space-xs) var(--space-xxl); }
.front-pitch { display: grid; gap: var(--space-m); max-inline-size: 36rem; }
.front-pitch > * { margin: 0; }
.front-pitch h1 { font-size: var(--size-xl); line-height: var(--line-xl); letter-spacing: var(--letter-spacing-xl); text-wrap: balance; }
.front-pitch .lead { color: var(--ink-soft); }
.front-hero .key-red, .front-terms .key-red { min-height: calc(var(--line-s) + 2 * var(--space-s)); padding-inline: var(--space-l); }

/* Tingene på skrivebordet, slik de ser ut inne i Blekkhus. */
.still { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--space-s); align-items: start; }
.still .counter { min-width: 0; }
.still-receipt { height: auto; }
.still-memo { grid-column: 1 / -1; margin: 0; }
.still-invoice {
  grid-row: span 2; position: relative; overflow: clip; display: grid; gap: var(--space-xxs);
  padding: var(--space-m) var(--space-m) 0; background: var(--paper); border-radius: var(--radius-xs); box-shadow: var(--sheet-shadow);
  font-size: var(--size-xs); line-height: var(--line-xs); letter-spacing: var(--letter-spacing-xs); font-variant-numeric: tabular-nums;
}
.still-invoice p { display: flex; justify-content: space-between; gap: var(--space-xs); margin: 0; }
.still-invoice p > * { white-space: nowrap; }
.still-invoice p > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.still-head { padding-bottom: var(--space-xs); margin-bottom: var(--space-xxs) !important; box-shadow: inset 0 calc(-1 * var(--border-l)) 0 var(--ink); }
.still-head b { font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-heavy); }
.still-head span, .still-to { color: var(--ink-soft); }
.still-to { margin-bottom: var(--space-xs) !important; }
.still-line { padding-block: var(--space-xxs); box-shadow: inset 0 -1px 0 var(--rule); }
.still-total { margin-top: var(--space-xs) !important; padding: var(--space-xs); background: var(--desk); border-radius: var(--radius-s); font-weight: var(--weight-medium); }
.still-total b { font-weight: var(--weight-heavy); }
.still-invoice > .stamp { position: absolute; inset-block-start: var(--space-xxl); inset-inline-end: var(--space-s); font-size: var(--size-s); }
.still-giro { display: block; block-size: var(--space-xxl); margin: var(--space-m) calc(-1 * var(--space-m)) 0; background: var(--giro-yellow); box-shadow: inset 0 var(--space-xs) 0 var(--paper); border-top: var(--border-s) dashed var(--neutral-5); }

.front-features { list-style: none; margin: 0 0 var(--space-xxl); padding: 0; display: grid; gap: var(--space-l) var(--space-xl); }
.front-features li { display: grid; gap: var(--space-xs); align-content: start; }
.front-features .ico { color: var(--blue); }
.front-features h2 { font-size: var(--size-m); line-height: var(--line-m); letter-spacing: var(--letter-spacing-m); }
.front-features p { margin: 0; color: var(--ink-soft); }

.front-terms { display: grid; gap: var(--space-m); }
.front-terms .sheet { display: grid; gap: var(--space-s); align-content: start; margin: 0; }
.front-terms .sheet > * { margin: 0; }
.front-terms h2 { font-size: var(--size-l); line-height: var(--line-l); letter-spacing: var(--letter-spacing-l); text-wrap: balance; }
.front-terms .fine a { color: var(--blue); text-underline-offset: 3px; }
.front-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-xs); }
.front-list li { position: relative; padding-inline-start: var(--space-l); }
.front-list li::before {
  content: ""; position: absolute; inset-inline-start: var(--space-xxs); inset-block-start: calc((var(--line-m) - var(--space-xs)) / 2);
  inline-size: var(--space-xs); block-size: var(--space-xs); border-radius: 50%; background: var(--blue);
}

/* Vilkårene og personvernet: et dokument, så det er et ark. */
.doc { max-inline-size: 44rem; margin-inline: auto; border-radius: var(--radius-xs); box-shadow: var(--sheet-shadow); }
.doc h1 { font-size: var(--size-l); line-height: var(--line-l); letter-spacing: var(--letter-spacing-l); margin-bottom: var(--space-xs); }
.doc .lead { color: var(--ink-soft); margin-bottom: var(--space-xxs); }
.doc > .fine { margin: 0 0 var(--space-l); padding-bottom: var(--space-m); box-shadow: inset 0 -1px 0 var(--rule); }
.doc h2 { font-size: var(--size-m); line-height: var(--line-m); letter-spacing: var(--letter-spacing-m); margin: var(--space-l) 0 var(--space-xs); }
.doc ul { margin: 0 0 var(--space-s); padding-inline-start: var(--space-l); display: grid; gap: var(--space-s); }
.doc a { color: var(--blue); text-underline-offset: 3px; }

/* ── Abonnementsbeviset ─────────────────────────────────────────────────── */
.licence > .stamp { position: absolute; inset-block-start: var(--space-l); inset-inline-end: var(--space-m); font-size: clamp(0.95rem, 4vw, 1.45rem); }
.licence h2 { font-size: var(--size-l); line-height: var(--line-l); letter-spacing: var(--letter-spacing-l); margin: 0 0 var(--space-m); padding-inline-end: 9rem; overflow-wrap: anywhere; }
.licence-facts {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-xs) var(--space-m); margin: 0 0 var(--space-m); padding-block-start: var(--space-m);
  box-shadow: inset 0 1px 0 var(--rule); font-variant-numeric: tabular-nums;
}
.licence-facts dt { font-size: var(--size-s); line-height: var(--line-m); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-medium); color: var(--ink-soft); }
.licence-facts dd { margin: 0; }
.licence .error { margin: 0 0 var(--space-m); }
.sheet .buttons form { display: contents; }

/* ── Koder og invitasjoner ──────────────────────────────────────────────── */
.code-offer h2 { font-size: var(--size-xl); line-height: var(--line-xl); letter-spacing: var(--letter-spacing-xl); margin: var(--space-xxs) 0 var(--space-s); font-variant-numeric: tabular-nums; }
.code-offer p:not(.kicker) { max-inline-size: 60ch; }
.code-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--space-s); }
.code-form input, .code-offer input { text-transform: uppercase; }
/* Lenken som deles: feltet tar plassen, tasten står ved siden av. */
.share-link { display: flex; gap: var(--space-s); align-items: center; margin-block: var(--space-s) var(--space-xs); }
.share-link input { flex: 1; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.share-link .key { flex: none; }
.code-list { list-style: none; margin: 0; padding: 0; }
.code-row { display: flex; gap: var(--space-m); align-items: flex-start; justify-content: space-between; padding-block: var(--space-s); box-shadow: inset 0 -1px 0 var(--rule); }
.code-row:first-child { padding-block-start: 0; }
.code-row:last-child { box-shadow: none; padding-block-end: 0; }
.code-main { flex: 1; min-inline-size: 0; }
.code-main .share-link { margin-block-end: 0; }
.code-name { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; margin: 0; }
.code-name .fine { margin: 0; overflow-wrap: anywhere; }
.code-main > .fine { margin-block-start: var(--space-xxs); }
.plain { list-style: none; margin: 0; padding: 0; }
.login-code { margin: 0; text-align: center; font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); }

/* ── Bevegelse: bare når den som ser på, ikke har bedt om ro ───────────────
   Kontroller bruker temaets lille kurve; flater og innganger den store. */
@media (prefers-reduced-motion: no-preference) {
  .lamp, .key, .drawer, button.dymo, .chip, .tab, .switch span { transition: translate var(--motion-duration) var(--motion-easing), box-shadow var(--motion-duration) var(--motion-easing), background-color var(--motion-duration) var(--motion-easing), color var(--motion-duration) var(--motion-easing); }
  input, select, textarea { transition: box-shadow var(--motion-duration) var(--motion-easing); }
  .memo, .pile-sheet, .index-card, .receipt { transition: translate var(--motion-duration) var(--motion-easing), box-shadow var(--motion-duration) var(--motion-easing); }
  .typed { animation: rise 0.5s var(--motion-large-easing) both; }
  .odo-wheel { animation: roll calc(0.7s + var(--i) * 0.12s) var(--motion-large-easing) both; }
  .chart .bar { transform-box: fill-box; transform-origin: bottom; animation: grow 0.7s var(--motion-large-easing) both; }
  .chart .line { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 1.2s var(--motion-large-easing) 0.15s forwards; }
  .chart .line.dashed { stroke-dasharray: 2 6; stroke-dashoffset: 0; opacity: 0; animation: fade 0.5s 1s forwards; }
  .gauge-needle { animation: needle 1.6s var(--ease-spring) 0.2s both; }
  .gauge-fill { stroke-dasharray: 300; stroke-dashoffset: 300; animation: draw 1.4s var(--motion-large-easing) 0.2s forwards; }
  .bars-track i { transform-origin: left; animation: growx 0.8s var(--motion-large-easing) both; }
  .stamp.fresh { animation: stamp 0.42s cubic-bezier(0.5, 0, 0.8, 0.4) 0.35s both; }
  .paper:has(.stamp.fresh) { animation: thump 0.3s ease-out 0.72s; }
  .show-paper { animation: deal 0.5s var(--motion-large-easing) both; }
  .typing tbody tr { animation: line-in var(--motion-large-duration) var(--motion-large-easing); }
  .receipts li { animation: deal 0.4s var(--motion-large-easing) both; animation-delay: calc(var(--n) * 35ms); }
  .scan-frame { animation: breathe 2.4s ease-in-out infinite; }
  .printout:not(.printout-empty) { animation: print 1.1s steps(14) both; }
  .scanner-reading .printout::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--red); box-shadow: 0 0 12px 3px color-mix(in oklch, var(--red) 60%, transparent); animation: sweep 1.6s ease-in-out infinite alternate; }
  .note { animation: deal var(--motion-large-duration) var(--motion-large-easing) both; }
  .front-pitch { animation: rise 0.5s var(--motion-large-easing) both; }
  .still > * { animation: deal 0.5s var(--motion-large-easing) both; }
  .still > :nth-child(2) { animation-delay: 90ms; }
  .still > :nth-child(3) { animation-delay: 180ms; }
  .still > :nth-child(4) { animation-delay: 270ms; }
  /* Stempelet slås ned uten lyd og dirring (data-stamp), for her er ingenting gjort. */
  .still-invoice > .stamp { animation: stamp 0.42s cubic-bezier(0.5, 0, 0.8, 0.4) 0.6s both; }
}
@keyframes rise { from { opacity: 0; translate: 0 6px; } }
@keyframes roll { from { transform: translateY(0); } }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@keyframes needle { from { transform: rotate(-90deg); } }
@keyframes growx { from { transform: scaleX(0); } }

/* ── Mus: svar på pekeren bare der det finnes en ─────────────────────────── */
@media (hover: hover) and (pointer: fine) {
  .import-history a:hover b { color: var(--blue); }
  .key:not(.key-red, [disabled]):hover, .lamp:hover, button.dymo:hover, .drawer:hover { background-color: var(--neutral-2); box-shadow: 0 0 0 1px var(--neutral-7-transparent), var(--shadow-s); }
  .key-red:hover { box-shadow: inset 0 0 0 1px var(--neutral-7-transparent), var(--shadow-s); background-color: color-mix(in oklch, var(--red) 94%, var(--ink)); }
  :root[data-sound="on"] .lamp[data-sound-toggle]:hover { background-color: var(--ink); }
  input:not([type="checkbox"], [type="radio"], [type="file"]):hover:not(:focus-visible), textarea:hover:not(:focus-visible) { box-shadow: 0 0 0 1px var(--neutral-5), var(--surface-recessed-shadow); }
  select:hover:not(:focus-visible) { box-shadow: 0 0 0 1px var(--neutral-5), var(--surface-raised-shadow); }
  .back:hover, .chip:not([aria-current]):hover, .switch input:not(:checked) + span:hover { color: var(--ink); }
  a.memo:hover { translate: 0 -2px; }
  .chart .month:hover .hit, .ahead-col:hover { fill: color-mix(in oklch, var(--blue) 8%, transparent); background: color-mix(in oklch, var(--blue) 8%, transparent); }
  .strip:hover { background: var(--desk); }
  .pile-sheet:hover, a.index-card:hover { translate: 0 -1px; box-shadow: var(--lift); }
  .receipt:hover { translate: 0 -3px; }
  .line-remove:hover:not([disabled]) { color: var(--red); background: color-mix(in oklch, var(--red) 9%, transparent); }
}

/* ── Fingre: taster og felt får 44 px å treffe, og felt får 16 px tekst så iOS ikke zoomer inn ── */
@media (pointer: coarse) {
  .key { min-height: 44px; }
  .import-upload input[type="file"]::file-selector-button { min-height: 44px; }
  input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea { min-height: 44px; font-size: var(--size-m); line-height: var(--line-m); letter-spacing: var(--letter-spacing-m); }
}

/* ── Telefon: diagrammene krympes til under halv størrelse, så aksene skrives større ── */
@media (max-width: 619px) {
  .chart .axis { font-size: 21px; }
  .chart .axis.strong { font-size: 20px; }
  .chart .grid { stroke-width: 1; }
  .chart .baseline { stroke-width: 2; }
  .line { stroke-width: 3.5; }
  .chart .dot { r: 6px; }
}

/* ── Større skjermer ───────────────────────────────────────────────────── */
@media (min-width: 620px) {
  .counters { grid-template-columns: repeat(4, 1fr); }
  .grid-form { grid-template-columns: 1fr 1fr; }
  .grid-form .wide { grid-column: 1 / -1; }
  .row-3 { grid-template-columns: 1fr 1fr 1fr; }
  .row-3 > :last-child { grid-column: auto; }
  .drawers { grid-template-columns: repeat(6, 1fr); }
  .figures { grid-template-columns: repeat(4, 1fr); }
  .sheet { padding: var(--space-l); }
  .page-head h1, .typed, .doc h1 { font-size: var(--size-xl); line-height: var(--line-xl); letter-spacing: var(--letter-spacing-xl); }
  .front-pitch h1 { font-size: var(--size-xxl); line-height: var(--line-xxl); letter-spacing: var(--letter-spacing-xxl); }
  .front-features { grid-template-columns: 1fr 1fr; }
  .doc { padding: var(--space-xl); }
}
@media (min-width: 900px) {
  body { padding-bottom: var(--space-xxl); }
  .keys { display: none; }
  /* Fanene (Graphical: faner): siden du er på, stikker opp av sporet. */
  .tabs {
    display: flex; gap: var(--space-xxs); margin-inline-start: var(--space-m); padding: var(--space-xxs); overflow-x: auto; scrollbar-width: none;
    background: var(--neutral-3); border-radius: var(--radius-m);
  }
  .tab {
    padding: var(--space-xxs) var(--space-s); text-decoration: none; white-space: nowrap; border-radius: var(--radius-s);
    font-size: var(--size-s); line-height: var(--line-s); letter-spacing: var(--letter-spacing-s); font-weight: var(--weight-medium); color: var(--ink-soft);
  }
  .tab[aria-current] { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-s); }
  .desk-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-m); }
  .desk-grid .span-2 { grid-column: span 2; }
  .desk-grid .span-3 { grid-column: span 3; }
  .desk-grid .tall { grid-row: span 2; }
  .editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .preview { position: sticky; top: 80px; }
  .show { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .show-side { position: sticky; top: 80px; }
  .entry-form { grid-template-columns: 340px minmax(0, 1fr); align-items: start; }
  .chat-log { max-height: calc(100dvh - 300px); }
  .memo { max-width: 600px; }
  .front-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-xxl); padding-block: var(--space-xl) var(--space-xxl); }
  .front-terms { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) and (hover: hover) and (pointer: fine) { .tab:not([aria-current]):hover { color: var(--ink); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
