:root {
  --navy: #002554;
  --gold: #f1b434;
  --bg: #eeeeee;
  --white: #ffffff;
  --text: #1a1a1a;
  --border: #e0e0e0;
}

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

html, body { height: 100%; }

body {
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */
header {
  background: var(--navy);
  color: white;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  flex-shrink: 0;
  z-index: 10;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  position: relative;
}

#btn-toggle-view {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-logo {
  height: 28px;
  width: auto;
  display: block;
}

/* ── Buttons ── */
.btn-gold {
  background: var(--gold);
  color: var(--navy);
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  transition: filter 0.15s;
}
.btn-gold:hover { filter: brightness(0.92); }
.btn-new-filterbar { margin-left: auto; padding: 6px 14px; font-size: 12px; }

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  font-size: 13px;
}
.btn-secondary:hover { background: #f5f5f5; }

.btn-danger {
  background: white;
  color: #dc2626;
  border: 1px solid #fca5a5;
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}
.btn-danger:hover { background: #fee2e2; border-color: #dc2626; }

/* ── Filter bar ── */
.filter-bar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
  /* Uten wrap havner de siste knappene utenfor skjermen på smale vinduer */
  flex-wrap: wrap;
  row-gap: 8px;
}

.filter-bar select,
.filter-bar input[type="text"] {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  outline: none;
  font-family: Arial, sans-serif;
}
.filter-bar select:focus,
.filter-bar input:focus { border-color: var(--navy); }

.count-badge {
  margin-left: auto;
  color: #888;
  font-size: 13px;
}

.filter-btn {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.filter-btn:hover { border-color: var(--navy); color: var(--navy); }
.filter-btn.filter-btn-active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--gold);
}

.filter-transportor-wrap {
  position: relative;
}

.filter-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 6px 4px;
  min-width: 160px;
  z-index: 50;
}

.filter-dropdown label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 5px;
  white-space: nowrap;
  transition: background 0.1s;
}
.filter-dropdown label:hover { background: #f5f7ff; }
.filter-dropdown label input[type=checkbox] { accent-color: var(--navy); width: 14px; height: 14px; }

.filter-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

.filter-transportor-badge {
  background: var(--gold);
  color: var(--navy);
  border-radius: 8px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 2px;
}

/* ── Main table area ── */
main {
  padding: 16px 24px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-wrapper {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: auto;
  flex: 1;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead tr { background: var(--navy); color: white; }

thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--navy);
}

th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  position: relative;
}

