@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fraunces"; font-weight: 500; font-display: swap; src: url(fonts/fraunces-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fraunces"; font-weight: 500; font-display: swap; src: url(fonts/fraunces-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Caveat"; font-weight: 500; font-display: swap; src: url(fonts/caveat-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Caveat"; font-weight: 500; font-display: swap; src: url(fonts/caveat-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --canvas: #efebe3; --paper: #f8f6f1; --paper-2: #fbfaf6; --white: #fff;
  --ink: #1c2a28; --muted: #6b716c; --faint: #8a8170;
  --line: #ddd6c8; --line-2: #ece6da;
  --green: #2f5d50; --green-d: #244a40; --green-bg: #e4ece8; --on-green: #f8f6f1;
  --blue-ink: #1f3a63; --seen-bg: #e3ebf3;
  --amber: #7a5410; --amber-bg: #f6ead2;
  --red: #a32d2d; --red-bg: #f8e6e4; --red-line: #e3b9b9;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --hand: "Caveat", "Segoe Script", "Bradley Hand", cursive;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, .serif, .doc-title { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
strong { font-weight: 500; }
code { font-family: var(--mono); font-size: .9em; }
.hash { word-break: break-all; font-size: .78em; color: var(--muted); }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }

/* Topbar */
.top { background: var(--paper-2); border-bottom: .5px solid var(--line); }
.bar { max-width: 1040px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font: 500 1.15rem var(--serif); color: var(--ink); text-decoration: none; margin-right: auto; }
.seal { width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: var(--on-green); display: inline-flex; align-items: center; justify-content: center; }
.seal .ic { width: 16px; height: 16px; }
nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; font-size: .9rem; }
nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
nav a:hover { color: var(--ink); background: var(--line-2); }
nav a.cur { color: var(--ink); background: var(--line-2); }
nav button.link { color: var(--muted); padding: 6px 10px; text-decoration: none; }
nav button.link:hover { color: var(--ink); }
.secure { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; }
.secure .ic { width: 15px; height: 15px; }

/* Ramme */
.wrap { max-width: 720px; margin: 0 auto; padding: 32px 16px 72px; }
.wrap.wide { max-width: 1040px; }
.card { background: var(--paper); border: .5px solid var(--line); border-radius: 12px; padding: 24px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin: 32px auto; padding: 32px; }
.card.center { text-align: center; }
.card.empty { text-align: center; padding: 48px 24px; }
.empty-ic { width: 52px; height: 52px; border-radius: 50%; background: var(--green-bg); color: var(--green); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.empty-ic .ic { width: 24px; height: 24px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.head h1 { margin: 0; }
.eyebrow { color: var(--muted); font-size: .85rem; margin-bottom: 2px; }
.doc-title { font-size: 2rem; line-height: 1.15; margin: 0 0 6px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: .9rem; }
.back:hover { color: var(--ink); }
.back .ic { width: 16px; height: 16px; }
.hint { margin: -6px 0 16px; }

/* Formularer */
label { display: block; font-weight: 500; font-size: .875rem; margin-bottom: 16px; }
input, textarea { display: block; width: 100%; margin-top: 6px; padding: 11px 13px; font: 400 15px var(--sans); color: var(--ink); background: var(--white); border: .5px solid #cfc7b7; border-radius: 8px; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #a9a294; }
input:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 93, 80, .15); }
.codeinput { font: 500 1.25rem var(--mono); letter-spacing: .12em; text-transform: uppercase; text-align: center; }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 16px; border: 1px dashed #b5ab98; border-radius: 10px; background: var(--paper-2); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover { border-color: var(--green); background: var(--white); }
.drop .ic { width: 26px; height: 26px; color: var(--green); }
.drop .drop-t { font-weight: 500; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.drop.has { border-style: solid; border-color: var(--green); background: var(--green-bg); }

/* Knapper */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--green); color: var(--on-green); border: .5px solid var(--green); border-radius: 8px; padding: 10px 18px; font: 500 15px var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, transform .05s; }
.btn:hover { background: var(--green-d); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; color: var(--green); border-color: #b9c7c1; }
.btn.ghost:hover { background: var(--green-bg); }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red-line); }
.btn.danger:hover { background: var(--red-bg); }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: wait; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; border: .5px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn.done { color: var(--green); background: var(--green-bg); }
button.link { background: none; border: 0; padding: 0; color: var(--green); font: inherit; cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 20px 0 12px; }
.actions .push { margin-left: auto; }
.actions-cell { white-space: nowrap; }
.actions-cell form { margin-left: 4px; }
.row-btns { display: flex; gap: 10px; justify-content: center; }

/* Beskeder */
.msg { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: .925rem; }
.msg .ic { margin-top: 2px; }
.msg.ok { background: var(--green-bg); color: var(--green-d); }
.msg.err { background: var(--red-bg); color: var(--red); }
.msg.warn { background: var(--amber-bg); color: var(--amber); }

/* Chips og badges */
.pill, .chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 500; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.chip .ic { width: 14px; height: 14px; }
.chip.big { padding: 6px 14px; font-size: .875rem; }
.chip.big .ic { width: 16px; height: 16px; }
.pill.ok, .chip.ok { background: var(--green-bg); color: var(--green-d); }
.pill.wait, .chip.wait { background: var(--amber-bg); color: var(--amber); }
.pill.seen, .chip.seen { background: var(--seen-bg); color: var(--blue-ink); }
.pill.off { background: var(--red-bg); color: var(--red); }
.badge { background: var(--red); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .72rem; font-weight: 500; }

