/* ══════════════════════════════════════════════════════════════════
   GENZURA — Super Admin (static)
   Design tokens & layout mirror the main React dashboard.
   ══════════════════════════════════════════════════════════════════ */

:root {
  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --violet-50:  #f5f3ff;
  --violet-600: #7c3aed;
  --violet-700: #6d28d9;

  --amber-50:  #fffbeb;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;
  --amber-600: #d97706;

  --red-50:  #fef2f2;
  --red-100: #fee2e2;
  --red-500: #ef4444;
  --red-600: #dc2626;

  --blue-50:  #eff6ff;
  --blue-600: #2563eb;

  --r-sm: 10px;
  --r:    14px;
  --r-lg: 18px;
  --r-2xl: 22px;

  --sh-sm: 0 1px 2px 0 rgba(16,24,40,.05);
  --sh:    0 8px 24px -8px rgba(16,24,40,.12), 0 2px 6px -2px rgba(16,24,40,.06);
  --sh-xl: 0 24px 48px -12px rgba(16,24,40,.22);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
a { color: inherit; }
::selection { background: var(--green-100); }

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-300); background-clip: content-box; }

/* ══════════════════════════════════════════════════════════════════
   Login
   ══════════════════════════════════════════════════════════════════ */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1100px 500px at 50% -10%, var(--green-50), transparent 60%),
    var(--gray-50);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: var(--r-2xl);
  box-shadow: var(--sh-xl);
  padding: 32px;
  animation: pop .35s cubic-bezier(.2,.8,.2,1);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand-badge {
  width: 46px; height: 46px;
  border-radius: 15px;
  background: var(--green-100);
  color: var(--green-600);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.04);
}
.brand-word {
  font-size: 22px; font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(90deg, var(--green-600), var(--green-800));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gray-400); }
.login-card h1 { font-size: 18px; margin: 4px 0 4px; }
.login-card p.hint { font-size: 13px; color: var(--gray-500); margin: 0 0 20px; line-height: 1.5; }

/* ══════════════════════════════════════════════════════════════════
   App shell
   ══════════════════════════════════════════════════════════════════ */
.app { display: flex; height: 100dvh; overflow: hidden; }

.sidebar {
  width: 244px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
  box-shadow: var(--sh-sm);
  z-index: 40;
}
.side-brand { padding: 12px; }
.side-brand-inner {
  background: var(--green-50);
  border: 1px solid var(--gray-50);
  border-radius: var(--r-lg);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--sh);
}
.side-brand-inner .brand-badge { width: 44px; height: 44px; border-radius: 14px; }
.side-brand-inner .brand-sub { display: block; margin-top: 1px; }

.nav { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r);
  color: var(--gray-500);
  font-size: 14px; font-weight: 500; letter-spacing: -.01em;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item svg { color: var(--gray-400); transition: color .15s; flex-shrink: 0; }
.nav-item:hover { background: var(--gray-50); color: var(--gray-900); }
.nav-item:hover svg { color: var(--green-600); }
.nav-item.active {
  background: var(--green-50);
  color: var(--green-700);
  font-weight: 600;
  box-shadow: var(--sh-sm);
}
.nav-item.active svg { color: var(--green-600); }
.nav-item.active::before {
  content: '';
  position: absolute; left: -2px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 18px; border-radius: 0 999px 999px 0;
  background: var(--green-600);
}

.side-foot { padding: 12px; }
.side-foot-inner {
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-lg);
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--sh);
}
.role-pill {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .1em; padding: 2px;
}
.dot-live { width: 7px; height: 7px; border-radius: 999px; background: var(--green-500); box-shadow: 0 0 0 3px var(--green-100); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

/* ── Topbar ────────────────────────────────────────────────────── */
.topbar {
  height: 58px;
  flex-shrink: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--gray-100);
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 14px; font-weight: 700; letter-spacing: -.01em; color: var(--gray-800); margin: 0; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--green-50); color: var(--green-600); }
.menu-btn { display: none; }

.search {
  flex: 1; max-width: 340px; position: relative;
}
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--gray-400); }
.search input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--r);
  font-size: 13px; color: var(--gray-800);
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--gray-400); }
.search input:focus { background: #fff; border-color: var(--green-200); box-shadow: 0 0 0 4px rgba(34,197,94,.08); }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 5px; border-radius: var(--r); transition: background .15s; }
.user-chip:hover { background: var(--gray-50); }
.avatar {
  width: 34px; height: 34px; border-radius: 12px;
  background: linear-gradient(135deg, var(--green-500), var(--green-700));
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--sh-sm);
}
.user-meta { line-height: 1.15; text-align: left; }
.user-meta b { font-size: 12px; color: var(--gray-800); display: block; }
.user-meta span { font-size: 10px; color: var(--gray-400); font-weight: 600; text-transform: capitalize; }

/* ── Content ───────────────────────────────────────────────────── */
.content { flex: 1; overflow-y: auto; padding: 24px; }
.container { max-width: 1500px; margin: 0 auto; animation: rise .5s cubic-bezier(.2,.8,.2,1); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 0; color: var(--gray-900); }
.page-head p { margin: 3px 0 0; font-size: 13px; color: var(--gray-500); }

/* ══════════════════════════════════════════════════════════════════
   Components
   ══════════════════════════════════════════════════════════════════ */
.card {
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.card-pad { padding: 18px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--gray-100);
}
.card-head h3 { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: -.01em; color: var(--gray-800); }
.card-head .sub { font-size: 11px; color: var(--gray-400); font-weight: 600; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }

/* Stat card */
.stat { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-ico {
  width: 40px; height: 40px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
}
.stat-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-400); }
.stat-val { font-size: 26px; font-weight: 800; letter-spacing: -.03em; color: var(--gray-900); line-height: 1; }
.stat-foot { font-size: 11px; color: var(--gray-400); font-weight: 600; }

.tone-green  { background: var(--green-50);  color: var(--green-600); }
.tone-violet { background: var(--violet-50); color: var(--violet-600); }
.tone-blue   { background: var(--blue-50);   color: var(--blue-600); }
.tone-amber  { background: var(--amber-50);  color: var(--amber-600); }
.tone-red    { background: var(--red-50);    color: var(--red-600); }
.tone-gray   { background: var(--gray-100);  color: var(--gray-500); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .01em;
  white-space: nowrap;
}
.badge .bdot { width: 6px; height: 6px; border-radius: 999px; }
.badge-green  { background: var(--green-50);  color: var(--green-700); }
.badge-green .bdot { background: var(--green-500); }
.badge-gray   { background: var(--gray-100);  color: var(--gray-600); }
.badge-gray .bdot { background: var(--gray-400); }
.badge-amber  { background: var(--amber-50);  color: var(--amber-600); }
.badge-amber .bdot { background: var(--amber-500); }
.badge-red    { background: var(--red-50);    color: var(--red-600); }
.badge-red .bdot { background: var(--red-500); }
.badge-violet { background: var(--violet-50); color: var(--violet-600); }
.badge-violet .bdot { background: var(--violet-600); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--r);
  font-size: 13px; font-weight: 700;
  transition: background .15s, color .15s, box-shadow .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--green-600); color: #fff; box-shadow: 0 6px 16px -6px rgba(22,163,74,.6); }
.btn-primary:hover { background: var(--green-700); }
.btn-violet { background: var(--violet-600); color: #fff; box-shadow: 0 6px 16px -6px rgba(124,58,237,.5); }
.btn-violet:hover { background: var(--violet-700); }
.btn-ghost { background: var(--gray-100); color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-200); }
.btn-danger { background: var(--red-50); color: var(--red-600); }
.btn-danger:hover { background: var(--red-100); }
.btn-outline { background: #fff; border: 1px solid var(--gray-200); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-50); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 11px; }
.btn-block { width: 100%; }

/* Table */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left; padding: 11px 16px;
  font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gray-400); background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100); white-space: nowrap;
}
.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--gray-50); vertical-align: middle; color: var(--gray-700); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.clickable { cursor: pointer; transition: background .12s; }
.tbl tbody tr.clickable:hover { background: var(--green-50); }
.tbl .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--gray-400); }
.tbl .strong { font-weight: 700; color: var(--gray-900); }
.right { text-align: right; }

.cell-biz { display: flex; align-items: center; gap: 11px; }
.cell-ico {
  width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0;
  background: var(--green-50); color: var(--green-600);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px;
}

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--gray-400); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px;
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--r); font-size: 13px; color: var(--gray-800);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--green-200); box-shadow: 0 0 0 4px rgba(34,197,94,.08); }
.switch { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--gray-700); }
.switch input { width: 18px; height: 18px; accent-color: var(--green-600); }

/* Empty / loader */
.empty {
  padding: 46px 20px; text-align: center; color: var(--gray-400);
  font-size: 13px; font-weight: 600;
}
.loader { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px; color: var(--gray-400); font-size: 13px; font-weight: 600; }
.spin { width: 18px; height: 18px; border: 2.5px solid var(--gray-200); border-top-color: var(--green-600); border-radius: 999px; animation: spin .7s linear infinite; }

.link { color: var(--green-600); font-weight: 700; font-size: 12px; }
.link:hover { text-decoration: underline; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--gray-400); font-weight: 600; }
.kv dd { margin: 0; color: var(--gray-800); font-weight: 600; text-align: right; word-break: break-word; }

.section { margin-bottom: 18px; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--gray-400); margin: 0 0 12px; }

.tabs { display: flex; gap: 4px; background: var(--gray-100); padding: 4px; border-radius: var(--r); }
.tab { padding: 7px 14px; border-radius: 10px; font-size: 12px; font-weight: 700; color: var(--gray-500); }
.tab:hover { color: var(--gray-800); }
.tab.active { background: #fff; color: var(--gray-900); box-shadow: var(--sh-sm); }

.pill-toggle { display: inline-flex; background: var(--gray-100); border-radius: 12px; padding: 3px; }

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(17,24,39,.5); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .18s ease;
}
.modal {
  width: 100%; max-width: 440px;
  background: #fff; border-radius: var(--r-2xl);
  box-shadow: var(--sh-xl);
  overflow: hidden; animation: pop .22s cubic-bezier(.2,.8,.2,1);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--gray-100); }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--gray-100); background: var(--gray-50); }

/* ── Toast ─────────────────────────────────────────────────────── */
#toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--gray-900); color: #fff;
  padding: 12px 16px; border-radius: var(--r);
  font-size: 13px; font-weight: 600;
  box-shadow: var(--sh-xl);
  display: flex; align-items: center; gap: 9px;
  animation: rise .25s ease;
  max-width: 340px;
}
.toast.ok { background: var(--green-700); }
.toast.err { background: var(--red-600); }

/* Backdrop for mobile sidebar */
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(17,24,39,.4); backdrop-filter: blur(4px); display: none; }

/* ── Animation ─────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop  { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ══════════════════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; transform: translateX(-102%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open + .scrim { display: block; }
  .menu-btn { display: flex; }
  .topbar h1 { display: none; }
  .content { padding: 16px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .user-meta { display: none; }
}
