/* ============================================================
   AutoFöretag — design tokens & global styles
   Modern, friendly Nordic fintech. Blue accent. Light + dark.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800&family=Geist+Mono:wght@400;500;600&display=swap');

:root {
  /* type — "Kontoret": one family (Geist); display differs by weight + tracking, not family */
  --font-ui: 'Geist', system-ui, sans-serif;
  --font-display: 'Geist', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;

  /* accent — deep indigo, low chroma for a calm, professional feel */
  --accent-h: 255;
  --accent-c: 0.13;

  --accent: oklch(0.46 var(--accent-c) var(--accent-h));
  --accent-strong: oklch(0.40 var(--accent-c) var(--accent-h));
  --accent-soft: oklch(0.95 0.03 var(--accent-h));
  --accent-softer: oklch(0.975 0.018 var(--accent-h));
  --accent-on: #fff;

  /* semantic — dampened one notch (L −0.05) so colour reads as data, not decoration */
  --pos: oklch(0.55 0.13 155);
  --pos-soft: oklch(0.95 0.045 155);
  --neg: oklch(0.535 0.17 25);
  --neg-soft: oklch(0.955 0.035 25);
  --warn: oklch(0.69 0.13 70);
  --warn-soft: oklch(0.95 0.06 80);
  --info: oklch(0.55 0.1 230);

  /* radii — crisp, document-like */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 12px;

  --gap: 16px;
}

/* ---------- LIGHT ---------- */
:root, [data-theme="light"] {
  --bg: oklch(0.975 0.005 255);
  --bg-grad: oklch(0.96 0.01 255);
  --surface: #ffffff;
  --surface-2: oklch(0.985 0.004 255);
  --surface-3: oklch(0.965 0.006 255);
  --ink: oklch(0.23 0.02 262);
  --ink-2: oklch(0.45 0.018 262);
  --ink-3: oklch(0.60 0.015 262);
  --line: oklch(0.92 0.006 262);
  --line-2: oklch(0.88 0.008 262);
  --shadow-sm: none;
  --shadow-md: 0 2px 6px oklch(0.4 0.03 262 / 0.07), 0 8px 24px oklch(0.4 0.03 262 / 0.07);
  --shadow-lg: 0 8px 16px oklch(0.4 0.03 262 / 0.08), 0 24px 56px oklch(0.4 0.03 262 / 0.12);
  --accent-soft: oklch(0.95 0.03 var(--accent-h));
  --accent-softer: oklch(0.975 0.018 var(--accent-h));
}

/* ---------- DARK ---------- */
[data-theme="dark"] {
  --bg: oklch(0.18 0.015 262);
  --bg-grad: oklch(0.205 0.02 262);
  --surface: oklch(0.225 0.018 262);
  --surface-2: oklch(0.245 0.018 262);
  --surface-3: oklch(0.27 0.02 262);
  --ink: oklch(0.96 0.01 262);
  --ink-2: oklch(0.78 0.015 262);
  --ink-3: oklch(0.62 0.018 262);
  --line: oklch(0.31 0.02 262);
  --line-2: oklch(0.37 0.022 262);
  --shadow-sm: none;
  --shadow-md: 0 2px 8px oklch(0 0 0 / 0.35), 0 10px 30px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 10px 20px oklch(0 0 0 / 0.4), 0 30px 60px oklch(0 0 0 / 0.45);
  --accent: oklch(0.68 0.14 var(--accent-h));
  --accent-strong: oklch(0.74 0.13 var(--accent-h));
  --accent-soft: oklch(0.32 0.06 var(--accent-h));
  --accent-softer: oklch(0.27 0.035 var(--accent-h));
  --accent-on: oklch(0.16 0.02 262);
  --pos: oklch(0.72 0.14 155);
  --pos-soft: oklch(0.32 0.06 155);
  --neg: oklch(0.7 0.16 25);
  --neg-soft: oklch(0.32 0.07 28);
  --warn: oklch(0.8 0.13 75);
  --warn-soft: oklch(0.33 0.06 75);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#root { height: 100%; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--accent-soft); }

/* numeric tabular figures everywhere amounts show */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; white-space: nowrap; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* scrollbars */
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100%;
  background: var(--bg); /* flat — no gradients ("Kontoret") */
}

/* sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 2px;
  background: oklch(0.245 0.022 260); /* always dark — does not invert in dark mode */
  color: oklch(0.88 0.012 260);
  min-height: 0;
  --side-dim: oklch(0.66 0.02 260);
  --side-hover: oklch(0.30 0.022 260);
  --side-active: oklch(0.33 0.028 260);
  --side-bar: oklch(0.72 0.13 255);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 16px;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--side-bar);
  display: grid; place-items: center;
  color: oklch(0.20 0.02 260); font-weight: 800; font-size: 16px;
  flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; color: oklch(0.95 0.008 260); }
