@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* Design tokens — corporate B2B (inspirert av moderne waste/tech-portaler) */
:root {
  --ep-navy: #1e3a5f;
  --ep-navy-dark: #142a44;
  --ep-navy-light: #2f5585;
  --ep-green: #00c853;
  --ep-green-dark: #00a844;
  --ep-green-soft: #6dd4a0;
  --ep-green-glow: rgba(0, 200, 83, 0.18);
  --ep-cyan: #03a9d6;
  --ep-bg: #f0f3f7;
  --ep-bg-alt: #e8ecf2;
  --ep-surface: #ffffff;
  --ep-surface-muted: #f7f9fc;
  --ep-text: #2c3340;
  --ep-text-muted: #5a6578;
  --ep-text-light: #8b95a5;
  --ep-border: #e2e8f0;
  --ep-border-strong: #cbd5e1;
  --ep-shadow: 0 4px 20px rgba(20, 42, 68, 0.06);
  --ep-shadow-lg: 0 12px 40px rgba(20, 42, 68, 0.1);
  --ep-shadow-card: 0 2px 12px rgba(20, 42, 68, 0.05);
  --ep-radius: 8px;
  --ep-radius-lg: 14px;
  --ep-radius-xl: 22px;
  --ep-radius-pill: 999px;
  --ep-font: 'DM Sans', 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  --ep-header-h: 76px;
  --ep-content-max: 1240px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--ep-font);
  background: var(--ep-bg);
  color: var(--ep-text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  font-size: 1rem;
}

body.nav-menu-open {
  overflow: hidden;
}

body[data-nav-root] {
  padding-top: 0;
}

/* ── Site header ── */
.site-header {
  background: var(--ep-surface);
  border-bottom: 1px solid var(--ep-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8), 0 4px 24px rgba(20, 42, 68, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
  min-height: var(--ep-header-h);
  position: relative;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ep-navy);
  text-decoration: none;
  letter-spacing: -0.02em;
  text-transform: none;
  margin-right: auto;
  z-index: 102;
}

.nav-brand::before {
  content: '';
  width: 4px;
  height: 32px;
  background: linear-gradient(180deg, var(--ep-green) 0%, var(--ep-green-dark) 100%);
  border-radius: 4px;
  flex-shrink: 0;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--ep-radius);
  z-index: 102;
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ep-navy);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  flex-wrap: wrap;
  min-width: 0;
}

.nav-sync-slot {
  display: flex;
  align-items: center;
  min-width: 0;
}

.nav-sync-slot .sync-status-bar {
  max-width: 100%;
}

.nav-sync-slot .sync-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(280px, 40vw);
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ep-navy);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: var(--ep-radius);
  text-transform: none;
  letter-spacing: 0;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}

.nav-link:hover {
  color: var(--ep-green-dark);
  background: var(--ep-green-glow);
}

.nav-link.active {
  color: var(--ep-green-dark);
  background: transparent;
  box-shadow: inset 0 -3px 0 var(--ep-green);
}

.nav-links {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}

/* ── Main content ── */
.site-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

body[data-nav-root] > :not(.site-header):not(.site-footer) {
  max-width: var(--ep-content-max);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 0 max(1.25rem, env(safe-area-inset-right)) calc(3rem + env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
}

/* Hero-bånd på sider (inspirert av moderne B2B-forsider) */
body[data-nav-root] > .page-header {
  --hero-pad-x: clamp(1.75rem, 4.5vw, 3rem);
  --hero-pad-y: clamp(2rem, 4.5vw, 3rem);
  max-width: var(--ep-content-max);
  width: calc(100% - 2 * max(1.25rem, env(safe-area-inset-left)));
  margin: clamp(1rem, 2.5vw, 1.5rem) auto 2.25rem;
  padding: var(--hero-pad-y) var(--hero-pad-x);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  border-radius: var(--ep-radius-xl);
  background: linear-gradient(132deg, var(--ep-navy-dark) 0%, var(--ep-navy) 46%, #2a5280 100%);
  box-shadow: var(--ep-shadow-lg);
  color: #fff;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: clamp(9rem, 17vw, 12.5rem);
}

body[data-nav-root] > .page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 90% at 100% 0%, rgba(0, 200, 83, 0.22) 0%, transparent 58%),
    radial-gradient(circle at 0% 100%, rgba(255, 255, 255, 0.06) 0%, transparent 42%);
  pointer-events: none;
}

body[data-nav-root] > .page-header::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  pointer-events: none;
}

body[data-nav-root] > .page-header .page-header-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 44rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
}

body[data-nav-root] > .page-header .page-title,
body[data-nav-root] > .page-header .header-badge,
body[data-nav-root] > .page-header .page-sub,
body[data-nav-root] > .page-header .page-meta {
  position: relative;
  z-index: 1;
}

body[data-nav-root] > .page-header .page-title {
  color: #fff;
  text-transform: none;
  font-size: clamp(1.875rem, 3.8vw, 2.625rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin: 0;
}

body[data-nav-root] > .page-header .page-title::after {
  content: '';
  display: block;
  width: 3.25rem;
  height: 4px;
  margin-top: 0.875rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ep-green) 0%, rgba(255, 255, 255, 0.55) 100%);
}

body[data-nav-root] > .page-header .header-badge {
  color: #fff;
  align-self: flex-start;
  margin-top: 0.125rem;
}

body[data-nav-root] > .page-header .page-sub {
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1rem, 1.8vw, 1.125rem);
  max-width: 38rem;
  line-height: 1.6;
  margin: 1rem 0 0;
  font-weight: 400;
}

body[data-nav-root] > .page-header .page-meta {
  display: block;
  margin: 0.875rem 0 0;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.68);
}

body[data-nav-root] > .page-header .page-meta:empty {
  display: none;
}

body[data-nav-root] > .page-header.page-header--row {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem 1.75rem;
}

body[data-nav-root] > .page-header.page-header--row > .page-header-inner,
body[data-nav-root] > .page-header.page-header--row > div:first-child {
  flex: 1 1 18rem;
  min-width: 0;
  max-width: 44rem;
}

