/* =========================================================
   ZYNDHUX ADMIN — Core Design System
   Brand: #000000 / #FFFFFF / #950606
   ========================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #0a0b0d;
  color: #e8e9ec;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; border: none; background: none; cursor: pointer; }
input, select, textarea { font: inherit; }

:root {
  --bg-0: #0a0b0d;
  --bg-1: #111317;
  --bg-2: #16181d;
  --bg-3: #1d2026;
  --border: #262932;
  --border-soft: #1c1e24;
  --text-1: #e8e9ec;
  --text-2: #9ca0ab;
  --text-3: #6b6f7a;
  --red: #950606;
  --red-light: #c90e0e;
  --red-bg: rgba(149,6,6,0.12);
  --green: #16a34a;
  --green-bg: rgba(22,163,74,0.12);
  --amber: #f59e0b;
  --amber-bg: rgba(245,158,11,0.12);
  --blue: #3b82f6;
  --blue-bg: rgba(59,130,246,0.12);
  --gray-bg: rgba(255,255,255,0.04);
  --radius: 8px;
  --radius-lg: 12px;
}

/* === LAYOUT === */
.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  background: var(--bg-1);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-x: hidden;
  transition: width 0.18s ease;
}
.sidebar.collapsed { width: 68px; }
.sidebar-nav { overflow-y: auto; overflow-x: hidden; }
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-brand-sub,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-item-badge,
.sidebar.collapsed .admin-card-info,
.sidebar.collapsed .logout-btn {
  display: none;
}
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px 0; gap: 0; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 20px 0; }
.sidebar.collapsed .admin-card { justify-content: center; padding: 8px 0; }
.sidebar.collapsed ~ .main { margin-left: 68px; }
.sidebar-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 8px 0;
  border: none; background: transparent; cursor: pointer;
  color: var(--text-3); border-top: 1px solid var(--border-soft);
}
.sidebar-toggle:hover { color: var(--text-1); background: var(--bg-2); }

.nav-item { --tt: 0; }
.sidebar.collapsed .nav-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-3);
  color: var(--text-1);
  border: 1px solid var(--border-soft);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.sidebar.collapsed .nav-item:hover::after { opacity: 1; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid var(--border-soft);
}
.sidebar-brand-mark {
  width: 28px; height: 28px;
  background: var(--red);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
}
.sidebar-brand-text { font-weight: 700; font-size: 15px; }
.sidebar-brand-sub { font-size: 11px; color: var(--text-3); }

.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-section { margin-bottom: 4px; }
.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 16px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  position: relative;
}
.nav-item:hover { background: var(--bg-2); color: var(--text-1); }
.nav-item.active { background: var(--red-bg); color: #fff; }
.nav-item.active::before {
  content: "";
  position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px;
  background: var(--red);
  border-radius: 2px;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
.nav-item-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-soft);
}
.admin-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
}
.admin-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  color: var(--text-1);
  flex-shrink: 0;
}
.admin-card-info { flex: 1; min-width: 0; }
.admin-card-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-card-role { font-size: 11px; color: var(--text-3); }
.logout-btn { color: var(--text-3); padding: 4px; border-radius: 6px; }
.logout-btn:hover { color: var(--red-light); background: var(--red-bg); }

/* === MAIN === */
.main {
  flex: 1;
  margin-left: 248px;
  min-height: 100vh;
}
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-0);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-breadcrumb { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 28px; max-width: 1400px; }

/* === SEARCH === */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  width: 280px;
}
.search-box input {
  background: none;
  border: none;
  color: var(--text-1);
  flex: 1;
  font-size: 13px;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box svg { color: var(--text-3); width: 16px; height: 16px; flex-shrink: 0; }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-light); }
.btn-secondary { background: var(--bg-3); color: var(--text-1); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-2); border-color: var(--text-3); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--text-1); }
.btn-danger { background: var(--red-bg); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.18); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === CARDS / METRICS === */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.metric-card {
  background: var(--bg-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.metric-label {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.metric-value { font-size: 26px; font-weight: 700; line-height: 1; }
.metric-sub { font-size: 12px; color: var(--text-2); margin-top: 6px; }
.metric-trend-up { color: var(--green); }
.metric-trend-down { color: #f87171; }

.panel {
  background: var(--bg-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.panel-title { font-size: 15px; font-weight: 600; }
.panel-title-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* === ALERT (data inconsistency) === */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  border: 1px solid;
}
.alert-warning { background: var(--amber-bg); border-color: rgba(245,158,11,0.3); }
.alert-icon { flex-shrink: 0; color: var(--amber); margin-top: 1px; }
.alert-body { flex: 1; }
.alert-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.alert-detail { font-size: 12.5px; color: var(--text-2); }

/* === TABLE === */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  vertical-align: middle;
}
tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: var(--bg-2); }
tbody tr:last-child td { border-bottom: none; }
.table-cell-main { font-weight: 500; color: var(--text-1); }
.table-cell-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.clickable-row { cursor: pointer; }

/* === BADGES / PILLS === */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill-active   { background: var(--green-bg); color: #4ade80; }
.pill-suspended{ background: var(--amber-bg); color: var(--amber); }
.pill-banned   { background: var(--red-bg); color: #f87171; }
.pill-deleted  { background: var(--gray-bg); color: var(--text-3); }
.pill-personal { background: var(--blue-bg); color: #60a5fa; }
.pill-business { background: rgba(168,85,247,0.12); color: #c084fc; }
.pill-verified { background: var(--green-bg); color: #4ade80; }
.pill-pending  { background: var(--amber-bg); color: var(--amber); }
.pill-warning  { background: var(--amber-bg); color: var(--amber); }
.pill-neutral  { background: var(--gray-bg); color: var(--text-2); }

.badge-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* === FILTERS BAR === */
.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--text-1);
  cursor: pointer;
}

/* === TABS === */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-soft); margin-bottom: 20px; }
.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active { color: var(--text-1); border-color: var(--red); }
.tab:hover { color: var(--text-1); }

/* === MODAL === */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-box {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { color: var(--text-3); padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--bg-2); color: var(--text-1); }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-soft);
}

/* === FORM === */
.form-row { margin-bottom: 14px; }
.form-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text-1);
  font-size: 13.5px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--red);
  box-shadow: 0 0 0 2px var(--red-bg);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-title { font-size: 14px; font-weight: 500; color: var(--text-2); margin-bottom: 4px; }
.empty-state-sub { font-size: 12.5px; }

/* === LOADING === */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  display: flex; align-items: center; justify-content: center;
  padding: 60px;
}

/* === TOAST === */
#toast-root { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  min-width: 260px;
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0; transform: translateX(20px);
  transition: all 0.25s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid #ef4444; }
.toast-warning { border-left: 3px solid var(--amber); }

/* === USER DETAIL DRAWER === */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 900;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px;
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  z-index: 901;
  overflow-y: auto;
}
.drawer-header {
  padding: 20px; border-bottom: 1px solid var(--border-soft);
  display: flex; justify-content: space-between; align-items: flex-start;
}
.drawer-body { padding: 20px; }
.detail-section { margin-bottom: 22px; }
.detail-section-title {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 10px;
}
.detail-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row-label { color: var(--text-3); flex-shrink: 0; }
.detail-row-value { color: var(--text-1); text-align: right; word-break: break-word; }

.dual-arch-warning {
  background: var(--amber-bg);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--amber);
  margin-bottom: 14px;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .drawer { width: 100%; }
}
