/* ============================================================
   AGOR Platform — Admin & Agent Dashboard
   Dark Theme: Navy #0a1940 | Gold #f5c518 | Orange #e87722
   ============================================================ */

/* ── FONT IMPORT ───────────────────────────────────────── */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Poppins:wght@400;500;600;700&display=swap");

/* ── CSS VARIABLES (dark theme default) ─────────────────── */
:root {
  --db-bg: #0d1526;
  --db-surface: #131f35;
  --db-surface2: #1a2847;
  --db-border: rgba(255, 255, 255, 0.07);
  --db-text: #e2e8f0;
  --db-muted: #8899b0;
  --db-navy: #0a1940;
  --db-gold: #f5c518;
  --db-orange: #e87722;
  --db-success: #22c55e;
  --db-danger: #ef4444;
  --db-warning: #f59e0b;
  --db-info: #60a5fa;
  --db-radius: 10px;
  --db-radius-lg: 14px;
  --db-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --db-font-heading: "Poppins", sans-serif;
  --db-font-body: "Inter", "Segoe UI", sans-serif;
}

/* ── LIGHT THEME ──────────────────────────────────────── */
/* Sidebar + topbar stay original dark navy.
   Content area gets the classic navy-tinted light background. */
html.light-theme,
body.light-theme {
  --db-bg: #eef1f7;
  --db-surface: #ffffff;
  --db-surface2: #e2e8f5;
  --db-border: rgba(10, 25, 64, 0.1);
  --db-text: #0d1e3a;
  --db-muted: #4a5e80;
  --db-gold: #c8960a;
  --db-orange: #c96010;
  --db-success: #15803d;
  --db-danger: #b91c1c;
  --db-warning: #b45309;
  --db-info: #1d4ed8;
}

/* Theme toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--db-surface2);
  border: 1px solid var(--db-border);
  color: var(--db-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--db-transition);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: rgba(245, 197, 24, 0.12);
  color: var(--db-gold);
  border-color: rgba(245, 197, 24, 0.3);
}
html.light-theme .theme-toggle,
body.light-theme .theme-toggle {
  background: rgba(10, 25, 64, 0.08);
  border-color: rgba(10, 25, 64, 0.15);
  color: #556888;
}
/* Dark mode: show moon, hide sun */
.theme-toggle .icon-sun {
  display: none;
}
.theme-toggle .icon-moon {
  display: inline;
}
/* Light mode: show sun, hide moon */
html.light-theme .theme-toggle .icon-sun,
body.light-theme .theme-toggle .icon-sun {
  display: inline;
}
html.light-theme .theme-toggle .icon-moon,
body.light-theme .theme-toggle .icon-moon {
  display: none;
}

/* ── RESET ─────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ── DASHBOARD LAYOUT ─────────────────────────────────── */
.dash-page {
  min-height: 100vh;
  background: var(--db-bg);
  display: flex;
  overflow-x: hidden;
  max-width: 100vw;
  color: var(--db-text);
  font-family: var(--db-font-body);
}

