/* Shared visual layer. Business logic and the original component hooks stay intact. */
:root {
  --bg: #f5f7fb; --panel: #fff; --panel-2: #f8fafc; --panel-3: #eef2f8;
  --border: #dfe5ee; --border-soft: #edf0f5; --text: #17253c;
  --text-dim: #526179; --text-faint: #62718a;
  --accent: #2F6FDB; --accent-dim: #2459B5; --success: #147d66;
  --danger: #ba3342; --warning: #986110; --data: #4A8AF0;
  --data-svak: rgba(65,107,225,.08); --graf-rute: #e7edf5;
  --radius: 10px; --radius-lg: 16px; --sidebar-w: 236px;
  --font-ui: 'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
html { color-scheme: light; }
body { font-size: 14px; line-height: 1.6; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
a { color: var(--accent-dim); }
a:focus-visible, summary:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px;
}
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; padding: 12px 20px; background: white; border: 2px solid var(--accent); border-radius: 10px; }
.skip-link:focus { top: 12px; }
.sidebar { background: #fff; border-color: var(--border); }
.sidebar .brand { padding: 28px 22px; gap: 12px; }
.sidebar .brand .mark { width: 38px; height: 38px; border-radius: 12px; font-size: 21px; background: #2F6FDB; }
.sidebar .brand .name { font-size: 19px; letter-spacing: -.6px; }
.brand-product { font-weight: 400; margin-left: 5px; color: var(--text-dim); }
.sidebar .brand .sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.sidebar nav { padding: 18px 14px; gap: 5px; }
.nav-section { font-size: 10px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-faint); padding: 12px 12px 8px; }
.nav-section:not(:first-child) { margin-top: 14px; }
.nav-link { padding: 11px 12px; font-size: 13px; border-radius: 9px; }
.nav-link.active { background: #E8F1FF; color: #2459B5; font-weight: 600; }
.nav-link.active .icon { color: #2F6FDB; }
.nav-link:hover { background: #f1f4fa; color: var(--text); }
.sidebar-footer { padding: 18px 14px; }
.mode-badge { font-size: 11px; line-height: 1.5; }
.mode-badge.dry { color: #85560d; background: #fff8e9; border-color: #f0dfb8; }
.mode-badge.live { color: #a32838; background: #fff0f1; border-color: #f1c6cb; }
.mode-badge.off { background: #f5f7fb; }
.topbar { min-height: 74px; padding: 16px 32px; background: rgba(255,255,255,.96); border-color: var(--border); }
.topbar h1 { font-size: 17px; letter-spacing: -.4px; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 28px 32px 48px; max-width: 1500px; }
.page-intro { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 26px; }
.eyebrow { display: block; font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; font-weight: 600; color: var(--text-faint); margin-bottom: 6px; }
.page-intro h2 { font-size: clamp(23px, 2.4vw, 30px); letter-spacing: -.9px; margin: 0 0 4px; font-weight: 600; line-height: 1.3; }
.page-intro p { color: var(--text-dim); margin: 0; font-size: 13px; }
.button-link { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--border); border-radius: 9px; background: white; color: var(--text); font-size: 13px; font-weight: 500; min-height: 42px; text-decoration: none; }
.button-link:hover { background: #f8fafc; text-decoration: none; }
.button-link.primary { color: white; border-color: var(--accent); background: var(--accent); }
.button-link.primary:hover { background: var(--accent-dim); }
.tabs { flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 10px 15px; font-size: 13px; }
.tabs a.active { color: var(--accent-dim); font-weight: 600; }
.tabs a .faint { margin-left: 5px; }
.stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { padding: 20px; gap: 10px; position: relative; min-width: 0; box-shadow: 0 2px 3px rgba(23,37,60,.02); }
.stat-card:hover, .kort:hover { border-color: #b7c6e0; }
a.stat-card { color: var(--text); text-decoration: none; }
a.stat-card:hover { background: #fcfdff; }
.stat-card .n, .stat-card.hero .n { font-family: var(--font-ui); font-size: 34px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -1.2px; line-height: 1.15; }
.stat-card .l { font-size: 13px; color: var(--text); font-weight: 500; }
.stat-card .stat-icon { width: 34px; height: 34px; border-radius: 10px; }
.stat-card.tone-accent .stat-icon { color: #2F6FDB; background: #E8F1FF; }
.stat-card.tone-success .stat-icon { color: #147d66; background: #e7f5ef; }
.stat-card.tone-warning .stat-icon { color: #986110; background: #fff5e5; }
.stat-card.tone-danger .stat-icon { color: #ba3342; background: #fff0f1; }
.stat-caption { font-size: 11px; color: var(--text-faint); }
.stat-action { font-size: 11px; color: var(--accent-dim); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.8fr) minmax(0,1fr); gap: 20px; margin-top: 22px; }
.dashboard-grid > *, .graf-rutenett > * { min-width: 0; }
.card, .kort { padding: 22px; box-shadow: 0 2px 3px rgba(23,37,60,.02); }
.card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.card-heading h3 { margin: 0 0 3px; font-size: 16px; font-weight: 600; letter-spacing: -.4px; }
.card-heading p { font-size: 12px; color: var(--text-faint); margin: 0; }
.card-heading > a { font-size: 12px; white-space: nowrap; }
.kort-tittel { font-size: 16px; letter-spacing: -.3px; }
.graf { gap: 18px; }
.graf-spor { background: #edf1f8; border-radius: 5px; }
.graf-soyle { border-radius: 5px; }
.graf-navn { font-size: 13px; }
.graf-verdi { font: 600 15px var(--font-ui); font-variant-numeric: tabular-nums; }
.graf-svg { min-height: 185px; }
.chart-key { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--text-faint); }
.chart-key::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--data); }
.chart-data { margin-top: 14px; font-size: 12px; color: var(--text-dim); }
.chart-data summary { cursor: pointer; }
.mobile-day { min-width: 0; }
.mobile-bar-track { height: 128px; display: flex; align-items: flex-end; background: #f4f7fd; border-radius: 4px; }
.mobile-bar { width: 100%; background: var(--data); border-radius: 4px 4px 0 0; }
.mobile-date { display: block; font-size: 10px; text-align: center; height: 20px; color: var(--text-faint); }
.chart-data table { font-size: 12px; margin-top: 8px; }
.chart-data th, .chart-data td { white-space: normal; }
.activity-summary { display: flex; align-items: baseline; gap: 10px; margin: -8px 0 12px; }
.activity-summary strong { font-size: 27px; font-weight: 600; letter-spacing: -.7px; }
.activity-summary span { color: var(--text-faint); font-size: 12px; }
.donut-layout { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.donut { width: 158px; height: 158px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.donut-center { width: 128px; height: 128px; border-radius: 50%; background: white; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-center strong { font-size: 30px; letter-spacing: -1px; font-weight: 600; line-height: 1.2; }
.donut-center span { font-size: 11px; color: var(--text-faint); }
.chart-legend { width: 100%; margin: 0; }
.legend-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; font-size: 12px; }
.legend-row dt { flex: 1; }
.legend-row dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.swatch { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; }
.swatch.blue { background: #4A8AF0; } .swatch.green { background: #147d66; } .swatch.gray { background: #9caac0; }
.card-note { color: var(--text-faint); font-size: 11px; line-height: 1.6; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.response-steps { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.response-step { border: 1px solid var(--border); background: #f8faff; padding: 18px; border-radius: 12px; }
.response-step span { display: block; color: var(--text-dim); font-size: 12px; }
.response-step strong { display: block; font-size: 30px; letter-spacing: -1px; font-weight: 600; }
.response-rate { display: flex; align-items: baseline; gap: 10px; margin-top: 18px; padding: 12px 0 0; border-top: 1px solid var(--border); }
.response-rate strong { color: #147d66; font-size: 23px; font-weight: 600; }
.response-rate span { font-size: 12px; color: var(--text-dim); }
.action-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin-top: 22px; }
.action-item { display: flex; gap: 12px; padding: 18px; background: white; border: 1px solid var(--border); border-radius: 12px; color: var(--text); }
.action-item:hover { border-color: #b7c6e0; text-decoration: none; }
.action-item .icon { color: var(--accent); margin-top: 2px; }
.action-item strong { display: block; font-size: 13px; font-weight: 500; }
.action-item span { display: block; font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.health-panel { margin-top: 22px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; }
.health-panel summary { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; cursor: pointer; font-size: 12px; }
.health-panel summary::after { content: 'Vis detaljer +'; color: var(--text-faint); font-size: 11px; }
.health-panel[open] summary::after { content: 'Skjul detaljer −'; }
.health-panel .kv { margin-top: 20px; }
.health-error { border-color: #e9b1b8; background: #fff8f8; }
.health-error summary { color: var(--danger); }
.status-dot.good, .status-dot.ok { background: var(--success); box-shadow: none; }
.status-dot.bad, .status-dot.warn { box-shadow: none; }
.section-title { font-size: 12px; letter-spacing: .7px; color: var(--text-dim); }
.table-wrap { background: white; max-width: 100%; }
th { font-size: 10px; letter-spacing: .8px; color: var(--text-faint); background: #f9fafc; padding: 13px 16px; }
td { padding: 14px 16px; font-size: 13px; }
tbody tr { cursor: default; }
tbody tr:hover { background: #f9fbff; }
.company-cell { white-space: normal; min-width: 170px; max-width: 300px; }
.company-cell a { color: var(--text); font-weight: 500; }
.cell-meta { display: block; font-size: 11px; color: var(--text-faint); margin-top: 3px; overflow-wrap: anywhere; }
.pill { font-size: 10px; padding: 4px 9px; border-radius: 6px; line-height: 1.5; }
.pill.good { background: #e6f5ee; color: #11634e; }
.pill.warn { background: #fff3dd; color: #82520d; }
.pill.bad { background: #fdecef; color: #a32838; }
.pill.accent { background: #E8F1FF; color: #2459B5; }
.pill.muted { background: #eff2f7; color: #526179; }
.filter-panel { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 18px; }
.filter-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-fields label { display: flex; flex-direction: column; gap: 5px; color: var(--text-dim); font-size: 11px; flex: 1 1 150px; min-width: 0; }
.filter-fields label:first-of-type { flex: 1.5 1 210px; }
.filter-fields input, .filter-fields select { width: 100%; min-width: 0; }
.filter-actions { display: flex; gap: 10px; align-items: center; }
.filter-actions a { font-size: 12px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; font-size: 11px; align-items: center; }
.list-note { font-size: 12px; color: var(--text-dim); margin: 14px 0; }
.table-wrap:focus-visible { outline-offset: 2px; }
.email-cell { white-space: normal; overflow-wrap: anywhere; min-width: 170px; max-width: 230px; }
.interest-cell { white-space: normal; min-width: 170px; max-width: 270px; }
.interest-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.interest-tags .pill { white-space: normal; }
.score { display: inline-block; min-width: 34px; padding: 5px 7px; border-radius: 8px; background: #E8F1FF; color: #2F6FDB; font-size: 13px; font-weight: 600; text-align: center; }
.table-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.table-header h3 { margin: 0; font-size: 14px; font-weight: 500; }
.table-header p { margin: 0; font-size: 11px; color: var(--text-faint); }
.tildel-rad { flex-wrap: wrap; padding: 16px; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.tildel-rad label { font-size: 12px; color: var(--text-dim); }
.selection-count { margin-left: auto; font-size: 12px; color: var(--text-faint); }
input, select, textarea { background: #fff; border-color: #d9e1ec; }
input[type=checkbox] { min-height: auto; width: 16px; height: 16px; accent-color: var(--accent); }
button { min-height: 40px; }
button.primary { background: var(--accent); }
button:hover { filter: none; border-color: #9badce; }
button.primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); }
button.danger { color: #a32838; }
.kv dd { overflow-wrap: anywhere; min-width: 0; font-family: var(--font-ui); font-size: 13px; }
.error { color: #a32838; }
.review-summary { grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 22px; }
.review-section { margin-bottom: 16px; background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.review-section summary { display: flex; align-items: center; gap: 12px; padding: 18px 20px; cursor: pointer; font-size: 14px; font-weight: 500; }
.review-section summary .pill { margin-left: auto; }
.review-section summary::after { content: '+'; font-size: 18px; color: var(--text-faint); }
.review-section[open] summary::after { content: '−'; }
.review-section .review-description { font-size: 12px; color: var(--text-faint); padding: 0 20px 12px; margin: 0; }
.review-section .table-wrap { border-radius: 0; border: 0; border-top: 1px solid var(--border-soft); }
.review-section td { white-space: normal; overflow-wrap: anywhere; }
.review-section td:last-child { text-align: right; }
.crm-tall { gap: 16px; }
.crm-tall .kort { background: white; padding: 20px; }
.crm-tall .verdi { font-size: 32px; font-weight: 600; letter-spacing: -1px; }
.crm-tall .merkelapp { font-size: 12px; }
.crm-kort { background: white; padding: 22px; }
.crm-topp h3 { font-size: 17px; }
.crm-meta, .crm-hvorfor, .crm-logg { overflow-wrap: anywhere; }
.crm-skjema { border-top: 1px solid var(--border-soft); padding-top: 16px; }
.crm-skjema label { min-width: 0; }
.crm-skjema input, .crm-skjema select { width: 100%; min-width: 0; }
.login-wrap { background: #f5f7fb; }
.login-card { max-width: calc(100% - 32px); background: white; border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 14px 50px rgba(23,37,60,.06); }
.login-card .mark { background: #2F6FDB; }
.sidebar-backdrop { display: none; }
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .review-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .content { padding: 24px; }
  .dashboard-grid { grid-template-columns: minmax(0,1.5fr) minmax(0,1fr); gap: 16px; }
  .action-list { gap: 10px; }
}
@media (max-width: 1000px) {
  .dashboard-grid { grid-template-columns: minmax(0,1fr); }
  .donut-layout { flex-direction: row; }
  .action-list { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 900px) {
  .sidebar-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 30; border: 0; border-radius: 0; background: rgba(23,37,60,.3); }
  .sidebar { width: 260px; }
  .content { padding: 22px 18px 40px; }
  .topbar { padding: 12px 18px; }
  .sidebar-toggle { background: white; }
  .crm-liste { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 560px) {
  .graf-mobile.kun-smal { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); gap: 5px; margin: 12px 0 8px; }
  .content { padding: 20px 14px 36px; }
  .page-intro { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 20px; }
  .stat-grid, .review-summary { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .stat-card { padding: 18px; }
  .topbar h1 { font-size: 15px; overflow-wrap: anywhere; }
  .topbar-actions { max-width: 44%; }
  .topbar-actions .faint { font-size: 10px; text-align: right; }
  .card, .kort { padding: 18px; }
  .donut-layout { flex-direction: column; }
  .card-heading { gap: 10px; }
  .card-heading h3 { font-size: 15px; }
  .card-heading > a { font-size: 11px; }
  .filter-fields label, .filter-fields label:first-of-type { flex-basis: 100%; }
  .filter-actions { width: 100%; }
  .filter-actions button { flex: 1; }
  .kv { grid-template-columns: minmax(0,1fr); gap: 4px; }
  .kv dd { margin-bottom: 10px; }
  .graf-rutenett { grid-template-columns: minmax(0,1fr); }
  .selection-count { margin-left: 0; width: 100%; }
  .review-section summary { padding: 16px; font-size: 13px; }
  .crm-tall { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .crm-kort { padding: 18px; }
}
