:root {
  /* Farver i stil med Hans' egen designmanual: navy bærer, teal fremhæver */
  --navy: #0f3a4f;
  --navy-2: #155a63;
  --teal: #3bb59a;
  --teal-soft: #e5f4ef;
  --teal-ink: #187563;
  --bg: #f4f7f8;
  --card: #ffffff;
  --text: #24303d;
  --heading: #0f3a4f;
  --muted: #6b7684;
  --line: #e4e8ee;
  --brand: #0f3a4f;
  --brand-text: #ffffff;
  --accent: #3bb59a;
  --shadow: 0 1px 2px rgba(15,58,79,.05), 0 6px 18px rgba(15,58,79,.07);
  --red: #b3261e;
  --red-bg: #fdecea;
  --amber: #8a5a00;
  --amber-bg: #fff4d6;
  --green: #1e6b3a;
  --green-bg: #e3f4e8;
  --blue: #1d4f91;
  --blue-bg: #e6eefa;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b2330; --card: #112e3c; --text: #dfe7ec; --heading: #e8f1f2; --muted: #9fb0bd; --line: #23495a;
    --teal-soft: #173f45; --teal-ink: #5fd0b4;
    --brand: #3bb59a; --brand-text: #0b2330; --accent: #3bb59a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
    --red: #ffb4ab; --red-bg: #3b1d1b; --amber: #f3c766; --amber-bg: #3a2f12;
    --green: #8fd6a6; --green-bg: #17301f; --blue: #a9c6f5; --blue-bg: #1b2a40;
  }
}

