/* eat. brand system 1.0: "Paper. Ink. Heat.", tuned to match eat.consulting.
   Paper #F3EFE5, ink #161614, vermilion #E74427 (about 65 / 25 / 10). Actions and decisive panels are INK
   (paper text, 15.8:1); vermilion lives in typography (one emphasised headline word or line per page,
   large bold text only: 3.48:1 on paper) and small accents (focus rings, "sent" chip outline, error edges).
   Never paper text on vermilion. Neutral tints are ink mixed onto paper, written as solid values.
   Type: DejaVu Sans (headlines bold uppercase, body regular), DejaVu Sans Mono for labels and receipts.
   Square corners, no shadows, no gradients. Fonts are self-hosted (public/fonts, Bitstream Vera licence). */

@font-face { font-family: "eat DejaVu Sans"; src: url("fonts/DejaVuSans.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "eat DejaVu Sans"; src: url("fonts/DejaVuSans-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "eat DejaVu Sans Mono"; src: url("fonts/DejaVuSansMono.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "eat DejaVu Sans Mono"; src: url("fonts/DejaVuSansMono-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --paper: #F3EFE5;
  --ink: #161614;
  --heat: #E74427;    /* vermilion: headline emphasis, focus rings, small accents. Never buttons or panels. */
  --ink-90: #2B2A27;  /* button hover (paper on it: 12.5:1) */
  --ink-70: #585753;  /* muted text (6.3:1 on paper) */
  --ink-40: #9B9891;  /* "opened" progress marker */
  --ink-20: #C7C4BB;  /* hairline and dashed rules */
  --ink-08: #E1DED4;  /* subtle fills */
  --ink-05: #E8E4DB;  /* faint fills (alerts, code) */
  --font: "eat DejaVu Sans", "DejaVu Sans", Arial, sans-serif;
  --mono: "eat DejaVu Sans Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 6.5vw, 88px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1); /* ease out */
}
* { box-sizing: border-box; border-radius: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper); line-height: 1.5; font-size: 18px;
  min-height: 100vh; display: flex; flex-direction: column; overflow-x: clip; }
main { flex: 1; padding-top: 48px; padding-bottom: 88px; }
a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; text-decoration-color: var(--heat); }

/* Headlines: DejaVu Sans Bold, uppercase, short lines, tight but readable. */
h1 { font-size: clamp(2.25rem, 1.4rem + 3.6vw, 4.5rem); line-height: 1.02; margin: 0 0 24px; letter-spacing: -0.025em; font-weight: 700;
  text-transform: uppercase; overflow-wrap: break-word; hyphens: auto; }