/* ── SIDEBAR ──────────────────────────────────────────── */
.dash-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--db-surface);
  border-right: 1px solid var(--db-border);
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--db-transition);
  overflow: hidden;
  /* Ensure footer is always visible */
  overflow-y: hidden;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--db-border);
  flex-shrink: 0;
}
.sidebar-logo img {
  height: 32px;
}
.sidebar-logo-text .org {
  font-size: 0.9rem;
  font-weight: 800;
  font-family: var(--db-font-heading);
  color: var(--db-gold);
  letter-spacing: 0.06em;
}
.sidebar-logo-text .sub {
  font-size: 0.58rem;
  color: var(--db-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  max-height: calc(100vh - 120px);
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.sidebar-section-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--db-muted);
  padding: 14px 10px 5px;
  opacity: 0.7;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--db-muted);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all var(--db-transition);
  margin-bottom: 1px;
  text-decoration: none;
}
.sidebar-link i {
  width: 18px;
  text-align: center;
  font-size: 0.88rem;
  flex-shrink: 0;
}
.sidebar-link:hover {
  background: var(--db-surface2);
  color: var(--db-text);
}
.sidebar-link.active {
  background: rgba(245, 197, 24, 0.12);
  color: var(--db-gold);
  font-weight: 600;
}
.sidebar-link.active i {
  color: var(--db-gold);
}
.sidebar-link .badge-count {
  margin-left: auto;
  background: var(--db-gold);
  color: var(--db-navy);
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 99px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--db-border);
  flex-shrink: 0;
  /* Always visible at bottom regardless of nav scroll */
  position: sticky;
  bottom: 0;
  background: var(--db-surface);
  z-index: 2;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background var(--db-transition);
  cursor: pointer;
}
.sidebar-user:hover {
  background: var(--db-surface2);
}
.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(245, 197, 24, 0.15);
  border: 1.5px solid rgba(245, 197, 24, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--db-gold);
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
}
.sidebar-user-info {
  flex: 1;
  min-width: 0;
}
.sidebar-user-info .name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--db-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-info .role {
  font-size: 0.62rem;
  color: var(--db-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--db-muted);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--db-transition);
  flex-shrink: 0;
  background: none;
  border: none;
}
.sidebar-logout:hover {
  color: var(--db-danger);
  background: rgba(239, 68, 68, 0.1);
}
/* Inline in sidebar-user row */
.sidebar-footer .sidebar-user .sidebar-logout {
  margin: 0;
  padding: 6px 8px;
  min-width: 28px;
}

/* ── MAIN CONTENT ─────────────────────────────────────── */
.dash-main {
  flex: 1;
  margin-left: 250px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
  background: var(--db-bg);
}

/* ── TOPBAR ───────────────────────────────────────────── */
.dash-topbar {
  background: var(--db-surface);
  border-bottom: 1px solid var(--db-border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}
.dash-topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.dash-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-page-title {
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--db-font-heading);
  color: var(--db-text);
}

.sidebar-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  color: var(--db-muted);
  font-size: 1rem;
  cursor: pointer;
  background: none;
  border: none;
  transition: all var(--db-transition);
}
.sidebar-toggle:hover {
  background: var(--db-surface2);
  color: var(--db-text);
}

/* ── CONTENT AREA ─────────────────────────────────────── */
.dash-content {
  padding: 24px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

/* ── STAT CARDS ───────────────────────────────────────── */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.dash-stat-card {
  background: var(--db-surface);
  border: 1px solid var(--db-border);
  border-radius: var(--db-radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: border-color var(--db-transition);
}
.dash-stat-card:hover {
  border-color: rgba(245, 197, 24, 0.2);
}
.dash-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.icon-navy {
  background: rgba(10, 25, 64, 0.6);
  color: var(--db-gold);
}
.icon-gold {
  background: rgba(245, 197, 24, 0.12);
  color: var(--db-gold);
}
.icon-green {
  background: rgba(34, 197, 94, 0.12);
  color: var(--db-success);
}
.icon-orange {
  background: rgba(232, 119, 34, 0.12);
  color: var(--db-orange);
}
.icon-red {
  background: rgba(239, 68, 68, 0.1);
  color: var(--db-danger);
}
.icon-blue {
  background: rgba(59, 130, 246, 0.1);
  color: var(--db-info);
}
.dash-stat-body {
  flex: 1;
}
.dash-stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  font-family: var(--db-font-heading);
  color: var(--db-text);
  line-height: 1;
  margin-bottom: 4px;
}
.dash-stat-label {
  font-size: 0.72rem;
  color: var(--db-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.dash-stat-change {
  font-size: 0.7rem;
  color: var(--db-success);
  margin-top: 5px;
}

/* ── PANELS ───────────────────────────────────────────── */
.dash-panel {
  background: var(--db-surface);
  border: 1px solid var(--db-border);
  border-radius: var(--db-radius-lg);
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
}
.dash-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--db-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.dash-panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--db-font-heading);
  color: var(--db-text);
}
.dash-panel-body {
  padding: 16px 20px;
}

/* ── TABLES ───────────────────────────────────────────── */
.dash-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 65vh;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--db-surface2) transparent;
}
.dash-table-wrap::-webkit-scrollbar {
  height: 5px;
  width: 5px;
}
.dash-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}
.dash-table-wrap::-webkit-scrollbar-thumb {
  background: var(--db-surface2);
  border-radius: 99px;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 580px;
}
.dash-table th {
  text-align: left;
  padding: 11px 14px;
  background: var(--db-surface2);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--db-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--db-border);
  position: sticky;
  top: 0;
  z-index: 2;
}
.dash-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--db-border);
  color: var(--db-text);
  vertical-align: middle;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Name/avatar column — show full text, no truncation */
