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

:root {
  /* Köterverket Global Admin – light (dag) */
  --bg:     #eef1f6;
  --paper:  #ffffff;
  --paper2: rgba(255,255,255,.88);
  --text:   #0d1321;
  --muted:  #52637a;
  --line:   rgba(13,19,33,.14);
  --line2:  rgba(13,19,33,.09);
  --shadow: 0 18px 50px rgba(13,19,33,.08);

  --accent:  #2563eb;
  --accent2: #1d4ed8;

  --ok:   #166534;
  --bad:  #991b1b;
  --warn: #b45309;

  --radius:  14px;
  --radius2: 18px;
  --pad:     16px;

  --btn:     #0d1321;
  --btnText: #ffffff;

  --kv-logo-filter: none;
  --theme-icon-sun: none;
  --theme-icon-moon: block;
}

/* ── Night / dark mode ───────────────────────────────────── */
[data-theme="dark"] {
  --bg:     #0b0c10;
  --paper:  #13141c;
  --paper2: rgba(16,17,26,.92);
  --text:   #e4e6ef;
  --muted:  #5c6880;
  --line:   rgba(255,255,255,.07);
  --line2:  rgba(255,255,255,.05);
  --shadow: 0 18px 50px rgba(0,0,0,.4);

  --btn:     #2563eb;
  --btnText: #ffffff;

  --kv-logo-filter: brightness(0) invert(1);
  --theme-icon-sun: block;
  --theme-icon-moon: none;
}

[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: .04; }
[data-theme="dark"] .topbar-user { background: rgba(255,255,255,.05); }
[data-theme="dark"] .card        { background: var(--paper); border-color: var(--line); }
[data-theme="dark"] .sidebar     { background: #0d0e14; border-color: var(--line2); }
[data-theme="dark"] .nav-item.active { background: var(--accent); color: #fff; }
[data-theme="dark"] .table th    { background: rgba(255,255,255,.04); }
[data-theme="dark"] .table tr:hover td { background: rgba(255,255,255,.03); }
[data-theme="dark"] .btn-secondary { background: rgba(255,255,255,.07); border-color: var(--line); color: var(--text); }
[data-theme="dark"] .btn-secondary:hover { background: rgba(255,255,255,.12); }

/* ── Theme toggle button ──────────────────────────────────── */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line2);
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .2s, border-color .2s, color .2s;
}
.theme-toggle-btn:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle-btn svg { flex-shrink: 0; }

/* Sol-animasjon: roter sakte */
@keyframes kv-spin-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
#adminIconSun { animation: kv-spin-slow 8s linear infinite; transform-origin: center; }

/* CSS-fallback for synlighet (JS-inline-style er primær, dette er backup) */
html:not([data-theme="dark"]) #adminIconSun  { display: none !important; }
html:not([data-theme="dark"]) #adminIconMoon { display: block !important; }
html[data-theme="dark"] #adminIconSun        { display: block !important; }
html[data-theme="dark"] #adminIconMoon       { display: none !important; }

/* ── KV logo in topbar ───────────────────────────────────── */
.kv-topbar-logo {
  height: 24px;
  width: auto;
  display: block;
  filter: var(--kv-logo-filter);
  transition: filter .2s;
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* Paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='.38'/%3E%3C/svg%3E");
}

/* APP */
.app { min-height: 100%; display: flex; flex-direction: column; }

/* ──────────────────────────────────────────────────────────
   TOPBAR
────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 72px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper2);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line2);
}

.topbar-left { display: flex; align-items: center; gap: 14px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: -.02em;
  flex-shrink: 0;
}
.brand-name {
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -.03em;
  line-height: 1;
}
.brand-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: rgba(255,255,255,.65);
}

.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .04em;
  color: #fff;
  background: var(--accent);
  flex-shrink: 0;
}

.topbar-user-meta { line-height: 1.1; }
.topbar-name { font-weight: 800; font-size: 13px; letter-spacing: -.01em; }
.topbar-role { font-size: 11px; color: var(--accent); font-weight: 700; }
.topbar-logout {
  display: inline-block;
  font-size: 12px;
  color: var(--bad);
  text-decoration: none;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(153,27,27,.22);
}
.topbar-logout:hover { background: rgba(153,27,27,.07); }

/* ──────────────────────────────────────────────────────────
   LAYOUT
────────────────────────────────────────────────────────── */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 248px 1fr;
}

/* ──────────────────────────────────────────────────────────
   SIDEBAR
────────────────────────────────────────────────────────── */
.sidebar {
  padding: 16px 12px;
  border-right: 1px solid var(--line2);
  background: rgba(255,255,255,.55);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
}

