:root {
  --bg: #f5f0e6;
  --surface: #fffdf8;
  --surface-2: #efe7d8;
  --ink: #2a2520;
  --muted: #7a6e62;
  --line: #e4d9c7;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --accent-soft: #dceae3;
  --warm: #b85a30;
  --warm-soft: #f7e3d6;
  --danger: #b3412f;
  --shadow: 0 1px 2px rgba(70, 45, 20, 0.06), 0 6px 18px rgba(70, 45, 20, 0.07);
  --cover-shadow: 0 1px 2px rgba(40, 25, 10, 0.18), 0 6px 14px rgba(40, 25, 10, 0.16);
  --radius: 16px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --tabbar: 62px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

/* Mørkt tema: automatisk efter telefonen, medmindre der er valgt lyst i appen
   (data-theme sættes af theme.js) – eller fordi der er valgt mørkt. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161411;
    --surface: #211e1a;
    --surface-2: #2b2722;
    --ink: #efe7da;
    --muted: #a69a8b;
    --line: #37312a;
    --accent: #86c0aa;
    --accent-ink: #0f201a;
    --accent-soft: #22382f;
    --warm: #e79066;
    --warm-soft: #3e2a1f;
    --danger: #e57663;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.25);
    --cover-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 6px 14px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #161411;
  --surface: #211e1a;
  --surface-2: #2b2722;
  --ink: #efe7da;
  --muted: #a69a8b;
  --line: #37312a;
  --accent: #86c0aa;
  --accent-ink: #0f201a;
  --accent-soft: #22382f;
  --warm: #e79066;
  --warm-soft: #3e2a1f;
  --danger: #e57663;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.25);
  --cover-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 6px 14px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--sans);
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar) + var(--safe-b) + 24px);
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
p { margin: 0 0 10px; }
a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }

.i { width: 1.35em; height: 1.35em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.3em; }

.muted { color: var(--muted); }
.small { font-size: 0.84rem; }
.center { text-align: center; }
.pad { padding: 16px 4px; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.late { color: var(--danger); font-weight: 600; }
.pre { white-space: pre-wrap; }
.danger-text { color: var(--danger) !important; }

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------- ramme */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  height: calc(54px + var(--safe-t));
  padding: var(--safe-t) 8px 0;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.top-title { margin: 0; text-align: center; font-size: 1.12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}
.top-btn .i { width: 1.5em; height: 1.5em; }
.top-brand { display: grid; place-items: center; width: 44px; height: 44px; }
.top-brand .logo { width: 32px; height: 32px; }
.logo { display: block; }

.view { max-width: 640px; margin: 0 auto; padding: 14px 16px; }

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar) + var(--safe-b));
  padding: 0 max(8px, calc(50% - 300px)) var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
}
.tab .i { width: 1.6em; height: 1.6em; }
.tab.on { color: var(--accent); }
.tab-icon { position: relative; display: grid; place-items: center; }
.tab-add .tab-icon {
  width: 46px;
  height: 46px;
  margin-top: -16px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 45%, transparent);
}
.tab-add .i { stroke-width: 2.4; }
.tab-add.on { color: var(--accent); }
.dot {
  position: absolute;
  top: -4px;
  right: -9px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--warm);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border: 2px solid var(--surface);
  box-sizing: content-box;
}

/* ------------------------------------------------------------- knapper og felter */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  font: 600 0.95rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn.block { display: flex; width: 100%; margin-top: 10px; }
.btn.small { min-height: 36px; padding: 0 13px; font-size: 0.85rem; border-radius: 11px; }
.btn.glass { background: rgba(0, 0, 0, 0.45); color: #fff; border-color: rgba(255, 255, 255, 0.28); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn.glass.on { background: #fff; color: #111; }
.link { color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

input, textarea, select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 16px/1.3 var(--sans);
  -webkit-appearance: none;
  appearance: none;
}
textarea { padding: 12px 14px; resize: vertical; }
select {
  width: auto;
  min-height: 36px;
  padding: 0 30px 0 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; padding: 0; margin: 0; flex: none; accent-color: var(--accent); -webkit-appearance: auto; appearance: auto; }
input[type="date"] { -webkit-appearance: none; display: block; }

.form { display: flex; flex-direction: column; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span:first-child { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); font-weight: 400; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 12px; padding: 6px 0 8px; font-size: 0.95rem; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }
.form-error { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 13%, var(--surface)); color: var(--danger); font-weight: 600; font-size: 0.9rem; }

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--muted);
}
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.searchbox input { border: 0; padding: 0; background: transparent; box-shadow: none !important; }
.search-form { display: flex; gap: 8px; margin-bottom: 14px; }
.search-form .searchbox { flex: 1; }

