/* =========================================================
   WhatsPlatform Premium Client UI
   Modern / Kurumsal / Premium / Dark-Light Ready
   ========================================================= */

/* ---------- Root Tokens ---------- */
:root{
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 6px 20px rgba(15, 23, 42, .06);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, .08);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, .12);

  --ring: 0 0 0 4px rgba(79, 70, 229, .10);

  --sidebar-w: 280px;
  --topbar-h: 76px;
  --content-max: 100%;

  --prim: #4f46e5;
  --prim-2: #6366f1;
  --prim-3: #818cf8;
  --pp: var(--prim);

  --success: #16a34a;
  --success-soft: rgba(22,163,74,.12);

  --danger: #dc2626;
  --danger-soft: rgba(220,38,38,.12);

  --warning: #d97706;
  --warning-soft: rgba(217,119,6,.12);

  --info: #2563eb;
  --info-soft: rgba(37,99,235,.12);

  --wa: #25d366;
  --wa-soft: rgba(37,211,102,.12);

  --bg0: #f5f7fb;
  --bg1: #ffffff;
  --bg2: #ffffff;
  --bg3: #f8fafc;
  --bg4: #eef2ff;

  --tx0: #0f172a;
  --tx1: #334155;
  --tx2: #64748b;
  --tx3: #94a3b8;

  --bdr: #e2e8f0;
  --bdr2: #cbd5e1;
  --bdr3: #dbe4f0;

  --overlay: rgba(15, 23, 42, .55);

  --grad-hero: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #2563eb 100%);
  --grad-soft: linear-gradient(180deg, rgba(99,102,241,.08), rgba(99,102,241,0));
}

