/* Utlagt. One accent (Utlagt green) on a calm neutral ground; depth instead of lines.
   Grid (desktop, >= 900px): rail 100 + canvas padding 32 + content (max 1152) + 32.
   Claim view: main column 1fr + aside 340, gap 24.
   Receipt rows: thumb 64 | lev 2fr | sted 1.2fr | dato 150 | beløp 130 | delete 40, gaps 12 (5 x 12 = 60),
   the column header uses the same template so every field lands under its heading. */

:root {
  color-scheme: light dark;
  --ground: #F2F2F7;
  --surface: #FFFFFF;
  --raised: #ECECF0;
  --active: #E3E3E8;
  --rule: #E5E5EA;
  --text: #000000;
  --muted: #6E6E73;
  --placeholder: #737378;
  --accent: #0B7A55;          /* fills: primary button, logo */
  --accent-text: #0A6B4B;     /* accent as text on light surfaces */
  --on-accent: #FFFFFF;
  --accent-soft: rgba(11, 122, 85, .12);
  --negative: #D70015;
  --warning-fg: #92400E;
  --warning-bg: #FFFBEB;
  --positive-fg: #04250E;
  --positive-bg: #DCFAE5;
  --card-shadow: 0 1px 2px rgba(0,0,0,.06), 0 1px 1px rgba(0,0,0,.04);
  --float-shadow: 0 8px 30px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.08);
  --r-card: 16px;
  --r-inner: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #000000;
    --surface: #1C1C1E;
    --raised: #2C2C2E;
    --active: #2C2C2E;
    --rule: #38383A;
    --text: #FFFFFF;
    --muted: #98989D;
    --placeholder: #8E8E93;
    --accent-text: #4CD69B;
    --accent-soft: rgba(76, 214, 155, .16);
    --negative: #FF6961;
    --warning-fg: #F5C26B;
    --warning-bg: #2A2210;
    --positive-fg: #7FE0A0;
    --positive-bg: #0F2A18;
    --card-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
    --float-shadow: 0 8px 30px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 15px/22px var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.num { font-variant-numeric: tabular-nums; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }

/* ---------- shell ---------- */
.mark { width: 36px; height: 36px; border-radius: 9px; display: block; flex: none; }
.mark.big { width: 56px; height: 56px; border-radius: 13px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-name { font-weight: 700; letter-spacing: -0.02em; }

.rail {
  position: fixed; inset: 0 auto 0 0; width: 100px; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 0;
}
.rail .brand { flex-direction: column; gap: 6px; margin-bottom: 20px; }
.rail .brand-name { font-size: 13px; line-height: 16px; }
.nav-item {
  width: 84px; padding: 10px 0 8px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; line-height: 13px; font-weight: 500; color: var(--muted); text-align: center;
  transition: background .2s, color .2s;
}
.nav-item:hover { color: var(--text); }
.nav-item[aria-current="page"] { background: var(--active); color: var(--text); }

.topbar { display: none; }
.tabbar { display: none; }
.canvas { margin-left: 100px; padding: 32px 32px 64px; }
.view { max-width: 1152px; margin: 0 auto; }
.app[data-start] .rail, .app[data-start] .tabbar, .app[data-start] .topbar .scope { display: none; }
.app[data-start] .canvas { margin-left: 0; }

/* ---------- title row ---------- */
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 24px; }
h1 { font-size: 32px; line-height: 38px; font-weight: 700; letter-spacing: -0.025em; }
.subline { margin-top: 4px; font-size: 15px; line-height: 20px; color: var(--muted); }
.title-actions { display: flex; gap: 8px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border: 0; border-radius: 9999px;
  font-family: inherit; font-size: 15px; line-height: 20px; font-weight: 600; cursor: pointer;
  transition: transform .2s, opacity .2s, background .2s;
}
.btn:active { transform: scale(.97); opacity: .88; }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn.filled { background: var(--accent); color: var(--on-accent); }
.btn.tinted { background: var(--accent-soft); color: var(--accent-text); }
.btn.plain { background: transparent; color: var(--accent-text); }
.btn.danger { color: var(--negative); }
.btn.big { width: 100%; min-height: 50px; font-size: 17px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; border-radius: 9999px;
  background: var(--raised); color: var(--text); cursor: pointer;
}
.icon-btn.small { width: 40px; height: 40px; background: transparent; color: var(--muted); }
.icon-btn.small:hover { color: var(--negative); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.label { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--muted); }
input, textarea, select {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 0; border-radius: var(--r-inner); background: var(--raised); color: var(--text);
  font-family: inherit; font-size: 16px; line-height: 22px; appearance: none; -webkit-appearance: none;
}
select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238E8E93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input[type="date"] { min-width: 0; }
.hint, .footnote { font-size: 13px; line-height: 18px; color: var(--muted); }
.error { display: flex; gap: 6px; align-items: center; font-size: 13px; line-height: 18px; color: var(--negative); }
.error .icon { width: 16px; height: 16px; }
.card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--card-shadow); }