.nav-section {
  margin: 14px 12px 5px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(82,99,122,.55);
  font-weight: 700;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 700;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: rgba(13,19,33,.05); }
.nav-item.active {
  background: var(--text);
  color: #fff;
}
.nav-item.active svg { stroke: #fff; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 6px;
  bottom: 6px;
  width: 10px;
  border-radius: 6px;
  background: var(--accent);
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.5;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px 4px;
  border-top: 1px solid var(--line2);
  font-size: 11px;
  color: rgba(82,99,122,.65);
  line-height: 1.5;
}
.sidebar-footer strong { color: var(--text); font-weight: 700; }

/* ──────────────────────────────────────────────────────────
   CONTENT
────────────────────────────────────────────────────────── */
.content { padding: 24px 24px 48px; min-width: 0; }

h1 { margin: 0 0 6px; font-size: 23px; letter-spacing: -.03em; }
h2 { margin: 0 0 12px; font-size: 17px; letter-spacing: -.02em; }
h3 { margin: 0 0 10px; font-size: 14px; letter-spacing: -.01em; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-head-left {}
.muted { color: var(--muted); font-size: 13px; }

/* ──────────────────────────────────────────────────────────
   GRID
────────────────────────────────────────────────────────── */
.grid { display: grid; gap: 14px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 18px; }
.grid.two  { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }

/* ──────────────────────────────────────────────────────────
   CARDS
────────────────────────────────────────────────────────── */
.card {
  position: relative;
  background: rgba(255,255,255,.80);
  border: 1px solid var(--line2);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  padding: var(--pad);
}

.card.kpi {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px 14px 22px;
}
.card.kpi::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 10px;
  bottom: 10px;
  width: 5px;
  border-radius: 6px;
  background: var(--accent);
}
.card.kpi.ok-kpi::before  { background: var(--ok); }
.card.kpi.bad-kpi::before { background: var(--bad); }
.card.kpi.warn-kpi::before { background: var(--warn); }

.kpi-text { min-width: 0; }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.kpi-label { margin-top: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi svg, .kpi i { width: 22px; height: 22px; stroke: var(--muted); flex-shrink: 0; opacity: .7; }

/* ──────────────────────────────────────────────────────────
   NOTICE / ALERTS
────────────────────────────────────────────────────────── */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.78);
  border: 1px solid var(--line2);
  font-size: 13px;
  margin-bottom: 16px;
}
.notice svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.notice.info    { border-color: rgba(37,99,235,.3); background: rgba(37,99,235,.06); }
.notice.warning { border-color: rgba(180,83,9,.28); background: rgba(180,83,9,.06); }
.notice.success { border-color: rgba(22,101,52,.28); background: rgba(22,101,52,.06); }
.notice.danger  { border-color: rgba(153,27,27,.28); background: rgba(153,27,27,.06); }

/* ──────────────────────────────────────────────────────────
   TABLES
────────────────────────────────────────────────────────── */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line2);
  color: var(--muted);
  white-space: nowrap;
}
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(13,19,33,.07);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(37,99,235,.04); }

/* ──────────────────────────────────────────────────────────
   STATUS BADGES & PILLS
────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
}
.badge.active    { background: rgba(22,101,52,.1);  color: #166534; }
.badge.inactive  { background: rgba(82,99,122,.12); color: #52637a; }
.badge.trial     { background: rgba(180,83,9,.1);   color: #b45309; }
.badge.customer  { background: rgba(37,99,235,.1);  color: #1d4ed8; }
.badge.free      { background: rgba(82,99,122,.1);  color: #52637a; }
.badge.premium   { background: rgba(109,40,217,.1); color: #6d28d9; }
.badge.warn      { background: rgba(153,27,27,.1);  color: #991b1b; }
.badge.past_due  { background: rgba(153,27,27,.1);  color: #991b1b; }
.badge.overdue   { background: rgba(153,27,27,.1);  color: #991b1b; }

.ok  { color: var(--ok);  font-weight: 800; }
.bad { color: var(--bad); font-weight: 800; }

/* Module toggle chip */
.mod-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: default;
}
.mod-chip.on  { background: rgba(37,99,235,.1); color: #1d4ed8; border-color: rgba(37,99,235,.22); }
.mod-chip.off { background: rgba(82,99,122,.08); color: var(--muted); border-color: var(--line2); }

/* ──────────────────────────────────────────────────────────
   BUTTONS
────────────────────────────────────────────────────────── */
button, .btn, .pill {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  background: var(--btn);
  color: var(--btnText);
  font-family: inherit;
  transition: filter .12s, background .12s;
}
button:hover, .btn:hover, .pill:hover { filter: brightness(1.08); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }

.btn-secondary, .pill.secondary {
  background: rgba(255,255,255,.85);
  color: var(--text);
  border: 1px solid var(--line2);
}

.btn-danger { background: var(--bad); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 11.5px; }

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}
.link:hover { text-decoration: underline; }