.dash-table td.col-name,
.dash-table td:nth-child(2):not(:only-child) {
  max-width: 240px;
  white-space: normal;
  overflow: visible;
}
/* First td that is a checkbox cell — keep narrow */
.dash-table td:first-child:has(input[type="checkbox"]) {
  max-width: 40px;
  width: 40px;
  white-space: nowrap;
  overflow: hidden;
}
/* First td that is NOT a checkbox (e.g. name in membership table) */
.dash-table td:first-child:not(:has(input[type="checkbox"])) {
  max-width: 240px;
  white-space: normal;
  overflow: visible;
}
.dash-table tr:last-child td {
  border-bottom: none;
}
.dash-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

/* ── CHECKBOX IN TABLE ────────────────────────────────── */
.dash-table th:first-child:has(input[type="checkbox"]),
.dash-table td:first-child:has(input[type="checkbox"]) {
  width: 40px;
  max-width: 40px;
  padding-left: 16px;
  white-space: nowrap;
  overflow: hidden;
}
/* Fallback for browsers without :has() support */
.dash-table th:first-child,
.dash-table td:first-child {
  padding-left: 14px;
}
.dash-table input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--db-gold);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── BADGES ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}
.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.badge-gold {
  background: rgba(245, 197, 24, 0.15);
  color: var(--db-gold);
}
.badge-navy {
  background: rgba(10, 25, 64, 0.5);
  color: var(--db-gold);
  border: 1px solid rgba(245, 197, 24, 0.2);
}
.badge-gray {
  background: rgba(255, 255, 255, 0.07);
  color: var(--db-muted);
}
.badge-orange {
  background: rgba(232, 119, 34, 0.15);
  color: var(--db-orange);
}
.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--db-warning);
}

/* ── BUTTONS ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--db-font-heading);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 8px;
  transition: all var(--db-transition);
  white-space: nowrap;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: var(--db-gold);
  color: var(--db-navy);
}
.btn-primary:hover {
  background: #fdd835;
  box-shadow: 0 4px 16px rgba(245, 197, 24, 0.3);
}
.btn-secondary {
  background: var(--db-surface2);
  color: var(--db-text);
  border: 1px solid var(--db-border);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}
.btn-outline-navy {
  background: transparent;
  color: var(--db-gold);
  border: 1px solid var(--db-gold);
}
.btn-outline-navy:hover {
  background: rgba(245, 197, 24, 0.1);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--db-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}
.btn-sm {
  padding: 6px 13px;
  font-size: 0.76rem;
  border-radius: 6px;
}
.btn-full {
  width: 100%;
  justify-content: center;
}
/* Manage button — styled like screenshot */
.btn-manage {
  background: var(--db-surface2);
  color: var(--db-text);
  border: 1px solid var(--db-border);
  padding: 5px 14px;
  font-size: 0.76rem;
  border-radius: 6px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}
