/* ============================================================
   bondeverktøy.no — global stylesheet
   Mobile-first. Designsystem fra context.md.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Primærfarger — dypere, mer jordnær grunnfarge */
  --color-primary:       #1f4d22;   /* navlinje, hovedaksent */
  --color-primary-light: #4a8f4a;
  --color-primary-dark:  #14331a;
  --color-primary-pale:  #eef3ea;

  /* Nøytrale */
  --color-bg:            #f7f5f0;
  --color-surface:       #ffffff;
  --color-surface-alt:   #faf8f3;
  --color-border:        #d8d3c8;
  --color-border-strong: #b8b2a4;
  --color-text:          #1a1a18;
  --color-text-muted:    #6b6860;

  /* Aksent */
  --color-accent:        #8b6914;
  --color-accent-pale:   #fdf3dc;

  /* Status */
  --color-success:       #1f4d22;
  --color-warning:       #8b6914;
  --color-error:         #8b2020;
  --color-error-pale:    #fbecec;

  /* Typografi */
  --font-main: 'Source Serif 4', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-ui:   system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Courier New', ui-monospace, monospace;

  /* Spacing */
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 10px;

  --shadow-sm: 0 1px 2px rgba(26,26,24,0.05);
  --shadow:    0 2px 8px rgba(26,26,24,0.08);
  --shadow-lg: 0 8px 24px rgba(26,26,24,0.12);

  --container-max: 780px;
  --container-wide: 1100px;
}

/* ---------- Dark mode overrides ---------- */
html[data-theme="dark"] {
  --color-bg:            #15181a;
  --color-surface:       #1e2124;
  --color-surface-alt:   #23272b;
  --color-border:        #363a3e;
  --color-border-strong: #4a4f55;
  --color-text:          #e8e6df;
  --color-text-muted:    #9a968a;
  --color-primary:       #6fbf6f;
  --color-primary-light: #90d490;
  --color-primary-dark:  #4a9b4a;
  --color-primary-pale:  #1f2a1f;
  --color-accent:        #d4a34a;
  --color-accent-pale:   #2a241a;
  --color-error-pale:    #2a1a1a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
  --shadow:    0 2px 10px rgba(0,0,0,0.45);
  --shadow-lg: 0 10px 28px rgba(0,0,0,0.55);
}
html[data-theme="dark"] .site-nav { background: #0f2410; }
html[data-theme="dark"] .site-footer { background: #0a1a0a; }
html[data-theme="dark"] .btn-dropdown__menu {
  background: var(--color-surface-alt);
  border-color: var(--color-border-strong);
  box-shadow: 0 10px 24px rgba(0,0,0,0.45);
}
html[data-theme="dark"] .btn-dropdown__menu a {
  color: var(--color-text);
}
html[data-theme="dark"] .btn-dropdown__menu a:hover,
html[data-theme="dark"] .btn-dropdown__menu a:focus-visible {
  background: rgba(111,191,111,0.16);
  color: var(--color-primary-light);
}
html[data-theme="dark"] select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='%239a968a' d='M5 7l5 6 5-6H5z'/></svg>");
}
html[data-theme="dark"] .tool-card h2 { color: var(--color-primary-light); }
html[data-theme="dark"] .result-label,
html[data-theme="dark"] .result-value { color: var(--color-primary-light); }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; display: block; }
button { font: inherit; }