body[data-nav-root] > .page-header.page-header--row > .toolbar,
body[data-nav-root] > .page-header.page-header--row > a.btn,
body[data-nav-root] > .page-header.page-header--row > button {
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

body[data-nav-root] > .page-header.page-header--row .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.34);
  color: #fff;
  backdrop-filter: blur(8px);
}

body[data-nav-root] > .page-header.page-header--row .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

body[data-nav-root] > .page-header.page-header--row .btn-primary {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--ep-border);
}

body[data-nav-root] > .page-header {
  border-bottom: none;
}

.page-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--ep-navy);
  letter-spacing: -0.02em;
  text-transform: none;
  line-height: 1.2;
}

.page-sub {
  font-size: 1rem;
  color: var(--ep-text-muted);
  margin-top: 0.625rem;
  font-weight: 400;
  line-height: 1.55;
}

/* ── Cards ── */
.card {
  background: var(--ep-surface);
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius-lg);
  padding: 1.75rem;
  box-shadow: var(--ep-shadow-card);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
  box-shadow: var(--ep-shadow);
}

.section-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ep-navy);
  text-transform: none;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
  padding-bottom: 0;
  border-bottom: none;
  display: block;
  min-width: 0;
}

.section-title::after {
  content: '';
  display: block;
  width: 48px;
  height: 4px;
  background: linear-gradient(90deg, var(--ep-green) 0%, var(--ep-green-soft) 100%);
  border-radius: 2px;
  margin-top: 0.5rem;
}

.card + .card {
  margin-top: 1.5rem;
}

/* ── Forms ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group--full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.8125rem;
  color: var(--ep-navy);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.form-input,
.form-select,
.form-textarea {
  background: var(--ep-surface);
  border: 1px solid var(--ep-border-strong);
  border-radius: var(--ep-radius);
  padding: 12px 16px;
  font-size: 0.9375rem;
  color: var(--ep-text);
  font-family: var(--ep-font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--ep-green);
  box-shadow: 0 0 0 3px rgba(0, 208, 132, 0.15);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: var(--ep-radius-pill);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--ep-font);
  text-transform: none;
  letter-spacing: 0;
  transition: all 0.2s;
  text-decoration: none;
  gap: 8px;
}

.btn-sm {
  padding: 8px 18px;
  font-size: 0.8125rem;
}

.btn-primary {
  background: linear-gradient(180deg, var(--ep-green) 0%, var(--ep-green-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 168, 68, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #00d65c 0%, var(--ep-green-dark) 100%);
  box-shadow: 0 6px 20px rgba(0, 168, 68, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--ep-surface);
  color: var(--ep-navy);
  border: 2px solid var(--ep-navy);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--ep-navy);
  color: #fff;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--ep-surface);
  color: #c82333;
  border: 2px solid #c82333;
}

.btn-danger:hover {
  background: #c82333;
  color: var(--ep-surface);
}

.hint {
  font-size: 0.8125rem;
  color: var(--ep-text-muted);
  margin-top: 8px;
  line-height: 1.6;
}

.hint a {
  color: var(--ep-navy);
  font-weight: 600;
}

.hint code {
  color: var(--ep-navy-light);
  font-size: 0.75rem;
  background: var(--ep-bg);
  padding: 2px 6px;
  border-radius: 3px;
}

.storage-note {
  background: linear-gradient(135deg, var(--ep-navy) 0%, var(--ep-navy-dark) 100%);
  border: none;
  border-radius: var(--ep-radius-lg);
  padding: 14px 18px;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--ep-green);
}

.storage-note a {
  color: var(--ep-green);
  font-weight: 600;
}

/* ── Stats & anbud grid ── */
.anbud-overview {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  margin-top: 1.25rem;
  max-width: none;
}

.anbud-section {
  margin-top: 0.25rem;
}

.anbud-section-title {
  font-size: 1.375rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: -0.02em;
  color: var(--ep-navy);
  margin: 0 0 1.25rem;
  padding: 1rem 1.5rem;
  background: var(--ep-surface);
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius-lg);
  border-left: 5px solid var(--ep-green);
  box-shadow: var(--ep-shadow-card);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--ep-surface);
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius-lg);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--ep-shadow-card);
  border-top: none;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--ep-green) 0%, var(--ep-cyan) 100%);
}

.stat-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ep-text-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 12px;
  line-height: 1.4;
}

.stat-value {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--ep-green-dark);
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-value--urgent { color: #d32f2f; }
.stat-value--primary { color: var(--ep-navy); }
.stat-value--muted { color: var(--ep-text-light); font-size: clamp(1.5rem, 3vw, 2rem); }

.stat-sub {
  font-size: 0.875rem;
  color: var(--ep-text-muted);
  margin-top: 10px;
  line-height: 1.45;
}

.anbud-section--done .anbud-section-title {
  border-left-color: var(--ep-green-dark);
}

.anbud-section--skipped .anbud-section-title {
  border-left-color: var(--ep-text-muted);
}

.anbud-section .anbud-grid {
  margin-top: 0;
}

.anbud-grid {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  max-width: 960px;
}

/* ── Aktive anbud – tabellvisning ── */
.anbud-table-card {
  padding: 0;
  overflow: hidden;
  max-width: none;
  --anbud-col-gap: 0.875rem;
  --anbud-col-template:
    minmax(10rem, 1.55fr)
    minmax(7rem, 1fr)
    5.5rem
    minmax(8rem, 1.05fr)
    6.75rem
    1.5rem;
}

.anbud-table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ep-border);
}

.anbud-table-card-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ep-navy);
  letter-spacing: -0.02em;
}

.anbud-table-card-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.625rem;
  border-radius: var(--ep-radius-pill);
  background: var(--ep-green-glow);
  color: var(--ep-green-dark);
  font-size: 0.875rem;
  font-weight: 700;
}

.anbud-table-head {
  display: grid;
  grid-template-columns: var(--anbud-col-template);
  column-gap: var(--anbud-col-gap);
  align-items: center;
  padding: 0.625rem 1.25rem;
  background: var(--ep-surface-muted);
  border-bottom: 1px solid var(--ep-border);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--ep-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.anbud-table-head > span:nth-child(4),
.anbud-table-head > span:nth-child(5) {
  text-align: left;
}

.anbud-table-head > span:nth-child(5) {
  text-align: right;
}

.anbud-table-body.anbud-grid {
  max-width: none;
  gap: 0;
}

.anbud-table-body .anbud-card--table {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--ep-border);
  box-shadow: none;
}