html[data-theme="dark"]{
  --prim: #7c83ff;
  --prim-2: #8b92ff;
  --prim-3: #a8afff;
  --pp: var(--prim);

  --success: #4ade80;
  --success-soft: rgba(74,222,128,.14);

  --danger: #fb7185;
  --danger-soft: rgba(251,113,133,.14);

  --warning: #fbbf24;
  --warning-soft: rgba(251,191,36,.14);

  --info: #60a5fa;
  --info-soft: rgba(96,165,250,.15);

  --wa: #25d366;
  --wa-soft: rgba(37,211,102,.14);

  --bg0: #09111f;
  --bg1: #0f172a;
  --bg2: #111c31;
  --bg3: #16233a;
  --bg4: #1a2742;

  --tx0: #e5eefb;
  --tx1: #c7d4e8;
  --tx2: #8ea2c0;
  --tx3: #6d82a3;

  --bdr: #21314d;
  --bdr2: #314563;
  --bdr3: #263956;

  --overlay: rgba(2, 8, 23, .72);

  --shadow-xs: 0 1px 2px rgba(2, 8, 23, .35);
  --shadow-sm: 0 10px 24px rgba(2, 8, 23, .28);
  --shadow-md: 0 18px 42px rgba(2, 8, 23, .34);
  --shadow-lg: 0 24px 60px rgba(2, 8, 23, .42);

  --ring: 0 0 0 4px rgba(124, 131, 255, .14);

  --grad-hero: linear-gradient(135deg, #4f46e5 0%, #7c3aed 45%, #0f766e 100%);
  --grad-soft: linear-gradient(180deg, rgba(124,131,255,.10), rgba(124,131,255,0));
}

/* ---------- Base ---------- */
*,
*::before,
*::after{ box-sizing:border-box; }

html{
  -webkit-text-size-adjust:100%;
  scroll-behavior:smooth;
}

body{
  margin:0;
  font-family:var(--font-sans);
  background:
    radial-gradient(circle at top right, rgba(99,102,241,.06), transparent 30%),
    radial-gradient(circle at bottom left, rgba(59,130,246,.05), transparent 28%),
    var(--bg0);
  color:var(--tx1);
  line-height:1.5;
  font-size:14px;
}

html[data-theme="dark"] body{
  background:
    radial-gradient(circle at top right, rgba(124,131,255,.10), transparent 30%),
    radial-gradient(circle at bottom left, rgba(37,211,102,.05), transparent 28%),
    var(--bg0);
}

img{ max-width:100%; display:block; }
svg{ display:block; }
button,
input,
select,
textarea{
  font:inherit;
}
a{
  color:var(--pp);
  text-decoration:none;
}
a:hover{
  opacity:.95;
}
:focus-visible{
  outline:none;
  box-shadow:var(--ring);
}
::selection{
  background:rgba(99,102,241,.18);
  color:var(--tx0);
}

/* ---------- Helpers ---------- */
.ct{ min-height:100vh; }
.tc{ text-align:center; }
.tr{ text-align:right; }
.tl{ text-align:left; }

.db{ display:block; }
.dn{ display:none !important; }
.df,
.fx{ display:flex; }
.ai-c{ align-items:center; }
.ai-s{ align-items:flex-start; }
.ai-e{ align-items:flex-end; }
.jc-c{ justify-content:center; }
.jc-b{ justify-content:space-between; }
.jc-e{ justify-content:flex-end; }
.fw{ flex-wrap:wrap; }
.fd-c{ flex-direction:column; }
.g1{ gap:4px; }
.g2, .gap2{ gap:8px; }
.g3{ gap:12px; }
.g4{ gap:16px; }
.g5{ gap:20px; }
.g6{ gap:24px; }
.mla{ margin-left:auto; }
.mra{ margin-right:auto; }
.w100{ width:100%; }

.p0{ padding:0; }
.p12{ padding:12px; }
.p16{ padding:16px; }
.p20{ padding:20px; }
.p24{ padding:24px; }

.mt0{ margin-top:0; }
.mt8{ margin-top:8px; }
.mt12{ margin-top:12px; }
.mt16{ margin-top:16px; }
.mt20{ margin-top:20px; }
.mt24{ margin-top:24px; }
.mb0{ margin-bottom:0; }
.mb8{ margin-bottom:8px; }
.mb12{ margin-bottom:12px; }
.mb16{ margin-bottom:16px; }
.mb20{ margin-bottom:20px; }
.mb24{ margin-bottom:24px; }

.fs10{ font-size:10px; }
.fs11{ font-size:11px; }
.fs12{ font-size:12px; }
.fs13{ font-size:13px; }
.fs14{ font-size:14px; }
.fs16{ font-size:16px; }

.fw4{ font-weight:400; }
.fw5{ font-weight:500; }
.fw6{ font-weight:600; }
.fw7{ font-weight:700; }
.fw8{ font-weight:800; }

.t0{ color:var(--tx0); }
.t1{ color:var(--tx1); }
.t2{ color:var(--tx2); }
.t3{ color:var(--tx3); }

.mono{
  font-family:var(--font-mono);
  letter-spacing:-.01em;
}

.hide-scroll{
  -ms-overflow-style:none;
  scrollbar-width:none;
}
.hide-scroll::-webkit-scrollbar{ display:none; }

/* ---------- Layout ---------- */
.layout{
  min-height:100vh;
  display:flex;
}

.sidebar{
  width:var(--sidebar-w);
  min-width:var(--sidebar-w);
  background:
    linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.92)),
    var(--bg1);
  border-right:1px solid var(--bdr);
  padding:20px 16px 16px;
  position:sticky;
  top:0;
  height:100vh;
  overflow-y:auto;
  z-index:40;
  box-shadow:inset -1px 0 0 rgba(255,255,255,.35);
}

html[data-theme="dark"] .sidebar{
  background:
    linear-gradient(180deg, rgba(17,28,49,.86), rgba(15,23,42,.96)),
    var(--bg1);
  box-shadow:inset -1px 0 0 rgba(255,255,255,.02);
}

.main{
  min-width:0;
  flex:1;
  display:flex;
  flex-direction:column;
}

.topbar{
  position:sticky;
  top:0;
  z-index:35;
  min-height:var(--topbar-h);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
  background:rgba(245,247,251,.76);
  border-bottom:1px solid rgba(226,232,240,.86);
}

html[data-theme="dark"] .topbar{
  background:rgba(9,17,31,.72);
  border-bottom:1px solid rgba(33,49,77,.9);
}

.topbar-in{
  min-height:var(--topbar-h);
  max-width:100%;
  margin:0;
  padding:16px 24px;
  display:flex;
  align-items:center;
  gap:16px;
  width:100%;
}

.page{
  width:100%;
  max-width:100%;
  margin:0;
  padding:20px 24px 28px;
}