/* ---------- Typografi ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-main);
  color: var(--color-text);
  line-height: 1.25;
  margin: 0 0 0.75rem 0;
  font-weight: 700;
}
h1 { font-size: 2rem; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }
@media (min-width: 720px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 1.75rem; }
}
p { margin: 0 0 1rem 0; }
a { color: var(--color-primary); text-underline-offset: 2px; }
a:hover { color: var(--color-primary-light); }

/* ---------- Skip-link (a11y) ---------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 1000;
  text-decoration: none;
  border-bottom-right-radius: var(--radius);
}
.skip-link:focus { top: 0; color: #fff; }

/* ---------- Container ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1rem;
}
.container-wide { max-width: var(--container-wide); }

/* ---------- Nav ---------- */
.site-nav {
  background: var(--color-primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.site-nav__inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.nav-logo {
  font-family: var(--font-main);
  font-size: 1.05rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.01em;
}
.nav-logo:hover { color: #fff; }
.nav-logo__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #c5e0b3;
}
.nav-logo__mark svg { display: block; }
.nav-logo__text { display: inline-block; }
.nav-logo__tld {
  font-weight: 400;
  color: rgba(255,255,255,0.7);
}
.site-nav nav > ul {
  list-style: none;
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.site-nav .nav-link {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  display: inline-block;
  transition: background 0.15s, color 0.15s;
}
.site-nav .nav-link:hover,
.site-nav .nav-link:focus-visible {
  background: rgba(255,255,255,0.15);
  color: #fff;
  outline: none;
}
.site-nav .nav-link[aria-current="page"] {
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-weight: 600;
}
.site-nav .nav-link--has-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.nav-beta-badge {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #f4a261;
  color: #1f1f1f;
  line-height: 1.4;
}

/* Kalkulator-dropdown i toppnav (alle sider) */
.site-nav li.nav-calc-dropdown {
  position: relative;
}
.site-nav .nav-calc-dropdown__toggle {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: inherit;
  align-items: center;
  display: inline-flex;
  gap: 0.35rem;
  -webkit-appearance: none;
  appearance: none;
}
.site-nav .nav-calc-dropdown__toggle[aria-current="page"] {
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-weight: 600;
}
.site-nav .nav-calc-dropdown__chevron {
  transition: transform 0.18s ease;
  flex-shrink: 0;
}
.site-nav .nav-calc-dropdown.is-open .nav-calc-dropdown__chevron {
  transform: rotate(180deg);
}
.site-nav .nav-calc-dropdown__menu {
  display: none;
  flex-direction: column;
  gap: 0;
  left: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  border-color: rgba(15,36,16,0.45);
}
.site-nav .nav-calc-dropdown__menu a {
  color: var(--color-text);
}
.site-nav .nav-calc-dropdown__menu a:hover,
.site-nav .nav-calc-dropdown__menu a:focus-visible {
  background: var(--color-primary-pale);
  color: var(--color-primary-dark);
}
.site-nav .nav-calc-dropdown.is-open .nav-calc-dropdown__menu {
  display: block;
}
html[data-theme="dark"] .site-nav .nav-calc-dropdown__toggle:hover,
html[data-theme="dark"] .site-nav .nav-calc-dropdown__toggle:focus-visible {
  background: rgba(255,255,255,0.16);
  color: #fff;
}
html[data-theme="dark"] .site-nav .nav-calc-dropdown__menu {
  background: #19221a;
  border-color: #4c6550;
  box-shadow: 0 12px 26px rgba(0,0,0,0.5);
}
html[data-theme="dark"] .site-nav .nav-calc-dropdown__menu a {
  color: #e8e6df;
}
html[data-theme="dark"] .site-nav .nav-calc-dropdown__menu a:hover,
html[data-theme="dark"] .site-nav .nav-calc-dropdown__menu a:focus-visible {
  background: rgba(111,191,111,0.18);
  color: #c8e9c8;
}
@media (max-width: 520px) {
  .site-nav__inner { padding: 0.5rem 0.75rem; }
  .site-nav .nav-link { padding: 0.35rem 0.55rem; font-size: 0.85rem; }
}

@media (max-width: 420px) {
  .site-nav__inner {
    align-items: flex-start;
    gap: 0.45rem;
  }
  .site-nav nav > ul {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.15rem;
  }
  .site-nav .nav-link {
    white-space: nowrap;
    font-size: 0.83rem;
  }
}

/* ---------- Main layout ---------- */
main {
  flex: 1 0 auto;
  padding: 2rem 0 3.5rem;
}

.map-page {
  padding: 0 0 3rem;
}

/* ---------- Hero ---------- */
.hero {
  text-align: left;
  padding: 1.25rem 1.1rem 1.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(74, 143, 74, 0.12), transparent 62%),
    linear-gradient(180deg, var(--color-surface-alt), var(--color-surface));
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}
.hero h1 { margin-bottom: 0.75rem; }
.hero__lede {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  max-width: 58ch;
  margin: 0;
}
@media (min-width: 720px) {
  .hero {
    padding: 1.6rem 1.6rem 1.9rem;
  }
}
.hero__meta {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  max-width: 58ch;
  margin: 0.6rem 0 0;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ---------- Calculator example hint ---------- */
.calc-example {
  margin: 0.4rem 0 0;
  padding: 0.55rem 0.75rem;
  background: var(--color-primary-pale, #e8efe2);
  border-left: 3px solid var(--color-primary, #2d6a2d);
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.45;
}
.calc-example em {
  font-style: normal;
  font-weight: 700;
}

/* ---------- Data sources list (kart.html) ---------- */
.data-sources {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: grid;
  gap: 0.75rem;
}
.data-sources li {
  padding: 0.75rem 1rem;
  background: var(--color-surface-alt, #f4f1e8);
  border-radius: 6px;
  border-left: 3px solid var(--color-primary, #2d6a2d);
}
.data-sources li strong {
  display: block;
  margin-bottom: 0.2rem;
}
.data-sources li span {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

/* ---------- Page header (subsider) ---------- */
.page-header {
  margin-bottom: 1.75rem;
}
.page-header h1 { margin-bottom: 0.5rem; }
.page-header__lede {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  margin: 0;
  max-width: 62ch;
}
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}
.breadcrumbs a { color: var(--color-text-muted); }
.breadcrumbs a:hover { color: var(--color-primary); }
.breadcrumbs span[aria-current="page"] { color: var(--color-text); }

/* ---------- Tool grid (forside) ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}
.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.2s, transform 0.15s;
  position: relative;
  overflow: hidden;
}
.tool-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--color-primary);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.2s;
}
.tool-card:hover,
.tool-card:focus-visible {
  border-color: var(--color-primary);
  box-shadow: 0 4px 14px rgba(31,77,34,0.10);
  transform: translateY(-2px);
  color: var(--color-text);
  outline: none;
}
.tool-card:hover::before,
.tool-card:focus-visible::before { transform: scaleY(1); }
.tool-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--color-primary-pale);
  color: var(--color-primary);
  margin-bottom: 0.85rem;
}
.tool-card__icon svg { width: 26px; height: 26px; display: block; }
.tool-card h2 {
  font-size: 1.15rem;
  margin: 0 0 0.4rem 0;
  color: var(--color-primary-dark);
}
.tool-card p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.5;
}
.tool-card__arrow {
  margin-top: auto;
  padding-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-primary);
  font-weight: 600;
}
.tool-card__badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--color-accent-pale, #f4e7c8);
  color: var(--color-accent, #8a6a1f);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* ---------- Section ---------- */
.section { margin: 2.5rem 0; }
.section h2 {
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--color-primary-pale);
  margin-bottom: 1rem;
}

details.calc-explain {
  margin: 1.1rem 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
details.calc-explain > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.9rem 1rem;
  font-family: var(--font-main);
  font-size: 1.1rem;
  font-weight: 700;
  position: relative;
  padding-right: 2.6rem;
}
details.calc-explain > summary::-webkit-details-marker { display: none; }
details.calc-explain > summary::after {
  content: "+";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  color: var(--color-primary);
  font-weight: 400;
}
details.calc-explain[open] > summary::after { content: "−"; }
details.calc-explain > :not(summary) {
  padding: 0 1rem 1rem;
}

/* ---------- Calc layout ---------- */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (min-width: 760px) {
  .calc-layout { grid-template-columns: 1fr 1fr; gap: 2.5rem; }
}

.calc-panel {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.calc-panel h2 {
  font-size: 1.15rem;
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--color-primary-dark);
  font-family: var(--font-ui);
  font-weight: 700;
}

/* ---------- Forms ---------- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
}
.input-group:last-child { margin-bottom: 0; }
.input-group label {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}
.input-group .hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.4;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}
.input-wrap .unit-suffix {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  pointer-events: none;
  font-family: var(--font-ui);
}
.input-wrap input { padding-right: 3.5rem; }

input[type="number"],
input[type="text"],
select {
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 0.625rem 0.75rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="number"]:hover,
select:hover { border-color: var(--color-border-strong); }
input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45,106,45,0.18);
}
input[aria-invalid="true"] {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(139,32,32,0.15);
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='%236b6860' d='M5 7l5 6 5-6H5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 1rem;
  padding-right: 2.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 520px) {
  .form-row { grid-template-columns: 1fr; gap: 0; }
}

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.checkbox-group input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  line-height: 1.2;
  min-height: 2.75rem;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(45,106,45,0.3);
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--color-primary-light); color: #fff; }
.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-secondary:hover { background: var(--color-primary-pale); }
.btn-block { width: 100%; }

/* ---------- Button dropdown ---------- */
.btn-dropdown {
  position: relative;
  display: inline-flex;
}
.btn-dropdown__chevron {
  transition: transform 0.18s ease;
  margin-left: 0.3em;
  flex-shrink: 0;
}
.btn-dropdown.is-open .btn-dropdown__chevron {
  transform: rotate(180deg);
}
.btn-dropdown__menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  background: #fff;
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  z-index: 200;
  white-space: nowrap;
}
.btn-dropdown.is-open .btn-dropdown__menu {
  display: block;
}
.btn-dropdown__menu a {
  display: block;
  padding: 0.55rem 1.1rem;
  color: var(--color-primary);
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 0;
}
.btn-dropdown__menu a:hover,
.btn-dropdown__menu a:focus-visible {
  background: var(--color-primary-pale);
  outline: none;
}
.btn-dropdown__menu li:first-child a {
  font-weight: 600;
}

/* ---------- Result boxes ---------- */
.result-box {
  background: var(--color-primary-pale);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.result-box:last-child { margin-bottom: 0; }
.result-box.is-empty {
  background: var(--color-surface-alt);
  border-color: var(--color-border);
  color: var(--color-text-muted);
  font-style: italic;
}
.result-label {
  font-size: 0.85rem;
  color: var(--color-primary-dark);
  font-weight: 600;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.is-empty .result-label { color: var(--color-text-muted); }
.result-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  font-family: var(--font-ui);
  line-height: 1.1;
}
.result-unit {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-left: 0.3rem;
  font-weight: 500;
}

/* Secondary result stats */
.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}
.stat-card__label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.2rem;
}
.stat-card__value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  font-family: var(--font-ui);
}
.stat-card__unit {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-left: 0.35rem;
}

/* Tables (detaljtabell i gjødsel) */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.data-table th,
.data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  text-align: right;
}
.data-table th:first-child,
.data-table td:first-child { text-align: left; }
.data-table thead th {
  background: var(--color-surface-alt);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}
.data-table tfoot td {
  font-weight: 700;
  background: var(--color-primary-pale);
  border-bottom: none;
}

/* ---------- Messages ---------- */
.error-msg {
  background: var(--color-error-pale);
  border: 1.5px solid var(--color-error);
  color: var(--color-error);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.warning-msg {
  background: var(--color-accent-pale);
  border: 1.5px solid var(--color-accent);
  color: var(--color-accent);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.info-note {
  background: var(--color-surface-alt);
  border-left: 3px solid var(--color-accent);
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  color: var(--color-text-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.25rem 0;
}
.info-note strong { color: var(--color-text); }

/* ---------- FAQ / details ---------- */
details.faq {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  overflow: hidden;
}
details.faq > summary {
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 2.5rem;
}
details.faq > summary::-webkit-details-marker { display: none; }
details.faq > summary::after {
  content: "+";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  color: var(--color-primary);
  font-weight: 400;
}
details.faq[open] > summary::after { content: "−"; }
details.faq > :not(summary) {
  padding: 0 1rem 1rem;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* ---------- Kart ---------- */
#map {
  width: 100%;
  height: 70vh;
  min-height: 420px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface-alt);
}
.map-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  padding: 0.85rem 1rem;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
}
.map-controls__title {
  font-weight: 600;
  margin-right: 0.25rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.map-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.map-controls label:hover { background: var(--color-primary-pale); }
.map-legend {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-primary-dark);
  color: rgba(255,255,255,0.82);
  padding: 2.25rem 1rem 0;
  font-size: 0.9rem;
  margin-top: auto;
}
.site-footer__inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  padding-bottom: 1.75rem;
}
@media (min-width: 720px) {
  .site-footer__inner {
    grid-template-columns: 1.8fr 1fr 1fr;
    gap: 2.5rem;
  }
}
.site-footer__brand h3 {
  font-size: 1.05rem;
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 0.4rem;
}
.site-footer__brand p {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.72);
  line-height: 1.55;
  max-width: 32ch;
}
.site-footer h3 {
  color: #fff;
  font-size: 0.78rem;
  font-family: var(--font-ui);
  margin: 0 0 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}
.site-footer a {
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  transition: color 0.15s;
}
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.4rem; font-size: 0.88rem; }

