/* ════════════════════════════════════════════════════════════════
   SiteFlow v4 — portfolio dashboard + look switch link
   Pairs with sf-v4.js. Everything except the look switch link is
   scoped under html.v4, so the classic look is untouched.
   Note: no fixed-width figures here — they space the commas in this font.
   ════════════════════════════════════════════════════════════════ */

/* ── Look switch link (shows in both looks) ───────────────────── */
.sf-side .me.sf-has-look { flex-wrap: wrap; }
.sf-side .me .sf-lookln { flex: 1 0 100%; display: block; margin: 2px 0 0 44px; font-size: 12px; font-weight: 600; color: inherit; opacity: .7; text-decoration: none; }
.sf-side .me .sf-lookln:hover { opacity: 1; text-decoration: underline; }
.sf-lookrow { padding: 8px 16px 4px; text-align: center; }
.sf-lookrow .sf-lookln { display: inline-block; padding: 10px 12px; font-size: 14px; font-weight: 600; color: var(--n5, #44577A); text-decoration: underline; text-underline-offset: 3px; }

/* ── Tokens ───────────────────────────────────────────────────── */
html.v4 .v4-port {
  --v4-or: #F26B21; --v4-ink: #0A1F44; --v4-ink2: #5B6B87; --v4-ink3: #8A94A6;
  --v4-line: #E6E8EC; --v4-card: #FFFFFF; --v4-soft: #F6F7F9; --v4-red: #C62828;
  color: var(--v4-ink);
}

/* ── Section head ─────────────────────────────────────────────── */
html.v4 .v4-port.desk { margin: 0 0 28px; }
html.v4 .v4-ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 14px; }
html.v4 .v4-ph h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; color: var(--v4-ink); }
html.v4 .v4-ph span { display: block; margin-top: 2px; font-size: 13px; color: var(--v4-ink2); }