* { box-sizing: border-box; }
html { font-size: 18px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Arial, sans-serif; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.brand, .greeting, .login h1 { font-family: "Source Serif 4", Georgia, serif; font-weight: 700; letter-spacing: .01em; }

/* Hoved: navy-gradient med teal-kant og bløde bølger forneden */
.top {
  position: relative; overflow: hidden; color: #e8edf3;
  padding: 18px 18px 64px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  border-bottom: 4px solid var(--teal);
}
.top > * { position: relative; z-index: 1; }
.top .waves { position: absolute; left: -2%; right: -2%; bottom: -2px; width: 104%; height: 70px; z-index: 0; pointer-events: none; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; color: #fff; }
.brand em { font-style: normal; color: var(--teal); }
.logo { display: inline-flex; width: 36px; height: 36px; border-radius: 50%; align-items: center; justify-content: center; background: rgba(59,181,154,.18); color: var(--teal); }
.top .greeting { margin: 16px 0 2px; font-size: 1.75rem; line-height: 1.15; color: #fff; }
.top .greeting:empty { display: none; }
.top .dagens {
  margin: 12px 0 16px; padding: 10px 14px; font-size: .9rem; line-height: 1.45; color: #e8edf3;
  background: rgba(255,255,255,.07); border-left: 4.5px solid var(--teal); border-radius: 0 8px 8px 0;
}
.top .dagens:empty { display: none; }
#form-med.otc .rx-only { display: none; }

/* Faner: piller på navy */
.tabs { display: flex; gap: 4px; padding: 4px; background: rgba(255,255,255,.08); border-radius: 24px; }
.tab {
  flex: 1; background: transparent; color: #e8edf3; border: 0; border-radius: 24px;
  padding: 8px 4px; min-height: 40px; font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .85;
  transition: background .2s, color .2s;
}
.tab.active { background: var(--teal); color: var(--navy); opacity: 1; }

main { max-width: 720px; margin: 0 auto; padding: 8px 16px 130px; }
@media (min-width: 760px) { .top > :not(.waves) { max-width: 688px; margin-left: auto !important; margin-right: auto !important; } }
h2 {
  display: flex; align-items: center; gap: 10px; margin: 26px 0 10px;
  font-size: .78rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--heading);
}
h2::after { content: ""; flex: 1; height: 1.5px; background: linear-gradient(90deg, var(--teal), transparent); }
dialog h2 { font-family: "Source Serif 4", Georgia, serif; font-size: 1.3rem; letter-spacing: 0; text-transform: none; }
dialog h2::after { display: none; }
.hint { color: var(--muted); font-size: .9rem; margin: 4px 0 12px; }

button, .button {
  font: inherit; font-size: 1rem; font-weight: 600; border: 0; border-radius: 24px; padding: 12px 16px; min-height: 48px;
  background: var(--brand); color: var(--brand-text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
button.secondary, .button.secondary { background: var(--card); color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--red-bg); color: var(--red); }
input, select, textarea {
  font: inherit; font-size: 1rem; width: 100%; padding: 10px 12px; min-height: 48px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: transparent; }
.row { display: flex; gap: 8px; margin: 8px 0; align-items: center; flex-wrap: wrap; }
.row > input { flex: 1; min-width: 0; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.spacer { flex: 1; }
label.stack { display: block; margin: 10px 0; font-weight: 500; }
label.stack input, label.stack select, label.stack textarea { margin-top: 4px; font-weight: 400; }
.filter label { display: flex; gap: 8px; align-items: center; }
.filter select { width: auto; flex: 1; }

.group { margin-top: 20px; }
.group h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.group h2 .count { order: 2; font-size: .75rem; font-weight: 700; letter-spacing: 0; padding: 2px 10px; border-radius: 15px; background: #e3eef3; color: var(--navy); }
@media (prefers-color-scheme: dark) { .group h2 .count { background: #1a4252; color: #e8f1f2; } }
.empty { color: var(--muted); font-style: italic; margin: 4px 0; }

.card {
  background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--line);
  border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card.s-bestil { border-left-color: var(--red); }
.card.s-bestilt { border-left-color: var(--amber); }
.card.s-klar { border-left-color: var(--green); }
.card.s-hentet { border-left-color: var(--blue); }
.card .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card .name { font-weight: 700; font-size: 1.05rem; color: var(--heading); }
.card .who { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.card .meta { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.card .warn { color: var(--red); font-weight: 600; font-size: .9rem; margin-top: 4px; }
.card .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.card .actions button { flex: 1; min-width: 140px; }

.fab {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 6;
  background: var(--navy); color: #fff; border: 2px solid var(--teal);
  box-shadow: 0 8px 22px rgba(15,58,79,.35); padding: 14px 24px; font-weight: 600; border-radius: 99px;
}

.otc-list { list-style: none; padding: 0; margin: 0; }
.otc-list li {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 8px;
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
}
.otc-list .meta { color: var(--muted); font-size: .85rem; }
.otc-list button { min-height: 40px; padding: 8px 12px; }

dialog {
  border: 0; border-top: 4px solid var(--teal); border-radius: 8px; padding: 18px 20px; width: min(560px, calc(100vw - 24px));
  background: var(--card); color: var(--text); max-height: calc(100vh - 24px);
}
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h2 { margin-top: 4px; }
#scan-video { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 4/3; object-fit: cover; }

#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 20;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; }

.login { max-width: 420px; margin: 0 auto; padding: 48px 16px; }
.login h1 { color: var(--heading); font-size: 2.1rem; line-height: 1.05; }
.login h1 em { font-style: normal; color: var(--teal); display: block; }
.login button { width: 100%; margin-top: 8px; }
.warn-text { color: var(--red); font-weight: 500; }
.banner { background: var(--amber-bg); color: var(--amber); border-radius: 10px; padding: 10px 12px; font-size: .9rem; margin-bottom: 8px; }
[hidden] { display: none !important; }
a.lookup { color: var(--teal-ink); font-size: .9rem; font-weight: 600; }
label.check { display: flex; gap: 10px; align-items: center; margin: 10px 0; font-weight: 500; }
label.check input { width: 24px; height: 24px; min-height: 0; flex: none; }
.ctr-box { background: var(--teal-soft); border: 0; border-left: 4.5px solid var(--teal); border-radius: 0 8px 8px 0; padding: 10px 14px; margin: 12px 0 0; font-size: .95rem; }
.ctr-box .line { margin: 2px 0; }
.ctr-box .soon { color: var(--amber); font-weight: 600; }
.ctr-box .gone { color: var(--red); font-weight: 600; }
.price { font-weight: 600; color: var(--text); }
.ctr-person { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 8px; }
button.linklike { background: none; border: 0; padding: 0; min-height: 0; color: var(--heading); font: inherit; font-weight: 600; font-size: 1.05rem; text-align: left; text-decoration: underline dotted; text-underline-offset: 3px; }
.card .meta.warn { color: var(--red); font-weight: 600; }
.card .actions button { min-width: 110px; }
input[readonly] { background: var(--bg); color: var(--muted); }
select:disabled { color: var(--muted); }

/* Venter på FMK */
.wait { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); padding: 16px; }
.wait[hidden] { display: none; }
.wait-box { background: var(--card, #222); color: var(--text, #fff); border-radius: 14px; padding: 24px; max-width: 340px; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.wait-box p { margin: 8px 0 0; }
.spinner { width: 44px; height: 44px; margin: 0 auto 8px; border: 5px solid rgba(127,127,127,.3); border-top-color: var(--brand, #6cc2a8); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
ul.plain { list-style: none; padding: 0; margin: 0 0 8px; }
ul.plain li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; }
button.small { padding: 4px 12px; font-size: 0.9em; }
#fuldmagt h3 { font-size: 1em; margin: 14px 0 4px; }
