/* ── Dark theme for the admin panel ──────────────────────────────────
   The portal's dark theme (portal/public/css/dark.css) on the admin
   panel's class names. Switched on by <html class="theme-dark">: the
   head script applies it before paint, the top bar's sun/moon flips it,
   and the choice (localStorage `dg-theme`) is shared with the portal on
   the same device.

   Most colour comes from the variables, redefined here; components that
   hard code white are listed below. Text is near-white throughout (the
   light theme's "no grey text" holds here as "no dim text"). */

html.theme-dark{
  color-scheme:dark;
  --bg:#2A3A6B;--surface:#2C3D70;
  --text:#FFFFFF;--text-2:#F3F6FC;--text-3:#D6DEEC;
  --border:#41558E;--border-2:#4E64A2;
  --brand:#7DB4FF;--brand-600:#5C9BF5;--brand-50:#28478F;--brand-100:#3056A6;
  --accent:#5EE2D2;--accent-50:rgba(22,184,166,.2);
  --amber:#FFC861;--amber-50:rgba(245,165,36,.2);
  --red:#FF8A98;--red-50:rgba(239,84,102,.2);
  --purple:#C4B5FD;--purple-50:rgba(139,92,246,.22);
  --shadow:0 2px 8px rgba(0,0,0,.12);--shadow-md:0 12px 32px rgba(0,0,0,.22);
}
html.theme-dark body,html.theme-dark .glass{
  color:var(--text);background:#33417A;
  --glass-bg:rgba(30,44,92,.72);
  --glass-bg-strong:rgba(28,40,86,.92);
  --glass-border:rgba(255,255,255,.16);
  --glass-shadow:0 2px 8px rgba(0,0,0,.12),inset 0 1px 0 rgba(255,255,255,.05);
}
/* The same five-colour wash, over a base about 40% darker. */
html.theme-dark .glass::before{
  background:
    radial-gradient(820px 620px at 12% 8%,rgba(59,130,246,.70),transparent 62%),
    radial-gradient(760px 600px at 52% 50%,rgba(139,92,246,.48),transparent 66%),
    radial-gradient(900px 700px at 90% 94%,rgba(20,200,180,.62),transparent 62%),
    linear-gradient(160deg,#34478E 0%,#4A3A8C 50%,#1F5F73 100%);
}
html.theme-dark .glass::after{
  background:
    radial-gradient(720px 560px at 90% 10%,rgba(236,72,153,.42),transparent 60%),
    radial-gradient(700px 580px at 12% 90%,rgba(245,165,36,.36),transparent 62%);
}
html.theme-dark{--dg-wash:
  radial-gradient(820px 620px at -8% -12%,rgba(59,130,246,.70),transparent 62%),
  radial-gradient(760px 600px at 50% 46%,rgba(139,92,246,.48),transparent 66%),
  radial-gradient(900px 700px at 98% 106%,rgba(20,200,180,.62),transparent 62%),
  linear-gradient(160deg,#34478E 0%,#4A3A8C 50%,#1F5F73 100%)}

/* ── Surfaces ────────────────────────────────────────────────────── */
html.theme-dark .glass .sidebar,html.theme-dark .glass .topbar{background:rgba(24,36,78,.72) !important;border-color:var(--glass-border) !important}
html.theme-dark .glass .card,html.theme-dark .glass .kpi,html.theme-dark .glass .stat-tile,html.theme-dark .glass .fac-card,html.theme-dark .glass .q-doc-card{background:var(--glass-bg) !important;border-color:var(--glass-border) !important}
html.theme-dark .glass .bell-panel,html.theme-dark .glass .profile-dropdown,html.theme-dark .glass .modal-box,
html.theme-dark .swal2-popup,html.theme-dark .combo-list{background:var(--glass-bg-strong) !important;border-color:var(--border) !important;color:var(--text) !important}
html.theme-dark .swal2-title,html.theme-dark .swal2-html-container{color:var(--text) !important}
html.theme-dark .card-h,html.theme-dark .modal-head,html.theme-dark .modal-foot{border-color:rgba(255,255,255,.12) !important}

/* ── Sidebar and top bar ─────────────────────────────────────────── */
html.theme-dark .glass .sb-link:not(.active),html.theme-dark .glass .sb-link:not(.active) i,
html.theme-dark .glass .sb-group-label,html.theme-dark .glass .sb-group-label .group-caret{color:#fff}
html.theme-dark .glass .sb-link:not(.active):hover{background:rgba(255,255,255,.1)}
html.theme-dark .glass .sb-brand::after{background:linear-gradient(90deg,rgba(255,255,255,0),rgba(255,255,255,.2) 18%,rgba(255,255,255,.2) 82%,rgba(255,255,255,0))}
html.theme-dark .sb-logo,html.theme-dark .sb-logo .brand{color:#fff}
html.theme-dark .glass .tb-toggle,html.theme-dark .glass .tb-icon-btn,html.theme-dark .glass .tb-search,html.theme-dark .glass .tb-profile{
  background:rgba(255,255,255,.06) !important;border-color:rgba(255,255,255,.2) !important;color:#fff}
html.theme-dark .glass .tb-toggle:hover,html.theme-dark .glass .tb-icon-btn:hover,html.theme-dark .glass .tb-profile:hover{background:rgba(255,255,255,.14) !important}
html.theme-dark .tb-search input{color:#fff}
html.theme-dark .glass .topbar::after{opacity:.5}

/* ── Controls ─────────────────────────────────────────────────────── */
html.theme-dark input:not([type=checkbox]):not([type=radio]):not([type=range]),html.theme-dark select,html.theme-dark textarea,
html.theme-dark .f-input,html.theme-dark .glass .f-input,html.theme-dark .mini-select,html.theme-dark .search-inp{
  background-color:rgba(255,255,255,.08) !important;color:var(--text) !important;border-color:rgba(255,255,255,.18) !important;
}
html.theme-dark .tb-search input,html.theme-dark .search-inp input{background:transparent !important;border:0 !important}
html.theme-dark input:not([type=checkbox]):not([type=radio]):focus,html.theme-dark select:focus,html.theme-dark textarea:focus,html.theme-dark .f-input:focus{
  background-color:rgba(255,255,255,.12) !important;border-color:#6EA2FF !important;box-shadow:0 0 0 3px rgba(110,162,255,.22) !important;outline:none;
}
html.theme-dark option{background:#22365A;color:var(--text)}
html.theme-dark ::placeholder{color:#AEBBD0;opacity:1}
html.theme-dark input[type=date]::-webkit-calendar-picker-indicator{filter:invert(1)}
html.theme-dark .glass .btn-ghost,html.theme-dark .ico-btn,html.theme-dark .glass .chip,html.theme-dark .glass .seg,html.theme-dark .appr-btn{
  background:rgba(255,255,255,.06) !important;color:var(--text) !important;border-color:var(--border-2) !important;
}
html.theme-dark .glass .btn-ghost:hover,html.theme-dark .ico-btn:hover{background:rgba(255,255,255,.14) !important}
html.theme-dark .glass .chip.on{background:#3B82F6 !important;border-color:#8EC5FF !important;color:#fff !important}
html.theme-dark .glass .seg button:not(.active),html.theme-dark .glass .seg a:not(.active){color:#fff}

/* ── Tables ──────────────────────────────────────────────────────── */
html.theme-dark .glass .content table > tbody > tr > td{background:rgba(255,255,255,.06) !important;border-color:rgba(255,255,255,.16) !important;color:var(--text)}
html.theme-dark .glass .content table > thead th{border-color:rgba(255,255,255,.16) !important;color:#fff !important}
html.theme-dark .glass table tbody tr:hover > td{background-color:rgba(255,255,255,.11) !important}
html.theme-dark .tbl-pagination{border-color:rgba(255,255,255,.12)}

/* ── Badges and tags ─────────────────────────────────────────────── */
html.theme-dark .glass .b-green,html.theme-dark .glass .t-green{background:rgba(22,184,166,.18);color:#5EE2D2;border-color:rgba(94,226,210,.45)}
html.theme-dark .glass .b-red{background:rgba(239,84,102,.18);color:#FF8A98;border-color:rgba(255,138,152,.45)}
html.theme-dark .glass .b-amber,html.theme-dark .glass .t-amber{background:rgba(245,165,36,.18);color:#FFC861;border-color:rgba(255,200,97,.45)}
html.theme-dark .glass .b-blue,html.theme-dark .glass .t-blue{background:rgba(59,130,246,.2);color:#CFE0FF;border-color:rgba(156,193,255,.45)}
html.theme-dark .glass .b-purple,html.theme-dark .glass .t-purple{background:rgba(139,92,246,.22);color:#DDD3FF;border-color:rgba(196,181,253,.45)}
html.theme-dark .glass .t-gray{background:rgba(255,255,255,.08);color:#fff;border-color:rgba(255,255,255,.22)}

/* ── Hard-coded light backgrounds in page markup ─────────────────── */
html.theme-dark .content [style*="background:#fff"],html.theme-dark .content [style*="background: #fff"],
html.theme-dark .content [style*="background:#FFF"],html.theme-dark .content [style*="background:white"],
html.theme-dark .content [style*="background:#F8FAFC"],html.theme-dark .content [style*="background:#F6F8FA"],
html.theme-dark .content [style*="background:#F1F5F9"]{background:rgba(255,255,255,.06) !important}
html.theme-dark .content [style*="color:#1A2533"],html.theme-dark .content [style*="color:#0C1B33"],html.theme-dark .content [style*="color:#111"]{color:#fff !important}

/* The logo mark is dark ink: drawn light here; "Gini" in light blue. */
html.theme-dark .logo-mark img{filter:brightness(0) invert(1)}
html.theme-dark .sb-logo .q{color:#8EC5FF}
html.theme-dark .kpi-trend.trend-up{background:rgba(22,184,166,.18);color:#5EE2D2;border-color:rgba(94,226,210,.45)}
html.theme-dark .kpi-trend.trend-dn{background:rgba(239,84,102,.18);color:#FF8A98;border-color:rgba(255,138,152,.45)}
