/* ─── Inter Variable font fra Google Fonts CDN ─── */
@import url('https://rsms.me/inter/inter.css');

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

:root {
  /* Primær merkevare (samme teal/gull som før) */
  --primary: #1A6B5A;
  --primary-hover: #145649;
  --accent: #D4A843;

  /* Premium-tekst-hierarki — Linear/Vercel-stil */
  --text: #0A0A0A;        /* primær tekst (mørk, ikke ren svart) */
  --text-secondary: #525252;  /* sekundær tekst */
  --text-muted: #A3A3A3;      /* svak tekst, plassholdere */

  /* Premium-bakgrunner — aldri rein hvit, aldri varm bg */
  --bg: #FAFAFA;          /* hovedbakgrunn */
  --bg-card: #ffffff;     /* kort/modaler hever seg over bg */
  --bg-subtle: #F5F5F5;   /* hover, alternerende rader */

  /* Borders — alltid 1px, lys grå */
  --border: #EAEAEA;
  --border-strong: #D4D4D4;

  /* Sidebar (bevart) */
  --sidebar-bg: #1B2B2A;
  --sidebar-text: #94A3B8;
  --sidebar-active: #D4A843;

  /* Status-farger med bedre balanse */
  --success: #16A34A;
  --warning: #D97706;
  --danger: #DC2626;

  /* Premium-shadows — fargete, ikke svarte */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(16, 24, 40, 0.06), 0 2px 4px -2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(16, 24, 40, 0.08), 0 4px 6px -4px rgba(16, 24, 40, 0.04);

  /* Bevegelser */
  --transition-base: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';  /* Inter's bedre tall + a */
  letter-spacing: -0.011em;  /* litt strammere — ser mer premium ut */
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@supports (font-variation-settings: normal) {
  body { font-family: 'Inter var', 'Inter', -apple-system, sans-serif; }
}

/* Premium typografi for headings — strammere letter-spacing */
h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.02em;
  font-weight: 600;
}

/* Tabulære tall i ALLE tabeller — score, priser, lager — perfekt linjet */
table, .price, .inventory, code, .tabular {
  font-variant-numeric: tabular-nums;
}

.app {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 248px;
  background:
    radial-gradient(circle at 50% 0%, rgba(26,107,90,0.18) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(212,168,67,0.08) 0%, transparent 60%),
    linear-gradient(180deg, #1A2A29 0%, #0F1B1A 100%);
  padding: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.06);
  box-shadow:
    1px 0 0 rgba(0,0,0,0.2),
    8px 0 24px -8px rgba(0,0,0,0.25);
  position: relative;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.sidebar nav {
  flex: 1;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.15);
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 10px 12px;
  transition: all var(--transition-base);
}

.sidebar-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
}

.sidebar-footer .sidebar-card div[style*="color"] {
  color: rgba(255,255,255,0.45) !important;
  font-weight: 600;
}

.sidebar-select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 12.5px;
  font-family: inherit;
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-weight: 500;
  box-sizing: border-box;
  cursor: pointer;
}

.sidebar-select option {
  background: #1A2A29;
  color: #fff;
}

.sidebar-logout {
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.sidebar-logout:hover {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.3);
  color: #fca5a5;
}

#user-name {
  color: #fff !important;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
}

#user-role {
  color: rgba(255,255,255,0.45) !important;
  font-size: 10.5px !important;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

#user-name {
  color: #fff !important;
}

#user-role {
  color: var(--sidebar-text) !important;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px 20px;
  position: relative;
  z-index: 1;
}

.logo-img {
  height: 88px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.logo-text {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.6);
}

.sidebar nav {
  flex: 1;
  padding: 12px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
  z-index: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: 10px;
  transition: all var(--transition-base);
  position: relative;
}

.nav-item:hover {
  color: rgba(255,255,255,0.95);
  background: rgba(255,255,255,0.04);
  transform: translateX(2px);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(26,107,90,0.7) 0%, rgba(26,107,90,0.35) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.1),
    inset 0 0 0 1px rgba(212, 168, 67, 0.3),
    0 4px 16px rgba(26, 107, 90, 0.35),
    0 0 0 1px rgba(212, 168, 67, 0.15);
}

.nav-item.active .nav-icon {
  filter: drop-shadow(0 0 8px rgba(212, 168, 67, 0.6));
}

.nav-icon {
  font-size: 16px;
  display: inline-flex;
  width: 20px;
  justify-content: center;
  transition: all var(--transition-base);
}