/* ---------- new claim ---------- */
.claim { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.claim-side { padding: 20px; position: sticky; top: 24px; }
.label-sm { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--muted); }
.answer { margin-top: 2px; font-size: 34px; line-height: 40px; font-weight: 700; letter-spacing: -0.02em; }
.answer .unit { font-size: 17px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.claim-side .subline { margin: 2px 0 20px; }
.claim-side .btn.big { margin-top: 4px; }
.claim-side .btn.plain { width: 100%; margin-top: 4px; }
#notice:not(:empty) { margin-top: 12px; }

.drop { padding: 28px 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; transition: box-shadow .2s; }
.drop.over { box-shadow: inset 0 0 0 2px var(--accent); }
.drop-text { font-size: 15px; line-height: 21px; color: var(--muted); max-width: 420px; }
.drop-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.drop.compact { padding: 16px 20px; flex-direction: row; justify-content: space-between; text-align: left; margin-top: 12px; }

.lines { list-style: none; margin: 0; padding: 0; }
.lines-head, .line { display: grid; column-gap: 12px; }
.lines-head {
  grid-template-columns: 64px minmax(0, 2fr) minmax(0, 1fr) 136px 100px 118px 40px;
  padding: 0 12px 8px; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--muted);
}
.lines-head .num { text-align: right; padding-right: 12px; }
.line {
  grid-template-columns: 64px minmax(0, 1fr) 40px; align-items: start;
  background: var(--surface); border-radius: var(--r-card); box-shadow: var(--card-shadow);
  padding: 12px; margin-bottom: 12px;
}
.line-thumb { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.thumb {
  width: 64px; height: 80px; border-radius: var(--r-inner); overflow: hidden; padding: 0; cursor: pointer;
  border: 1px solid var(--rule); background: var(--raised); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.thumb .icon { width: 26px; height: 26px; }
.cap { font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; }
.line-top { display: none; }
.fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 136px 100px 118px; column-gap: 12px; }
.fields input:disabled { background: transparent; }
.fields .field { margin: 0; }
.fields .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fields input.num { text-align: right; }
.line .notes { grid-column: 2 / -1; display: grid; gap: 8px; }
.line .notes:not(:empty) { margin-top: 10px; }
.status { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; color: var(--muted); }
.note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 18px; padding: 10px 12px; border-radius: var(--r-inner); }
.note .icon { width: 18px; height: 18px; }
.note.warn { background: var(--warning-bg); color: var(--warning-fg); }
.note.info { background: var(--raised); color: var(--muted); }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--rule); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 20px; }
.banner.ok { background: var(--positive-bg); color: var(--positive-fg); }
.banner.bad { background: var(--warning-bg); color: var(--warning-fg); }
.banner .grow { flex: 1; }
.banner .btn { min-height: 36px; padding: 0 14px; font-size: 14px; margin-top: 8px; }