/* ──────────────────────────────────────────────────────────
   FORMS
────────────────────────────────────────────────────────── */
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 11.5px;
  font-weight: 800;
  color: #2b3442;
  margin-bottom: 5px;
  letter-spacing: .01em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line2);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  background: rgba(255,255,255,.85);
  color: var(--text);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}

textarea { resize: vertical; min-height: 90px; }

input:focus, select:focus, textarea:focus {
  border-color: rgba(37,99,235,.4);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

/* ── Dark mode input override (ETTER base-stilene for å vinne kaskadet) ── */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #1a1c27;
  color: #e4e6ef;
  border-color: rgba(255,255,255,.14);
}
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: rgba(37,99,235,.5);
  box-shadow: 0 0 0 4px rgba(37,99,235,.18);
}
[data-theme="dark"] .form-row label { color: var(--muted); }

.help { margin-top: 5px; font-size: 11.5px; color: var(--muted); }

/* ──────────────────────────────────────────────────────────
   MODULE LIST – iOS toggle row style (site_modules page)
────────────────────────────────────────────────────────── */
.module-grid {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line2);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 4px;
  max-width: 860px;      /* ikke strekk på tvers av hele skjermen */
}

/* Row: [Name + tag — tar all plass] [toggle høyre-justert] */
.module-card {
  display: flex;
  align-items: center;
  justify-content: space-between;   /* navn til venstre, toggle alltid til høyre */
  gap: 16px;
  padding: 10px 16px;
  border: none;
  border-bottom: 1px solid var(--line2);
  background: transparent;
  cursor: pointer;
  transition: background .12s;
  user-select: none;
}
.module-card:last-child { border-bottom: none; }
.module-card:hover      { background: var(--line2); }
.module-card.active     { background: rgba(37,99,235,.07); }

/* Left: name + premium tag */
.module-card-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.module-card-info h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);               /* følger temaet */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.module-card-info p { display: none; }

/* Premium badge */
.module-card .premium-tag {
  font-size: 9.5px;
  font-weight: 800;
  color: #a78bfa;
  background: rgba(139,92,246,.15);
  border: 1px solid rgba(139,92,246,.25);
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Remove bar and val — not used in this style */
.module-bar { display: none; }
.module-val { display: none; }

/* Category heading */
.module-cat-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 0 6px;
}

/* ── iOS-style toggle (module rows + general use) ─────── */
.toggle {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  display: block;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.15);
  cursor: pointer;
  transition: background .22s;
}
.toggle input:checked + .toggle-track {
  background: #2563eb;
  box-shadow: 0 0 8px rgba(37,99,235,.45);
}
.toggle-track::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .22s cubic-bezier(.34,1.3,.64,1);
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }

/* Make module rows show the toggle properly */
.module-card .toggle { display: block; }

/* ──────────────────────────────────────────────────────────
   TOAST
────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}
.toast {
  min-width: 240px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(13,19,33,.92);
  color: #fff;
  box-shadow: 0 16px 40px rgba(0,0,0,.25);
  font-size: 13px;
  animation: toast-in .2s ease;
}
.toast.ok   { background: rgba(20,83,45,.92); }
.toast.warn { background: rgba(127,29,29,.92); }
@keyframes toast-in { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }

/* ──────────────────────────────────────────────────────────
   LOGIN PAGE
────────────────────────────────────────────────────────── */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-wrap { width: min(400px, calc(100% - 32px)); }
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}
.login-brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 18px;
}
.login-brand-text { font-weight: 900; font-size: 18px; letter-spacing: -.03em; }
.login-card { padding: 26px; }
.login-actions { margin-top: 16px; }
.login-actions button { width: 100%; background: var(--accent); }
.login-err { margin-top: 12px; color: var(--bad); font-weight: 800; font-size: 12.5px; }
.login-note { margin-top: 14px; font-size: 11.5px; color: var(--muted); text-align: center; }

