/* Tryggdigital – designsystem */
:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --ink: #14231c;
  --ink-2: #4b5a52;
  --muted: #6b7770;
  --line: #e4dfd3;
  --forest: #0f3d2e;
  --forest-2: #175c44;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --berry: #e11d48;
  --berry-2: #be123c;
  --berry-soft: #ffe4e9;
  --orange: #ea580c;
  --orange-soft: #ffedd5;
  --blue: #2563eb;
  --slate: #334155;
  --danger: #dc2626;
  --gold: #f59e0b;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(20, 35, 28, .06), 0 6px 24px rgba(20, 35, 28, .07);
  --shadow-lg: 0 10px 40px rgba(20, 35, 28, .18);
  --tap: 56px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent; min-height: 100vh; overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.15; letter-spacing: -.01em; }
p { margin: 0 0 .6em; }
a { color: var(--forest-2); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .02em; }
.boot { display: grid; place-items: center; min-height: 100vh; font-weight: 700; color: var(--forest); }
[hidden] { display: none !important; }

/* ---------- Topplinje ---------- */
.topbar {
  position: sticky; top: 0; z-index: 500; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--forest); color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}
.topbar.role-picker { background: linear-gradient(120deg, #0f3d2e, #14532d); }
.topbar.role-sprayer { background: linear-gradient(120deg, #0f3d2e, #1e3a5f); }
.topbar.role-admin { background: #13261f; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.brand img { border-radius: 10px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.1rem; letter-spacing: .01em; }
.brand-text small { opacity: .75; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.lang-btn, .home-btn {
  min-height: 48px; min-width: 48px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .1);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; font: inherit; font-weight: 700;
  text-decoration: none; font-size: 1rem; cursor: pointer; transition: background .15s, transform .1s;
}
.home-btn { font-size: 1.5rem; padding: 0; }
.lang-btn:active, .home-btn:active { transform: scale(.95); background: rgba(255, 255, 255, .2); }
.flag { font-size: 1.4rem; line-height: 1; }
.flag.big { font-size: 2.4rem; }

/* ---------- Knapper ---------- */
.btn {
  --b: var(--surface); --c: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px; border-radius: 14px;
  border: 1px solid transparent; background: var(--b); color: var(--c); font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  transition: transform .08s ease, box-shadow .15s, background .15s, filter .15s; user-select: none; white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { --b: var(--forest-2); --c: #fff; box-shadow: 0 4px 14px rgba(23, 92, 68, .3); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.light { --b: var(--surface); --c: var(--ink); border-color: var(--line); }
.btn.light:hover { background: var(--surface-2); }
.btn.ghost { --b: transparent; --c: var(--ink-2); }
.btn.ghost:hover { background: rgba(0, 0, 0, .04); }
.btn.danger { --b: var(--danger); --c: #fff; }
.btn.danger-light { --b: #fff1f1; --c: var(--danger); border-color: #fecaca; }
.btn.ghost-light { --b: rgba(255, 255, 255, .12); --c: #fff; border-color: rgba(255, 255, 255, .3); }
.btn.tripletex { --b: #1f2a6b; --c: #fff; box-shadow: 0 4px 14px rgba(31, 42, 107, .3); }
.btn.authority { --b: #1e3a5f; --c: #fff; box-shadow: 0 4px 14px rgba(30, 58, 95, .3); width: 100%; }
.btn.small { min-height: 40px; padding: 0 12px; font-size: .9rem; }
.btn.xl { min-height: 60px; font-size: 1.1rem; padding: 0 22px; border-radius: 16px; }
.btn.xxl { min-height: 76px; font-size: 1.35rem; padding: 0 28px; border-radius: 20px; width: 100%; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1.05rem;
  display: inline-grid; place-items: center; color: var(--ink-2); transition: background .15s, transform .08s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.93); }
.icon-btn.danger { color: var(--danger); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Kort og skjema ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 1px solid rgba(0, 0, 0, .03); }
.card h3 { font-size: 1.1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.callout { background: linear-gradient(135deg, #ecfdf5, #fff); border: 1px solid #bbf7d0; }
.callout ol { padding-left: 1.2em; margin: 0 0 14px; }
.callout li { margin-bottom: 4px; }
.input {
  width: 100%; min-height: 50px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font: inherit; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--forest-2); box-shadow: 0 0 0 4px rgba(23, 92, 68, .15); }
.input.big { min-height: 58px; font-size: 1.15rem; }
textarea.input { min-height: 80px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 650; font-size: .95rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-grid { display: flex; flex-direction: column; gap: 16px; }
.form-2, .form-3 { display: grid; gap: 16px; grid-template-columns: 1fr; }
.input-unit { display: flex; align-items: center; gap: 8px; }
.input-unit em { font-style: normal; color: var(--muted); font-weight: 600; white-space: nowrap; }
.example { margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: #fffbeb; border: 1px solid #fde68a; color: #78350f; }
.label { font-weight: 650; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: #eef1ef; color: var(--ink-2); font-size: .82rem; font-weight: 650; white-space: nowrap; }
.pill.green { background: var(--green-soft); color: #166534; }
.pill.berry { background: var(--berry-soft); color: var(--berry-2); }
.pill.slate { background: #e2e8f0; color: var(--slate); }
.pill.tiny { font-size: .7rem; padding: 1px 6px; margin-left: 6px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty > span { font-size: 2.6rem; display: block; margin-bottom: 6px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink-2);
}
.chip.on { background: var(--forest-2); border-color: var(--forest-2); color: #fff; }
.chip strong { margin-right: 2px; }

/* ---------- Forside ---------- */
.home { max-width: 980px; margin: 0 auto; padding: 28px 16px 40px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3rem); }
.hero p { color: var(--ink-2); font-size: 1.15rem; }
.role-grid { display: grid; gap: 16px; margin-top: 22px; }
.role-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 22px; border-radius: 24px; color: #fff; text-decoration: none;
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden; min-height: 128px; transition: transform .12s;
}
.role-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.role-card:active { transform: scale(.98); }
.role-card h2 { font-size: 1.6rem; margin: 0 0 4px; }
.role-card p { margin: 0; opacity: .9; }
.role-card.berry { background: linear-gradient(135deg, #e11d48, #9f1239); }
.role-card.leaf { background: linear-gradient(135deg, #1d4ed8, #0f3d2e); }
.role-card.slate { background: linear-gradient(135deg, #1f2937, #0f3d2e); }
.role-icon { font-size: 2.6rem; width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; background: rgba(255, 255, 255, .16); }
.role-arrow { font-size: 1.8rem; opacity: .85; }
.home-note { margin-top: 24px; color: var(--muted); font-size: .92rem; text-align: center; }

/* ---------- Plukker ---------- */
.picker { max-width: 760px; margin: 0 auto; padding: 22px 16px 40px; }
.picker-head h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); margin-bottom: 4px; }
.picker-head p { color: var(--ink-2); font-size: 1.1rem; }
.action-stack { display: grid; gap: 16px; margin: 18px 0; }
.action-btn {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; width: 100%; min-height: 128px; padding: 18px 22px; border: 0; border-radius: 28px;
  color: #fff; font: inherit; text-align: left; cursor: pointer; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
  transition: transform .1s ease, box-shadow .2s;
}
.action-btn::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, .14), transparent 60%); pointer-events: none; }
.action-btn:active { transform: scale(.97); box-shadow: 0 4px 16px rgba(0, 0, 0, .2); }
.action-btn.green { background: linear-gradient(135deg, #16a34a, #166534); }
.action-btn.berry { background: linear-gradient(135deg, #f43f5e, #be123c); min-height: 150px; }
.action-btn.orange { background: linear-gradient(135deg, #f97316, #c2410c); }
.a-icon { font-size: 2.8rem; width: 84px; height: 84px; border-radius: 24px; display: grid; place-items: center; background: rgba(255, 255, 255, .18); }
.a-text { display: flex; flex-direction: column; gap: 2px; }
.a-text strong { font-size: clamp(1.5rem, 5.4vw, 2rem); line-height: 1.1; }
.a-text small { font-size: 1.05rem; opacity: .9; }
.a-scan { font-size: 2rem; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; border: 2px solid rgba(255, 255, 255, .5); }
.team-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.team-strip > div { background: var(--surface); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.team-strip strong { font-size: 1.8rem; color: var(--forest-2); }
.team-strip span { color: var(--muted); font-size: .92rem; }
.my-stats { width: 100%; margin-top: 14px; min-height: 60px; font-size: 1.1rem; border: 1.5px dashed var(--line); }

/* Antall-ark */
.count-sheet { position: fixed; inset: 0; z-index: 2000; background: radial-gradient(circle at 50% 0%, #17402f, #07140e 70%); color: #fff; display: grid; place-items: center; padding: 20px; animation: fade .2s; overflow-y: auto; }
.count-inner { width: min(560px, 100%); display: flex; flex-direction: column; gap: 18px; text-align: center; }
.count-inner h1 { font-size: 2rem; }
.who { font-size: 1.3rem; font-weight: 700; opacity: .9; margin: 0; }
.stepper { display: grid; grid-template-columns: 1fr 1.2fr 1fr; align-items: center; gap: 12px; }
.step-btn { height: 110px; border-radius: 28px; border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-size: 3.4rem; font-weight: 300; cursor: pointer; transition: transform .08s, background .15s; }
.step-btn:active { transform: scale(.94); background: rgba(255, 255, 255, .25); }
.step-btn.small { height: 52px; width: 52px; border-radius: 14px; font-size: 1.8rem; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.step-btn:disabled { opacity: .4; }
.stepper-value { font-size: 5.5rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.quick-counts { display: flex; justify-content: center; gap: 10px; }
.chip-btn { width: 64px; height: 64px; border-radius: 18px; border: 1.5px solid rgba(255, 255, 255, .3); background: transparent; color: #fff; font: inherit; font-size: 1.4rem; font-weight: 700; cursor: pointer; }
.chip-btn:active { background: rgba(255, 255, 255, .2); }

/* Gamification */
.game-panel { display: grid; grid-template-columns: 1fr; justify-items: center; text-align: center !important; gap: 18px; align-items: center; background: rgba(255, 255, 255, .08); border-radius: 24px; padding: 18px; text-align: left; }
.ring { position: relative; width: 132px; height: 132px; }
.ring-svg, .ring svg { display: block; width: 100%; height: 100%; }
.ring svg { transform: rotate(-90deg); }
.check-wrap { display: grid; place-items: center; }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, .15); stroke-width: 12; }
.ring-fg { fill: none; stroke: #fb7185; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-label strong { font-size: 2.4rem; line-height: 1; }
.ring-label span { font-size: .78rem; opacity: .8; text-align: center; max-width: 90px; }
.badge-chip { display: inline-flex; align-items: center; gap: 8px; background: rgba(250, 204, 21, .18); color: #fde68a; padding: 6px 14px; border-radius: 999px; font-weight: 700; margin-bottom: 8px; }
.badge-icon { font-size: 1.3rem; }
.next { opacity: .9; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.mini-stats div { background: rgba(255, 255, 255, .08); border-radius: 14px; padding: 8px; text-align: center; display: flex; flex-direction: column; }
.mini-stats strong { font-size: 1.4rem; }
.mini-stats span { font-size: .75rem; opacity: .75; }
.badge-wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge-tile { border-radius: 18px; padding: 12px 6px; background: rgba(255, 255, 255, .06); display: flex; flex-direction: column; align-items: center; gap: 2px; filter: grayscale(1); opacity: .45; }
.badge-tile.have { filter: none; opacity: 1; background: rgba(250, 204, 21, .16); }
.badge-tile span { font-size: 2rem; }
.badge-tile em { font-style: normal; font-size: .75rem; opacity: .7; }

/* ---------- Fullskjerm resultat ---------- */
.big-result { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 24px; color: #fff; opacity: 0; transition: opacity .25s; overflow: hidden; text-align: center; }
.big-result.show { opacity: 1; }
.big-result.success { background: radial-gradient(circle at 50% 30%, #22c55e, #14532d 75%); }
.big-result.error { background: radial-gradient(circle at 50% 30%, #f97316, #9a3412 75%); }
.big-inner { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 560px; transform: scale(.9); transition: transform .35s cubic-bezier(.2, 1.4, .4, 1); }
.big-result.show .big-inner { transform: scale(1); }
.big-inner h1 { font-size: clamp(1.8rem, 7vw, 2.6rem); margin: 10px 0 6px; }
.big-inner p { font-size: 1.15rem; margin: 0; opacity: .95; }
.big-inner .btn { margin-top: 22px; min-width: 220px; }
.big-icon { width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .18); display: grid; place-items: center; font-size: 4rem; font-weight: 800; }
.checkmark { width: 92px; height: 92px; }
.checkmark circle { stroke: #fff; stroke-width: 3; stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw .5s .1s forwards; }
.checkmark path { stroke: #fff; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 50; stroke-dashoffset: 50; animation: draw .35s .5s forwards; }
.big-number { font-size: clamp(3rem, 14vw, 5rem) !important; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; margin: 4px 0 !important; }
.label-light, .who-light { opacity: .85; font-weight: 600; }
.result-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.result-stats > div { background: rgba(255, 255, 255, .16); border-radius: 16px; padding: 10px 16px; display: flex; flex-direction: column; min-width: 110px; }
.result-stats strong { font-size: 1.5rem; }
.result-stats span { font-size: .85rem; opacity: .85; }
.cheer { width: 100%; font-weight: 700; }
.result-extra { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 10px; }
.new-badge { display: flex; align-items: center; gap: 10px; background: rgba(250, 204, 21, .25); border: 1.5px solid rgba(253, 230, 138, .7); padding: 10px 18px; border-radius: 18px; animation: pop .6s cubic-bezier(.2, 1.6, .4, 1); }
.new-badge span { font-size: 2rem; }
.new-badge em { font-style: normal; }
.warn-light { background: rgba(0, 0, 0, .2); padding: 8px 14px; border-radius: 12px; }
.code-pill { font-family: ui-monospace, monospace; background: rgba(0, 0, 0, .2); padding: 6px 14px !important; border-radius: 10px; }
.confetti { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 16px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: .9; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Skanner ---------- */
.scanner { position: fixed; inset: 0; z-index: 2500; background: #050d09; color: #fff; display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 16px); gap: 14px; animation: fade .15s; }
.scanner.green { --accent: #4ade80; } .scanner.berry { --accent: #fb7185; } .scanner.orange { --accent: #fb923c; }
.scan-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.scan-title { display: flex; flex-direction: column; }
.scan-title strong { font-size: 1.6rem; }
.scan-title span { opacity: .8; }
.scan-tool { width: 56px; height: 56px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .1); font-size: 1.6rem; }
.scan-body { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.scan-view { position: relative; flex: 1; border-radius: 24px; overflow: hidden; background: #000; min-height: 240px; }
.scan-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; left: 50%; top: 50%; width: min(72vw, 340px); aspect-ratio: 1; transform: translate(-50%, -50%); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); border-radius: 24px; }
.scan-frame > span { position: absolute; width: 44px; height: 44px; border: 6px solid var(--accent, #4ade80); }
.scan-frame > span:nth-child(1) { left: -3px; top: -3px; border-right: 0; border-bottom: 0; border-top-left-radius: 24px; }
.scan-frame > span:nth-child(2) { right: -3px; top: -3px; border-left: 0; border-bottom: 0; border-top-right-radius: 24px; }
.scan-frame > span:nth-child(3) { left: -3px; bottom: -3px; border-right: 0; border-top: 0; border-bottom-left-radius: 24px; }
.scan-frame > span:nth-child(4) { right: -3px; bottom: -3px; border-left: 0; border-top: 0; border-bottom-right-radius: 24px; }
.scan-laser { position: absolute; left: 8%; right: 8%; height: 3px; top: 10%; background: var(--accent, #4ade80); box-shadow: 0 0 16px var(--accent, #4ade80); border-radius: 3px; animation: laser 1.8s ease-in-out infinite alternate; }
@keyframes laser { to { top: 88%; } }
.scanner.hit .scan-frame { box-shadow: 0 0 0 100vmax rgba(34, 197, 94, .5); }
.scan-status { text-align: center; font-size: 1.1rem; font-weight: 600; opacity: .9; }
.scan-status.error { color: #fdba74; }
.scan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.manual-form { display: flex; flex-direction: column; gap: 14px; margin: auto 0; width: 100%; max-width: 520px; align-self: center; }
.manual-form .input { text-align: center; font-size: 1.6rem; letter-spacing: .08em; }

/* ---------- Toast og modal ---------- */
#toasts { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%); z-index: 4000; display: flex; flex-direction: column; gap: 8px; width: min(480px, calc(100% - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 16px; background: #13261f; color: #fff; box-shadow: var(--shadow-lg); font-weight: 600; transform: translateY(20px); opacity: 0; transition: all .25s; }
.toast.show { transform: none; opacity: 1; }
.toast-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--green); display: grid; place-items: center; font-weight: 800; flex: none; }
.toast.error .toast-icon { background: var(--danger); }
.modal-wrap { position: fixed; inset: 0; z-index: 3500; background: rgba(9, 25, 18, .5); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.modal-wrap.show { opacity: 1; }
.modal { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 24px 24px 0 0; padding: 20px 20px calc(env(safe-area-inset-bottom) + 20px); transform: translateY(30px); transition: transform .25s; }
.modal.wide { max-width: 760px; }
.modal-wrap.show .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-size: 1.35rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; min-height: 56px; }
.info-dialog { text-align: center; padding: 8px 0; }
.check-badge { width: 84px; height: 84px; margin: 0 auto 12px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; font-size: 2.6rem; font-weight: 800; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
.info-text { font-size: 1.25rem; font-weight: 700; }
.lang-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.lang-option { min-height: 96px; border-radius: 18px; border: 2px solid var(--line); background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; font-size: 1.1rem; cursor: pointer; transition: transform .08s, border-color .15s; }
.lang-option:active { transform: scale(.96); }
.lang-option.active { border-color: var(--forest-2); background: #ecfdf5; box-shadow: 0 0 0 3px rgba(23, 92, 68, .15); }

/* ---------- Admin ---------- */
.admin { display: block; }
.admin-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 600; display: grid; grid-template-columns: repeat(7, 1fr); background: #13261f;
  padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px); box-shadow: 0 -4px 20px rgba(0, 0, 0, .15);
}
.admin-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; color: rgba(255, 255, 255, .65); text-decoration: none; font-size: .66rem; font-weight: 650; min-height: 54px; justify-content: center; text-align: center; }
.admin-nav a.on { color: #fff; background: rgba(255, 255, 255, .12); }
.nav-icon { font-size: 1.25rem; line-height: 1; font-weight: 800; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.admin-content { padding: 20px 16px 110px; max-width: 1200px; margin: 0 auto; }
.page-title { font-size: 1.9rem; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kpi { background: var(--surface); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--line); min-width: 0; }
.kpi.green { border-top-color: var(--green); }
.kpi.berry { border-top-color: var(--berry); }
.kpi-label { color: var(--muted); font-size: .85rem; font-weight: 650; }
.kpi-value { font-size: 1.7rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-sub { color: var(--muted); font-size: .8rem; }
.table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tfoot td { border-bottom: 0; border-top: 2px solid var(--line); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tbody tr:hover { background: var(--surface-2); }
.qr-mini svg { display: block; border-radius: 4px; }
.quick-add { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-bottom: 12px; }
.quick-add .btn { min-height: 58px; }
.worker-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.worker-card { background: var(--surface); border-radius: 18px; padding: 12px; box-shadow: var(--shadow); display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.worker-card.inactive { opacity: .55; }
.qr-thumb svg { display: block; border-radius: 8px; border: 1px solid var(--line); }
.w-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; align-items: flex-start; }
.w-info strong { font-size: 1.1rem; }
.w-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 10px; }
.day-bar { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px; }
.day-bar .btn { font-size: 1.6rem; min-width: 56px; }
.day-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.day-mid strong { font-size: 1.2rem; text-transform: capitalize; }
.day-mid .input { max-width: 200px; min-height: 42px; text-align: center; }
.rec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.rec-head h3 { margin: 0; }
.rec-sum { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.rec-cols { display: grid; gap: 18px; }
.rec-cols h4 { font-size: .95rem; color: var(--ink-2); }
.rec-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.row-actions { display: flex; gap: 6px; }
.rec-cols .btn.small { margin-top: 10px; }
.crate-adjust { display: flex; align-items: center; gap: 16px; }
.crate-total { font-size: 2rem; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.crate-log { margin-top: 10px; }
.crate-log summary { cursor: pointer; color: var(--ink-2); font-weight: 600; padding: 6px 0; }
.period { display: flex; flex-direction: column; gap: 12px; }
.period-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.period-dates label { display: flex; flex-direction: column; gap: 4px; font-weight: 650; font-size: .9rem; }
.hide-sm { display: none; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 220px; padding: 24px 0 4px; overflow-x: auto; }
.bar-col { flex: 1 0 24px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 24px; }
.bar { width: 100%; max-width: 44px; background: linear-gradient(180deg, #fb7185, #e11d48); border-radius: 8px 8px 3px 3px; min-height: 3px; transition: height .5s; }
.bar-val { font-size: .72rem; font-weight: 700; color: var(--ink-2); }
.bar-label { font-size: .68rem; color: var(--muted); white-space: nowrap; }
.perf-list { margin-top: 18px; }
.perf-row { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rank { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #eef1ef; font-weight: 800; color: var(--ink-2); }
.perf-row:nth-child(2) .rank { background: #fde68a; color: #78350f; }
.perf-row:nth-child(3) .rank { background: #e5e7eb; }
.perf-row:nth-child(4) .rank { background: #fed7aa; color: #7c2d12; }
.perf-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.meter { height: 10px; border-radius: 99px; background: #eef1ef; overflow: hidden; margin: 6px 0; }
.meter div { height: 100%; background: linear-gradient(90deg, #22c55e, #15803d); border-radius: 99px; }

/* ---------- Kart / jorder ---------- */
.tab-fields .page-title { margin-bottom: 12px; }
.fields-layout { display: grid; gap: 16px; }
.map-wrap { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.map { width: 100%; background: #dfe7e1; }
.big-map { height: 58vh; min-height: 360px; }
.small-map { height: 220px; border-radius: 16px; margin-top: 12px; }
.map-tools { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 450; display: flex; gap: 10px; flex-wrap: wrap; }
.map-tools .btn { min-height: 56px; box-shadow: var(--shadow-lg); }
.edit-bar:not([hidden]) ~ .map-tools { display: none; }
.edit-bar { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 460; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: rgba(19, 38, 31, .92); color: #fff; padding: 10px 12px; border-radius: 16px; font-weight: 650; }
.edit-bar span { flex: 1 1 160px; }
.field-side h3 { margin-bottom: 2px; }
.field-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.field-item { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 16px; padding: 8px; box-shadow: var(--shadow); border: 2px solid transparent; }
.field-item.on { border-color: var(--forest-2); }
.field-main { flex: 1; display: flex; gap: 12px; align-items: center; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; min-height: 48px; padding: 4px; min-width: 0; }
.field-main span:last-child { display: flex; flex-direction: column; min-width: 0; }
.field-main small { color: var(--muted); }
.field-actions { display: flex; gap: 6px; }
.dot { width: 16px; height: 16px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
.field-label { background: rgba(255, 255, 255, .92); border: 0; border-radius: 8px; font-weight: 700; color: var(--ink); box-shadow: 0 2px 6px rgba(0, 0, 0, .2); padding: 3px 8px; }
.field-label::before { display: none; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }
.leaflet-container { font-family: var(--font); }
.leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-size: 22px; }
.leaflet-touch .leaflet-control-layers-toggle { width: 44px; height: 44px; }

/* ---------- Sprøyter ---------- */
.sprayer { max-width: 900px; margin: 0 auto; padding: 18px 16px 40px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #e7e3d8; padding: 6px; border-radius: 18px; margin-bottom: 16px; }
.seg a { min-height: 52px; display: grid; place-items: center; border-radius: 14px; text-decoration: none; color: var(--ink-2); font-weight: 700; }
.seg a.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.spray-form { display: flex; flex-direction: column; gap: 14px; }
.form-sec { display: flex; flex-direction: column; gap: 14px; }
.sec-head { display: flex; align-items: center; gap: 12px; }
.sec-head h3 { margin: 0; flex: 1; font-size: 1.2rem; }
.sec-num { width: 34px; height: 34px; border-radius: 50%; background: var(--forest-2); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.req, .rec { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.req { background: var(--berry-soft); color: var(--berry-2); }
.rec { background: #e0f2fe; color: #075985; }
.gps-box { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 16px; background: #eff6ff; color: #1e3a8a; font-weight: 650; flex-wrap: wrap; }
.gps-box > span:nth-child(2) { flex: 1; }
.gps-box.ok { background: var(--green-soft); color: #14532d; }
.gps-box.warn { background: var(--orange-soft); color: #7c2d12; }
.gps-icon { font-size: 1.4rem; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.field-chips { display: grid; gap: 10px; grid-template-columns: 1fr; }
.field-chip { display: flex; gap: 12px; align-items: center; padding: 12px 14px; min-height: 64px; border-radius: 16px; border: 2px solid var(--line); background: #fff; font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.field-chip span:last-child { display: flex; flex-direction: column; }
.field-chip small { color: var(--muted); }
.field-chip.on { border-color: var(--forest-2); background: #ecfdf5; box-shadow: 0 0 0 3px rgba(23, 92, 68, .12); }
.products { display: flex; flex-direction: column; gap: 12px; }
.product { border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.prod-head { display: flex; justify-content: space-between; align-items: center; }
.dose-row { display: grid; grid-template-columns: 1fr 120px; gap: 8px; }
.form-errors { background: #fff1f2; border: 1.5px solid #fecdd3; color: #9f1239; border-radius: 16px; padding: 14px 18px; }
.form-errors ul { margin: 8px 0 0; padding-left: 1.2em; }
.sticky-submit { position: sticky; bottom: 0; padding: 12px 0 calc(env(safe-area-inset-bottom) + 12px); background: linear-gradient(180deg, transparent, var(--bg) 30%); z-index: 400; }
.law summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; }
.law p { margin-top: 12px; color: var(--ink-2); }
.sources { padding-left: 1.2em; }
.sources li { margin: 4px 0; }
.journal-actions { display: flex; flex-direction: column; gap: 12px; }
.journal-list { display: flex; flex-direction: column; gap: 12px; }
.spray-top { display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.spray-date { width: 60px; height: 64px; border-radius: 16px; background: #1e3a5f; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.spray-date strong { font-size: 1.5rem; line-height: 1; }
.spray-date span { font-size: .78rem; text-transform: uppercase; opacity: .8; }
.spray-main h3 { margin-bottom: 4px; }
.spray-main p { margin-bottom: 6px; }
.prod-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.prod-pills .pill { white-space: normal; }
.spray-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.big-empty h3 { color: var(--ink); }

/* ---------- Utskrift ---------- */
.print-area { display: none; }
.qr-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6mm; }
.qr-card { border: 1px dashed #999; border-radius: 4mm; padding: 5mm; display: flex; flex-direction: column; align-items: center; gap: 2mm; break-inside: avoid; text-align: center; }
.qr-card strong { font-size: 13pt; }
.qr-brand { font-size: 9pt; color: #555; }
.qr-img svg { width: 44mm; height: 44mm; }
@media print {
  @page { margin: 12mm; }
  body { background: #fff; font-size: 11pt; }
  .topbar, .admin-nav, .no-print, .seg, .page-title + .stack > .card:first-child .chips, .btn, .icon-btn, .journal-actions, .sticky-submit, .law { display: none !important; }
  .card, .kpi { box-shadow: none; border: 1px solid #ddd; }
  .admin-content { padding: 0; }
  body.printing #app { display: none; }
  body.printing .print-area { display: block; }
  .hide-sm { display: table-cell; }
}

/* ---------- Større skjermer (nettbrett) ---------- */
@media (min-width: 640px) {
  .game-panel { grid-template-columns: auto 1fr; justify-items: stretch; text-align: left !important; }
  .form-2 { grid-template-columns: 1fr 1fr; }
  .form-3 { grid-template-columns: repeat(3, 1fr); }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .worker-grid { grid-template-columns: repeat(2, 1fr); }
  .field-chips { grid-template-columns: repeat(2, 1fr); }
  .rec-cols { grid-template-columns: 1fr 1fr; }
  .hide-sm { display: table-cell; }
  .modal-wrap { align-items: center; }
  .modal { border-radius: 24px; padding-bottom: 20px; }
  .lang-grid { grid-template-columns: repeat(3, 1fr); }
  .journal-actions { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .journal-actions .btn.authority { width: auto; }
  .spray-top { grid-template-columns: auto 1fr auto; }
  .spray-actions { grid-column: auto; flex-direction: column; justify-content: flex-start; }
}
@media (min-width: 900px) {
  .role-grid { grid-template-columns: repeat(3, 1fr); }
  .role-card { grid-template-columns: 1fr; align-content: start; min-height: 260px; }
  .role-arrow { position: absolute; right: 22px; bottom: 18px; }
  .admin { display: grid; grid-template-columns: 230px 1fr; min-height: calc(100vh - 68px); }
  .admin-nav { position: sticky; top: 68px; height: calc(100vh - 68px); display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; box-shadow: none; }
  .admin-nav a { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 1rem; padding: 12px 14px; min-height: 52px; }
  .nav-icon { width: 24px; text-align: center; }
  .admin-content { padding: 28px 28px 40px; width: 100%; }
  .worker-grid { grid-template-columns: repeat(3, 1fr); }
  .fields-layout { grid-template-columns: 1fr 360px; align-items: start; }
  .big-map { height: calc(100vh - 200px); }
  .action-stack { grid-template-columns: 1fr 1fr; }
  .action-btn.berry { grid-column: 1 / -1; order: -1; min-height: 170px; }
  .action-btn.green .a-scan, .action-btn.orange .a-scan { display: none; }
  .action-btn { grid-template-columns: auto 1fr; }
  .action-btn.berry { grid-template-columns: auto 1fr auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
