/* ==========================================================================
   Motello design system
   Tokens and component conventions follow the earlier design prototype
   (Fordonssystemet v5.dc.html) as a visual reference (spec section 5) —
   its sample data and simulated behavior were NOT reused, only the look.
   ========================================================================== */

:root {
  --bg: oklch(0.97 0.006 240);
  --surface: #fff;
  --surface-2: oklch(0.985 0.004 240);
  --surface-3: oklch(0.955 0.004 240);
  --line: oklch(0.925 0.005 240);
  --line-soft: oklch(0.955 0.003 240);
  --ink: oklch(0.22 0.012 250);
  --ink-2: oklch(0.36 0.012 250);
  --muted: oklch(0.52 0.012 250);
  --faint: oklch(0.72 0.01 250);
  --tint: 0.16;
  --fg-l: 0.42;

  --nav-bg: #fff;
  --nav-line: oklch(0.91 0.006 240);
  --nav-ink: oklch(0.4 0.012 250);
  --nav-active: oklch(0.42 0.11 230);
  --nav-tint: 0.12;
  --nav-count-bg: oklch(0.42 0.01 250);
  --nav-count-ink: #fff;

  --topbar-bg: oklch(0.47 0.11 235);
  --topbar-line: oklch(0.56 0.1 235);
  --topbar-field-bg: oklch(0.54 0.1 235);
  --topbar-ink-muted: oklch(0.93 0.03 235);

  --accent: oklch(0.64 0.13 225);
  --accent-soft: oklch(0.68 0.09 225 / var(--tint));
  --accent-ink: oklch(var(--fg-l) 0.11 230);

  --status-neutral-bg: oklch(0.68 0.09 240 / var(--tint));
  --status-neutral-fg: oklch(var(--fg-l) 0.09 240);
  --status-pending-bg: oklch(0.68 0.15 75 / var(--tint));
  --status-pending-fg: oklch(var(--fg-l) 0.12 75);
  --status-success-bg: oklch(0.68 0.15 150 / var(--tint));
  --status-success-fg: oklch(0.32 0.1 150);
  --status-danger-bg: oklch(0.68 0.15 25 / var(--tint));
  --status-danger-fg: oklch(var(--fg-l) 0.15 25);
  --status-inactive-bg: var(--line-soft);
  --status-inactive-fg: var(--muted);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 100px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: oklch(0.15 0.018 255);
  --surface: oklch(0.195 0.022 255);
  --surface-2: oklch(0.225 0.022 255);
  --surface-3: oklch(0.25 0.022 255);
  --line: oklch(0.31 0.025 255);
  --line-soft: oklch(0.26 0.022 255);
  --ink: oklch(0.96 0.005 250);
  --ink-2: oklch(0.85 0.01 250);
  --muted: oklch(0.7 0.015 250);
  --faint: oklch(0.5 0.015 250);
  --tint: 0.24;
  --fg-l: 0.82;

  --topbar-bg: oklch(0.32 0.08 245);
  --topbar-line: oklch(0.42 0.08 245);
  --topbar-field-bg: oklch(0.38 0.08 245);
  --nav-bg: oklch(0.16 0.025 255);
  --nav-line: oklch(0.3 0.035 255);
  --nav-ink: oklch(0.72 0.025 250);
  --nav-active: #fff;
  --nav-tint: 0.22;
  --nav-count-bg: oklch(0.42 0.01 250);
  --nav-count-ink: #fff;

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: oklch(0.15 0.018 255);
    --surface: oklch(0.195 0.022 255);
    --surface-2: oklch(0.225 0.022 255);
    --surface-3: oklch(0.25 0.022 255);
    --line: oklch(0.31 0.025 255);
    --line-soft: oklch(0.26 0.022 255);
    --ink: oklch(0.96 0.005 250);
    --ink-2: oklch(0.85 0.01 250);
    --muted: oklch(0.7 0.015 250);
    --faint: oklch(0.5 0.015 250);
    --tint: 0.24;
    --fg-l: 0.82;
    --topbar-bg: oklch(0.32 0.08 245);
    --topbar-line: oklch(0.42 0.08 245);
    --topbar-field-bg: oklch(0.38 0.08 245);
    --nav-bg: oklch(0.16 0.025 255);
    --nav-line: oklch(0.3 0.035 255);
    --nav-ink: oklch(0.72 0.025 250);
    --nav-active: #fff;
    --nav-tint: 0.22;
  --nav-count-bg: oklch(0.42 0.01 250);
  --nav-count-ink: #fff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Figtree', system-ui, sans-serif;
  font-size: 14px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: oklch(0.54 0.13 225); text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 8px; color: var(--ink); font-weight: 500; }
h1:focus { outline: none; }

input, select, textarea, button { font-family: inherit; font-size: 13px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: var(--radius); }

.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }

/* ---------- Layout shell ---------- */
.app-shell { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: 56px; flex: 0 0 auto; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; background: var(--topbar-bg); border-bottom: 1px solid var(--topbar-line);
  z-index: 5;
}
.topbar-brand { font-weight: 500; font-size: 16px; letter-spacing: 0.08em; color: #fff; white-space: nowrap; }
.topbar-brand .tagline {
  font-family: 'IBM Plex Mono', monospace; text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 500; color: oklch(0.8 0.13 210); font-size: 10px; margin-left: 6px;
}
.facility-picker, .topbar-search {
  border: 1px solid var(--topbar-line); border-radius: var(--radius); font-size: 13px;
  background: var(--topbar-field-bg); color: #fff;
}
.facility-picker { display: flex; align-items: center; gap: 6px; padding: 6px 10px; color: var(--topbar-ink-muted); }
.topbar-search { flex: 1; max-width: 420px; padding: 8px 12px; outline: none; }
.topbar-search::placeholder { color: var(--topbar-ink-muted); opacity: .8; }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 8px; padding-left: 12px; border-left: 1px solid var(--topbar-line); }
.avatar-chip {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500;
}
.topbar-user-name { font-size: 13px; font-weight: 500; color: #fff; line-height: 1.2; }
.topbar-user-role { font-size: 11px; color: var(--topbar-ink-muted); line-height: 1.2; }

.app-body { flex: 1; display: flex; overflow: hidden; }

.sidebar { width: 216px; flex: 0 0 auto; background: var(--nav-bg); border-right: 1px solid var(--nav-line); padding: 14px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 9px 12px; border-radius: var(--radius); font-size: 13px; cursor: pointer;
  margin-bottom: 2px; font-weight: 400; color: var(--nav-ink); text-decoration: none;
}
.nav-item:hover { background: var(--surface-3); text-decoration: none; }
.nav-item.active {
  font-weight: 500; color: var(--nav-active); background: oklch(0.64 0.13 225 / var(--nav-tint));
  box-shadow: inset 0 0 0 1px oklch(0.64 0.13 225 / 0.4), 0 0 18px oklch(0.64 0.13 225 / 0.15);
}
.nav-item .badge-soon {
  font-size: 10px; font-weight: 500; color: var(--muted); background: var(--line-soft);
  border-radius: var(--radius-pill); padding: 2px 7px;
}

.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ---------- Cards / tiles ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px;
}
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.kpi-value { font-size: 22px; font-weight: 500; color: var(--ink); }
.kpi-sub { font-size: 12px; margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: oklch(0.58 0.13 225); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-danger { background: oklch(0.55 0.16 25); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.field input, .field select, .field textarea {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
.field input:not([type=checkbox]):not([type=radio]), .field select { min-height: 40px; }
/* Rullgardiner: samma storlek och rundning som övriga fält, egen pil. */
.field select, select.select-lg {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23888' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select.select-lg {
  min-height: 40px; padding: 0 36px 0 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background-color: var(--surface); color: var(--ink); font-size: 13px; font-weight: 500;
}
.btn-lg { min-height: 40px; display: inline-flex; align-items: center; padding: 0 18px; border-radius: var(--radius); font-weight: 500; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field .hint { font-size: 11px; color: var(--muted); }
.field .error { font-size: 11px; color: oklch(0.55 0.16 25); }

/* ---------- Tables ---------- */
/* Listor: vit (surface) bakgrund med ram och rundade hörn. border-collapse: separate krävs för att hörnen ska rundas. */
table.data-table {
  width: 100%; font-size: 12.5px; line-height: 1.3; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  border-collapse: separate; border-spacing: 0; overflow: hidden;
}
table.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); font-weight: 500; padding: 6px 10px; border-bottom: 1px solid var(--line);
}
table.data-table td { padding: 5px 10px; border-bottom: 1px solid var(--line-soft); }
/* Tätare innehåll i listor: knappar, märken och PDF-symboler får samma kompakta höjd som raden. */
table.data-table .btn { padding: 3px 10px; font-size: 12px; min-height: 26px; }
table.data-table .status-badge { padding: 1px 8px; font-size: 11px; }
table.data-table .pdf-view, table.data-table .pdf-download { width: 28px; height: 28px; }
table.data-table .pdf-view svg { width: 18px; height: 18px; }
table.data-table .pdf-download svg { width: 16px; height: 16px; }
table.data-table tbody tr:hover { background: var(--surface-2); }
table.data-table tbody tr:last-child td { border-bottom: 0; }
table.data-table thead th:first-child { border-top-left-radius: calc(var(--radius) - 1px); }
table.data-table thead th:last-child { border-top-right-radius: calc(var(--radius) - 1px); }

/* ---------- Tabs / chips ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { padding: 10px 14px; font-size: 13px; cursor: pointer; font-weight: 400; color: var(--muted); border-bottom: 2px solid transparent; background: none; border-left: none; border-right: none; border-top: none; }
.tab.active { font-weight: 500; color: var(--accent-ink); border-bottom-color: var(--accent); }

.chip {
  padding: 6px 14px; border-radius: var(--radius-pill); font-size: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 400;
}
.chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }

/* ---------- Status badges ----------
   Five semantic categories reused across every module's statuses
   (spec section 6/9/11/12/13/20/21/22/24/25 — every status shown with text + color):
   neutral = new/incoming, pending = in progress, success = done/ok,
   danger = failed/lost/needs attention, inactive = closed/no longer relevant. */
.status-badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.status-neutral { background: var(--status-neutral-bg); color: var(--status-neutral-fg); }
.status-pending { background: var(--status-pending-bg); color: var(--status-pending-fg); }
.status-success { background: var(--status-success-bg); color: var(--status-success-fg); }
.status-danger { background: var(--status-danger-bg); color: var(--status-danger-fg); }
.status-inactive { background: var(--status-inactive-bg); color: var(--status-inactive-fg); }

/* ---------- Översikt (dashboard) ---------- */
.dash-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 1px 2px oklch(0.4 0.03 250 / 0.04), 0 4px 14px oklch(0.4 0.03 250 / 0.04);
  padding: 14px 16px;
}
.dash-kpi-label {
  font-family: 'IBM Plex Mono', monospace; text-transform: uppercase; letter-spacing: 0.1em;
  font-size: 10px; color: var(--muted);
}
.dash-kpi-value { font-size: 28px; font-weight: 500; letter-spacing: -0.02em; margin-top: 10px; }
.dash-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.dash-card-title { font-size: 14px; font-weight: 500; }
.dash-card-subtitle { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.dash-quick-action {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 100px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 500;
  color: var(--ink); text-decoration: none;
}
.dash-quick-action:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Inköpswizard och kontrollrader ---------- */
.wizard-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.wizard-step {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px;
}
.wizard-step.active { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); font-weight: 500; }
.wizard-step.done { color: var(--status-success-fg); }
.wizard-num {
  width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; border: 1px solid currentColor;
}
.wizard-regno {
  flex: 1; font-family: 'IBM Plex Mono', monospace; font-size: 16px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
.wizard-price { font-size: 14px; font-weight: 500; }
.wizard-choice, .wizard-ack { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; margin: 8px 0; cursor: pointer; }
.wizard-ack { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--status-danger-bg); color: var(--status-danger-fg); font-weight: 500; }
.fact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 16px; margin-top: 12px; font-size: 12px; }
.fact-grid span { display: block; font-size: 10px; color: var(--muted); }
.finding { display: flex; align-items: flex-start; gap: 8px; padding: 6px 10px; margin-bottom: 6px; border-radius: var(--radius-sm); border-left: 4px solid var(--line); background: var(--surface-2); }
.finding-icon { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 1px; }
.finding-body { min-width: 0; }
.finding-title { font-size: 12px; font-weight: 500; display: block; }
.finding-detail { font-size: 11px; color: var(--muted); display: block; margin-top: 2px; }
.finding-ok { border-left-color: var(--status-success-fg); }
.finding-ok .finding-title { font-weight: 500; }
.finding-info { border-left-color: var(--status-neutral-fg); }
.finding-warning { border-left-color: var(--status-pending-fg); background: var(--status-pending-bg); }
.finding-blocker { border-left-width: 5px; border-left-color: var(--status-danger-fg); background: var(--status-danger-bg); padding: 8px 12px; }
.finding-blocker .finding-icon { width: 20px; height: 20px; flex-basis: 20px; }
.finding-blocker .finding-title { color: var(--status-danger-fg); font-size: 13px; }
.finding-blocker .finding-detail { color: var(--ink); }
.check-summary { display: flex; align-items: center; gap: 8px; padding: 7px 12px; margin-bottom: 10px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500; }
.check-summary .finding-icon { margin-top: 0; }
.check-summary-ok { background: var(--status-success-bg); color: var(--status-success-fg); }
.check-summary-warning { background: var(--status-pending-bg); color: var(--status-pending-fg); }
.check-summary-blocker { background: var(--status-danger-fg); color: #fff; }
.check-summary-blocker .finding-icon path { fill: #fff; stroke: #fff; }
.check-summary-blocker .finding-icon rect, .check-summary-blocker .finding-icon circle { fill: var(--status-danger-fg); }

/* ---------- Vehicle card flags (import, many owners, etc.) ---------- */
.vehicle-flag-banner {
  padding: 8px 12px; margin-bottom: 8px; border-radius: var(--radius-md, 6px);
  background: var(--status-danger-bg); color: var(--status-danger-fg);
  font-size: 13px; font-weight: 500;
}

/* ---------- Impersonation banner (platform admin) ---------- */
.impersonation-banner {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 8px 16px; background: var(--status-danger-bg); color: var(--status-danger-fg);
  font-size: 13px; font-weight: 500;
}
.impersonation-banner form { margin: 0; }

/* ---------- Empty / loading / error states ---------- */
.empty-state, .loading-state, .error-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 48px 24px; color: var(--muted); text-align: center;
}
.empty-state .title, .error-state .title { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.error-state { color: oklch(0.55 0.16 25); }

/* ---------- Framework defaults (kept from scaffold) ---------- */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

.blazor-error-boundary {
  background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
  padding: 1rem 1rem 1rem 3.7rem;
  color: white;
}
.blazor-error-boundary::after { content: "Ett fel har inträffat."; }

/* ==========================================================================
   Minimal Bootstrap-class compatibility shim
   ASP.NET Core's default Identity account pages (Login/Register/Manage/…)
   are scaffolded with Bootstrap grid/utility classes. Rather than pull in
   all of Bootstrap (a second design system) or rewrite ~30 generated Razor
   files, this covers just the classes those pages actually use, styled to
   match Motello's own tokens. See AuthLayout.razor for the surrounding shell.
   ========================================================================== */
.row { display: flex; flex-wrap: wrap; gap: 16px; margin: 0; }
[class^="col-"] { flex: 1 1 auto; min-width: 0; }
.mb-3 { margin-bottom: 14px; }
.mt-2 { margin-top: 8px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.w-100 { width: 100%; }
.h-100 { height: 100%; }
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.text-danger { color: oklch(0.55 0.16 25); font-size: 12px; }
.text-info { color: var(--accent); font-size: 12px; }
.text-success { color: oklch(0.4 0.1 150); font-size: 12px; }
.text-secondary { color: var(--muted); }
.font-weight-bold { font-weight: 500; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

.form-floating, .form-horizontal .control-label { margin-bottom: 4px; }
.form-control, .form-select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); margin-top: 4px;
}
.form-control:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.form-label, .control-label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.form-check-input { margin-right: 6px; }
.darker-border-checkbox.form-check-input { border-color: var(--line); }
.checkbox label { font-size: 13px; color: var(--ink-2); }
.input-group { display: flex; }
.input-group-append { display: flex; }
.input-group-text { padding: 8px 10px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.btn-lg { padding: 10px 16px; font-size: 14px; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; }
.btn-danger { background: oklch(0.55 0.16 25); color: #fff; border: none; padding: 8px 14px; border-radius: var(--radius); cursor: pointer; }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.alert-danger { background: var(--status-danger-bg); color: var(--status-danger-fg); }
.alert-warning { background: var(--status-pending-bg); color: var(--status-pending-fg); }
.alert-info { background: var(--status-neutral-bg); color: var(--status-neutral-fg); }
.alert-success { background: var(--status-success-bg); color: var(--status-success-fg); }
.glyphicon-warning-sign::before { content: "⚠"; }

.nav-pills { display: flex; gap: 4px; list-style: none; padding: 0; margin: 0 0 16px; }
.nav-pills .nav-link { padding: 7px 14px; border-radius: var(--radius-pill); font-size: 13px; color: var(--muted); cursor: pointer; }
.nav-pills .nav-link.active { background: var(--accent); color: #fff; }

table:not(.data-table) { width: 100%; border-collapse: collapse; font-size: 13px; }
table:not(.data-table) td, table:not(.data-table) th { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; }

/* "Avancerade inställningar" — hopfällbar sektion för sällan ändrade val */
.advanced-settings { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 12px; }
.advanced-settings > summary { cursor: pointer; color: var(--muted); font-weight: 500; }
.advanced-settings > summary:hover { color: var(--ink-2); }

/* Varudeklaration — mobilvänligt formulär med stora tryckytor */
.vd-page { max-width: 760px; margin: 0 auto; }
.vd-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; background: var(--bg, #fff); border-bottom: 1px solid var(--line); margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.vd-section { margin-bottom: 12px; padding: 0; }
.vd-section > summary { cursor: pointer; padding: 14px 16px; font-size: 14px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.vd-section > summary::-webkit-details-marker { display: none; }
.vd-section > summary::after { content: "▾"; color: var(--muted); }
.vd-section[open] > summary::after { content: "▴"; }
.vd-body { padding: 0 16px 16px; }
.vd-field { margin-bottom: 14px; }
.vd-field > label, .vd-label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.vd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; }
.vd-page input:not([type=checkbox]):not([type=radio]), .vd-page select, .vd-page textarea { font-size: 16px; min-height: 44px; width: 100%; }
.vd-page textarea { min-height: 90px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg-btn { min-height: 44px; min-width: 64px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface, #fff); color: var(--ink-2); font-size: 15px; font-weight: 500; cursor: pointer; }
.seg-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.vd-check { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 12px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface, #fff); font-size: 14px; text-align: left; cursor: pointer; }
.vd-check .box { flex: 0 0 24px; height: 24px; border: 2px solid var(--line); border-radius: 6px; display: grid; place-items: center; font-size: 16px; color: #fff; }
.vd-check.on { border-color: var(--status-success-fg); background: var(--status-success-bg); }
.vd-check.on .box { background: var(--status-success-fg); border-color: var(--status-success-fg); }
.vd-cond { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.vd-cond .pos { display: inline-block; width: 22px; font-weight: 500; color: var(--muted); }
.vd-sig { width: 100%; height: 160px; border: 2px dashed var(--line); border-radius: var(--radius-sm); background: #fff; touch-action: none; display: block; }
.vd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 32px; }
.vd-actions .btn { min-height: 48px; font-size: 15px; }
@media (max-width: 600px) { .vd-grid { grid-template-columns: 1fr 1fr; } }
.input-invalid { border-color: var(--status-danger-fg) !important; }

/* ---------- Responsivt skal (mobil) ----------
   Under 860 px blir sidomenyn en utfällbar låda (☰ i toppfältet) i stället för att ta 216 px fast
   bredd och trycka ut innehållet. Fält i rader staplas, tabeller får horisontell rullning. */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.nav-burger, .nav-backdrop { display: none; }
@media (max-width: 860px) {
  .app-shell { height: 100dvh; }
  .topbar { padding: 0 10px; gap: 8px; }
  .nav-burger {
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--topbar-line);
    color: #fff; font-size: 20px; cursor: pointer;
  }
  .topbar-brand { font-size: 13px; letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
  .topbar-brand .tagline, .topbar-search { display: none; }
  .topbar-user { padding-left: 0; border-left: 0; }
  .topbar-user > div:not(.avatar-chip) { display: none; }
  .facility-picker { max-width: 120px; padding: 4px 6px; }
  .facility-picker select { max-width: 100px; }
  .topbar [role="button"] { padding: 6px 8px !important; font-size: 11px !important; }

  .sidebar {
    position: fixed; top: 56px; bottom: 0; left: 0; z-index: 40;
    width: min(280px, 84vw); transform: translateX(-100%); transition: transform .18s ease;
    box-shadow: 0 0 30px rgba(0, 0, 0, .35);
  }
  .app-shell:has(.nav-toggle:checked) .sidebar { transform: none; }
  .app-shell:has(.nav-toggle:checked) .nav-backdrop { display: block; position: fixed; inset: 56px 0 0 0; z-index: 30; background: rgba(0, 0, 0, .4); }

  .content { padding: 12px; min-width: 0; }
  .card { padding: 12px; }
  .row .field { flex: 1 1 100% !important; max-width: none !important; }
  /* Tabeller med två kolumner eller färre rullar i sidled; listor med fler kolumner blir kort (se nedan och table-cards.js). */
  .data-table { display: block; overflow-x: auto; white-space: nowrap; }
  .wizard-regno { width: 100%; }
}

/* Utloggningsknapp i toppfältet */
.logout-form { margin: 0; flex: 0 0 auto; }
.logout-btn {
  background: transparent; border: 1px solid var(--topbar-line); border-radius: 100px; padding: 6px 12px;
  color: var(--topbar-ink-muted); font-size: 12px; cursor: pointer; white-space: nowrap;
}
.logout-btn:hover { color: #fff; border-color: var(--muted); }
.logout-btn .short { display: none; }
@media (max-width: 860px) {
  .logout-btn { padding: 6px 10px; font-size: 15px; line-height: 1; }
  .logout-btn .long { display: none; }
  .logout-btn .short { display: inline; }
}

/* ---------- Pop-up (modal) ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-sheet { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); width: min(560px, 100%); max-height: 92vh; overflow-y: auto; padding: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-x { background: transparent; border: 0; font-size: 18px; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.modal-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.tradein-summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2, transparent); }
@media (max-width: 860px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal-sheet { width: 100%; border-radius: 14px 14px 0 0; max-height: 94dvh; }
  .modal-sheet input { font-size: 16px; min-height: 44px; }
}

/* Kompakta etikett/värde-rutnät (fordonskort m.m.) */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; font-size: 13px; }
.kv > span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 1px; }
.kv.wide { grid-column: 1 / -1; }
.kv-compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; font-size: 12px; margin-top: 10px; }
.kv-compact > .kv > span { font-size: 9.5px; }
.tech-details > summary { cursor: pointer; font-size: 14px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.tech-details > summary::-webkit-details-marker { display: none; }
.tech-details > summary::after { content: "▾"; color: var(--muted); margin-left: 8px; }
.tech-details[open] > summary::after { content: "▴"; }
.tech-count { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: auto; margin-right: 6px; }

/* Inbytespopup: kalkyl och marginal */
.tradein-calc { margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2, transparent); }
.tradein-calc-title { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; }
.margin-box { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.margin-box .margin-label { font-size: 11px; color: var(--muted); }
.margin-box .margin-value { font-size: 18px; font-weight: 500; }
.margin-box .margin-value span { font-size: 13px; font-weight: 500; }
.margin-box .margin-detail { font-size: 11px; color: var(--muted); text-align: right; }
.margin-box.good { background: var(--status-success-bg); border-color: var(--status-success-fg); }
.margin-box.good .margin-value { color: var(--status-success-fg); }
.margin-box.bad { background: var(--status-danger-bg); border-color: var(--status-danger-fg); }
.margin-box.bad .margin-value { color: var(--status-danger-fg); }

/* Menyn: kort förklaring under varje punkt */
.nav-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.nav-hint { font-size: 10.5px; font-weight: 400; color: var(--muted); margin-top: 1px; }
.nav-item.active .nav-hint { color: inherit; opacity: .75; }

/* Räknare (mörkgrå cirkel) vid menypunkter */
.nav-count {
  flex: 0 0 auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--nav-count-bg); color: var(--nav-count-ink); font-size: 11px; font-weight: 500; line-height: 1;
}
.nav-count.zero { background: var(--surface-3); color: var(--muted); }

/* ---------- Paginering ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--muted); }
.pager-controls { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-btn { min-width: 32px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); font-size: 12px; cursor: pointer; }
.pager-btn:hover:not(:disabled) { background: var(--surface-2); }
.pager-btn:disabled { opacity: .45; cursor: default; }
.pager-btn.current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.pager-gap { padding: 0 4px; }
.pager-size { margin-left: 10px; display: inline-flex; align-items: center; gap: 6px; }
.pager-size select { height: 32px; padding: 0 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); font-size: 12px; }
@media (max-width: 860px) { .pager { justify-content: center; } .pager-btn { height: 40px; min-width: 40px; } }

/* Kund – översikt: uppgifter till vänster, anteckningar till höger */
.cust-overview { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .cust-overview { grid-template-columns: 1fr; } }

/* Fordonsgalleri */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.gallery-item { position: relative; display: flex; flex-direction: column; gap: 4px; }
.gallery-thumb { padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface-3); cursor: pointer; aspect-ratio: 4 / 3; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-cover { position: absolute; top: 8px; left: 8px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: var(--radius-pill); }
.gallery-actions { display: flex; justify-content: space-between; gap: 8px; }
.gallery-link { background: none; border: 0; padding: 4px 0; font-size: 12px; color: var(--accent-ink); cursor: pointer; }
.gallery-link.danger { color: var(--status-danger-fg); margin-left: auto; }
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.85); display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 94vw; max-height: 88vh; border-radius: var(--radius-sm); }
.lightbox-close, .lightbox-nav { position: absolute; background: rgba(255, 255, 255, 0.15); color: #fff; border: 0; border-radius: 50%; width: 44px; height: 44px; font-size: 26px; cursor: pointer; }
.lightbox-close { top: 16px; right: 16px; }
.lightbox-nav { top: 50%; transform: translateY(-50%); }
.lightbox-nav.prev { left: 16px; } .lightbox-nav.next { right: 16px; }
.lightbox-count { position: absolute; bottom: 16px; color: #fff; font-size: 13px; }

/* Detaljvy: rubrik med status/redigera, åtgärdsrutor */
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.detail-head-actions { display: flex; gap: 8px; align-items: center; }
.action-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; }
.action-tile { display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.action-tile:hover { background: var(--surface-3); }
.action-tile strong { font-size: 14px; }
.action-tile span { font-size: 12px; color: var(--muted); }
.action-tile.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.action-tile.primary span { color: rgba(255, 255, 255, 0.85); }
.action-tile.primary:hover { filter: brightness(0.95); background: var(--accent); }
@media (max-width: 860px) { .detail-head-actions { width: 100%; } .detail-head-actions select { flex: 1; } }

.dropzone { position: relative; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface-3); min-height: 130px; display: flex; align-items: center; justify-content: center; text-align: center; transition: background .15s, border-color .15s; }
.dropzone:hover, .dropzone:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.busy { opacity: .7; }
.dropzone-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone-text { display: flex; flex-direction: column; gap: 4px; padding: 16px; pointer-events: none; }
.dropzone-text strong { font-size: 15px; }
.dropzone-text span { font-size: 12px; color: var(--muted); }
.gallery-item { cursor: grab; }
.gallery-item.dragging { opacity: .4; }
.gallery-item.drop-target .gallery-thumb { outline: 3px solid var(--accent); outline-offset: 2px; }
.gallery-moves { display: inline-flex; gap: 2px; }
.gallery-moves .gallery-link { font-size: 18px; line-height: 1; padding: 2px 8px; }
.gallery-link:disabled { opacity: .3; cursor: default; }
/* Säljarfakta */
.fact-tiles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.fact-tile { flex: 1 1 150px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.fact-tile span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fact-tile strong { display: block; font-size: 18px; margin-top: 2px; }
.fact-tile small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.stock-days { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--ink-2); }
.stock-days strong { font-size: 15px; color: var(--ink); }
.stock-days.warn strong { color: var(--status-pending-fg); }

.fact-tile.price { flex: 1.6 1 260px; }
.price-figure { display: flex !important; align-items: center; gap: 8px; white-space: nowrap; }
.margin-badge { margin-left: 0; font-size: 12px; font-weight: 500; padding: 1px 6px; border-radius: var(--radius-pill); line-height: 1.4; white-space: nowrap; }
.margin-badge.pos { background: var(--status-success-bg, #dcf5e4); color: var(--status-success-fg, #14733a); }
.margin-badge.neg { background: var(--status-danger-bg, #fde2e2); color: var(--status-danger-fg, #b42318); }
.text-pos { color: var(--status-success-fg, #14733a); } .text-neg { color: var(--status-danger-fg, #b42318); }
.cost-form { background: var(--surface-3); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.fact-tile .margin-badge { display: inline-block; text-transform: none; letter-spacing: 0; font-size: 12px; }
.fact-tile .margin-badge.pos { color: var(--status-success-fg, #14733a); }
.fact-tile .margin-badge.neg { color: var(--status-danger-fg, #b42318); }
.action-tile > div { display: flex; flex-direction: column; gap: 2px; }
.tile-icon { flex: 0 0 auto; color: var(--accent); }
.customer-box { background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; max-width: 520px; }
.customer-box-lines { font-size: 13px; color: var(--ink-2); margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }

/* Kundflöde */
.flow-case { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.flow-case-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.flow-steps { display: flex; gap: 6px; overflow-x: auto; }
.flow-step { flex: 1 0 96px; border-radius: var(--radius-sm); padding: 6px 8px; background: var(--surface-3); border-left: 3px solid var(--line); min-width: 96px; }
.flow-step-label { font-size: 12px; font-weight: 500; }
.flow-step-detail { font-size: 11px; color: var(--muted); min-height: 14px; }
.flow-step.done { border-left-color: var(--status-success-fg, #14733a); background: var(--status-success-bg, #dcf5e4); }
.flow-step.pending { border-left-color: var(--accent); }
.flow-step.warning { border-left-color: var(--status-pending-fg, #a15c00); }
.flow-step.danger { border-left-color: var(--status-danger-fg, #b42318); background: var(--status-danger-bg, #fde2e2); }
.flow-step.none { opacity: .55; }

.equipment-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.equipment-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 3px 4px 3px 12px; font-size: 13px; }
.equipment-chip button { border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; color: var(--muted); padding: 0 6px; border-radius: 50%; }
.equipment-chip button:hover { color: var(--status-danger-fg, #b42318); }

.pick-row { cursor: pointer; }
.pick-row:hover td, .pick-row:focus td { background: var(--accent-soft); }
.pick-row:focus { outline: none; }
/* PDF-åtgärder */
.pdf-actions { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
@font-face { font-family: "DejaVu Sans"; src: url("/fonts/DejaVuSans.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: "DejaVu Sans"; src: url("/fonts/DejaVuSans-Bold.ttf") format("truetype"); font-weight: 700; }
.dash-picker { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.dash-picker legend { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 6px; }
.quote-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.quote-chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); color: var(--muted); text-decoration: none; }
.quote-chip strong { color: var(--ink); margin-left: 4px; }
.quote-chip.open { background: var(--status-pending-bg); color: var(--status-pending-fg); }
.quote-chip.open strong { color: inherit; }
.quote-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.quote-row:hover { background: var(--surface-2); }
.pub-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.pub-kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); cursor: pointer; text-align: left; font: inherit; }
.pub-kpi span { font-size: 12px; color: var(--muted); }
.pub-kpi strong { font-size: 22px; font-weight: 500; }
.pub-kpi:hover { background: var(--surface-2); }
.pub-kpi.on { border-color: var(--accent, var(--ink)); box-shadow: inset 0 0 0 1px var(--accent, var(--ink)); }
.req-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; background: var(--surface-3); color: var(--muted); vertical-align: middle; }
.req-badge.req-missing { background: var(--status-pending-bg, #fdf0d5); color: var(--status-pending-fg, #7a4a00); }
input.req-empty, select.req-empty { border-color: var(--status-pending-fg, #c27c00); background: var(--status-pending-bg, #fffaf0); }
.pdf-print { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; background: none; border-radius: var(--radius-sm); color: var(--ink-2); cursor: pointer; padding: 0; }
.pdf-print:hover { background: var(--surface-3); }
table.data-table .pdf-print { width: 28px; height: 28px; }
table.data-table .pdf-print svg { width: 16px; height: 16px; }
.pdf-view, .pdf-download { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius-sm); color: var(--status-danger-fg, #b42318); text-decoration: none; }
.pdf-download { color: var(--ink-2); }
.pdf-view:hover, .pdf-download:hover { background: var(--surface-3); }
td.row-actions { text-align: right; white-space: nowrap; }
td.row-actions > * { vertical-align: middle; }
/* Ekonomi-graf */
.eco-forecast { margin: 12px 0 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-3); font-size: 13px; }
.eco-forecast.ok { background: var(--status-success-bg, #dcf5e4); }
.eco-forecast.warn { background: var(--status-pending-bg, #fff1d6); }
.eco-forecast.neg { background: var(--status-danger-bg, #fde2e2); }
.eco-chart-wrap { position: relative; width: 100%; overflow-x: auto; }
.eco-chart { width: 100%; min-width: 420px; height: auto; display: block; }
.eco-hover { stroke: var(--ink-2); stroke-width: 1; }
.eco-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 4px 14px rgba(0,0,0,.15); padding: 8px 10px; font-size: 12px; line-height: 1.5; white-space: nowrap; }
.eco-tip-date { font-weight: 500; margin-bottom: 2px; }
.eco-grid { stroke: var(--line-soft); stroke-width: 1; stroke-dasharray: 3 4; }
.eco-axis { fill: var(--muted); font-size: 11px; }
.eco-label { fill: var(--ink-2); font-size: 11px; font-weight: 500; }
.eco-area-purchase { fill: #4f7cff; opacity: .85; }
.eco-area-costs { fill: #f4a73b; opacity: .85; }
.eco-area-stock { fill: #e5584f; opacity: .8; }
.eco-future { fill: var(--surface); opacity: .55; }
.eco-today { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 4 3; }
.eco-sale { stroke: var(--chart-2); stroke-width: 2; stroke-dasharray: 6 5; stroke-linecap: round; }
.eco-sale-label { fill: #15803d; }
.eco-break { stroke: var(--status-danger-fg); stroke-width: 1.5; stroke-dasharray: 3 4; }
.eco-break-label { fill: var(--status-danger-fg); }
.eco-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.eco-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.eco-sw.purchase { background: #4f7cff; } .eco-sw.costs { background: #f4a73b; } .eco-sw.stock { background: #e5584f; } .eco-sw.sale { background: var(--chart-2); }

/* Kalender */
.cal-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
@media (max-width: 700px) { .cal-pair { grid-template-columns: 1fr; } }
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.cal-title { background: var(--surface-3); border-radius: var(--radius-sm); text-align: center; font-weight: 500; font-size: 13px; padding: 6px; margin-bottom: 8px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; font-weight: 500; font-size: 13px; margin-bottom: 6px; }
.cal-arrow { background: none; border: 0; font-size: 20px; cursor: pointer; width: 36px; height: 32px; border-radius: var(--radius-sm); color: var(--ink-2); }
.cal-arrow:hover { background: var(--surface-3); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-dow { font-size: 11px; color: var(--muted); padding: 4px 0; }
.cal-day { height: 36px; border: 0; background: none; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; color: var(--ink); }
.cal-day:hover:not(:disabled) { background: var(--surface-3); }
.cal-day.out { color: var(--muted); opacity: .55; }
.cal-day.today { font-weight: 500; text-decoration: underline; }
.cal-day.sel { background: var(--accent); color: #fff; font-weight: 500; opacity: 1; }
.cal-day:disabled { opacity: .3; cursor: default; }
.cal-time { width: 100%; margin-top: 8px; }
button.action-tile { text-align: left; cursor: pointer; font: inherit; width: 100%; }
button.action-tile:disabled { opacity: .5; cursor: not-allowed; }
.owner-box { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--surface-3); font-size: 14px; }

.equip-suggest { margin-top: 12px; }
.equip-suggest-title { font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.equip-suggest-chip { border: 1px dashed var(--line); background: var(--surface); border-radius: var(--radius-pill); padding: 3px 12px; font-size: 13px; cursor: pointer; color: var(--ink); }
.equip-suggest-chip:hover { background: var(--accent-soft); border-color: var(--accent); }

/* Publik signeringssida */
.public-main { max-width: 860px; margin: 0 auto; padding: 16px 16px 120px; }
.sign-head { margin-bottom: 12px; }
.sign-company { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sign-head h1 { font-size: 22px; margin: 2px 0 0; }
.sign-intro { color: var(--ink-2); font-size: 14px; }
.sign-page-canvas { display: block; width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; background: #fff; }
.sign-frame { width: 100%; height: 80vh; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.sign-bar { position: sticky; bottom: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 12px; box-shadow: 0 -4px 14px rgba(0,0,0,.08); }
.sign-hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.sign-qr { margin-top: 12px; text-align: center; }
.sign-qr img { width: 200px; height: 200px; image-rendering: pixelated; }
.sign-qr p { font-size: 12px; color: var(--muted); }
.sign-badge { margin-top: 4px; font-size: 12px; font-weight: 500; border-radius: var(--radius-pill); padding: 2px 10px; display: inline-block; }
.sign-badge.signed { background: var(--status-success-bg, #dcf5e4); color: var(--status-success-fg, #14733a); }
.sign-badge.pending { background: var(--status-pending-bg, #fff1d6); color: var(--status-pending-fg, #7a4a00); }
.dash-link { display: block; text-decoration: none; color: inherit; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.dash-link:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,.08); }

/* Kundflöde: tydligt klart / just nu / kvar */
.flow-case.complete { border-left: 4px solid var(--status-success-fg, #14733a); }
.flow-case.cancelled { border-left: 4px solid var(--status-danger-fg, #b42318); }
.flow-now { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.flow-step.todo { opacity: .6; background: var(--surface-3); border-left-color: var(--line); }
.flow-step.current { opacity: 1; border-left-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.flow-step.done .flow-mark { color: var(--status-success-fg, #14733a); }
.flow-mark { display: inline-block; width: 16px; font-weight: 500; }
.flow-step-time { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.flow-key { font-size: 12px; margin-left: 8px; color: var(--muted); }
.flow-key.done { color: var(--status-success-fg, #14733a); } .flow-key.current { color: var(--accent-ink); font-weight: 500; }
.flow-step { flex: 1 0 118px; min-width: 118px; }

.sign-parties ul { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.sign-parties li { display: flex; gap: 8px; font-size: 14px; color: var(--muted); }
.sign-parties li.done { color: var(--ink); }
.sign-parties .mark { width: 16px; font-weight: 500; }
.sign-parties li.done .mark { color: var(--status-success-fg, #14733a); }
.sign-drawn { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.draw-canvas { width: 100%; max-width: 600px; height: auto; aspect-ratio: 600 / 220; border: 1px dashed var(--line); border-radius: var(--radius-sm); background: #fff; touch-action: none; cursor: crosshair; display: block; }

/* ---------- PDF-förhandsvisning (pop-up) ---------- */
body.pdf-popup-open { overflow: hidden; }
.pdf-popup-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.pdf-popup-sheet { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); width: min(920px, 100%); height: min(94vh, 1100px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); overflow: hidden; }
.pdf-popup-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pdf-popup-title { font-size: 14px; }
.pdf-popup-actions { display: flex; align-items: center; gap: 8px; }
.pdf-popup-body { flex: 1; overflow-y: auto; padding: 12px; background: var(--surface-3); -webkit-overflow-scrolling: touch; }
.pdf-popup-page { display: block; margin: 0 auto 12px; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.pdf-popup-frame { width: 100%; height: 100%; min-height: 70vh; border: 0; background: #fff; }
.pdf-popup-loading { color: var(--muted); font-size: 13px; text-align: center; }
@media (max-width: 640px) {
  .pdf-popup-backdrop { padding: 0; }
  .pdf-popup-sheet { width: 100%; height: 100%; border-radius: 0; border: 0; }
  .pdf-popup-body { padding: 6px; }
}

/* ---------- Väljarlista i pop-up (t.ex. välj fordon) ---------- */
.picker-list { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; }
.picker-row { display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%; padding: 6px 10px; min-height: 36px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.picker-row:hover { background: var(--surface-3); border-color: var(--accent); }
.cust-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.cust-actions .btn { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Betalsätt på offerten ---------- */
.pay-panel { padding: 14px 16px; }
.pay-title { font-size: 15px; margin: 0 0 12px; text-align: center; }
.pay-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.pay-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.pay-card small { font-size: 12px; color: var(--muted); }
.pay-card:hover { background: var(--surface-3); }
.pay-card.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pay-card.on small { color: #fff; opacity: .9; }
.pay-radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.pay-radio span { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: 0; }
.pay-card.on .pay-radio span { opacity: 1; }
.pay-body { margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius); }
.pay-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.pay-line label { font-size: 13px; font-weight: 500; }
.pay-amount { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.pay-amount input { width: 110px; text-align: right; font-weight: 500; padding: 4px 8px; }
.pay-slider { width: 100%; margin: 2px 0 12px; accent-color: var(--accent); }
.pay-sub { display: block; font-size: 13px; font-weight: 500; margin: 4px 0 6px; }
.pay-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pay-chip { min-width: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-weight: 500; cursor: pointer; }
.pay-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pay-total { display: flex; align-items: baseline; justify-content: space-between; margin-top: 14px; padding: 10px 12px; background: var(--surface-3); border-radius: var(--radius-sm); }
.pay-total strong { font-size: 22px; }
.pay-total small { font-size: 12px; font-weight: 500; color: var(--muted); }
.pay-note { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; margin: 8px 0 0; background: var(--surface); }
.pay-trade { margin-top: 12px; }
.quote-page { max-width: 920px; }
/* Kundruta: saknade uppgifter till vänster, kundinformation till höger — sparar höjd. */
.customer-split { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.customer-split .customer-box { flex: 2 1 280px; min-width: 0; }
.customer-missing { flex: 1 1 220px; min-width: 200px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.customer-missing-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.customer-missing-alert { border-color: var(--status-danger-fg); background: var(--status-danger-bg); }
.customer-missing-alert .customer-missing-title { color: var(--status-danger-fg); font-weight: 700; }
.customer-missing-alert .customer-missing-hint { color: var(--status-danger-fg); }
input.input-missing { border-color: var(--status-danger-fg); }
.contact-missing-text { color: var(--status-danger-fg); font-size: 13px; font-weight: 500; margin: 10px 0 0; }
.customer-missing-hint { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }

/* ---------- Startsidan: diagram, nyckeltal och påminnelser ---------- */
:root {
  --chart-1: #3b82f6; --chart-2: #22c55e; --chart-3: #f5b82e; --chart-4: #f97316;
  --chart-5: #8b5cf6; --chart-6: #ec4899; --chart-7: #14b8a6; --chart-other: oklch(0.72 0.01 250); --chart-unknown: oklch(0.84 0.008 250);
}
:root[data-theme="dark"] {
  --chart-1: #60a5fa; --chart-2: #4ade80; --chart-3: #fbbf24; --chart-4: #fb923c;
  --chart-5: #a78bfa; --chart-6: #f472b6; --chart-7: #2dd4bf; --chart-other: oklch(0.55 0.01 250); --chart-unknown: oklch(0.42 0.01 250);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --chart-1: #60a5fa; --chart-2: #4ade80; --chart-3: #fbbf24; --chart-4: #fb923c;
    --chart-5: #a78bfa; --chart-6: #f472b6; --chart-7: #2dd4bf; --chart-other: oklch(0.55 0.01 250); --chart-unknown: oklch(0.42 0.01 250);
  }
}
.donut { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.donut-figure { position: relative; width: 112px; height: 112px; flex: 0 0 auto; }
.donut-figure svg { width: 100%; height: 100%; display: block; }
.donut-track { stroke: var(--line-soft); }
.donut-seg { transition: stroke-width .15s ease; cursor: default; stroke-linecap: butt; }
.donut-seg.hot { stroke-width: 17; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center strong { font-size: 20px; font-weight: 500; line-height: 1.1; }
.donut-center span { font-size: 11px; color: var(--muted); }
.chart-legend { list-style: none; margin: 0; padding: 0; flex: 1 1 150px; min-width: 140px; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.chart-legend li { display: flex; align-items: center; gap: 8px; padding: 2px 6px; border-radius: 6px; transition: background .12s; }
.chart-legend li.hot { background: var(--surface-3); }
.chart-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.chart-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-count { font-weight: 500; }
.chart-pct { color: var(--muted); width: 38px; text-align: right; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 110px) 1fr 28px; align-items: center; gap: 10px; font-size: 12px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; animation: bar-grow .5s ease-out; }
@keyframes bar-grow { from { width: 0; } }
.bar-value { text-align: right; font-weight: 500; }
.dash-kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.dash-kpi-value small { font-size: 13px; font-weight: 500; color: var(--muted); }

.rem-grid { display: grid; grid-template-columns: 250px 1fr; gap: 20px; }
@media (max-width: 760px) { .rem-grid { grid-template-columns: 1fr; } }
.rem-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.rem-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.rem-dow { text-align: center; font-size: 10px; color: var(--muted); font-weight: 500; padding-bottom: 2px; }
.rem-day { position: relative; aspect-ratio: 1; min-height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: 12px; cursor: pointer; }
.rem-day:hover { background: var(--surface-3); }
.rem-day.today { font-weight: 800; font-size: 14px; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.rem-day.sel { background: var(--accent); color: #fff; }
.rem-dot { position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); }
.rem-day.sel .rem-dot { background: #fff; }
.rem-dot.late { background: var(--status-danger-fg); }
.rem-group { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 10px 0 4px; }
.rem-group:first-child { margin-top: 0; }
.rem-group.late { color: var(--status-danger-fg); }
.rem-group.today { color: var(--accent); font-weight: 800; font-size: 12px; }
.rem-item.today .rem-title { font-weight: 800; }
.rem-toggle { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font-family: inherit; }
.rem-toggle:hover { color: var(--ink); }
.rem-chevron { font-size: 12px; width: 12px; }
.rem-group-count { background: var(--surface-3); color: var(--ink); border-radius: 999px; padding: 0 8px; font-size: 11px; font-weight: 700; }
.rem-group.late .rem-group-count { background: var(--status-danger-bg, var(--surface-3)); color: var(--status-danger-fg); }
.rem-item.today .rem-sub { font-weight: 700; color: var(--ink); }
.rem-detail { color: var(--ink); }
.rem-empty { font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.rem-item { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.rem-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); cursor: pointer; flex: 0 0 auto; margin-top: 1px; padding: 0; }
.rem-check:hover { border-color: var(--accent); background: var(--accent-soft); }
.rem-body { min-width: 0; flex: 1; }
.rem-title { font-size: 13px; font-weight: 500; }
.rem-sub { font-size: 11px; color: var(--muted); }
.rem-sub.late { color: var(--status-danger-fg); }
.rem-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.rem-add input:first-child { flex: 1 1 200px; min-width: 0; }
.rem-add input[type=date] { width: 150px; }

/* ---------- Färgglada nyckeltal och diagram ---------- */
.kpi-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; text-decoration: none; color: inherit; }
.kpi-head { display: flex; align-items: center; gap: 10px; }
.kpi-icon { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.kpi-blue { color: #3b82f6; background: color-mix(in srgb, #3b82f6 14%, transparent); }
.kpi-purple { color: #8b5cf6; background: color-mix(in srgb, #8b5cf6 14%, transparent); }
.kpi-green { color: #16a34a; background: color-mix(in srgb, #22c55e 16%, transparent); }
.kpi-orange { color: #ea580c; background: color-mix(in srgb, #f97316 15%, transparent); }
.kpi-pink { color: #db2777; background: color-mix(in srgb, #ec4899 14%, transparent); }
.kpi-teal { color: #0d9488; background: color-mix(in srgb, #14b8a6 15%, transparent); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kpi-value { font-size: 22px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kpi-sub { font-size: 11.5px; color: var(--muted); }
.trend-pill { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 500; }
.trend-pill.up { background: color-mix(in srgb, #22c55e 16%, transparent); color: #15803d; }
.trend-pill.down { background: color-mix(in srgb, #ef4444 15%, transparent); color: #b91c1c; }
.trend-pill.flat { background: var(--surface-3); color: var(--muted); }
:root[data-theme="dark"] .trend-pill.up { color: #4ade80; } :root[data-theme="dark"] .trend-pill.down { color: #f87171; }

.cols-legend { display: flex; gap: 14px; font-size: 11.5px; margin-bottom: 4px; }
.cols-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cols-plot { position: relative; display: flex; align-items: stretch; gap: 8px; height: 150px; padding: 6px 0 20px 26px; }
.cols-grid { position: absolute; left: 26px; right: 0; top: 6px; bottom: 22px; pointer-events: none; }
.cols-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line-soft); }
.cols-line span { position: absolute; left: -26px; top: -7px; width: 22px; text-align: right; font-size: 10px; color: var(--muted); }
.cols-group { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.cols-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.col-bar { position: relative; width: min(18px, 38%); border-radius: 6px 6px 2px 2px; min-height: 0; transition: height .4s ease, filter .15s; }
.col-bar em { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10px; font-weight: 500; color: var(--ink-2); }
.cols-group:hover .col-bar { filter: brightness(1.08); }
.cols-x { position: absolute; bottom: -20px; font-size: 11px; color: var(--muted); text-transform: capitalize; }

.area svg { width: 100%; height: 100px; display: block; }
.area-grid { stroke: var(--line-soft); stroke-width: 1; stroke-dasharray: 3 4; }
.area-axis { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.dash-grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 10px; }
.dash-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 10px; }
.dash-grid-wide { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 10px; margin-bottom: 10px; }
@media (max-width: 900px) { .dash-grid-wide { grid-template-columns: 1fr; } }

/* ---------- Rabatt och marginal i offert/avtal ---------- */
.discount-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.discount-row > input { flex: 1 1 200px; min-width: 0; }
.discount-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 6px 0 10px; }
.margin-peek { background: none; border: 0; padding: 0; font-size: 11.5px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.margin-peek:hover { color: var(--ink-2); }
.margin-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.margin-dot.ok { background: var(--status-success-fg); }
.margin-dot.low { background: var(--status-danger-fg); }
.margin-detail { font-size: 11.5px; color: var(--muted); }
.margin-detail.low { color: var(--status-danger-fg); }


/* ==========================================================================
   Lättare typografi och renare linjer/former (efter genomgång av hela gränssnittet)
   ========================================================================== */
strong, b, th, dt { font-weight: 500; }
h1, h2, h3, h4 { font-weight: 500; letter-spacing: -0.01em; }
/* Inline-stilar med fet text i sidorna följer samma lättare vikt. */
[style*="font-weight:600"], [style*="font-weight: 600"], [style*="font-weight:700"], [style*="font-weight: 700"] { font-weight: 500 !important; }

/* Knappar och fält: jämna rundningar, tunna linjer, mjuk fokusring i stället för kraftig kant. */
.btn { border-radius: 10px; }
.btn-secondary { border-color: var(--line); background: var(--surface); }
.btn-secondary:hover { background: var(--surface-2); border-color: oklch(0.88 0.008 240); }
.field input, .field select, .field textarea, .input-group-text, select.select-lg { border-radius: 10px; border-color: var(--line); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.card { border-radius: 14px; box-shadow: none; }

/* Listor: ingen tung rubrikrad, bara tunna radavskiljare. */
table.data-table { border-radius: 12px; border-color: var(--line); }
table.data-table th { text-transform: none; letter-spacing: 0; font-size: 11.5px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
table.data-table td { border-bottom-color: var(--line-soft); }

/* Meddelanderutor: tunn ram i färgen i stället för tjock kant till vänster. */
.finding { border-left: 1px solid var(--line); border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.finding-ok { border-color: color-mix(in srgb, var(--status-success-fg) 35%, var(--line)); background: color-mix(in srgb, var(--status-success-fg) 6%, var(--surface)); }
.finding-info { border-color: color-mix(in srgb, var(--status-neutral-fg) 30%, var(--line)); }
.finding-warning { border-color: color-mix(in srgb, var(--status-pending-fg) 40%, var(--line)); }
.finding-blocker { border: 1px solid color-mix(in srgb, var(--status-danger-fg) 45%, var(--line)); }
.finding-title { font-weight: 500; }

/* Flikar, steg, val och kort med tunna, jämna former. */
.wizard-step, .seg-btn, .pay-card, .pay-chip, .picker-row, .tradein-summary, .pager-btn { border-color: var(--line); border-radius: 10px; }
.wizard-step.active, .pay-chip.on, .seg-btn.on { box-shadow: none; }
.vd-sig { border-width: 1px; }
.modal-sheet { border-radius: 16px; border-color: var(--line); }
.status-badge, .trend-pill { font-weight: 500; }
.dash-card { box-shadow: none; border-radius: 14px; }
.dash-link:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, .05); }
.kpi-value, .donut-center strong, .bar-value, .chart-count { font-weight: 500; }

/* ---------- Dokumentmallar ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tpl-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.tpl-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.tpl-card.off { opacity: .7; }
.tpl-name { font-size: 14px; font-weight: 500; }
.tpl-desc { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }

/* ---------- Utvecklingslogg ---------- */
.changelog { max-width: 820px; }
.cl-day { display: grid; grid-template-columns: 120px 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 640px) { .cl-day { grid-template-columns: 1fr; gap: 6px; } }
.cl-date { font-size: 12px; color: var(--muted); padding-top: 14px; }
.cl-entries { display: flex; flex-direction: column; gap: 10px; border-left: 1px solid var(--line); padding-left: 16px; }
.cl-entry { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.cl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.cl-title { font-size: 14px; font-weight: 500; }
.cl-entry ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.cl-entry li { margin-bottom: 3px; }

/* ---------- Hur vill du göra nu? ---------- */
.next-options { display: flex; flex-direction: column; gap: 8px; }
.next-option { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.next-option strong { font-size: 14px; font-weight: 500; }
.next-option span { font-size: 12px; color: var(--muted); }
.next-option:hover:not(:disabled) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.next-option:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Dokumentdialog: förhandsvisning + åtgärder ---------- */
.modal-sheet.doc-detail { width: min(1080px, 100%); max-height: 94vh; overflow: hidden; display: flex; flex-direction: column; }
.doc-detail-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 16px; min-height: 0; flex: 1; }
.doc-preview { height: min(72vh, 820px); border-radius: 12px; border: 1px solid var(--line); }
.doc-side { overflow-y: auto; max-height: min(72vh, 820px); display: flex; flex-direction: column; gap: 12px; }
.doc-facts { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.doc-facts span { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.doc-side-title { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.doc-party { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-revoke { border-top: 1px solid var(--line-soft); padding-top: 12px; }
@media (max-width: 900px) {
  .doc-detail-grid { grid-template-columns: 1fr; overflow-y: auto; }
  .doc-preview { height: 46vh; }
  .doc-side { max-height: none; overflow: visible; }
}
.row-click { cursor: pointer; }

/* ---------- Så betalar kunden ---------- */
.pay-summary { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.pay-summary-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.pay-summary-title { font-size: 13px; font-weight: 500; }
.pay-summary-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pay-summary-table td { padding: 4px 0; border-bottom: 1px solid var(--line-soft); }
.pay-summary-table td:last-child { text-align: right; white-space: nowrap; }
.pay-summary-table tr.sub td { color: var(--muted); font-size: 12px; padding-left: 12px; }
.pay-summary-table tr.total td { font-weight: 500; border-bottom-color: var(--line); }
.pay-summary-table tr.remaining td { font-weight: 500; font-size: 14px; border-bottom: 0; padding-top: 8px; }
.pay-summary-table tr.remaining.payout td { color: var(--status-danger-fg); }
.pay-summary-table .hint { font-size: 11px; color: var(--muted); }
.pay-summary-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* ---------- Datumfält med kalender ---------- */
.date-input { position: relative; display: block; }
.date-input > input { padding-right: 40px; width: 100%; }
.date-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.date-btn:hover { background: var(--surface-3); color: var(--ink-2); }
.date-backdrop { position: fixed; inset: 0; z-index: 140; background: transparent; }
.date-pop { position: absolute; z-index: 150; top: calc(100% + 6px); left: 0; width: min(300px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px 8px; box-shadow: 0 12px 32px rgba(0, 0, 0, .14); }
.date-pop .cal-day { height: 34px; }
.date-pop-foot { display: flex; justify-content: space-between; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-soft); font-size: 12px; }

.eco-line { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.eco-line-total { stroke-width: 2.6; }
.eco-dot { fill: var(--surface); stroke-width: 2.5; }
.eco-dot-loss { stroke: var(--status-danger-fg); fill: var(--surface); }
.eco-faint { fill: var(--muted); }
.eco-sw { border-radius: 50%; }
.eco-milestones { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
.eco-milestone { flex: 1 1 150px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--surface); display: flex; flex-direction: column; gap: 1px; }
.eco-milestone span { font-size: 11px; color: var(--muted); }
.eco-milestone strong { font-size: 14px; font-weight: 500; }
.eco-milestone small { font-size: 11px; color: var(--muted); }
.eco-milestone.purchase { border-top: 3px solid var(--chart-1); }
.eco-milestone.today { border-top: 3px solid var(--chart-5); }
.eco-milestone.loss { border-top: 3px solid var(--status-danger-fg); }

.tradein-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px 14px; padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 13px; }
.tradein-facts span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

/* ---------- PDF i helsida ---------- */
.pdf-fullview { height: calc(100vh - 170px); min-height: 480px; border: 1px solid var(--line); border-radius: 14px; }
.doc-panel.doc-page .doc-detail-grid { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.doc-panel.doc-page .doc-preview { height: calc(100vh - 250px); min-height: 480px; max-height: none; }
.doc-panel.doc-page .doc-side { max-height: calc(100vh - 250px); }
.doc-panel > .modal-head { margin-bottom: 12px; }

/* ---------- Motello-admin: eget utseende så det aldrig förväxlas med kundvyn ---------- */
.admin-shell {
  --accent: oklch(0.52 0.17 295);
  --accent-soft: oklch(0.62 0.12 295 / 0.14);
  --accent-ink: oklch(0.4 0.14 295);
  --nav-active: oklch(0.4 0.14 295);
  --topbar-bg: oklch(0.42 0.14 295);
  --topbar-line: oklch(0.52 0.12 295);
  --topbar-field-bg: oklch(0.5 0.12 295);
}
.admin-shell .nav-item.active { background: oklch(0.6 0.12 295 / 0.14); }
.admin-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: oklch(0.62 0.17 295); color: #fff; font-size: 10px; letter-spacing: .1em; vertical-align: 2px; }
.admin-switch { color: #fff; opacity: .85; font-size: 12.5px; text-decoration: none; padding: 6px 12px; border: 1px solid rgba(255,255,255,.3); border-radius: 99px; margin-right: 8px; }
.admin-switch:hover { opacity: 1; background: rgba(255,255,255,.1); }

/* ---------- Sökfält ---------- */
.search-field { position: relative; display: block; max-width: 380px; margin-bottom: 12px; }
.search-field > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field > input { width: 100%; min-height: 40px; padding: 8px 34px 8px 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.search-field > input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.search-clear:hover { background: var(--surface-3); }
.search-field input[type=search]::-webkit-search-cancel-button { display: none; }


/* ---------- Anpassningsbar startsida: rutnät med 12 kolumner ---------- */
.dash-board { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.dash-slot { position: relative; min-width: 0; display: flex; }
.dash-slot > .dash-card { flex: 1; min-width: 0; }
.dash-slot.span-3 { grid-column: span 3; }
.dash-slot.span-4 { grid-column: span 4; }
.dash-slot.span-6 { grid-column: span 6; }
.dash-slot.span-8 { grid-column: span 8; }
.dash-slot.span-12 { grid-column: span 12; }
@media (max-width: 900px) {
    .dash-slot.span-3, .dash-slot.span-4 { grid-column: span 6; }
    .dash-slot.span-6, .dash-slot.span-8 { grid-column: span 12; }
}
@media (max-width: 380px) { .dash-slot.span-3, .dash-slot.span-4 { grid-column: span 12; } }

.dash-board.editing .dash-slot { outline: 1.5px dashed var(--line); outline-offset: 3px; border-radius: 14px; }
.dash-board.editing .dash-slot.dragging { opacity: .4; }
.dash-board.editing .dash-slot.drop-target { outline: 2px solid var(--accent); }
.slot-shield { position: absolute; inset: 0; z-index: 2; cursor: grab; border-radius: 14px; background: transparent; }
.slot-tools { position: absolute; top: 8px; right: 8px; z-index: 3; display: flex; align-items: center; gap: 4px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.slot-btn { border: 0; background: transparent; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-size: 14px; }
.slot-btn:hover { background: var(--accent-soft); color: var(--accent-ink); }
.slot-select { width: auto; max-width: 130px; height: 28px; padding: 0 6px; font-size: 12px; border-radius: 8px; }
.dash-edit-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 10px; background: var(--accent-soft); border: 1px solid var(--line); border-radius: 12px; font-size: 13px; }
.dash-edit-bar span { color: var(--muted); margin-left: 4px; }
.dash-hidden-tray { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; color: var(--muted); }

/* ---------- Uppgifter: anteckningshistorik ---------- */
.task-notes { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.task-note { padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 10px; font-size: 13px; background: var(--surface); }
.task-note.system { background: transparent; color: var(--muted); }
.task-note-meta { font-size: 11px; color: var(--muted); margin-bottom: 2px; }

/* Dokumentlistor: avtals-/offertnumret är länken som öppnar dokumentet */
.doc-number { font-weight: 500; font-size: 13px; white-space: nowrap; }

/* Utskick: när ett mejl skickats och om det öppnats */
.mail-trail { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.mail-trail .opened { color: var(--status-success-fg); }
.mail-composer { padding: 10px 12px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px; }
.mail-composer label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.mail-composer textarea { width: 100%; }

/* Motello-admin: att göra-lista */
.admin-todos { padding: 4px 16px; }
.admin-todo { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.admin-todo:first-child { border-top: 0; }
.admin-todo > input[type=checkbox] { margin-top: 4px; width: 18px; height: 18px; flex: 0 0 auto; }
.admin-todo-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.admin-todo-title { font-size: 14px; }
.admin-todo-notes { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; }
.admin-todo-meta { font-size: 11.5px; color: var(--muted); }
.admin-todo-actions { display: flex; gap: 12px; flex: 0 0 auto; }
.admin-todo.done .admin-todo-title { text-decoration: line-through; color: var(--muted); }

/* Toppfältet är blått i stället för svart: avataren och knapparna ska synas mot det */
.topbar .avatar-chip { background: rgba(255,255,255,.22); color: #fff; }
.logout-btn:hover { border-color: rgba(255,255,255,.7); }

/* Universalsök för kopplingar (EntityPicker) */
.entity-picker { position: relative; min-width: 0; }
.entity-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 8px 6px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--accent-soft); font-size: 13px; }
.entity-chip a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-kind { flex: 0 0 auto; padding: 1px 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line-soft); font-size: 11px; color: var(--muted); }
.entity-clear { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 12px; padding: 2px 6px; border-radius: 99px; }
.entity-clear:hover { background: var(--surface); color: var(--ink); }
.entity-results { margin-top: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; max-height: 280px; overflow-y: auto; }
.entity-result { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-top: 1px solid var(--line-soft); background: transparent; cursor: pointer; font-size: 13px; color: var(--ink); }
.entity-result:first-child { border-top: 0; }
.entity-result:hover, .entity-result:focus-visible { background: var(--accent-soft); outline: none; }
.entity-title { font-weight: 500; }
.entity-sub { color: var(--muted); font-size: 12px; }
.entity-hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.task-link a { font-size: 12px; }

/* Valbara kolumner */
.col-picker { position: relative; }
.col-picker > summary { list-style: none; cursor: pointer; }
.col-picker > summary::-webkit-details-marker { display: none; }
.col-picker-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 230px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12); display: flex; flex-direction: column; gap: 4px; }
.col-picker-title { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* Sökrutan i toppfältet (gemensam sökning) */
.global-search { position: relative; flex: 1; max-width: 460px; min-width: 0; }
.global-search .topbar-search { width: 100%; max-width: none; box-sizing: border-box; }
.gs-menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; max-height: 70vh; overflow-y: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.16); padding: 6px 0; }
.gs-group { padding: 8px 14px 4px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.gs-hit, .gs-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; width: 100%; text-align: left; padding: 8px 14px; border: 0; background: transparent; cursor: pointer; font-size: 13px; color: var(--ink); text-decoration: none; }
.gs-hit:hover, .gs-row:hover { background: var(--accent-soft); text-decoration: none; }
.gs-title { font-weight: 500; }
.gs-sub { color: var(--muted); font-size: 12px; }
.gs-empty { padding: 12px 14px; font-size: 13px; color: var(--muted); }
.gs-all { display: block; width: 100%; padding: 10px 14px; border: 0; border-top: 1px solid var(--line-soft); background: transparent; text-align: left; cursor: pointer; font-size: 12.5px; color: var(--accent-ink); }
.gs-all:hover { background: var(--accent-soft); }
.gs-row { border-top: 1px solid var(--line-soft); }
@media (max-width: 860px) { .global-search { display: none; } }

/* Sorterbara kolumnrubriker */
table.data-table th.sortable { padding: 0; }
.sort-btn { width: 100%; display: inline-flex; align-items: center; gap: 5px; padding: inherit; border: 0; background: transparent; font: inherit; color: inherit; cursor: pointer; text-align: inherit; white-space: nowrap; }
th.sortable .sort-btn { padding: 6px 10px; text-transform: inherit; letter-spacing: inherit; }
th.sortable[style*="text-align:right"] .sort-btn { justify-content: flex-end; }
.sort-arrow { font-size: 10px; color: var(--faint); }
th.sorted .sort-arrow { color: var(--accent-ink); }
.sort-btn:hover .sort-arrow { color: var(--ink-2); }
.sort-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }

/* Fordonssidan: varningar för besiktning, trafikstatus och körförbud */
.vehicle-flag-banner.warn { background: var(--status-pending-bg); color: var(--status-pending-fg); }
.vehicle-check-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12.5px; color: var(--muted); }

/* Publicering: markera flera bilar */
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 10px; background: var(--accent-soft); border: 1px solid var(--line); border-radius: 12px; }
tr.row-selected { background: var(--accent-soft); }
tr.row-selected:hover { background: var(--accent-soft); }
.stock-old { color: var(--status-danger-fg); }

/* Prisskyltsdesignern */
.sign-designer { display: grid; grid-template-columns: 200px minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .sign-designer { grid-template-columns: 1fr; } .sign-designer > .empty-state { grid-column: auto !important; } }
.sign-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.sign-list-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.sign-new { padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.sign-list-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line-soft); background: none; text-align: left; cursor: pointer; font: inherit; color: var(--ink); }
.sign-list-item small { color: var(--muted); font-size: 11px; }
.sign-list-item:hover { background: var(--surface-2); }
.sign-list-item.on { background: var(--surface-3); font-weight: 600; }
.sign-stage { min-width: 0; }
.sign-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.sign-saved { font-size: 12px; color: var(--muted); margin-left: auto; }
.sign-sheet { background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; justify-content: center; }
.sign-svg { width: 100%; max-width: 520px; height: auto; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.18); display: block; }
.sign-hit { fill: transparent; cursor: pointer; pointer-events: all; }
.sign-hit:hover { stroke: #2563eb; stroke-width: 1; stroke-opacity: .5; vector-effect: non-scaling-stroke; }
.sign-hit.on { stroke: #2563eb; stroke-width: 2; stroke-dasharray: 5 3; vector-effect: non-scaling-stroke; }
.sign-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 12px 12px; }
.sign-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 -12px 10px; padding: 0 8px; }
.sign-tab { padding: 10px 8px; border: 0; background: none; font: inherit; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.sign-tab.on { color: var(--ink); border-bottom-color: var(--accent, #e8662d); }
.sign-tree { display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; margin-bottom: 10px; }
.sign-node { position: relative; box-sizing: border-box; min-height: 30px; display: flex; align-items: center; text-align: left; padding: 6px 8px; font-size: 13px; color: var(--ink); cursor: grab; border-radius: var(--radius-sm); user-select: none; }
.sign-node[draggable="true"]::before { content: "⋮⋮"; color: var(--muted); font-size: 11px; letter-spacing: -2px; margin-right: 6px; flex: none; }
.sign-node[data-root="1"] { cursor: pointer; }
.sign-node.dragging { opacity: .4; }
.sign-node.drop-before { box-shadow: 0 -2px 0 #2563eb; }
.sign-node.drop-after { box-shadow: 0 2px 0 #2563eb; }
.sign-node.drop-into { background: #dbeafe; outline: 2px dashed #2563eb; outline-offset: -2px; }
.sign-node:hover { background: var(--surface-2); }
.sign-node.on { background: var(--surface-3); font-weight: 600; }
.sign-tree-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sign-add { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 8px 10px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); }
.sign-add small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.sign-add:hover { background: var(--surface-2); }
.sign-panel-title { font-size: 13px; margin: 0 0 4px; }
.sign-file { font-size: 12px; margin-top: 6px; max-width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.row-action { font: inherit; font-size: 12px; padding: 4px 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); margin-left: 4px; max-width: 110px; }
.gaps-card { margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--status-pending-fg, #c27c00); border-radius: var(--radius); background: var(--status-pending-bg, #fffaf0); }
.drive-sign { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }

/* Inloggning och kontosidor (AuthLayout): mörkblå bakgrund med rutmönster, ljus ruta i mitten. */
.auth-bg {
  position: relative; min-height: 100vh; color: #fff;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.027) 0 2px, transparent 2px 26px),
    repeating-linear-gradient(45deg, rgba(255,255,255,.02) 0 2px, transparent 2px 26px),
    radial-gradient(120% 90% at 78% 8%, oklch(0.52 0.12 238) 0, oklch(0.40 0.10 240) 38%, oklch(0.25 0.07 245) 100%);
}
.auth-top { display: flex; align-items: center; justify-content: space-between; padding: 22px 32px; }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 600; font-size: 18px; letter-spacing: -.01em; }
.auth-mark { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 7px; background: #fff; color: oklch(0.40 0.10 240); font-size: 14px; font-weight: 800; line-height: 1; }
.auth-main { display: grid; place-items: center; padding: 12px 16px 56px; min-height: calc(100vh - 80px); }
.auth-card {
  width: min(412px, 100%); box-sizing: border-box; padding: 26px 24px; border-radius: 18px; color: var(--ink);
  background: oklch(0.965 0.006 240); box-shadow: 0 24px 60px rgba(4, 14, 32, .45);
}
.auth-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.auth-sub { margin: 0 0 18px; font-size: 13px; color: var(--muted); }
.auth-card .field { margin-bottom: 14px; }
.auth-card .field label { display: block; margin-bottom: 6px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); text-transform: none; letter-spacing: 0; }
.auth-card input:not([type=checkbox]):not([type=radio]), .auth-card select {
  width: 100%; box-sizing: border-box; height: 44px; padding: 0 14px; font-size: 13.5px; border-radius: 10px;
  border: 1px solid oklch(0.87 0.01 240); background: #fff; color: var(--ink);
}
.auth-card input:focus { outline: 2px solid oklch(0.64 0.13 225 / .45); outline-offset: 1px; border-color: oklch(0.55 0.12 235); }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 16px; font-size: 12.5px; }
.auth-row a { color: var(--muted); text-decoration: none; }
.auth-row a:hover { text-decoration: underline; }
.auth-check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); cursor: pointer; }
.auth-check input { width: 16px; height: 16px; accent-color: oklch(0.47 0.11 235); }
.auth-primary, .auth-secondary { display: flex; align-items: center; justify-content: center; width: 100%; box-sizing: border-box; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.auth-primary { height: 46px; border: 0; background: oklch(0.47 0.11 235); color: #fff; font-size: 14px; }
.auth-primary:hover { background: oklch(0.42 0.11 235); }
.auth-secondary { height: 44px; border: 1px solid oklch(0.87 0.01 240); background: #fff; color: var(--ink); font-size: 13.5px; }
.auth-secondary:hover { background: oklch(0.985 0.004 240); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; font-size: 10.5px; letter-spacing: .1em; color: var(--faint); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: oklch(0.88 0.01 240); }
.auth-foot { margin: 14px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.auth-foot a { color: var(--accent-ink); }
.auth-card .text-danger, .auth-card .validation-message { color: var(--status-danger-fg); font-size: 12px; }
.auth-card .btn-primary { width: 100%; height: 46px; border-radius: 10px; background: oklch(0.47 0.11 235); border: 0; color: #fff; font-weight: 600; }
@media (max-width: 520px) { .auth-top { padding: 16px 18px; } .auth-card { padding: 22px 18px; } }

/* Formulär med kort och rutnät (fordonsformuläret): rubrikremsa med versaler, tre kolumner, små versala etiketter. */
.form-title { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 12px; color: var(--ink-2); }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.form-card-head { padding: 12px 20px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 20px; padding: 18px 20px 20px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: 1 / -1; }
.form-grid .field { margin: 0; min-width: 0; }
.form-grid .field > label:not(.wizard-choice) { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.form-grid input:not([type=checkbox]):not([type=radio]), .form-grid select, .form-grid textarea { width: 100%; box-sizing: border-box; }
.form-grid input:not([type=checkbox]):not([type=radio]), .form-grid select { height: 42px; }
.form-grid textarea { min-height: 90px; }
.form-inline { display: flex; gap: 8px; align-items: stretch; }
.form-inline input { flex: 1; }
.form-checks { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.form-actions { display: flex; gap: 10px; padding-bottom: 24px; }
@media (max-width: 900px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .span-3 { grid-column: 1 / -1; } }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } .form-grid .span-2, .form-grid .span-3 { grid-column: auto; } }

/* Attest */
.approval-row { padding: 10px 0; border-top: 1px solid var(--border, #e3e8ee); font-size: 13px; }
.approval-row:first-of-type { border-top: 0; }
.approval-decision { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.approval-comment { width: 100%; }
.approval-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.approval-status { font-weight: 600; }
.approval-pending { color: var(--status-pending-fg, #9a6700); }
.approval-approved { color: var(--status-success-fg, #1a7f37); }
.approval-rejected { color: var(--status-danger-fg, #cf222e); }
.approval-superseded { color: var(--muted); }
.approval-note { flex-basis: 100%; margin: 0 0 6px; font-size: 12px; color: var(--status-pending-fg, #9a6700); }

.reserved-lock { margin-left: 6px; cursor: help; }
.deal-id { font-weight:600; margin-right:6px; padding:1px 6px; border-radius:4px; background:var(--accent-soft); color:var(--accent-ink); text-decoration:none; font-size:12px; }

/* Toppmenyn har samma blå bakgrund med rutmönster som inloggningssidan */
.topbar {
  --topbar-line: rgba(255, 255, 255, .22);
  --topbar-field-bg: rgba(255, 255, 255, .12);
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.027) 0 2px, transparent 2px 26px),
    repeating-linear-gradient(45deg, rgba(255,255,255,.02) 0 2px, transparent 2px 26px),
    radial-gradient(70% 320% at 78% 0, oklch(0.52 0.12 238) 0, oklch(0.40 0.10 240) 40%, oklch(0.27 0.07 245) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}

/* Undermeny i sidomenyn (t.ex. Bevakning, Uppdrag och Inköp under Lager) */
.nav-item.nav-sub { margin-left: 14px; padding: 7px 12px 7px 14px; font-size: 12.5px; border-left: 1px solid var(--nav-line); border-radius: 0 var(--radius) var(--radius) 0; }
.nav-item.nav-sub.active { border-left-color: var(--accent, currentColor); }
.nav-item.nav-group { cursor: default; font-weight: 600; margin-top: 2px; }
.nav-item.nav-group:hover { background: transparent; }

/* Händelselogg i affärsvyn */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; padding: 9px 0; border-top: 1px solid var(--line-soft, #e8ecf1); }
.timeline-item:first-child { border-top: 0; }
.timeline-icon { font-size: 16px; text-align: center; line-height: 1.4; }
.timeline-title { font-size: 13px; font-weight: 500; }
.timeline-detail { font-size: 12px; color: var(--muted); margin-top: 1px; }
.timeline-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) { .timeline-item { grid-template-columns: 24px 1fr; } .timeline-time { grid-column: 2; } }

/* Process och flöde: steg på fordonskortet och tavlan under Flöde */
.proc-list { display: grid; gap: 10px; }
.proc-step { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); }
.proc-step.done { opacity: .75; }
.proc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.proc-chip { color: #fff; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.proc-status { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.proc-status.on { background: var(--accent-soft); color: var(--accent); }
.proc-days { font-size: 12px; color: var(--muted); }
.proc-late { font-size: 12px; font-weight: 700; color: var(--status-danger-fg); }
.proc-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.proc-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.proc-board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.proc-col { flex: 0 0 250px; background: var(--surface-2, var(--surface-3)); border-radius: var(--radius); padding: 8px; min-height: 120px; }
.proc-col-head { display: flex; align-items: center; justify-content: space-between; border-top: 4px solid var(--accent); padding: 8px 4px 8px; font-size: 13px; }
.proc-count { background: var(--surface); border-radius: 999px; min-width: 24px; text-align: center; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.proc-hint { font-size: 11px; color: var(--muted); margin: 0 4px 4px; }
.proc-empty { font-size: 12px; color: var(--muted); padding: 6px 4px; margin: 0; }
.proc-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; margin-top: 8px; }
.proc-card.late { border-color: var(--status-danger-fg); box-shadow: inset 3px 0 0 var(--status-danger-fg); }
.proc-car { font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; display: block; }
.proc-reg { font-size: 12px; font-family: var(--mono, ui-monospace, monospace); letter-spacing: .04em; color: var(--muted); }
.proc-note { font-size: 12px; margin-top: 4px; padding: 4px 6px; background: var(--accent-soft); border-radius: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.proc-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.flow-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; }
.flow-tabs .wizard-step { flex: 0 0 auto; align-items: center; }
.flow-tab { display: inline-flex; gap: 6px; font: inherit; text-align: left; cursor: pointer; background: var(--surface); }
.flow-name { font-weight: 600; white-space: nowrap; }
.flow-sub { display: block; flex-basis: 100%; font-size: 11px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.flow-tab { flex-wrap: wrap; }
.flow-tab.selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.flow-tab.done .flow-sub { color: var(--status-success-fg); }
.flow-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-3); padding: 10px 12px; margin-top: 6px; }
.proc-sum { display: grid; gap: 6px; }
.proc-sum-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-decoration: none; color: var(--ink); padding: 6px 8px; border-radius: 8px; border-left: 4px solid var(--accent); background: var(--surface-3); font-size: 13px; }
.proc-sum-row:hover { background: var(--accent-soft); }

/* Inbyte: övervärdet i betalsättet och kostnadsrader i inbytesdialogen */
.pay-surplus { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; }
.tradein-cost { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft, var(--line)); }
.tradein-cost .pay-amount input { width: 110px; }

/* Registerkontroll: grupperad lista med rubriker. */
.finding-group-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
.finding-oks { margin-top: 12px; }
.finding-oks > summary { cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--status-success-fg); padding: 6px 2px; }
.finding-oks[open] > summary { margin-bottom: 6px; }

/* Bilder på uppgifter. */
.task-photos { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 8px; }
.task-photo { position: relative; width: 96px; height: 96px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.task-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.task-photo-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; line-height: 22px; cursor: pointer; }
.task-photo-count { margin-left: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- Listor som kort på mobil ----------
   table-cards.js markerar listor med tre kolumner eller fler (data-cards), sätter etiketten på varje cell (data-label), kortets rubrik (data-card-title)
   och döljer rena ikonceller (data-skip). Etiketten står i en smal kolumn till vänster och värdena börjar på samma ställe för alla rader. */
@media (max-width: 860px) {
  table.data-table[data-cards] { display: block; overflow: visible; white-space: normal; border: 0; background: transparent; border-radius: 0; }
  table.data-table[data-cards] thead { display: none; }
  table.data-table[data-cards] tbody, table.data-table[data-cards] tfoot { display: block; }
  table.data-table[data-cards] tr { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 8px; margin-bottom: 10px; }
  table.data-table[data-cards] tbody tr:hover { background: var(--surface); }
  table.data-table[data-cards] td {
    display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; text-align: left;
    padding: 3px 0; border: 0; min-height: 24px; white-space: normal; overflow-wrap: anywhere; font-size: 13px;
  }
  table.data-table[data-cards] td::before {
    content: attr(data-label); flex: 0 0 35%; max-width: 35%; overflow-wrap: normal;
    font-size: 11px; line-height: 1.25; text-transform: none; letter-spacing: 0; color: var(--muted);
  }
  table.data-table[data-cards] td[data-label=""]::before { content: none; }
  table.data-table[data-cards] td[data-skip], table.data-table[data-cards] td:empty { display: none; }
  table.data-table[data-cards] td[data-card-title] { font-size: 15px; font-weight: 600; padding: 0 0 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
  table.data-table[data-cards] td[data-card-title]::before { content: none; }
  table.data-table[data-cards] td.row-actions { justify-content: flex-end; gap: 6px; padding-top: 8px; }
  table.data-table[data-cards] td.row-actions::before { content: none; }
  table.data-table[data-cards] .btn { min-height: 36px; }
  /* Tabellrubrikerna är dolda, så sorteringspilarna finns inte kvar att klicka på. */
  table.data-table[data-cards] .sort-arrow { display: none; }
}