.btn-manage:hover {
  background: rgba(245, 197, 24, 0.1);
  color: var(--db-gold);
  border-color: rgba(245, 197, 24, 0.3);
}

/* ── FORMS ────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--db-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-label .required {
  color: var(--db-danger);
  margin-left: 3px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--db-surface2);
  border: 1px solid var(--db-border);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--db-text);
  transition: border-color var(--db-transition);
  outline: none;
  font-family: inherit;
}
.form-control:focus {
  border-color: var(--db-gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.1);
}
.form-control::placeholder {
  color: rgba(136, 153, 176, 0.5);
}
textarea.form-control {
  resize: vertical;
  min-height: 100px;
}
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238899b0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-hint {
  font-size: 0.75rem;
  color: var(--db-muted);
  margin-top: 4px;
}
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}
.form-check-input {
  width: 16px;
  height: 16px;
  accent-color: var(--db-gold);
  margin-top: 2px;
  flex-shrink: 0;
}

/* ── ALERTS ───────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}
.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #4ade80;
}
.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
}
.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--db-warning);
}
.alert-info {
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.25);
  color: #93c5fd;
}

/* ── SPINNER ──────────────────────────────────────────── */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--db-gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-navy {
  border-color: rgba(245, 197, 24, 0.2);
  border-top-color: var(--db-gold);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── MODAL ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-backdrop.open {
  display: flex;
}
.modal {
  background: var(--db-surface);
  border: 1px solid var(--db-border);
  border-radius: var(--db-radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modal-slide-in 0.25s ease;
}
@keyframes modal-slide-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--db-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--db-surface);
  z-index: 1;
}
.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--db-text);
}
.modal-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--db-surface2);
  border: 1px solid var(--db-border);
  color: var(--db-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--db-transition);
}
.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--db-danger);
}
.modal-body {
  padding: 20px 22px;
}
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--db-border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
}

/* ── TOPBAR PROFILE CHIP ──────────────────────────────── */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--db-transition);
  border: 1px solid var(--db-border);
}
.topbar-user:hover {
  background: var(--db-surface2);
}
.topbar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--db-text);
}