/* ── KPI figures ──────────────────────────────────────────────── */
html.v4 .v4-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
html.v4 .v4-kpi {
  all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 18px 20px 16px; background: var(--v4-card); border: 1px solid var(--v4-line); border-radius: 12px;
  font-family: 'Schibsted Grotesk', -apple-system, sans-serif; transition: border-color .15s, box-shadow .15s;
}
html.v4 .v4-kpi:hover { border-color: #CDD2DA; box-shadow: 0 2px 10px rgba(10,31,68,.05); }
html.v4 .v4-kpi:focus-visible { outline: 2px solid var(--v4-or); outline-offset: 2px; }
html.v4 .v4-kpi .k { font-size: 13px; font-weight: 600; color: var(--v4-ink2); }
html.v4 .v4-kpi .v { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; color: var(--v4-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.v4 .v4-kpi .s { font-size: 12.5px; line-height: 1.35; color: var(--v4-ink3); }
html.v4 .v4-kpi.none .v { color: #C3C9D3; }
html.v4 .v4-kpi.hot .v { color: var(--v4-ink); }
html.v4 .v4-kpi.hot .s { color: var(--v4-red); font-weight: 600; }
html.v4 .v4-kpi:first-child { box-shadow: inset 0 3px 0 var(--v4-or); }
html.v4 .v4-kpi:first-child:hover { box-shadow: inset 0 3px 0 var(--v4-or), 0 2px 10px rgba(10,31,68,.05); }

/* ── Chart grid + cards ───────────────────────────────────────── */
html.v4 .v4-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
html.v4 .v4-grid.one { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
html.v4 .v4-cc { display: flex; flex-direction: column; min-width: 0; height: 300px; background: var(--v4-card); border: 1px solid var(--v4-line); border-radius: 12px; overflow: hidden; }
html.v4 .v4-cch { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
html.v4 .v4-cch b { display: block; font-size: 15px; font-weight: 700; color: var(--v4-ink); line-height: 1.25; }
html.v4 .v4-cch .m { display: block; margin-top: 2px; font-size: 12.5px; color: var(--v4-ink3); }
html.v4 .v4-lg { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 12px; padding-top: 2px; font-size: 12px; font-weight: 500; color: var(--v4-ink2); }
html.v4 .v4-lg span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
html.v4 .v4-lg i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
html.v4 .v4-ccb { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px 16px 14px; }
html.v4 .v4-cv { position: relative; flex: 1; min-height: 0; }
html.v4 .v4-cv canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
html.v4 .v4-wait { margin: auto; font-size: 13px; color: var(--v4-ink3); }
html.v4 .v4-note { flex: none; margin-top: 8px; padding: 7px 10px; border-radius: 8px; background: var(--v4-soft); font-size: 12.5px; line-height: 1.35; color: var(--v4-ink2); }

/* Empty / low-data state */
html.v4 .v4-empty { margin: auto; max-width: 340px; padding: 8px 12px; text-align: center; }
html.v4 .v4-empty b { display: block; font-size: 14px; font-weight: 700; color: var(--v4-ink); }
html.v4 .v4-empty p { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: var(--v4-ink2); }

/* Doughnut + legend */
html.v4 .v4-dwrap { flex: 1; min-height: 0; display: flex; align-items: center; gap: 20px; padding: 0 4px; }
html.v4 .v4-dcv { position: relative; flex: none; width: 190px; height: 190px; max-height: 100%; }
html.v4 .v4-dcv canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
html.v4 .v4-dc { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
html.v4 .v4-dc small { font-size: 12px; font-weight: 600; color: var(--v4-ink3); }
html.v4 .v4-dc b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--v4-ink); line-height: 1.15; }
html.v4 .v4-dwrap.nochart .v4-dc { position: static; flex: none; width: 150px; }
html.v4 .v4-dl { flex: 1; min-width: 0; display: flex; flex-direction: column; }
html.v4 .v4-dl .r { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--v4-line); font-size: 13.5px; }
html.v4 .v4-dl .r:last-of-type { border-bottom: 0; }
html.v4 .v4-dl .r i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
html.v4 .v4-dl .l { flex: 1; min-width: 0; color: var(--v4-ink2); font-weight: 500; }
html.v4 .v4-dl .l small { margin-left: 4px; font-size: 12px; color: var(--v4-ink3); }
html.v4 .v4-dl b { font-weight: 700; color: var(--v4-ink); white-space: nowrap; }
html.v4 .v4-dn { margin-top: 6px; font-size: 12px; color: var(--v4-ink3); }

/* Figures table (shown when Chart.js isn't available) */
html.v4 .v4-ft { width: 100%; border-collapse: collapse; font-size: 13px; }
html.v4 .v4-ft th { padding: 6px 8px; text-align: left; font-weight: 600; font-size: 12px; color: var(--v4-ink3); border-bottom: 1px solid var(--v4-line); }
html.v4 .v4-ft td { padding: 7px 8px; border-bottom: 1px solid var(--v4-line); color: var(--v4-ink); }
html.v4 .v4-ft tr:last-child td { border-bottom: 0; }
html.v4 .v4-ft .rt { text-align: right; white-space: nowrap; }
html.v4 .v4-ccb .v4-ft { overflow: auto; }

/* Mid-width desktop: KPIs 2 × 2 */
@media (min-width: 900px) and (max-width: 1180px) {
  html.v4 .v4-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) and (max-width: 1060px) {
  html.v4 .v4-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ── Phone ────────────────────────────────────────────────────── */
html.v4 .v4-port.phone { margin: 4px 0 8px; }
html.v4 .v4-kstrip {
  display: flex; gap: 10px; overflow-x: auto; padding: 4px 16px 10px; margin: 0;
  scroll-snap-type: x mandatory; scroll-padding: 0 16px; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
html.v4 .v4-kstrip::-webkit-scrollbar { display: none; }
html.v4 .v4-kstrip .v4-kpi { flex: 0 0 auto; width: 72%; max-width: 260px; padding: 14px 16px 13px; scroll-snap-align: start; }
html.v4 .v4-kstrip .v4-kpi .v { font-size: 24px; }
html.v4 .v4-pgrid { padding: 0 16px; }
html.v4 .v4-port.phone .v4-cc { height: 250px; }
html.v4 .v4-port.phone .v4-cch { padding: 14px 16px 0; }
html.v4 .v4-port.phone .v4-ccb { padding: 10px 12px 12px; }

/* Calm pass: no orange top edge on the first figure */
html.v4 .v4-kpi:first-child, html.v4 .v4-kpi:first-child:hover { box-shadow: none !important; }
