/* KvikTilbud: Kompas AI-paletten (creme, navy, mørk lilla som accent), Schibsted Grotesk, kantede hjørner. Ét lyst tema. */
:root {
  --bg: #F2E9D8; --screen: #F8F3E9; --surface: #FFFDF8; --ink: #0F2340; --muted: #4A5872; --line: #D9CBB0;
  --accent: #4A2C85; --accent-ink: #FFFFFF; --accent-soft: #E9E3F3; --navy: #0F2340;
  --chalk-soft: #EFE4CC; --chalk-ink: #0F2340;
  --ok: #1E6B45; --ok-soft: #DDEBDF; --warn-soft: #EEDDD3; --warn-ink: #7A3B1C; --danger: #A8321F;
  --paper: #FFFFFF; --paper-line: #E2D8C4;
  --f: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light; accent-color: var(--accent);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--screen); color: var(--ink); font-family: var(--f); font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
@media (min-width: 560px) { body { background: var(--bg); } }

.app { max-width: 520px; margin: 0 auto; min-height: 100dvh; background: var(--screen); display: flex; flex-direction: column; position: relative; }
@media (min-width: 560px) { .app { box-shadow: 0 0 0 1px var(--line); } }
.view { flex: 1; display: flex; flex-direction: column; gap: 14px;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 20px max(16px, env(safe-area-inset-left)); }
.view:focus { outline: none; }