.anbud-table-body .anbud-card--table:last-child {
  border-bottom: none;
}

.anbud-table-body .anbud-card--table:hover,
.anbud-table-body .anbud-card--table.is-expanded {
  background: var(--ep-surface-muted);
  border-color: var(--ep-border);
  box-shadow: none;
}

.anbud-accordion-trigger--table {
  display: grid;
  grid-template-columns: var(--anbud-col-template);
  column-gap: var(--anbud-col-gap);
  align-items: center;
  padding: 0.75rem 1.25rem;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
}

.anbud-accordion-trigger--table:hover {
  background: var(--ep-surface-muted);
}

.anbud-col {
  min-width: 0;
}

.anbud-col--title {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
}

.anbud-col--title .anbud-accordion-kategori {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ep-navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.anbud-type-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--ep-radius-pill);
  flex-shrink: 0;
}

.anbud-type-badge--anbud {
  background: var(--ep-green-glow);
  color: var(--ep-green-dark);
}

.anbud-type-badge--tilbud {
  background: #e8f4fc;
  color: var(--ep-navy);
}

.anbud-oppdragstype-select {
  display: inline-block;
  width: auto;
  min-width: 6.5rem;
  max-width: 8rem;
  font-size: 0.8125rem;
  padding: 4px 8px;
  margin: 0 0.25rem;
  vertical-align: middle;
}

.anbud-accordion-heading .anbud-type-badge {
  margin-bottom: 2px;
}

.anbud-col--client {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ep-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anbud-col--date {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ep-navy);
  white-space: nowrap;
}

.anbud-col--status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.25rem;
  min-width: 0;
}

.anbud-col-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.375rem;
  max-width: 100%;
}

.anbud-progress-chip {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--ep-text-muted);
  white-space: nowrap;
  line-height: 1.2;
}

.anbud-col--status .status-badge--compact {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.status-badge--compact {
  padding: 4px 8px;
  font-size: 0.625rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-transform: none;
}

.anbud-row-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.anbud-row-progress-item {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) 2rem;
  gap: 6px;
  align-items: center;
  width: 100%;
}

.anbud-row-progress-label {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--ep-text-muted);
  text-transform: uppercase;
}

.progress-track--sm {
  height: 4px;
}

.anbud-row-progress-count {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--ep-text-muted);
  text-align: right;
}

.anbud-col--deadline {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.anbud-col--deadline .deadline-badge {
  white-space: nowrap;
  font-size: 0.625rem;
  padding: 4px 8px;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.anbud-table-chevron {
  justify-self: end;
  align-self: center;
  margin-top: 0.125rem;
}

/* ── Anbud cards & accordion ── */
.anbud-card {
  background: var(--ep-surface);
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius-lg);
  box-shadow: var(--ep-shadow);
  transition: box-shadow 0.2s, border-color 0.2s;
  overflow: hidden;
}

.anbud-card.anbud-accordion {
  padding: 0;
}

.anbud-card.anbud-accordion:hover,
.anbud-card.anbud-accordion.is-expanded {
  box-shadow: var(--ep-shadow-lg);
  border-color: var(--ep-green-soft);
}

.anbud-accordion-trigger {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem 1.25rem;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
}

.anbud-accordion-trigger:hover {
  background: var(--ep-bg);
}

.anbud-accordion-heading {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.anbud-accordion-kategori {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ep-navy);
  line-height: 1.3;
}

.anbud-accordion-meta {
  font-size: 0.8125rem;
  color: var(--ep-text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.anbud-accordion-navn {
  font-weight: 500;
  color: var(--ep-text);
}

.anbud-accordion-sep {
  opacity: 0.5;
}

.anbud-accordion-chevron {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--ep-navy);
  border-bottom: 2px solid var(--ep-navy);
  transform: rotate(45deg);
  transition: transform 0.2s;
  margin-left: 4px;
}

.anbud-accordion.is-expanded .anbud-accordion-chevron {
  transform: rotate(-135deg);
  margin-top: 6px;
}

.anbud-accordion-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 1.5rem 1.5rem;
  border-top: 1px solid var(--ep-border);
}

.anbud-accordion-panel[hidden] {
  display: none;
}

.anbud-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.anbud-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.anbud-delete-btn {
  flex-shrink: 0;
  font-size: 0.75rem;
  padding: 6px 12px;
}

.anbud-name {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ep-navy);
}

.anbud-meta {
  font-size: 0.8125rem;
  color: var(--ep-text-muted);
  margin-top: 4px;
}

.frist-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.frist-edit input[type='date'] {
  background: var(--ep-bg);
  border: 1px solid var(--ep-border-strong);
  border-radius: var(--ep-radius);
  color: var(--ep-text);
  font-size: 0.75rem;
  padding: 4px 8px;
  font-family: inherit;
}

.deadline-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.deadline-badge.urgent {
  background: #fde8ea;
  color: #c82333;
}

.deadline-badge.warning {
  background: #fff8e6;
  color: #b8860b;
}

.deadline-badge.ok {
  background: #e8f8f1;
  color: var(--ep-green-dark);
}

.status-badge {
  border-radius: var(--ep-radius);
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge.working {
  background: #fff4e6;
  color: #c45c00;
  border-left: 3px solid #ff6900;
}

.status-badge.waiting {
  background: #fde8ea;
  color: #c82333;
  border-left: 3px solid #c82333;
}

.status-badge.research {
  background: #e8f4fc;
  color: var(--ep-navy);
  border-left: 3px solid var(--ep-cyan);
}

.status-badge.done {
  background: #e8f8f1;
  color: var(--ep-green-dark);
  border-left: 3px solid var(--ep-green);
}

.status-badge.skipped {
  background: var(--ep-bg);
  color: var(--ep-text-muted);
  border-left: 3px solid var(--ep-border-strong);
}

.anbud-kommentar {
  margin-top: 0.25rem;
}

.anbud-kommentar .form-label {
  margin-bottom: 6px;
}

.kommentar-input {
  width: 100%;
  resize: vertical;
  min-height: 5rem;
}

.status-select {
  width: 100%;
  margin-top: 4px;
  background: var(--ep-bg);
  border: 1px solid var(--ep-border-strong);
  border-radius: var(--ep-radius);
  color: var(--ep-text);
  font-size: 0.8125rem;
  padding: 8px 10px;
  font-family: inherit;
}

.criteria-bar-wrap {
  margin-bottom: 10px;
}

.criteria-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  margin-bottom: 4px;
}

