/* ── Reset & Variables ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --forest:      #1c336b;
  --forest-mid:  #28468b;
  --sage:        #5c9e31;
  --sage-light:  #7ec74b;
  --mint:        #a3e673;
  --cream:       #f1f5f9;
  --parchment:   #f8fafc;
  --white:       #ffffff;
  --earth:       #1e293b;
  --earth-mid:   #475569;
  --earth-light: #94a3b8;
  --rust:        #ef4444;
  --gold:        #eab308;
  --border:      rgba(28, 51, 107, 0.12);
  --shadow-sm:   0 1px 4px rgba(26,61,43,0.08);
  --shadow:      0 4px 16px rgba(26,61,43,0.12);
  --shadow-lg:   0 12px 40px rgba(26,61,43,0.18);
  --radius:      10px;
  --radius-lg:   16px;
  --font-display:'Inter', system-ui, sans-serif;
  --font-body:   'Inter', system-ui, sans-serif;
  --sidebar-w:   238px;
}

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--earth);
  min-height: 100vh;
  display: flex;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--forest);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0,0,0,0.2);
}
.sidebar-logo {
  padding: 16px 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo-img { display: flex; align-items: center; justify-content: center; }
.sidebar-logo-img img {
  width: 100%;
  max-width: 186px;
  height: auto;
  display: block;
  border-radius: 6px;
  background: #fff;
  padding: 6px 8px;
  box-sizing: border-box;
}
.sidebar-logo h1  { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--mint); line-height: 1.2; }
.sidebar-logo p   { font-size: 10px; color: rgba(168,213,181,0.45); margin-top: 2px; letter-spacing: 0.5px; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: rgba(168,213,181,0.3); padding: 10px 12px 4px; font-weight: 500; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: var(--radius);
  cursor: pointer; transition: all .18s;
  color: rgba(168,213,181,0.65); font-size: 13.5px;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item .icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-item:hover  { background: rgba(168,213,181,0.1); color: var(--mint); }
.nav-item.active { background: rgba(168,213,181,0.16); color: #fff; font-weight: 500; }
.sidebar-footer  { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,0.06); font-size: 10px; color: rgba(168,213,181,0.25); text-align: center; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
#main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  background: var(--parchment); border-bottom: 1px solid var(--border);
  padding: 0 32px; height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-family: var(--font-display); font-size: 21px; font-weight: 600; color: var(--forest); }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.content { flex: 1; padding: 28px 32px; max-width: 1300px; }

/* ── Views ───────────────────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── Stat Cards ──────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 22px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; background:linear-gradient(90deg,var(--sage),var(--mint)); border-radius:3px 3px 0 0; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--earth-light); margin-bottom: 6px; font-weight: 500; }
.stat-value { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--forest); line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--earth-light); margin-top: 4px; }
.stat-icon  { position: absolute; top: 18px; right: 20px; font-size: 26px; opacity: .14; }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 22px; }
.card-header { padding: 16px 22px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--parchment); }
.card-title  { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--forest); }
.card-body   { padding: 18px 22px; }

/* ── Table ───────────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--earth-light); font-weight: 500; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--parchment); white-space: nowrap; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid rgba(26,61,43,0.05); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(168,213,181,0.06); }
.table-actions { display: flex; gap: 5px; justify-content: flex-end; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 8px 16px; border-radius: var(--radius); border: none; font-family: var(--font-body); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: all .18s; text-decoration: none; white-space: nowrap; }
.btn-primary   { background: var(--forest); color: #fff; }
.btn-primary:hover { background: var(--forest-mid); box-shadow: var(--shadow); }
.btn-secondary { background: var(--parchment); color: var(--earth); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--cream); }
.btn-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-ghost { background: transparent; color: var(--sage); border: 1px solid transparent; padding: 5px 9px; font-size: 12.5px; }
.btn-ghost:hover { background: rgba(107,158,122,0.1); border-color: var(--border); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #c49a35; }
.btn-sm   { padding: 5px 11px; font-size: 12px; }
.btn-icon { padding: 5px 7px; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 11.5px; font-weight: 500; color: var(--earth-mid); margin-bottom: 4px; letter-spacing: .2px; }
.form-control { width: 100%; padding: 8px 11px; border: 1.5px solid var(--border); border-radius: var(--radius); font-family: var(--font-body); font-size: 13.5px; color: var(--earth); background: var(--parchment); transition: border-color .15s, box-shadow .15s; outline: none; }
.form-control:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(107,158,122,0.13); background: #fff; }
select.form-control { cursor: pointer; }
.form-row        { display: grid; gap: 12px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(26,61,43,0.45); backdrop-filter: blur(3px); z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; animation: modalIn .22s ease; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1040px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-10px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-header { padding: 20px 26px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title  { font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--forest); }
.modal-close  { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--earth-light); width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 6px; transition: background .15s; }
.modal-close:hover { background: var(--cream); color: var(--earth); }
.modal-body   { padding: 22px 26px; }
.modal-footer { padding: 14px 26px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── Toast ───────────────────────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 22px; right: 22px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--earth); color: #fff; padding: 11px 16px; border-radius: var(--radius); font-size: 13.5px; box-shadow: var(--shadow-lg); animation: toastIn .2s ease; max-width: 300px; }
.toast.success { background: var(--forest); border-left: 3px solid var(--mint); }
.toast.error   { background: #7f1d1d;       border-left: 3px solid #ef4444; }
@keyframes toastIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

/* ── Badges ──────────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; letter-spacing: .2px; }
.badge-green  { background: rgba(168,213,181,0.28); color: var(--forest); }
.badge-gold   { background: rgba(212,168,67,0.2);   color: #7c5c10; }
.badge-gray   { background: rgba(100,100,100,0.12); color: #555; }
.badge-red    { background: rgba(220,38,38,0.12);   color: #dc2626; }
.badge-blue   { background: rgba(59,130,246,0.12);  color: #1e40af; }
.badge-purple { background: rgba(124,58,237,0.12);  color: #7c3aed; }
.badge-teal   { background: rgba(20,184,166,0.12);  color: #0d9488; }
.badge-amber  { background: rgba(180,83,9,0.1);     color: #b45309; }

/* ── Customer Flags ──────────────────────────────────────────────────────────── */
.flag-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.flag-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 500;
  cursor: pointer; border: 1.5px solid transparent; transition: all .15s; user-select: none;
}
.flag-pill input[type=checkbox] { display: none; }
.flag-pill.checked { border-color: currentColor; }
.flag-AKTIV        { color: #15803d; background: rgba(21,128,61,0.08);  } .flag-AKTIV.checked        { background: rgba(21,128,61,0.16);  }
.flag-INAKTIV      { color: #6b7280; background: rgba(107,114,128,0.08);} .flag-INAKTIV.checked      { background: rgba(107,114,128,0.18);}
.flag-ATERKOMMANDE { color: #0d9488; background: rgba(13,148,136,0.08); } .flag-ATERKOMMANDE.checked { background: rgba(13,148,136,0.16); }
.flag-RING_UPP     { color: #dc2626; background: rgba(220,38,38,0.08);  } .flag-RING_UPP.checked     { background: rgba(220,38,38,0.16);  }
.flag-NYTT_AVTAL   { color: #7c3aed; background: rgba(124,58,237,0.08); } .flag-NYTT_AVTAL.checked   { background: rgba(124,58,237,0.16); }
.flag-VIP          { color: #b45309; background: rgba(180,83,9,0.08);   } .flag-VIP.checked          { background: rgba(180,83,9,0.16);   }
.flag-OFFERT       { color: #1d4ed8; background: rgba(29,78,216,0.08);  } .flag-OFFERT.checked       { background: rgba(29,78,216,0.16);  }

/* ── Tabs ────────────────────────────────────────────────────────────────────── */
.tab-bar { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab-btn { padding: 9px 18px; border: none; background: none; font-family: var(--font-body); font-size: 13.5px; color: var(--earth-light); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s; font-weight: 500; }
.tab-btn:hover  { color: var(--forest); }
.tab-btn.active { color: var(--forest); border-bottom-color: var(--sage); }
.tab-content         { display: none; }
.tab-content.active  { display: block; }

/* ── Calc Preview ────────────────────────────────────────────────────────────── */
.calc-preview { background: linear-gradient(135deg,rgba(26,61,43,0.04),rgba(168,213,181,0.1)); border: 1px solid rgba(26,61,43,0.1); border-radius: var(--radius); padding: 13px 16px; margin-top: 8px; }
.calc-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; color: var(--earth-mid); }
.calc-row.total { font-weight: 600; color: var(--forest); border-top: 1px solid var(--border); margin-top: 5px; padding-top: 7px; font-size: 14.5px; }

/* ── Faktura builder ─────────────────────────────────────────────────────────── */
.faktura-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 7px; align-items: center; margin-bottom: 7px; }
.row-total   { font-weight: 600; font-size: 13.5px; color: var(--forest); text-align: right; min-width: 72px; }
.dagbok-check-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--parchment); }
.dagbok-check-item { display: flex; align-items: center; gap: 9px; padding: 9px 13px; border-bottom: 1px solid rgba(26,61,43,0.05); font-size: 13px; cursor: pointer; transition: background .12s; }
.dagbok-check-item:hover { background: rgba(168,213,181,0.1); }
.dagbok-check-item:last-child { border-bottom: none; }
.dagbok-check-item input { cursor: pointer; accent-color: var(--forest); }

/* ── Årsöversikt matrix ──────────────────────────────────────────────────────── */
.year-matrix-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.year-matrix { border-collapse: collapse; font-size: 12.5px; white-space: nowrap; min-width: 100%; }
.year-matrix th { background: var(--forest); color: var(--mint); padding: 10px 12px; text-align: center; font-weight: 500; font-size: 11px; letter-spacing: .4px; border-right: 1px solid rgba(255,255,255,0.08); position: sticky; top: 0; z-index: 10; }
.year-matrix th.row-header { text-align: left; min-width: 130px; left: 0; z-index: 20; border-right: 2px solid rgba(255,255,255,0.18); }
.year-matrix th.col-total  { background: var(--forest-mid); }
.year-matrix td { padding: 8px 12px; text-align: center; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--white); transition: background .12s; }
.year-matrix td.row-label  { text-align: left; font-weight: 500; color: var(--earth-mid); background: var(--parchment); border-right: 2px solid var(--border); position: sticky; left: 0; z-index: 5; font-size: 12px; }
.year-matrix td.row-label span { display: block; font-size: 10px; color: var(--earth-light); font-weight: 400; }
.year-matrix td.has-hours  { background: rgba(168,213,181,0.18); color: var(--forest); font-weight: 600; }
.year-matrix td.many-hours { background: rgba(74,124,89,0.22);   color: var(--forest); font-weight: 700; }
.year-matrix td.row-total  { background: rgba(26,61,43,0.06); font-weight: 700; color: var(--forest); border-right: none; }
.year-matrix tr.col-totals td { background: var(--parchment); font-weight: 700; color: var(--forest); border-top: 2px solid var(--border); }
.year-matrix tr.col-totals td.row-label { background: var(--forest); color: var(--mint); }
.year-matrix tr:hover td:not(.row-label) { background: rgba(168,213,181,0.1); }
.year-matrix tr.col-totals:hover td      { background: var(--parchment); }

.matrix-controls { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; padding: 14px 18px; background: var(--parchment); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.matrix-controls .form-group { margin-bottom: 0; min-width: 150px; }
.matrix-legend { display: flex; gap: 14px; align-items: center; font-size: 11px; color: var(--earth-light); margin-top: 8px; }
.legend-swatch { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }

/* ── Filters ─────────────────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 18px; flex-wrap: wrap; padding: 14px 18px; background: var(--parchment); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.filter-bar .form-group { margin-bottom: 0; min-width: 150px; }

/* ── Inställningar ───────────────────────────────────────────────────────────── */
.settings-section { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 22px; overflow: hidden; }
.settings-section-title { padding: 14px 20px; background: var(--parchment); border-bottom: 1px solid var(--border); font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--forest); display: flex; align-items: center; gap: 7px; }
.settings-body { padding: 20px; }

/* ── Helpers ─────────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.empty-state { padding: 44px 24px; text-align: center; color: var(--earth-light); }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 10px; opacity: .45; }
.empty-state p { font-size: 14.5px; }

/* ── Print document ──────────────────────────────────────────────────────────── */
.print-doc { font-family: var(--font-body); padding: 38px; background: #fff; color: #222; max-width: 740px; margin: 0 auto; }
.print-doc .doc-header { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 22px; border-bottom: 2px solid #1a3d2b; margin-bottom: 26px; }
.print-doc .company-name { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: #1a3d2b; }
.print-doc table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 12.5px; }
.print-doc table th { background: #1a3d2b; color: #fff; padding: 8px 11px; text-align: left; font-weight: 500; }
.print-doc table td { padding: 8px 11px; border-bottom: 1px solid #eee; }
.print-doc table tr:nth-child(even) td { background: #f9f9f9; }
.print-doc .totals-box { margin-left: auto; width: 270px; margin-top: 18px; }
.print-doc .totals-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13.5px; border-bottom: 1px solid #eee; }
.print-doc .totals-row.total { font-weight: 700; font-size: 15px; border-top: 2px solid #1a3d2b; border-bottom: none; margin-top: 4px; padding-top: 9px; }

/* ── Scrollbar ───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(26,61,43,0.18); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(26,61,43,0.32); }

/* ── Print media ─────────────────────────────────────────────────────────────── */
@media print {
  body { background: #fff; }
  #sidebar, .topbar, .no-print { display: none !important; }
  #main { margin-left: 0 !important; }
}

/* ── Active / Inactive ───────────────────────────────────────────────────────── */
.row-inactive { opacity: 0.72; }
.row-inactive td { background: rgba(0,0,0,0.015) !important; }
.inactive-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #9b8670; flex-shrink: 0; margin-top: 2px; }

.btn-deactivate { background: rgba(156,163,175,0.12); color: #6b7280; border: 1px solid rgba(156,163,175,0.3); font-size: 12px; }
.btn-deactivate:hover { background: rgba(156,163,175,0.22); }
.btn-activate   { background: rgba(21,128,61,0.1);  color: #15803d; border: 1px solid rgba(21,128,61,0.25); font-size: 12px; }
.btn-activate:hover   { background: rgba(21,128,61,0.2); }
.btn-delete-perm { background: rgba(220,38,38,0.08); color: #dc2626; border: 1px solid rgba(220,38,38,0.22); font-size: 12px; }
.btn-delete-perm:hover { background: rgba(220,38,38,0.16); }

/* ── Tab counts ──────────────────────────────────────────────────────────────── */
.tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 10px; font-size: 10px; font-weight: 600; margin-left: 5px; background: rgba(26,61,43,0.1); color: var(--earth-mid); }
.tab-btn.active .tab-count { background: rgba(74,124,89,0.18); color: var(--forest); }

/* ── Category rows in tjanster table ─────────────────────────────────────────── */
.category-row td { background: var(--cream) !important; border-bottom: none !important; padding: 12px 12px 4px !important; }
.category-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; color: var(--earth-light); }

/* ── Confirm delete modal ────────────────────────────────────────────────────── */
.confirm-delete-box { background: #fff5f5; border: 1.5px solid #fecaca; border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 18px; }
.confirm-delete-box h4 { color: #991b1b; font-size: 14px; font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.confirm-delete-box p  { font-size: 13px; color: #7f1d1d; line-height: 1.5; }
.confirm-delete-note   { font-size: 12px !important; color: #9b8670 !important; margin-top: 8px; font-style: italic; }
.confirm-delete-label  { font-size: 12.5px; color: var(--earth-mid); margin-bottom: 6px; margin-top: 14px; display: block; }
.confirm-delete-label strong { color: var(--rust); }

/* ── Helper text ─────────────────────────────────────────────────────────────── */
.text-muted { color: var(--earth-light); font-size: 12px; }

/* ── Analys ──────────────────────────────────────────────────────────────────── */
.analys-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }

.analys-kpi-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s;
}
.analys-kpi-card:hover { box-shadow: var(--shadow); }
.analys-kpi-card::before { content:''; position:absolute; top:0;left:0;right:0;height:3px;border-radius:3px 3px 0 0; }
.kpi-green::before  { background: linear-gradient(90deg, var(--sage), var(--mint)); }
.kpi-rust::before   { background: linear-gradient(90deg, var(--rust), #e8924a); }
.kpi-forest::before { background: linear-gradient(90deg, var(--forest), var(--sage)); }
.kpi-gold::before   { background: linear-gradient(90deg, var(--gold), #f0c96a); }
.kpi-dark-rust::before { background: linear-gradient(90deg, #991b1b, var(--rust)); }

.kpi-icon  { font-size: 20px; margin-bottom: 6px; opacity: .7; }
.kpi-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--earth-light); font-weight: 500; margin-bottom: 4px; }
.kpi-value { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--forest); line-height: 1; margin-bottom: 5px; }
.kpi-sub   { font-size: 11px; color: var(--earth-light); margin-bottom: 8px; }
.kpi-bar-bg { height: 4px; background: var(--cream); border-radius: 3px; overflow: hidden; }
.kpi-bar    { height: 100%; border-radius: 3px; transition: width .6s ease; }

.analys-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.analys-card-header { padding: 14px 20px 12px; border-bottom: 1px solid var(--border); background: var(--parchment); display: flex; align-items: center; justify-content: space-between; }
.analys-card-title  { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--forest); }
.analys-card-body   { padding: 18px 20px; }
.analys-sub-label   { font-size: 11px; color: var(--earth-light); }

.analys-controls { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 20px; padding: 14px 18px; background: var(--parchment); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.analys-controls .form-group { margin-bottom: 0; min-width: 150px; }

/* Bar chart */
.chart-legend { display: flex; align-items: center; font-size: 11.5px; color: var(--earth-light); gap: 4px; }
.legend-dot   { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-line  { display: inline-block; width: 14px; height: 3px; border-radius: 2px; flex-shrink: 0; }

.bar-tooltip {
  position: absolute; z-index: 50; pointer-events: none;
  background: rgba(26,42,35,0.96); color: #fff;
  border-radius: var(--radius); padding: 10px 14px;
  font-size: 12.5px; min-width: 190px;
  box-shadow: var(--shadow-lg); backdrop-filter: blur(4px);
}
.tooltip-title { font-weight: 600; margin-bottom: 7px; color: var(--mint); font-size: 13px; }
.tooltip-row   { display: flex; justify-content: space-between; gap: 14px; padding: 2px 0; }

/* Mini bar inside table cell */
.mini-bar-bg { height: 3px; background: var(--cream); border-radius: 2px; overflow: hidden; margin-top: 4px; width: 100%; max-width: 120px; }
.mini-bar    { height: 100%; border-radius: 2px; transition: width .5s ease; }

/* Margin pill */
.margin-pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }

/* Taxa breakdown */
.taxa-breakdown { display: flex; flex-direction: column; gap: 14px; }
.taxa-row       { }
.taxa-row-top   { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 5px; }
.taxa-naam      { font-weight: 500; color: var(--earth); }
.taxa-bar-wrap  { height: 8px; background: var(--cream); border-radius: 4px; overflow: hidden; margin-bottom: 5px; }
.taxa-bar       { height: 100%; background: linear-gradient(90deg, var(--sage), var(--mint)); border-radius: 4px; transition: width .6s ease; }
.taxa-row-bottom{ display: flex; justify-content: space-between; align-items: center; }

/* ── Mobile Responsiveness ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #mobile-menu-btn { display: block !important; }
  
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  #sidebar.open {
    transform: translateX(0);
  }
  
  #main { margin-left: 0 !important; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  
  .stats-grid { grid-template-columns: 1fr; }
  .analys-kpi-grid { grid-template-columns: 1fr; }
  
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  
  .card-body, .analys-card-body, .settings-body { overflow-x: auto; }
  
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  
  .modal { max-height: 95vh; margin: 10px; }
  .modal-body { padding: 16px; }
  
  .data-table th, .data-table td { white-space: nowrap; }
  
  /* Dagbok builder and Faktura rows */
  .faktura-row { grid-template-columns: 1fr; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
  .row-total { text-align: left; margin-bottom: 4px; }
}
