/* Lager – stylesheet */
:root {
  --bg: #f4f6f8; --card: #fff; --fg: #17202a; --muted: #6b7682; --line: #e3e7ec;
  --pri: #0f766e; --pri-fg: #fff; --pri-soft: #e6f4f2;
  --warn: #b45309; --warn-bg: #fef3c7; --bad: #b91c1c; --bad-bg: #fee2e2; --ok-bg: #dcfce7; --ok: #166534;
  --r: 12px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1418; --card: #182027; --fg: #e6eaee; --muted: #93a0ac; --line: #26313a; --pri: #14b8a6; --pri-fg: #042f2e; --pri-soft: #11302d;
    --warn: #fbbf24; --warn-bg: #3a2a07; --bad: #f87171; --bad-bg: #3b1212; --ok-bg: #0f2e1c; --ok: #86efac; }
  input, select, textarea { color-scheme: dark; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 var(--font); background: var(--bg); color: var(--fg); }
a { color: var(--pri); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
h2.inline { display: inline; }
small, .small { font-size: .85em; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.big { font-size: 1.4rem; }
.mt { margin-top: .75rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
[hidden] { display: none !important; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--fg); font-size: 1.05rem; }
.brand svg { color: var(--pri); }
.topsearch { flex: 1; max-width: 420px; }
.topsearch input { width: 100%; }
.mainnav { display: flex; gap: .25rem; }
.mainnav a { padding: .4rem .7rem; border-radius: 8px; color: var(--fg); }
.mainnav a.on, .mainnav a:hover { background: var(--pri-soft); color: var(--pri); text-decoration: none; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; padding: .35rem; border-radius: 8px; display: flex; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu .menu { position: absolute; right: 0; top: 110%; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 8px 30px rgba(0,0,0,.15); min-width: 200px; padding: .35rem; z-index: 40; }
.usermenu .menu a { display: block; padding: .5rem .75rem; border-radius: 8px; color: var(--fg); }
.usermenu .menu a:hover { background: var(--pri-soft); text-decoration: none; }
.menu-head { padding: .5rem .75rem; font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: .25rem; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.bottomnav { display: none; }

/* Mobil */
@media (max-width: 860px) {
  .mainnav, .scanbtn span { display: none; }
  .topsearch { max-width: none; }
  .brand span { display: none; }
  .wrap { padding: .75rem .75rem calc(80px + env(safe-area-inset-bottom)); }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .45rem 0 .4rem; font-size: .7rem; color: var(--muted); }
  .bottomnav a svg { width: 24px; height: 24px; }
  .bottomnav a.on { color: var(--pri); }
  .bottomnav a:hover { text-decoration: none; }
  .bottomnav a.scan svg { background: var(--pri); color: var(--pri-fg); border-radius: 50%; padding: 7px; width: 40px; height: 40px; margin-top: -16px; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
  .scanbtn { display: none !important; }
}

/* Elementer */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.cardhead h2 { margin: 0; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pagehead h1 { margin: 0; }
.actions { display: flex; gap: .5rem; align-items: center; }
.actions.flexwrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row > input, .row > select, .row > textarea { flex: 1 1 140px; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.inline { display: inline; }
form.inline { display: inline-flex; gap: .25rem; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .55rem .9rem; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none !important; white-space: nowrap; line-height: 1.2; min-height: 40px; }
.btn:hover { border-color: var(--pri); }
.btn.primary { background: var(--pri); color: var(--pri-fg); border-color: var(--pri); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-bg); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { border-color: var(--line); }
.btn.small { padding: .3rem .55rem; min-height: 32px; font-size: .88rem; }
.btn.round { width: 44px; height: 44px; border-radius: 50%; padding: 0; font-size: 1.3rem; }
.btn:disabled { opacity: .5; }

input, select, textarea { font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: .5rem .65rem; min-height: 40px; max-width: 100%; }
input[type=checkbox], input[type=radio] { min-height: 0; width: 18px; height: 18px; accent-color: var(--pri); }
input[type=color] { padding: 2px; width: 48px; }
input[type=range] { padding: 0; accent-color: var(--pri); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pri); outline-offset: -1px; border-color: var(--pri); }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; font-size: .92rem; }
label > small { font-weight: 400; }
.lbl { display: block; font-weight: 500; font-size: .92rem; margin-bottom: .3rem; }
label.check { flex-direction: row; align-items: center; gap: .45rem; font-weight: 400; cursor: pointer; }
.optgroup { display: flex; flex-wrap: wrap; gap: .35rem 1rem; }
.input-suffix { display: flex; align-items: center; gap: .4rem; }
.input-suffix input { flex: 1; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem 1rem; align-content: start; }
.formgrid > h2, .formgrid > h3 { margin: .25rem 0 0; }
.formgrid .span2 { grid-column: 1 / -1; }
.formgrid .cf { display: flex; flex-direction: column; }
.formgrid .cf > input, .formgrid .cf > select, .formgrid .cf > textarea { width: 100%; }
@media (max-width: 560px) { .formgrid { grid-template-columns: 1fr; } }
.formgrid.boxed { margin-top: 1rem; padding: 1rem; border: 1px dashed var(--line); border-radius: var(--r); }
details > summary { cursor: pointer; }
.small-label { font-weight: 400; }
.small-label input { margin-top: .4rem; width: 100%; }

.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; background: var(--ok-bg); color: var(--ok); }
.flash.bad { background: var(--bad-bg); color: var(--bad); }
.warnbox { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; background: var(--warn-bg); color: var(--warn); }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; background: var(--line); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.chip { --c: #64748b; display: inline-flex; align-items: center; gap: .3rem; padding: .08rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); white-space: nowrap; }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.count { display: inline-block; min-width: 1.6em; text-align: center; padding: 0 .4rem; border-radius: 999px; background: var(--line); font-size: .78rem; color: var(--muted); }
.qty { font-weight: 600; white-space: nowrap; }
.qty.low { color: var(--warn); }
.stars { color: #f59e0b; letter-spacing: 1px; }
.swatch { display: inline-block; width: 1em; height: 1em; border-radius: 4px; vertical-align: -2px; border: 1px solid var(--line); }

/* Statistik */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: 1rem; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: .85rem 1rem; color: var(--fg); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stat:hover { border-color: var(--pri); text-decoration: none; }
.stat b { font-size: 1.7rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.warn b { color: var(--warn); }
.stat.bad b { color: var(--bad); }

/* Lister */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .6rem; padding: .55rem 0; }
.list li:last-child { border-bottom: 0; }
.list li > a { display: flex; align-items: center; gap: .6rem; color: var(--fg); flex: 1; min-width: 0; }
.list li > a:hover { text-decoration: none; }
.list li > a:hover b { color: var(--pri); }
.list.compact li { padding: .35rem 0; }

/* Fliser */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.tiles.large { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
@media (max-width: 560px) { .tiles, .tiles.large { grid-template-columns: repeat(2, 1fr); gap: .5rem; } }
.tile { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; color: var(--fg); box-shadow: var(--shadow); }
.tile > a { color: var(--fg); display: flex; flex-direction: column; height: 100%; }
.tile:hover, .tile > a:hover { text-decoration: none; border-color: var(--pri); }
.tile .thumb { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--bg); }
.tile-body { padding: .55rem .7rem .7rem; display: flex; flex-direction: column; gap: .15rem; }
.tile-body b { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile-body small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-top: .25rem; font-size: .85rem; }
.tile-sel { position: absolute; top: .4rem; left: .4rem; z-index: 2; background: var(--card); border-radius: 6px; padding: 3px; display: flex; opacity: .85; }
.thumb.noimg { display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--bg); }
.thumb.noimg svg { width: 40%; max-width: 64px; opacity: .5; }
.thumb.sm { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; aspect-ratio: auto; }
.thumb.xl { width: 100%; aspect-ratio: 1; border-radius: var(--r); }

/* Filtre */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .65rem; }
.filters input[type=search] { flex: 1 1 200px; }
.filters select { flex: 0 1 180px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--card); }
.seg a { padding: .45rem .75rem; color: var(--fg); border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--pri); color: var(--pri-fg); }
.seg a:hover { text-decoration: none; }
.selbar { position: sticky; top: 58px; z-index: 20; display: flex; gap: .75rem; align-items: center; background: var(--pri-soft); border: 1px solid var(--pri); padding: .5rem .75rem; border-radius: var(--r); margin-bottom: .75rem; }
@media (max-width: 860px) { .selbar { position: fixed; top: auto; bottom: calc(70px + env(safe-area-inset-bottom)); left: .75rem; right: .75rem; } }
.pager { display: flex; flex-wrap: wrap; gap: .25rem; justify-content: center; }
.pager a { padding: .35rem .65rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); }
.pager a.on { background: var(--pri); color: var(--pri-fg); }

/* Tabeller */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card.tablewrap { padding: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table .w1 { width: 1%; }
.table td input:not([type=checkbox]):not([type=color]) { width: 100%; }
.table tr.dim td { opacity: .5; }
.usebatch input { width: 3.5em; min-height: 32px; padding: .25rem .4rem; text-align: right; }

/* Ting-visning */
.itemhead { display: grid; grid-template-columns: 220px 1fr auto; gap: 1.25rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.itemhead:not(:has(.itemhead-img)) { grid-template-columns: 1fr auto; }
.itemhead-img img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r); display: block; }
.itemhead-body { display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.itemhead-body h1 { word-break: break-word; }
.meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: .25rem; }
.stockbox { display: flex; align-items: center; gap: 1rem; justify-content: space-between; background: var(--bg); border-radius: var(--r); padding: .6rem .8rem; max-width: 420px; }
.stockbox.low { background: var(--warn-bg); }
.stock-num { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stock-num small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.qtyform { display: flex; gap: .4rem; align-items: center; }
.qrbox { display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center; }
.qrbox canvas { border-radius: 8px; background: #fff; width: 140px; height: 140px; image-rendering: pixelated; }
.qrbox small { max-width: 160px; word-break: break-all; }
@media (max-width: 860px) {
  .itemhead { grid-template-columns: 1fr; gap: .9rem; }
  .itemhead-img img, .itemhead-img .thumb.xl { aspect-ratio: 16/10; max-height: 240px; }
  .stockbox { max-width: none; }
  .itemhead-img:has(.noimg) { display: none; }
  .itemhead .qrbox { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; text-align: left; }
  .qrbox canvas { width: 96px; height: 96px; }
  .itemhead-body .actions .btn { flex: 1 1 auto; }
}
.props { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.props > div { display: contents; }
.props dt { color: var(--muted); }
.props dd { margin: 0; word-break: break-word; }
.desc { white-space: normal; margin-top: 0; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.gallery figure { margin: 0; position: relative; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.gallery figcaption { display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.dropzone { position: relative; border: 2px dashed var(--line); border-radius: var(--r); padding: 1rem; text-align: center; cursor: pointer; color: var(--muted); font-weight: 500; }
.dropzone:hover { border-color: var(--pri); color: var(--pri); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dropzone.busy { opacity: .6; pointer-events: none; }
.dropzone.busy span::after { content: ' – uploader…'; }
.previews { display: flex; flex-wrap: wrap; gap: .4rem; }
.previews img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.log { list-style: none; padding: 0; margin: .5rem 0 0; }
.log li { padding: .4rem 0; border-bottom: 1px solid var(--line); }

.stickybar { position: sticky; bottom: 0; display: flex; gap: .5rem; flex-wrap: wrap; padding: .75rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 -4px 16px rgba(0,0,0,.06); z-index: 10; }
@media (max-width: 860px) { .stickybar { bottom: calc(64px + env(safe-area-inset-bottom)); padding: .5rem; gap: .35rem; flex-wrap: nowrap; } .stickybar .btn { flex: 1 1 auto; padding: .5rem .4rem; font-size: .85rem; } .stickybar .btn.ghost { display: none; } }

/* Bedømmelse */
.rating-input { align-self: flex-start; display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.rating-input input { display: none; }
.rating-input label { font-size: 1.6rem; color: var(--line); cursor: pointer; display: inline; }
.rating-input input:checked ~ label, .rating-input label:hover, .rating-input label:hover ~ label { color: #f59e0b; }

/* Lokationstræ */
.tree { list-style: none; margin: 0; padding-left: 1.2rem; border-left: 1px dashed var(--line); }
.tree.root { padding-left: 0; border-left: 0; }
.tree-row { display: flex; align-items: center; gap: .4rem; padding: .3rem 0; }
.tree-row a { color: var(--fg); font-weight: 500; }
.tree-sel { display: inline-flex; }

/* Login */
.auth { max-width: 380px; margin: 10vh auto; }
.empty { text-align: center; padding: 2rem 1rem; }

/* Lightbox og modal */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 100; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 96vw; max-height: 92vh; object-fit: contain; }
.lightbox .btn { position: absolute; top: 1rem; right: 1rem; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-box { background: var(--card); border-radius: var(--r); padding: 1rem; width: 100%; max-width: 520px; max-height: 95vh; overflow: auto; }

/* Scanner */
.reader { width: 100%; min-height: 60px; border-radius: var(--r); overflow: hidden; background: #000; }
.reader:empty { display: none; }
.reader video { width: 100% !important; display: block; }
.scanpage { max-width: 620px; margin: 0 auto; }

/* Labels */
.labelui { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; align-items: start; }
@media (max-width: 860px) { .labelui { grid-template-columns: 1fr; } .labelmain { order: -1; } .lblprev canvas { width: 100% !important; } }
.labelopts { display: flex; flex-direction: column; gap: .6rem; }
.labelopts h3 { margin: .5rem 0 0; }
.labelmain .sticky { position: sticky; top: 64px; z-index: 5; }
.previews-labels { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }
.lblprev { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: .75rem; overflow-x: auto; }
.lblprev canvas { display: block; image-rendering: pixelated; box-shadow: 0 0 0 1px #ccc, 0 2px 8px rgba(0,0,0,.15); border-radius: 3px; background: #fff; height: auto; }
.lblprev figcaption { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--muted); margin-top: .4rem; }
#printarea { display: none; }

@media print {
  body.labelprint > *:not(#printarea) { display: none !important; }
  .topbar, .bottomnav, .actions, .btn { display: none !important; }
  body { background: #fff; margin: 0; }
  body.labelprint #printarea { display: block !important; }
  .plabel { display: flex; align-items: center; justify-content: center; overflow: hidden; break-after: page; page-break-after: always; }
  .plabel:last-child { break-after: auto; page-break-after: auto; }
  .plabel img { display: block; image-rendering: pixelated; }
}

/* Batch-side */
.batchhead-top { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.batchhead-top h1 { margin: 0; }
.thumb.md { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; flex: none; aspect-ratio: auto; }
.batchfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .75rem; background: var(--bg); border-radius: var(--r); padding: .8rem; margin-bottom: 1rem; }
.batchfacts > div { display: flex; flex-direction: column; gap: .2rem; min-width: 0; overflow-wrap: anywhere; }
.bignum { font-size: 1.8rem; line-height: 1.1; }
.bignum small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.quickuse { display: flex; flex-direction: column; gap: .6rem; }
.big-btn { width: 100%; min-height: 56px; font-size: 1.15rem; }
.batchhead.is-empty .batchfacts { opacity: .6; }
.qrbox.left { flex-direction: row; align-items: flex-start; text-align: left; gap: 1rem; }
.qrbox.left canvas { flex: none; }
.list li.dim { opacity: .55; }
.gs1info { background: var(--pri-soft); border-radius: 10px; padding: .55rem .75rem; }

/* Sikkerhed */
.ok-badge { background: var(--ok-bg); color: var(--ok); }
.codeinput { font-size: 1.4rem; letter-spacing: .25em; text-align: center; }
.totpqr { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; margin: .75rem 0; }
.totpqr canvas { background: #fff; border-radius: 10px; width: 200px; height: 200px; image-rendering: pixelated; padding: 6px; }
.secret { font-size: 1rem; word-break: break-all; background: var(--bg); padding: .4rem .6rem; border-radius: 8px; }
.steps { padding-left: 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem 2.2rem; font-size: 1.05rem; padding-left: 2.2rem; margin: .5rem 0 1rem; }
.recovery { border-color: var(--pri); }
.warntext { color: var(--warn); }
.dangertext { color: var(--bad); }
.userlist li { flex-wrap: wrap; row-gap: .4rem; }
.userlist li > .grow { flex-basis: 260px; }
.userlist li form input { width: 9.5em; min-height: 32px; padding: .3rem .5rem; }

/* ===== v4 ===== */
.menu-sep { height: 1px; background: var(--line); margin: .3rem 0; }
.usermenu .menu { max-height: 80vh; overflow-y: auto; }
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown .menu { position: absolute; right: 0; top: 110%; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 8px 30px rgba(0,0,0,.15); min-width: 210px; padding: .35rem; z-index: 40; }
.itemhead .dropdown .menu { left: 0; right: auto; }
.dropdown .menu a, .dropdown .menu button { display: block; width: 100%; text-align: left; padding: .55rem .75rem; border-radius: 8px; color: var(--fg); background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown .menu a:hover, .dropdown .menu button:hover { background: var(--pri-soft); text-decoration: none; }
.dropdown .menu form { display: block; margin: 0; }
.chip.tag::before { display: none; }
a:hover > .chip { text-decoration: none; filter: brightness(.95); }
.subsection { border: 1px solid var(--line); border-radius: var(--r); padding: .6rem .8rem; }
.subsection > summary { padding: .2rem 0; }
pre.code { background: var(--bg); padding: .6rem .8rem; border-radius: 8px; font: .85rem var(--mono); overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: .4rem 0 .8rem; }
.settingsnav { margin-bottom: 1rem; flex-wrap: wrap; }
/* Indkøb */
.checkbtn { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--muted); background: transparent; cursor: pointer; flex: none; padding: 0; }
.checkbtn:hover { border-color: var(--pri); }
.checkbtn.on { background: var(--pri); border-color: var(--pri); position: relative; }
.checkbtn.on::after { content: '✓'; color: var(--pri-fg); font-weight: 700; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.shoplist li { padding: .6rem 0; }
.basketrow { flex-wrap: wrap; }
.receiveform { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; background: var(--bg); padding: .6rem; border-radius: 10px; }
.receiveform label { flex: 1 1 110px; }
.receiveform .span-all { flex-basis: 100%; }
.suggest { border-color: var(--warn); }
/* Optælling */
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: .5rem; }
.progress span { display: block; height: 100%; background: var(--pri); transition: width .3s; }
.stlast { margin-top: .6rem; padding: .6rem .8rem; border-radius: 10px; background: var(--pri-soft); font-weight: 600; }
.stlast.elsewhere { background: var(--warn-bg); color: var(--warn); }
.stlast.unknown { background: var(--bad-bg); color: var(--bad); }
.countform input { width: 4.5em; min-height: 32px; padding: .25rem .4rem; text-align: right; }
/* Roller: kun-læse-brugere ser ikke redigeringsknapper */
body.role-viewer:not(.page-security) form[method=post]:not(.viewer-ok), body.role-viewer .edit-only, body.role-viewer a[href*="p=item_edit"], body.role-viewer .btn.primary[href*="new"] { display: none !important; }
@media (min-width: 861px) { .stats { grid-template-columns: repeat(4, 1fr); } }

.scanmodes { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }
.scanmodes label { display: block; }
.scanmodes input { position: absolute; opacity: 0; pointer-events: none; }
.scanmodes span { display: flex; align-items: center; justify-content: center; padding: .55rem .3rem; border: 1px solid var(--line); border-radius: 9px; font-weight: 500; font-size: .88rem; cursor: pointer; text-align: center; background: var(--card); }
.scanmodes input:checked + span { background: var(--pri); color: var(--pri-fg); border-color: var(--pri); }
.movetarget { margin-top: .5rem; padding: .5rem .7rem; border-radius: 9px; background: var(--warn-bg); color: var(--warn); }
.big-drop { padding: 2.2rem 1rem; font-size: 1.2rem; }
.tile-tags { display: flex; flex-wrap: wrap; gap: .2rem; margin-top: .15rem; }
.tile-tags .chip { font-size: .7rem; padding: 0 .4rem; }
.bulkmenu { min-width: 290px; }
.bulkmenu .bulkrow { display: flex; gap: .35rem; padding: .3rem .4rem; align-items: center; }
.bulkmenu .bulkrow select, .bulkmenu .bulkrow input { flex: 1; min-height: 34px; padding: .3rem .5rem; min-width: 0; }
.selbar .dropdown .menu { left: 0; right: auto; }
@media (max-width: 860px) { .selbar .dropdown .menu { bottom: 110%; top: auto; } }
.lookupresult { display: flex; gap: .6rem; align-items: center; background: var(--pri-soft); padding: .5rem .7rem; border-radius: 9px; font-weight: 400; }
.lookupimg { width: 48px; height: 48px; object-fit: contain; background: #fff; border-radius: 6px; }

.offlinebar { position: sticky; top: 0; z-index: 50; background: var(--warn-bg); color: var(--warn); padding: .5rem 1rem; text-align: center; font-weight: 600; font-size: .9rem; }
/* Offentlig visning */
.publicview { max-width: 560px; }
.publicimg { width: 100%; max-height: 360px; object-fit: cover; border-radius: var(--r); margin-bottom: 1rem; }
.contactbox { background: var(--pri-soft); border-radius: var(--r); padding: .9rem 1rem; font-weight: 600; margin-top: 1rem; }
/* Værdi */
.bars { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .55rem; }
.bars li { display: grid; grid-template-columns: minmax(0, 1.2fr) 1fr auto; gap: .6rem; align-items: center; font-size: .9rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--pri); border-radius: 99px; }
.importmap th { vertical-align: top; min-width: 150px; }
.importmap select { width: 100%; font-size: .85rem; min-height: 34px; }
.printonly { display: none; }
@media print {
  .noprint { display: none !important; }
  .printonly { display: block; }
  body:not(.labelprint) .wrap { padding: 0; max-width: none; }
  .report .thumb.sm { width: 36px; height: 36px; }
  .report h2 { break-after: avoid; margin-top: 1.2rem; }
  .reporttable tr { break-inside: avoid; }
  .card { box-shadow: none; border: 0; }
}
.batchfacts .badge { white-space: normal; }

@media (max-width: 560px) {
  .loanlist li, .tasklist li { flex-wrap: wrap; row-gap: .45rem; }
  .loanlist li > .grow, .tasklist li > .grow { flex-basis: calc(100% - 60px); }
  .tasklist li > .badge { margin-left: 0; }
  .selbar .dropdown { position: static; }
  .selbar .dropdown .menu { position: fixed; left: .75rem; right: .75rem; bottom: calc(130px + env(safe-area-inset-bottom)); top: auto; min-width: 0; }
}
.dropdown .menu .bulkrow button { width: auto; flex: none; display: inline-flex; padding: .3rem .6rem; border: 1px solid var(--line); background: var(--card); }
.dropdown .menu .bulkrow button:hover { border-color: var(--pri); }
.selbar { flex-wrap: wrap; gap: .5rem; }
.dropdown .menu button.dangertext { color: var(--bad); }

/* Opsætning & systemtjek */
.ck { text-indent: 0; line-height: 1; display: inline-flex; width: 1.5em; height: 1.5em; border-radius: 50%; align-items: center; justify-content: center; font-size: .85em; font-weight: 700; vertical-align: -.1em; margin-right: .2em; flex: none; }
.ck.ok { background: var(--ok-bg); color: var(--ok); }
.ck.warn { background: var(--warn-bg); color: var(--warn); }
.ck.bad { background: var(--bad-bg); color: var(--bad); }
.checkitem h2 { display: flex; align-items: center; gap: .3rem; }
.checklist { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.checklist li { display: block; padding-left: 1.9em; text-indent: -1.9em; }
.checklist .mono { overflow-wrap: anywhere; }
.tabs .seg { margin-bottom: .75rem; flex-wrap: wrap; }
.tabs ol { padding-left: 1.2rem; }
.tabs ol li { margin-bottom: .6rem; }
.setupbanner { display: flex; gap: .75rem; align-items: center; background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); border-radius: var(--r); padding: .7rem 1rem; margin-bottom: 1rem; text-decoration: none !important; }
.setupbanner .btn { flex: none; }
.infobox { background: var(--pri-soft); border-radius: 10px; padding: .6rem .8rem; margin: 0; }
.optgroup.col { flex-direction: column; gap: .5rem; }
.big-check { font-size: 1rem; padding: .3rem 0; }

.backuplist li { flex-wrap: wrap; row-gap: .4rem; }
.backuplist li > .grow { flex-basis: 100%; overflow-wrap: anywhere; }
@media (min-width: 700px) { .backuplist li > .grow { flex-basis: auto; } }

/* Dropdown-menuer: på mobil som et panel fra bunden, så de altid er synlige */
@media (max-width: 860px) {
  .dropdown[open] > .menu {
    position: fixed; left: .75rem; right: .75rem; top: auto; min-width: 0;
    bottom: calc(76px + env(safe-area-inset-bottom));
    max-height: calc(100vh - 160px); overflow-y: auto; z-index: 61;
    border-radius: 16px; padding: .5rem; box-shadow: 0 -8px 40px rgba(0,0,0,.25);
    animation: sheetup .15s ease-out;
  }
  .dropdown[open]::before { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 60; }
  .dropdown[open] > .menu a, .dropdown[open] > .menu button { padding: .8rem .9rem; font-size: 1rem; }
  .selbar .dropdown[open] > .menu { bottom: calc(130px + env(safe-area-inset-bottom)); }
}
@keyframes sheetup { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
/* På computer: vend menuen opad, hvis der ikke er plads nedenunder */
.dropdown .menu.up { top: auto; bottom: 110%; }