.criteria-row .criteria-label {
  color: var(--ep-text-muted);
}

.criteria-bar {
  height: 6px;
  background: var(--ep-bg);
  border-radius: 3px;
  overflow: hidden;
}

.criteria-bar-fill {
  height: 100%;
  border-radius: 3px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: var(--ep-bg);
  border: 1px solid var(--ep-border);
  color: var(--ep-text-muted);
  font-size: 0.6875rem;
  padding: 4px 10px;
  border-radius: 20px;
}

.checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.checklist-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-track {
  height: 6px;
  width: 72px;
  background: var(--ep-bg);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--ep-green);
  border-radius: 3px;
  transition: width 0.2s;
}

.checklist-count {
  font-size: 0.75rem;
  color: var(--ep-text-muted);
  font-weight: 600;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
  cursor: pointer;
  padding: 4px 0;
}

.checklist-item input[type='checkbox'] {
  margin-top: 3px;
  accent-color: var(--ep-green);
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.checklist-item label {
  font-size: 0.8125rem;
  color: var(--ep-text);
  cursor: pointer;
  user-select: none;
}

.checklist-item.done label {
  color: var(--ep-green-dark);
  text-decoration: line-through;
}

.checklist-header--kval {
  margin-top: 4px;
}

.checklist-item--kval {
  padding: 6px 8px;
  border-radius: 6px;
  background: #fff8e6;
  border: 1px solid #f5d78e;
}

.checklist-item--kval input[type='checkbox'] {
  accent-color: #d97706;
}

.checklist-item--kval.done {
  background: #f0fdf4;
  border-color: #86efac;
}

.progress-fill--kval {
  background: #f59e0b;
}

.upload-zone {
  border: 2px dashed var(--ep-border-strong);
  border-radius: var(--ep-radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--ep-surface-muted);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--ep-green);
  background: rgba(0, 200, 83, 0.06);
  box-shadow: 0 0 0 4px var(--ep-green-glow);
}

.upload-zone p {
  font-size: 1.0625rem;
  color: var(--ep-navy);
  font-weight: 600;
}

.upload-zone span {
  font-size: 0.8125rem;
  color: var(--ep-text-muted);
  display: block;
  margin-top: 8px;
}

.upload-zone.is-busy {
  pointer-events: none;
  opacity: 0.85;
  border-color: var(--ep-green);
}

.upload-zone .upload-status {
  margin-top: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ep-navy);
}

.import-status {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--ep-radius);
  border: 1px solid var(--ep-border);
  background: var(--ep-surface-muted);
}

.import-status-text {
  margin: 0 0 10px;
  font-size: 0.875rem;
  color: var(--ep-text);
  line-height: 1.45;
}

.import-status-text:last-child {
  margin-bottom: 0;
}

.import-status--ok {
  border-color: #86efac;
  background: #f0fdf4;
}

.import-status--warn {
  border-color: #fcd34d;
  background: #fffbeb;
}

.import-status--busy {
  border-color: var(--ep-green-soft);
  opacity: 0.9;
}

.import-status .btn {
  margin: 0;
}

.anbud-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--ep-border);
  gap: 12px;
}

.anbud-imported-at {
  margin: 6px 0 0;
  font-size: 0.75rem;
}

.anbud-kontakt-block {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius);
  background: var(--ep-surface-muted);
}

.anbud-kontakt-grid {
  margin-top: 8px;
}

.anbud-kontakt-summary {
  margin: 8px 0 0;
}

.anbud-ref {
  font-weight: 600;
  color: var(--ep-navy);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.extract-preview {
  background: var(--ep-bg);
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius);
  padding: 12px;
  max-height: 160px;
  overflow-y: auto;
  font-size: 0.75rem;
  color: var(--ep-text-muted);
  white-space: pre-wrap;
  margin-top: 12px;
}

/* ── Sync status ── */
.sync-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.6875rem;
  color: var(--ep-text-muted);
  font-weight: 500;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ep-border-strong);
  flex-shrink: 0;
}

.sync-dot.connected {
  background: var(--ep-green);
}

.sync-dot.syncing {
  background: #fcb900;
  animation: sync-pulse 1s infinite;
}

.sync-dot.error {
  background: #c82333;
}

@keyframes sync-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.sync-setup-link {
  color: var(--ep-green-dark);
  text-decoration: none;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sync-setup-link:hover {
  text-decoration: underline;
}

/* ── Footer ── */
.site-footer {
  background: linear-gradient(180deg, var(--ep-navy-dark) 0%, #0f1f33 100%);
  color: rgba(255, 255, 255, 0.78);
  padding: 3rem max(1.25rem, env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
  margin-top: 3rem;
  font-size: 0.875rem;
}

.site-footer-grid {
  max-width: var(--ep-content-max);
  margin: 0 auto 2rem;
  display: grid;
  grid-template-columns: 1.4fr repeat(2, 1fr);
  gap: 2.5rem;
}

.site-footer-brand {
  max-width: 22rem;
}

.site-footer-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

.site-footer-tagline {
  margin: 0;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.65);
}

.site-footer-col h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ep-green);
  margin: 0 0 1rem;
}

.site-footer-col a {
  display: block;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 0.35rem 0;
  transition: color 0.15s;
}

.site-footer-col a:hover {
  color: var(--ep-green);
}

.site-footer-bottom {
  max-width: var(--ep-content-max);
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.5);
}