/* ------------------------------------------------------------- kort og lister */

.card { background: var(--surface); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card.flush { padding: 0 16px; }
.card h2:last-child { margin: 0; }
.section-title { margin: 22px 2px 10px; font-size: 1.08rem; }
.section-title:first-child { margin-top: 4px; }

.notice { padding: 12px 14px; border-radius: 13px; background: var(--accent-soft); color: var(--ink); font-size: 0.92rem; margin-bottom: 14px; }
.notice.warn { background: var(--warm-soft); }
.notice.warm { background: var(--warm-soft); color: var(--warm); font-weight: 600; }
.link-notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-decoration: none; color: inherit; }
.dup-notice { display: flex; flex-direction: column; gap: 3px; border-left: 4px solid var(--warm); }
.dup-notice a { display: inline-flex; align-items: center; gap: 2px; margin-top: 4px; font-weight: 600; color: var(--warm); text-decoration: none; }

.list > * + * { border-top: 1px solid var(--line); }
.hit {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.list > .hit + .hit { border-top: 1px solid var(--line); }
.hit > .i { color: var(--muted); }
.hit-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hit-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.owner { color: var(--accent); display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; }
.owner .i { width: 1.1em; height: 1.1em; }

.person-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; }
.person-row > .btn, .person-row > .pill, .person-row > a.btn { align-self: center; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.msg { margin: 6px 0 0; padding: 8px 12px; border-radius: 4px 12px 12px 12px; background: var(--surface-2); font-size: 0.9rem; }
.mini-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.mini-row:first-of-type { border-top: 0; }

.loan { display: flex; gap: 12px; padding: 12px 0; }
.loan.faded { opacity: 0.72; }
.loan-title { color: inherit; text-decoration: none; font-weight: 600; }

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
}
.avatar.sm { width: 32px; height: 32px; font-size: 0.78rem; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.35rem; }