/* Initialer og fremdrift */
.av { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 500; flex: none; }
.av.on { background: var(--green); color: var(--on-green); }
.av.off { background: var(--white); border: 1px dashed #b5ab98; color: var(--faint); }
.progress { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 4px 0 22px; }
.avs { display: flex; gap: 4px; flex-wrap: wrap; }
.track { display: block; width: 160px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.fill { display: block; height: 100%; background: var(--green); border-radius: 3px; }

/* Rækker (lister) */
.rows { background: var(--white); border: .5px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: .5px solid var(--line-2); color: inherit; text-decoration: none; }
.row:last-child { border-bottom: 0; }
.link-row:hover { background: var(--paper-2); }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-right { display: flex; align-items: center; }
.code { color: var(--muted); font-size: .85rem; letter-spacing: .04em; }
.doc-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--paper); border: .5px solid var(--line); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.doc-ic.on { background: var(--green-bg); border-color: transparent; color: var(--green); }
.mini { display: flex; align-items: center; gap: 10px; }
.mini .track { width: 80px; }
.linkbox { display: flex; align-items: center; gap: 10px; background: var(--white); border: .5px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 14px; margin-bottom: 14px; }
.linkbox > .ic { color: var(--muted); }
.linkbox input { border: 0; margin: 0; padding: 6px 0; background: transparent; box-shadow: none; font-size: .9rem; min-width: 0; }

/* Underskrift */
.sig { font: 500 2rem/1 var(--hand); color: var(--blue-ink); }
.sig:empty::before { content: attr(data-empty); color: #c4bcae; }
.small-sig { font-size: 1.5rem; }
.sigline { border-bottom: 1.5px solid var(--ink); min-height: 56px; display: flex; align-items: flex-end; padding: 0 2px 4px; margin: 4px 0 4px; overflow: hidden; }
.sigline.center { justify-content: center; max-width: 320px; margin: 18px auto 8px; }
.sigcap { margin-bottom: 18px; }
.sign-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.sign-panel { background: var(--paper); border: .5px solid var(--line); border-radius: 12px; padding: 22px; position: sticky; top: 16px; }
.done-head { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--green-d); margin-bottom: 8px; }
.paper { background: var(--white); border: .5px solid var(--line); border-radius: 12px; overflow: hidden; }
.pdfwrap { height: 72vh; min-height: 460px; background: #e9e5dc; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pdfpages { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.pdfpages.fallback { padding: 0; height: 100%; }
.pg { width: 100%; background: #fff; box-shadow: 0 1px 3px rgba(28, 42, 40, .12); }
.pg canvas { display: block; width: 100%; height: 100%; }
.pdf-loading { padding: 40px 0; text-align: center; color: var(--muted); font-size: .9rem; }
.pdfwrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.paper-foot { display: flex; flex-wrap: wrap; gap: 18px; padding: 10px 14px; border-top: .5px solid var(--line-2); font-size: .85rem; }
.paper-foot a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.paper-foot .ic { width: 15px; height: 15px; }
.codebox { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--white); border: 1px dashed #b5ab98; border-radius: 10px; padding: 14px 16px; margin: 18px 0; font: 500 1.2rem var(--mono); letter-spacing: .06em; }

/* Tabeller (admin) */
table.list { width: 100%; border-collapse: collapse; background: var(--white); border: .5px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
table.list th, table.list td { text-align: left; padding: 12px 14px; border-bottom: .5px solid var(--line-2); vertical-align: middle; }
table.list th { font-size: .78rem; font-weight: 500; color: var(--muted); background: var(--paper-2); }
table.list tr:last-child td { border-bottom: 0; }
table.kv td { padding: 5px 18px 5px 0; }
.right { text-align: right; }

.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .85rem; }
.links { margin-top: 18px; font-size: .9rem; text-align: center; }

@media (max-width: 760px) {
  .sign-grid { grid-template-columns: 1fr; }
  .sign-panel { position: static; }
  .pdfwrap { height: auto; min-height: 0; overflow: visible; }
  .pdfpages { padding: 10px; gap: 10px; }
  .pdfpages.fallback { height: 60vh; }
  .doc-title { font-size: 1.6rem; }
  .card.narrow { padding: 24px; margin-top: 8px; }
  .row { flex-wrap: wrap; gap: 10px 12px; }
  .row .grow { flex-basis: calc(100% - 100px); }
  .row .code { margin-left: 44px; }
  .mini { width: 100%; padding-left: 50px; }
  .actions .push { margin-left: 0; }
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border-bottom: .5px solid var(--line-2); padding: 8px 0; }
  table.list td { border: 0; padding: 4px 14px; }
  .right { text-align: left; }
  .actions-cell { white-space: normal; }
  .actions-cell form { margin: 0 4px 4px 0; display: inline-block; }
}

/* Smalle kort (login, kode m.m.) */
.card.narrow form > .btn { width: 100%; }
.card.narrow .doc-title { font-size: 1.6rem; margin-bottom: 18px; }

/* Brugere og statistik */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--paper); border: .5px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; }
.stat-n { font: 500 1.9rem/1.1 var(--serif); }
.section { margin-top: 28px; }
.invite-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.invite-form label { margin-bottom: 0; }
.invite-form .btn { height: 44px; }
.rows.inner { margin: 18px 0 0; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.user-row .grow { gap: 1px; }
@media (max-width: 760px) {
  .invite-form { grid-template-columns: 1fr; }
  .row-actions { width: 100%; justify-content: flex-start; padding-left: 46px; }
}
input[readonly] { background: var(--paper-2); color: var(--muted); }