/* ── Column resize handle ── */
.col-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 2;
  background: transparent;
  transition: background 0.15s;
}
.col-resize-handle:hover,
.col-resize-handle.resizing {
  background: rgba(241, 180, 52, 0.55);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr.date-break td { border-top: 2px solid #002554; }
tbody tr:hover { background: #eef2fa; }
tbody tr:nth-child(even) { background: #f9f9f9; }
tbody tr:nth-child(even):hover { background: #eef2fa; }

td {
  padding: 8px 12px;
  white-space: nowrap;
}

/* ── DEPIX progress bar ── */
.depix-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 110px;
}
.depix-track {
  flex: 1;
  background: #e5e7eb;
  border-radius: 99px;
  height: 7px;
  min-width: 60px;
}
.depix-fill {
  background: var(--gold);
  height: 7px;
  border-radius: 99px;
  transition: width 0.3s;
}
.depix-label {
  color: #888;
  font-size: 11px;
  width: 30px;
  text-align: right;
}

/* ── Status badge ── */
.status-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

/* ── Checklist indicator ── */
.checklist-indicator { font-weight: 600; font-size: 13px; }
.cl-done    { color: #16a34a; }
.cl-partial { color: #ca8a04; }
.cl-empty   { color: #9ca3af; }

/* ── TC cell ── */
.tc-ok   { color: #16a34a; font-weight: 700; font-size: 12px; }
.tc-date { color: var(--navy); font-size: 12px; }

/* ── Panel action buttons ── */
.panel-actions {
  display: flex;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #fafafa;
}

.btn-hold {
  flex: 1;
  padding: 8px;
  border: 1px solid #fbbf24;
  background: #fffbeb;
  color: #b45309;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: Arial, sans-serif;
  transition: all 0.15s;
}
.btn-hold:hover { background: #fef3c7; border-color: #b45309; }
.btn-hold.active-hold { background: #b45309; color: white; border-color: #b45309; }

.btn-ferdig {
  flex: 1;
  padding: 8px;
  border: 1px solid #86efac;
  background: #f0fdf4;
  color: #15803d;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: Arial, sans-serif;
  transition: all 0.15s;
}
.btn-ferdig:hover { background: #dcfce7; border-color: #15803d; }
.btn-ferdig.active-ferdig { background: #15803d; color: white; border-color: #15803d; }

/* ── Hold / Ferdig row indicators ── */
tbody tr.row-hold   { border-left: 3px solid #f59e0b; }
tbody tr.row-ferdig { border-left: 3px solid #16a34a; opacity: 0.85; }

tbody tr.row-lkw         { background: #f0fdf4; }
tbody tr.row-prio-red    { background: #fff1f1; }
tbody tr.row-prio-orange { background: #fff8f1; }
tbody tr.row-prio-yellow  { background: #fffef0; }
tbody tr.row-prio-purple  { background: #faf5ff; }

/* ── Logo-merke i venstre band ── */
tbody td:first-child {
  position: relative;
  padding-left: 30px;
}

tbody td:first-child::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 22px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 13px 17px;
  background-image: url("data:image/svg+xml,<svg viewBox='0 0 950 1260' xmlns='http://www.w3.org/2000/svg' style='fill-rule:evenodd'><path d='M359.553,388.713c-787.315,524.872 -108.405,1081.716 391.463,788.335c-370.617,114.076 -807.744,-217.428 -497.828,-568.45c40.364,-53.453 127.922,-153.529 106.365,-219.885' fill='%23f9b233'/><path d='M233.406,755.404c266.013,351.115 800.018,18.25 266.013,-755.404c897.111,954.783 -176.353,1564.848 -266.013,755.404' fill='%23ffffff'/><path d='M625.662,6.696c241.427,52.989 588.817,412.171 300.289,965.677c50.749,-494.367 -124.384,-782.123 -300.289,-965.677' fill='%23f9b233'/></svg>");
}

/* Svøpet (hvit path) skifter farge etter prioritet */
tbody tr.row-prio-red td:first-child::before {
  background-image: url("data:image/svg+xml,<svg viewBox='0 0 950 1260' xmlns='http://www.w3.org/2000/svg' style='fill-rule:evenodd'><path d='M359.553,388.713c-787.315,524.872 -108.405,1081.716 391.463,788.335c-370.617,114.076 -807.744,-217.428 -497.828,-568.45c40.364,-53.453 127.922,-153.529 106.365,-219.885' fill='%23f9b233'/><path d='M233.406,755.404c266.013,351.115 800.018,18.25 266.013,-755.404c897.111,954.783 -176.353,1564.848 -266.013,755.404' fill='%23dc2626'/><path d='M625.662,6.696c241.427,52.989 588.817,412.171 300.289,965.677c50.749,-494.367 -124.384,-782.123 -300.289,-965.677' fill='%23f9b233'/></svg>");
}
tbody tr.row-prio-orange td:first-child::before {
  background-image: url("data:image/svg+xml,<svg viewBox='0 0 950 1260' xmlns='http://www.w3.org/2000/svg' style='fill-rule:evenodd'><path d='M359.553,388.713c-787.315,524.872 -108.405,1081.716 391.463,788.335c-370.617,114.076 -807.744,-217.428 -497.828,-568.45c40.364,-53.453 127.922,-153.529 106.365,-219.885' fill='%23f9b233'/><path d='M233.406,755.404c266.013,351.115 800.018,18.25 266.013,-755.404c897.111,954.783 -176.353,1564.848 -266.013,755.404' fill='%23ea580c'/><path d='M625.662,6.696c241.427,52.989 588.817,412.171 300.289,965.677c50.749,-494.367 -124.384,-782.123 -300.289,-965.677' fill='%23f9b233'/></svg>");
}
tbody tr.row-prio-yellow td:first-child::before {
  background-image: url("data:image/svg+xml,<svg viewBox='0 0 950 1260' xmlns='http://www.w3.org/2000/svg' style='fill-rule:evenodd'><path d='M359.553,388.713c-787.315,524.872 -108.405,1081.716 391.463,788.335c-370.617,114.076 -807.744,-217.428 -497.828,-568.45c40.364,-53.453 127.922,-153.529 106.365,-219.885' fill='%23f9b233'/><path d='M233.406,755.404c266.013,351.115 800.018,18.25 266.013,-755.404c897.111,954.783 -176.353,1564.848 -266.013,755.404' fill='%23ca8a04'/><path d='M625.662,6.696c241.427,52.989 588.817,412.171 300.289,965.677c50.749,-494.367 -124.384,-782.123 -300.289,-965.677' fill='%23f9b233'/></svg>");
}
tbody tr.row-prio-purple td:first-child::before {
  background-image: url("data:image/svg+xml,<svg viewBox='0 0 950 1260' xmlns='http://www.w3.org/2000/svg' style='fill-rule:evenodd'><path d='M359.553,388.713c-787.315,524.872 -108.405,1081.716 391.463,788.335c-370.617,114.076 -807.744,-217.428 -497.828,-568.45c40.364,-53.453 127.922,-153.529 106.365,-219.885' fill='%23f9b233'/><path d='M233.406,755.404c266.013,351.115 800.018,18.25 266.013,-755.404c897.111,954.783 -176.353,1564.848 -266.013,755.404' fill='%239333ea'/><path d='M625.662,6.696c241.427,52.989 588.817,412.171 300.289,965.677c50.749,-494.367 -124.384,-782.123 -300.289,-965.677' fill='%23f9b233'/></svg>");
}
tbody tr.row-lkw td:first-child::before {
  background-image: url("data:image/svg+xml,<svg viewBox='0 0 950 1260' xmlns='http://www.w3.org/2000/svg' style='fill-rule:evenodd'><path d='M359.553,388.713c-787.315,524.872 -108.405,1081.716 391.463,788.335c-370.617,114.076 -807.744,-217.428 -497.828,-568.45c40.364,-53.453 127.922,-153.529 106.365,-219.885' fill='%23f9b233'/><path d='M233.406,755.404c266.013,351.115 800.018,18.25 266.013,-755.404c897.111,954.783 -176.353,1564.848 -266.013,755.404' fill='%2316a34a'/><path d='M625.662,6.696c241.427,52.989 588.817,412.171 300.289,965.677c50.749,-494.367 -124.384,-782.123 -300.289,-965.677' fill='%23f9b233'/></svg>");
}

/* ── Delete button ── */
.btn-delete {
  background: none;
  border: none;
  color: #f87171;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.btn-delete:hover { background: #fee2e2; color: #dc2626; }

/* ── Empty state ── */
.empty-state {
  padding: 60px 24px;
  text-align: center;
  color: #9ca3af;
}

/* ── Side panel overlay ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 100;
}

/* ── Side panel ── */
.side-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 480px;
  max-width: 100vw;
  background: white;
  z-index: 101;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.16);
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.panel-header {
  background: var(--navy);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.panel-header h2 { font-size: 16px; font-weight: 700; }

.panel-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.panel-close:hover { color: white; }

.btn-panel-cancel {
  background: var(--gold);
  border: none;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 5px 16px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  transition: filter 0.15s;
}
.btn-panel-cancel:hover { filter: brightness(0.92); }

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-panel-copy {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 14px;
  border-radius: 6px;
  transition: background 0.15s;
}
.btn-panel-copy:hover { background: rgba(255,255,255,0.25); }

.opt-klasse {
  font-size: 11px;
  color: #333;
  border: 1px solid #dde3ec;
  border-radius: 5px;
  padding: 3px 5px;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.cfp-klasser { margin-bottom: 7px; }

.ferdig-missing {
  font-size: 11px;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 7px 10px;
  margin: 0 20px 10px;
  line-height: 1.45;
}
#btn-ferdig:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.panel-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  flex-shrink: 0;
  background: #f9f9f9;
}
.panel-footer button { flex: 1; }

/* ── Form sections ── */
.form-section { margin-bottom: 24px; }

.section-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(0,37,84,0.15);
  padding-bottom: 6px;
  margin-bottom: 12px;
}
.section-title-row .section-title {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
  flex: 1;
}
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--navy);
  border-bottom: 1px solid rgba(0,37,84,0.15);
  padding-bottom: 6px;
  margin-bottom: 12px;
}
.btn-copy-address {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  color: #555;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-copy-address:hover { background: #f0f4ff; border-color: var(--navy); color: var(--navy); }
.btn-copy-address.copied { background: #e8f8ee; border-color: #27ae60; color: #27ae60; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full-width { grid-column: span 2; }

.form-group label {
  font-size: 11px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: Arial, sans-serif;
  outline: none;
  transition: border-color 0.15s;
  background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--navy); }

/* Påkrevd felt som ennå ikke er fylt ut */
.form-group input.felt-mangler,
.form-group select.felt-mangler,
input.felt-mangler {
  background: #fff8db;
  border-color: #e3c75f;
}
.form-group input.felt-mangler:focus,
.form-group select.felt-mangler:focus,
input.felt-mangler:focus { border-color: var(--navy); }

textarea { resize: vertical; }

.differanse-display {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 700;
  background: #f9f9f9;
  color: #aaa;
}
.differanse-display.positive { color: #dc2626; background: #fef2f2; border-color: #fca5a5; }
.differanse-display.negative { color: #15803d; background: #f0fdf4; border-color: #86efac; }
.differanse-display.zero     { color: #555;    background: #f9f9f9; }

/* ── TC mode toggle ── */
.tc-toggle { display: flex; gap: 6px; margin-top: 4px; }

.tc-btn {
  padding: 5px 16px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: Arial, sans-serif;
  transition: all 0.15s;
}
.tc-btn.active {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.tc-btn.active-ok {
  background: #16a34a;
  color: white;
  border-color: #16a34a;
}

/* ── Checklist ── */
.checklist { display: flex; flex-direction: column; gap: 4px; }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 7px 8px;
  border-radius: 6px;
  transition: background 0.1s;
  user-select: none;
}
.checklist-item:hover { background: #f5f5f5; }

.checklist-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
  flex-shrink: 0;
}

.checklist-item .cl-label {
  font-size: 13px;
  color: var(--text);
  flex: 1;
  transition: color 0.15s;
}
.checklist-item.checked .cl-label {
  text-decoration: line-through;
  color: #9ca3af;
}

.cl-check-icon {
  color: #16a34a;
  font-size: 13px;
  font-weight: 700;
}

/* ── Checklist popup ── */
.cl-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 200;
}

.cl-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 201;
  width: 300px;
  max-width: 95vw;
  animation: popupIn 0.15s ease;
}

@keyframes popupIn {
  from { transform: translate(-50%, -50%) scale(0.92); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
}

.cl-popup-header {
  background: var(--navy);
  color: white;
  padding: 12px 16px;
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cl-popup-header span { font-size: 14px; font-weight: 700; }
.cl-popup-header button {
  background: var(--gold);
  border: none;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 6px;
  transition: filter 0.15s;
}
.cl-popup-header button:hover { filter: brightness(0.92); }

.cl-popup-body { padding: 12px 8px; }

td.cl-cell { cursor: pointer; }
td.cl-cell:hover .checklist-indicator { text-decoration: underline dotted; }

/* ── Note popup ── */
.note-popup-body {
  padding: 12px 16px;
}
.note-popup-body textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: Arial, sans-serif;
  resize: vertical;
  outline: none;
}
.note-popup-body textarea:focus { border-color: var(--navy); }

.note-popup-footer {
  padding: 0 16px 14px;
  display: flex;
  justify-content: flex-end;
}

td.note-cell { cursor: pointer; text-align: center; width: 36px; }
td.note-cell svg { display: block; margin: 0 auto; transition: opacity 0.15s; }
td.note-cell:hover svg { opacity: 0.7; }

td.docs-cell { width: 48px; }
.docs-icon { cursor: pointer; display: inline-flex; align-items: center; gap: 3px; transition: opacity 0.15s; }
.docs-icon:hover { opacity: 0.7; }
.docs-badge {
  background: #2563eb;
  color: white;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  line-height: 16px;
}

.docs-popup-info {
  padding: 6px 16px 8px;
  font-size: 12px;
  color: #888;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.docs-popup-footer {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
}

.docs-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}
.docs-file-row:last-child { border-bottom: none; }
.docs-file-name {
  flex: 1;
  color: #2563eb;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.docs-file-name:hover { text-decoration: underline; }
.docs-file-size { font-size: 11px; color: #888; white-space: nowrap; }
.docs-file-delete {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.1s, background 0.1s;
}
.docs-file-delete:hover { color: #c0392b; background: #fdf2f2; }
.docs-uploading { color: #888; font-size: 13px; padding: 8px 4px; }

/* ── Comment popup ── */
.comment-popup { width: 360px; }

td.comments-cell { width: 48px; position: relative; }
.comments-icon { cursor: pointer; display: inline-flex; align-items: center; gap: 3px; transition: opacity 0.15s; }
.comments-icon:hover { opacity: 0.7; }
.comments-new-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e53e3e;
  border: 1.5px solid #fff;
  pointer-events: none;
}
.comments-badge {
  background: #2563eb;
  color: white;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  line-height: 16px;
}

.comment-popup-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  min-height: 48px;
}

.comment-item {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.comment-user {
  font-weight: 700;
  color: var(--navy);
  font-size: 12px;
}

.comment-date {
  font-size: 11px;
  color: #999;
}

.comment-text {
  color: #1a1a1a;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-empty {
  color: #aaa;
  font-size: 12px;
  text-align: center;
  padding: 12px 0;
  margin: 0;
}

.comment-popup-footer {
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-popup-footer textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: Arial, sans-serif;
  resize: none;
  outline: none;
  box-sizing: border-box;
}
.comment-popup-footer textarea:focus { border-color: var(--navy); }

.comment-popup-footer .btn-gold {
  width: 100%;
  padding: 8px;
}

/* ── Column settings button ── */
.btn-col-settings {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  transition: all 0.15s;
}
.btn-col-settings:hover { background: #f0f4ff; border-color: var(--navy); color: var(--navy); }

/* ── Varsle ansvarlig ── */
.btn-varsle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}
.btn-varsle:hover:not(:disabled) { filter: brightness(1.25); }
.btn-varsle:disabled { opacity: 0.4; cursor: not-allowed; }
.varsle-hint { font-size: 11.5px; color: #666; margin-top: 6px; line-height: 1.4; }

/* ── Eksport-dialog ── */
.export-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 201;
  width: 460px;
  max-width: 94vw;
  display: flex;
  flex-direction: column;
  animation: popupIn 0.15s ease;
}
.export-body { padding: 16px; }
.export-desc { font-size: 12.5px; color: #555; margin-bottom: 13px; }

.export-modes { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.export-mode {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid #e0e4ea;
  border-radius: 7px;
  padding: 9px 11px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.export-mode:hover { background: #f7f9fc; }
.export-mode input { margin: 2px 0 0; cursor: pointer; }
.export-mode span { display: flex; flex-direction: column; gap: 2px; }
.export-mode strong { font-size: 13px; color: #1a1a1a; }
.export-mode em { font-style: normal; font-size: 11.5px; color: #777; }
.export-mode:has(input:checked) {
  border-color: var(--navy);
  background: #f3f7fd;
}
.export-grid { display: flex; gap: 11px; flex-wrap: wrap; }
.export-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 1;
  min-width: 120px;
}
.export-grid input,
.export-grid select {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  color: #1a1a1a;
}
.export-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: #444;
  margin-top: 13px;
  cursor: pointer;
}
.export-check input { margin: 0; cursor: pointer; }
.export-count {
  margin-top: 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy);
  background: var(--light-grey, #eeeeee);
  border-radius: 6px;
  padding: 8px 11px;
}
.export-foot {
  padding: 12px 16px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
}
.export-foot button { padding: 7px 18px; border-radius: 6px; cursor: pointer; }
.export-foot button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Kolonnesortering og -filtrering ── */
#transport-table thead th { cursor: pointer; user-select: none; }
#transport-table thead th .th-label { margin-right: 2px; }
.th-sort { font-size: 8px; opacity: 0.9; margin-right: 2px; }
.th-filter {
  display: inline-flex;
  align-items: center;
  opacity: 0.35;
  padding: 0 2px;
  vertical-align: middle;
}
.th-filter:hover { opacity: 1; }
.th-filter-active { opacity: 1; color: var(--gold); }

.col-filter-pop {
  position: fixed;
  z-index: 300;
  background: #fff;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  width: 230px;
  padding: 9px;
  font-size: 12.5px;
  color: #1a1a1a;
}
.cfp-head {
  font-weight: 700;
  color: var(--navy);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 7px;
}
.cfp-search {
  width: 100%;
  border: 1px solid #e0e0e0;
  border-radius: 5px;
  padding: 5px 7px;
  font-size: 12.5px;
  margin-bottom: 6px;
}
.cfp-actions { display: flex; gap: 10px; margin-bottom: 5px; }
.cfp-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 11px;
  color: var(--navy);
  cursor: pointer;
  text-decoration: underline;
}
.cfp-list { max-height: 190px; overflow-y: auto; margin-bottom: 8px; }
.cfp-list label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 2px;
  cursor: pointer;
  border-radius: 4px;
}
.cfp-list label:hover { background: #f3f6fa; }
.cfp-list input { margin: 0; cursor: pointer; }
.cfp-empty { color: #999; padding: 8px 2px; }
.cfp-foot { display: flex; gap: 7px; justify-content: flex-end; }
.cfp-clear {
  background: #eee;
  border: none;
  border-radius: 5px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
}
.cfp-apply { padding: 5px 13px; font-size: 12px; border-radius: 5px; cursor: pointer; }

.col-filter-date { width: 252px; }
.cfp-range { display: flex; gap: 8px; margin-bottom: 9px; }
.cfp-range label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  font-size: 10px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cfp-range input {
  border: 1px solid #e0e0e0;
  border-radius: 5px;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 400;
  color: #1a1a1a;
}
.cfp-quick { margin-bottom: 8px; }
.cfp-ar {
  border: 1px solid #e0e0e0;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 12px;
  margin-bottom: 6px;
  width: 100%;
}
.cfp-qbtns { display: flex; gap: 4px; flex-wrap: wrap; }
.cfp-q {
  flex: 1;
  min-width: 38px;
  background: #f0f3f8;
  border: 1px solid #dde3ec;
  border-radius: 5px;
  padding: 4px 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
}
.cfp-q:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.cfp-q-ar { flex: 0 0 100%; min-width: 0; }
.cfp-treff {
  font-size: 11.5px;
  color: #555;
  background: #f5f7fa;
  border-radius: 5px;
  padding: 5px 8px;
  margin-bottom: 8px;
}

/* ── Kostnadslogg ── */
.kostnad-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 201;
  width: 940px;
  max-width: 96vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: popupIn 0.15s ease;
}
.kostnad-filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  flex-wrap: wrap;
}
.kostnad-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kostnad-filters input,
.kostnad-filters select {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 13px;
  text-transform: none;
  font-weight: 400;
  color: #1a1a1a;
}
.kostnad-reset { height: 31px; }
.kostnad-export {
  height: 31px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 6px;
  padding: 0 13px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  margin-left: auto;
}
.kostnad-export:disabled { opacity: 0.4; cursor: not-allowed; }
.kostnad-body { overflow-y: auto; flex: 1; padding: 16px; }

.kost-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.kost-card {
  background: var(--light-grey, #eeeeee);
  border-radius: 8px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.kost-card-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kost-card-val { font-size: 19px; font-weight: 700; color: var(--navy); }

.kost-heading {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 16px 0 7px;
}
.kost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.kost-table th {
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  text-align: left;
  padding: 7px 9px;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.kost-table td { padding: 6px 9px; border-bottom: 1px solid #f0f0f0; }
/* Hovedtabellens DEPIX-logo ligger på en uscopet «tbody td:first-child»-regel
   og lekker inn hit — nøytraliser den for kostnadstabellene */
.kost-table tbody td:first-child { padding-left: 9px; }
.kost-table tbody td:first-child::before { content: none; }
.kost-table tbody tr:hover { background: #f7f9fc; }
.kost-num { text-align: right; white-space: nowrap; }
.kost-sortable { cursor: pointer; user-select: none; }
.kost-sortable:hover { background: #013a7a; }
.kost-pos { color: #15803d; font-weight: 600; }
.kost-neg { color: #dc2626; font-weight: 600; }
.kost-empty { text-align: center; color: #999; padding: 14px; }

/* ── Compare modal ── */
.compare-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 201;
  width: 720px;
  max-width: 96vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: popupIn 0.15s ease;
}

.compare-body {
  overflow-y: auto;
  flex: 1;
  padding: 16px;
}

.compare-info { font-size: 13px; color: #444; }

.compare-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.compare-stat {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.compare-stat-total   { background: #f0f4ff; color: var(--navy); }
.compare-stat-new     { background: #fff3cd; color: #856404; }
.compare-stat-changed { background: #fde8d8; color: #92400e; }
.compare-stat-known   { background: #d1fae5; color: #065f46; }

.compare-section { margin-bottom: 20px; }

.compare-section-header {
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px 6px 0 0;
  margin-bottom: 0;
}
.compare-new-header     { background: #fff3cd; color: #856404; }
.compare-changed-header { background: #fde8d8; color: #92400e; }
.compare-known-header   { background: #d1fae5; color: #065f46; }
.compare-date-old { color: #999; text-decoration: line-through; }
.compare-date-new { color: #c0392b; font-weight: 600; }

.compare-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.compare-table th {
  background: #f8f9fa;
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
  color: #555;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.compare-table td {
  padding: 5px 10px;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr:hover td { background: #f8f9fa; }

.compare-empty { color: #aaa; font-size: 12px; padding: 10px 12px; margin: 0; border: 1px solid var(--border); border-top: none; border-radius: 0 0 6px 6px; }

.compare-col-btn {
  text-align: left;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
  font-size: 13px;
  transition: border-color 0.1s, background 0.1s;
}
.compare-col-btn:hover { background: #f0f4ff; border-color: var(--navy); }
.compare-col-sample { color: #888; font-size: 11px; margin-left: 8px; }

.compare-import-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px 4px;
  gap: 12px;
}
.compare-selected-count { font-size: 12px; color: #666; }
.compare-import-btn { padding: 7px 18px; font-size: 13px; }
.compare-import-ok {
  background: #d1fae5;
  color: #065f46;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.compare-table thead input[type="checkbox"],
.compare-table td input[type="checkbox"] { cursor: pointer; }

.compare-table-edit td { padding: 3px 6px; }
.compare-edit {
  width: 100%;
  min-width: 80px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
  font-family: Arial, sans-serif;
  background: transparent;
  color: #1a1a1a;
  box-sizing: border-box;
  transition: border-color 0.1s, background 0.1s;
}
.compare-edit:hover { border-color: #d0d0d0; background: #fafafa; }
.compare-edit:focus { border-color: var(--navy); background: #fff; outline: none; }

/* ── Column settings modal ── */
.col-settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 200;
}

.col-settings-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 201;
  width: 380px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: popupIn 0.15s ease;
}

.col-settings-header {
  background: var(--navy);
  color: white;
  padding: 12px 16px;
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.col-settings-header span { font-size: 14px; font-weight: 700; }
.col-settings-header button {
  background: var(--gold);
  border: none;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 6px;
  transition: filter 0.15s;
}
.col-settings-header button:hover { filter: brightness(0.92); }

.col-settings-desc {
  font-size: 12px;
  color: #888;
  padding: 10px 16px 4px;
  flex-shrink: 0;
}

.col-settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.col-settings-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ── Column row (drag item) ── */
.col-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  background: white;
  user-select: none;
  transition: background 0.1s, border-color 0.1s;
}
.col-row-dragging { opacity: 0.35; }
.col-row-over { border-color: var(--navy); background: #eef2fa; }
.col-row-hidden { background: #fafafa; }

.col-drag-handle {
  color: #bbb;
  font-size: 17px;
  line-height: 1;
  flex-shrink: 0;
  cursor: grab;
}
.col-drag-handle:active { cursor: grabbing; }

.col-visibility-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 3px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  color: var(--navy);
  flex-shrink: 0;
  transition: background 0.1s;
}
.col-visibility-btn:hover { background: rgba(0,37,84,0.08); }
.col-row-hidden .col-visibility-btn { color: #ccc; }

.col-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.col-row-hidden .col-name { color: #aaa; font-weight: 400; }

/* ── Auth overlay ── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-card {
  background: var(--white);
  border-radius: 12px;
  width: 360px;
  max-width: 95vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.32);
  overflow: hidden;
}

.auth-brand {
  background: var(--navy);
  color: var(--white);
  padding: 22px 28px 18px;
  border-bottom: 3px solid var(--gold);
}
.auth-logo {
  height: 36px;
  width: auto;
  display: block;
  margin-bottom: 6px;
}
.auth-brand p {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
}

.auth-body {
  padding: 24px 28px;
}

.btn-sso-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 11px 16px;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn-sso-microsoft:hover {
  background: #f5f5f5;
  border-color: #aaa;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.auth-body h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
}

.auth-error {
  color: #c0392b;
  font-size: 12px;
  margin-top: 8px;
  padding: 6px 10px;
  background: #fdf2f2;
  border-radius: 4px;
  border-left: 3px solid #c0392b;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
  color: #aaa;
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}

.auth-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  color: #1a1a1a;
  margin-bottom: 8px;
  outline: none;
  transition: border-color 0.15s;
}
.auth-input:focus {
  border-color: var(--navy);
}

.btn-magic-link {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: var(--gold);
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-magic-link:hover { opacity: 0.88; }
.btn-magic-link:disabled { opacity: 0.5; cursor: default; }

.auth-success {
  font-size: 13px;
  color: #15803d;
  background: #dcfce7;
  border-left: 3px solid #15803d;
  border-radius: 4px;
  padding: 8px 10px;
  margin-top: 4px;
}

.auth-switch {
  font-size: 12px;
  color: #666;
  margin-top: 12px;
  text-align: center;
}
.auth-switch a {
  color: var(--navy);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.auth-pending {
  text-align: center;
  padding: 8px 0;
}
.auth-pending-icon {
  font-size: 36px;
  margin-bottom: 12px;
}
.auth-pending h3 {
  margin-bottom: 8px;
}
.auth-pending p {
  font-size: 13px;
  color: #555;
  margin-bottom: 18px;
}

/* ── Header user area ── */
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.header-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.header-user-role {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--gold);
  color: var(--navy);
  letter-spacing: 0.3px;
}

.btn-logout {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-logout:hover { background: rgba(255,255,255,0.22); }

.btn-header-icon {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  padding: 5px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background 0.15s;
}
.btn-header-icon:hover { background: rgba(255,255,255,0.22); }

/* ── User management list ── */
.user-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  padding: 10px 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.user-section-title:first-child { padding-top: 0; }

.user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid #f0f0f0;
}
.user-row:last-child { border-bottom: none; }

.user-row-info {
  flex: 1;
  min-width: 0;
}
.user-row-info strong {
  display: block;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-row-info span {
  font-size: 11px;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.user-role-select {
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  color: var(--text);
  cursor: pointer;
}

.btn-approve {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s;
}
.btn-approve:hover { background: #bbf7d0; }

.btn-user-delete {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.1s, background 0.1s;
  flex-shrink: 0;
}
.btn-user-delete:hover { color: #c0392b; background: #fdf2f2; }

/* ── Options manager ────────────────────────────────────────────────────── */
.options-mgmt-panel { width: 420px; }
.user-mgmt-panel    { width: 420px; }
.options-mgmt-body  { display: flex; flex-direction: column; gap: 20px; }

.opt-section { display: flex; flex-direction: column; gap: 6px; }
.opt-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
}
.opt-section-title-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.opt-section-title-toggle:hover { color: #555; }
.opt-collapse-arrow { font-size: 9px; opacity: 0.6; }
.opt-list { display: flex; flex-direction: column; gap: 2px; }
.opt-empty { font-size: 12px; color: #bbb; padding: 4px 0; }
.opt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #f8f9fa;
}
.opt-preview {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.opt-colors { display: flex; gap: 4px; align-items: center; }
.opt-colors input[type=color] {
  width: 28px;
  height: 28px;
  padding: 2px;
  border: 1px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
  background: none;
}
.opt-colors input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.opt-colors input[type=color]::-webkit-color-swatch { border: none; border-radius: 3px; }
.opt-add-bg, .opt-add-text {
  width: 28px;
  height: 34px;
  padding: 2px;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.opt-add-bg::-webkit-color-swatch-wrapper,
.opt-add-text::-webkit-color-swatch-wrapper { padding: 0; }
.opt-add-bg::-webkit-color-swatch,
.opt-add-text::-webkit-color-swatch { border: none; border-radius: 4px; }
.opt-delete {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.1s, background 0.1s;
  flex-shrink: 0;
}
.opt-delete:hover { color: #c0392b; background: #fdf2f2; }
.opt-deactivate {
  font-size: 11px;
  padding: 3px 8px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  color: #666;
  white-space: nowrap;
}
.opt-deactivate:hover { background: #fdf2f2; border-color: #e53e3e; color: #c0392b; }
.opt-inactive-title {
  font-size: 11px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 0 4px;
}
.opt-list-inactive { opacity: 0.7; }
.opt-row-inactive { background: #f8f8f8; }
.opt-preview-inactive { background: #ddd !important; color: #888 !important; text-decoration: line-through; }
.opt-restore {
  font-size: 11px;
  padding: 3px 8px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  color: #002554;
}
.opt-restore:hover { background: #e8f0ff; border-color: #002554; }
.opt-add-row { display: flex; gap: 6px; }
.opt-add-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.opt-add-input:focus { border-color: #002554; }
.opt-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
}

/* ── Map view ───────────────────────────────────────────────────────────── */

.btn-view-toggle {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.3);
  background: transparent;
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.btn-view-toggle:hover { background: rgba(255,255,255,0.1); }
.btn-view-toggle.btn-toggle-active { background: #f1b434; color: #002554; border-color: #f1b434; }

#map-view {
  display: none;
  width: 100%;
  overflow: hidden;
}
#map-view.map-active {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}
body.map-mode .filter-bar { display: none; }
body.map-mode main { display: none; }
#map-detail-overlay { z-index: 999; }

#map-list-panel {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e5e7eb;
  background: #fff;
  overflow: hidden;
  transition: width 0.22s ease, opacity 0.22s ease;
}
#map-list-panel.list-hidden {
  width: 0;
  opacity: 0;
  pointer-events: none;
  border: none;
}
#map-list-panel.list-minimized { width: 72px; }
#map-list-panel.list-minimized .map-list-title { display: none; }
#map-list-panel.list-minimized #map-filters { display: none; }
#map-list-panel.list-minimized .map-week-hdr { padding: 4px 6px; gap: 0; }
#map-list-panel.list-minimized .map-week-hdr span:first-child { font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#map-list-panel.list-minimized .map-week-hdr span:last-child { display: none; }
#map-list-panel.list-minimized .map-row { padding: 4px 6px; gap: 5px; }
#map-list-panel.list-minimized .map-row-bot { display: none; }
#map-list-panel.list-minimized .map-row-top { gap: 5px; justify-content: flex-start; }
#map-list-panel.list-minimized .map-row-kunde { display: none; }
#map-list-panel.list-minimized .map-row-ordre { font-size: 10px; color: #333; font-weight: 500; }

#map-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #002554;
  flex-shrink: 0;
}
.map-list-title { font-size: 12px; font-weight: 600; color: #fff; }
.map-list-close {
  background: var(--gold);
  border: none;
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  transition: filter 0.15s;
  line-height: 1;
}
.map-list-close:hover { filter: brightness(0.92); }

.map-list-open-btn {
  position: absolute;
  bottom: 24px;
  left: 16px;
  background: #002554;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  z-index: 500;
}
.map-list-open-btn:hover { background: #003070; }

#map-list-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

#map-filters {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9f9f7;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.map-filter-row { display: flex; align-items: center; gap: 8px; }
.map-filter-label { font-size: 11px; color: #888; min-width: 55px; }
.map-chip {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #666;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.map-chip.active { background: #002554; color: #fff; border-color: #002554; }
.map-filter-select {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #1a1a1a;
  flex: 1;
}

#map-rows-container { overflow-y: auto; flex: 1; }

.map-week-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 12px;
  background: #f5f5f3;
  border-bottom: 0.5px solid #e5e7eb;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #666;
  position: sticky;
  top: 0;
  z-index: 1;
}
.map-week-hdr span:last-child { font-weight: 400; text-transform: none; letter-spacing: 0; }

.map-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px 8px 12px;
  border-bottom: 0.5px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.1s;
}
.map-row:hover { background: #f5f7fa; }
.map-row-sel { background: #eef3fc !important; border-left: 3px solid #002554; padding-left: 9px; }

.map-row-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.map-row-cnt { flex: 1; min-width: 0; }
.map-row-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.map-row-kunde { font-size: 12px; font-weight: 500; color: #1a1a1a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 162px; }
.map-row-ordre { font-size: 10px; color: #999; flex-shrink: 0; }
.map-row-bot { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.map-row-meta   { font-size: 10px; color: #888; }
.map-row-sep    { font-size: 10px; color: #ccc; }
.mrt-tc-date    { font-size: 10px; background: #fef3c7; color: #92400e; border-radius: 3px; padding: 1px 5px; margin-left: auto; }

.mrt-ok   { font-size:10px; background:#dcfce7; color:#15803d; border-radius:3px; padding:1px 5px; }
.mrt-dato { font-size:10px; background:#dbeafe; color:#1d4ed8; border-radius:3px; padding:1px 5px; }
.mrt-no   { font-size:10px; background:#f3f4f6; color:#9ca3af; border-radius:3px; padding:1px 5px; }
.mrt-lkw  { font-size:10px; background:#dcfce7; color:#15803d; border-radius:3px; padding:1px 5px; font-weight:600; }
.mrt-cmt  { font-size:10px; color:#2563eb; display:flex; align-items:center; gap:2px; margin-left:auto; }
.mrt-cmt-new { color:#e53e3e; font-weight:700; }

#map-detail {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: #fff;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.16);
  animation: slideIn 0.2s ease;
}
.panel-title-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-detail-body { flex: 1; overflow-y: auto; padding: 12px; }

.mds { margin-bottom: 14px; }
.mdst {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #888;
  margin-bottom: 7px;
  padding-bottom: 4px;
  border-bottom: 0.5px solid #e5e7eb;
}
.mdg { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.mdf { }
.mdf-full { grid-column: 1 / -1; }
.mdl { font-size: 10px; color: #999; margin-bottom: 2px; }
.mdv { font-size: 12px; color: #1a1a1a; background: #f5f5f3; border-radius: 4px; padding: 5px 8px; min-height: 26px; }

.mdc { background: #f5f5f3; border-radius: 4px; padding: 6px 8px; margin-bottom: 5px; }
.mdc-meta { font-size: 10px; color: #999; margin-bottom: 3px; }
.mdc-text { font-size: 12px; color: #1a1a1a; }

.map-cmt-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 12px;
  font-family: inherit;
  resize: none;
  margin-top: 8px;
  color: #1a1a1a;
  background: #fff;
}
.map-cmt-input:focus { outline: none; border-color: #002554; }
.map-cmt-btn {
  width: 100%;
  margin-top: 5px;
  padding: 7px;
  background: #f1b434;
  border: none;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #002554;
  cursor: pointer;
}
.map-cmt-btn:hover { opacity: 0.88; }

#map-panel { flex: 1; min-height: 0; min-width: 0; position: relative; z-index: 0; }

.leaflet-tooltip.map-tooltip {
  background: #002554;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  box-shadow: none;
}
.leaflet-tooltip.map-tooltip::before { border-right-color: #002554; }

.map-legend {
  background: rgba(255,255,255,0.92);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.2);
  line-height: 1;
}
.map-legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #1a1a1a;
  padding: 3px 0;
}
.map-legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(0,0,0,0.2);
}

.user-self-badge {
  font-size: 10px;
  background: #e0e7ff;
  color: #3730a3;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}

/* ── Mobile ── */
@media (max-width: 768px) {

  /* Header: skjul brukernavn, vis kun rolle og logg-ut */
  .header-user-name { display: none; }
  .header-logo { height: 22px; }

  /* Filterbar: horisontal scroll */
  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 8px 12px;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .filter-bar::-webkit-scrollbar { display: none; }

  /* Kartvisning: listepanel som bottom sheet */
  #map-list-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 55vh;
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    transition: transform 0.25s ease;
    z-index: 500;
    transform: translateY(0);
    opacity: 1 !important;
  }
  #map-list-panel::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 8px auto 0;
    flex-shrink: 0;
  }
  #map-list-panel.list-hidden {
    transform: translateY(100%);
    pointer-events: none;
  }
  #map-list-head { display: none; }

  /* Oversikt-knapp sentrert nederst */
  .map-list-open-btn {
    left: 50%;
    transform: translateX(-50%);
    bottom: 20px;
    white-space: nowrap;
  }

  /* Detaljpanel: full bredde fra bunnen */
  #map-detail {
    width: 100vw;
    top: 56px;
  }

  /* Side-panel (Rediger transport): full bredde */
  .side-panel { width: 100vw; }

  /* Touch-vennlige knapper */
  .map-row { min-height: 52px; }
  .btn-logout { display: none; }
  .btn-view-toggle { font-size: 12px; padding: 6px 10px; }

  /* Ny transport-knapp i filterbar */
  .btn-new-filterbar { font-size: 11px; padding: 5px 10px; }
}