.brand-name b { color: var(--side-bar); }

.nav-section { font-size: 11px; font-weight: 600; color: var(--side-dim); text-transform: uppercase; letter-spacing: 0.06em; padding: 16px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px; border-radius: var(--r-xs);
  color: var(--side-dim); font-size: 14px; font-weight: 500;
  border: none; background: transparent; width: 100%; text-align: left;
  transition: background .12s, color .12s;
  position: relative;
}
.nav-item:hover { background: var(--side-hover); color: oklch(0.92 0.01 260); }
.nav-item.active {
  background: var(--side-active); color: #fff; font-weight: 600;
  box-shadow: inset 3px 0 0 var(--side-bar); /* left bar, no rounded pill */
}
.nav-item .badge-count {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--side-bar); color: oklch(0.20 0.02 260);
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: 99px;
  display: grid; place-items: center;
}
.nav-item .ico { color: var(--side-dim); flex-shrink: 0; }
.nav-item.active .ico, .nav-item:hover .ico { color: currentColor; }

/* sidebar bottom: divider + tenant switcher (dark surface) */
.side-sep { height: 1px; background: oklch(0.33 0.02 260); margin: 6px 4px 8px; flex-shrink: 0; }
.sidebar .tenant-btn.side-tenant {
  width: 100%; max-width: none;
  background: var(--side-hover); border: 1px solid transparent; color: oklch(0.92 0.01 260);
}
.sidebar .tenant-btn.side-tenant:hover { background: var(--side-active); border-color: transparent; }
.sidebar .tenant-btn.side-tenant .tenant-name { color: oklch(0.94 0.008 260); }
.sidebar .tenant-btn.side-tenant .tenant-role { color: var(--side-dim); }

/* main column */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface); /* solid — no blur/transparency */
  position: sticky; top: 0; z-index: 20;
}
.crumb { font-size: 13px; color: var(--ink-3); }
.crumb b { color: var(--ink); font-weight: 600; }
.topbar-title { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }

.icon-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; color: var(--ink-2);
  transition: all .12s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); border-color: var(--line-2); }

.scroll-area { overflow-y: auto; flex: 1; min-height: 0; }
.page { max-width: 1180px; margin: 0 auto; padding: 26px 26px 80px; }
.page-wide { max-width: 1320px; }

/* ============================================================
   TENANT SWITCHER
   ============================================================ */
.tenant-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px 7px 8px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  transition: all .12s; max-width: 260px;
}
.tenant-btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.tenant-logo {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
  font-family: var(--font-display);
}
.tenant-meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.tenant-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tenant-role { font-size: 11px; color: var(--ink-3); }

.menu {
  position: absolute; z-index: 60;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: 6px; min-width: 280px;
  animation: pop .12s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.99); } }
.menu-label { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px 4px; }
.menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 8px 10px; border-radius: var(--r-sm); border: none; background: transparent;
  color: var(--ink); font-size: 14px; text-align: left; transition: background .1s;
}
.menu-item:hover { background: var(--surface-3); }
.menu-item.is-active { background: var(--accent-softer); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* backdrop for menus/modals */
.backdrop { position: fixed; inset: 0; z-index: 50; }

/* ============================================================
   CARDS / PRIMITIVES
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 15.5px; letter-spacing: -0.01em; }
.card-sub { font-size: 12.5px; color: var(--ink-3); }

.grid { display: grid; gap: var(--gap); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; border: 1px solid transparent;
  transition: background .12s, border-color .12s, color .12s; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-on); }
.btn-primary:hover { background: var(--accent-strong); } /* darker plate, no shadow/translate */
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-3); border-color: var(--line-2); }
.btn-soft { background: var(--accent-soft); color: var(--accent-strong); }
[data-theme="dark"] .btn-soft { color: var(--accent); }
.btn-soft:hover { background: var(--accent-softer); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* pills / badges */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--ink-2);
}
.pill .dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.pill-pos { background: var(--pos-soft); color: var(--pos); }
.pill-neg { background: var(--neg-soft); color: var(--neg); }
.pill-warn { background: var(--warn-soft); color: oklch(0.5 0.12 60); }
[data-theme="dark"] .pill-warn { color: var(--warn); }
.pill-accent { background: var(--accent-soft); color: var(--accent-strong); }
[data-theme="dark"] .pill-accent { color: var(--accent); }
.pill-muted { background: var(--surface-3); color: var(--ink-3); }

