:root {
  color-scheme: light;
  --bg: #f2f3f5;
  --bg-elevated: #ffffff;
  --panel: #ffffff;
  --panel-soft: #f7f8fa;
  --text: #12161c;
  --muted: #5a6570;
  --line: #dde2e8;
  --line-strong: #c4cad2;
  --accent: #e32d2d;
  --accent-dark: #b91c1c;
  --accent-soft: rgba(227, 45, 45, 0.1);
  --warning: #a16207;
  --danger: #b42318;
  --shadow: 0 1px 4px rgba(18, 22, 28, 0.08), 0 4px 16px rgba(18, 22, 28, 0.06);
  --header-h: 56px;
  --header-fg: #f4f5f7;
  --header-fg-muted: rgba(244, 245, 247, 0.6);
  --header-border: #2a2a2a;
}

* {
  box-sizing: border-box;
}

/* Vahetused: brauseri [hidden] peab peitma. Pärast app.js marsruuterit võidab konkreetne aktiivne vaade (main.app.routes-ready). */
[hidden] {
  display: none !important;
}

.app-view[hidden] {
  display: none !important;
}

main.app.routes-ready > .app-view {
  display: none !important;
}

main.app.routes-ready > .app-view.app-view--active {
  display: block !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: -0.005em;
}

button,
input,
select {
  font: inherit;
}

/* —— Site header (tume riba, sisu hele) —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--header-border);
  background: #111111;
}

.site-header__inner {
  display: flex;
  max-width: 1200px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
  padding: 4px clamp(20px, 4vw, 40px);
  min-height: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--header-fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.brand:hover {
  color: #ffffff;
}

.brand__mark {
  display: flex;
  flex-shrink: 0;
}

.brand__logo {
  display: block;
  width: 168px;
  height: auto;
  object-fit: contain;
}

.brand__name {
  color: inherit;
  font-weight: 700;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 28px;
}

.site-nav__link {
  color: var(--header-fg-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav__link:hover {
  color: #ffffff;
}

.site-nav__link--current {
  color: #ffffff;
  font-weight: 600;
}

.site-nav__btn {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(244, 245, 247, 0.55);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.site-nav__btn:hover {
  color: #ffffff;
}

.site-nav__badge {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(227, 45, 45, 0.45);
  background: rgba(227, 45, 45, 0.15);
  color: #ffb4b4;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand:focus-visible,
.site-nav__link:focus-visible,
.site-nav__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

/* —— Kerge sisepääs (ainult brauseris, pole turvaline) —— */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
}

html.calc-unlocked .auth-gate {
  display: none;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card .eyebrow {
  margin-bottom: 8px;
}

.auth-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 10px;
}

.auth-hint {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-error {
  margin: 0 0 12px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
}

.primary-button {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.primary-button.compact {
  width: auto;
  min-height: 36px;
  padding: 0 16px;
  margin-top: 0;
  white-space: nowrap;
  align-self: flex-end;
}

.primary-button:hover {
  background: #f04444;
}

.primary-button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.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;
}

.app {
  min-height: calc(100vh - var(--header-h));
  padding: 28px clamp(16px, 3vw, 36px) 48px;
}

.placeholder-view {
  padding-top: 4px;
}

.placeholder-view .topbar {
  margin-bottom: 16px;
}

.placeholder-view__text {
  margin: 0;
  max-width: 48ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.workspace.map-view {
  max-width: 980px;
}

.map-view .topbar {
  align-items: flex-start;
  margin-bottom: 18px;
}

.map-view__stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.map-view__panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.map-view__figure {
  margin: 0;
  padding: clamp(22px, 3vw, 30px);
  background: transparent;
}

.map-view__stack > .map-view__panel:first-child .map-view__figure {
  padding-top: clamp(18px, 2vw, 24px);
  padding-bottom: clamp(14px, 2vw, 18px);
}

.map-view__figure--diagram {
  padding-top: clamp(18px, 2vw, 24px);
  padding-bottom: clamp(18px, 2vw, 24px);
}

.map-view__figure--diagram .map-view__img {
  width: 100%;
  max-width: 82%;
  margin-inline: auto;
}

.map-view__img {
  display: block;
  width: 100%;
  height: auto;
  margin-inline: auto;
}

/* —— BAF nädala-maatriks —— */
.workspace.baf-view {
  max-width: 820px;
}

.baf-view .topbar {
  margin-bottom: 12px;
}

.baf-intro {
  margin: 0 0 16px;
  max-width: 52ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.baf-intro code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--panel-soft);
  font-size: 0.88em;
  color: var(--text);
}

.baf-intro--admin {
  margin-top: -8px;
  color: var(--accent-dark);
  font-weight: 600;
}

.baf-admin-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(227, 45, 45, 0.28);
  border-radius: 8px;
  background: var(--accent-soft);
}

