/* ============================================================
   GenuineProKey — Admin Panel CSS  (dark-first, responsive)
   ============================================================ */

/* ── CSS Custom Properties (dark mode = default) ─────────── */
:root {
  /* Brand */
  --primary:        #818cf8;
  --primary-dark:   #6366f1;
  --primary-light:  rgba(99,102,241,0.18);
  --success:        #34d399;
  --warning:        #fbbf24;
  --danger:         #f87171;
  --info:           #60a5fa;
  --accent:         #f59e0b;

  /* Dark palette (default) */
  --bg:             #0f172a;
  --card:           #1e293b;
  --card-hover:     #243448;
  --sidebar-bg:     #0d1526;
  --sidebar-text:   #8b9ab8;
  --sidebar-hover:  rgba(255,255,255,0.07);
  --sidebar-active: #6366f1;
  --text:           #e2e8f0;
  --text-muted:     #64748b;
  --border:         #2e4166;
  --shadow:         0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:      0 6px 24px rgba(0,0,0,0.5);

  /* Sizing */
  --radius:    10px;
  --sidebar-w: 260px;
  --topbar-h:  64px;
  --transition: 0.2s ease;

  /* Fluid font sizes (overridden at breakpoints) */
  --fs-xs:   11px;
  --fs-sm:   12px;
  --fs-base: 13.5px;
  --fs-md:   14px;
  --fs-lg:   15px;
  --fs-xl:   18px;
  --fs-2xl:  22px;
  --fs-3xl:  26px;
}

/* ── Light Mode Overrides ─────────────────────────────────── */
[data-theme="light"] {
  --primary:        #6366f1;
  --primary-dark:   #4f46e5;
  --primary-light:  #e0e7ff;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;
  --bg:             #f1f5f9;
  --card:           #ffffff;
  --card-hover:     #f8fafc;
  --sidebar-bg:     #1e1b4b;
  --sidebar-text:   #c7d2fe;
  --sidebar-hover:  rgba(255,255,255,0.08);
  --sidebar-active: #6366f1;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --border:         #e2e8f0;
  --shadow:         0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:      0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
}