.sb-logo{
  padding:6px 6px 18px;
  margin-bottom:10px;
}

.sb-icon{
  width:48px;
  height:48px;
  border-radius:15px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  background:var(--grad-hero);
  color:#fff;
  box-shadow:0 12px 24px rgba(79,70,229,.22);
  flex-shrink:0;
}

.sb-name{
  color:var(--tx0);
  font-size:18px;
  font-weight:800;
  line-height:1.1;
  letter-spacing:-.03em;
}

.sb-ver{
  color:var(--tx2);
  font-size:12px;
  margin-top:4px;
}

.sb-widget{
  background:linear-gradient(180deg, rgba(99,102,241,.08), rgba(99,102,241,.03));
  border:1px solid rgba(99,102,241,.14);
  border-radius:18px;
  padding:16px;
  margin:10px 4px 16px;
  box-shadow:var(--shadow-xs);
}

html[data-theme="dark"] .sb-widget{
  background:linear-gradient(180deg, rgba(124,131,255,.10), rgba(124,131,255,.04));
  border-color:rgba(124,131,255,.18);
}

.sb-plan{
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--tx0);
  font-size:13px;
  font-weight:700;
  margin-bottom:14px;
}

.sb-kota-head{
  display:flex;
  justify-content:space-between;
  gap:8px;
  font-size:11px;
  color:var(--tx2);
  margin-bottom:8px;
}

.sb-kota-bar{
  height:8px;
  background:rgba(148,163,184,.18);
  border-radius:999px;
  overflow:hidden;
  margin-bottom:12px;
}

.sb-kota-fill{
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg, #4f46e5, #7c3aed);
  transition:width .35s ease;
}

.sb-nav{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-top:8px;
}

.sb-a{
  position:relative;
  display:flex;
  align-items:center;
  gap:12px;
  color:var(--tx1);
  padding:12px 14px;
  border-radius:14px;
  transition:background .18s ease, color .18s ease, transform .18s ease, border-color .18s ease;
  border:1px solid transparent;
}

.sb-a:hover{
  background:var(--bg3);
  color:var(--tx0);
  transform:translateX(2px);
}

.sb-a.act{
  background:linear-gradient(180deg, rgba(99,102,241,.11), rgba(99,102,241,.06));
  color:var(--pp);
  border-color:rgba(99,102,241,.18);
  box-shadow:var(--shadow-xs);
}

html[data-theme="dark"] .sb-a.act{
  background:linear-gradient(180deg, rgba(124,131,255,.16), rgba(124,131,255,.08));
  border-color:rgba(124,131,255,.24);
}

.sb-a-ic{
  width:38px;
  height:38px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--bg3);
  color:inherit;
  flex-shrink:0;
}

.sb-a.act .sb-a-ic{
  background:rgba(99,102,241,.12);
}

html[data-theme="dark"] .sb-a.act .sb-a-ic{
  background:rgba(124,131,255,.15);
}

.sb-a-txt{
  min-width:0;
  flex:1;
}
.sb-a-name{
  color:inherit;
  font-size:13px;
  font-weight:700;
  line-height:1.2;
}
.sb-a-sub{
  color:var(--tx2);
  font-size:11px;
  margin-top:3px;
  line-height:1.2;
}

.topbar-title{
  min-width:0;
}
.topbar-kicker{
  color:var(--tx2);
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.12em;
  margin-bottom:4px;
}
.topbar-title h1{
  margin:0;
  color:var(--tx0);
  font-size:24px;
  line-height:1.1;
  font-weight:800;
  letter-spacing:-.03em;
}
.topbar-title p{
  margin:6px 0 0;
  color:var(--tx2);
  font-size:13px;
}

.topbar-tools{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.topbar-chip{
  height:40px;
  padding:0 14px;
  border-radius:14px;
  display:inline-flex;
  align-items:center;
  gap:8px;
  color:var(--tx1);
  background:rgba(255,255,255,.72);
  border:1px solid var(--bdr);
  box-shadow:var(--shadow-xs);
}

html[data-theme="dark"] .topbar-chip{
  background:rgba(17,28,49,.85);
}

.mob-toggle{
  display:none;
}

/* ---------- Cards ---------- */
.card,
.stat-card,
.panel,
.soft-card{
  background:var(--bg2);
  border:1px solid var(--bdr);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-sm);
}