.site-footer__bottom {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0.9rem 0 1rem;
  border-top: 1px solid rgba(255,255,255,0.13);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
}
.site-footer__bottom > .site-footer__copy { margin-left: auto; }
.site-footer__crumbs {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255,255,255,0.7);
}
.site-footer__crumbs a { color: rgba(255,255,255,0.7); }
.site-footer__crumbs a:hover { color: #fff; }
.site-footer__crumbs span[aria-current="page"] { color: #fff; font-weight: 500; }
.site-footer__crumbs--home { font-weight: 600; color: #fff; }

@media (max-width: 639px) {
  .site-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .site-footer__bottom > .site-footer__copy { margin-left: 0; }
}

/* ---------- Utility ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.text-muted { color: var(--color-text-muted); }

/* ---------- Print ---------- */
@media print {
  .site-nav, .site-footer, .btn, .map-controls { display: none !important; }
  body { background: #fff; color: #000; }
  .calc-panel, .result-box { border: 1px solid #999; break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Tillegg: enhetsvelger, tema, toast, kart-avanserte kontroller
   ============================================================ */

/* ---------- Theme toggle ---------- */
.theme-toggle {
  background: transparent;
  color: rgba(255,255,255,0.85);
  border: none;
  border-radius: var(--radius);
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.5rem;
  transition: background 0.15s, color 0.15s;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: rgba(255,255,255,0.15);
  color: #fff;
  outline: none;
}
.theme-toggle svg { display: block; }

/* ---------- Enhetsvelger (input + select kombo) ---------- */
.input-unit {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  align-items: stretch;
}
.input-unit input[type="number"] { padding-right: 0.75rem; }
.unit-select {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  padding: 0.625rem 2rem 0.625rem 0.6rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  background-color: var(--color-surface-alt);
  color: var(--color-text);
  min-width: 5.5rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='%236b6860' d='M5 7l5 6 5-6H5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.9rem;
}
.unit-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45,106,45,0.18);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--color-primary-dark);
  color: #fff;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
}
.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Kart: avansert kontrollpanel ---------- */
.map-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 900px) {
  .map-wrap { grid-template-columns: 280px 1fr; }
}
.map-sidebar {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  max-height: 70vh;
  overflow-y: auto;
}
.map-sidebar h3 {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--color-border);
}
.map-sidebar h3:first-of-type { margin-top: 0; }

.layer-group { margin-bottom: 0.25rem; }
.layer-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0;
  font-size: 0.9rem;
}
.layer-item input[type="checkbox"],
.layer-item input[type="radio"] {
  accent-color: var(--color-primary);
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}
.layer-item label {
  cursor: pointer;
  font-weight: 500;
  line-height: 1.25;
}
.layer-item .opacity-slider {
  width: 70px;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.layer-item .opacity-slider:disabled { opacity: 0.3; cursor: not-allowed; }

/* Kart tar mer plass */
#map {
  height: 70vh;
  min-height: 500px;
}
@media (max-width: 899px) {
  #map { height: 60vh; min-height: 420px; }
}

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius) !important;
  font-family: var(--font-ui);
}
.leaflet-popup-content {
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0.85rem 1rem !important;
}
.leaflet-popup-content strong { color: var(--color-primary-dark); }
.leaflet-popup-content dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0.5rem 0 0;
}
.leaflet-popup-content dt { color: var(--color-text-muted); font-size: 0.8rem; }
.leaflet-popup-content dd { margin: 0; font-weight: 600; }
.leaflet-popup-content .popup-actions {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
}
.leaflet-popup-content .popup-actions a {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

/* Search box */
.map-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.map-search input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
}
.map-search input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45,106,45,0.18);
}
.map-search__results {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  max-height: 12rem;
  overflow-y: auto;
  display: none;
}
.map-search__results.is-open { display: block; }
.map-search__results li {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.88rem;
}
.map-search__results li:last-child { border-bottom: none; }
.map-search__results li:hover,
.map-search__results li.is-active {
  background: var(--color-primary-pale);
}

.map-btn {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: border-color 0.15s, background 0.15s;
}
.map-btn:hover { border-color: var(--color-primary); background: var(--color-primary-pale); }
.map-btn svg { color: var(--color-primary); flex: none; }
.map-btn:disabled,
.map-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.map-btn:disabled svg,
.map-btn[disabled] svg { color: var(--color-text-muted); }

/* Kalkulator-live: fjern submit-knapp-stil når skjult */
.calc-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}
.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  font-size: 0.85rem;
  padding: 0.5rem 0.9rem;
  min-height: auto;
}
.btn-ghost:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-primary-pale);
}
.btn-ghost--small { font-size: 0.8rem; padding: 0.35rem 0.7rem; }

/* Sprøyte-kalkulator: tank-mix */
.sp-mix {
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.9rem 1rem 1rem;
  margin: 1rem 0 0.25rem;
  background: var(--color-surface, transparent);
}
.sp-mix legend {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  padding: 0 0.4rem;
}
.sp-mix__list { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 0.75rem; }
.sp-product {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: end;
}
.sp-product .input-group { margin: 0; }
.sp-product__del {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  width: 2rem; height: 2rem;
  border-radius: 0.4rem;
  font-size: 1.2rem; line-height: 1;
  cursor: pointer;
  align-self: end;
  margin-bottom: 0.1rem;
}
.sp-product__del:hover { color: var(--color-danger, #b00); border-color: var(--color-danger, #b00); }
@media (max-width: 600px) {
  .sp-product { grid-template-columns: 1fr auto; grid-template-areas: "name del" "dose dose"; }
  .sp-product__name { grid-area: name; }
  .sp-product__dose { grid-area: dose; }
  .sp-product__del { grid-area: del; }
}

/* Subtil live-indikator i resultat-header */
.live-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  background: var(--color-primary-pale);
  color: var(--color-primary-dark);
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-left: 0.5rem;
}

/* Tags for operasjonsgrupper osv. */
.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  background: var(--color-accent-pale);
  color: var(--color-accent);
  border-radius: 999px;
  font-weight: 600;
}

