:root {
  --green: #2F7D4F;
  --green-dark: #1F5A37;
  --green-soft: #DCEFE3;
  --yellow: #F2C14E;
  --cream: #FBEFD2;
  --ink: #14211A;
  --muted: #4A5A50;
  --line: #D5DAD2;
  --bg: #F4F5F1;
  --white: #FFFFFF;
  --red: #8A3B2E;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
a:hover { color: var(--green-dark); }
h1, h2, h3 { margin: 0; letter-spacing: -0.4px; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 800; }
p { margin: 0; line-height: 1.5; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

.wrap { max-width: 520px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 16px; }
.wrap.wide { max-width: 1100px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--white); border-bottom: 1px solid #E3E6E0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--green); color: var(--yellow); display: flex; align-items: center; justify-content: center; }
.nav { display: flex; flex-wrap: wrap; gap: 6px; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 700; font-size: 14px; padding: 8px 10px; border-radius: 10px; }
.nav a.active { background: var(--green-soft); color: var(--green-dark); }

.card { background: var(--white); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card.green { background: var(--green); color: var(--white); }
.card.dark { background: var(--ink); color: var(--white); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.center { text-align: center; }
.big { font-size: 30px; font-weight: 800; }

label { font-size: 14px; font-weight: 700; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=url], select, textarea {
  width: 100%; height: 50px; border-radius: 12px; border: 1.5px solid var(--line); padding: 0 14px;
  font-family: inherit; font-size: 16px; color: var(--ink); background: var(--white);
}
textarea { height: auto; padding: 12px 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--green-soft); border-color: var(--green); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: 14px; line-height: 1.45; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--green); flex-shrink: 0; }

button, .btn {
  height: 50px; padding: 0 18px; border-radius: 12px; border: none; background: var(--green); color: var(--white);
  font-family: inherit; font-size: 16px; font-weight: 800; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:hover, .btn:hover { background: var(--green-dark); color: var(--white); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary, .btn.secondary { background: var(--white); color: var(--ink); border: 1.5px solid var(--line); }
button.secondary:hover { background: var(--bg); }
button.yellow { background: var(--yellow); color: var(--ink); }
button.danger { background: var(--white); color: var(--red); border: 1.5px solid #E2B4AA; }
button.small { height: 40px; font-size: 14px; padding: 0 14px; }

.stamps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.stamp { aspect-ratio: 1; border-radius: 99px; border: 2px dashed rgba(255,255,255,0.55); }
.stamp.on { background: var(--yellow); border: none; }
.card:not(.green) .stamp { border-color: #A9CDB6; }

.pill { display: inline-block; font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 99px; background: var(--green-soft); color: var(--green-dark); }
.pill.warn { background: var(--cream); color: #6B4800; }
.pill.red { background: #F6E1DC; color: var(--red); }

.msg { padding: 12px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.msg.ok { background: var(--green-soft); color: var(--green-dark); }
.msg.err { background: #F6E1DC; color: var(--red); }

.qr { background: var(--white); padding: 12px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.qr img, .qr canvas { width: 200px; height: 200px; image-rendering: pixelated; }
.code { font-size: 15px; font-weight: 800; letter-spacing: 2px; color: var(--ink); }

video.scanner { width: 100%; border-radius: 14px; background: #23362A; aspect-ratio: 1; object-fit: cover; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpi .big { font-size: 28px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); padding: 8px; border-bottom: 1px solid #E3E6E0; }
td { padding: 10px 8px; border-bottom: 1px solid #F0F2EE; }
.scroll { overflow-x: auto; }

@media (max-width: 480px) {
  .wrap { padding: 16px 12px 40px; }
  h1 { font-size: 23px; }
}

/* ---------- Tryckmaterial ---------- */
.print-wrap { background: #E8EAE5; min-height: 100vh; padding: 20px 12px 60px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.print-bar { max-width: 600px; width: 100%; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sheet { background: var(--white); color: var(--ink); box-shadow: 0 2px 12px rgba(0,0,0,.08); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4mm; padding: 8mm; box-sizing: border-box; }
.sheet.a6 { width: 105mm; height: 148mm; }
.sheet.a4 { width: 210mm; height: 297mm; padding: 18mm; gap: 8mm; }
.sheet.sticker { width: 120mm; height: 120mm; background: transparent; box-shadow: none; padding: 0; }
.p-brand { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13pt; color: var(--green); }
.p-brand.inv { color: var(--yellow); }
.p-title { font-size: 19pt; line-height: 1.12; font-weight: 800; letter-spacing: -0.3px; }
.p-title.xl { font-size: 40pt; }
.p-qr { width: 58mm; height: 58mm; image-rendering: pixelated; }
.p-qr.xl { width: 120mm; height: 120mm; }
.p-big { font-size: 13pt; font-weight: 800; line-height: 1.3; }
.a4 .p-big { font-size: 22pt; }
.p-small { font-size: 9.5pt; color: var(--muted); line-height: 1.4; }
.a4 .p-small { font-size: 14pt; }
.p-circle { width: 120mm; height: 120mm; border-radius: 50%; background: var(--green); color: var(--white); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2mm; border: 3mm solid var(--yellow); box-sizing: border-box; }
.p-sticker-top { font-size: 16pt; font-weight: 600; }
.p-sticker-name { font-size: 34pt; font-weight: 800; letter-spacing: -0.5px; }
.p-sticker-bottom { font-size: 13pt; color: var(--yellow); font-weight: 700; }
.staff { text-align: left; align-items: stretch; justify-content: flex-start; }
.staff h2 { font-size: 15pt; }
.staff ol { margin: 0; padding-left: 5mm; display: flex; flex-direction: column; gap: 2.5mm; font-size: 10.5pt; line-height: 1.4; }

@media print {
  @page { margin: 0; }
  body { background: #fff; }
  .no-print, .topbar { display: none !important; }
  .print-wrap { background: #fff; padding: 0; gap: 0; display: block; }
  .sheet { box-shadow: none; margin: 0 auto; page-break-after: always; break-after: page; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Runda QR-dekaler, 4 per A4 */
.sheet.sticker-sheet { width: 210mm; height: 297mm; display: grid; grid-template-columns: repeat(2, 80mm); gap: 20mm; align-content: center; justify-content: center; padding: 0; }
.p-round { width: 80mm; height: 80mm; border-radius: 50%; background: var(--white); border: 2.5mm solid var(--green); box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5mm; }
.p-round-top { display: flex; align-items: center; gap: 4px; font-size: 10pt; font-weight: 800; color: var(--green); }
.p-round-top svg { width: 14px; height: 14px; }
.p-round-qr { width: 40mm; height: 40mm; image-rendering: pixelated; }
.p-round-bottom { font-size: 8.5pt; font-weight: 800; color: var(--ink); }