h1, h2, h3 { font-family: var(--f); letter-spacing: -.02em; margin: 0; line-height: 1.1; text-wrap: balance; }
.topbar { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.topbar h1 { font-size: 24px; font-weight: 700; }
.topbar .sub { font-size: 13px; color: var(--muted); }
.back { border: 0; background: var(--surface); color: var(--ink); width: 44px; height: 44px; border-radius: 4px; font-size: 22px; cursor: pointer; flex: none; box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; text-decoration: none; }
.eyebrow { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: proportional-nums; letter-spacing: 0; }
p { margin: 0; }
a { color: var(--accent); }

button, input, textarea, select { font-family: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn { border: 0; border-radius: 4px; min-height: 48px; padding: 12px 16px; font-size: 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-danger { background: var(--surface); color: var(--danger); box-shadow: inset 0 0 0 1px var(--line); }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 8px 12px; font-size: 14px; }
.sticky-cta { position: sticky; bottom: 0; padding: 12px 0 max(4px, env(safe-area-inset-bottom)); margin-top: auto; background: linear-gradient(to top, var(--screen) 75%, transparent); display: grid; gap: 8px; z-index: 2; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.card { background: var(--surface); border-radius: 6px; padding: 14px; box-shadow: inset 0 0 0 1px var(--line); }
.stack { display: grid; gap: 10px; }

/* Felter */
.field { display: grid; gap: 4px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
.field input, .field textarea, .field select, .input { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 11px 12px; min-height: 48px; }
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.field input[aria-invalid="true"] { border-color: var(--danger); }

/* Beskeder */
.alert { border-radius: 6px; padding: 12px 14px; font-size: 14px; display: flex; gap: 10px; align-items: start; }
.alert-error { background: var(--warn-soft); color: var(--warn-ink); }
.alert-info { background: var(--accent-soft); color: var(--ink); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert b { display: block; }
.toast { position: fixed; left: 50%; top: max(12px, env(safe-area-inset-top)); width: min(488px, calc(100% - 24px)); transform: translate(-50%, -160%); background: var(--ink); color: var(--screen); border-radius: 6px; padding: 12px 14px; font-size: 14px; transition: transform .3s ease; z-index: 20; }
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: var(--warn-ink); }

/* Login */
.brand { display: flex; gap: 10px; align-items: center; }
.logo { width: 44px; height: 44px; border-radius: 4px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 22px; flex: none; }
.hero { padding: 28px 0 8px; display: grid; gap: 10px; }
.hero h1 { font-size: 34px; font-weight: 800; letter-spacing: -.035em; }
.hero p { color: var(--muted); font-size: 17px; }

/* Forside */
.hello { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface); border-radius: 6px; padding: 10px; box-shadow: inset 0 0 0 1px var(--line); }
.stat b { display: block; font-size: 24px; line-height: 1; }
.stat span { font-size: 12px; color: var(--muted); }
.big-new { background: var(--navy); color: #fff; border: 0; border-radius: 6px; padding: 18px; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 14px; text-decoration: none; }
.big-new .plus { width: 48px; height: 48px; border-radius: 4px; background: var(--accent); display: grid; place-items: center; font-size: 28px; font-weight: 600; flex: none; }
.big-new b { font-size: 22px; display: block; line-height: 1.1; }
.big-new small { font-size: 13px; opacity: .85; }
.qlist { display: grid; gap: 8px; }
.qrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; background: var(--surface); border-radius: 6px; padding: 12px 14px; box-shadow: inset 0 0 0 1px var(--line); color: inherit; text-decoration: none; min-height: 64px; }
.qrow .who { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow .what { font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow .amt { text-align: right; font-size: 14px; }
.pill { justify-self: end; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 4px; white-space: nowrap; align-self: center; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.wait { background: var(--chalk-soft); color: var(--chalk-ink); }
.pill.lost { background: var(--warn-soft); color: var(--warn-ink); }
.pill.new { background: var(--accent-soft); color: var(--accent); }
.empty { text-align: center; padding: 22px 14px; color: var(--muted); font-size: 14px; }

.tabbar { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); background: var(--surface); padding: 4px 8px max(8px, env(safe-area-inset-bottom)); z-index: 3; }
.tabbar a { color: var(--muted); font-size: 12px; font-weight: 600; padding: 6px; min-height: 52px; display: grid; justify-items: center; align-content: center; gap: 2px; text-decoration: none; }
.tabbar svg { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--accent); }

/* Nyt tilbud */
.mic-wrap { display: grid; justify-items: center; gap: 8px; padding: 4px 0; }
.mic { width: 88px; height: 88px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; position: relative; }
.mic svg { width: 36px; height: 36px; }
.mic.rec { background: #C8372D; }
.mic.rec::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid #C8372D; opacity: .5; animation: pulse 1.2s ease-out infinite; }
@keyframes pulse { from { transform: scale(.9); opacity: .6; } to { transform: scale(1.25); opacity: 0; } }
.mic-label { font-size: 14px; color: var(--muted); text-align: center; }
.audio-ok { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.audio-ok audio { flex: 1; min-width: 0; height: 40px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo { aspect-ratio: 1; border-radius: 4px; overflow: hidden; position: relative; background: var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo button { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border: 0; border-radius: 4px; background: rgba(15,35,64,.8); color: #fff; font-size: 20px; cursor: pointer; }
.photo span { position: absolute; left: 4px; bottom: 4px; font-size: 11px; font-weight: 600; background: rgba(15,35,64,.75); color: #fff; padding: 2px 6px; border-radius: 3px; }
.photo-add { aspect-ratio: 1; border-radius: 4px; border: 2px dashed var(--line); background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; align-content: center; gap: 4px; font-size: 13px; font-weight: 600; position: relative; }
.photo-add svg { width: 26px; height: 26px; }
.photo-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.photo-add:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }

/* AI arbejder */
.working { flex: 1; display: grid; align-content: center; gap: 22px; padding: 10px 6px; }
.working h2 { font-size: 30px; line-height: 1.05; }
.steps { display: grid; gap: 14px; list-style: none; padding: 0; margin: 0; }
.steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; color: var(--muted); }
.steps .dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 14px; }
.steps li.active, .steps li.done { color: var(--ink); }
.steps li.active .dot { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.steps li.done .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps li small { display: block; font-size: 12px; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
.timer { font-size: 13px; color: var(--muted); }

/* Tjek og ret */
.ai-banner { display: flex; gap: 10px; align-items: start; background: var(--accent-soft); border-radius: 6px; padding: 10px 12px; font-size: 14px; }
.ai-banner b { color: var(--accent); }
.lines { display: grid; gap: 8px; }
.line { background: var(--surface); border-radius: 6px; padding: 12px; box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 8px; }
.line.needs { box-shadow: inset 0 0 0 2px var(--warn-ink); }
.line.saving { opacity: .7; }
.line-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.line-head input { font: inherit; font-weight: 600; color: var(--ink); border: 1px solid transparent; border-radius: 4px; background: none; padding: 8px 6px; margin-left: -6px; width: 100%; min-width: 0; min-height: 44px; }
.line-head input:hover, .line-head input:focus { border-color: var(--line); background: var(--screen); }
.line-del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 22px; width: 44px; height: 44px; flex: none; }
.line-calc { display: grid; grid-template-columns: 78px auto 96px minmax(0, 1fr); gap: 6px; align-items: center; font-size: 14px; }
.line-calc input { font-size: 16px; width: 100%; color: var(--ink); background: var(--screen); border: 1px solid var(--line); border-radius: 4px; padding: 8px 6px; text-align: right; min-height: 44px; font-variant-numeric: tabular-nums; }
.line-calc .unit { color: var(--muted); white-space: nowrap; }
.line-calc .sum { text-align: right; font-weight: 600; }
.src { font-size: 12px; color: var(--muted); }
.note { font-size: 13px; background: var(--chalk-soft); color: var(--chalk-ink); border-radius: 4px; padding: 7px 9px; display: flex; gap: 6px; font-style: italic; }
.note .pen { font-style: normal; }
.needs-msg { font-size: 13px; color: var(--warn-ink); font-weight: 600; }
.add-line { border: 2px dashed var(--line); background: none; color: var(--muted); border-radius: 6px; padding: 12px; min-height: 48px; cursor: pointer; font-weight: 600; font-size: 15px; width: 100%; }
.add-box { display: grid; gap: 8px; }
.totals { display: grid; gap: 4px; font-size: 15px; }
.totals div { display: flex; justify-content: space-between; gap: 8px; }
.totals .grand { font-size: 19px; font-weight: 700; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.desc { font-size: 15px; line-height: 1.5; white-space: pre-line; }
.assumptions { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }

/* Send */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-radius: 6px; padding: 4px; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { border: 0; background: none; color: var(--muted); padding: 10px; min-height: 44px; border-radius: 4px; font-weight: 600; font-size: 15px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* Sendt */
.done-hero { text-align: center; display: grid; justify-items: center; gap: 6px; padding-top: 14px; }
.done-hero .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; }
.done-hero .tick.lost { background: var(--warn-soft); color: var(--warn-ink); }
.done-hero .tick svg { width: 34px; height: 34px; }
.done-hero h2 { font-size: 28px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; position: relative; padding-bottom: 14px; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.timeline .tdot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.timeline li.done .tdot { background: var(--accent); border-color: var(--accent); }
.timeline li.lost .tdot { background: var(--warn-ink); border-color: var(--warn-ink); }
.timeline li.skip { opacity: .5; }
.timeline li.skip b { text-decoration: line-through; }
.timeline b { font-size: 15px; display: block; }
.timeline small { font-size: 13px; color: var(--muted); }
.linkbox { display: flex; gap: 8px; align-items: center; }
.linkbox input { flex: 1; min-width: 0; font-size: 13px; }

/* Prisliste */
.prow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.prow .pn { font-size: 15px; font-weight: 500; }
.prow .pu { font-size: 13px; color: var(--muted); }
.prop { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.prop:last-child { border-bottom: 0; }
.prop input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--accent); justify-self: center; }
.prop .pgrid { display: grid; grid-template-columns: minmax(0, 1fr) 88px 100px; gap: 6px; }
.prop .pgrid input, .prop .pgrid select, .newitem input, .newitem select { font: inherit; font-size: 16px; width: 100%; color: var(--ink); background: var(--screen); border: 1px solid var(--line); border-radius: 4px; padding: 8px 6px; min-height: 44px; }
.prop.off .pgrid { opacity: .45; }
.newitem { display: grid; grid-template-columns: minmax(0, 1fr) 88px 100px; gap: 6px; }
@media (max-width: 400px) { .prop .pgrid, .newitem { grid-template-columns: 1fr 1fr; } .prop .pgrid > :first-child, .newitem > :first-child { grid-column: 1 / -1; } }
.filedrop { display: flex; gap: 12px; align-items: center; position: relative; }
.filedrop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.filedrop:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.fileicon { width: 40px; height: 48px; border-radius: 3px; background: var(--warn-soft); color: var(--warn-ink); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.progress-dots { display: flex; gap: 6px; }
.progress-dots i { flex: 1; height: 4px; background: var(--line); }
.progress-dots i.on { background: var(--accent); }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 30px auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

/* Logo, prisrækker og filknap */
.logo-img { width: 44px; height: 44px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 4px; flex: none; }
.logo-edit { display: flex; gap: 14px; align-items: center; }
.logo-edit .logo-img { width: 72px; height: 72px; }
.filebtn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; }
.filebtn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.filebtn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.pact { grid-column: 1 / -1; display: flex; gap: 8px; }
.prow-edit { display: grid; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }

/* Tale til tekst: information og til/fra */
.stt { border-radius: 4px; }
.stt p { margin: 0; font-size: 14px; }
.stt-actions { display: grid; gap: 8px; }
.stt-actions .btn { min-height: 48px; }
.stt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; }
.stt-switch { width: 56px; height: 44px; border: 0; border-radius: 4px; background: var(--line); padding: 8px; cursor: pointer; flex: none; position: relative; }
.stt-switch span { display: block; width: 20px; height: 28px; background: var(--surface); border-radius: 2px; transition: transform .15s; box-shadow: 0 0 0 1px rgba(15,35,64,.25); }
.stt-switch.on { background: var(--accent); }
.stt-switch.on span { transform: translateX(16px); }
.stt-switch:disabled { opacity: .5; cursor: not-allowed; }
.stt-info summary { cursor: pointer; font-size: 14px; color: var(--accent); min-height: 32px; display: flex; align-items: center; }
.stt-info { display: grid; gap: 6px; }

/* Tilgængelighed og robusthed */
.skip { position: absolute; left: 8px; top: -60px; z-index: 30; background: var(--ink); color: var(--screen); padding: 12px 16px; min-height: 44px; border-radius: 4px; text-decoration: none; font-weight: 600; }
.skip:focus { top: 8px; }
.net { position: sticky; top: 0; z-index: 15; background: var(--warn-ink); color: #fff; padding: 12px 14px; font-size: 15px; font-weight: 600; line-height: 1.4; }
.toast.error { color: #fff; }
button:disabled, .btn:disabled { cursor: not-allowed; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.tabbar a:focus-visible { outline-offset: -3px; }
.line-del, .photo button, [data-delphoto], [data-delclip] { min-width: 44px; min-height: 44px; }
.stt-info summary { min-height: 44px; }
body, .view { overflow-wrap: anywhere; }
@media (forced-colors: active) { .btn, .seg button, .stt-switch { border: 1px solid ButtonText; } }
