/* =============================================================================
   IntegrityAI — "Apple UI" theme   (uiVersion = apple)
   A modern, frosted-glass SaaS interface tuned for large tablet & laptop screens.

   ADDITIVE LAYER: loaded AFTER admin.css + app.css and ONLY when this version is
   active, so the Classic (v1) interface stays byte-for-byte unchanged. It re-skins
   the whole app by overriding the shared design tokens + component classes, adds a
   standardized type scale, a centered max-width content shell (identical layout on
   2K/4K — only mobile collapses), and the modern dashboard/chart styles.
   Honors the existing light/dark toggle (data-theme) and the brand teal accent.
   ============================================================================= */

/* ── Design tokens · LIGHT ─────────────────────────────────────────────────── */
:root {
  /* roomier shell */
  --sidebar-w: 264px;
  --topnav-h: 64px;
  --radius: 12px;
  --radius-lg: 18px;
  --transition: 0.22s cubic-bezier(0.32, 0.72, 0, 1);

  /* soft, airy surfaces */
  --bg: #eef2f7;
  --bg-2: #eaeff5;
  --bg-3: #e6ecf3;
  --border: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(15, 23, 42, 0.16);

  /* modern slate text hierarchy (replaces the v1 all-black text) */
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;

  /* glassy chrome */
  --sidebar-bg: rgba(255, 255, 255, 0.62);
  --topnav-bg:  rgba(255, 255, 255, 0.62);
  --card-bg:    rgba(255, 255, 255, 0.74);
  --input-bg:   rgba(255, 255, 255, 0.85);
  --dot-fill:   #ffffff;

  /* teal-forward primary (brand) */
  --accent: #0d9488;
  --accent-fg: #ffffff;
  --ring: rgba(13, 148, 136, 0.18);

  /* Apple system-ish semantic colours */
  --blue: #0a84ff;  --green: #16a34a; --amber: #ea8f00; --red: #ef4444; --violet: #7c3aed;
}