.site-footer-inner {
  max-width: var(--ep-content-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.site-footer strong {
  color: var(--ep-green);
  font-weight: 700;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--ep-green);
}

.site-footer-text {
  color: rgba(255, 255, 255, 0.6);
}

.site-footer-link {
  color: var(--ep-green-soft);
  font-weight: 600;
  text-decoration: none;
}

.site-footer-link:hover {
  color: var(--ep-green);
  text-decoration: underline;
}

@media (max-width: 768px) {
  .site-footer-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
}

/* ── Admin import rules ── */
.admin-save-hint {
  padding: 12px 16px;
  border-radius: var(--ep-radius);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
}

.admin-save-hint--ok {
  background: #e8f8f1;
  color: var(--ep-green-dark);
  border-left: 4px solid var(--ep-green);
}

.admin-save-hint--error {
  background: #fde8ea;
  color: #c82333;
  border-left: 4px solid #c82333;
}

.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.admin-nav {
  position: sticky;
  top: calc(var(--ep-header-h) + 12px);
  padding: 1.25rem;
}

.admin-nav .section-title {
  margin-bottom: 0.75rem;
}

.admin-nav-link {
  display: block;
  padding: 10px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ep-navy);
  text-decoration: none;
  border-radius: var(--ep-radius);
  margin-bottom: 4px;
}

.admin-nav-link:hover {
  background: rgba(0, 208, 132, 0.1);
}

.admin-nav-actions {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ep-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-nav-actions .btn {
  width: 100%;
  justify-content: center;
}

.admin-main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.admin-section-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ep-navy);
  margin: 0 0 0.75rem;
}

.admin-section .hint {
  margin-bottom: 1rem;
}

.admin-pattern {
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: var(--ep-bg);
  border: 1px solid var(--ep-border);
}

.admin-pattern-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.admin-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.admin-add-pattern {
  margin-top: 0.5rem;
}

.admin-test-result {
  max-height: 400px;
  overflow: auto;
}

.pattern-delete {
  min-width: 36px;
  padding: 4px 10px;
  font-size: 1.125rem;
  line-height: 1;
}

/* ── Container tracker (delt mal) ── */
.page-header--row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-badge {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--ep-radius-pill);
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.login-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--ep-bg);
  border-radius: var(--ep-radius);
  border: 1px solid var(--ep-border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ep-border-strong);
  flex-shrink: 0;
}

.status-dot.connected {
  background: var(--ep-green);
}

.status-dot.error {
  background: #c82333;
}

.status-dot.loading {
  background: #fcb900;
  animation: sync-pulse 1s infinite;
}

.status-text {
  font-size: 0.75rem;
  color: var(--ep-text-muted);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.6875rem;
}

.trackers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.tracker-card {
  margin-bottom: 0;
  min-width: 0;
  overflow: hidden;
}

.tracker-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.tracker-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--ep-navy);
}

.tracker-deadline {
  font-size: 0.6875rem;
  color: var(--ep-text-muted);
  margin-top: 2px;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.serial-input {
  width: 100%;
  min-width: 0;
}

.fetch-btn {
  background: var(--ep-navy);
  color: var(--ep-surface);
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 0.75rem;
}

.fetch-btn:hover {
  background: var(--ep-navy-dark);
}

.fetch-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.location-result {
  margin-top: 10px;
  padding: 10px;
  background: var(--ep-bg);
  border-radius: var(--ep-radius);
  border: 1px solid var(--ep-border);
}

.location-result.hidden {
  display: none;
}

.loc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.loc-label {
  font-size: 0.625rem;
  color: var(--ep-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.loc-value {
  font-size: 0.75rem;
  color: var(--ep-text-muted);
  font-weight: 500;
}

.loc-value--found {
  color: var(--ep-green-dark);
}

.loc-value--warn {
  color: #b8860b;
}

.loc-value--error {
  color: #c82333;
}

.loc-coords {
  font-size: 0.75rem;
  color: var(--ep-cyan);
  font-family: ui-monospace, monospace;
}

.loc-time {
  font-size: 0.625rem;
  color: var(--ep-text-muted);
  margin-top: 4px;
}

.loc-error {
  font-size: 0.75rem;
  color: #c82333;
  margin-top: 6px;
}

.loc-error.hidden {
  display: none;
}

.map-card {
  padding: 0;
  overflow: hidden;
}

.map-header {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--ep-border);
}

.map-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--ep-navy);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.map-actions {
  margin-top: 0;
}

#map {
  height: 420px;
  width: 100%;
}

.leaflet-container {
  background: var(--ep-bg) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--ep-surface);
  border: 1px solid var(--ep-border);
  color: var(--ep-text);
  border-radius: var(--ep-radius-lg);
  box-shadow: var(--ep-shadow-lg);
}

.leaflet-popup-tip {
  background: var(--ep-surface);
}

.popup-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ep-navy);
  margin-bottom: 4px;
}

.popup-serial {
  font-size: 0.625rem;
  color: var(--ep-text-muted);
  margin-bottom: 6px;
}

.popup-coords {
  font-size: 0.75rem;
  color: var(--ep-cyan);
  font-family: ui-monospace, monospace;
}

.legend {
  display: flex;
  gap: 16px;
  padding: 12px 1.25rem;
  border-top: 1px solid var(--ep-border);
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--ep-text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.refresh-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--ep-text-muted);
}

.cors-warning {
  display: none;
  background: #fff8e6;
  border: 1px solid #fcb900;
  border-radius: var(--ep-radius);
  padding: 10px 14px;
  font-size: 0.75rem;
  color: #8a6d00;
  margin-top: 12px;
}

.cors-warning a {
  color: var(--ep-navy);
  font-weight: 600;
}

/* ── Login ── */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: linear-gradient(135deg, var(--ep-navy-dark) 0%, var(--ep-navy) 45%, #2a5280 100%);
  position: relative;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 80% at 90% 10%, var(--ep-green-glow) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  border: none;
  box-shadow: var(--ep-shadow-lg);
  border-radius: var(--ep-radius-xl);
  padding: 2rem;
}

.login-card .page-title {
  color: var(--ep-navy);
}

.login-card .page-sub {
  color: var(--ep-text-muted);
}

.login-error {
  background: #fde8ea;
  color: #c82333;
  padding: 10px 14px;
  border-radius: var(--ep-radius);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
}

.login-reset {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: var(--ep-text-muted);
}

.login-reset summary {
  cursor: pointer;
  color: var(--ep-navy);
  font-weight: 600;
}

.login-recovery {
  margin-top: 0.25rem;
}

.login-recovery-title {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ep-navy);
}

.login-recovery-lead {
  margin: 0 0 1rem;
}