/* ── PAGINATION ───────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 14px;
  justify-content: flex-start;
}
.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--db-muted);
  background: var(--db-surface2);
  border: 1px solid var(--db-border);
  cursor: pointer;
  transition: all var(--db-transition);
}
.page-btn:hover {
  background: rgba(245, 197, 24, 0.1);
  color: var(--db-gold);
  border-color: rgba(245, 197, 24, 0.3);
}
.page-btn.active {
  background: var(--db-gold);
  color: var(--db-navy);
  border-color: var(--db-gold);
  font-weight: 800;
}

/* ── SIDEBAR OVERLAY ──────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show {
  display: block;
}

/* ── HAMBURGER ────────────────────────────────────────── */
.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--db-muted);
  border-radius: 2px;
  transition: all var(--db-transition);
}
.nav-hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  cursor: pointer;
  border-radius: 6px;
}
.nav-hamburger:hover {
  background: var(--db-surface2);
}
.nav-hamburger.open .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-hamburger.open .hamburger-line:nth-child(2) {
  opacity: 0;
}
.nav-hamburger.open .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ── DETAIL PAGE (Manage Agent/Member) ────────────────── */
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.detail-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--db-text);
}
.detail-actions-btn {
  position: relative;
  display: inline-block;
}
.actions-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--db-surface);
  border: 1px solid var(--db-border);
  border-radius: 10px;
  min-width: 200px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  z-index: 200;
  overflow: hidden;
  display: none;
}
.actions-dropdown.open {
  display: block;
}
.actions-dropdown a,
.actions-dropdown button {
  display: block;
  width: 100%;
  padding: 11px 16px;
  text-align: left;
  font-size: 0.85rem;
  color: var(--db-text);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--db-transition);
  font-family: inherit;
}
.actions-dropdown a:hover,
.actions-dropdown button:hover {
  background: var(--db-surface2);
  color: var(--db-gold);
}
.actions-dropdown .danger {
  color: var(--db-danger);
}
.actions-dropdown .danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--db-danger);
}
.actions-dropdown hr {
  border: none;
  border-top: 1px solid var(--db-border);
  margin: 4px 0;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--db-border);
  border: 1px solid var(--db-border);
  border-radius: var(--db-radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.detail-stat {
  background: var(--db-surface);
  padding: 18px 16px;
}
.detail-stat .label {
  font-size: 0.75rem;
  color: var(--db-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.detail-stat .value {
  font-size: 1rem;
  color: var(--db-text);
  font-weight: 700;
}
.detail-stat .value.highlight {
  color: var(--db-gold);
  font-size: 1.2rem;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
}
.info-table tr {
  border-bottom: 1px solid var(--db-border);
}
.info-table tr:last-child {
  border-bottom: none;
}
.info-table td {
  padding: 13px 16px;
  font-size: 0.875rem;
  color: var(--db-text);
  vertical-align: middle;
}
.info-table td:first-child {
  color: var(--db-muted);
  font-weight: 600;
  width: 180px;
  font-size: 0.8rem;
}
.info-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--db-muted);
  padding: 14px 16px 8px;
  border-bottom: 1px solid var(--db-border);
}

/* ── SEARCH INPUT ─────────────────────────────────────── */
.search-wrap {
  position: relative;
  margin-bottom: 16px;
}
.search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--db-muted);
  font-size: 0.85rem;
}
.search-wrap input {
  padding-left: 36px;
  background: var(--db-surface2);
  border: 1px solid var(--db-border);
  color: var(--db-text);
}
.search-wrap input::placeholder {
  color: var(--db-muted);
  opacity: 0.6;
}
.search-wrap input:focus {
  border-color: var(--db-gold);
}

/* ── TOAST ────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--db-surface);
  border: 1px solid var(--db-border);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 0.875rem;
  color: var(--db-text);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 380px;
  animation: toast-in 0.3s ease;
}
.toast.success {
  border-left: 3px solid var(--db-success);
}
.toast.error {
  border-left: 3px solid var(--db-danger);
}
.toast.warning {
  border-left: 3px solid var(--db-warning);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(110%);
  }
}

/* ── PROFILE CARD ─────────────────────────────────────── */
.profile-card {
  background: linear-gradient(
    135deg,
    var(--db-surface) 0%,
    var(--db-surface2) 100%
  );
  border: 1px solid var(--db-border);
  border-radius: var(--db-radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}
.profile-card::after {
  content: "";
  position: absolute;
  bottom: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 1px solid rgba(245, 197, 24, 0.08);
  pointer-events: none;
}
.profile-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--db-text);
  margin-bottom: 4px;
}
.profile-id {
  font-size: 0.78rem;
  color: var(--db-gold);
  letter-spacing: 0.1em;
  font-family: monospace;
}
.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(245, 197, 24, 0.1);
  border: 2px solid rgba(245, 197, 24, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--db-gold);
  font-weight: 800;
  flex-shrink: 0;
}
.completion-bar-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.completion-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--db-gold), var(--db-orange));
  border-radius: 99px;
  transition: width 1s ease;
}

/* ── NOTIFICATION ITEMS ─────────────────────────────── */
.notif-item {
  display: flex;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--db-border);
  align-items: flex-start;
}
.notif-item:last-child {
  border-bottom: none;
}
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--db-gold);
  margin-top: 6px;
  flex-shrink: 0;
}
.notif-dot.read {
  background: rgba(255, 255, 255, 0.15);
}
.notif-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--db-text);
  margin-bottom: 3px;
}
.notif-msg {
  font-size: 0.8rem;
  color: var(--db-muted);
  line-height: 1.6;
}
.notif-time {
  font-size: 0.7rem;
  color: rgba(136, 153, 176, 0.6);
  margin-top: 4px;
}