.baf-admin-hint {
  margin: 0;
  color: var(--accent-dark);
  font-size: 13px;
  line-height: 1.45;
}

.baf-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.baf-save-status {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.baf-save-status--ok {
  color: #2d7a4a;
}

.baf-save-status--err {
  color: var(--danger);
}

.baf-fuel-lookup-wrap {
  margin-bottom: 10px;
}

.baf-fuel-legend {
  margin: 0 0 18px;
  max-width: 70ch;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.baf-summary-grid {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

.baf-summary-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  flex: 0 0 auto;
  width: clamp(160px, 21vw, 210px);
  max-width: 210px;
  padding: 10px 14px;
}

.baf-summary-card:last-child {
  border-radius: 6px;
}

/* Täislaiuses nagu alumine võrk; kaarti ei venitata äärest äärde. */
.baf-table-wrap.baf-fuel-lookup-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0;
}

.baf-summary-card__title {
  margin: 0 0 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.baf-summary-card__pct {
  margin: 0;
  font-size: clamp(24px, 3.4vw, 32px);
  line-height: 1.05;
  font-weight: 800;
}

.baf-summary-card__meta {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.baf-summary-card--prev {
  border-color: var(--line);
}

.baf-summary-card--active {
  border-color: var(--line-strong);
  outline: 2px solid #16a34a;
  outline-offset: -1px;
}

.baf-summary-card--forecast {
  border-style: dashed;
  border-color: var(--line-strong);
}

.baf-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.baf-matrix {
  width: 100%;
  min-width: 380px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}

.baf-matrix th,
.baf-matrix td {
  border: 1px solid var(--line);
  box-sizing: border-box;
  padding-block: 6px;
  padding-inline: 5px;
  vertical-align: middle;
}

.baf-matrix thead th {
  background: var(--panel-soft);
  font-weight: 600;
  color: var(--text);
  padding-block: 6px;
  padding-inline: 5px;
}

/* Esimene tulp: üks fikseeritud laius (nurk + päevad + jalus), ei “hinga” laiemaks kui andmeveerud. */
.baf-matrix .baf-corner,
.baf-matrix .baf-rowhead {
  width: 9.25rem;
  min-width: 9.25rem;
  max-width: 9.25rem;
  text-align: left;
  background: var(--panel-soft);
}

.baf-matrix .baf-matrix-foot th,
.baf-matrix .baf-matrix-foot td {
  background: var(--panel-soft);
  font-weight: 600;
}

.baf-matrix .baf-matrix-foot td {
  text-align: center;
}

.baf-matrix .baf-avg-meta {
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
}

.baf-matrix thead th.baf-th {
  text-align: center;
}

.baf-matrix .baf-th-line {
  display: block;
  text-align: center;
}

.baf-matrix .baf-th-line--muted {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.baf-matrix .baf-th-week {
  margin-bottom: 1px;
  font-size: 14px;
}

.baf-matrix .baf-th-dates {
  margin-top: 1px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.baf-matrix tbody th.baf-rowhead {
  font-weight: 600;
  white-space: nowrap;
}

.baf-matrix tbody td {
  text-align: center;
  background: var(--panel);
}

.baf-matrix .baf-cell-input {
  box-sizing: border-box;
  width: 100%;
  max-width: 6.25rem;
  min-height: 36px;
  margin-inline: auto;
  display: block;
  padding: 5px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  text-align: center;
}

.baf-matrix .baf-cell-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.baf-matrix .baf-cell-client {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 1px 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.3;
  word-break: break-word;
  text-align: center;
}

.baf-matrix .baf-cell-empty {
  color: var(--line-strong);
  font-weight: 600;
}

.workspace {
  max-width: 1220px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 600;
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(340px, 0.72fr);
  gap: 24px;
  align-items: start;
}

.form-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.form-panel {
  display: grid;
  gap: 20px;
  padding: 24px;
}

.field-group {
  display: grid;
  gap: 8px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text);
  padding: 9px 12px;
  outline: none;
  transition: border-color 100ms ease, box-shadow 100ms ease;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input:disabled,
select:disabled {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  cursor: not-allowed;
}

.autocomplete {
  position: relative;
}

.suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: none;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 4px 20px rgba(18, 22, 28, 0.12);
}

.suggestions.open {
  display: block;
}

.suggestion {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.suggestion:last-child {
  border-bottom: 0;
}

.suggestion:hover,
.suggestion.active {
  background: rgba(227, 45, 45, 0.07);
}

.suggestion-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.suggestion-meta {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * Hinnataseme tsoonid: sama rohelisest kollase skaala nagu BG hinnatablelis.
 * (.price-matrix SVG-s tumedam #2c2c2c tulp on LDM/hinna kirjeldusrida, mitte tarnetsoon.)
 */
:root {
  --zone-1-bg: #377c6f;
  --zone-2-bg: #4c9a7a;
  --zone-3-bg: #87c4ab;
  --zone-4-bg: #cce6db;
  --zone-5-bg: #f6e7b6;
  --zone-6-bg: #efd376;
  --zone-7-bg: #dfb84a;
  --zone-pill-text: #0f1a18;
}

.zone-badge {
  min-width: 56px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  text-align: center;
  border: 1px solid transparent;
}

.zone-badge--unknown {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: rgba(185, 28, 28, 0.22);
}

.zone-badge--z1 {
  background: var(--zone-1-bg);
  color: var(--zone-pill-text);
  border-color: rgba(0, 0, 0, 0.35);
}

.zone-badge--z2 {
  background: var(--zone-2-bg);
  color: var(--zone-pill-text);
  border-color: rgba(0, 0, 0, 0.3);
}

.zone-badge--z3 {
  background: var(--zone-3-bg);
  color: var(--zone-pill-text);
  border-color: rgba(0, 0, 0, 0.28);
}

.zone-badge--z4 {
  background: var(--zone-4-bg);
  color: var(--zone-pill-text);
  border-color: rgba(0, 0, 0, 0.22);
}

.zone-badge--z5 {
  background: var(--zone-5-bg);
  color: var(--zone-pill-text);
  border-color: rgba(0, 0, 0, 0.22);
}

.zone-badge--z6 {
  background: var(--zone-6-bg);
  color: var(--zone-pill-text);
  border-color: rgba(0, 0, 0, 0.25);
}

.zone-badge--z7 {
  background: var(--zone-7-bg);
  color: var(--zone-pill-text);
  border-color: rgba(0, 0, 0, 0.28);
}

.cargo-section {
  display: grid;
  gap: 16px;
  padding-top: 8px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.cargo-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.cargo-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 8px 10px;
  width: max(100%, 720px);
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.cargo-row--invalid {
  border-color: rgba(180, 35, 24, 0.42);
  background: #fff4f2;
}

.cargo-row .cargo-field {
  display: grid;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
  align-self: flex-end;
}

.cargo-row .cargo-field--xs {
  flex: 0 0 4.5rem;
  max-width: 5rem;
}

.cargo-row .cargo-field--sm {
  flex: 0 1 5.5rem;
  min-width: 4.25rem;
}

.cargo-row .cargo-field--wt {
  flex: 1 1 6.5rem;
  min-width: 5.75rem;
}

.cargo-row label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cargo-row input,
.cargo-row select {
  box-sizing: border-box;
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  padding: 7px 9px;
  border-radius: 6px;
  line-height: 1.25;
}

/** Üks kõrgus mis sisendi ja selectiga. */
.cargo-input-like.cargo-input-like--check {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg-elevated);
}

.cargo-input-like--check input {
  width: 17px;
  height: 17px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.cargo-field--chk {
  flex: 0 0 auto;
  width: 4.85rem;
  min-width: 4.25rem;
}

.cargo-field--stackmax {
  flex: 0 0 5rem;
  min-width: 4.5rem;
}

.cargo-field--stackmax.is-hidden {
  display: none;
}

.row-ldm {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1 1 8.5rem;
  min-width: 7.5rem;
  margin-left: auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 12px;
}

.row-ldm__pair {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.row-ldm__abbr {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--muted);
  cursor: help;
}

.row-ldm__abbr--plain {
  cursor: default;
  color: var(--muted);
}

.row-ldm__sep {
  color: var(--line-strong);
  font-weight: 700;
  opacity: 0.9;
}

.row-ldm strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.icon-button {
  flex: 0 0 38px;
  align-self: flex-end;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.icon-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cargo-summary-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.cargo-summary-actions .cargo-summary {
  display: flex;
  flex-wrap: wrap;
  flex: 1 1 260px;
  gap: 10px;
  min-width: 0;
}

.cargo-summary-actions #clear-button {
  flex: 0 0 auto;
  margin-inline-start: auto;
}

.cargo-summary__item {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  box-sizing: border-box;
  min-width: 0;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel-soft);
}

.cargo-summary__label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.cargo-summary__value {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.secondary-button {
  justify-self: start;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 100ms ease, background-color 100ms ease;
}

.secondary-button.compact {
  min-height: 34px;
  padding: 6px 12px;
  white-space: nowrap;
}

.secondary-button:hover {
  border-color: var(--line-strong);
  background: var(--panel);
}

.result-panel {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  display: grid;
  gap: 20px;
  padding: 22px;
}

.price {
  min-height: 60px;
  font-size: 48px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.status {
  min-height: 46px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.status:empty {
  display: none;
  margin: 0;
  min-height: 0;
}

.status.warning {
  color: var(--warning);
}

.status.error {
  color: var(--danger);
}

.result-prices {
  display: grid;
  gap: 0;
  margin-top: 2px;
}

.result-hero {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.result-hero__label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.result-hero__value {
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--text);
}

.result-breakdown {
  display: grid;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.result-prognoos {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.result-price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-block: 6px;
}

.result-price-row--compact {
  padding-block: 2px;
}

.result-price-row--compact .result-price-label {
  font-size: 14px;
}

.result-price-row--compact .result-price-value {
  font-size: 18px;
  font-weight: 700;
}

.result-price-label {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.result-price-value {
  flex-shrink: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.result-eta-block {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.result-eta-main {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.result-eta-label {
  margin-right: 8px;
  font-weight: 700;
}

.result-eta-date {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.result-eta-note {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--danger);
}

.result-eta-error {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.5;
  color: var(--danger);
}

.details {
  display: grid;
  gap: 0;
  margin: 0;
  /* Ülemine joon tuleb .result-prognoos border-bottom’ist — siin top-border tekitaks topeltjoone */
  border-top: 0;
}

.details div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.details div:last-child {
  /* Viimase rea alumine joon + ETA border-top = topelt; ETA eraldus piisab */
  border-bottom: none;
}

dt {
  color: var(--muted);
  font-size: 14px;
}

dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

@media (max-width: 820px) {
  .site-header__inner {
    flex-direction: column;
    align-items: stretch;
    padding-top: 4px;
    padding-bottom: 4px;
    gap: 10px;
  }

  .site-nav {
    justify-content: flex-start;
    gap: 12px 20px;
  }

  .app {
    padding: 20px 16px 40px;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  h1 {
    font-size: clamp(20px, 6vw, 26px);
  }

  .calculator-grid {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }
}

@media (max-width: 520px) {
  .app {
    padding: 16px 12px 36px;
  }

  .form-panel,
  .result-panel {
    padding: 18px;
  }

}

@media (max-width: 620px) {
  .baf-admin-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .secondary-button.compact {
    justify-self: start;
  }

  .cargo-summary-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cargo-summary-actions #clear-button {
    margin-inline-start: 0;
    width: 100%;
  }

  .cargo-summary {
    flex-direction: column;
  }

  .cargo-summary__item {
    flex: 1 1 auto;
    width: 100%;
  }

  .details div {
    grid-template-columns: 1fr;
  }

  .cargo-row {
    width: max(100%, 640px);
  }

  dd {
    text-align: left;
  }

  .result-hero__value {
    font-size: clamp(24px, 7vw, 34px);
  }

  .suggestion {
    grid-template-columns: 1fr;
  }

  .zone-badge {
    justify-self: start;
  }
}

/* ---------------------------------------------------------------
   Nav-linkide nähtavus rolli järgi
--------------------------------------------------------------- */
.admin-only-nav {
  display: none !important;
}
.calc-admin .admin-only-nav {
  display: flex !important;
}

.user-only-nav {
  display: none !important;
}
.calc-unlocked .user-only-nav {
  display: flex !important;
}

/* ---------------------------------------------------------------
   Konto-vaade
--------------------------------------------------------------- */
.konto-username {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--muted);
}

.konto-username strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------------------------------------------------------------
   Kasutajahaldus — admin vaade
--------------------------------------------------------------- */
.admin-view .topbar {
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.admin-loading,
.admin-error {
  padding: 16px 0;
  color: var(--muted);
  font-size: 14px;
}

.admin-error {
  color: var(--danger);
}

.admin-section {
  margin-bottom: 32px;
}

.admin-section__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table__head {
  text-align: left;
  padding: 9px 14px;
  background: var(--bg-elevated);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
}

.admin-table__row:not(:last-child) {
  border-bottom: 1px solid var(--line);
}

.admin-table__cell {
  padding: 10px 14px;
  vertical-align: middle;
}

.admin-table__cell--name {
  font-weight: 500;
}

.admin-table__cell--actions {
  text-align: right;
  white-space: nowrap;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.admin-table__empty {
  padding: 16px 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.admin-you {
  margin-left: 6px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.admin-role {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.admin-role--admin {
  background: rgba(227, 45, 45, 0.1);
  color: var(--accent-dark);
}

.admin-role--client {
  background: var(--bg-elevated);
  color: var(--muted);
}

.admin-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 5px;
  border: 1px solid var(--line);
  cursor: pointer;
  background: var(--bg-elevated);
  color: var(--text);
  transition: background 0.15s;
}

.admin-btn:hover {
  background: var(--panel-soft);
}

.admin-btn--danger {
  color: var(--danger);
  border-color: rgba(227, 45, 45, 0.35);
}

.admin-btn--danger:hover {
  background: rgba(227, 45, 45, 0.08);
}

.admin-btn--secondary {
  color: var(--muted);
}

.admin-form__row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.admin-input,
.admin-select {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}

.admin-input:focus,
.admin-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.admin-form .field-group {
  flex: 1 1 160px;
}

.admin-form__status {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.admin-form__status--ok {
  color: #2d7a4a;
}

.admin-form__status--err {
  color: var(--danger);
}