/* ── Nav user / logout ── */
.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav-user-email {
  font-size: 0.75rem;
  color: var(--ep-text-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout {
  flex-shrink: 0;
}

/* ── Responsive: tablet og mindre ── */
@media (max-width: 900px) {
  .trackers-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .anbud-overview,
  .anbud-grid:not(.anbud-table-body) {
    max-width: none;
  }
}

@media (max-width: 1100px) and (min-width: 769px) {
  .anbud-table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .anbud-table-head,
  .anbud-accordion-trigger--table {
    min-width: 52rem;
  }
}

/* ── Responsive: mobil ── */
@media (max-width: 768px) {
  :root {
    --ep-header-h: 56px;
  }

  .main-nav {
    flex-wrap: nowrap;
    align-items: center;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: 8px;
    min-height: var(--ep-header-h);
  }

  .nav-toggle {
    display: flex;
    margin-left: auto;
  }

  .nav-menu {
    display: none;
    position: fixed;
    inset: var(--ep-header-h) 0 0 0;
    z-index: 101;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 1rem max(1rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom))
      max(1rem, env(safe-area-inset-left));
    background: var(--ep-surface);
    border-top: 1px solid var(--ep-border);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--ep-shadow-lg);
  }

  .nav-open .nav-menu {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    width: 100%;
    gap: 6px;
  }

  .nav-link {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    font-size: 0.875rem;
  }

  .nav-user {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--ep-border);
    gap: 10px;
  }

  .nav-user-email {
    max-width: none;
    font-size: 0.8125rem;
  }

  .nav-logout {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .nav-sync-slot {
    width: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--ep-border);
  }

  .nav-sync-slot .sync-label {
    max-width: none;
    white-space: normal;
  }

  body[data-nav-root] > :not(.site-header):not(.site-footer) {
    padding: 1.25rem max(0.875rem, env(safe-area-inset-right)) calc(2rem + env(safe-area-inset-bottom))
      max(0.875rem, env(safe-area-inset-left));
  }

  .page-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
  }

  body[data-nav-root] > .page-header {
    --hero-pad-x: 1.25rem;
    --hero-pad-y: 1.5rem;
    width: calc(100% - 1.75rem);
    min-height: auto;
    border-radius: var(--ep-radius-lg);
  }

  body[data-nav-root] > .page-header .page-title {
    font-size: 1.625rem;
  }

  body[data-nav-root] > .page-header .page-sub {
    font-size: 0.9375rem;
  }

  .page-header--row {
    flex-direction: column;
    align-items: stretch;
  }

  .header-badge {
    align-self: flex-start;
  }

  .card {
    padding: 1.125rem;
  }

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

  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px;
  }

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

  .toolbar .btn,
  .toolbar a.btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .anbud-list-item {
    flex-direction: column;
    align-items: stretch;
  }

  .anbud-list-item .toolbar {
    margin-top: 8px;
  }

  .anbud-accordion-trigger {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 0.875rem 1rem;
    gap: 0.5rem 0.75rem;
  }

  .anbud-accordion-heading {
    flex: 1 1 calc(100% - 56px);
    min-width: 0;
  }

  .anbud-accordion-kategori {
    font-size: 0.9375rem;
  }

  .anbud-accordion-trigger .deadline-badge {
    order: 3;
    flex: 1 1 100%;
    text-align: center;
  }

  .anbud-accordion-chevron {
    align-self: center;
  }

  .anbud-accordion-panel {
    padding: 0 1rem 1.25rem;
  }

  .anbud-table-head {
    display: none;
  }

  .anbud-accordion-trigger--table {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      'title chevron'
      'client client'
      'date deadline'
      'status status';
    gap: 0.5rem 0.75rem;
    padding: 1rem;
  }

  .anbud-col--title {
    grid-area: title;
  }

  .anbud-col--client {
    grid-area: client;
    font-size: 0.8125rem;
    color: var(--ep-text-muted);
    font-weight: 500;
  }

  .anbud-col--date {
    grid-area: date;
    font-size: 0.8125rem;
  }

  .anbud-col--status {
    grid-area: status;
  }

  .anbud-col--deadline {
    grid-area: deadline;
    justify-content: flex-start;
  }

  .anbud-table-chevron {
    grid-area: chevron;
    align-self: center;
  }

  .anbud-table-card-header {
    padding: 1rem;
  }

  .anbud-section-title {
    font-size: 1.0625rem;
    padding: 0.75rem 1rem;
  }

  .checklist-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .checklist-progress {
    width: 100%;
  }

  .frist-edit {
    flex-direction: column;
    align-items: stretch;
  }

  .frist-edit input[type='date'] {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  .status-select {
    min-height: 44px;
    font-size: 16px;
  }

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

  .login-grid .btn-primary {
    width: 100%;
    min-height: 44px;
  }

  .status-bar {
    flex-wrap: wrap;
  }

  .status-bar .btn-danger {
    width: 100%;
    margin-left: 0 !important;
    margin-top: 8px;
    min-height: 44px;
  }

  .map-header {
    flex-direction: column;
    align-items: stretch;
  }

  .map-actions {
    width: 100%;
  }

  .map-actions .btn,
  .map-actions .refresh-row {
    width: 100%;
  }

  .refresh-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .refresh-row .form-select {
    width: 100%;
  }

  #map {
    height: min(50vh, 360px);
    min-height: 240px;
  }

  .legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .legend-item[style*='margin-left'] {
    margin-left: 0 !important;
  }

  .fetch-btn {
    min-height: 44px;
    padding: 10px 16px;
  }

  .upload-zone {
    padding: 1.5rem 1rem;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    position: static;
  }

  .admin-nav-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .admin-nav-actions .btn {
    flex: 1;
    min-width: 140px;
  }

  .btn {
    min-height: 44px;
    padding: 10px 18px;
  }

  .criteria-row {
    flex-wrap: wrap;
    gap: 4px;
  }
}

/* ── Responsive: små mobiler ── */
@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 1rem;
  }

  .nav-brand {
    font-size: 1rem;
  }

  .deadline-badge {
    font-size: 0.625rem;
    padding: 4px 10px;
  }
}