/* ── TIER BADGES ──────────────────────────────────────── */
.tier-badge-int {
  background: rgba(245, 197, 24, 0.1);
  color: var(--db-gold);
}
.tier-badge-sor {
  background: rgba(232, 119, 34, 0.1);
  color: var(--db-orange);
}
.tier-badge-agent {
  background: rgba(34, 197, 94, 0.1);
  color: var(--db-success);
}

/* ── GRID HELPERS ─────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .dash-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .detail-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dash-sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    height: 100vh;
    width: 260px;
  }
  .dash-sidebar.open {
    transform: translateX(0);
  }
  .dash-main {
    margin-left: 0;
  }
  .dash-content {
    padding: 14px 12px;
  }
  .sidebar-toggle {
    display: flex;
  }
  .dash-topbar {
    padding: 0 12px;
    height: 54px;
  }
  .dash-page-title {
    font-size: 0.9rem;
  }
  .dash-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }
  .dash-stat-card {
    padding: 14px 12px;
    gap: 10px;
  }
  .dash-stat-value {
    font-size: 1.4rem;
  }
  .dash-stat-icon {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  .dash-panel-header {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .dash-panel-body {
    padding: 12px 14px;
  }
  .dash-table-wrap {
    max-height: 60vh;
  }
  .dash-table {
    min-width: 500px;
  }
  .dash-table th,
  .dash-table td {
    padding: 10px 10px;
    font-size: 0.8rem;
  }
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    border-radius: 14px 14px 0 0;
    max-height: 90vh;
    margin: 0;
    max-width: 100% !important;
    width: 100%;
  }
  .modal-header::before {
    content: "";
    display: block;
    width: 32px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    margin: 0 auto 10px;
  }
  .modal-header {
    padding: 8px 16px 12px;
  }
  .modal-body {
    padding: 12px 16px;
  }
  .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .dash-topbar-right .btn-outline-navy {
    display: none;
  }
  .sidebar-nav {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    scrollbar-width: none;
  }
  .detail-stats {
    grid-template-columns: 1fr 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .dash-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .dash-stat-card {
    padding: 12px 10px;
    gap: 8px;
  }
  .dash-stat-value {
    font-size: 1.3rem;
  }
  .dash-stat-icon {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }
  .dash-content {
    padding: 10px 8px;
  }
  .dash-topbar {
    padding: 0 10px;
    height: 50px;
  }
  .dash-table {
    min-width: 420px;
  }
  .info-table td:first-child {
    width: 120px;
  }
  .detail-stats {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── TOPBAR BUTTON LABELS ─────────────────────────────── */
@media (max-width: 420px) {
  .dash-topbar-right .btn-label {
    display: none;
  }
  .dash-topbar-right .btn {
    padding: 6px 9px;
  }
}

/* ── SCROLL HINT on table ─────────────────────────────── */
@media (max-width: 768px) {
  .dash-panel .dash-table-wrap::before {
    content: "← scroll →";
    display: block;
    text-align: center;
    font-size: 0.65rem;
    color: var(--db-muted);
    letter-spacing: 0.08em;
    padding: 5px 0 3px;
    text-transform: uppercase;
    opacity: 0.6;
  }
}

/* ── FILTER BAR ───────────────────────────────────────── */
@media (max-width: 640px) {
  .dash-panel-body [style*="flex"] {
    flex-wrap: wrap !important;
  }
  .dash-panel-body .form-control {
    min-width: 0;
    flex: 1 1 140px;
  }
}


/* ── LIGHT THEME SURFACE OVERRIDES ────────────────────── */
/* Sidebar + topbar deliberately stay dark navy — no overrides */