/* status tag — square dot + uncoloured text ("Kontoret") */
.status-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button {
  border: none; background: transparent; color: var(--ink-2);
  padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; transition: all .12s;
}
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.input, .select {
  height: 42px; padding: 0 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink); font-size: 14px; transition: border .12s, box-shadow .12s;
  width: 100%;
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--ink-3); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 12px;
  border-bottom: 1px solid var(--ink); white-space: nowrap; /* report-style dark rule */
}
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr.clickable:hover { background: var(--surface-2); cursor: pointer; }
.tbl tr.sum td { border-top: 1px solid var(--ink); border-bottom: 2px solid var(--ink); font-weight: 600; }
.tbl .right { text-align: right; }
.t-amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.ver-link { font-family: var(--font-mono); color: var(--accent); font-size: 12.5px; }
.ver-link:hover { text-decoration: underline; }

.kbd { font-family: var(--font-mono); font-size: 11.5px; background: var(--surface-3); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--ink-2); }

/* misc helpers */
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--ink-3); }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.h-display { font-family: var(--font-display); letter-spacing: -0.025em; font-weight: 700; }
.divider { height: 1px; background: var(--line); }

/* progress bar */
.bar-track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width .5s cubic-bezier(.2,.8,.2,1); }

/* fade/slide page transition */
.fade-in { animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }
.af-spin { animation: afSpin .8s linear infinite; transform-origin: center; }
@keyframes afSpin { to { transform: rotate(360deg); } }

/* toast */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--bg);
  padding: 11px 16px; border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 500; animation: toastIn .25s cubic-bezier(.2,.8,.2,1);
}
.toast .toast-ico { color: var(--pos); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }

/* modal */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: oklch(0.2 0.03 262 / 0.45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 24px; animation: fadeIn .15s ease; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: 100%; animation: pop .18s ease; }

/* stat tiles */
.stat { padding: 16px 18px; }
.stat-label { font-size: 11px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-weight: 700; font-size: 26px; letter-spacing: -0.02em; margin-top: 7px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 15px; font-weight: 600; color: var(--ink-3); margin-left: 2px; }
.stat-sub { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 5px; }
.stat-up { color: var(--pos); font-weight: 600; }
.stat-down { color: var(--neg); font-weight: 600; }

/* receipt / placeholder image */
.ph {
  background:
    repeating-linear-gradient(135deg, var(--surface-3) 0 9px, transparent 9px 18px),
    var(--surface-2);
  border: 1px dashed var(--line-2); border-radius: var(--r-md);
  display: grid; place-items: center; color: var(--ink-3);
  font-family: var(--font-mono); font-size: 11px; text-align: center; padding: 8px;
}

/* tab nav (underline) */
.tabnav { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabnav button {
  border: none; background: none; padding: 12px 15px; font-size: 14px; font-weight: 600;
  color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; transition: color .12s; cursor: pointer;
}
.tabnav button:hover { color: var(--ink); }
.tabnav button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* toggle switch */
.switch {
  width: 42px; height: 24px; border-radius: 99px; background: var(--line-2);
  position: relative; transition: background .16s; flex-shrink: 0; border: none; cursor: pointer; padding: 0;
}
.switch.on { background: var(--pos); }
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 99px; background: #fff; transition: transform .16s; box-shadow: var(--shadow-sm);
}
.switch.on::after { transform: translateX(18px); }

/* settings definition rows */
.def { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px solid var(--line); }
.def:first-child { border-top: none; }
.def-label { font-size: 13.5px; color: var(--ink-3); }
.def-value { font-size: 13.5px; font-weight: 600; text-align: right; }

/* copyable mono row */
.copyrow {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); font-family: var(--font-mono); font-size: 12.5px;
}
.copyrow button { border: none; background: none; color: var(--accent); font-weight: 600; font-size: 12px; cursor: pointer; font-family: var(--font-ui); flex-shrink: 0; }

/* formal report sheet (BFNAR style) */
.report-sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: 30px 32px; }
.rep-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 2px solid var(--ink); padding-bottom: 14px; margin-bottom: 10px; }
.rep-title { font-family: var(--font-display); font-weight: 800; font-size: 23px; letter-spacing: -0.02em; line-height: 1.1; }
.rep-org { font-size: 12px; color: var(--ink-2); margin-top: 3px; font-weight: 600; }
.rep-org span { display: block; font-weight: 400; color: var(--ink-3); }
.rep-meta { font-size: 11.5px; color: var(--ink-2); display: grid; grid-template-columns: auto auto; gap: 3px 16px; text-align: left; white-space: nowrap; }
.rep-meta b { font-weight: 600; }
.rep-meta .rv { text-align: right; font-variant-numeric: tabular-nums; }
.rep-tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.rep-tbl th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--ink); }
.rep-tbl th.r, .rep-tbl td.r { text-align: right; }
.rep-tbl td { padding: 6px 10px; border-bottom: 1px solid var(--line); }
.rep-tbl tr.bar td { background: var(--ink); color: var(--bg); font-weight: 700; font-size: 12.5px; padding: 8px 10px; border: none; }
.rep-tbl tr.sub td { font-weight: 700; }
.rep-tbl tr.sum td { font-weight: 700; border-top: 1px solid var(--ink); border-bottom: 2px solid var(--ink); }
.rep-tbl tr.acc td { color: var(--ink-2); }
.rep-tbl tr.acc td:first-child { padding-left: 22px; }
.rep-tbl a.acc-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.rep-tbl a.acc-link:hover { text-decoration: underline; }
.rep-tbl tr.click { cursor: pointer; }
.rep-tbl tr.click:hover td { background: var(--surface-2); }