/* ── Responsive: stor skjerm ── */
@media (min-width: 1280px) {
  .anbud-overview:not(:has(.anbud-table-card)),
  .anbud-grid:not(.anbud-table-body) {
    max-width: 1000px;
  }

  .anbud-table-card,
  .anbud-table-body.anbud-grid {
    max-width: none;
  }
}

/* ── Container generator ── */
.cg-page .cg-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.25rem;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  align-items: start;
}

.cg-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  border-radius: var(--ep-radius-lg);
  transition: box-shadow 0.25s ease;
}

.cg-main--fresh {
  box-shadow: 0 0 0 2px rgba(0, 200, 83, 0.35);
}

.cg-section {
  padding: 1.25rem 1.5rem;
}

.cg-section-hint {
  margin: -0.5rem 0 1rem;
}

.cg-section--inactive {
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
}

.cg-section--inactive .cg-section-title::after {
  content: ' (not applicable)';
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--ep-text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.cg-field--disabled {
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
}

.cg-field--disabled .form-label::after {
  content: ' (not applicable)';
  font-weight: 400;
  font-size: 0.6875rem;
  color: var(--ep-text-muted);
}

.cg-aside {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: calc(var(--ep-header-h) + 12px);
}

.cg-summary-card {
  padding: 1.25rem;
}

.cg-reset-notice {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--ep-radius);
  background: var(--ep-green-glow);
  border: 1px solid rgba(0, 168, 68, 0.25);
  color: var(--ep-green-dark);
  font-size: 0.875rem;
  font-weight: 600;
}

.cg-summary-card--fresh {
  box-shadow: 0 0 0 2px rgba(0, 200, 83, 0.35);
  transition: box-shadow 0.25s ease;
}

.cg-summary-kicker {
  font-size: 0.75rem;
  color: var(--ep-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cg-summary-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ep-navy);
  margin: 4px 0 8px;
}

.cg-spec-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  font-size: 0.8125rem;
  margin: 12px 0;
}

.cg-spec-dl dt {
  color: var(--ep-text-muted);
  font-weight: 500;
}

.cg-spec-dl dd {
  margin: 0;
  color: var(--ep-text);
}

.cg-weight-box {
  background: var(--ep-bg);
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius);
  padding: 10px 12px;
  margin: 12px 0;
}

.cg-weight-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8125rem;
  padding: 4px 0;
}

.cg-weight-row--total {
  border-top: 1px solid var(--ep-border-strong);
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 600;
  color: var(--ep-navy);
}

.cg-details {
  margin-top: 8px;
  font-size: 0.8125rem;
}

.cg-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ep-navy-light);
}

.cg-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.cg-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--ep-border);
}

.cg-list {
  margin: 8px 0 0 1rem;
  font-size: 0.8125rem;
}

.cg-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cg-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: start;
  font-size: 0.8125rem;
  cursor: pointer;
}

.cg-option--disabled {
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
}

.cg-option strong {
  color: var(--ep-navy);
  white-space: nowrap;
}

.cg-saved-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ep-border);
}

.cg-price-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--ep-border-strong);
}

.cg-admin-json,
.cg-admin-lines {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.75rem;
}

@media (max-width: 960px) {
  .cg-page .cg-layout {
    grid-template-columns: 1fr;
  }

  .cg-aside {
    position: static;
  }
}

@media print {
  .site-header,
  .cg-main,
  .cg-aside .card:not(.cg-summary-card),
  .page-header .toolbar {
    display: none !important;
  }

  .cg-page .cg-layout {
    display: block;
    padding: 0;
  }

  .cg-summary-card {
    box-shadow: none;
    border: none;
  }
}

/* Archive */
.archive-list {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.archive-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.archive-item-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ep-navy);
  margin: 0 0 4px;
}

/* Projects */
.projects-layout {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 0 2rem;
  display: grid;
  grid-template-columns: minmax(160px, 200px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  min-width: 0;
}

.projects-sidebar {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  position: sticky;
  top: calc(var(--ep-header-h) + 8px);
  min-width: 0;
}

.projects-list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--ep-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font: inherit;
}

.projects-list-item:hover {
  border-color: var(--ep-blue);
}

.projects-list-item--active {
  border-color: var(--ep-navy);
  background: var(--ep-surface-muted);
}

.projects-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  overflow-x: hidden;
}

.projects-main .card {
  padding: 1.25rem;
}

.projects-main .form-input,
.projects-main .form-textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.project-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-detail-header .btn {
  flex-shrink: 0;
}

.project-detail-title {
  margin: 0 0 4px;
  font-size: 1.125rem;
  color: var(--ep-navy);
  line-height: 1.3;
}

.project-section {
  padding: 0;
}

.project-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.project-section-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ep-navy);
}

/* Order & transport cards — compact, no horizontal scroll */
.project-order-card,
.project-transport-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  padding: 1rem 0;
  border-bottom: 1px solid var(--ep-border);
}

.project-order-card:first-child,
.project-transport-card:first-child {
  padding-top: 0;
}

.project-order-card:last-child,
.project-transport-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.project-order-fields,
.project-transport-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem 0.875rem;
  min-width: 0;
}

.project-order-field,
.project-transport-field {
  margin: 0;
  min-width: 0;
}

.project-order-field--full,
.project-transport-field--full {
  grid-column: 1 / -1;
}

.project-order-field--check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1.375rem;
}

.project-order-field--check .form-label {
  margin: 0;
  font-weight: 500;
}

.project-order-field--check input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.project-orders-header,
.project-order-row,
.project-transport-row {
  display: none;
}

.project-row-remove {
  flex-shrink: 0;
  margin-top: 1.375rem;
}

.project-date-input {
  min-width: 0 !important;
}

.project-check-row {
  margin-bottom: 8px;
  display: grid;
  gap: 8px;
  align-items: center;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.project-check-row:has(.project-date-input) {
  grid-template-columns: auto minmax(0, 1fr) minmax(7.5rem, 0.65fr) auto;
}

.project-checklist,
.project-transport-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.project-orders {
  width: 100%;
  min-width: 0;
}

.project-meeting-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.project-meeting-field {
  margin: 0;
  min-width: 0;
}

.project-meeting-referat {
  margin: 0;
}

.project-meeting-remove {
  grid-column: 1 / -1;
  justify-self: end;
  margin: 0;
}

.project-meeting-card {
  display: block;
  padding: 1rem;
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius);
  background: var(--ep-surface-muted);
}