/* ── Base Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a   { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul  { list-style: none; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar        { width: 5px; height: 5px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

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

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--primary-dark);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.sidebar-logo .logo-text { font-size: var(--fs-md); font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-logo .logo-sub  { font-size: var(--fs-xs); color: var(--sidebar-text); opacity: 0.7; margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-section { margin-bottom: 4px; }
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-text);
  opacity: 0.4;
  padding: 8px 20px 4px;
}

.nav-item { display: block; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative;
  border-radius: 0;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: var(--sidebar-active); color: #fff; }
.nav-link.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: rgba(255,255,255,0.45);
  border-radius: 0 2px 2px 0;
}
.nav-link i { width: 17px; text-align: center; font-size: var(--fs-sm); flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  line-height: 1.4;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: var(--fs-sm); font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 10.5px; color: var(--sidebar-text); opacity: 0.6; }

/* ── Main Area ─────────────────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── Topbar ──────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}

.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 17px;
  padding: 6px;
  line-height: 1;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--border); color: var(--text); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}
.breadcrumb .sep { opacity: 0.4; }
.breadcrumb .current { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.topbar-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--fs-sm);
  transition: all var(--transition);
}
.topbar-btn:hover { background: var(--border); color: var(--text); }

/* Theme toggle */
.theme-toggle:hover { color: var(--warning); border-color: var(--warning); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  transition: background var(--transition);
  white-space: nowrap;
}
.topbar-user:hover { background: var(--border); }
.topbar-user .ta-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Page Content ──────────────────────────────────────── */
.page-content { flex: 1; padding: 24px 28px; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-header-left .page-title    { font-size: var(--fs-2xl); font-weight: 700; color: var(--text); line-height: 1.2; }
.page-header-left .page-subtitle { font-size: var(--fs-sm);  color: var(--text-muted); margin-top: 3px; }
.page-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-title { font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.card-body  { padding: 18px; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.025);
}
[data-theme="light"] .card-footer { background: var(--bg); }

/* ── Stat Cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
/* Dark icon colors */
.stat-icon.purple { background: rgba(139,92,246,0.18);  color: #a78bfa; }
.stat-icon.green  { background: rgba(52,211,153,0.18);  color: #34d399; }
.stat-icon.blue   { background: rgba(96,165,250,0.18);  color: #60a5fa; }
.stat-icon.orange { background: rgba(251,146,60,0.18);  color: #fb923c; }
.stat-icon.red    { background: rgba(248,113,113,0.18); color: #f87171; }
/* Light icon colors */
[data-theme="light"] .stat-icon.purple { background: #ede9fe; color: #7c3aed; }
[data-theme="light"] .stat-icon.green  { background: #d1fae5; color: #059669; }
[data-theme="light"] .stat-icon.blue   { background: #dbeafe; color: #2563eb; }
[data-theme="light"] .stat-icon.orange { background: #ffedd5; color: #ea580c; }
[data-theme="light"] .stat-icon.red    { background: #fee2e2; color: #dc2626; }

.stat-info  { flex: 1; min-width: 0; }
.stat-value { font-size: var(--fs-2xl); font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-label { font-size: var(--fs-xs);  color: var(--text-muted); margin-top: 2px; }
.stat-change {
  font-size: var(--fs-xs);
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-change.up      { color: var(--success); }
.stat-change.down    { color: var(--danger); }
.stat-change.warning { color: var(--warning); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; }
thead th {
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
[data-theme="light"] thead th { background: var(--bg); }

tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: var(--fs-base);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.04); }
[data-theme="light"] tbody tr:hover { background: #f8fafc; }

.col-check  { width: 40px; }
.col-action { width: 120px; text-align: right; }

.item-cell { display: flex; align-items: center; gap: 12px; }
.item-emoji {
  width: 38px; height: 38px;
  border-radius: 8px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
[data-theme="light"] .item-emoji { background: var(--bg); }
.item-name { font-weight: 600; color: var(--text); font-size: var(--fs-base); }
.item-sub  { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 1px; }

/* ============================================================
   BADGES / PILLS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
/* Dark badge defaults */
.badge-success { background: rgba(52,211,153,0.18);  color: #6ee7b7; }
.badge-warning { background: rgba(251,191,36,0.18);  color: #fcd34d; }
.badge-danger  { background: rgba(248,113,113,0.18); color: #fca5a5; }
.badge-info    { background: rgba(96,165,250,0.18);  color: #93c5fd; }
.badge-gray    { background: rgba(148,163,184,0.15); color: #94a3b8; }
.badge-purple  { background: rgba(167,139,250,0.18); color: #c4b5fd; }
/* Light badge overrides */
[data-theme="light"] .badge-success { background: #d1fae5; color: #065f46; }
[data-theme="light"] .badge-warning { background: #fef3c7; color: #92400e; }
[data-theme="light"] .badge-danger  { background: #fee2e2; color: #991b1b; }
[data-theme="light"] .badge-info    { background: #dbeafe; color: #1e40af; }
[data-theme="light"] .badge-gray    { background: #f1f5f9; color: #475569; }
[data-theme="light"] .badge-purple  { background: #ede9fe; color: #5b21b6; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), opacity var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }
.btn-primary:hover { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.25); }
.btn-success { background: #059669; color: #fff; border-color: #059669; }
.btn-success:hover { background: #047857; }
.btn-danger  { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn-danger:hover  { background: #dc2626; }
.btn-warning { background: #d97706; color: #fff; border-color: #d97706; }
.btn-light {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border-color: var(--border);
}
.btn-light:hover { background: rgba(255,255,255,0.14); border-color: var(--text-muted); }
[data-theme="light"] .btn-light { background: var(--bg); }
[data-theme="light"] .btn-light:hover { background: var(--border); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-outline-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-outline-danger:hover { background: rgba(248,113,113,0.12); }
[data-theme="light"] .btn-outline-danger:hover { background: #fee2e2; }

.btn-sm   { padding: 5px 12px; font-size: var(--fs-sm); border-radius: 6px; }
.btn-xs   { padding: 3px 8px;  font-size: var(--fs-xs); border-radius: 5px; }
.btn-icon { padding: 7px; width: 34px; height: 34px; justify-content: center; }

.actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.action-btn {
  width: 30px; height: 30px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  transition: all var(--transition);
  text-decoration: none;
}
.action-btn:hover        { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.action-btn.delete:hover { background: rgba(248,113,113,0.15); color: var(--danger); border-color: var(--danger); }
.action-btn.view:hover   { background: rgba(96,165,250,0.15);  color: var(--info);   border-color: var(--info); }
[data-theme="light"] .action-btn.delete:hover { background: #fee2e2; }
[data-theme="light"] .action-btn.view:hover   { background: #dbeafe; }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid   { display: grid; gap: 18px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }

.form-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.form-label .req { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 13px;
  font-family: inherit;
  font-size: var(--fs-base);
  color: var(--text);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
[data-theme="light"] .form-control { background: var(--card); }
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-control::placeholder { color: var(--text-muted); opacity: 0.65; }
.form-control:disabled { opacity: 0.5; cursor: not-allowed; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
[data-theme="light"] select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

textarea.form-control { resize: vertical; min-height: 100px; }

.form-hint  { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.form-error { font-size: var(--fs-xs); color: var(--danger); margin-top: 2px; }

.has-error .form-control { border-color: var(--danger); }

.check-group { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check-group input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }
.check-group label { font-size: var(--fs-base); cursor: pointer; }

.search-bar {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
}
.search-bar i { padding: 0 12px; color: var(--text-muted); font-size: var(--fs-sm); flex-shrink: 0; }
.search-bar input {
  border: none;
  outline: none;
  padding: 9px 12px 9px 0;
  font-family: inherit;
  font-size: var(--fs-base);
  color: var(--text);
  width: 220px;
  background: transparent;
}
.search-bar input::placeholder { color: var(--text-muted); opacity: 0.6; }

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-select {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--text);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
[data-theme="light"] .filter-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.filter-select:focus { border-color: var(--primary); }

/* ============================================================
   PAGINATION / TABLE FOOTER
   ============================================================ */
.tbl-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(255,255,255,0.025);
  border-radius: 0 0 var(--radius) var(--radius);
}
[data-theme="light"] .tbl-footer { background: var(--bg); }
.tbl-info { font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; }
.tbl-info strong { color: var(--text); }

.tbl-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.per-page-wrap  { display: flex; align-items: center; gap: 6px; }
.per-page-label { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.per-page-select {
  height: 30px; padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: border-color var(--transition);
}
.per-page-select:focus { outline: none; border-color: var(--primary); }

.pg-nav { display: flex; align-items: center; gap: 3px; }
.pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px; height: 30px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: var(--fs-xs);
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--card);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  user-select: none;
}
a.pg-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.pg-btn.active { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); cursor: default; font-weight: 700; }
.pg-btn[aria-disabled="true"], span.pg-btn:not(.active) { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.pg-ellipsis { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 30px; font-size: var(--fs-xs); color: var(--text-muted); user-select: none; }

/* ── Admin thumbnails ─────────────────────────────────── */
.admin-thumb {
  width: 38px; height: 38px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
}
.admin-thumb-placeholder {
  width: 38px; height: 38px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  color: var(--text-muted);
}
[data-theme="light"] .admin-thumb { background: var(--bg); }
[data-theme="light"] .admin-thumb-placeholder { background: var(--bg); }

/* ── Legacy pagination ─────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.pagination-info { font-size: var(--fs-sm); color: var(--text-muted); }
.pagination-links { display: flex; align-items: center; gap: 4px; }
.pagination-links a,
.pagination-links span {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 6px;
  font-size: var(--fs-xs);
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: all var(--transition);
  background: var(--card);
}
.pagination-links a:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.pagination-links .active { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }
.pagination-links .dots   { border: none; background: none; }

/* ============================================================
   ALERTS / FLASH
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: var(--fs-base);
  margin-bottom: 18px;
  border: 1px solid transparent;
}
/* Dark defaults */
.alert-success { background: rgba(52,211,153,0.12);  border-color: rgba(52,211,153,0.25);  color: #6ee7b7; }
.alert-danger  { background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.25); color: #fca5a5; }
.alert-warning { background: rgba(251,191,36,0.12);  border-color: rgba(251,191,36,0.25);  color: #fcd34d; }
.alert-info    { background: rgba(96,165,250,0.12);  border-color: rgba(96,165,250,0.25);  color: #93c5fd; }
.alert i { font-size: var(--fs-md); margin-top: 1px; flex-shrink: 0; }
/* Light overrides */
[data-theme="light"] .alert-success { background: #d1fae5; border-color: #a7f3d0; color: #065f46; }
[data-theme="light"] .alert-danger  { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
[data-theme="light"] .alert-warning { background: #fef3c7; border-color: #fde68a; color: #92400e; }
[data-theme="light"] .alert-info    { background: #dbeafe; border-color: #bfdbfe; color: #1e40af; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 26px;
}
.login-logo .icon {
  width: 44px; height: 44px;
  background: var(--primary-dark);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.login-logo .brand { font-size: var(--fs-xl); font-weight: 700; color: var(--text); }
.login-logo .brand small { display: block; font-size: var(--fs-xs); font-weight: 400; color: var(--text-muted); }
.login-title    { font-size: var(--fs-2xl); font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-subtitle { font-size: var(--fs-base); color: var(--text-muted); text-align: center; margin-bottom: 26px; }
.login-card .form-group { margin-bottom: 14px; }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; font-size: var(--fs-md); margin-top: 8px; }

.input-icon-wrap { position: relative; }
.input-icon-wrap i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: var(--fs-sm); }
.input-icon-wrap .form-control { padding-left: 36px; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 22px;
  margin-bottom: 22px;
}
.revenue-chart-placeholder {
  height: 220px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
}
[data-theme="light"] .revenue-chart-placeholder {
  background: linear-gradient(135deg, #f0f4ff, #e8edff);
  border: none;
}
.revenue-chart-placeholder .big-icon { font-size: 44px; opacity: 0.3; }

.top-products-list { display: flex; flex-direction: column; }
.top-product-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.top-product-item:last-child { border-bottom: none; }
.tp-rank {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: var(--fs-xs);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tp-rank.gold   { background: rgba(251,191,36,0.2);  color: #fbbf24; }
.tp-rank.silver { background: rgba(148,163,184,0.2); color: #94a3b8; }
.tp-rank.bronze { background: rgba(251,146,60,0.2);  color: #fb923c; }
[data-theme="light"] .tp-rank.gold   { background: #fef3c7; color: #b45309; }
[data-theme="light"] .tp-rank.silver { background: #f1f5f9; color: #475569; }
[data-theme="light"] .tp-rank.bronze { background: #ffedd5; color: #9a3412; }

.tp-info    { flex: 1; min-width: 0; }
.tp-name    { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-sales   { font-size: var(--fs-xs); color: var(--text-muted); }
.tp-revenue { font-size: var(--fs-sm); font-weight: 700; flex-shrink: 0; }

.order-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.dot-pending    { background: var(--warning); }
.dot-processing { background: var(--info); }
.dot-completed  { background: var(--success); }
.dot-cancelled  { background: var(--danger); }

/* ============================================================
   ORDER DETAIL
   ============================================================ */
.order-detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 22px;
  align-items: start;
}
.info-list { display: flex; flex-direction: column; }
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-key { font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; min-width: 120px; padding-top: 1px; }
.info-val { font-size: var(--fs-base); color: var(--text); flex: 1; }

/* ============================================================
   SETTINGS TABS
   ============================================================ */
.settings-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tab {
  padding: 10px 16px;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.settings-tab:hover  { color: var(--primary); }
.settings-tab.active { color: var(--primary); border-color: var(--primary); }
.settings-section          { display: none; }
.settings-section.active   { display: block; }

/* ============================================================
   TOAST
   ============================================================ */
.admin-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 10px;
  font-size: var(--fs-base);
  font-weight: 500;
  max-width: 340px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
  animation: toastIn .28s cubic-bezier(.22,.61,.36,1) both;
  cursor: default;
}
.admin-toast-success { background: #059669; color: #fff; }
.admin-toast-error   { background: #dc2626; color: #fff; }
.admin-toast-close { margin-left: auto; background: none; border: none; color: inherit; opacity: .7; cursor: pointer; font-size: 16px; padding: 0 0 0 8px; line-height: 1; flex-shrink: 0; }
.admin-toast-close:hover { opacity: 1; }
@keyframes toastIn  { from { transform: translateY(16px) scale(.96); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes toastOut { to   { transform: translateY(16px) scale(.96); opacity: 0; } }
.admin-toast.hiding { animation: toastOut .25s ease forwards; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 52px; margin-bottom: 14px; opacity: 0.35; }
.empty-state h3 { font-size: var(--fs-xl); font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p  { font-size: var(--fs-md); max-width: 300px; margin: 0 auto 18px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--card);
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  transform: scale(0.96);
  transition: transform var(--transition);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-title  { font-size: var(--fs-lg); font-weight: 700; }
.modal-close  { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 18px; padding: 2px; transition: color var(--transition); }
.modal-close:hover { color: var(--danger); }
.modal-body   { padding: 18px; }
.modal-footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 199;
}

/* ============================================================
   TOPBAR USER DROPDOWN
   ============================================================ */
.tu-wrap { position: relative; }
.tu-chevron { font-size: 11px; transition: transform 0.2s; color: var(--text-muted); }
.tu-chevron.open { transform: rotate(180deg); }
.tu-dropdown {
  display: none;
  position: fixed;
  z-index: 9999;
  width: 230px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.tu-dropdown.open { display: block; }
.tu-dd-profile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.tu-dd-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary-dark);
  color: #fff;
  font-size: var(--fs-md); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tu-dd-meta  { min-width: 0; }
.tu-dd-name  { font-size: var(--fs-sm); font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-dd-email { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.tu-dd-role  { display: inline-block; margin-top: 4px; font-size: 10px; font-weight: 600; color: var(--primary); background: var(--primary-light); padding: 2px 7px; border-radius: 20px; }
.tu-dd-sep   { height: 1px; background: var(--border); }
.tu-dd-logout {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: none; border: none;
  cursor: pointer;
  font-size: var(--fs-base); font-weight: 500;
  color: var(--danger);
  text-align: left;
  transition: background var(--transition);
}
.tu-dd-logout:hover { background: rgba(248,113,113,0.1); }
[data-theme="light"] .tu-dd-logout:hover { background: var(--bg); }
.tu-dd-logout i { font-size: var(--fs-sm); }

/* ============================================================
   UTILITIES
   ============================================================ */
.d-flex          { display: flex; }
.align-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.text-muted   { color: var(--text-muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }
.w-100  { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.hidden { display: none !important; }

/* ============================================================
   VARIABLE ALIASES (used in certain views)
   ============================================================ */
:root {
  --green:  #34d399;
  --blue:   #60a5fa;
  --red:    #f87171;
  --yellow: #fbbf24;
}
[data-theme="light"] {
  --green:  #059669;
  --blue:   #2563eb;
  --red:    #dc2626;
  --yellow: #b45309;
}

/* ============================================================
   ADDITIONAL BADGE VARIANTS
   ============================================================ */
.badge-green     { background: rgba(52,211,153,0.18);  color: #6ee7b7; }
.badge-yellow    { background: rgba(251,191,36,0.18);  color: #fcd34d; }
.badge-red       { background: rgba(248,113,113,0.18); color: #fca5a5; }
.badge-secondary { background: rgba(148,163,184,0.15); color: #94a3b8; }
[data-theme="light"] .badge-green     { background: #d1fae5; color: #065f46; }
[data-theme="light"] .badge-yellow    { background: #fef3c7; color: #92400e; }
[data-theme="light"] .badge-red       { background: #fee2e2; color: #991b1b; }
[data-theme="light"] .badge-secondary { background: #f1f5f9; color: #475569; }

/* ============================================================
   3-COLUMN STATS GRID VARIANT
   ============================================================ */
.stats-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

/* ============================================================
   BLOG CATEGORIES 2-COLUMN LAYOUT
   ============================================================ */
.blog-cat-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: start;
}