.card{
  padding:22px 24px;
}

.ch{
  display:flex;
  align-items:center;
  gap:12px;
  padding:18px 20px;
  border-bottom:1px solid var(--bdr);
  background:linear-gradient(180deg, rgba(99,102,241,.03), rgba(99,102,241,0));
}

.ct-ttl{
  color:var(--tx0);
  font-size:14px;
  font-weight:800;
  letter-spacing:-.02em;
}

.cb{
  padding:20px;
}

.hero{
  position:relative;
  overflow:hidden;
  background:var(--grad-hero);
  color:#fff;
  border-radius:24px;
  padding:28px;
  box-shadow:var(--shadow-md);
}

.hero::after{
  content:"";
  position:absolute;
  inset:auto -10% -35% auto;
  width:340px;
  height:340px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(255,255,255,.20), rgba(255,255,255,0) 72%);
  pointer-events:none;
}

.hero-kicker{
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.16em;
  opacity:.82;
  margin-bottom:10px;
}
.hero-title{
  margin:0;
  font-size:30px;
  line-height:1.05;
  font-weight:900;
  letter-spacing:-.04em;
}
.hero-sub{
  margin:10px 0 0;
  max-width:760px;
  color:rgba(255,255,255,.86);
  font-size:14px;
  line-height:1.7;
}

/* ---------- Buttons ---------- */
.btn{
  appearance:none;
  border:none;
  outline:none;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  height:42px;
  padding:0 16px;
  border-radius:14px;
  font-size:13px;
  font-weight:700;
  transition:transform .14s ease, box-shadow .14s ease, background .14s ease, border-color .14s ease, color .14s ease, opacity .14s ease;
  white-space:nowrap;
  user-select:none;
}

.btn:hover{ transform:translateY(-1px); }
.btn:active{ transform:translateY(0); }
.btn:disabled,
.btn[disabled]{
  cursor:not-allowed;
  opacity:.62;
  transform:none;
}

.btn-sm{
  height:36px;
  padding:0 13px;
  border-radius:12px;
  font-size:12px;
}
.btn-xs{
  height:30px;
  padding:0 10px;
  border-radius:10px;
  font-size:11px;
}
.btn-lg{
  height:48px;
  padding:0 18px;
  border-radius:15px;
  font-size:14px;
}

.btn-p{
  color:#fff;
  background:linear-gradient(135deg, var(--prim), var(--prim-2));
  box-shadow:0 10px 22px rgba(79,70,229,.22);
}
.btn-p:hover{
  box-shadow:0 14px 28px rgba(79,70,229,.26);
}

.btn-o{
  color:var(--tx1);
  background:var(--bg2);
  border:1px solid var(--bdr);
  box-shadow:var(--shadow-xs);
}
.btn-o:hover{
  border-color:var(--bdr2);
  color:var(--tx0);
}