h2 { font-size: 1.375rem; line-height: 1.2; margin: 48px 0 16px; letter-spacing: -0.01em; font-weight: 700; text-transform: uppercase; }
/* Small section labels: mono uppercase 14 px ("01 / STRATEGY"). */
.h3, h3 { font-family: var(--mono); font-size: 0.875rem; line-height: 1.3; margin: 32px 0 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
/* Narrow cards (verify, messages, consent) carry longer headlines: keep them big but contained. */
.card.narrow h1 { font-size: clamp(2rem, 1.3rem + 2.4vw, 3.25rem); line-height: 1.05; }
/* User-entered document titles stay in sentence case (they are content, not headlines). */
.page-head:has(.chip) h1, .sign-doc h1, .card.center .eyebrow + h1 {
  text-transform: none; font-size: clamp(1.75rem, 1.2rem + 2vw, 2.75rem); line-height: 1.12; letter-spacing: -0.02em;
}
p { margin: 0 0 16px; }
p, .lead, .prose li { max-width: 70ch; }
code { font-family: var(--mono); font-size: 0.85em; }
.hash, .break { word-break: break-all; }
.hash { font-family: var(--mono); }
.pre { white-space: pre-wrap; }
.muted { color: var(--ink-70); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.center p, .center .lead { margin-left: auto; margin-right: auto; }
.lead { font-size: 1.125rem; color: var(--ink-70); }
.eyebrow { color: var(--ink); font-family: var(--mono); font-size: 0.875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 12px; }
/* The signer's "sent by" line contains names (and the lowercase wordmark): keep its case. */
.sign-doc .eyebrow, .card.center .eyebrow { text-transform: none; letter-spacing: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); padding: 8px 12px; z-index: 10; }
.ok-text { color: var(--ink); font-weight: 700; }
/* Vermilion emphasis in a headline (large bold text only). */
.hl { color: var(--heat); }
.error-text { color: var(--ink); font-weight: 700; border-left: 4px solid var(--heat); padding-left: 10px; }
.error-text::before { content: "! "; font-family: var(--mono); }

.wrap { width: 100%; max-width: calc(880px + 2 * var(--gutter)); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.wrap.wide { max-width: calc(1200px + 2 * var(--gutter)); }

/* ---- Top bar (as eat.consulting): heavy wordmark left, plain links, bold underlined CTA right, 1 px rule */
.topbar { background: var(--paper); border-bottom: 1px solid var(--ink); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 84px; gap: 8px 40px; flex-wrap: wrap; }
.wordmark { font-size: 2.25rem; color: var(--ink); text-decoration: none; letter-spacing: -0.05em; line-height: 1; white-space: nowrap; padding: 10px 0; min-width: 48px; }
.wordmark:hover { text-decoration: none; }
.wm-eat { font-weight: 700; }
.wm-rest { font-weight: 400; font-size: 0.6em; letter-spacing: -0.01em; margin-left: 0.25em; }
.nav { display: flex; align-items: center; gap: 12px 32px; flex: 1 1 auto; flex-wrap: wrap; font-size: 1.0625rem; }
.nav-links { display: flex; align-items: center; gap: 4px 28px; flex-wrap: wrap; margin: 0 auto; }
.nav-links a { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.nav-links a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
/* The single header CTA: bold text with a 2 px ink underline set a few px below. */
.nav-cta, .btn-link { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; color: var(--ink); white-space: nowrap;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 7px; text-decoration-color: var(--ink); }
.nav-cta:hover, .btn-link:hover { text-decoration-color: var(--heat); }
.muted-link { color: var(--ink-70); }
.inline { display: inline; margin: 0; }

/* ---- Footer: "EAT / EUVIC AI & TRANSFORMATION" left, mono labels right --- */
.footer { border-top: 1px solid var(--ink); background: var(--paper); color: var(--ink); font-family: var(--mono); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; padding-top: 22px; padding-bottom: 26px; }
.footer-brand { font-weight: 700; }
.footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer a { color: var(--ink); text-decoration: none; }
.footer a:hover { text-decoration: underline; text-decoration-color: var(--heat); text-decoration-thickness: 2px; }

/* ---- Surfaces: paper with ink rules (no white cards) -------------------- */
.card { background: var(--paper); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 28px 0; }
.card.narrow, .narrow { max-width: 620px; margin-left: auto; margin-right: auto; }
.prose { max-width: 760px; margin: 0 auto; }
.prose li { margin-bottom: 6px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack > label { margin-top: 8px; }
hr { border: 0; border-top: 1px dashed var(--ink-40); margin: 32px 0; }

/* The one decisive statement on a page may sit on a full INK panel with paper text (as the website's
   statement sections); its primary button inverts to paper with ink text. */
.panel-ink, .step:has(.btn-decision) { background: var(--ink); color: var(--paper); }
.panel-ink { padding: 28px; }
.panel-ink .muted, .panel-ink .lead, .step:has(.btn-decision) .muted { color: var(--ink-20); }

/* ---- Forms ------------------------------------------------------------- */
label { font-weight: 700; font-size: 1rem; display: block; }
label .muted { font-weight: 400; }
input[type="text"], input[type="email"], input[type="number"], input[type="search"], input:not([type]), select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background-color: var(--paper);
  border: 2px solid var(--ink); border-radius: 0; padding: 11px 14px; min-height: 50px; margin-top: 4px;
}
input[type="search"] { -webkit-appearance: none; appearance: none; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer;
  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 1l5 5 5-5' fill='none' stroke='%23161614' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
::placeholder { color: var(--ink-70); opacity: 1; }
input[type="file"] { font: inherit; font-size: 1rem; padding: 10px 0; max-width: 100%; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700; color: var(--ink); background: transparent; border: 2px solid var(--ink); border-radius: 0;
  padding: 9px 16px; margin-right: 12px; cursor: pointer; transition: background-color .2s var(--ease), color .2s var(--ease);
}
input[type="file"]::file-selector-button:hover { background: var(--ink); color: var(--paper); }
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, canvas:focus-visible, summary:focus-visible {
  outline: 3px solid var(--heat); outline-offset: 2px;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--heat); outline-offset: 2px; }
/* On ink the vermilion ring stays (4.53:1 against ink). */
input:disabled { background-color: var(--ink-08); color: var(--ink-70); border-color: var(--ink-20); }

input[type="checkbox"], input[type="radio"] {
  -webkit-appearance: none; appearance: none; margin: 0; flex-shrink: 0; cursor: pointer;
  width: 24px; height: 24px; border: 2px solid var(--ink); border-radius: 0; background: var(--paper);
  display: inline-block; vertical-align: middle;
}
input[type="checkbox"]:checked {
  background-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='12' viewBox='0 0 14 12'%3E%3Cpath d='M1.5 6.5l4 4 7-9' fill='none' stroke='%23F3EFE5' stroke-width='2.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 14px 12px;
}
input[type="radio"] { width: 18px; height: 18px; padding: 3px; }
input[type="radio"]:checked { background: var(--ink); background-clip: content-box; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; line-height: 1.45; cursor: pointer; }
.check input { margin-top: 0; }

/* ---- Buttons (as eat.consulting) ---------------------------------------- */
/* Primary: solid ink rectangle, bold paper text (15.8:1), square. Hover: a touch lighter ink and an underline. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; font: inherit; font-size: 1rem; font-weight: 700;
  background: var(--ink); color: var(--paper); border: 2px solid var(--ink); border-radius: 0; padding: 13px 24px; min-height: 52px;
  cursor: pointer; text-decoration: none; text-align: center; line-height: 1.2;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease); }
.btn:hover { background: var(--ink-90); border-color: var(--ink-90); color: var(--paper); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
/* Secondary (toolbars, forms with several buttons): transparent with a 2 px ink frame. */
.btn-secondary, .btn-danger, .btn-danger-outline { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover, .btn-danger:hover, .btn-danger-outline:hover { background: var(--ink-08); border-color: var(--ink); color: var(--ink); }
/* Destructive: ink outline, the wording carries the meaning; a "!" mark makes it unmistakable. */
.btn-danger::before, .btn-danger-outline::before { content: "!" / ""; font-family: var(--mono); font-weight: 700; }
/* Decision buttons ("Signera", "Skicka för signering", "Godkänn"): the same ink button, larger. */
.btn-decision { font-size: 1.1875rem; min-height: 64px; padding: 18px 34px; }
.btn-small { min-height: 44px; padding: 8px 16px; font-size: 0.875rem; }
.btn-block { width: 100%; }
.btn-large { min-height: 68px; font-size: 1.25rem; }
/* On an ink panel the primary button inverts: paper rectangle, ink text. */
.panel-ink .btn:not(.btn-secondary), .step:has(.btn-decision) .btn-decision { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.panel-ink .btn:not(.btn-secondary):hover, .step:has(.btn-decision) .btn-decision:hover { background: var(--ink-08); border-color: var(--ink-08); color: var(--ink); }
.linkbtn { background: none; border: 0; color: var(--ink); font: inherit; cursor: pointer; padding: 6px 0; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
.nav .linkbtn { color: var(--ink); text-decoration: none; font-size: inherit; padding: 0; }
.nav .linkbtn:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }

/* ---- Alerts: ink text, meaning carried by glyph, wording and a vermilion edge for errors -------- */
.alert { position: relative; padding: 13px 16px 13px 52px; margin: 0 0 16px; border: 0; border-left: 4px solid var(--ink); background: var(--ink-05); color: var(--ink); font-size: 1rem; }
.alert::before { position: absolute; left: 14px; top: 13px; width: 24px; height: 24px; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 0.9rem; line-height: 1; border: 2px solid var(--ink); }
.alert-info::before { content: "i"; }
.alert-success::before { content: "\2713"; }
.alert-warn::before { content: "!"; }
.alert-error { font-weight: 700; border-left-color: var(--heat); }
.alert-error::before { content: "!"; background: var(--ink); color: var(--paper); }

/* ---- Status chips: small, quiet, mono uppercase, 1 px frame ---------------- */
.chip { display: inline-block; font-family: var(--mono); font-size: 0.75rem; font-weight: 400; text-transform: uppercase; letter-spacing: 0.05em;
  line-height: 1.2; padding: 4px 8px; white-space: nowrap; border: 1px solid var(--ink); background: transparent; color: var(--ink); }
.chip-sent { border-color: var(--heat); }
.chip-draft, .chip-waiting { border-style: dashed; }
.chip-completed, .chip-signed { background: var(--ink); color: var(--paper); }
.chip-declined, .chip-cancelled, .chip-expired { border-color: var(--ink-40); color: var(--ink-70); text-decoration: line-through; text-decoration-thickness: 1px; }
.chip-viewer { border-color: var(--ink-20); color: var(--ink-70); }
/* Email delivery state (sender detail page): smaller still. */
.chip-delivery { font-size: 0.6875rem; padding: 2px 6px; vertical-align: 1px; }
.chip-delivery-delivered { background: transparent; border-color: var(--ink); color: var(--ink); }
.chip-delivery-delivered::before { content: "\2713  " / ""; }
.chip-delivery-sent, .chip-delivery-queued { background: transparent; border-color: var(--ink-40); color: var(--ink-70); }
.chip-delivery-delivery_delayed { border-style: dashed; }
.chip-delivery-bounced, .chip-delivery-failed, .chip-delivery-complained, .chip-delivery-suppressed { background: transparent; border-color: var(--heat); color: var(--ink); font-weight: 700; text-decoration: none; }
.chip-delivery-bounced::before, .chip-delivery-failed::before, .chip-delivery-complained::before, .chip-delivery-suppressed::before { content: "! " / ""; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { margin: 0; }
.page-head:has(.chip) { align-items: center; }
.filters { display: flex; gap: 10px; margin: 0 0 24px; flex-wrap: wrap; }
.filters input { flex: 1 1 240px; margin: 0; }
.filters select { flex: 0 1 220px; margin: 0; }
.doc-list, .party-list, .plain { list-style: none; padding: 0; margin: 0; }
.doc-list { background: var(--paper); border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.doc-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 20px; align-items: center; padding: 18px 0; border-top: 1px solid var(--ink-20); }
.doc-row:first-child { border-top: 0; }
.doc-link { text-decoration: none; color: var(--ink); min-width: 0; }
.doc-link:hover .doc-title { text-decoration: underline; text-decoration-color: var(--heat); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.doc-title { display: block; font-weight: 700; font-size: 1.125rem; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { display: block; color: var(--ink-70); font-size: 0.9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-progress { font-size: 0.8125rem; color: var(--ink-70); display: flex; gap: 8px; align-items: center; font-family: var(--mono); }
.dots { display: inline-flex; gap: 4px; }
.dot { width: 11px; height: 11px; border: 2px solid var(--ink); background: transparent; }
.dot-signed { background: var(--ink); }
.dot-opened { background: var(--ink-40); border-color: var(--ink-40); }
.dot-declined { border-style: dashed; border-color: var(--ink-70); }
.doc-date { color: var(--ink-70); font-size: 0.8125rem; font-family: var(--mono); }
.empty { text-align: center; padding: 56px 16px; background: var(--paper); border: 2px dashed var(--ink-40); }
.empty p { margin-left: auto; margin-right: auto; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 12px 28px; margin: 0 0 24px; align-items: baseline; }
.facts dt { color: var(--ink-70); font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.facts dd { margin: 0; min-width: 0; font-size: 1rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.actions form { margin: 0; }
.party-list { padding: 4px 0; }
.party-row { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px dashed var(--ink-40); flex-wrap: wrap; font-size: 1rem; }
.party-row:first-child { border-top: 0; }
.party-side { display: flex; gap: 10px; align-items: center; }
.party-side form { margin: 0; }
.party-row > div:first-child { min-width: 0; flex: 1 1 280px; }
.party-row .rename form { margin-top: 12px; }
.party-row .rename p { margin: 10px 0 0; }
.party-row .rename .inline-fields input:not([type="file"]) { flex: 1 1 100%; }
.party-row .rename .inline-fields .btn { flex: 0 0 auto; }
/* Event log as a receipt: monospaced details, dashed rules. */
.events { list-style: none; padding: 4px 0; margin: 0; font-family: var(--mono); font-size: 0.8125rem; line-height: 1.5; }
.events li { padding: 11px 0; border-top: 1px dashed var(--ink-40); max-width: none; }
.events li:first-child { border-top: 0; }
.events time { color: var(--ink); font-variant-numeric: tabular-nums; margin-right: 8px; }
.events strong { text-transform: uppercase; letter-spacing: 0.02em; }
.danger-zone { margin-top: 56px; border: 2px dashed var(--ink-40); padding: 14px 20px; background: var(--paper); }
.danger-zone summary, .decline summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.danger-zone form { margin-top: 12px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.party { border: 1px solid var(--ink); padding: 14px 16px 10px; margin: 0 0 12px; background: transparent; }
.row-actions, .form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form-actions { justify-content: flex-end; align-items: center; border-top: 1px dashed var(--ink-40); padding-top: 20px; margin-top: 12px; }
.form-actions:has(.btn-decision) { border-top: 1px solid var(--ink); padding-top: 24px; margin-top: 20px; }
.action-note { margin: 0 0 0 auto; font-family: var(--mono); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-70); max-width: 32ch; text-align: right; }

/* Result icons: square tiles. "OK": ink with a paper tick, wiped in once (the headline carries the vermilion). */
.icon-circle { width: 64px; height: 64px; margin: 0 auto 22px; position: relative; border: 2px solid var(--ink); background: transparent; }
.icon-ok { background: var(--ink); }
.icon-ok::before { content: ""; position: absolute; inset: -2px; background: var(--paper); transform-origin: right center; transform: scaleX(0); }
.icon-ok::after { content: ""; position: absolute; left: 22px; top: 11px; width: 14px; height: 28px; border: solid var(--paper); border-width: 0 5px 5px 0; transform: rotate(45deg); }
@media (prefers-reduced-motion: no-preference) {
  .icon-ok::before { animation: heat-wipe .4s var(--ease) both; }
}
@keyframes heat-wipe { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.icon-error::after, .icon-warn::after, .icon-info::after { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 30px; line-height: 1; color: var(--ink); }
.icon-error { background: var(--ink); }
.icon-error::after { content: "!"; color: var(--paper); }
.icon-warn { border-style: dashed; }
.icon-warn::after { content: "!"; }
.icon-info::after { content: "i"; }
.result { text-align: center; margin-bottom: 28px; }
.card.center h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem); margin-top: 28px; }

/* ---- Login ------------------------------------------------------------- */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px 56px; align-items: start; }
.login h1 { font-size: clamp(2.75rem, 1.5rem + 5vw, 6rem); margin-bottom: 24px; }
.login .lead { font-size: 1.1875rem; color: var(--ink); max-width: 60ch; }
.login-panel { border: 1px solid var(--ink); padding: 32px; margin-top: 8px; }
.login-panel .stack > label:first-of-type { margin-top: 0; }
.login-panel .btn { margin-top: 10px; }
.login-foot { grid-column: 1 / -1; border-top: 1px solid var(--ink); padding-top: 18px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  font-family: var(--mono); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; }
.login-foot p { margin: 0; }
.descriptor .wm { font-family: var(--font); font-weight: 700; text-transform: none; letter-spacing: -0.04em; font-size: 1rem; }

/* ---- Signer page ------------------------------------------------------- */
.sign-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 40px; align-items: start; }
.sign-doc h1 { margin-bottom: 10px; }
.message { background: transparent; border-left: 4px solid var(--ink); padding: 4px 16px; margin: 0 0 20px; }
.message p { margin: 4px 0 0; }
.pdf-viewer { display: flex; flex-direction: column; gap: 16px; background: var(--ink-08); padding: 16px; min-height: 200px; }
.pdf-page { width: 100%; height: auto; border: 1px solid var(--ink); display: block; background: #fff; }
.sign-panel { position: sticky; top: 16px; background: var(--paper); border: 2px solid var(--ink); padding: 0; }
.sign-panel > :not(#sign-steps) { margin-left: 22px; margin-right: 22px; }
.sign-panel > :first-child:not(:empty) { margin-top: 22px; }
.step { border-top: 1px dashed var(--ink-40); padding: 20px 22px 22px; margin: 0; }
.step:first-child { border-top: 0; }
.step h2 { font-family: var(--mono); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 12px; }
.step p { font-size: 1rem; }
.step:has(.btn-decision) { border-top: 0; padding-top: 24px; padding-bottom: 26px; }
.step:has(.btn-decision) h2 { color: var(--paper); }
.step:has(.btn-decision) .check { font-weight: 400; color: var(--paper); }
/* Consent checkbox on ink: paper frame, paper fill with an ink tick when checked. */
.step:has(.btn-decision) .check input { border-color: var(--paper); background-color: transparent; }
.step:has(.btn-decision) .check input:checked { background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='12' viewBox='0 0 14 12'%3E%3Cpath d='M1.5 6.5l4 4 7-9' fill='none' stroke='%23161614' stroke-width='2.4'/%3E%3C/svg%3E"); }
.step:has(.btn-decision) .btn-decision { margin-top: 10px; text-transform: uppercase; letter-spacing: 0.02em; }
.locked { opacity: 0.55; }
.inline-form { margin: 0 0 12px; }
.otp-input { font-family: var(--mono); font-size: 1.5rem; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.sig { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
.sig legend { font-weight: 700; font-size: 1rem; margin-bottom: 6px; }
.tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.tab { display: inline-flex; gap: 8px; align-items: center; border: 2px solid var(--ink-20); padding: 6px 14px; font-weight: 400; cursor: pointer; font-size: 0.9375rem; }
.tab:has(input:checked) { border-color: var(--ink); background: var(--ink-08); font-weight: 700; }
.sig-canvas { width: 100%; height: 160px; border: 2px solid var(--ink); background: var(--paper); touch-action: none; display: block; cursor: crosshair; }
.sig-canvas.invalid { border: 2px dashed var(--heat); }
.typed-sig { font-family: "Brush Script MT", "Segoe Script", "Snell Roundhand", cursive; font-size: 1.6rem; }
.parties-mini { border-top: 1px dashed var(--ink-40); padding: 6px 0 4px; font-size: 1rem; }
.sign-panel > .parties-mini { margin: 0; padding-left: 22px; padding-right: 22px; }
.parties-mini h2 { margin-top: 14px; }
.parties-mini li { padding: 3px 0; }
.decline { border-top: 1px dashed var(--ink-40); padding: 14px 0 18px; font-size: 1rem; }
.sign-panel > .decline { margin: 0; padding-left: 22px; padding-right: 22px; }
.decline form { margin-top: 10px; }

/* ---- Files (envelope) -------------------------------------------------- */
.file-list { padding: 4px 0; margin: 0 0 16px; }
.file-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 14px 0; border-top: 1px dashed var(--ink-40); }
.file-row:first-child { border-top: 0; }
.file-main { display: flex; gap: 12px; align-items: flex-start; min-width: 0; flex: 1 1 260px; }
.file-info { min-width: 0; }
.file-pos { flex-shrink: 0; width: 28px; height: 28px; border: 2px solid var(--ink); color: var(--ink); font-family: var(--mono); font-weight: 700; font-size: 0.8125rem; display: inline-grid; place-items: center; }
.file-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.file-actions form { margin: 0; }
.rename { flex-basis: 100%; }
.rename summary { cursor: pointer; color: var(--ink); font-size: 0.9375rem; text-decoration: underline; text-underline-offset: 3px; }
.inline-fields { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 8px 0 0; }
.inline-fields input:not([type="file"]) { flex: 1 1 220px; margin: 0; }
.inline-fields label { flex-basis: 100%; }
.add-files { background: var(--paper); border: 2px dashed var(--ink-40); padding: 14px 20px; }
.sign-files { background: var(--paper); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 12px 0; margin: 0 0 18px; }
.sign-files h2 { margin: 0 0 8px; }
.sign-file-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px dashed var(--ink-40); min-width: 0; font-size: 1rem; }
.sign-file-list li:first-child { border-top: 0; }
.sign-file-list li > div { min-width: 0; }
.verify-files li { padding: 6px 0; }
.section-gap { margin-top: 28px; }
.h2-flush { margin-top: 0; }
.token-list { margin: 14px 0; }
.token-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px dashed var(--ink-40); }
.token-row:first-child { border-top: 0; }
.token-row form { margin: 0; }
.copy-row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin: 8px 0; }
.copy-row code { flex: 1 1 240px; min-width: 0; word-break: break-all; background: var(--ink-08); padding: 8px 10px; font-size: 0.8125rem; }
.consent ul { text-align: left; }
.consent-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.consent-actions .btn { min-width: 140px; }

@media (max-width: 960px) {
  .sign-layout { grid-template-columns: 1fr; }
  .sign-panel { position: static; }
  .login { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  main { padding-top: 28px; }
  .card { padding: 20px 0; }
  .panel-ink { padding: 20px; }
  .login-panel { padding: 22px 18px; }
  .action-note { margin: 0; text-align: left; max-width: none; flex: 1 1 100%; order: -1; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .doc-row { grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px 0; }
  .doc-progress { grid-column: 1; }
  .doc-date { display: none; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 10px; }
  .pdf-viewer { padding: 6px; gap: 8px; margin-left: -10px; margin-right: -10px; }
  .form-actions .btn, .row-actions .btn { flex: 1 1 100%; }
  .party-row .rename .inline-fields .btn { flex: 1 1 100%; white-space: normal; }
  .party-side { flex-wrap: wrap; }
  .sign-panel > :not(#sign-steps) { margin-left: 16px; margin-right: 16px; }
  .sign-panel > .parties-mini, .sign-panel > .decline { margin: 0; padding-left: 16px; padding-right: 16px; }
  .step { padding: 18px 16px 20px; }
  .topbar-inner { min-height: 68px; }
  .wordmark { font-size: 1.875rem; }
  .nav { flex: 0 1 auto; font-size: 1rem; }
  .nav-links { gap: 0 18px; margin: 0; }
  .nav-cta { display: none; } /* "Nytt dokument" finns på startsidan; håller menyn på en rad */
  .footer nav { gap: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Browser autofill (Chrome/Safari paint autofilled fields light blue). Keep fields paper and ink.
   Chrome ignores background-color here, so an inset fill is used: it renders as a flat paper fill, not a shadow. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--paper) inset;
  box-shadow: 0 0 0 1000px var(--paper) inset;
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  transition: background-color 600000s 0s;
}
input:autofill { background-color: var(--paper); color: var(--ink); }

/* Step-up verification (email code before connecting an app or creating an API key) */
.stepup-block { margin: 0 0 18px; }
.stepup-text { margin: 16px 0 12px; }
.stepup-resend { margin: 14px 0 0; }
.stepup-status:empty { display: none; }
.stepup-status { margin-top: 16px; }
@media (max-width: 640px) {
  .consent-actions { flex-direction: column-reverse; }
  .consent-actions .btn { width: 100%; }
}