/* Page / main background */
html.light-theme .dash-page,
body.light-theme .dash-page { background: #eef1f7; color: #0d1e3a; }
html.light-theme .dash-main,
body.light-theme .dash-main { background: #eef1f7; }
html.light-theme .dash-content,
body.light-theme .dash-content { background: #eef1f7; }

/* Panels — white cards with depth */
html.light-theme .dash-panel,
body.light-theme .dash-panel {
  background: #ffffff;
  border-color: rgba(10,25,64,.08);
  box-shadow: 0 2px 12px rgba(10,25,64,.07);
}
html.light-theme .dash-stat-card,
body.light-theme .dash-stat-card {
  background: #ffffff;
  border-color: rgba(10,25,64,.08);
  box-shadow: 0 2px 8px rgba(10,25,64,.06);
}
html.light-theme .dash-panel-header,
body.light-theme .dash-panel-header {
  background: #f5f8ff;
  border-color: rgba(10,25,64,.08);
}
html.light-theme .dash-panel-body,
body.light-theme .dash-panel-body { background: #ffffff; }

/* Text */
html.light-theme .dash-stat-value,
body.light-theme .dash-stat-value { color: #0a1940; }
html.light-theme .dash-stat-label,
body.light-theme .dash-stat-label { color: #4a5e80; }
html.light-theme .dash-panel-title,
body.light-theme .dash-panel-title { color: #0a1940; }
/* Topbar title stays white — topbar is still dark navy */

/* Tables */
html.light-theme .dash-table,
body.light-theme .dash-table { background: #ffffff; }
html.light-theme .dash-table th,
body.light-theme .dash-table th {
  background: #eef1f7;
  color: #4a5e80;
  border-color: rgba(10,25,64,.08);
}
html.light-theme .dash-table td,
body.light-theme .dash-table td {
  background: #ffffff;
  color: #0d1e3a;
  border-color: rgba(10,25,64,.07);
}
html.light-theme .dash-table tr:hover td,
body.light-theme .dash-table tr:hover td { background: #f5f7ff; }

/* Badges */
html.light-theme .badge-gray,
body.light-theme .badge-gray { background: rgba(10,25,64,.07); color: #4a5e80; }
html.light-theme .badge-navy,
body.light-theme .badge-navy {
  background: rgba(10,25,64,.08);
  color: #0a1940;
  border-color: rgba(10,25,64,.15);
}

/* Buttons */
html.light-theme .btn-secondary,
body.light-theme .btn-secondary {
  background: #e2e8f5;
  color: #0d1e3a;
  border-color: rgba(10,25,64,.15);
}
html.light-theme .btn-secondary:hover,
body.light-theme .btn-secondary:hover { background: #d4ddf0; }
html.light-theme .btn-outline-navy,
body.light-theme .btn-outline-navy { color: #0a1940; border-color: #0a1940; }

/* Forms */
html.light-theme .form-control,
body.light-theme .form-control {
  background: #ffffff;
  border-color: rgba(10,25,64,.2);
  color: #0d1e3a;
}
html.light-theme .form-control::placeholder,
body.light-theme .form-control::placeholder { color: #8899b0; }
html.light-theme .form-label,
body.light-theme .form-label { color: #4a5e80; }
html.light-theme select.form-control,
body.light-theme select.form-control { background-color: #ffffff; }

/* Modals */
html.light-theme .modal,
body.light-theme .modal {
  background: #ffffff;
  border-color: rgba(10,25,64,.1);
  box-shadow: 0 20px 60px rgba(10,25,64,.18);
}
html.light-theme .modal-header,
body.light-theme .modal-header {
  background: #f5f8ff;
  border-color: rgba(10,25,64,.08);
}
html.light-theme .modal-footer,
body.light-theme .modal-footer {
  background: #f5f8ff;
  border-color: rgba(10,25,64,.08);
}
html.light-theme .modal-title,
body.light-theme .modal-title { color: #0a1940; }
html.light-theme .modal-close-btn,
body.light-theme .modal-close-btn {
  background: #e2e8f5;
  border-color: rgba(10,25,64,.12);
  color: #4a5e80;
}

/* Alerts */
html.light-theme .alert-info,
body.light-theme .alert-info {
  background: rgba(29,78,216,.07);
  border-color: rgba(29,78,216,.2);
  color: #1d4ed8;
}
html.light-theme .alert-success,
body.light-theme .alert-success {
  background: rgba(21,128,61,.08);
  border-color: rgba(21,128,61,.2);
  color: #15803d;
}
html.light-theme .alert-danger,
body.light-theme .alert-danger {
  background: rgba(185,28,28,.07);
  border-color: rgba(185,28,28,.2);
  color: #b91c1c;
}
html.light-theme .alert-warning,
body.light-theme .alert-warning {
  background: rgba(180,83,9,.07);
  border-color: rgba(180,83,9,.2);
  color: #b45309;
}

/* Pagination */
html.light-theme .page-btn,
body.light-theme .page-btn {
  background: #ffffff;
  color: #4a5e80;
  border-color: rgba(10,25,64,.15);
}
html.light-theme .page-btn:hover,
body.light-theme .page-btn:hover { background: #eef1f7; color: #0a1940; }
html.light-theme .page-btn.active,
body.light-theme .page-btn.active { background: #0a1940; color: #f5c518; border-color: #0a1940; }

/* Detail stats */
html.light-theme .detail-stat,
body.light-theme .detail-stat { background: #ffffff; }
html.light-theme .detail-stat .value,
body.light-theme .detail-stat .value { color: #0a1940; }
html.light-theme .detail-stat .label,
body.light-theme .detail-stat .label { color: #4a5e80; }
html.light-theme .detail-stats,
body.light-theme .detail-stats { border-color: rgba(10,25,64,.08); }

/* Info table */
html.light-theme .info-table td,
body.light-theme .info-table td { color: #0d1e3a; border-color: rgba(10,25,64,.07); }
html.light-theme .info-table td:first-child,
body.light-theme .info-table td:first-child { color: #4a5e80; }

/* Profile card */
html.light-theme .profile-card,
body.light-theme .profile-card {
  background: linear-gradient(135deg, #ffffff 0%, #eef1f7 100%);
  border-color: rgba(10,25,64,.08);
  box-shadow: 0 2px 12px rgba(10,25,64,.08);
}
html.light-theme .profile-name,
body.light-theme .profile-name { color: #0a1940; }

/* Toast */
html.light-theme .toast,
body.light-theme .toast {
  background: #ffffff;
  border-color: rgba(10,25,64,.1);
  color: #0d1e3a;
  box-shadow: 0 8px 32px rgba(10,25,64,.12);
}

/* Actions dropdown */
html.light-theme .actions-dropdown,
body.light-theme .actions-dropdown {
  background: #ffffff;
  border-color: rgba(10,25,64,.1);
  box-shadow: 0 8px 24px rgba(10,25,64,.12);
}
html.light-theme .actions-dropdown a,
html.light-theme .actions-dropdown button,
body.light-theme .actions-dropdown a,
body.light-theme .actions-dropdown button { color: #0d1e3a; }
html.light-theme .actions-dropdown a:hover,
html.light-theme .actions-dropdown button:hover,
body.light-theme .actions-dropdown a:hover,
body.light-theme .actions-dropdown button:hover { background: #eef1f7; }

/* Search */
html.light-theme .search-wrap input,
body.light-theme .search-wrap input {
  background: #ffffff;
  border-color: rgba(10,25,64,.2);
  color: #0d1e3a;
}

/* Notif items */
html.light-theme .notif-title,
body.light-theme .notif-title { color: #0a1940; }
html.light-theme .notif-item,
body.light-theme .notif-item { border-color: rgba(10,25,64,.08); }
html.light-theme .notif-msg,
body.light-theme .notif-msg { color: #4a5e80; }