/* KPI active state */
.kpi-tile {
  cursor: pointer;
}

.kpi-tile.kpi-active-state {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--text), var(--shadow-md);
  transform: translateY(-2px);
}

/* Content */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.content-header h1 {
  font-size: 28px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.page-subtitle {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

/* ─── KPI-rad: store kort med tall som popper ─── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 24px 32px 8px;
}

.kpi-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.kpi-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border-strong);
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}

.kpi-tile.kpi-total::before { background: linear-gradient(90deg, #1A6B5A, #2E9986); }
.kpi-tile.kpi-active::before { background: linear-gradient(90deg, #16A34A, #22C55E); }
.kpi-tile.kpi-draft::before { background: linear-gradient(90deg, #D97706, #F59E0B); }
.kpi-tile.kpi-issues::before { background: linear-gradient(90deg, #DC2626, #EF4444); }
.kpi-tile.kpi-score::before { background: linear-gradient(90deg, #1A6B5A, #D4A843); }
.kpi-tile.kpi-ok::before { background: linear-gradient(90deg, #16A34A, #22C55E); }
.kpi-tile.kpi-warn::before { background: linear-gradient(90deg, #D97706, #F59E0B); }
.kpi-tile.kpi-err::before { background: linear-gradient(90deg, #DC2626, #EF4444); }

.kpi-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 36px;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-top: 6px;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.kpi-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── Report-controls (dato-velger + compare-mode) ─── */
.report-controls {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 16px 32px 0;
  flex-wrap: wrap;
}

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

.report-control-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* ─── Hero KPI for Salgsrapporter (sexy versjon) ─── */
.hero-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 24px 32px 8px;
}

.hero-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 22px 0;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
  min-height: 180px;
  display: flex;
  flex-direction: column;
}

.hero-kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.hero-kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.hero-kpi-value {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--text);
  margin: 8px 0 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.hero-kpi-trend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
}

.trend-arrow {
  font-size: 11px;
}

