/* Super Admin visual design. Everything is scoped to body.sa, which only the Super Admin's pages carry, so no other
 * role is affected. Looks only: no element is added, removed or re-wired by this file. */
/* ---- palettes: sa-theme.js sets data-sa="light" | "dark" on Super Admin pages only ---- */
:root[data-sa] { --radius: 16px; --grad: linear-gradient(135deg, #4f46e5, #7c3aed 55%, #2563eb); }
:root[data-sa="light"] {
  color-scheme: light;
  --bg: #f5f6fb; --surface: #ffffff; --text: #141a2e; --muted: #5d667e; --border: #e6e8f2;
  --primary: #4f46e5; --primary-d: #4338ca; --primary-soft: #eeedfd;
  --green: #0b7a55; --green-soft: #e4f7ee; --amber: #a85608; --amber-soft: #fff2dc; --red: #c0262d; --red-soft: #fdebec;
  --shadow: 0 1px 2px rgba(20,26,46,.04), 0 8px 24px -12px rgba(20,26,46,.14);
  --lift: 0 2px 4px rgba(20,26,46,.05), 0 18px 36px -16px rgba(79,70,229,.32);
  --side: linear-gradient(185deg, #ffffff 0%, #fbfbff 55%, #f4f4fd 100%); --side-text: #4c5573; --side-strong: #141a2e;
  --side-group: #8a91ab; --side-hover: #eeeffb; --side-line: #e6e8f2; --side-tile: #f7f7fd; --side-bar: #ffffff; --glow: rgba(124,58,237,.09);
}
:root[data-sa="dark"] {
  color-scheme: dark;
  --bg: #0a0d18; --surface: #121729; --text: #e9ecf7; --muted: #99a2bd; --border: #232a42;
  --primary: #8b87ff; --primary-d: #a5a2ff; --primary-soft: #211f4d;
  --green: #4fd8a4; --green-soft: #10322a; --amber: #f4b95f; --amber-soft: #37280f; --red: #ff8489; --red-soft: #391a20;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 28px -14px rgba(0,0,0,.65);
  --lift: 0 2px 6px rgba(0,0,0,.4), 0 20px 40px -18px rgba(124,108,255,.45);
  --side: linear-gradient(185deg, #171a3a 0%, #0e1126 55%, #0a0c1c 100%); --side-text: #aab1d1; --side-strong: #ffffff;
  --side-group: #6b7399; --side-hover: rgba(255,255,255,.07); --side-line: rgba(255,255,255,.08); --side-tile: rgba(255,255,255,.04); --side-bar: #12152f; --glow: rgba(124,58,237,.12);
}
body.sa {
  font-family: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 14.5px; letter-spacing: .001em;
  background: radial-gradient(900px 420px at 100% -10%, var(--glow), transparent 70%), var(--bg);
  background-attachment: fixed; min-height: 100vh;
}
body.sa h1 { font-size: 1.7rem; font-weight: 750; letter-spacing: -.022em; }
body.sa h2 { font-size: 1.08rem; font-weight: 700; letter-spacing: -.01em; }

/* ---- navigation ---- */
body.sa .shell { grid-template-columns: 264px minmax(0, 1fr); }
body.sa .sidebar { background: var(--side); color: var(--side-text); padding: 20px 14px; scrollbar-width: thin; scrollbar-color: var(--side-line) transparent; border-right: 1px solid var(--side-line); }
body.sa .brand { color: var(--side-strong); font-size: 1.2rem; letter-spacing: -.02em; padding: 2px 10px 20px; gap: 11px; }
body.sa .brand i { width: 34px; height: 34px; border-radius: 11px; background: var(--grad); box-shadow: 0 8px 20px -6px rgba(124,58,237,.75); position: relative; }
body.sa .brand i::after { content: ""; position: absolute; inset: 10px; border: 2.5px solid #fff; border-radius: 5px; }
body.sa .sidebar nav a { display: flex; align-items: center; gap: 11px; color: var(--side-text); padding: 9px 12px; margin-bottom: 2px; border-radius: 11px; font-weight: 500; transition: background .18s, color .18s, transform .18s; }
body.sa .sidebar nav a:hover { background: var(--side-hover); color: var(--side-strong); transform: translateX(2px); }
body.sa .sidebar nav a.active { background: linear-gradient(100deg, #4f46e5, #7c3aed); color: #fff; font-weight: 600; box-shadow: 0 10px 22px -10px rgba(124,58,237,.9); }
body.sa .sidebar nav a svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
body.sa .sidebar nav a .nav-badge { margin-left: auto; }
body.sa .nav-group { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--side-group); padding: 16px 12px 6px; }
body.sa .sidebar .me { border: 1px solid var(--side-line); background: var(--side-tile); color: var(--side-strong); border-radius: 14px; padding: 12px; margin-top: 18px; }
body.sa .sidebar .me button { background: var(--surface); color: var(--side-strong); border-color: var(--side-line); justify-content: center; }
body.sa .sidebar .me button:hover { background: var(--side-hover); }
body.sa .nav-group:first-child { padding-top: 0; }

/* ---- page frame ---- */
body.sa .sa-col { min-width: 0; display: flex; flex-direction: column; }
body.sa .sa-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 32px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
body.sa .sa-crumb { color: var(--muted); font-size: .85rem; } body.sa .sa-crumb b { color: var(--text); font-weight: 650; }
body.sa .sa-user { display: flex; align-items: center; gap: 10px; font-size: .85rem; font-weight: 600; }
body.sa .sa-user small { display: block; color: var(--muted); font-weight: 500; line-height: 1.2; }
body.sa .sa-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; }
body.sa .main { padding: 26px 32px 48px; max-width: 1480px; width: 100%; }

/* ---- cards and figures ---- */
body.sa .card { border-radius: var(--radius); padding: 22px; transition: box-shadow .2s, border-color .2s; }
body.sa .cards { gap: 14px; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
body.sa .stat { position: relative; overflow: hidden; padding: 20px 22px; --tone: var(--primary); }
body.sa .stat.green { --tone: var(--green); } body.sa .stat.amber { --tone: var(--amber); } body.sa .stat.red { --tone: var(--red); }
body.sa .stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--tone); }
body.sa .stat::after { content: ""; position: absolute; width: 110px; height: 110px; right: -38px; top: -44px; border-radius: 50%; background: var(--tone); opacity: .09; }
body.sa .stat:hover { transform: translateY(-2px); box-shadow: var(--lift); } body.sa .stat { transition: transform .2s, box-shadow .2s; }
body.sa .stat .n { font-size: 2.1rem; font-weight: 780; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
body.sa .stat .l { font-weight: 550; }
body.sa .charts, body.sa .two { gap: 16px; }
body.sa .bar { height: 7px; } body.sa .bar > i { background: linear-gradient(90deg, var(--green), color-mix(in srgb, var(--green) 55%, #38bdf8)); border-radius: 9px; transition: width .4s; }

/* ---- controls ---- */
body.sa button, body.sa .btn { border-radius: 11px; font-weight: 550; transition: transform .12s, box-shadow .18s, background .18s, border-color .18s; }
body.sa button:hover:not(:disabled), body.sa .btn:hover { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); box-shadow: 0 6px 16px -10px rgba(79,70,229,.6); }
body.sa button:active:not(:disabled), body.sa .btn:active { transform: translateY(1px); }
body.sa button.primary, body.sa .btn.primary, body.sa .subtabs button.on, body.sa .tabs button.on { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 10px 20px -12px rgba(79,70,229,.95); }
body.sa button.primary:hover:not(:disabled), body.sa .btn.primary:hover { background: var(--grad); filter: brightness(1.09); }
body.sa button.danger.solid { background: var(--red); }
body.sa input, body.sa select, body.sa textarea { border-radius: 11px; transition: border-color .18s, box-shadow .18s; }
body.sa input:focus, body.sa select:focus, body.sa textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); outline: none; }
body.sa input[type=checkbox], body.sa input[type=radio] { accent-color: var(--primary); }
body.sa label { color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
body.sa .subtabs button { border-radius: 99px; padding-inline: 16px; }
body.sa .badge { padding: 3px 10px; }

/* ---- tables ---- */
body.sa .table-wrap { box-shadow: var(--shadow); }
body.sa th { font-size: .7rem; letter-spacing: .08em; padding-block: 12px; background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
body.sa td { padding-block: 13px; }
body.sa tbody tr { transition: background .15s; } body.sa tbody tr:hover td:not(.sticky-r) { background: color-mix(in srgb, var(--primary) 4%, transparent); }

/* ---- pop-ups, messages, sign in ---- */
body.sa .overlay { backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
body.sa .modal { border-radius: 20px; padding: 26px; border: 1px solid var(--border); animation: pop .22s ease; }
body.sa .toast { border-radius: 13px; box-shadow: 0 16px 32px -14px rgba(0,0,0,.45); }
body.sa .alert, body.sa .alert-banner { border-radius: 14px; }
body.sa .center-page { background: radial-gradient(700px 420px at 15% 10%, rgba(79,70,229,.2), transparent 70%), radial-gradient(700px 480px at 90% 90%, rgba(37,99,235,.16), transparent 70%); }
body.sa .center-page .panel { padding: 34px; border-radius: 22px; box-shadow: var(--lift); position: relative; overflow: hidden; }
body.sa .center-page .panel::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--grad); }

/* ---- Light | Dark switch ---- */
body.sa .sa-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); }
body.sa .sa-switch button { min-height: 30px; padding: 4px 12px; border: 0; border-radius: 99px; background: transparent; color: var(--muted); font-size: .82rem; box-shadow: none; }
body.sa .sa-switch button[aria-pressed="true"] { background: var(--grad); color: #fff; }
body.sa .sa-switch svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.sa .topbar .sa-switch { display: none; }
body.sa .sa-tools { display: flex; align-items: center; gap: 18px; }
body.sa .center-page > .sa-switch { position: fixed; top: 16px; right: 16px; }

/* ---- tablet and phone ---- */
@media (max-width: 1100px) { body.sa .shell { grid-template-columns: 232px minmax(0, 1fr); } body.sa .main { padding: 22px 20px 40px; } body.sa .sa-bar { padding-inline: 20px; } }
@media (max-width: 800px) {
  body.sa .shell { grid-template-columns: minmax(0, 1fr); }
  body.sa .sidebar { width: min(284px, 86vw); height: auto; transition: transform .25s ease; }
  body.sa.nav-open .sidebar { box-shadow: 0 0 60px rgba(0,0,0,.4); }        /* only while open: closed, it would shade the page */
  body.sa .topbar { background: var(--side-bar); color: var(--side-strong); border-bottom: 1px solid var(--side-line); }
  body.sa .topbar button { color: var(--side-strong); border-color: var(--side-line); }
  body.sa .topbar .sa-switch { display: inline-flex; margin-left: auto; }
  body.sa .topbar .sa-switch span { display: none; }
  body.sa.nav-open .shell::before { content: ""; position: fixed; inset: 0; background: rgba(8,10,24,.55); z-index: 35; }
  body.sa .sa-bar { display: none; }
  body.sa .main { padding: 16px 14px 32px; }
  body.sa h1 { font-size: 1.4rem; }
  body.sa .card { padding: 16px; } body.sa .cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  body.sa .stat { padding: 14px 16px; } body.sa .stat .n { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) { body.sa *, body.sa *::before, body.sa *::after { animation: none !important; transition: none !important; } }
@media print { body.sa { background: #fff !important; } }