.pill { flex: none; padding: 4px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; white-space: nowrap; }
.pill.free { background: var(--accent-soft); color: var(--accent); }
.pill.busy { background: var(--warm-soft); color: var(--warm); }
.pill.no { background: var(--surface-2); color: var(--muted); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 600 0.85rem var(--sans);
  cursor: pointer;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.menu { padding: 4px 16px; }
.menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-row + .menu-row { border-top: 1px solid var(--line); }
.menu-row span { flex: 1; }
.menu-row .i:last-child:not(:first-child) { color: var(--muted); }
.menu-row.danger { color: var(--danger); }

/* ------------------------------------------------------------- bøger */

.cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 3px 7px 7px 3px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--cover-shadow);
  flex: none;
}
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0, rgba(255, 255, 255, 0.16) 2.5%, rgba(0, 0, 0, 0.05) 5%, transparent 9%);
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-blank {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14% 11% 12% 15%;
  background: linear-gradient(165deg, hsl(var(--h) 34% 44%), hsl(var(--h) 40% 28%));
  color: #fbf4e6;
  font-family: var(--serif);
  overflow: hidden;
}
.cover-blank span { font-size: 0.82rem; font-weight: 600; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.cover-blank small { font-size: 0.66rem; opacity: 0.85; font-family: var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cover-sm { width: 46px; border-radius: 2px 4px 4px 2px; }
.cover-sm .cover-blank { padding: 0; }
.cover-sm .cover-blank > * { display: none; }
.cover-md { width: 112px; }
.cover-lg { width: 132px; }
.cover-lg .cover-blank span { font-size: 1rem; }
.cover-lg .cover-blank small { font-size: 0.75rem; }

.shelf-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.shelf-head p { margin: 0; }
.shelf-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shelf-tools select { flex: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 20px 14px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 3px; color: inherit; text-decoration: none; min-width: 0; }
.tile .cover { margin-bottom: 5px; transition: transform 0.15s ease; }
.tile:active .cover { transform: scale(0.97); }
.tile-title { font-size: 0.84rem; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-sub { font-size: 0.76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag {
  position: absolute;
  top: 6px;
  right: -4px;
  max-width: calc(100% - 4px);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.tag.lent { background: var(--warm); color: #fff; }
.tag.req { background: var(--accent); color: var(--accent-ink); }

.hero { display: flex; gap: 18px; align-items: flex-end; margin: 6px 0 20px; }
.hero-text { min-width: 0; }
.hero h1 { margin: 0 0 6px; font-size: 1.5rem; line-height: 1.18; overflow-wrap: anywhere; }
.hero .authors { margin: 0 0 6px; font-size: 1rem; }

.owner-chip { display: inline-flex; align-items: center; gap: 8px; margin: -6px 0 14px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.92rem; }
.owner-chip .i { color: var(--muted); }

.status { display: flex; align-items: center; gap: 12px; }
.status > .i {
  width: 42px;
  height: 42px;
  padding: 9px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.status > div { display: flex; flex-direction: column; }
.status.lent > .i { background: var(--warm-soft); color: var(--warm); }
.status.req > .i, .status.no > .i { background: var(--surface-2); color: var(--muted); }

.desc { margin: 0; white-space: pre-line; cursor: pointer; }
.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.clamp.open { display: block; }

/* ------------------------------------------------------------- tilføj */

.add-menu { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.option:active { transform: scale(0.99); }
.option > span:not(.option-icon) { display: flex; flex-direction: column; gap: 2px; }
.option strong { font-size: 1.02rem; }
.option small { color: var(--muted); font-size: 0.85rem; }
.option-icon { display: grid; place-items: center; width: 50px; height: 50px; flex: none; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.option-icon .i { width: 1.7em; height: 1.7em; }
.option.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); padding: 20px 16px; }
.option.primary small { color: inherit; opacity: 0.85; }
.option.primary .option-icon { background: rgba(255, 255, 255, 0.18); color: inherit; }
.isbn-form { margin-bottom: 4px; }

.scanner {
  position: relative;
  aspect-ratio: 3 / 4;
  max-height: calc(100vh - 230px);
  width: 100%;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
}
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 34%;
  height: 32%;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.38);
  overflow: hidden;
}
.scan-line {
  position: absolute;
  left: 6%;
  right: 6%;
  height: 2px;
  top: 50%;
  background: #ff6a4a;
  box-shadow: 0 0 12px #ff6a4a;
  animation: scan 1.8s ease-in-out infinite alternate;
}
@keyframes scan { from { top: 15%; } to { top: 85%; } }
.scan-frame.locked { border-color: #4cd18a; transition: border-color 0.15s; }
.scan-frame.locked .scan-line { background: #4cd18a; box-shadow: 0 0 12px #4cd18a; animation-play-state: paused; }
.scan-hint { position: absolute; left: 16px; right: 16px; bottom: 74px; margin: 0; text-align: center; color: #fff; font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); }
.scan-controls { position: absolute; left: 14px; right: 14px; bottom: 14px; display: flex; justify-content: space-between; }

.preview-cover { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.cover-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.cover-actions label { cursor: pointer; }

.pick-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.pick-head h2 { margin: 0 0 2px; }
.pick-head p { margin: 0; }
.pick-photo { width: 72px; height: 96px; object-fit: cover; border-radius: 8px; flex: none; }

.done { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 18px; }
.done h2 { margin: 18px 0 8px; font-size: 1.3rem; }
.done .btn.block { max-width: 400px; }

/* ------------------------------------------------------------- venner og profil */

.invite-link { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 0.85rem; overflow-wrap: anywhere; font-family: ui-monospace, Menlo, Consolas, monospace; }
#user-results { margin-top: 6px; }
.profile-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 18px; }
.profile-head > div { display: flex; flex-direction: column; }
.profile-head strong { font-family: var(--serif); font-size: 1.25rem; }
.invite-card { display: flex; flex-direction: column; align-items: center; padding: 28px 18px; }
.invite-card h2 { margin: 12px 0 0; }
.invite-card .btn.block { max-width: 360px; }
.steps { margin: 0; padding-left: 22px; }
.steps li { margin-bottom: 6px; }
.steps .i { width: 1.15em; height: 1.15em; }
.danger-zone summary { cursor: pointer; font-weight: 600; color: var(--danger); }
.danger-zone[open] summary { margin-bottom: 12px; }

.install-banner { display: flex; align-items: center; gap: 12px; margin-top: 28px; padding: 12px 8px 12px 14px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.install-banner > span .logo { width: 40px; height: 40px; }
.install-banner p { flex: 1; margin: 0; font-size: 0.9rem; line-height: 1.3; }

/* ------------------------------------------------------------- tomme tilstande, indlæsning */

.empty { text-align: center; padding: 42px 18px; display: flex; flex-direction: column; align-items: center; }
.empty-icon { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); margin-bottom: 16px; }
.empty-icon .i { width: 2.4em; height: 2.4em; stroke-width: 1.5; }
.empty h2 { font-size: 1.35rem; margin-bottom: 8px; }
.empty p { color: var(--muted); max-width: 340px; margin-bottom: 20px; }

.loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 60px 0; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- login */

.auth { max-width: 420px; margin: 0 auto; padding: calc(40px + var(--safe-t)) 18px 30px; }
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand .logo { width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 18px; box-shadow: var(--shadow); }
.auth-brand h1 { font-size: 2.3rem; margin: 0 0 6px; }
.auth-brand p { color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 14px; border-radius: 14px; background: var(--surface-2); }
.seg button { min-height: 40px; border: 0; border-radius: 11px; background: none; color: var(--muted); font: 600 0.95rem var(--sans); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.auth .empty { padding-top: 80px; }

/* ------------------------------------------------------------- læsning */

.seg-3 { grid-template-columns: repeat(3, 1fr); margin-bottom: 0; }
.seg label { position: relative; display: grid; place-items: center; min-height: 40px; border-radius: 11px; color: var(--muted); font: 600 0.92rem var(--sans); cursor: pointer; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:focus-visible) { outline: 2.5px solid var(--accent); }
.seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.card .seg button.on, .card .seg label:has(input:checked) { background: var(--accent); color: var(--accent-ink); }
.reading-since { margin: 10px 0 0; }
.readers { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 0.9rem; }
.readers .i { color: var(--accent); }
.tag.reading { background: var(--accent); color: var(--accent-ink); }
.tag.done { background: var(--surface); color: var(--accent); }
.tag.done .i { width: 1.15em; height: 1.15em; vertical-align: -0.25em; stroke-width: 2.6; }
.hscroll { display: flex; gap: 14px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 10px; scroll-snap-type: x proximity; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll .tile { flex: none; width: 96px; scroll-snap-align: start; }

/* ------------------------------------------------------------- ark og beskeder */

.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 10, 5, 0.42); opacity: 0; transition: opacity 0.22s; }
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 560px;
  max-height: 88vh;
  margin: 0 auto;
  overflow: auto;
  padding: 24px 18px calc(20px + var(--safe-b));
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet h2 { padding-right: 40px; font-size: 1.25rem; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-x { position: absolute; top: 12px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.choices { display: flex; flex-direction: column; margin-bottom: 12px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 54px; border-bottom: 1px solid var(--line); cursor: pointer; }
.other-name { margin-top: 4px; }
.form:has(input[name="who"]:not([value="other"]):checked) .other-name { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar) + var(--safe-b) + 16px);
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 24px 18px; }
  .cover-lg { width: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