.trend-pct {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.trend-period {
  color: var(--text-muted);
  font-weight: 500;
}

.hero-kpi-trend.trend-up { color: #16A34A; }
.hero-kpi-trend.trend-down { color: #DC2626; }
.hero-kpi-trend.trend-flat { color: var(--text-muted); }

.hero-kpi-spark {
  width: calc(100% + 44px);
  margin-left: -22px;
  margin-right: -22px;
  margin-bottom: 0;
  margin-top: auto;
  height: 50px;
  display: block;
}

/* Accent border på toppen */
.hero-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}
.hero-kpi-revenue::before { background: linear-gradient(90deg, #1A6B5A, #2E9986); }
.hero-kpi-orders::before { background: linear-gradient(90deg, #D4A843, #F59E0B); }
.hero-kpi-aov::before { background: linear-gradient(90deg, #16A34A, #22C55E); }
.hero-kpi-conv::before { background: linear-gradient(90deg, #7C3AED, #A855F7); }

/* ─── Report-card (chart-container, top-products) ─── */
.report-card {
  margin: 16px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.report-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.report-card-header h3 {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0;
}

.report-card-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.chart-card .chart-container {
  padding: 20px 24px;
  height: 320px;
}

/* Top-products som rik liste, ikke kjedelig tabell */
.top-products-list {
  padding: 8px 0;
}

.top-product-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 24px;
  transition: background var(--transition-base);
  border-bottom: 1px solid var(--border);
}

.top-product-row:last-child {
  border-bottom: none;
}

.top-product-row:hover {
  background: var(--bg-subtle);
}

.top-product-rank {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
  width: 32px;
}

.top-product-rank.rank-1 { color: #D4A843; font-size: 18px; }
.top-product-rank.rank-2 { color: #94A3B8; font-size: 16px; }
.top-product-rank.rank-3 { color: #B45309; font-size: 15px; }

.top-product-name {
  font-size: 14px;
  font-weight: 550;
  color: var(--text);
  letter-spacing: -0.005em;
}

.top-product-vendor {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.top-product-sold {
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 80px;
}

.top-product-revenue {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 120px;
}

/* ─── Helse-progress-card med stacked bar ─── */
.health-progress-card {
  margin: 0 32px 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.health-progress-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 10px;
}

.health-progress-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-subtle);
}

.hp-segment {
  height: 100%;
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.hp-segment.hp-ok { background: linear-gradient(90deg, #16A34A, #22C55E); }
.hp-segment.hp-warn { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.hp-segment.hp-err { background: linear-gradient(90deg, #DC2626, #EF4444); }

.header-actions {
  display: flex;
  gap: 8px;
}

.btn {
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 550;
  font-family: inherit;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: white;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.12);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 32px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg);
}

.status-dot::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--accent);
}

.status-dot.connected::before {
  background: var(--success);
}

.status-dot.error::before {
  background: var(--danger);
}

/* Table — som "card" */
.table-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 32px 32px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

table thead {
  background: var(--bg-subtle);
}

table tbody td:first-child {
  padding-left: 20px;
}

table tbody td:last-child {
  padding-right: 20px;
}

table thead th:first-child {
  padding-left: 20px;
  border-top-left-radius: 12px;
}

table thead th:last-child {
  padding-right: 20px;
  border-top-right-radius: 12px;
}

thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}

tbody td {
  padding: 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

tbody tr {
  transition: background var(--transition-base);
}

tbody tr:hover {
  background: var(--bg-card);
  box-shadow: 0 0 0 1px var(--border) inset;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg-subtle);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(0,0,0,0.04);
}

.product-info .product-title {
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 14px;
  letter-spacing: -0.01em;
}

.product-info .product-desc {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sku {
  color: var(--text-muted);
  font-family: monospace;
  font-size: 13px;
}

.sku-input {
  font-family: monospace;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 8px;
  width: 140px;
  transition: all 0.15s;
}

.sku-input:placeholder-shown {
  border-color: #D1D5DB;
  border-style: dashed;
}

.sku-input:hover {
  border-color: #D1D5DB;
  background: var(--bg);
}

.sku-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
}

.sku-input.sku-saving {
  opacity: 0.5;
}

.sku-input.sku-saved {
  border-color: var(--success);
  background: #f0f9f0;
}

/* Tags */
.tag-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  position: relative;
  max-width: 220px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--primary);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.tag-remove {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  cursor: pointer;
  padding: 0 1px;
  line-height: 1;
}

.tag-remove:hover {
  color: #ffffff;
}

.tag-add-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px dashed #D1D5DB;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.tag-add-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(26, 107, 90, 0.06);
}

.tag-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  width: 200px;
  margin-top: 4px;
}

.tag-search {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  border-radius: 8px 8px 0 0;
  color: var(--text);
}

.tag-search:focus {
  outline: none;
}

.tag-search::placeholder {
  color: #9CA3AF;
}

.tag-options {
  max-height: 160px;
  overflow-y: auto;
}

.tag-option {
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}

.tag-option:hover {
  background: var(--bg);
  color: var(--primary);
}

.tag-option-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: #9CA3AF;
  text-align: center;
}

.price {
  font-weight: 500;
}

.inventory {
  font-weight: 600;
}

.inventory.low {
  color: var(--warning);
}

.inventory.out {
  color: var(--danger);
}

.inventory.good {
  color: var(--success);
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.active {
  background: #ECFDF5;
  color: #065F46;
}

.status-badge.draft {
  background: #FEF3C7;
  color: #92400E;
}

.status-badge.archived {
  background: #F3F4F6;
  color: #6B7280;
}

.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 40px !important;
}

/* Modal */
#enrich-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

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

.modal-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.modal-col h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  padding: 16px;
  border-radius: 8px;
  min-height: 200px;
}

.modal-text ul {
  padding-left: 20px;
  margin: 8px 0;
}

.modal-text li {
  margin: 4px 0;
}

.modal-text p {
  margin: 8px 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #327534;
}

.loading-spinner {
  color: var(--primary);
  text-align: center;
  padding: 40px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Button group */
.btn-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.btn-meta {
  background: #E5E7EB;
  color: var(--text);
  border: 1px solid #D1D5DB;
}

.btn-meta:hover {
  background: #D1D5DB;
  color: var(--dark);
}

/* Meta modal */
.modal-meta .modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.meta-current h3,
.meta-new h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-text {
  min-height: auto;
}

.meta-textarea {
  width: 100%;
  min-height: 80px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
}

.meta-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.char-counter {
  text-align: right;
  font-size: 12px;
  margin-top: 6px;
}

.char-ok { color: var(--success); }
.char-warn { color: var(--warning); }
.char-over { color: var(--danger); }

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  background: var(--bg);
}

.search-input {
  flex: 1;
  max-width: 320px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: inherit;
  letter-spacing: -0.005em;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.search-input:hover {
  border-color: var(--border-strong);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 107, 90, 0.12);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* GLOBAL REGEL: hele teksten i input/select skal ALLTID være synlig.
   Bjarnes preference 2026-04-11 — ALDRI truncation på form-felter. */
select.search-input,
.search-input,
select.modal-field,
.modal-field select,
.modal-field input[type="text"],
.modal-field input[type="number"] {
  text-overflow: clip;
  white-space: normal;
  overflow: visible;
}
select.search-input option {
  white-space: normal;
}

.filter-buttons {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-filter {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-filter:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.btn-filter.active {
  background: var(--text);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* View switching */
.view { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

/* Priser-view */
.pending-badge {
  background: #FEF3C7;
  color: #92400E;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

.pending-dot {
  background: #FEF3C7;
  color: #92400E;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

/* Pris-modal */
.modal-prices .modal-content {
  max-width: 700px;
}

.variant-table {
  width: 100%;
  border-collapse: collapse;
}

.variant-table thead th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.variant-table tbody td {
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: middle;
}

.variant-title {
  font-weight: 500;
  margin-bottom: 2px;
}

.variant-sku {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
}

.price-original {
  color: var(--text-muted);
}

.compare-price {
  display: block;
  font-size: 12px;
  color: #9CA3AF;
  text-decoration: line-through;
}

.price-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.price-input {
  width: 100px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  font-family: inherit;
  text-align: right;
}

.price-input:focus {
  outline: none;
  border-color: var(--primary);
}

.price-suffix {
  color: var(--text-muted);
  font-size: 13px;
}

.row-changed {
  background: #ECFDF5 !important;
}

.row-changed .price-input {
  border-color: var(--success);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 20px 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}

/* Sales Chart */
.chart-container {
  background: var(--bg-card);
  margin: 0 28px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.chart-container canvas {
  width: 100%;
}

/* Section title */
.section-title {
  font-size: 16px;
  font-weight: 600;
  padding: 0 0 12px;
  color: var(--text);
}

/* Metafields modal */
.modal-metafields {
  max-width: 950px;
}

.mf-section {
  margin-bottom: 24px;
}

.mf-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mf-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}

.mf-table thead th {
  text-align: left;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.mf-table tbody td {
  padding: 8px 10px;
  font-size: 13px;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: top;
}

.mf-namespace {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.mf-key {
  font-family: monospace;
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

.mf-type {
  font-size: 11px;
  color: var(--primary);
  background: rgba(26, 107, 90, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

.mf-value-wrap {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.mf-input {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: monospace;
}

.mf-input:focus {
  outline: none;
  border-color: var(--primary);
}

.mf-textarea {
  min-height: 60px;
  resize: vertical;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.4;
}

.btn-save-mf {
  background: var(--primary);
  color: white;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-save-mf:hover {
  background: var(--primary-hover);
}

.mf-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px 0;
}

.top-rank {
  width: 28px;
  height: 28px;
  background: #E5E7EB;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ─── Edit-modal ───────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 22, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.modal-dialog {
  background: #F5F5F4;
  border-radius: 16px;
  width: 100%;
  max-width: 1100px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0,0,0,0.05);
  overflow: hidden;
}

.modal-header {
  padding: 22px 28px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--text);
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.modal-close {
  background: none;
  border: 1px solid var(--border);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  transition: all var(--transition-base);
}
.modal-close:hover {
  background: var(--bg-subtle);
  color: var(--text);
  border-color: var(--border-strong);
}

.modal-body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
  background: #F5F5F4;
}

.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-section {
  margin-bottom: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.modal-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-weight: 700;
}

.modal-findings {
  background: #FAF7F0;
  border: 1px solid #F0E5C8;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 20px;
}
.modal-finding {
  font-size: 0.85rem;
  padding: 3px 0;
}

.modal-field {
  margin-bottom: 12px;
}
.modal-field label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}
.modal-field input[type="text"],
.modal-field select,
.modal-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  background: white;
}
.modal-field textarea {
  min-height: 80px;
  resize: vertical;
}
.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-variant {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.modal-variant-header {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.modal-variant-sku {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.78rem;
  font-family: monospace;
}

.modal-mf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
.modal-mf-field label {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}
.modal-mf-field input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.82rem;
  font-family: inherit;
}
.modal-mf-field input:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-error {
  background: #fdecea;
  color: #c0392b;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}
.modal-success {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}