.btn-g{
  color:#fff;
  background:linear-gradient(135deg, #16a34a, #22c55e);
  box-shadow:0 10px 22px rgba(34,197,94,.20);
}

.btn-r{
  color:#fff;
  background:linear-gradient(135deg, #dc2626, #ef4444);
  box-shadow:0 10px 22px rgba(239,68,68,.18);
}

.btn-w{
  color:#fff;
  background:linear-gradient(135deg, #d97706, #f59e0b);
  box-shadow:0 10px 22px rgba(245,158,11,.18);
}

.btn-link{
  background:transparent;
  color:var(--pp);
  padding:0;
  height:auto;
  border-radius:0;
  box-shadow:none;
}

/* ---------- Forms ---------- */
.fg{
  margin-bottom:16px;
}
.fg:last-child{
  margin-bottom:0;
}
.fl{
  display:block;
  margin-bottom:8px;
  color:var(--tx1);
  font-size:12px;
  font-weight:700;
  letter-spacing:.02em;
}

.fc,
select.fc,
textarea.fc{
  width:100%;
  min-height:46px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--bdr);
  background:var(--bg1);
  color:var(--tx0);
  transition:border-color .14s ease, box-shadow .14s ease, background .14s ease;
  box-shadow:var(--shadow-xs);
}

textarea.fc{
  min-height:110px;
  resize:vertical;
}

.fc::placeholder{
  color:var(--tx3);
}

.fc:hover{
  border-color:var(--bdr2);
}

.fc:focus{
  border-color:var(--pp);
  box-shadow:var(--ring);
}

.fc[disabled],
.fc[readonly]{
  opacity:.72;
  background:var(--bg3);
  cursor:not-allowed;
}

.check,
.radio{
  display:flex;
  align-items:flex-start;
  gap:10px;
  color:var(--tx1);
  font-size:13px;
}

.inp-group{
  display:flex;
  align-items:stretch;
}
.inp-group .fc{
  border-top-right-radius:0;
  border-bottom-right-radius:0;
}
.inp-group .btn{
  border-top-left-radius:0;
  border-bottom-left-radius:0;
}

/* ---------- Alerts ---------- */
.alert{
  border:1px solid var(--bdr);
  border-radius:16px;
  padding:14px 16px;
  font-size:13px;
  line-height:1.65;
}

.alert-success{
  background:var(--success-soft);
  border-color:rgba(22,163,74,.16);
  color:var(--tx0);
}
.alert-danger{
  background:var(--danger-soft);
  border-color:rgba(220,38,38,.16);
  color:var(--tx0);
}
.alert-warning{
  background:var(--warning-soft);
  border-color:rgba(217,119,6,.18);
  color:var(--tx0);
}
.alert-info{
  background:var(--info-soft);
  border-color:rgba(37,99,235,.16);
  color:var(--tx0);
}

/* ---------- Badge / Rozet ---------- */
.rz{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-height:28px;
  padding:0 10px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  letter-spacing:.03em;
  border:1px solid transparent;
  white-space:nowrap;
}

.rz-g{
  background:rgba(22,163,74,.12);
  color:var(--success);
  border-color:rgba(22,163,74,.16);
}
.rz-gd{
  background:rgba(217,119,6,.12);
  color:var(--warning);
  border-color:rgba(217,119,6,.18);
}
.rz-n{
  background:rgba(148,163,184,.14);
  color:var(--tx2);
  border-color:rgba(148,163,184,.14);
}
.rz-r{
  background:rgba(220,38,38,.12);
  color:var(--danger);
  border-color:rgba(220,38,38,.16);
}
.rz-b{
  background:rgba(37,99,235,.12);
  color:var(--info);
  border-color:rgba(37,99,235,.16);
}
.rz-p{
  background:rgba(99,102,241,.12);
  color:var(--pp);
  border-color:rgba(99,102,241,.18);
}

/* ---------- Tables ---------- */
.tbl-wrap{
  overflow:auto;
  border-radius:0 0 20px 20px;
}

table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:680px;
}

thead th{
  text-align:left;
  padding:14px 16px;
  background:var(--bg3);
  color:var(--tx2);
  font-size:11px;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
  border-bottom:1px solid var(--bdr);
  position:sticky;
  top:0;
  z-index:1;
}

tbody td{
  padding:15px 16px;
  color:var(--tx1);
  border-bottom:1px solid var(--bdr);
  vertical-align:middle;
  background:var(--bg2);
}

tbody tr:hover td{
  background:linear-gradient(180deg, rgba(99,102,241,.03), rgba(99,102,241,0));
}

tbody tr:last-child td{
  border-bottom:none;
}

/* ---------- Pagination ---------- */
.pg{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}
.pg a,
.pg span{
  min-width:36px;
  height:36px;
  padding:0 12px;
  border-radius:12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:var(--bg2);
  border:1px solid var(--bdr);
  color:var(--tx1);
  font-size:12px;
  font-weight:700;
}
.pg .act,
.pg a:hover{
  color:var(--pp);
  border-color:rgba(99,102,241,.22);
  background:rgba(99,102,241,.08);
}

/* ---------- Progress ---------- */
.prog{
  width:100%;
}
.prog-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-bottom:8px;
  font-size:11px;
  color:var(--tx2);
}
.prog-track{
  width:100%;
  height:10px;
  border-radius:999px;
  background:rgba(148,163,184,.18);
  overflow:hidden;
}
.prog-fill{
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg, var(--prim), var(--prim-2));
  transition:width .35s ease;
}
.prog-fill.g{ background:linear-gradient(90deg, #16a34a, #22c55e); }
.prog-fill.y{ background:linear-gradient(90deg, #d97706, #f59e0b); }
.prog-fill.r{ background:linear-gradient(90deg, #dc2626, #ef4444); }

/* ---------- Modal ---------- */
.mo{
  position:fixed;
  inset:0;
  z-index:100;
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:var(--overlay);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}

.mo.open{
  display:flex;
  animation:fadeIn .18s ease;
}

.md{
  width:min(100%, 680px);
  max-height:min(88vh, 920px);
  overflow:auto;
  background:var(--bg2);
  border:1px solid var(--bdr);
  border-radius:24px;
  box-shadow:var(--shadow-lg);
  animation:popIn .18s ease;
}

.md.sm{ width:min(100%, 460px); }
.md.lg{ width:min(100%, 920px); }

.mh{
  display:flex;
  align-items:center;
  gap:12px;
  padding:18px 22px;
  border-bottom:1px solid var(--bdr);
  position:sticky;
  top:0;
  background:rgba(255,255,255,.92);
  backdrop-filter:blur(10px);
  z-index:2;
}

html[data-theme="dark"] .mh{
  background:rgba(17,28,49,.92);
}

.mttl{
  color:var(--tx0);
  font-size:15px;
  font-weight:800;
  letter-spacing:-.02em;
}

.mc{
  width:38px;
  height:38px;
  margin-left:auto;
  border:none;
  background:var(--bg3);
  color:var(--tx1);
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}

.mb{
  padding:22px;
}

.mf{
  padding:16px 22px 22px;
  border-top:1px solid var(--bdr);
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
}

/* ---------- Empty States ---------- */
.empty{
  background:var(--bg2);
  border:1px dashed var(--bdr2);
  border-radius:20px;
  padding:48px 24px;
  text-align:center;
}

.empty-ic{
  width:72px;
  height:72px;
  margin:0 auto 16px;
  border-radius:20px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--bg3);
  color:var(--tx2);
  font-size:30px;
}
.empty-title{
  color:var(--tx0);
  font-size:17px;
  font-weight:800;
  margin-bottom:8px;
}
.empty-sub{
  color:var(--tx2);
  font-size:13px;
  max-width:540px;
  margin:0 auto;
}

/* ---------- Flash ---------- */
.flash-wrap{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-bottom:18px;
}
.flash{
  border-radius:16px;
  padding:14px 16px;
  border:1px solid var(--bdr);
  box-shadow:var(--shadow-xs);
}
.flash.success{
  background:var(--success-soft);
  border-color:rgba(22,163,74,.16);
}
.flash.danger{
  background:var(--danger-soft);
  border-color:rgba(220,38,38,.16);
}
.flash.warning{
  background:var(--warning-soft);
  border-color:rgba(217,119,6,.18);
}

/* ---------- Dropdown / pills ---------- */
.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:34px;
  padding:0 12px;
  border-radius:999px;
  background:var(--bg3);
  border:1px solid var(--bdr);
  color:var(--tx1);
  font-size:12px;
  font-weight:700;
}

/* ---------- Theme Toggle ---------- */
.theme-toggle{
  position:relative;
  width:58px;
  height:34px;
  border:none;
  border-radius:999px;
  background:linear-gradient(135deg, rgba(99,102,241,.22), rgba(37,99,235,.16));
  cursor:pointer;
  padding:0;
  box-shadow:inset 0 0 0 1px rgba(99,102,241,.16);
}

.theme-toggle::before{
  content:"";
  position:absolute;
  top:4px;
  left:4px;
  width:26px;
  height:26px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 6px 12px rgba(15,23,42,.18);
  transition:transform .18s ease;
}

html[data-theme="dark"] .theme-toggle::before{
  transform:translateX(24px);
  background:#dbeafe;
}

.theme-toggle-ico{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 8px;
  font-size:12px;
  pointer-events:none;
}

/* ---------- Utilities used by pages ---------- */
.kpi-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:16px;
}
.kpi{
  background:var(--bg2);
  border:1px solid var(--bdr);
  border-radius:20px;
  padding:22px;
  box-shadow:var(--shadow-sm);
}
.kpi-label{
  color:var(--tx2);
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.12em;
  font-weight:800;
  margin-bottom:8px;
}
.kpi-value{
  color:var(--tx0);
  font-size:32px;
  line-height:1;
  font-weight:900;
  letter-spacing:-.05em;
}
.kpi-sub{
  color:var(--tx2);
  margin-top:8px;
  font-size:12px;
}

.grid-2{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:16px;
}
.grid-3{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:16px;
}
.grid-4{
  display:grid;
  grid-template-columns:repeat(4, minmax(0,1fr));
  gap:16px;
}

.hr{
  height:1px;
  background:var(--bdr);
  border:none;
  margin:20px 0;
}

.dot{
  width:8px;
  height:8px;
  border-radius:50%;
  flex-shrink:0;
}
.dot.g{ background:var(--success); }
.dot.y{ background:var(--warning); }
.dot.r{ background:var(--danger); }
.dot.b{ background:var(--info); }
.dot.p{ background:var(--pp); }

/* ---------- Scrollbar ---------- */
*{
  scrollbar-width:thin;
  scrollbar-color:rgba(148,163,184,.5) transparent;
}
*::-webkit-scrollbar{
  width:8px;
  height:8px;
}
*::-webkit-scrollbar-track{
  background:transparent;
}
*::-webkit-scrollbar-thumb{
  background:rgba(148,163,184,.42);
  border-radius:999px;
  border:2px solid transparent;
  background-clip:padding-box;
}
*::-webkit-scrollbar-thumb:hover{
  background:rgba(148,163,184,.62);
  border:2px solid transparent;
  background-clip:padding-box;
}

/* ---------- Animations ---------- */
@keyframes fadeIn{
  from{ opacity:0; }
  to{ opacity:1; }
}
@keyframes popIn{
  from{ opacity:0; transform:translateY(10px) scale(.985); }
  to{ opacity:1; transform:translateY(0) scale(1); }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px){
  .sidebar{
    width:248px;
    min-width:248px;
  }
  .page,
  .topbar-in{
    padding-left:20px;
    padding-right:20px;
  }
}

@media (max-width: 960px){
  .layout{
    display:block;
  }

  .sidebar{
    position:fixed;
    left:0;
    top:0;
    bottom:0;
    transform:translateX(-100%);
    transition:transform .18s ease;
    box-shadow:var(--shadow-lg);
  }

  body.sb-open .sidebar{
    transform:translateX(0);
  }

  body.sb-open{
    overflow:hidden;
  }

  .mob-toggle{
    display:inline-flex;
  }

  .topbar{
    left:0;
  }

  .topbar-in{
    min-height:70px;
  }

  .page{
    padding-top:20px;
  }

  body.sb-open::after{
    content:"";
    position:fixed;
    inset:0;
    background:var(--overlay);
    z-index:39;
  }

  .grid-4{
    grid-template-columns:repeat(2, minmax(0,1fr));
  }
}

@media (max-width: 760px){
  :root{
    --topbar-h: 68px;
  }

  .page,
  .topbar-in{
    padding-left:14px;
    padding-right:14px;
  }

  .page{
    padding-top:16px;
    padding-bottom:20px;
  }

  .topbar-title h1{
    font-size:20px;
  }

  .hero{
    padding:22px 18px;
    border-radius:20px;
  }

  .hero-title{
    font-size:24px;
  }

  .card,
  .cb{
    padding:16px;
  }

  .ch{
    padding:15px 16px;
  }

  .grid-2,
  .grid-3,
  .grid-4{
    grid-template-columns:1fr;
  }

  .topbar-tools{
    width:100%;
    margin-left:0;
  }

  .topbar-in{
    flex-wrap:wrap;
    align-items:flex-start;
    gap:12px;
  }

  .btn{
    max-width:100%;
  }

  .mf{
    flex-wrap:wrap;
  }

  .mf .btn{
    flex:1 1 140px;
  }
}

@media (max-width: 520px){
  .sidebar{
    width:min(88vw, 320px);
    min-width:min(88vw, 320px);
  }

  .topbar-chip{
    width:100%;
    justify-content:center;
  }

  .btn{
    width:100%;
  }

  .btn-sm,
  .btn-xs{
    width:auto;
  }

  .tbl-wrap{
    border-radius:16px;
  }

  .md{
    border-radius:20px;
  }

  .mh,
  .mb,
  .mf{
    padding-left:16px;
    padding-right:16px;
  }
}