.project-meeting-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem 0.875rem;
  align-items: end;
  margin-bottom: 10px;
}

.project-meeting-field--wide {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .projects-layout {
    grid-template-columns: 1fr;
  }

  .projects-sidebar {
    position: static;
    max-height: none;
  }

  .project-check-row,
  .project-check-row:has(.project-date-input) {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .project-check-row .project-date-input {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .project-order-fields,
  .project-transport-fields,
  .project-meeting-meta {
    grid-template-columns: 1fr;
  }

  .project-order-field--check {
    padding-top: 0;
  }

  .project-row-remove {
    margin-top: 0;
  }

  .project-order-card,
  .project-transport-card {
    grid-template-columns: 1fr;
  }

  .project-row-remove {
    justify-self: end;
  }
}

/* Logistics */
.logistics-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
  overflow-x: hidden;
}

.logistics-panel {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  min-width: 0;
}

.logistics-section {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  min-width: 0;
}

.logistics-section-title {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ep-text-muted);
}

.logistics-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.25rem;
  background: var(--ep-surface);
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius-pill);
  width: fit-content;
  max-width: 100%;
}

.logistics-tab {
  border: 1px solid var(--ep-border);
  background: #fff;
  color: var(--ep-navy);
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.logistics-tab--active {
  background: linear-gradient(180deg, var(--ep-green) 0%, var(--ep-green-dark) 100%);
  border-color: var(--ep-green-dark);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 168, 68, 0.3);
}

.logistics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  width: 100%;
  min-width: 0;
  align-items: start;
}

.logistics-grid > .card + .card {
  margin-top: 0;
}

.logistics-card {
  min-width: 0;
  height: 100%;
}

.logistics-card--full {
  width: 100%;
}

.logistics-card-title {
  margin: 0 0 0.375rem;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ep-navy);
  letter-spacing: -0.02em;
}

.logistics-card-lead {
  margin: 0 0 1rem;
}

.logistics-form .form-input,
.logistics-form .form-select,
.logistics-form .form-textarea,
.logistics-card .form-input,
.logistics-card .form-select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.logistics-lines-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 12px 0 8px;
}

.logistics-line-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.5rem auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.logistics-line-row .logistics-line-qty {
  text-align: center;
}

.logistics-form-actions {
  margin-top: 12px;
}

.logistics-result {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--ep-radius);
  background: var(--ep-surface-muted);
  border: 1px solid var(--ep-border);
}

.logistics-result--compact {
  margin-top: 8px;
}

.logistics-result-total {
  font-size: 1.05rem;
  margin: 0 0 6px;
}

.logistics-result-list {
  margin: 8px 0 0;
  padding-left: 1.2rem;
}

.logistics-result--panel {
  margin-top: 0;
  background: transparent;
  border: none;
  padding: 0;
}

.logistics-history {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.logistics-history-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius-lg);
  background: var(--ep-surface-muted);
  min-width: 0;
}

.logistics-history-main {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
  cursor: pointer;
}

.logistics-history-route {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--ep-navy);
  line-height: 1.35;
  word-break: break-word;
}

.logistics-history-price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ep-green-dark);
}

.logistics-history-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ep-border);
}

.logistics-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.logistics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.logistics-table th,
.logistics-table td {
  padding: 8px;
  border-bottom: 1px solid var(--ep-border);
  text-align: left;
  vertical-align: top;
}

.logistics-table th {
  color: var(--ep-text-muted);
  font-weight: 500;
}

@media (max-width: 1024px) {
  .logistics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .logistics-history {
    grid-template-columns: 1fr;
  }

  .logistics-line-row {
    grid-template-columns: 1fr 4.5rem auto;
  }
}

@media (max-width: 520px) {
  .logistics-line-row {
    grid-template-columns: 1fr auto;
  }

  .logistics-line-row .logistics-line-qty {
    grid-column: 1;
    width: 100%;
    text-align: left;
  }

  .logistics-line-row .btn-danger {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
  }
}

.logistics-map-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.logistics-map-host {
  position: relative;
}

.logistics-map-message {
  margin: 0 0 8px;
}

.logistics-map {
  width: 100%;
  height: min(62vh, 520px);
  min-height: 320px;
  border-radius: var(--ep-radius);
  border: 1px solid var(--ep-border);
  background: var(--ep-surface-muted);
  z-index: 0;
}

.logistics-map-marker-wrap {
  background: transparent;
  border: none;
}

.logistics-map-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.logistics-map-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.logistics-map-legend-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.logistics-map-legend-intro {
  margin: 0;
  flex: 1;
  min-width: 200px;
}

.logistics-map-legend-item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--ep-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.logistics-map-legend-item--error {
  opacity: 0.75;
}

.logistics-map-legend-number,
.logistics-map-legend-swatch {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.logistics-map-legend-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.logistics-map-legend-link {
  font-size: 0.8125rem;
  white-space: nowrap;
}

.logistics-history-main[data-focus-trip] {
  cursor: pointer;
}

.logistics-history-main[data-focus-trip]:hover strong {
  color: var(--ep-blue);
}

.logistics-layer-list {
  margin: 4px 0 0;
  padding-left: 1.2rem;
  font-size: 0.8125rem;
  color: var(--ep-text-muted);
}

.logistics-layer-detail-row td {
  padding-top: 0;
  border-bottom: 1px solid var(--ep-border);
}

.logistics-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.logistics-rule-item {
  padding: 10px 12px;
  border: 1px solid var(--ep-border);
  border-radius: 8px;
  background: var(--ep-surface-muted);
}

.logistics-rule-item strong {
  display: block;
  margin-top: 4px;
  color: var(--ep-navy);
}

.logistics-pipeline-list {
  margin: 0 0 12px;
  padding-left: 1.2rem;
  font-size: 0.875rem;
  color: var(--ep-text-muted);
}

.logistics-report-summary {
  margin-bottom: 12px;
}

.logistics-report-json {
  margin: 8px 0 0;
  padding: 12px;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 8px;
  font-size: 0.8125rem;
  overflow-x: auto;
}

.logistics-report-details summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--ep-navy);
}