/* ──────────────────────────────────────────────────────────
   SYSTEM LINKAGE — dots, pills, checkboxes, badges
────────────────────────────────────────────────────────── */

/* ── System colour tokens (used across all system components) ──
   Backroom  = blue    #2563eb  rgba(37,99,235)
   Bloodline = rose    #e11d48  rgba(225,29,72)
   Boardroom = purple  #7c3aed  rgba(124,58,237)
───────────────────────────────────────────────────────── */

/* ── Dot indicator ─────────────────────────────────────── */
.sys-check-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
}
.sys-check-dot.backroom  { background: #2563eb; }
.sys-check-dot.bloodline { background: #e11d48; }
.sys-check-dot.boardroom { background: #7c3aed; }
.sys-check-dot.all       { background: #94a3b8; }

/* ── System pills (compact tags in tables / list views) ── */
.sys-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.sys-pill.backroom  { background: rgba(37,99,235,.1);    color: #1d4ed8; }
.sys-pill.bloodline { background: rgba(225,29,72,.1);    color: #be123c; }
.sys-pill.boardroom { background: rgba(124,58,237,.1);   color: #6d28d9; }
.sys-pill.all       { background: rgba(148,163,184,.15); color: var(--muted); }

/* ── System checkbox group (sites.php new/edit form) ─── */
.sys-check-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sys-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--line2);
  background: var(--paper);
  cursor: pointer;
  user-select: none;
  flex: 1;
  min-width: 160px;
  transition: border-color .15s, background .15s;
}
.sys-check input[type="checkbox"] { display: none; }

.sys-check:hover {
  border-color: rgba(37,99,235,.4);
  background: rgba(37,99,235,.03);
}

.sys-check[data-sys="backroom"].checked  { border-color: #2563eb; background: rgba(37,99,235,.06); }
.sys-check[data-sys="bloodline"].checked { border-color: #e11d48; background: rgba(225,29,72,.06); }
.sys-check[data-sys="boardroom"].checked { border-color: #7c3aed; background: rgba(124,58,237,.06); }
.sys-check.checked { border-color: var(--accent); background: rgba(37,99,235,.05); }

/* Text inside system checkbox */
.sys-check-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.sys-check-sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 1px;
  line-height: 1.2;
}

/* ── Customer system badges (customer.php profile header) ── */
.customer-sys-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.customer-sys-badge.backroom  { background: rgba(37,99,235,.1);  color: #1d4ed8; }
.customer-sys-badge.bloodline { background: rgba(225,29,72,.1);  color: #be123c; }
.customer-sys-badge.boardroom { background: rgba(124,58,237,.1); color: #6d28d9; }

/* Dark mode system components */
[data-theme="dark"] .sys-check {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.10);
}
[data-theme="dark"] .sys-check:hover {
  border-color: rgba(37,99,235,.5);
  background: rgba(37,99,235,.08);
}
[data-theme="dark"] .sys-check[data-sys="backroom"].checked  { background: rgba(37,99,235,.14); }
[data-theme="dark"] .sys-check[data-sys="bloodline"].checked { background: rgba(225,29,72,.14); }
[data-theme="dark"] .sys-check[data-sys="boardroom"].checked { background: rgba(124,58,237,.14); }

[data-theme="dark"] .customer-sys-badge.backroom  { background: rgba(37,99,235,.18);  color: #93c5fd; }
[data-theme="dark"] .customer-sys-badge.bloodline { background: rgba(225,29,72,.18);  color: #fda4af; }
[data-theme="dark"] .customer-sys-badge.boardroom { background: rgba(124,58,237,.18); color: #c4b5fd; }

[data-theme="dark"] .sys-pill.backroom  { color: #93c5fd; }
[data-theme="dark"] .sys-pill.bloodline { color: #fda4af; }
[data-theme="dark"] .sys-pill.boardroom { color: #c4b5fd; }

/* ──────────────────────────────────────────────────────────
   RESPONSIVE
────────────────────────────────────────────────────────── */
.burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line2);
  background: rgba(255,255,255,.85);
  cursor: pointer;
}
.burger svg { width: 17px; height: 17px; display: block; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13,19,33,.35);
  backdrop-filter: blur(2px);
  z-index: 60;
}

@media (max-width: 960px) {
  .burger { display: flex; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 72px;
    left: 0;
    bottom: 0;
    width: 268px;
    max-width: 86vw;
    transform: translateX(-110%);
    transition: transform .22s ease;
    z-index: 80;
    height: auto;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .content { padding: 18px 16px 40px; }
  .page-head { flex-direction: column; gap: 10px; }
}