/* standardized modern type scale + glass app backdrop */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Geist", system-ui, sans-serif;
  font-size: 14.5px;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 10% -8%, #d9eaff 0%, transparent 55%),
    radial-gradient(1100px 680px at 100% 0%, #d6f7ef 0%, transparent 52%),
    linear-gradient(180deg, #eef4fb 0%, #e9eff7 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* Match the browser canvas + native controls to the active theme, so navigating between pages in
   dark mode never flashes a white canvas — html paints dark from the very first frame. */
:root { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }
html { background: var(--bg-2); }

/* ── Design tokens · DARK (toggle still works) ─────────────────────────────── */
[data-theme="dark"] {
  --bg: #0b0f15;
  --bg-2: #0e131a;
  --bg-3: #182230;
  --border: rgba(255, 255, 255, 0.09);
  --border-hover: rgba(255, 255, 255, 0.2);

  --text: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;

  --sidebar-bg: rgba(17, 24, 35, 0.6);
  --topnav-bg:  rgba(17, 24, 35, 0.6);
  --card-bg:    rgba(22, 30, 43, 0.66);
  --input-bg:   rgba(28, 38, 52, 0.7);
  --dot-fill:   #0e131a;

  --accent: #2dd4bf;
  --accent-fg: #042f2e;
  --ring: rgba(45, 212, 191, 0.22);
}
[data-theme="dark"] body {
  /* Clean, even dark. The old saturated corner glows (#0e2740 blue, #07312b teal)
     showed as teal/blue bands in the thin strips between the fixed header/footer and
     the content — on both login and admin. A subtle vertical gradient keeps a hint of
     depth without any colored band. */
  background: linear-gradient(180deg, #0c1117 0%, #090d12 100%);
}

/* ============================================================================
   LAYOUT SHELL — centered, capped content so 2K and 4K look IDENTICAL
   (only the side margin grows). Fixed sidebar/topnav stay full-bleed.
   ============================================================================ */
.main-content { padding-bottom: 60px; }
.page { max-width: 1520px; margin: 0 auto; padding: 28px 34px; }
.page:has(.dash-hero) { padding-top: 10px; }   /* dashboard — tighter top padding */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.page-subtitle { font-size: 14px; color: var(--text-2); margin-top: 3px; }

/* ── Frosted sidebar ───────────────────────────────────────────────────────── */
.sidebar {
  background: var(--sidebar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-right: 1px solid var(--border);
  box-shadow: 1px 0 30px rgba(15, 23, 42, 0.05);
}
.sidebar-brand { height: var(--topnav-h); font-size: 16px; }
.nav-section-label { font-size: 11px; letter-spacing: .09em; color: var(--text-3); padding: 16px 10px 6px; }
.nav-item-link { padding: 9px 12px; font-size: 14px; border-radius: 11px; color: var(--text-2); margin-bottom: 2px; }
.nav-item-link i { font-size: 17px; }
.nav-item-link:hover { background: var(--bg-3); color: var(--text); }
.nav-item-link.active { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.nav-item-link.active i { color: var(--accent-fg); }
.nav-item-link.active::before { display: none; }            /* pill replaces the left bar */
.nav-sub-item, .nav-tree-item { font-size: 13.5px; border-radius: 9px; }
.user-card { border-radius: 12px; }
.user-avatar { border-radius: 12px; }

/* ── Frosted top nav ───────────────────────────────────────────────────────── */
.topnav {
  background: var(--topnav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 1px solid var(--border);
  padding: 0 26px;
}
.topnav-search { max-width: 420px; border-radius: 12px; padding: 9px 14px; background: var(--input-bg); }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; }
.header-nav .menu-item > a { font-size: 14px; border-radius: 10px; }

/* ── Glass cards ───────────────────────────────────────────────────────────── */
.card-base, .stat-card, .kpi-card, .modal-box, .dropdown-menu-custom {
  background: var(--card-bg);
  -webkit-backdrop-filter: saturate(170%) blur(20px);
  backdrop-filter: saturate(170%) blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.card-base { padding: 24px; }
.stat-card:hover, .kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
}

/* ── KPI cards ─────────────────────────────────────────────────────────────── */
.kpi-grid { gap: 18px; }
.kpi-card { padding: 22px 22px 18px; }
.kpi-top { margin-bottom: 14px; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.kpi-icon { width: 38px; height: 38px; border-radius: 12px; font-size: 17px; }
.kpi-ic-teal   { background: var(--teal-bg);              color: var(--accent); }
.kpi-ic-green  { background: rgba(22, 163, 74, 0.14);     color: var(--green); }
.kpi-ic-violet { background: rgba(124, 58, 237, 0.14);    color: var(--violet); }
.kpi-ic-amber  { background: rgba(234, 143, 0, 0.16);     color: var(--amber); }
[data-theme="dark"] .kpi-ic-green  { color: #4ade80; }
[data-theme="dark"] .kpi-ic-violet { color: #c4b5fd; }
[data-theme="dark"] .kpi-ic-amber  { color: #fcd34d; }
.kpi-value { font-size: 32px; letter-spacing: -0.02em; margin-bottom: 6px; }
.kpi-foot { margin-bottom: 0; }
.kpi-sub { font-size: 12.5px; color: var(--text-3); }

/* ── Buttons / inputs / badges ─────────────────────────────────────────────── */
.btn-primary-custom {
  background: linear-gradient(180deg, #14b8a6 0%, var(--accent) 100%);
  border-radius: 12px; padding: 10px 18px; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 16px var(--ring);
}
.btn-primary-custom:hover { opacity: 1; filter: brightness(1.05); }
.btn-ghost { border-radius: 11px; padding: 9px 16px; font-size: 14px; }
.form-label { font-size: 14px; }
.form-ctrl { border-radius: 11px; padding: 11px 14px; font-size: 14.5px; }
.form-ctrl:focus { box-shadow: 0 0 0 4px var(--ring); }
.badge-pill { padding: 4px 11px; font-size: 12px; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.tbl th { font-size: 12px; padding: 12px 18px; color: var(--text-3); }
.tbl td { padding: 14px 18px; font-size: 14px; }
.tbl tr:hover td { background: rgba(255, 255, 255, 0.45); }
[data-theme="dark"] .tbl tr:hover td { background: rgba(255, 255, 255, 0.04); }

/* ── Footer (frosted) ──────────────────────────────────────────────────────── */
.app-footer {
  background: var(--topnav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  height: 42px;
}

/* ============================================================================
   MODERN DASHBOARD  (templates/dashboard-apple.html)
   ============================================================================ */
.dash-hero {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 24px;
}
.dash-greet { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.date-pill {
  border-radius: 12px; padding: 9px 14px; font-size: 13px; color: var(--text-2);
  background: var(--card-bg); border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); white-space: nowrap;
}

.dash-grid { display: grid; gap: 18px; margin-top: 18px; }
.dash-grid-2to1 { grid-template-columns: 1.7fr 1fr; align-items: stretch; }

.chart-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.chart-card .chart-header { padding: 18px 20px 14px; }
.chart-card .chart-title { font-size: 15.5px; font-weight: 700; }
.chart-card .chart-sub { font-size: 12.5px; color: var(--text-2); }
.chart-body { padding: 14px 18px 18px; flex: 1; }

/* ── Area chart (audit activity) ───────────────────────────────────────────── */
.area-host { display: flex; align-items: stretch; }
.ac-svg { width: 100%; height: auto; display: block; }
.ac-area { fill: url(#acFill); }
.ac-grad-top { stop-color: var(--accent); stop-opacity: .30; }
.ac-grad-bot { stop-color: var(--accent); stop-opacity: 0; }
.ac-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.ac-dot { fill: var(--dot-fill); stroke: var(--accent); stroke-width: 2; }
.ac-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.ac-ylab { fill: var(--text-3); font-size: 10px; text-anchor: end; }
.ac-xlab { fill: var(--text-3); font-size: 10px; text-anchor: middle; }

/* ── Donut (accounts by tier) ──────────────────────────────────────────────── */
.donut-block { display: flex; align-items: center; gap: 22px; padding: 16px 20px 20px; }
.donut-host { flex: 0 0 auto; width: 150px; }
.donut-svg { width: 150px; height: 150px; display: block; }
.donut-total { text-anchor: middle; fill: var(--text); font-size: 27px; font-weight: 700; }
.donut-cap { text-anchor: middle; fill: var(--text-3); font-size: 11px; }
.tier-legend { flex: 1; display: flex; flex-direction: column; gap: 11px; }
.leg-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.leg-dot { width: 11px; height: 11px; border-radius: 4px; flex: 0 0 auto; }
.leg-name { font-weight: 600; color: var(--text); }
.leg-val { margin-left: auto; font-weight: 700; font-family: 'Geist Mono', monospace; color: var(--text); }

/* ── Activity feed ─────────────────────────────────────────────────────────── */
.feed { padding: 6px 20px 14px; }
.feed-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: none; }
.feed-dot {
  width: 34px; height: 34px; border-radius: 11px; flex: 0 0 auto; display: grid; place-items: center;
  background: var(--teal-bg); color: var(--accent); font-size: 15px;
}
.feed-main { flex: 1; min-width: 0; }
.feed-action { font-weight: 600; font-size: 13.5px; color: var(--text); }
.feed-sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-actor { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.feed-empty { padding: 18px 0; color: var(--text-3); font-size: 13.5px; }

/* ── Horizontal bars (entities by category) ────────────────────────────────── */
.hbar-list { display: flex; flex-direction: column; gap: 18px; padding: 18px 20px 22px; }
.hbar-row { display: flex; align-items: center; gap: 12px; }
.hbar-label { width: 52px; font-size: 13px; font-weight: 600; color: var(--text); flex: 0 0 auto; }
.hbar-track { flex: 1; height: 10px; border-radius: 99px; background: var(--bg-3); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 99px; min-width: 4px; transition: width .7s cubic-bezier(.4,0,.2,1); }
.hbar-val { width: 30px; text-align: right; font-size: 13px; font-weight: 700; font-family: 'Geist Mono', monospace; color: var(--text); flex: 0 0 auto; }

/* ============================================================================
   Login / public landing — frosted big-screen treatment
   ============================================================================ */
.lp { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif; }
.lp-main, .login-wrap {
  background:
    radial-gradient(1200px 620px at 80% -10%, #d6f7ef 0%, transparent 55%),
    radial-gradient(1000px 600px at 4% 0%, #d9eaff 0%, transparent 50%),
    linear-gradient(180deg, #eef4fb, #e6edf6);
}
.lp-header, .lp-footer {
  background: rgba(255, 255, 255, 0.62);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
.lp-panel {
  background: rgba(255, 255, 255, 0.74);
  -webkit-backdrop-filter: saturate(170%) blur(22px);
  backdrop-filter: saturate(170%) blur(22px);
  border-radius: 22px; padding: 32px 34px; max-width: 480px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.lp-input, .lp-select { border-radius: 12px; padding: 12px 14px; }
.lp-btn { border-radius: 13px; padding: 13px; box-shadow: 0 8px 20px rgba(13, 148, 136, 0.28); }
[data-theme="dark"] .lp-main, [data-theme="dark"] .login-wrap {
  /* Don't stack a second glow layer on top of body — it doubled the tint into a
     visible band above and below the login card. Let the clean body background show. */
  background: transparent;
}
[data-theme="dark"] .lp-header, [data-theme="dark"] .lp-footer { background: rgba(17, 24, 35, 0.6); }
[data-theme="dark"] .lp-panel { background: rgba(22, 30, 43, 0.66); }

/* ── Apple UI login: split — animated network globe (left) + login form (right) ──────────── */
.lp-split {
  grid-template-columns: 1fr clamp(420px, 38%, 520px);
  grid-template-rows: 1fr;
  /* Counter the global 1440-design zoom so the split maps to exactly one viewport
     (no page scroll on wide / zoom>1 screens). --zoom is published by the scaler. */
  min-height: calc(100vh / var(--zoom, 1));
  height: calc(100vh / var(--zoom, 1));
  place-items: stretch;
  padding: 0;
  max-width: none;
  gap: 0;
}
.lp-split .lp-showcase { grid-column: 1; grid-row: 1; }                  /* globe → left */
.lp-split .lp-panel { grid-column: 2; grid-row: 1; place-self: center; margin: 80px 30px 58px;
  /* On unusually short windows the form scrolls inside the card, never the page. */
  max-height: calc((100vh / var(--zoom, 1)) - 138px); overflow-y: auto; }

/* Left panel follows the theme — light in light mode, dark in dark mode — and the world-map
   animation (canvas) re-colours to match. The form on the right keeps the theme too. */
.lp-showcase {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 0 56px 56px;
  color: #25323a;
  background: radial-gradient(860px 780px at 50% 42%, #e8f4f0, #d8e6ef 74%);
}
[data-theme="dark"] .lp-showcase {
  color: #e8eef2;
  background: radial-gradient(860px 780px at 50% 42%, #0c1a22, #06090d 74%);
}
.lp-globe { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.lp-show-head { position: relative; z-index: 2; max-width: 480px; }
.lp-show-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: .02em; color: #0d9488;
}
[data-theme="dark"] .lp-show-kicker { color: #7dd3c0; }
.lp-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #0d9488;
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.16); animation: lpPulse 1.8s ease-in-out infinite;
}
[data-theme="dark"] .lp-dot { background: #2dd4bf; box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.16); }
@keyframes lpPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.lp-show-title {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  font-size: clamp(30px, 3vw, 46px); font-weight: 800; letter-spacing: .01em;
  margin: 14px 0 10px;
  /* Brand wordmark colours — FIXED per client requirement (match the logo), same in every theme. */
  color: #3da82b;            /* INTEGRITY — brand green  */
}
.lp-show-title span { color: #f5821f; }   /* AI — brand orange */
.lp-show-sub { font-size: 14.5px; line-height: 1.55; color: #5a6b75; max-width: 380px; }
[data-theme="dark"] .lp-show-sub { color: #9fb0bd; }

@media (max-width: 980px) {
  .lp-split { grid-template-columns: 1fr; place-items: center; }
  .lp-showcase { display: none; }
  .lp-split .lp-panel { grid-column: auto; margin: 88px 20px 70px; }
}

/* ============================================================================
   RESPONSIVE — desktop layout is identical 1024px → 4K; only mobile collapses
   ============================================================================ */
@media (max-width: 992px) {
  .dash-grid-2to1 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .page { max-width: 100%; padding: 18px 16px; }
  .dash-hero { flex-direction: column; }
  .donut-block { flex-direction: column; align-items: stretch; }
  .donut-host { align-self: center; }
}

/* ============================================================================
   REFINEMENTS — floating card sidebar · full-collapse menu · readable frosted
   dropdowns · bigger top-nav type · client-adjustable font size
   ============================================================================ */
:root {
  --sb-gap: 14px;
  --sb-offset: calc(var(--sidebar-w) + 28px);   /* sidebar width + gap on both sides */
  --fs: 1;                                       /* client font-scale (set on <html> by the head) */
  --menu-bg: rgba(255, 255, 255, 0.94);
  --menu-border: rgba(15, 23, 42, 0.10);
}
[data-theme="dark"] {
  --menu-bg: rgba(20, 27, 38, 0.95);
  --menu-border: rgba(255, 255, 255, 0.12);
}

/* ── Sidebar as a floating card ────────────────────────────────────────────── */
.sidebar {
  top: var(--sb-gap); left: var(--sb-gap); bottom: var(--sb-gap);
  height: auto;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}
.sidebar-brand { border-radius: 22px 22px 0 0; }
.main-content {
  margin-left: var(--sb-offset);
  padding-top: calc(66px + var(--sb-gap));    /* content starts right at the top bar's bottom edge */
}
/* Top bar as a floating rounded card (matches the sidebar) */
.topnav {
  top: var(--sb-gap);
  left: var(--sb-offset);
  right: var(--sb-gap);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.10);
  padding: 0 22px;
  transition: left var(--transition);
}
/* Mask behind the floating top bar — paints the SAME fixed page gradient over the gap, so the
   area looks identical to the background (UI unchanged) yet hides page content that scrolls up
   into the gap above/around the bar. */
body::after {
  content: '';
  position: fixed;
  top: 0; left: var(--sb-offset); right: 0;
  height: calc(66px + var(--sb-gap));   /* covers only the gap above + the bar — not below it */
  background: inherit;      /* same gradient + background-attachment:fixed as <body> → seamless */
  z-index: 1025;            /* above content, below the top bar (1030) and sidebar (1040) */
  pointer-events: none;
  transition: left var(--transition);
}
.app-footer { left: var(--sb-offset); transition: left var(--transition); }

/* ── Full-collapse menu system (toggle in the top bar) ─────────────────────── */
html.nav-collapsed .sidebar      { transform: translateX(-120%); }
html.nav-collapsed .main-content { margin-left: var(--sb-gap); }
html.nav-collapsed .topnav       { left: var(--sb-gap); }
html.nav-collapsed .app-footer   { left: var(--sb-gap); }
html.nav-collapsed body::after   { left: var(--sb-gap); }
.nav-collapse-btn { flex: 0 0 auto; }

/* ── Footer as a floating rounded card (matches the sidebar + top bar) ──────── */
.app-footer {
  left: var(--sb-offset);
  right: var(--sb-gap);
  bottom: var(--sb-gap);
  justify-content: flex-end;       /* right-align the footer text */
  gap: 14px;
  border: none;                    /* no outline line — card is defined by fill + shadow */
  border-radius: 14px;
  background: var(--menu-bg);      /* opaque frosted fill → a clear, distinct card */
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}
.main-content { padding-bottom: calc(42px + var(--sb-gap)); }   /* content runs right up to the footer's top edge */
/* Mask behind the floating footer — same seamless-gradient trick as the top bar, so scrolled
   content never shows in the gap around/below it. */
body::before {
  content: '';
  position: fixed;
  bottom: 0; left: var(--sb-offset); right: 0;
  height: calc(42px + var(--sb-gap));   /* covers only the footer + the gap below it — not above */
  background: inherit;
  z-index: 1019;            /* above content, below the footer (1020) */
  pointer-events: none;
  transition: left var(--transition);
}
html.nav-collapsed body::before { left: var(--sb-gap); }

/* ── Bigger, clearer top-nav type ──────────────────────────────────────────── */
.topnav { height: 66px; }
.header-nav .menu-item > a { font-size: calc(15.5px * var(--fs)); font-weight: 400; padding: 8px 12px; }
.header-nav .menu-item > a .bi { font-size: 15px; }
.topnav-search input { font-size: calc(14.5px * var(--fs)); }

/* ── Readable dropdown menus — opaque frosted glass so page text never bleeds through ── */
.header-nav .menu-dd,
.dropdown-menu-custom {
  background: var(--menu-bg);
  -webkit-backdrop-filter: saturate(180%) blur(26px);
  backdrop-filter: saturate(180%) blur(26px);
  border: 1px solid var(--menu-border);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}
.header-nav .menu-dd .menu-item > a { font-size: calc(14px * var(--fs)); }

/* ============================================================================
   CLIENT FONT-SIZE CONTROL — every text size scales with --fs (Settings → Text size)
   ============================================================================ */
body              { font-size: calc(14.5px * var(--fs)); }
.page-title       { font-size: calc(26px   * var(--fs)); }
.page-subtitle    { font-size: calc(14px   * var(--fs)); }
.dash-greet       { font-size: calc(13px   * var(--fs)); }
.date-pill        { font-size: calc(13px   * var(--fs)); }
.sidebar-brand    { font-size: calc(16px   * var(--fs)); }
.nav-section-label{ font-size: calc(11px   * var(--fs)); }
.nav-item-link    { font-size: calc(14px   * var(--fs)); }
.nav-sub-item, .nav-tree-item { font-size: calc(13.5px * var(--fs)); }
.kpi-label        { font-size: calc(13px   * var(--fs)); }
.kpi-value        { font-size: calc(32px   * var(--fs)); }
.kpi-sub          { font-size: calc(12.5px * var(--fs)); }
.chart-card .chart-title { font-size: calc(15.5px * var(--fs)); }
.chart-card .chart-sub   { font-size: calc(12.5px * var(--fs)); }
.tbl th           { font-size: calc(12px   * var(--fs)); }
.tbl td           { font-size: calc(14px   * var(--fs)); }
.badge-pill       { font-size: calc(12px   * var(--fs)); }
.btn-primary-custom, .btn-ghost { font-size: calc(14px * var(--fs)); }
.form-label       { font-size: calc(14px   * var(--fs)); }
.form-ctrl        { font-size: calc(14.5px * var(--fs)); }
.dropdown-item-custom { font-size: calc(13.5px * var(--fs)); }
.leg-row, .feed-action, .hbar-label { font-size: calc(13.5px * var(--fs)); }
.feed-sub, .feed-actor { font-size: calc(12px * var(--fs)); }
.donut-total      { font-size: calc(27px   * var(--fs)); }

/* ── Mobile: the card sidebar returns to a flush full-height drawer ─────────── */
@media (max-width: 768px) {
  .main-content { margin-left: 0; padding-top: var(--topnav-h); }
  .topnav {
    top: 0; left: 0; right: 0;
    border: none; border-bottom: 1px solid var(--border);
    border-radius: 0; box-shadow: none;
  }
  body::after, body::before { display: none; }   /* mobile bars are flush; frost real content like iOS */
  .main-content { padding-bottom: 56px; }
  .app-footer {
    left: 0; right: 0; bottom: 0;
    border: none; border-top: 1px solid var(--border);
    border-radius: 0; box-shadow: none;
  }
  .sidebar {
    top: 0; left: 0; bottom: 0; height: auto;
    border: none; border-right: 1px solid var(--border);
    border-radius: 0; box-shadow: none; transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 16px 44px rgba(15, 23, 42, 0.28); }
  .sidebar-brand { border-radius: 0; }
  .nav-collapse-btn { display: none; }   /* mobile uses the existing hamburger */
}

/* ============================================================================
   DATA TABLES & CREATE-FORMS  (Users · Entities · Content / Articles · LC Process)
   ============================================================================ */

/* Create-form + list pages currently sit side-by-side (inline 1fr 1.2fr / 1.3fr grids), which
   cramps the 6–8 column tables. Stack them: form on top, table full-width below. */
.page [style*="grid-template-columns:1fr 1.2fr"],
.page [style*="grid-template-columns:1fr 1.3fr"] {
  grid-template-columns: 1fr !important;
}
/* Keep the create-form readable instead of stretched edge-to-edge in its now-full-width card. */
.page [style*="grid-template-columns:1fr 1.2fr"] > .card-base:first-child .form-grid,
.page [style*="grid-template-columns:1fr 1.3fr"] > .card-base:first-child .form-grid {
  max-width: 820px;
}

/* A table-card may scroll sideways on small screens instead of breaking the layout. */
.card-base:has(> .tbl) { overflow-x: auto; }

/* Compact action buttons inside table rows — the themed ghost button is too big for cells. */
.tbl td .btn-ghost,
.tbl td .btn-primary-custom {
  padding: 6px 10px;
  font-size: calc(13px * var(--fs));
  border-radius: 9px;
  gap: 5px;
}
.tbl td form { margin: 0; display: inline-flex; }
.tbl td:last-child { white-space: nowrap; }
.tbl th { white-space: nowrap; }

/* Forms: a little more breathing room + clearer labels. */
.form-grid { gap: 16px 18px; }
.form-label { margin-bottom: 7px; font-weight: 600; }

/* Section tab bars (Content / Entities) — align with the spacious type scale. */
.content-tabs { gap: 6px; margin-bottom: 18px; }
.content-tab { font-size: calc(14px * var(--fs)); padding: 10px 15px; border-radius: 10px 10px 0 0; }