/* Layer status ikoner + loading */
.layer-status{display:inline-block;min-width:1.2em;text-align:center;font-size:0.85em;margin-left:0.35rem}
.layer-status.is-loading{color:#888}
.layer-status.is-ok{color:#4a9b4a}
.layer-status.is-warn{color:#c98a00}
.layer-status.is-error{color:#c0392b}
.map-stage{position:relative}
.map-loading{position:absolute;top:0.75rem;right:0.75rem;background:rgba(45,106,45,0.92);color:#fff;padding:0.45rem 0.8rem;border-radius:6px;font-size:0.85rem;font-weight:600;z-index:500;box-shadow:0 2px 8px rgba(0,0,0,0.2);pointer-events:none}
.info-ico{opacity:0.55;font-size:0.85em}

/* Hjelpetekst per lag */
.layer-help{font-size:0.72rem;color:var(--color-text-muted);margin:0.1rem 0 0.25rem 1.7rem;line-height:1.35;flex-basis:100%}
.layer-item{display:flex;flex-wrap:wrap;align-items:center;gap:0.3rem;padding:0.35rem 0;border-bottom:1px solid var(--color-border)}
.layer-item:last-child{border-bottom:none}
.layer-item label{flex:1;cursor:pointer;font-size:0.88rem}
.opacity-slider{flex-basis:100%;margin-left:1.7rem;height:14px}

/* Fargeforklaring (legend) */
.legend-panel{display:flex;flex-direction:column;gap:0.4rem;max-height:420px;overflow:auto;padding:0.25rem 0}
.legend-item{border:1px solid var(--color-border);border-radius:6px;background:#fff;padding:0.35rem 0.5rem}
.legend-item > summary{cursor:pointer;font-weight:600;font-size:0.85rem;color:var(--color-primary);list-style:none}
.legend-item > summary::-webkit-details-marker{display:none}
.legend-item > summary::before{content:"▸ ";display:inline-block;transition:transform 0.15s}
.legend-item[open] > summary::before{content:"▾ "}
.legend-help{font-size:0.75rem;color:var(--color-text-muted);margin:0.25rem 0;line-height:1.4}
.legend-item img{display:block;max-width:100%;margin-top:0.25rem;background:#fff;border-radius:3px}

/* Flytende fargeforklaring over kartet (nederst til venstre, over Leaflet-attribution) */
.map-legend{position:absolute;left:0.75rem;bottom:2.2rem;width:min(240px,calc(100% - 1.5rem));background:var(--color-surface);color:var(--color-text);border:1px solid var(--color-border);border-radius:var(--radius);box-shadow:var(--shadow);font-size:0.8rem;z-index:500}
.map-legend__head{display:flex;align-items:center;justify-content:space-between;gap:0.5rem;padding:0.4rem 0.6rem;background:var(--color-primary);color:#fff;border-radius:var(--radius) var(--radius) 0 0;font-size:0.82rem}
.map-legend__head strong{font-weight:700;font-size:0.85rem;line-height:1.2;min-width:0}
.map-legend__toggle{background:rgba(255,255,255,0.18);border:none;color:#fff;width:22px;height:22px;border-radius:4px;cursor:pointer;font-weight:700;line-height:1;flex:none}
.map-legend__toggle:hover{background:rgba(255,255,255,0.32)}
.map-legend__body{padding:0.5rem 0.6rem 0.6rem}
.map-legend__body img{display:block;max-width:100%;background:transparent;border-radius:3px}
@media (max-width:640px){
  .map-legend{left:0.5rem;bottom:2rem;width:min(60vw,220px);font-size:0.72rem}
}

/* Tabs */
.tab-bar{display:flex;flex-wrap:wrap;gap:0.25rem;border-bottom:2px solid var(--color-border);margin-bottom:1.5rem}
.tab-btn{background:none;border:none;padding:0.7rem 1.1rem;font-size:1rem;font-weight:600;color:var(--color-text-muted);cursor:pointer;border-bottom:3px solid transparent;margin-bottom:-2px;border-radius:6px 6px 0 0;transition:all 0.15s}
.tab-btn:hover{color:var(--color-primary);background:var(--color-bg-alt,#efece4)}
.tab-btn[aria-selected=true]{color:var(--color-primary);border-bottom-color:var(--color-primary);background:var(--color-bg-alt,#efece4)}
.tab-panel{display:none}
.tab-panel.is-active{display:block;animation:fadeIn 0.2s}
@keyframes fadeIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}

.calc-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.2rem 0 1.2rem;
}
.calc-switch__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.52rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface);
}
.calc-switch__link:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-primary-pale);
}
.calc-switch__link.is-active {
  color: #fff;
  background: var(--color-primary);
  border-color: var(--color-primary);
}

/* ---------- Kart: teigmåler ---------- */
.measure-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}
.measure-status {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-alt);
  padding: 0.55rem 0.65rem;
  font-size: 0.84rem;
  line-height: 1.45;
}
#map.map-measure-active { cursor: crosshair; }
.map-btn.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.map-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- GPS lightbar ---------- */
.gps-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

/* Beta-banner — GPS-siden, men generisk for andre beta-verktøy senere */
.beta-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  margin: 0 0 0.85rem;
  border: 1.5px solid #d3911a;
  background: #fff7e6;
  color: #1f1f1f;
  border-radius: var(--radius);
  font-size: 0.92rem;
  line-height: 1.45;
}
.beta-notice__tag {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: #d3911a;
  color: #fff;
  flex: none;
  align-self: center;
}
.beta-notice__text { flex: 1; min-width: 0; }
.beta-notice__text a { color: inherit; text-decoration: underline; }

/* GPS-form-rader: label + input/select stablet vertikalt */
.gps-page .gps-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0 0 0.7rem;
}
.gps-page .gps-form-row label {
  font-weight: 700;
  font-size: 0.92rem;
}
.gps-page .gps-form-row input,
.gps-page .gps-form-row select {
  padding: 0.6rem 0.7rem;
  font-size: 1.05rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  background: #ffffff;
  color: #0a0a0a;
  min-height: 2.9rem;
}
.gps-page .gps-form-row input:focus,
.gps-page .gps-form-row select:focus {
  outline: 2px solid #1f5e87;
  outline-offset: 1px;
  border-color: #1f5e87;
}

/* AB-info-grid med <dl>/<dt>/<dd>-struktur */
.gps-info-grid > div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.gps-info-grid dt {
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 0;
}
.gps-info-grid dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* How-to/info-lister på GPS-siden */
.gps-page .howto-list,
.gps-page .info-list {
  padding-left: 1.2rem;
  margin: 0.5rem 0 1rem;
  line-height: 1.55;
}
.gps-page .howto-list li,
.gps-page .info-list li {
  margin: 0.3rem 0;
}

/* High-contrast sunlight defaults for GPS page (overrides any dark theme) */
html:has(.gps-page) {
  color-scheme: light;
  --color-bg:            #f5f3ec;
  --color-surface:       #ffffff;
  --color-surface-alt:   #faf8f3;
  --color-border:        #d8d4c4;
  --color-border-strong: #2d2d2d;
  --color-text:          #0a0a0a;
  --color-text-muted:    #2a2a2a;
  background: #f5f3ec;
}
html:has(.gps-page) body {
  background: #f5f3ec;
  color: #0a0a0a;
}
html:has(.gps-page) #theme-toggle {
  display: none !important;
}
.gps-page .gps-card {
  background: #ffffff;
  border-color: #1f1f1f;
  border-width: 2px;
  color: #0a0a0a;
}
.gps-page .text-muted,
.gps-page .gps-stat__label,
.gps-page .gps-card h3 {
  color: #2a2a2a;
}

.gps-card {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
}
.gps-card--primary {
  position: sticky;
  top: calc(var(--gps-nav-offset, 56px) + 0.35rem);
  z-index: 1200;
  border-width: 2px;
  border-color: #2d6a2d;
}
.gps-primary-spacer {
  display: none;
  height: 0;
}
.gps-action-spacer {
  display: none;
  height: 0;
}

.gps-mode-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}
.gps-mode-row .map-btn {
  width: 100%;
  justify-content: center;
  min-height: 2.65rem;
  font-weight: 700;
}
.gps-mode-row .map-btn[hidden] {
  display: none !important;
}

/* Status pill (replaces gray runtime-state strip in drive-mode) */
.gps-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.55rem;
  border: 1.5px solid currentColor;
}
.gps-status-pill__dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.gps-status-pill.is-idle    { color: #5d5a4f; background: #f0eee5; }
.gps-status-pill.is-waiting { color: #8b6914; background: #fef3d6; }
.gps-status-pill.is-active  { color: #1c5e2c; background: #d4ecd4; }
.gps-status-pill.is-locked  { color: #9c3018; background: #fadbd1; }
.gps-status-pill.is-error   { color: #9c3018; background: #fadbd1; }

.gps-runtime-state {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
}
.gps-card h3 {
  margin: 0 0 0.65rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.gps-top-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}
.gps-stat {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-alt);
  padding: 0.5rem;
}
.gps-stat__label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
}
.gps-stat__value {
  display: block;
  margin-top: 0.2rem;
  font-size: 1rem;
  font-family: var(--font-heading);
}

/* Lightbar */
.gps-lightbar {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 0.28rem;
  margin-bottom: 0.55rem;
}
.gps-lightbar__seg {
  display: block;
  height: 2.2rem;
  border-radius: 0.4rem;
  background: #b0ad9d;
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}
.gps-lightbar__seg.is-center {
  background: #5e5a4f;
}
.gps-lightbar__seg.is-center.is-ok {
  background: #1f8a3f;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(31, 138, 63, 0.35);
}
.gps-lightbar__seg.is-left {
  background: #c83a18;
}
.gps-lightbar__seg.is-right {
  background: #c87a0c;
}

/* Hero meter (giant signed number) */
.gps-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius);
  border: 2px solid #1f1f1f;
  background: #ffffff;
  margin-bottom: 0.35rem;
}
.gps-hero__arrow {
  font-size: clamp(2rem, 8vw, 3rem);
  line-height: 1;
  font-weight: 900;
  color: #5d5a4f;
}
.gps-hero__value {
  font-family: var(--font-heading);
  font-size: clamp(2.4rem, 11vw, 4rem);
  line-height: 1;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: #0a0a0a;
}
.gps-hero__unit {
  font-size: clamp(1rem, 3.5vw, 1.4rem);
  font-weight: 700;
  color: #2a2a2a;
}
.gps-hero.is-idle .gps-hero__arrow,
.gps-hero.is-idle .gps-hero__value { color: #5d5a4f; }
.gps-hero.is-ok .gps-hero__arrow,
.gps-hero.is-ok .gps-hero__value { color: #157a35; }
.gps-hero.is-left .gps-hero__arrow,
.gps-hero.is-left .gps-hero__value { color: #b0331a; }
.gps-hero.is-right .gps-hero__arrow,
.gps-hero.is-right .gps-hero__value { color: #a36408; }
.gps-hero__sub {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0 0 0.4rem;
  min-height: 1.1em;
}

.gps-status-message {
  margin: 0;
  font-size: 0.88rem;
}
.gps-speed-lock {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  display: none;
}
.gps-speed-lock.is-locked {
  color: #a8341e;
  font-weight: 700;
  display: block;
}
.gps-reset-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
}

/* Reset button hold animation */
.map-btn--reset {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.map-btn--reset .gps-reset-progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: rgba(156, 48, 24, 0.65);
  z-index: 0;
  transition: width 80ms linear;
  pointer-events: none;
}
.map-btn--reset .gps-reset-label {
  position: relative;
  z-index: 1;
}
.map-btn--reset.is-holding {
  background: #d96f54;
  border-color: #9c3018;
  color: #fff;
}

/* Capture (Sett A/B) hold-to-record button */
.map-btn--capture {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.map-btn--capture .gps-capture-progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: rgba(40, 130, 70, 0.55);
  z-index: 0;
  transition: width 80ms linear;
  pointer-events: none;
}
.map-btn--capture .gps-capture-label {
  position: relative;
  z-index: 1;
}
.map-btn--capture.is-holding {
  background: #4ea36a;
  border-color: #1c6033;
  color: #fff;
}

/* Quick line button (Lås kurs) */
.map-btn--quick {
  background: var(--color-primary-pale, #e7f0f7);
  border-color: var(--color-primary, #1f5e87);
  color: var(--color-primary, #1f5e87);
  font-weight: 700;
}
.map-btn--quick:hover {
  background: var(--color-primary, #1f5e87);
  color: #fff;
}

/* Toggle row (Lyd, Auto) */
.gps-toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}
.gps-toggle-btn {
  font-weight: 700;
  min-height: 2.6rem;
}
.gps-toggle-btn.is-on {
  background: #2c8050;
  border-color: #1c6033;
  color: #fff;
}

/* Four-stat HUD grid + fix-age tones */
.gps-top-metrics--four {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}
@media (min-width: 480px) {
  .gps-top-metrics--four { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.gps-top-metrics--three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}
.gps-hint {
  font-size: 0.8rem;
  margin: 0.4rem 0 0.6rem;
}
.gps-stat--age .gps-stat__value[data-tone="ok"]   { color: #1c6033; }
.gps-stat--age .gps-stat__value[data-tone="warn"] { color: #b87000; }
.gps-stat--age .gps-stat__value[data-tone="bad"]  { color: #9c3018; }
.gps-stat--age .gps-stat__value[data-tone="idle"] { color: var(--color-text-muted, #666); }

/* Single-button row */
.gps-btn-grid--single { grid-template-columns: 1fr !important; }

/* View switch */
.gps-view-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}
.gps-view-switch__btn {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0.7rem 0.75rem;
  min-height: 2.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.gps-view-switch__btn:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-pale);
}
.gps-view-switch__btn.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.gps-view-panel {
  display: none;
  position: relative;
  z-index: 1;
}
.gps-view-panel.is-active {
  display: block;
}

/* Map + overlay */
.gps-map-frame {
  position: relative;
}
.gps-map {
  width: 100%;
  height: min(60vh, 460px);
  min-height: 300px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #dde7d8;
  touch-action: none;
}
.gps-map.is-locked {
  cursor: default;
}
.gps-map-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: var(--radius);
  background: rgba(248, 245, 235, 0.92);
  text-align: center;
  padding: 1rem;
  pointer-events: none;
}
.gps-map-overlay[hidden] {
  display: none;
}
.gps-map-overlay__icon {
  font-size: 2.4rem;
  line-height: 1;
}
.gps-map-overlay__title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: #0a0a0a;
}
.gps-map-overlay__sub {
  font-size: 0.95rem;
  color: #2a2a2a;
  max-width: 26rem;
}
.gps-map-note {
  margin: 0.7rem 0 0;
  font-size: 0.86rem;
}

/* Controls grid */
.gps-btn-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
.gps-btn-grid .map-btn {
  width: 100%;
  justify-content: center;
  min-height: 3rem;
  font-weight: 700;
}
#btn-gps-reset-ab,
#btn-gps-center-lane {
  grid-column: 1 / -1;
}
.gps-info-grid {
  margin-top: 0.8rem;
  border-top: 1px solid var(--color-border);
  padding-top: 0.7rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.32rem;
  font-size: 0.9rem;
}

/* Bottom action bar (always visible, fixed in drive-mode) */
.gps-action-bar {
  display: grid;
  gap: 0.5rem;
  padding: 0.7rem;
  border: 2px solid #1f5e87;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}
.gps-action-bar__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
.gps-action-bar .map-btn {
  width: 100%;
  justify-content: center;
  min-height: 3.4rem;
  font-weight: 800;
  font-size: 1.05rem;
}
.map-btn--start {
  background: #1f8a3f;
  border-color: #14622c;
  color: #ffffff;
}
.map-btn--start:hover:not(:disabled) {
  background: #14622c;
}
.gps-quick-lane .map-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.gps-lane-btn__main {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}
.gps-lane-btn__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 1.5rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #f0eee5;
  color: #1f1f1f;
  font-size: 0.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  border: 1px solid #c9c6ba;
}

/* Tractor layout (always on) */
.gps-page .breadcrumbs,
.gps-page .page-header {
  display: none;
}
.gps-shell {
  gap: 0.55rem;
  margin-bottom: 0;
}
.gps-page {
  padding-top: 0.5rem;
  padding-bottom: 1rem;
}
.gps-card--primary {
  position: sticky;
  top: calc(var(--gps-nav-offset, 56px) + 0.25rem);
  z-index: 1400;
  padding: 0.5rem 0.6rem;
}
.gps-primary-spacer { display: none; }

.gps-action-bar {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 0px);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 0.6rem), var(--container-max));
  z-index: 1400;
  margin-bottom: 0.3rem;
  padding: 0.35rem;
  gap: 0.3rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.gps-action-spacer { display: block; }
.gps-action-bar__row {
  display: contents;
}
.gps-action-bar .map-btn {
  min-height: 2.9rem;
  font-size: 0.88rem;
  padding: 0.4rem 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gps-runtime-state { display: none; }
/* Avanserte kort vises i Kontroller-fanen; har egne kompakte regler nedenfor. */
.gps-page .gps-advanced {
  margin: 0;
}

/* Compact stats inside the HUD primary card */
.gps-card--primary .gps-top-metrics {
  gap: 0.35rem;
  margin: 0.35rem 0 0;
}
.gps-card--primary .gps-stat {
  padding: 0.3rem 0.4rem;
}
.gps-card--primary .gps-stat__label {
  font-size: 0.65rem;
}
.gps-card--primary .gps-stat__value {
  font-size: 0.92rem;
  margin-top: 0.1rem;
}

.gps-status-pill {
  margin: 0 0 0.35rem;
  align-self: flex-start;
}
.gps-lightbar { gap: 0.28rem; margin-bottom: 0.35rem; }
.gps-lightbar__seg { height: 2.1rem; border-radius: 0.4rem; }
.gps-hero {
  padding: 0.25rem 0.5rem;
  margin-bottom: 0.15rem;
  border-width: 1.5px;
}
.gps-hero__value { font-size: clamp(2.1rem, 10vw, 3.4rem); }
.gps-hero__arrow { font-size: clamp(1.6rem, 7vw, 2.4rem); }
.gps-hero__sub {
  font-size: 0.78rem;
  margin-bottom: 0;
  min-height: 0;
  line-height: 1.2;
}

.gps-view-switch__btn { min-height: 2.6rem; font-size: 0.95rem; padding: 0.4rem 0.6rem; }
.gps-btn-grid .map-btn { min-height: 3.2rem; font-size: 1rem; }

.gps-map {
  height: var(--gps-map-slot, 220px);
  min-height: 120px;
}
.gps-card--map-wrap { padding: 0.55rem; }
.gps-map-overlay__icon { font-size: 1.8rem; }
.gps-map-overlay__title { font-size: 1.1rem; }
.gps-map-overlay__sub { font-size: 0.85rem; }

/* De-emphasize help sections so the tractor UI stays the focus */
.gps-page .section,
.gps-page .page-header {
  opacity: 0.85;
}

/* Mobile (≤640) */
@media (max-width: 640px) {
  .gps-card {
    padding: 0.85rem;
    border-radius: var(--radius);
  }
  .gps-card--primary {
    top: calc(var(--gps-nav-offset, 52px) + 0.25rem);
  }
  .gps-top-metrics {
    gap: 0.4rem;
  }
  .gps-stat__value {
    font-size: 0.95rem;
  }
  .gps-lightbar__seg {
    height: 2.3rem;
    border-radius: 0.4rem;
  }
  .gps-view-switch,
  .gps-action-bar__row,
  .gps-btn-grid {
    /* keep 2-column on phones — paired controls */
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .gps-page {
    padding-top: 0.85rem;
  }
}


/* ---------- Feedback modal (åpnes fra footer/FAQ-lenke) ---------- */
.bvt-fb-modal[hidden] { display: none; }
.bvt-fb-modal {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.bvt-fb-backdrop {
  position: absolute; inset: 0;
  background: rgba(20, 30, 20, 0.55);
  backdrop-filter: blur(2px);
}
.bvt-fb-card {
  position: relative;
  background: var(--color-surface, #fff);
  color: var(--color-text, #1a1a1a);
  border-radius: 12px;
  padding: 1.5rem 1.5rem 1.25rem;
  max-width: 32rem; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--color-border, #d0d0d0);
}
.bvt-fb-close {
  position: absolute; top: 0.5rem; right: 0.6rem;
  background: transparent; border: 0;
  font-size: 1.6rem; line-height: 1; cursor: pointer;
  color: var(--color-text-muted, #666);
  width: 2rem; height: 2rem; border-radius: 50%;
}
.bvt-fb-close:hover { background: var(--color-surface-alt, #eee); color: var(--color-text); }
.bvt-fb-card h2 { margin: 0 0 0.5rem; font-size: 1.3rem; }
.bvt-fb-lede { margin: 0 0 1rem; color: var(--color-text-muted); font-size: 0.95rem; line-height: 1.5; }
.bvt-fb-card label {
  display: block; font-weight: 600; font-size: 0.9rem;
  margin: 0.6rem 0 0.3rem;
}
.bvt-fb-opt { font-weight: 400; color: var(--color-text-muted); font-size: 0.85rem; }
.bvt-fb-card input[type="text"],
.bvt-fb-card textarea {
  width: 100%; box-sizing: border-box;
  padding: 0.6rem 0.7rem;
  border: 1.5px solid var(--color-border, #c4c4c4);
  border-radius: 6px;
  font: inherit; font-size: 1rem;
  background: var(--color-bg, #fff); color: var(--color-text);
  resize: vertical;
}
.bvt-fb-card input[type="text"]:focus,
.bvt-fb-card textarea:focus {
  outline: 2px solid var(--color-primary, #2d6a2d); outline-offset: 1px;
  border-color: var(--color-primary);
}
.bvt-fb-counter { text-align: right; font-size: 0.78rem; color: var(--color-text-muted); margin-top: 0.2rem; }
.bvt-fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.bvt-fb-actions {
  display: flex; gap: 0.6rem; justify-content: flex-end;
  margin-top: 1rem;
}
.bvt-fb-cancel, .bvt-fb-send {
  padding: 0.65rem 1.1rem; border-radius: 6px; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; border: 1.5px solid transparent;
}
.bvt-fb-cancel {
  background: transparent; color: var(--color-text);
  border-color: var(--color-border, #c4c4c4);
}
.bvt-fb-cancel:hover { background: var(--color-surface-alt, #eee); }
.bvt-fb-send {
  background: var(--color-primary, #2d6a2d); color: #fff;
}
.bvt-fb-send:hover { background: var(--color-primary-dark, #1e4a1e); }
.bvt-fb-send:disabled { opacity: 0.6; cursor: wait; }
.bvt-fb-status { margin: 0.7rem 0 0; min-height: 1.2em; font-size: 0.9rem; }
.bvt-fb-status--ok  { color: var(--color-primary, #2d6a2d); font-weight: 600; }
.bvt-fb-status--err { color: #b03030; font-weight: 600; }

/* Inline-knapp i FAQ */
.bvt-fb-inline-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1rem; margin-top: 0.4rem;
  background: var(--color-primary, #2d6a2d); color: #fff;
  border: 0; border-radius: 6px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  text-decoration: none;
}
.bvt-fb-inline-btn:hover { background: var(--color-primary-dark, #1e4a1e); color: #fff; }

.vaer-wday__icon { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; }
.vaer-wday__icon img { width: 100%; height: 100%; }
.vaer-wday__cond { font-size: 0.82rem; color: var(--color-text-muted); }
.vaer-wday__temps { display: flex; align-items: baseline; gap: 0.45rem; font-family: var(--font-main); }
.vaer-wday__hi { font-size: 1.2rem; font-weight: 700; color: var(--color-text); }

/* ============================================================
   v0.11 Værvurdering: op-kort, verdikt-hero, why-liste, vinduer
   ============================================================ */

/* Smal vindu-stripe over time-stripen */
.vaer-winbar {
  display: flex; align-items: center; gap: 0.6rem;
  margin: 0.75rem 0 1rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 0.95rem;
  line-height: 1.4;
}
.vaer-winbar[hidden] { display: none; }
.vaer-winbar__icon { font-size: 1.2rem; line-height: 1; flex: none; }
.vaer-winbar__msg { flex: 1; min-width: 0; color: var(--color-text); }
.vaer-winbar__msg strong { font-weight: 700; }
.vaer-winbar__alt { color: var(--color-text-muted); font-size: 0.88rem; }
.vaer-winbar--good {
  background: rgba(45,106,45,0.08);
  border-color: rgba(45,106,45,0.40);
  border-left: 4px solid var(--color-primary);
}
.vaer-winbar--soon {
  background: rgba(45,106,45,0.04);
  border-left: 4px solid var(--color-primary);
}
.vaer-winbar--warn {
  background: rgba(212,154,0,0.08);
  border-color: rgba(212,154,0,0.45);
  border-left: 4px solid #d49a00;
}
.vaer-winbar--bad {
  background: rgba(139,32,32,0.05);
  border-color: rgba(139,32,32,0.35);
  border-left: 4px solid #8b2020;
}
.vaer-winbar--neutral { border-left: 4px solid var(--color-border-strong); }

/* Operasjons-chips: enkel rad */
.vaer-ops { margin: 1rem 0 0.75rem; }
.vaer-ops__list {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.vaer-ops__hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem; color: var(--color-text-muted);
}
.vaer-op {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font: inherit; font-family: var(--font-ui); font-size: 0.92rem; font-weight: 600;
  background: var(--color-surface); color: var(--color-text);
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.vaer-op:hover { background: var(--color-surface-alt); border-color: var(--color-border-strong); }
.vaer-op--active {
  background: var(--color-primary); color: #fff; border-color: var(--color-primary);
}
.vaer-op--active:hover { background: var(--color-primary); border-color: var(--color-primary); }
.vaer-op__icon { font-size: 1rem; line-height: 1; }

/* Time-stripe: 'na' (utenfor arbeidstid) */
.vaer-hour--na {
  background: var(--color-surface);
  border-color: var(--color-border);
  opacity: 0.5;
}

/* ============================================================

/* Operasjonsvelger — store kort */
.vaer-ops__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.7rem;
}
.vaer-opcard {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.8rem 0.95rem;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 0.12s, border-color 0.12s, transform 0.06s, box-shadow 0.12s;
}
.vaer-opcard:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-border-strong);
}
.vaer-opcard:active { transform: translateY(1px); }
.vaer-opcard--active {
  border-color: var(--color-primary);
  background: rgba(45,106,45,0.08);
  box-shadow: 0 0 0 2px var(--color-primary) inset, 0 4px 12px rgba(45,106,45,0.15);
}
.vaer-opcard__icon {
  font-size: 1.7rem; line-height: 1; flex: none;
}
.vaer-opcard__body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.vaer-opcard__name {
  font-family: var(--font-ui); font-weight: 700; font-size: 1rem;
  color: var(--color-text);
}
.vaer-opcard__short {
  font-size: 0.82rem; color: var(--color-text-muted); font-weight: 500;
  line-height: 1.25;
}

/* Verdikt-hero — det store svaret */
.vaer-verdict-wrap { margin: 1.5rem 0; }
.vaer-verdict-wrap[hidden] { display: none; }

.vaer-verdict {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.25rem 1.4rem;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md, 0 4px 14px rgba(0,0,0,0.06));
}
.vaer-verdict__icon {
  font-size: 2.6rem; line-height: 1; flex: none;
}
.vaer-verdict__body { flex: 1; min-width: 0; }
.vaer-verdict__title {
  font-family: var(--font-ui); font-weight: 800;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  line-height: 1.25; margin-bottom: 0.35rem;
}
.vaer-verdict__msg {
  font-size: 1rem; color: var(--color-text);
  line-height: 1.45;
}
.vaer-verdict__msg strong { color: var(--color-text); font-weight: 700; }
.vaer-verdict__hint {
  margin-top: 0.55rem; padding-top: 0.55rem;
  border-top: 1px dashed var(--color-border);
  font-size: 0.85rem; color: var(--color-text-muted);
}
.vaer-verdict--good {
  background: linear-gradient(135deg, rgba(45,106,45,0.08), rgba(45,106,45,0.02));
  border-color: rgba(45,106,45,0.45);
  border-left: 6px solid var(--color-primary);
}
.vaer-verdict--good .vaer-verdict__title { color: var(--color-success, #1f5320); }
.vaer-verdict--soon {
  background: linear-gradient(135deg, rgba(45,106,45,0.05), rgba(212,154,0,0.05));
  border-color: rgba(45,106,45,0.30);
  border-left: 6px solid var(--color-primary);
}
.vaer-verdict--soon .vaer-verdict__title { color: var(--color-primary-dark, #1f5320); }
.vaer-verdict--warn {
  background: linear-gradient(135deg, rgba(212,154,0,0.10), rgba(212,154,0,0.02));
  border-color: rgba(212,154,0,0.50);
  border-left: 6px solid #d49a00;
}
.vaer-verdict--warn .vaer-verdict__title { color: #8a6300; }
.vaer-verdict--bad {
  background: linear-gradient(135deg, rgba(139,32,32,0.07), rgba(139,32,32,0.02));
  border-color: rgba(139,32,32,0.40);
  border-left: 6px solid #8b2020;
}
.vaer-verdict--bad .vaer-verdict__title { color: var(--color-error, #8b2020); }
.vaer-verdict--unknown { border-left: 6px solid var(--color-border-strong); }

/* Verdikt: 2-kolonne grid (Hvorfor + Vinduer) */
.vaer-verdict-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 720px) {
  .vaer-verdict-grid { grid-template-columns: 1fr; }
}

.vaer-why,
.vaer-windows {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.95rem 1.05rem;
}
.vaer-why__title {
  margin: 0 0 0.6rem;
  font-family: var(--font-ui); font-size: 0.78rem; font-weight: 700;
  color: var(--color-text-muted); letter-spacing: 0.06em; text-transform: uppercase;
}
.vaer-why__list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.vaer-why__item {
  display: grid;
  grid-template-columns: 1.2rem 1fr auto;
  align-items: baseline;
  column-gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  background: var(--color-surface-alt);
  border-radius: 8px;
  font-size: 0.92rem;
  border-left: 3px solid transparent;
}
.vaer-why__item--ok   { border-left-color: var(--color-primary); }
.vaer-why__item--warn { border-left-color: #d49a00; background: rgba(212,154,0,0.06); }
.vaer-why__item--bad  { border-left-color: #8b2020; background: rgba(139,32,32,0.05); }
.vaer-why__mark {
  font-weight: 800; text-align: center; font-family: var(--font-ui);
}
.vaer-why__item--ok   .vaer-why__mark { color: var(--color-success, #1f5320); }
.vaer-why__item--warn .vaer-why__mark { color: #8a6300; }
.vaer-why__item--bad  .vaer-why__mark { color: var(--color-error, #8b2020); }
.vaer-why__label { font-weight: 600; color: var(--color-text); }
.vaer-why__value {
  font-family: var(--font-main); font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  white-space: nowrap;
}
.vaer-why__note {
  grid-column: 2 / -1;
  font-size: 0.8rem; color: var(--color-text-muted);
  margin-top: 0.1rem;
}
.vaer-why__none {
  list-style: none; padding: 0.5rem 0; color: var(--color-text-muted);
  font-style: italic; font-size: 0.9rem;
}

/* Vinduer-liste */
.vaer-windows__list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 0.4rem;
  counter-reset: win;
}
.vaer-windows__item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  background: var(--color-surface-alt);
  border-radius: 8px;
  border-left: 3px solid var(--color-border-strong);
  font-size: 0.92rem;
  counter-increment: win;
}
.vaer-windows__item::before {
  content: counter(win) ".";
  font-family: var(--font-ui); font-weight: 800;
  color: var(--color-text-muted);
  margin-right: 0.4rem;
  min-width: 1.2em;
}
.vaer-windows__item--first {
  border-left-color: var(--color-primary);
  background: rgba(45,106,45,0.07);
}
.vaer-windows__when { flex: 1; }
.vaer-windows__dur {
  font-family: var(--font-ui); font-weight: 700;
  background: var(--color-primary); color: #fff;
  padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.78rem; letter-spacing: 0.02em;
  white-space: nowrap;
}
.vaer-windows__none {
  list-style: none; padding: 0.5rem 0; color: var(--color-text-muted);
  font-style: italic; font-size: 0.9rem;
}

/* Time-stripe: 'na' (utenfor arbeidstid) */
.vaer-hour--na {
  background: var(--color-surface);
  border-color: var(--color-border);
  opacity: 0.5;
}

/* ============================================================
   v0.10 Polish: hero CTAs, result hero number, focus, a11y
   ============================================================ */

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.25rem 0 0.75rem;
}
.hero__trust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.85rem;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  list-style: none;
  padding: 0;
}
.hero__trust li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.hero__trust svg {
  width: 14px;
  height: 14px;
  color: var(--color-primary);
  flex: none;
}

@media (max-width: 640px) {
  main { padding: 1.4rem 0 2.4rem; }

  .section { margin: 1.9rem 0; }
  .page-header { margin-bottom: 1.2rem; }
  .page-header__lede,
  .page-head__lede {
    font-size: 0.98rem;
    line-height: 1.5;
  }
  .page-head { margin: 1rem 0 1.35rem; }

  .hero {
    padding: 1rem 0.9rem 1.15rem;
    margin-bottom: 1.3rem;
  }
  .hero h1 { margin-bottom: 0.55rem; }
  .hero__lede { font-size: 1.02rem; }
  .hero__actions {
    margin-top: 1rem;
    gap: 0.5rem;
  }
  .hero__actions .btn {
    flex: 1 1 100%;
    width: 100%;
  }
  .hero__trust {
    gap: 0.35rem 0.8rem;
    font-size: 0.8rem;
  }

  .tool-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    margin-top: 1.2rem;
  }
  .tool-card { padding: 1.15rem; }

  .tab-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.2rem;
    margin-bottom: 1rem;
  }
  .tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.92rem;
    padding: 0.62rem 0.85rem;
  }

  .calc-panel { padding: 1.1rem; }
  .calc-actions { gap: 0.45rem; }
  .calc-actions .btn-ghost {
    flex: 1 1 calc(50% - 0.25rem);
    text-align: center;
    justify-content: center;
  }
}

@media (max-width: 360px) {
  .calc-actions .btn-ghost {
    flex: 1 1 100%;
  }
}

.result-hero {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 1.1rem 0 1.25rem;
  border-top: 2px solid var(--color-primary);
  margin-bottom: 1rem;
}
.result-hero__label {
  flex: 1 1 100%;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.15rem;
}
.result-hero__value {
  font-family: var(--font-ui);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1;
  color: var(--color-primary-dark);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.result-hero__unit {
  font-size: 1rem;
  color: var(--color-text-muted);
  font-weight: 500;
}
.result-hero__sub {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.stat-card__value,
.result-value { font-variant-numeric: tabular-nums; }

:where(a, button, summary, [role="tab"]):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   Værsiden v0.13 — segmentert modus-velger, polert layout
   ============================================================ */

/* Sørg for at [hidden] alltid skjuler seksjoner med flex-layout */
.vaer-legend[hidden],
.vaer-mode[hidden],
.vaer-spray[hidden] { display: none !important; }

/* Sideheader-stramme */
.page-head__lede { max-width: 56ch; }

/* Modus-velger som segmentert kontroll */
.vaer-mode { margin: 1.25rem 0 1.5rem; }
.vaer-mode__bar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  width: 100%;
  box-sizing: border-box;
}
.vaer-mode__btn {
  flex: 1 1 0;
  min-width: 88px;
  padding: 0.55rem 0.9rem;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.vaer-mode__btn:hover { color: var(--color-text); background: rgba(0,0,0,0.03); }
.vaer-mode__btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.vaer-mode__btn--active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 0 0 1px var(--color-border);
}
.vaer-mode__desc {
  margin: 0.55rem 0 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  min-height: 1.2em;
}

/* Status-banner (flat, ren venstre-strek) */
.vaer-spray {
  display: flex; gap: 0.85rem; align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border-strong);
  background: var(--color-surface);
  margin: 1rem 0 1.5rem;
}
.vaer-spray__icon {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  font-family: var(--font-ui);
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 4px;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  margin-top: 0.05rem;
}
.vaer-spray__body { flex: 1; min-width: 0; }
.vaer-spray__title {
  font-family: var(--font-ui); font-weight: 700;
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 0 0 0.2rem;
}
.vaer-spray__msg { font-size: 0.98rem; color: var(--color-text); line-height: 1.5; font-variant-numeric: tabular-nums; }
.vaer-spray__msg strong { font-weight: 700; }
.vaer-spray__alt { display: block; margin-top: 0.3rem; color: var(--color-text-muted); font-size: 0.88rem; }
.vaer-spray--good { border-left-color: var(--color-primary); }
.vaer-spray--good .vaer-spray__icon { background: var(--color-primary); color: #fff; }
.vaer-spray--soon { border-left-color: #2563a8; }
.vaer-spray--soon .vaer-spray__icon { background: #2563a8; color: #fff; }
.vaer-spray--warn { border-left-color: #b8860b; }
.vaer-spray--warn .vaer-spray__icon { background: #b8860b; color: #fff; }
.vaer-spray--bad  { border-left-color: #8b2020; }
.vaer-spray--bad  .vaer-spray__icon { background: #8b2020; color: #fff; }

/* Time-strip — vindpil og flagg */
.vaer-hour__windrow { display: flex; align-items: center; justify-content: center; gap: 0.25rem; }
.vaer-hour__windarrow {
  display: inline-block;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--color-text-muted);
  transition: transform 0.2s ease;
  transform-origin: 50% 50%;
}
.vaer-hour--good .vaer-hour__windarrow { color: var(--color-primary); }
.vaer-hour--bad  .vaer-hour__windarrow { color: var(--color-error, #8b2020); }
.vaer-hour__flags {
  display: flex; justify-content: center; gap: 0.2rem;
  min-height: 0.95em;
  font-size: 0.78rem; line-height: 1;
}
.vaer-hour__flag { color: #8a6300; }
.vaer-hour__flag--rain { color: #2563a8; }
.vaer-hour--inversion { box-shadow: inset 0 0 0 1px rgba(212,154,0,0.45); }

/* Legend (settes dynamisk fra JS) */
.vaer-legend {
  display: flex; flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0 0 1rem;
  padding: 0.5rem 0.85rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--color-text-muted);
}
.vaer-legend__sym { font-weight: 700; color: var(--color-text); margin-right: 0.15rem; }

/* Dag-badges */
.vaer-wday__badge {
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.vaer-wday__badge--good { background: var(--color-primary); color: #fff; }
.vaer-wday__badge--ok   { background: #d49a00; color: #fff; }
.vaer-wday__badge--bad  { background: #8b2020; color: #fff; }

/* Forklaringsblokk */
.vaer-faq {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin: 0.5rem 0;
  background: var(--color-surface);
}
.vaer-faq > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.7rem 1rem;
  font-family: var(--font-ui);
  font-weight: 700;
  position: relative;
  user-select: none;
}
.vaer-faq > summary::-webkit-details-marker { display: none; }
.vaer-faq > summary::after {
  content: "+";
  position: absolute; right: 1rem; top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-weight: 400;
  font-size: 1.2rem;
  line-height: 1;
}
.vaer-faq[open] > summary::after { content: "−"; }
.vaer-faq[open] > summary { border-bottom: 1px solid var(--color-border); }
.vaer-faq > ul {
  margin: 0; padding: 0.75rem 1rem 0.85rem 2.1rem;
  font-size: 0.95rem;
}
.vaer-faq > ul li { margin: 0.25rem 0; }

/* Kart-panel */
.gaard-map-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}
.map-toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.map-toolbar .btn-ghost { display: inline-flex; align-items: center; gap: 0.35rem; }
.map-hint {
  font-size: 0.82rem;
  margin-left: auto;
}
#gaard-map {
  width: 100%;
  height: 480px;
  border-radius: var(--radius);
  border: 1.5px solid var(--color-border);
  background: #e8e4db;
  z-index: 0;
}
@media (max-width: 600px) {
  #gaard-map { height: 360px; }
}
.map-foot { font-size: 0.8rem; margin: 0; }

/* pH-statusbadges */
.ph-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.ph-badge--ok   { background: #d4edda; color: #155724; }
.ph-badge--low  { background: #fff3cd; color: #7a5b04; }
.ph-badge--bad  { background: #f8d7da; color: #721c24; }

@media (prefers-color-scheme: dark) {
  .ph-badge--ok   { background: #1e3a25; color: #a8e0b4; }
  .ph-badge--low  { background: #3a3010; color: #ffd86b; }
  .ph-badge--bad  { background: #3a1a1c; color: #ffb3b8; }
}

/* Info-banner nederst */
.gaard-note {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-top: 1.5rem;
  padding: 0.85rem 1rem;
  background: var(--color-accent-pale);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.5;
}
.gaard-note__icon { color: var(--color-accent); flex: none; padding-top: 1px; }
.gaard-note strong { font-weight: 700; }

/* ─── Modal (felles, brukes på Din gård) ─────────────────── */
.bvt-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  padding: 0;
  animation: bvtModalFade 0.15s ease-out;
}
@media (min-width: 600px) {
  .bvt-modal { align-items: center; padding: 1rem; }
}
@keyframes bvtModalFade {
  from { opacity: 0; } to { opacity: 1; }
}
.bvt-modal[hidden] { display: none; }
.bvt-modal__panel {
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 14px 14px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.25);
  animation: bvtModalSlide 0.2s ease-out;
}
@media (min-width: 600px) {
  .bvt-modal__panel { border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,0.25); }
}
.bvt-modal__panel--small { max-width: 460px; }
@keyframes bvtModalSlide {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.bvt-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem 0.7rem;
  border-bottom: 1px solid var(--color-border);
}
.bvt-modal__header h2 { margin: 0; font-size: 1.15rem; }
.bvt-modal__close {
  background: none; border: 0; cursor: pointer;
  color: var(--color-text-muted);
  padding: 0.25rem; line-height: 0; border-radius: 6px;
}
.bvt-modal__close:hover { color: var(--color-text); background: var(--color-surface-alt); }
.bvt-modal__body {
  padding: 1rem 1.1rem 0.5rem;
  overflow-y: auto;
  flex: 1;
}
.bvt-modal__footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.85rem 1.1rem 1rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

/* form-row--two: 2 kolonner på bredt, 1 på smalt */
.form-row--two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0;
}
.form-row--two .input-group { margin-bottom: 0.75rem; }
@media (max-width: 540px) {
  .form-row--two { grid-template-columns: 1fr; gap: 0; }
}

/* btn-secondary--small */
.btn-secondary--small { font-size: 0.85rem; padding: 0.45rem 0.85rem; }

/* form-row--three: 3 kolonner på bredt, 1 på smalt (brukes for L×B×H) */
.form-row--three {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 540px) {
  .form-row--three { grid-template-columns: 1fr; gap: 0; }
}

/* Visuell skille mellom mål og volum */
.lass-size {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.9rem 1rem 1rem;
  margin: 0 0 1rem;
  background: var(--color-surface-alt, transparent);
}
.lass-size > legend {
  padding: 0 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
}

/* Loading-indikator: flytt litt så den ikke krasjer med FAB-ene */
.map-app {
  display: grid;
  grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  height: calc(100dvh - var(--map-nav-offset, 72px));
  min-height: 620px;
  margin-bottom: 2rem;
}

.map-app .map-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: none;
  min-height: 0;
  overflow: hidden;
}

.map-sidebar__head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-surface);
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.map-sidebar__intro {
  margin-bottom: 0.9rem;
}

.map-sidebar__eyebrow {
  margin: 0 0 0.3rem;
  color: var(--color-primary);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.map-sidebar__intro h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2vw, 2.2rem);
  line-height: 1.05;
}

.map-sidebar__lede {
  margin: 0.55rem 0 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.map-presets {
  margin-top: 0.15rem;
}

.map-presets__list {
  display: grid;
  gap: 0.5rem;
}

.map-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  width: 100%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.map-preset-btn:hover,
.map-preset-btn:focus-visible {
  border-color: var(--color-primary);
  background: var(--color-primary-pale);
  color: var(--color-primary-dark);
  outline: none;
}

.map-preset-btn.is-active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.map-preset-btn__title {
  font-size: 0.88rem;
  line-height: 1.2;
}

.map-preset-btn__sub {
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--color-text-muted);
  font-weight: 500;
}

.map-preset-btn.is-active .map-preset-btn__sub {
  color: rgba(255,255,255,0.86);
}

.map-search {
  position: relative;
  align-items: center;
  gap: 0;
  margin-bottom: 0.45rem;
}

.map-search__icon {
  position: absolute;
  left: 0.8rem;
  color: var(--color-text-muted);
  pointer-events: none;
}

.map-search input {
  padding-left: 2.35rem;
}

.map-search__help {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  line-height: 1.4;
}

.map-sidebar__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}
.map-sidebar__body::-webkit-scrollbar { width: 6px; }
.map-sidebar__body::-webkit-scrollbar-track { background: transparent; }
.map-sidebar__body::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}
.map-sidebar__body::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-strong);
}

.map-sidebar__credit {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
}

/* FAQ-akkordion (jordkart-side) */
.faq-item {
  border-bottom: 1px solid var(--color-border);
  padding: 0.15rem 0;
}
.faq-item:first-of-type { border-top: 1px solid var(--color-border); }
.faq-item > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 0;
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(-45deg);
  transition: transform 0.18s;
  margin-left: auto;
}
.faq-item[open] > summary::after { transform: rotate(45deg); }
.faq-item > summary:hover { color: var(--color-primary); }
.faq-item > p {
  margin: 0 0 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.55;
}

/* HowTo trinn-liste */
.map-howto {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.55rem;
}
.map-howto li { line-height: 1.5; }
.map-howto li strong { color: var(--color-primary); }

.map-app .map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface-alt);
}

.map-app #map {
  height: 100%;
  min-height: 0;
}

.map-overlay {
  position: absolute;
  z-index: 600;
  display: flex;
  gap: 0.5rem;
}

.map-overlay--top-left {
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

.map-overlay--top-left .map-fab {
  border-radius: 0 999px 999px 0;
  width: 2.4rem;
  border-left: none;
  box-shadow: var(--shadow);
}

.map-overlay--top-right {
  top: 0.75rem;
  right: 0.75rem;
}

.map-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.map-fab:hover {
  transform: translateY(-1px);
  background: var(--color-primary-pale);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
}

.map-fab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.map-fab .icon-when-closed {
  display: none;
}

.map-app--collapsed {
  grid-template-columns: 1fr;
}

.map-app--collapsed .map-sidebar {
  display: none;
}

.map-app--collapsed .map-fab .icon-when-open {
  display: none;
}

.map-app--collapsed .map-fab .icon-when-closed {
  display: block;
}

.map-app .map-loading {
  top: auto;
  bottom: 1rem;
  right: 1rem;
}

/* Legend skal ligge over Leaflet attribution */
.map-app .map-legend {
  bottom: 2rem;
  left: 1rem;
  max-height: calc(100% - 6rem);
}

/* Mobil: stable sidebar over kart */
@media (max-width: 899px) {
  .map-app {
    grid-template-columns: 1fr;
    height: calc(100dvh - var(--map-nav-offset, 64px));
    min-height: 0;
    margin-bottom: 1.5rem;
    position: relative;
  }
  .map-app .map-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(92vw, 360px);
    z-index: 700;
    border-right: 1.5px solid var(--color-border);
    border-bottom: none;
    border-radius: 0;
    box-shadow: 16px 0 36px rgba(0, 0, 0, 0.22);
    max-height: none;
  }
  .map-sidebar__head {
    position: static;
  }
  .map-sidebar__intro h1 {
    font-size: 1.6rem;
  }
  .map-sidebar__lede {
    font-size: 0.9rem;
  }
  .map-app .map-stage {
    height: 100%;
    min-height: 0;
  }
  .map-app--collapsed { grid-template-columns: 1fr; }
  .map-app--collapsed .map-sidebar {
    display: none;
  }
  .map-overlay--top-left { top: 3.6rem; left: 0.5rem; }
  .map-overlay--top-left {
    transform: none;
  }
  .map-overlay--top-left .map-fab {
    border-radius: 999px;
    width: 2.85rem;
  }
  .map-overlay--top-right { top: 0.5rem; right: 0.5rem; }
  .map-page__intro { padding-top: 0.5rem; }
  .map-page__header { margin-bottom: 0.6rem; }
}

/* Dark mode-justeringer */
@media (prefers-color-scheme: dark) {
  .map-fab {
    background: rgba(36, 40, 36, 0.95);
    color: #d8e6d8;
    border-color: rgba(255,255,255,0.12);
  }
  .map-fab:hover {
    background: var(--color-primary);
    color: #fff;
  }
}

/* ============================================================
   Jordkart-side: ryddet sidebar (v0.14.1)
   ============================================================ */

/* Collapsible seksjoner i sidebar */
.map-section {
  border-bottom: 1px solid var(--color-border);
  padding: 0;
}
.map-section:last-of-type { border-bottom: none; }
.map-section > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.7rem 0;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}
.map-section > summary::-webkit-details-marker { display: none; }
.map-section > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(-45deg);
  transition: transform 0.18s;
  flex: none;
  margin-left: auto;
}
.map-section[open] > summary::after { transform: rotate(45deg); }
.map-section > summary:hover { color: var(--color-primary); }
.map-section > summary:hover::after { border-color: var(--color-primary); }
.map-section__hint {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-text-muted);
  margin-left: 0.5rem;
}
.map-section[open] > *:not(summary) {
  margin-bottom: 0.6rem;
}

/* Kompakt under-overskrift inne i Tema-lag */
.layer-subhead {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin: 0.6rem 0 0.15rem;
  font-weight: 600;
}
.layer-subhead:first-child { margin-top: 0; }

/* Kompakte lag-rader */
.map-app .layer-item {
  padding: 0.32rem 0;
  border-bottom: none;
  gap: 0.45rem;
  align-items: center;
}
.map-app .layer-item label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  font-size: 0.86rem;
  line-height: 1.3;
}

.layer-item__title {
  min-width: 0;
}

.map-layer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  background: rgba(45, 106, 45, 0.12);
  color: var(--color-primary-dark);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Skjul hjelpetekst og slider for inaktive lag */
.map-app .layer-item .layer-help,
.map-app .layer-item .opacity-slider {
  display: none;
}
.map-app .layer-item:has(input:checked) .layer-help,
.map-app .layer-item:has(input:checked) .opacity-slider {
  display: block;
}
.map-app .layer-item:has(input:checked) {
  background: var(--color-primary-pale);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  margin: 0.15rem 0;
}
.map-app .layer-item:has(input:checked) .layer-help {
  margin: 0.2rem 0 0.3rem 1.7rem;
}
.map-app .layer-item:has(input:checked) .opacity-slider {
  width: calc(100% - 1.7rem);
  max-width: calc(100% - 1.7rem);
  margin-left: 1.7rem;
  box-sizing: border-box;
}

/* Basiskart-rader: kompakt */
#base-layers .layer-item { padding: 0.3rem 0; }

/* Kompakter teigmåler-status */
.map-app .measure-status {
  margin-top: 0.5rem;
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
}

.map-related-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.map-related-links__item {
  display: block;
  padding: 1rem 1.05rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
}

.map-related-links__item strong {
  display: block;
  margin-bottom: 0.28rem;
  color: var(--color-primary-dark);
}

.map-related-links__item span {
  display: block;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.map-related-links__item:hover,
.map-related-links__item:focus-visible {
  border-color: var(--color-primary);
  background: var(--color-primary-pale);
  outline: none;
}

/* Mobil */
@media (max-width: 899px) {
  .map-section > summary { padding: 0.6rem 0; }
  .map-related-links { grid-template-columns: 1fr; }
}