/* report rail */
.rep-rail-btn { width: 100%; border: none; background: transparent; border-radius: var(--r-sm); padding: 9px 12px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); text-align: left; cursor: pointer; display: flex; align-items: center; gap: 9px; margin-bottom: 1px; }
.rep-rail-btn:hover { background: var(--surface-3); color: var(--ink); }
.rep-rail-btn.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.rep-rail-label { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 12px 12px 5px; }

.menu-toggle { display: none; }

/* responsive */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 80;
    transform: translateX(-100%); transition: transform .22s cubic-bezier(.2,.8,.2,1);
    box-shadow: var(--shadow-lg);
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .menu-toggle { display: grid; }
  .page { padding: 18px 16px 80px; }
  .topbar { padding: 10px 16px; }
}
.scrim { display: none; }
@media (max-width: 920px) {
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 70; background: oklch(0.2 0.03 262 / 0.4); }
}

/* hide-on-mobile / desktop */
@media (max-width: 720px) { .hide-sm { display: none !important; } }
@media (max-width: 1080px) { .hide-md { display: none !important; } }

/* ============================================================
   Print / "Spara PDF" — isolate the on-screen report sheet and keep
   every border, fill and line in the PDF (browsers drop background
   colours and bar fills unless print-color-adjust is forced exact).
   ============================================================ */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: #fff !important; }
  /* Collapse the app chrome (display:none removes it from layout) so the report
     flows from the top of the page and paginates across MULTIPLE pages. */
  .sidebar, .topbar, .scrim, .rep-rail, .crumb, .menu, .backdrop, .toasts, .seg, .icon-btn, .modal-bg { display: none !important; }
  .app, .main, .page, .page-wide, .grid { display: block !important; }
  /* Hide everything, reveal only the report sheet — but keep it in NORMAL FLOW.
     (position:absolute clips printed content to a single page; static paginates.) */
  body * { visibility: hidden !important; }
  .report-sheet, .report-sheet * { visibility: visible !important; }
  .report-sheet {
    position: static !important; width: 100% !important;
    margin: 0 !important; padding: 0 !important; border: none !important; box-shadow: none !important;
    background: #fff !important;
  }
  .rep-tbl { width: 100%; border-collapse: collapse; }
  /* Repeat the table header on every printed page so columns stay labelled. */
  .rep-tbl thead { display: table-header-group; }
  /* Keep bar/sum fills visible (they read as the section "lines"). */
  .rep-tbl tr.bar td { background: #1a1a1a !important; color: #fff !important; }
  .rep-tbl td, .rep-tbl th { border-color: #bbb !important; }
  /* Never split a row across pages — that's what dropped lines/linebreaks. */
  .rep-tbl tr, .report-sheet .rep-head { break-inside: avoid; page-break-inside: avoid; }
  /* Controls explicitly flagged no-print (action buttons, edit columns) must be
     fully removed from the PDF even when they sit inside a visible report sheet —
     display:none beats the visibility:visible reveal above. */
  .no-print { display: none !important; }
  /* Generic data tables (.tbl) inside a report sheet (Budget, kontoutdrag) get the
     same print treatment as .rep-tbl: repeated header, visible borders, no split
     rows — so no lines/linebreaks drop out of the PDF. */
  .report-sheet { overflow: visible !important; }
  .report-sheet .tbl { width: 100%; border-collapse: collapse; }
  .report-sheet .tbl thead { display: table-header-group; }
  .report-sheet .tbl th, .report-sheet .tbl td { border-color: #bbb !important; }
  .report-sheet .tbl tr { break-inside: avoid; page-break-inside: avoid; }
  /* card chrome inside a report sheet flattens cleanly for print */
  .report-sheet .card-head { border-bottom-color: #bbb !important; }
  /* Drill-down konto-länkar ska se ut som vanlig text i PDF, inte blå länkar. */
  .konto-link { color: inherit !important; text-decoration: none !important; }
  /* Ta bort tomrummet överst i PDF:en: dölj sidchrome (rubrik, KPI-kort, flikar)
     som varken ÄR eller innehåller en report-sheet. :has() stöds i moderna
     webbläsare (Chrome "Spara som PDF"); äldre ignorerar regeln → oförändrat. */
  .page > *:not(.report-sheet):not(:has(.report-sheet)) { display: none !important; }
  @page { margin: 14mm; }
}