/* ---------- sent ---------- */
.strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 32px; }
.strip > div { padding: 18px 20px; }
.strip > div + div { border-left: 1px solid var(--rule); }
.strip > div:first-child .v { color: var(--accent-text); }
.strip .v { margin-top: 4px; font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.01em; }
.strip .v .unit { font-size: 15px; font-weight: 500; color: var(--muted); }
.strip .s { font-size: 13px; line-height: 18px; color: var(--muted); }
.month { margin-bottom: 28px; }
.month-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px 8px; }
.month-head h2 { font-size: 17px; line-height: 22px; font-weight: 600; }
.month-head span { font-size: 15px; color: var(--muted); }
.claims { overflow: hidden; }
.claims details + details { border-top: 1px solid var(--rule); }
.claims summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: 84px minmax(0, 1fr) auto 20px;
  align-items: center; column-gap: 16px; padding: 14px 16px; min-height: 64px;
}
.claims summary::-webkit-details-marker { display: none; }
.claims summary:hover { background: var(--ground); }
.claims .when { font-size: 15px; color: var(--muted); }
.claims .who, .claims .what { display: block; }
.claims .who { font-size: 16px; line-height: 21px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.claims .what { font-size: 13px; line-height: 18px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.claims .sum { font-size: 16px; font-weight: 600; text-align: right; }
.claims summary > .icon { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
.claims details[open] summary > .icon { transform: rotate(90deg); }
.claim-lines { margin: 0; padding: 0 52px 14px calc(84px + 32px); list-style: none; }
.claim-lines li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; font-size: 14px; }
.claim-lines li span:first-child { color: var(--muted); }
.claim-lines li span:last-child { flex: none; }
.empty-state { padding: 28px 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }

/* ---------- settings ---------- */
.setting { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 32px; padding: 28px 0; border-top: 1px solid var(--rule); }
.title-row + .setting { border-top: 0; padding-top: 4px; }
.setting-label h2 { font-size: 17px; line-height: 22px; font-weight: 600; margin-top: 6px; }
.setting-label p { margin-top: 4px; font-size: 14px; line-height: 20px; color: var(--muted); }
.panel { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--card-shadow); padding: 20px; }
.panel .field:last-of-type { margin-bottom: 0; }
.panel-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 20px; }
.saved { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.sig-preview { height: 88px; border-radius: var(--r-inner); background: #FFFFFF; box-shadow: inset 0 0 0 1px var(--rule); display: flex; align-items: center; padding: 8px 16px; }
.sig-preview img { max-height: 64px; max-width: 100%; }
.co { padding: 12px 0; }
.co + .co { border-top: 1px solid var(--rule); }
.co:first-child { padding-top: 0; }
.co:last-child { padding-bottom: 0; }
.co strong { font-size: 16px; font-weight: 600; }
.co p { font-size: 14px; line-height: 20px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.danger-panel { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 12px; }

/* ---------- first run ---------- */
.start-wrap { display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 56px; max-width: 1040px; margin: 6vh auto 0; align-items: start; }
.start { padding: 32px 28px 28px; }
.how { padding-top: 32px; }
.how h2 { font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.01em; }
.how h3 { margin: 24px 0 4px; font-size: 17px; line-height: 22px; font-weight: 600; }
.how p { font-size: 15px; line-height: 22px; color: var(--muted); max-width: 440px; }
.start h1 { margin-top: 20px; font-size: 28px; line-height: 34px; }
.start .subline { margin: 6px 0 24px; }

/* ---------- dialogs ---------- */
dialog {
  width: min(480px, 100%); max-height: 92vh; margin: auto; padding: 20px; border: 0;
  border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--float-shadow);
}
dialog::backdrop { background: rgba(0,0,0,.35); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sheet-head h2 { font-size: 22px; line-height: 28px; font-weight: 700; }
dialog.full { width: min(640px, 100%); }
.stage { display: flex; justify-content: center; margin: 12px 0 16px; }
.stage canvas { touch-action: none; border-radius: 10px; max-width: 100%; }
.row-actions { display: flex; justify-content: space-between; gap: 12px; }
.row-actions .btn { flex: 1; }
.scan-busy { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 160px; color: var(--muted); font-size: 15px; }
.pages { list-style: none; margin: 16px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.pages li { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.pages img { width: 96px; height: 128px; object-fit: cover; object-position: top; border-radius: 10px; border: 1px solid var(--rule); background: #fff; }
dialog .btn.big + .btn.big { margin-top: 8px; }

.sign-total { margin: 12px 0 2px; font-size: 17px; }
.sign-total strong { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.02em; }
.pad-wrap { position: relative; margin: 16px 0 8px; height: 180px; border-radius: 14px; background: #FFFFFF; box-shadow: inset 0 0 0 1px var(--rule); overflow: hidden; }
.pad-wrap::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 44px; height: 1px; background: #D1D1D6; pointer-events: none; }
#pad { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#saved-sig { position: absolute; left: 20px; top: 16px; width: calc(100% - 40px); height: calc(100% - 64px); object-fit: contain; object-position: left bottom; }
.pad-hint { position: absolute; left: 22px; bottom: 16px; font-size: 13px; color: #6E6E73; pointer-events: none; }
.pad-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.pad-row .check { flex: 1; }
.pad-row .btn { flex: none; min-height: 44px; padding: 0 8px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; line-height: 20px; min-height: 44px; cursor: pointer; }
.check input { appearance: auto; -webkit-appearance: checkbox; width: 22px; height: 22px; min-height: 0; padding: 0; margin: 0; flex: none; accent-color: var(--accent); }
.declare { margin: 4px 0 16px; }
#signer .error { margin: 0 0 4px; }

/* ---------- tablet and phone ---------- */
/* The receipt rows need room for five fields in a row; below that they stack. */
#view-ny { max-width: 1280px; }
@media (max-width: 1320px) {
  .lines-head { display: none !important; }
  .line { grid-template-columns: 64px minmax(0, 1fr); }
  .line-top { display: flex; align-items: center; justify-content: space-between; min-height: 40px; margin-bottom: 4px; }
  .line-top strong { font-size: 16px; font-weight: 600; }
  .line-del, .cap { display: none; }
  .fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .fields .wide { grid-column: 1 / -1; }
  .fields .f-belop { order: 4; }
  .fields .f-mva { order: 5; }
  .fields .label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .fields input.num { text-align: left; }
  .line .notes { grid-column: 2 / -1; }
}
@media (max-width: 1100px) {
  .claim { grid-template-columns: minmax(0, 1fr) 300px; }
  .setting { grid-template-columns: 260px minmax(0, 1fr); }
}
@media (max-width: 899px) {
  .rail { display: none; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 5; align-items: center; justify-content: space-between; gap: 12px;
    padding: max(8px, env(safe-area-inset-top)) 16px 8px; min-height: 52px; background: var(--ground);
  }
  .topbar .mark { width: 28px; height: 28px; border-radius: 7px; }
  .topbar .brand-name { font-size: 17px; }
  .scope { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
    background: var(--surface); box-shadow: 0 -1px 0 var(--rule); padding-bottom: env(safe-area-inset-bottom);
  }
  .tab { min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; line-height: 13px; font-weight: 500; color: var(--muted); }
  .tab[aria-current="page"] { color: var(--accent-text); }
  .tab .icon { width: 22px; height: 22px; }
  .canvas { margin-left: 0; padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); }
  .app[data-start] .canvas { padding-bottom: 32px; }
  h1 { font-size: 28px; line-height: 34px; }
  .title-row { margin-bottom: 16px; }
  .title-actions .btn { padding: 0 14px; }
  .claim { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .claim-side { position: static; }
  .setting { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 24px 0; }
  .setting-label h2 { margin-top: 0; }
  .strip { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .strip > div:first-child { grid-column: 1 / -1; }
  .strip > div:nth-child(2) { border-left: 0; border-top: 1px solid var(--rule); }
  .strip > div:nth-child(3) { border-top: 1px solid var(--rule); }
  .claims summary { grid-template-columns: minmax(0, 1fr) auto 16px; column-gap: 12px; }
  .claims .when { display: none; }
  .claim-lines { padding-left: 16px; padding-right: 44px; }
  .start-wrap { grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 2vh; }
  .start { padding: 24px 20px; }
  .how { padding: 16px 4px 0; }
}
@media (max-width: 560px) {
  .title-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .title-actions .btn { flex: 1; }
  .line { grid-template-columns: 44px minmax(0, 1fr); column-gap: 12px; padding: 12px 12px 14px; }
  .line-body { display: contents; }
  .line-thumb { grid-column: 1; grid-row: 1; }
  .line-top { grid-column: 2; grid-row: 1; align-self: center; margin: 0; }
  .line .status, .fields, .line .notes { grid-column: 1 / -1; }
  .line .status { margin-top: 4px; }
  .fields { margin-top: 10px; }
  .thumb { width: 44px; height: 56px; border-radius: 8px; }
  .thumb .icon { width: 20px; height: 20px; }
}
.minibar { display: none; }
@media (max-width: 899px) {
  .minibar {
    position: fixed; left: 12px; right: 12px; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 4;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 8px 8px 16px; border-radius: 9999px; background: var(--surface); box-shadow: var(--float-shadow);
    transition: transform .25s, opacity .25s;
  }
  .minibar[data-off] { transform: translateY(12px); opacity: 0; pointer-events: none; }
  .minibar .t { font-size: 13px; line-height: 16px; color: var(--muted); }
  .minibar .t strong { display: block; font-size: 17px; line-height: 22px; color: var(--text); font-weight: 700; }
  .minibar .btn { min-height: 40px; padding: 0 18px; }
  .canvas { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
}
@media (max-width: 560px) {
  dialog { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 20px 20px 0 0; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  dialog.full { margin: 0; height: 100%; max-height: 100%; border-radius: 0; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .spinner { animation: none; }
}

/* Sign in */
.start .pk-login { margin-bottom: 4px; }
.or { margin: 16px 0 12px; font-size: 13px; line-height: 18px; color: var(--muted); text-align: center; }
.code-input { font-size: 24px; line-height: 30px; letter-spacing: 0.3em; }
.link-row { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.link-row .btn { padding: 0 4px; }
#step-passkey .btn.big + .btn.big { margin-top: 8px; }
#step-passkey .error { margin-bottom: 12px; }
.who-line { font-size: 15px; line-height: 21px; }
.who-line span { color: var(--muted); }
.pk-list { list-style: none; margin: 16px 0 0; padding: 0; }
.pk-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.pk-list strong { display: block; font-size: 15px; font-weight: 600; }
.pk-list small { display: block; font-size: 13px; line-height: 18px; color: var(--muted); }
.pk-list .btn { min-height: 36px; padding: 0 10px; }
.login-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
@media (min-width: 900px) {
  .app[data-start] .canvas { min-height: 100vh; display: flex; align-items: center; padding-top: 48px; padding-bottom: 48px; }
  .app[data-start] .view { width: 100%; }
  .app[data-start] .start-wrap { margin-top: 0; }
}

/* ---------- sign-up, setup and subscription ---------- */
.switch-row { margin-top: 16px; font-size: 15px; text-align: center; color: var(--muted); }
.switch-row a, .footnote a { color: var(--accent-text); font-weight: 600; }
.org-row { display: flex; gap: 8px; align-items: flex-end; }
.org-row .field { flex: 1; }
.org-row .btn { margin-bottom: 16px; }
#signup-form .footnote { margin-top: 12px; text-align: center; }
.billing-card { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.billing-card .t { font-size: 15px; line-height: 21px; }
.billing-card .t strong { display: block; font-size: 17px; font-weight: 600; }
.billing-card .t { flex: 1 1 320px; }
.billing-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.billing-card.over { background: var(--warning-bg); color: var(--warning-fg); box-shadow: none; }
.plans { display: grid; gap: 8px; margin: 12px 0; }
.plan-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 14px; border: 0; background: var(--raised); color: var(--text); text-align: left; cursor: pointer; }
.plan-opt[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.plan-opt[disabled] { opacity: .45; cursor: not-allowed; }
.plan-opt strong { display: block; font-size: 16px; }
.plan-opt small { display: block; font-size: 13px; color: var(--muted); }
.plan-opt .num { font-size: 17px; font-weight: 600; white-space: nowrap; }
.pay-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.setup-block { margin-bottom: 24px; }
.setup-block h3 { font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.setup-block > p { font-size: 14px; color: var(--muted); margin: 0 0 12px; }
.person-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto auto 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.person-row .check { min-height: 40px; font-size: 14px; white-space: nowrap; }
@media (max-width: 899px) { .person-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* ---------- the company view ---------- */
.segmented { display: inline-flex; gap: 2px; padding: 2px; margin: 0 0 20px; border-radius: 9999px; background: var(--raised); }
.segmented button { min-height: 36px; padding: 0 16px; border: 0; border-radius: 9999px; font-size: 14px; font-weight: 500; color: var(--text); background: transparent; }
.segmented button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--card-shadow); font-weight: 600; }
.status-tag { display: inline-flex; align-items: center; gap: 4px; }
.status-tag.venter { color: var(--warning-fg); }
.status-tag.avvist { color: var(--negative); }
.claim-meta { list-style: none; margin: 4px 0 8px; padding: 0; font-size: 14px; line-height: 20px; }
.claim-meta li { padding: 2px 0; }
.claim-meta span { color: var(--muted); }
.reject-box { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 520px; margin-top: 4px; }
.reject-box textarea { min-height: 64px; }
#bedrift-pick select { min-height: 40px; }

/* ---------- storage: mine utlegg ---------- */
.save-state { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; font-size: 13px; line-height: 18px; color: var(--muted); }
.save-state .icon { width: 16px; height: 16px; flex: none; }
.save-state.ok .icon { color: var(--accent-text); }
.save-state.bad { color: var(--negative); }
.save-state a { color: var(--accent-text); font-weight: 600; }

#arkiv-top:not(:empty) { margin-bottom: 24px; }
.vault-card { padding: 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.vault-card h2 { font-size: 20px; line-height: 26px; font-weight: 700; }
.vault-card > p { font-size: 15px; line-height: 21px; max-width: 62ch; }
.rk-form { display: flex; align-items: flex-end; gap: 10px; width: 100%; max-width: 560px; }
.rk-form .field { flex: 1; margin: 0; }
.rk-form input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; text-transform: uppercase; }
.rk-form .btn { flex: none; }

.claim-body { padding: 0 52px 16px calc(84px + 32px); }
.claim-body .claim-lines { padding: 0 0 8px; }
.claim-body .label-sm { margin-top: 8px; }
.claim-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.claim-thumbs:not(:empty) { margin-bottom: 12px; }
.claim-thumbs .thumb { width: 56px; height: 72px; border-radius: 8px; overflow: hidden; background: var(--raised); display: grid; place-items: center; color: var(--muted); }
.claim-thumbs .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.claim-thumbs .thumb .spinner { width: 18px; height: 18px; }
.versions { list-style: none; margin: 2px 0 0; padding: 0; }
.versions li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; font-size: 14px; }
.versions li span:last-child { flex: none; }
.claim-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.claim-actions .btn { min-height: 40px; padding: 0 16px; font-size: 15px; }

#rk-dialog .rk-text { margin: 8px 0 16px; font-size: 15px; line-height: 21px; }
.rk-key {
  padding: 16px 12px; border-radius: 12px; background: var(--raised); text-align: center; user-select: all; -webkit-user-select: all;
  font: 600 20px/28px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; word-break: break-word;
}
.rk-row { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.rk-row .saved { display: inline-flex; align-items: center; gap: 6px; }
#rk-dialog .footnote { margin-bottom: 8px; }
#step-vault .btn.big + .btn.big { margin-top: 8px; }
#step-vault .error { margin-bottom: 12px; }

@media (max-width: 899px) {
  .claim-body { padding: 0 16px 16px; }
  .rk-form { flex-direction: column; align-items: stretch; }
}
