/*
Theme Name: ResellerHub Dashboard
Theme URI: https://resellerhub.com
Author: ResellerHub
Description: A complete reseller management dashboard theme with login, dashboard, orders, products, earnings and commission tracking.
Version: 2.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: resellerhub
Tags: dashboard, reseller, ecommerce, custom-menu, custom-logo
*/

/* ============================================================
   ROOT VARIABLES
   ============================================================ */
:root {
  --primary:       #3a0ca3;
  --primary-light: #4361ee;
  --secondary:     #7209b7;
  --success:       #4cc9f0;
  --success-dark:  #0891b2;
  --danger:        #f72585;
  --warning:       #f8961e;
  --info:          #4895ef;
  --green:         #22c55e;
  --dark:          #1a1a2e;
  --light:         #f8f9fa;
  --border:        #e9ecef;
  --text:          #2d3748;
  --text-light:    #718096;
  --shadow:        0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -2px rgba(0,0,0,.05);
  --shadow-sm:     0 4px 6px -1px rgba(0,0,0,.10);
  --shadow-lg:     0 20px 25px -5px rgba(0,0,0,.10), 0 10px 10px -5px rgba(0,0,0,.04);
  --radius:        10px;
  --radius-sm:     6px;
  --sidebar-width: 260px;
  --header-height: 70px;
  --transition:    all 0.3s ease;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; overflow-x:hidden; max-width:100%; }
body {
  font-family: "Poppins", "Segoe UI", system-ui, sans-serif;
  background: #f5f7fb;
  color: var(--text);
  overflow-x: hidden;
  max-width:100%;
}
a { color: inherit; text-decoration: none; }
img { max-width:100%; display:block; }
button { font-family: inherit; }
ul, ol { list-style:none; }

::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:#f1f1f1; }
::-webkit-scrollbar-thumb { background:var(--primary-light); border-radius:10px; }
::-webkit-scrollbar-thumb:hover { background:var(--primary); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.rh-login-page {
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background: linear-gradient(135deg, var(--dark) 0%, #16213e 50%, #0f3460 100%);
  padding:20px;
  position:relative;
  overflow:hidden;
}
.rh-login-page::before {
  content:"";
  position:absolute; inset:0;
  background: radial-gradient(ellipse at 20% 50%, rgba(67,97,238,.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(114,9,183,.12) 0%, transparent 60%);
}
.rh-login-card {
  background:white;
  border-radius:16px;
  padding:44px 40px;
  width:100%;
  max-width:420px;
  box-shadow: var(--shadow-lg);
  position:relative;
  z-index:1;
  animation: fadeInUp .5s ease;
}
.rh-login-logo {
  text-align:center;
  margin-bottom:32px;
}
.rh-login-logo .logo-icon {
  width:60px; height:60px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius:14px;
  display:flex; align-items:center; justify-content:center;
  margin:0 auto 14px;
  box-shadow: 0 8px 20px rgba(58,12,163,.3);
}
.rh-login-logo .logo-icon i { font-size:26px; color:white; }
.rh-login-logo h1 { font-size:22px; font-weight:700; color:var(--dark); margin-bottom:4px; }
.rh-login-logo p  { font-size:13px; color:var(--text-light); }
.rh-login-tabs {
  display:flex;
  background:var(--light);
  border-radius:8px;
  padding:4px;
  margin-bottom:24px;
  gap:4px;
}
.rh-login-tab {
  flex:1; text-align:center; padding:9px;
  font-size:13px; font-weight:600;
  color:var(--text-light); border-radius:6px;
  cursor:pointer; transition:var(--transition);
}
.rh-login-tab.active {
  background:white;
  color:var(--primary);
  box-shadow:var(--shadow-sm);
}
.rh-form-group { margin-bottom:18px; }
.rh-form-group label {
  display:block; font-size:12.5px; font-weight:600;
  color:var(--text); margin-bottom:7px; letter-spacing:.02em;
}
.rh-form-group .input-wrap {
  position:relative; display:flex; align-items:center;
}
.rh-form-group .input-wrap i {
  position:absolute; left:14px;
  font-size:15px; color:var(--text-light); z-index:1;
}
.rh-form-group input, .rh-form-group select, .rh-form-group textarea {
  width:100%;
  padding:11px 14px 11px 42px;
  border:1.5px solid var(--border);
  border-radius:8px;
  font-size:14px;
  font-family:inherit;
  color:var(--text);
  background:white;
  transition:var(--transition);
  outline:none;
}
.rh-form-group input:focus, .rh-form-group select:focus, .rh-form-group textarea:focus {
  border-color:var(--primary-light);
  box-shadow:0 0 0 3px rgba(67,97,238,.12);
}
.rh-form-group input.no-icon, .rh-form-group select.no-icon, .rh-form-group textarea.no-icon {
  padding-left:14px;
}
.rh-forgot { text-align:right; margin-top:-10px; margin-bottom:18px; }
.rh-forgot a { font-size:12.5px; color:var(--primary-light); }
.rh-divider {
  display:flex; align-items:center; gap:12px;
  margin:20px 0; color:var(--text-light); font-size:12px;
}
.rh-divider::before, .rh-divider::after {
  content:""; flex:1; height:1px; background:var(--border);
}
.rh-login-footer { text-align:center; font-size:12.5px; color:var(--text-light); margin-top:20px; }
.rh-login-footer a { color:var(--primary); font-weight:600; }
.rh-login-error {
  background:rgba(247,37,133,.08);
  border:1px solid rgba(247,37,133,.25);
  color:var(--danger);
  border-radius:8px; padding:10px 14px;
  font-size:13px; margin-bottom:16px;
  display:flex; align-items:center; gap:8px;
}

/* ============================================================
   APP SHELL LAYOUT
   ============================================================ */
.rh-overlay {
  display:none; position:fixed; inset:0;
  background:rgba(0,0,0,.5); z-index:999;
  backdrop-filter:blur(2px);
}
.rh-overlay.show { display:block; }

.rh-shell {
  display:grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  min-height:100vh;
  max-width:100vw;
  overflow-x:hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.rh-sidebar {
  grid-row: 1 / 3;
  background: linear-gradient(180deg, #0d1a3f 0%, #0a1230 55%, #060a1c 100%);
  color:white;
  overflow-y:auto;
  transition:var(--transition);
  box-shadow:var(--shadow);
  z-index:1000;
  position:relative;
  display:flex;
  flex-direction:column;
}
.rh-sidebar::before {
  content:""; position:absolute; top:0; right:0;
  height:100%; width:1px;
  background:linear-gradient(to bottom, rgba(255,255,255,.1), transparent);
}
.rh-sidebar-logo {
  padding:22px 22px 20px;
  border-bottom:1px solid rgba(255,255,255,.07);
  margin-bottom:10px;
  display:flex; align-items:center; justify-content:space-between;
}
.rh-sidebar-logo-mark {
  display:flex; align-items:center; gap:11px;
}
.rh-sidebar-logo-mark img {
  width:38px; height:auto; display:block; flex-shrink:0;
  filter:drop-shadow(0 2px 6px rgba(0,0,0,.35));
}
.rh-sidebar-logo h1 {
  font-size:19px; font-weight:700; color:white;
  display:flex; align-items:center; gap:3px;
  letter-spacing:-.2px;
  font-family:'Poppins',sans-serif;
}
.rh-sidebar-logo h1 span {
  background:linear-gradient(90deg, #4d7fff, #f97316);
  -webkit-background-clip:text; background-clip:text;
  -webkit-text-fill-color:transparent;
}
.rh-sidebar-close {
  display:none;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.1);
  color:white;
  width:30px; height:30px; border-radius:9px;
  font-size:13px; cursor:pointer;
  align-items:center; justify-content:center;
  transition:var(--transition);
}
.rh-sidebar-close:hover { background:rgba(255,255,255,.16); }

.rh-nav-menu { padding:6px 14px 16px; flex:1; }

.rh-menu-heading {
  padding:18px 10px 8px;
  font-size:10px; text-transform:uppercase;
  letter-spacing:1.3px; color:rgba(255,255,255,.32); font-weight:600;
  font-family:'Poppins',sans-serif;
}
.rh-menu-heading:first-child { padding-top:10px; }

.rh-nav-item {
  display:flex; align-items:center; gap:12px;
  padding:10.5px 14px;
  cursor:pointer;
  transition:background .18s ease, color .18s ease;
  margin:2px 0;
  border-radius:10px;
  position:relative;
  color:rgba(255,255,255,.62);
  font-size:13.5px; font-weight:500;
  text-decoration:none;
  font-family:'Poppins',sans-serif;
}
.rh-nav-item i {
  width:19px; text-align:center;
  font-size:14.5px !important;
  flex-shrink:0;
  transition:var(--transition);
  color:rgba(255,255,255,.5);
}
.rh-nav-item span { font-size:13.5px; line-height:1; }
.rh-nav-item:hover {
  background:rgba(255,255,255,.06);
  color:white;
}
.rh-nav-item:hover i { color:white; }
.rh-nav-item.active {
  background:linear-gradient(90deg, rgba(22,82,240,.9), rgba(22,82,240,.55));
  color:white; font-weight:600;
  box-shadow:0 4px 14px rgba(22,82,240,.35);
}
.rh-nav-item.active i { color:var(--mm-orange, #f97316); }

.rh-sidebar-user {
  padding:16px 20px;
  border-top:1px solid rgba(255,255,255,.08);
  margin-top:auto;
  display:flex; align-items:center; gap:12px;
  background:rgba(255,255,255,.02);
}
.rh-sidebar-avatar {
  width:36px; height:36px; border-radius:50%;
  background:linear-gradient(135deg, var(--primary-light), var(--secondary));
  display:flex; align-items:center; justify-content:center;
  font-size:14px; font-weight:700; color:white; flex-shrink:0;
}
.rh-sidebar-username { font-size:13px; font-weight:600; color:white; font-family:'Poppins',sans-serif; }
.rh-sidebar-userrole { font-size:11px; color:rgba(255,255,255,.45); font-family:'Poppins',sans-serif; }
.rh-sidebar-logout {
  margin-left:auto;
  background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.12);
  color:rgba(255,255,255,.55); border-radius:8px;
  cursor:pointer; font-size:14px; transition:var(--transition);
  padding:7px 9px; display:flex; align-items:center; justify-content:center;
  text-decoration:none;
}
.rh-sidebar-logout:hover { color:white; background:rgba(239,68,68,.3); border-color:rgba(239,68,68,.45); }

/* ============================================================
   TOPBAR / HEADER
   ============================================================ */
.rh-header {
  grid-column:2;
  background:white;
  display:flex; align-items:center;
  justify-content:space-between;
  padding:0 28px;
  box-shadow:var(--shadow-sm);
  z-index:100;
  position:sticky; top:0;
}
.rh-header-left { display:flex; align-items:center; gap:14px; }
.rh-hamburger {
  display:none;
  background:none; border:none; cursor:pointer;
  width:38px; height:38px; border-radius:8px;
  align-items:center; justify-content:center;
  font-size:19px; color:var(--text);
  transition:var(--transition);
}
.rh-hamburger:hover { background:var(--light); color:var(--primary); }

.rh-search {
  display:flex; align-items:center;
  background:var(--light); border-radius:50px;
  padding:8px 18px; width:320px;
  border:1px solid transparent; transition:var(--transition);
}
.rh-search:focus-within {
  box-shadow:0 0 0 2px rgba(67,97,238,.1);
  border-color:rgba(67,97,238,.3);
}
.rh-search i { font-size:15px; color:var(--text-light); }
.rh-search input {
  border:none; background:none; outline:none;
  width:100%; padding:5px 10px;
  font-size:13.5px; color:var(--text); font-family:inherit;
}
.rh-search input::placeholder { color:var(--text-light); }

.rh-header-actions { display:flex; align-items:center; gap:4px; }

.rh-header-icon {
  position:relative; width:40px; height:40px;
  display:flex; align-items:center; justify-content:center;
  border-radius:50%; cursor:pointer; transition:var(--transition);
  color:var(--text-light);
}
.rh-header-icon i { font-size:18px !important; transition:var(--transition); }
.rh-header-icon:hover { background:rgba(67,97,238,.08); }
.rh-header-icon:hover i { color:var(--primary); transform:translateY(-2px); }
.rh-header-badge {
  position:absolute; top:4px; right:4px;
  background:var(--danger); color:white;
  border-radius:50%; width:17px; height:17px;
  font-size:9px; font-weight:700;
  display:flex; align-items:center; justify-content:center;
  border:2px solid white;
}

.rh-user-pill {
  display:flex; align-items:center; gap:10px;
  padding:6px 12px; border-radius:var(--radius);
  cursor:pointer; transition:var(--transition); margin-left:8px;
}
.rh-user-pill:hover { background:rgba(67,97,238,.05); }
.rh-user-avatar {
  width:40px; height:40px; border-radius:50%;
  background:linear-gradient(135deg, var(--secondary), var(--primary));
  display:flex; align-items:center; justify-content:center;
  font-size:15px; font-weight:700; color:white;
  box-shadow:0 3px 8px rgba(67,97,238,.2);
}
.rh-user-name  { font-size:13.5px; font-weight:600; }
.rh-user-role  { font-size:11.5px; color:var(--text-light); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.rh-main {
  grid-column:2;
  min-width:0;
  overflow-x:hidden;
  padding:26px 28px 40px;
  overflow-y:auto;
}

.rh-page-header {
  display:flex; align-items:flex-start;
  justify-content:space-between; flex-wrap:wrap;
  gap:14px; margin-bottom:26px;
  animation:fadeIn .4s ease;
}
.rh-page-header-left {}
.rh-page-title {
  font-size:26px; font-weight:700; color:var(--dark);
  position:relative; padding-bottom:10px; margin-bottom:4px;
}
.rh-page-title::after {
  content:""; position:absolute; bottom:0; left:0;
  width:38px; height:3px;
  background:linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius:10px;
}
.rh-page-sub { font-size:13px; color:var(--text-light); }
.rh-page-actions { display:flex; gap:10px; flex-wrap:wrap; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.rh-stats-grid {
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:20px; margin-bottom:24px;
  animation:fadeInUp .5s ease;
}
.rh-stat-card {
  background:white; border-radius:var(--radius);
  padding:24px; box-shadow:var(--shadow-sm);
  transition:all .4s ease; position:relative;
  overflow:hidden; border:1px solid rgba(0,0,0,.03);
}
.rh-stat-card::before {
  content:""; position:absolute; top:0; left:0;
  width:5px; height:100%; opacity:.9;
}
.rh-stat-card:nth-child(1)::before { background:linear-gradient(to bottom,var(--primary),var(--primary-light)); }
.rh-stat-card:nth-child(2)::before { background:linear-gradient(to bottom,var(--info),var(--success)); }
.rh-stat-card:nth-child(3)::before { background:linear-gradient(to bottom,var(--green),#16a34a); }
.rh-stat-card:nth-child(4)::before { background:linear-gradient(to bottom,var(--warning),#f59e0b); }
.rh-stat-card:hover { transform:translateY(-6px); box-shadow:var(--shadow); }

.rh-stat-top { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:16px; }
.rh-stat-icon {
  width:56px; height:56px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:22px; color:white;
  box-shadow:0 6px 10px rgba(0,0,0,.12); transition:var(--transition);
}
.rh-stat-card:hover .rh-stat-icon { transform:scale(1.1); }
.rh-stat-icon.ic-purple { background:linear-gradient(135deg,var(--primary),var(--secondary)); }
.rh-stat-icon.ic-blue   { background:linear-gradient(135deg,var(--info),#4cc9f0); }
.rh-stat-icon.ic-green  { background:linear-gradient(135deg,var(--green),#16a34a); }
.rh-stat-icon.ic-orange { background:linear-gradient(135deg,var(--warning),#f59e0b); }
.rh-stat-icon.ic-pink   { background:linear-gradient(135deg,var(--danger),#e11d48); }
.rh-stat-icon.ic-teal   { background:linear-gradient(135deg,var(--success),#0e7490); }

.rh-stat-value {
  font-size:28px; font-weight:700; color:var(--dark);
  transition:var(--transition); margin-bottom:4px;
}
.rh-stat-card:hover .rh-stat-value { color:var(--primary); }
.rh-stat-label { font-size:13.5px; color:var(--text-light); font-weight:500; }
.rh-stat-change {
  display:flex; align-items:center; gap:5px;
  font-size:12.5px; font-weight:600; padding-top:10px;
}
.rh-stat-change i { font-size:13px !important; }
.rh-stat-change.up   { color:var(--success-dark); }
.rh-stat-change.down { color:var(--danger); }
.rh-stat-change.neutral { color:var(--text-light); }

/* ============================================================
   CARDS
   ============================================================ */
.rh-card {
  background:white; border-radius:var(--radius);
  box-shadow:var(--shadow-sm); overflow:hidden;
  margin-bottom:22px; border:1px solid rgba(0,0,0,.03);
  animation:fadeInUp .6s ease;
}
.rh-card-header {
  padding:18px 22px; border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
  flex-wrap:wrap; gap:10px;
  background:rgba(248,249,250,.5);
}
.rh-card-title {
  font-size:16px; font-weight:600; color:var(--dark);
  display:flex; align-items:center; gap:9px;
}
.rh-card-title i { font-size:16px !important; color:var(--primary); }
.rh-card-body { padding:22px; }

/* ============================================================
   TABLES
   ============================================================ */
.rh-table-wrap { overflow-x:auto; }
.rh-table {
  width:100%; border-collapse:separate; border-spacing:0;
  font-size:13.5px;
}
.rh-table th {
  padding:13px 18px; text-align:left;
  font-size:12px; font-weight:600; color:var(--text);
  background:#f8f9fa; white-space:nowrap;
  border-bottom:1px solid var(--border);
}
.rh-table td {
  padding:14px 18px; border-bottom:1px solid var(--border);
  vertical-align:middle; color:var(--text);
}
.rh-table tr:last-child td { border-bottom:none; }
.rh-table tbody tr { transition:var(--transition); }
.rh-table tbody tr:hover {
  background:rgba(67,97,238,.025);
  transform:translateY(-1px);
  box-shadow:0 3px 8px rgba(0,0,0,.04);
}

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.rh-badge {
  display:inline-flex; align-items:center; gap:5px;
  padding:5px 12px; border-radius:20px;
  font-size:12px; font-weight:600; white-space:nowrap;
}
.rh-badge i { font-size:11px !important; }
.rh-badge-green    { background:rgba(34,197,94,.12);   color:#16a34a; border:1px solid rgba(34,197,94,.25); }
.rh-badge-amber    { background:rgba(245,158,11,.12);  color:#d97706; border:1px solid rgba(245,158,11,.25); }
.rh-badge-red      { background:rgba(247,37,133,.12);  color:#db2777; border:1px solid rgba(247,37,133,.25); }
.rh-badge-blue     { background:rgba(72,149,239,.12);  color:#1d6fc4; border:1px solid rgba(72,149,239,.25); }
.rh-badge-purple   { background:rgba(58,12,163,.1);    color:var(--primary); border:1px solid rgba(58,12,163,.2); }
.rh-badge-gray     { background:rgba(113,128,150,.1);  color:var(--text-light); border:1px solid rgba(113,128,150,.2); }

/* ============================================================
   BUTTONS
   ============================================================ */
.rh-btn {
  display:inline-flex; align-items:center; justify-content:center;
  gap:7px; padding:10px 20px;
  border-radius:var(--radius); font-weight:500; cursor:pointer;
  transition:all .3s; border:none; outline:none;
  font-size:13.5px; font-family:inherit;
  box-shadow:0 2px 6px rgba(0,0,0,.08);
  position:relative; overflow:hidden;
  text-decoration:none;
}
.rh-btn::after {
  content:""; position:absolute;
  width:100%; height:100%; top:0; left:-100%;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.2),transparent);
  transition:.5s;
}
.rh-btn:hover::after { left:100%; }
.rh-btn i { font-size:14px !important; transition:var(--transition); }
.rh-btn:hover i { transform:translateX(2px); }
.rh-btn:hover { transform:translateY(-2px); }

.rh-btn-primary {
  background:linear-gradient(135deg,var(--primary),var(--primary-light));
  color:white;
}
.rh-btn-primary:hover {
  background:linear-gradient(135deg,var(--secondary),var(--primary));
  box-shadow:0 6px 15px rgba(58,12,163,.25); color:white;
}
.rh-btn-outline {
  background:transparent;
  border:2px solid var(--primary-light);
  color:var(--primary);
}
.rh-btn-outline:hover {
  background:var(--primary); color:white;
  border-color:var(--primary);
  box-shadow:0 6px 15px rgba(58,12,163,.2);
}
.rh-btn-success {
  background:linear-gradient(135deg,var(--green),#16a34a);
  color:white;
}
.rh-btn-danger {
  background:rgba(247,37,133,.1); color:var(--danger);
  border:1px solid rgba(247,37,133,.25);
}
.rh-btn-danger:hover { background:rgba(247,37,133,.2); }
.rh-btn-sm { padding:6px 14px; font-size:12.5px; border-radius:var(--radius-sm); }
.rh-btn-sm i { font-size:12px !important; }
.rh-btn-full { width:100%; justify-content:center; }

/* ============================================================
   FORMS (general)
   ============================================================ */
.rh-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.rh-form-grid-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; }
.rh-form-actions { display:flex; gap:12px; margin-top:22px; justify-content:flex-end; }

/* ============================================================
   COMMISSION / EARNINGS SUMMARY BAR
   ============================================================ */
.rh-earn-bar {
  background:linear-gradient(135deg,var(--primary) 0%,var(--secondary) 100%);
  border-radius:var(--radius);
  padding:24px 28px;
  display:flex; align-items:center;
  justify-content:space-around; flex-wrap:wrap;
  gap:20px; margin-bottom:22px;
  box-shadow:0 8px 20px rgba(58,12,163,.3);
}
.rh-earn-item { text-align:center; }
.rh-earn-val  { font-size:26px; font-weight:800; color:white; font-family:monospace; }
.rh-earn-lbl  { font-size:11px; color:rgba(255,255,255,.7); text-transform:uppercase; letter-spacing:.08em; margin-top:3px; }
.rh-earn-sep  { width:1px; height:50px; background:rgba(255,255,255,.2); }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.rh-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:20px; }

/* ============================================================
   ALERTS / NOTICES
   ============================================================ */
.rh-alert {
  display:flex; align-items:flex-start; gap:10px;
  padding:13px 16px; border-radius:8px;
  font-size:13px; margin-bottom:16px;
}
.rh-alert i { font-size:16px !important; margin-top:1px; flex-shrink:0; }
.rh-alert-info    { background:rgba(72,149,239,.1);  color:#1d6fc4; border:1px solid rgba(72,149,239,.2); }
.rh-alert-success { background:rgba(34,197,94,.1);   color:#16a34a; border:1px solid rgba(34,197,94,.2); }
.rh-alert-warning { background:rgba(245,158,11,.1);  color:#d97706; border:1px solid rgba(245,158,11,.2); }
.rh-alert-danger  { background:rgba(247,37,133,.1);  color:#db2777; border:1px solid rgba(247,37,133,.2); }

/* ============================================================
   QUICK ACTION CARDS (dashboard shortcuts)
   ============================================================ */
.rh-quick-actions {
  display:grid; grid-template-columns:repeat(4,1fr);
  gap:14px; margin-bottom:22px;
}
.rh-quick-card {
  background:white; border-radius:var(--radius);
  padding:18px 16px; text-align:center;
  box-shadow:var(--shadow-sm); cursor:pointer;
  transition:var(--transition); border:1px solid rgba(0,0,0,.03);
  text-decoration:none; color:var(--text);
  display:flex; flex-direction:column; align-items:center; gap:10px;
}
.rh-quick-card:hover {
  transform:translateY(-5px); box-shadow:var(--shadow);
  color:var(--primary);
}
.rh-quick-card .rh-quick-icon {
  width:50px; height:50px; border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  font-size:20px; color:white; transition:var(--transition);
}
.rh-quick-card:hover .rh-quick-icon { transform:scale(1.1); }
.rh-quick-card span { font-size:13px; font-weight:500; }

/* ============================================================
   MOBILE BOTTOM NAV
   ============================================================ */
.rh-bottom-nav {
  display:none;
  position:fixed; bottom:0; left:0; right:0;
  background:white; border-top:1px solid var(--border);
  z-index:900; box-shadow:0 -4px 12px rgba(0,0,0,.08);
}
.rh-bottom-nav-inner {
  display:flex; align-items:center; justify-content:space-around;
  padding:8px 0 max(8px, env(safe-area-inset-bottom));
}
.rh-mob-item {
  display:flex; flex-direction:column; align-items:center;
  gap:3px; padding:6px 4px; border-radius:10px;
  cursor:pointer; transition:var(--transition); flex:1;
  color:var(--text-light); text-decoration:none;
  min-width:0;
}
.rh-mob-item:hover, .rh-mob-item.active { color:var(--primary-light); }
.rh-mob-item i { font-size:16px !important; transition:var(--transition); }
.rh-mob-item span { font-size:9px; font-weight:500; white-space:nowrap; }
.rh-mob-item.active i { transform:translateY(-2px); }

/* ============================================================
   PLACEHOLDER PAGES (Analytics, Sales, etc.)
   ============================================================ */
.rh-coming-soon {
  text-align:center; padding:60px 20px;
  animation:fadeInUp .5s ease;
}
.rh-coming-soon .rh-cs-icon {
  width:80px; height:80px; border-radius:20px;
  background:linear-gradient(135deg,var(--primary),var(--secondary));
  display:flex; align-items:center; justify-content:center;
  font-size:32px; color:white;
  margin:0 auto 20px;
  box-shadow:0 8px 20px rgba(58,12,163,.3);
}
.rh-coming-soon h3 { font-size:22px; font-weight:700; color:var(--dark); margin-bottom:10px; }
.rh-coming-soon p  { font-size:14px; color:var(--text-light); max-width:400px; margin:0 auto 22px; }

/* ============================================================
   SETTINGS FORM
   ============================================================ */
.rh-setting-row {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 0; border-bottom:1px solid var(--border); gap:20px;
}
.rh-setting-row:last-child { border-bottom:none; }
.rh-setting-info h4 { font-size:14px; font-weight:600; color:var(--dark); margin-bottom:3px; }
.rh-setting-info p  { font-size:12.5px; color:var(--text-light); }
.rh-toggle {
  position:relative; width:44px; height:24px; flex-shrink:0;
}
.rh-toggle input { opacity:0; width:0; height:0; }
.rh-toggle-slider {
  position:absolute; inset:0;
  background:#ccc; border-radius:24px; cursor:pointer;
  transition:var(--transition);
}
.rh-toggle-slider::before {
  content:""; position:absolute;
  width:18px; height:18px; border-radius:50%;
  background:white; left:3px; bottom:3px;
  transition:var(--transition);
  box-shadow:0 2px 4px rgba(0,0,0,.2);
}
.rh-toggle input:checked + .rh-toggle-slider { background:var(--primary-light); }
.rh-toggle input:checked + .rh-toggle-slider::before { transform:translateX(20px); }

/* ============================================================
   PROFILE AVATAR (users page)
   ============================================================ */
.rh-user-row-avatar {
  width:34px; height:34px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:13px; font-weight:700; color:white; flex-shrink:0;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes fadeInUp {
  from { opacity:0; transform:translateY(18px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width:1280px) {
  .rh-stats-grid { grid-template-columns:repeat(2,1fr); }
  .rh-quick-actions { grid-template-columns:repeat(2,1fr); }
}
@media (max-width:1024px) {
  :root { --sidebar-width:230px; }
}
@media (max-width:992px) {
  :root { --sidebar-width:260px; }
  .rh-shell {
    grid-template-columns:1fr;
    grid-template-rows:var(--header-height) auto 1fr;
  }
  .rh-sidebar {
    position:fixed; top:0; left:0; height:100vh;
    transform:translateX(-100%); z-index:1001;
  }
  .rh-sidebar.open { transform:translateX(0); box-shadow:var(--shadow-lg); }
  .rh-sidebar-close { display:flex; }
  .rh-header { grid-column:1; }
  .rh-hamburger { display:flex; }
  .rh-main { grid-column:1; padding-bottom:90px; }
  .rh-bottom-nav { display:block; }
  .rh-grid-2 { grid-template-columns:1fr; }
}
@media (max-width:768px) {
  .rh-search { display:none; }
  .rh-stats-grid { grid-template-columns:1fr 1fr; gap:12px; }
  .rh-quick-actions { grid-template-columns:repeat(2,1fr); }
  .rh-user-role { display:none; }
  .rh-main { padding:16px 14px 90px; }
  .rh-page-title { font-size:20px; }
  .rh-form-grid, .rh-form-grid-3 { grid-template-columns:1fr; }
  .rh-earn-sep { display:none; }
}
@media (max-width:576px) {
  .rh-stats-grid { grid-template-columns:1fr; }
  .rh-quick-actions { grid-template-columns:1fr 1fr; }
  .rh-page-actions { width:100%; }
  .rh-page-actions .rh-btn { flex:1; justify-content:center; }
  .rh-user-name { display:none; }
}

/* Bulk Order modal — item row (Products & Offers pages).
   Two stacked lines at every width: photo/name/remove on top, Qty/Price
   fields below. Previously this was one flex row with five fixed-width
   pieces (image, name, qty box, price box, delete button) squeezed side
   by side — on phone-width screens there wasn't enough room for all of
   them and the name/qty/price text overlapped instead of wrapping. */
.rh-bo-row {
  padding:10px;
  border:1.5px solid var(--border);
  border-radius:10px;
}
.rh-bo-row + .rh-bo-row { margin-top:10px; }
.rh-bo-top {
  display:flex;
  align-items:center;
  gap:10px;
}
.rh-bo-info { flex:1; min-width:0; }
.rh-bo-del {
  flex-shrink:0;
  background:#fee2e2; color:#dc2626; border:none;
  width:30px; height:30px; border-radius:8px; cursor:pointer;
}
.rh-bo-fields {
  display:flex;
  gap:10px;
  margin-top:10px;
  padding-left:54px; /* aligns under the name text (44px photo + 10px gap) */
}
.rh-bo-qty   { width:60px;  flex-shrink:0; }
.rh-bo-price { width:110px; flex-shrink:0; }
@media (max-width:576px) {
  .rh-bo-fields { padding-left:0; }
  .rh-bo-qty, .rh-bo-price { width:auto; flex:1 1 0; }
}

/* ============================================================
   DARK MODE
   Toggled via [data-theme="dark"] on <html>, set/persisted by
   the theme switch button in the topbar (see header.php / footer.php).
   Site-wide colours are CSS-variable driven, so redefining the
   variables here covers the sidebar, topbar, cards, forms, modals
   and buttons automatically. Because a lot of page-template markup
   sets a small set of *inline* light backgrounds/text colours
   directly (instead of a variable), the attribute-selector rules
   below catch those same values wherever they appear in a style="…"
   attribute, across every page, without having to touch each file.
   ============================================================ */
[data-theme="dark"] {
  --primary:       #818cf8;
  --primary-light: #93a4ff;
  --secondary:     #c084fc;
  --success:       #4cc9f0;
  --success-dark:  #22d3ee;
  --danger:        #f87171;
  --warning:       #fbbf24;
  --info:          #60a5fa;
  --green:         #4ade80;
  --light:         #1c2036;
  --border:        #2e3450;
  --text:          #e2e5f1;
  --text-light:    #9aa1b9;
  --shadow:        0 10px 15px -3px rgba(0,0,0,.45), 0 4px 6px -2px rgba(0,0,0,.30);
  --shadow-sm:     0 4px 6px -1px rgba(0,0,0,.40);
  --shadow-lg:     0 20px 25px -5px rgba(0,0,0,.55), 0 10px 10px -5px rgba(0,0,0,.30);

  /* Extra tokens used only by the overrides below */
  --rh-page-bg:    #10131f;
  --rh-surface:    #1a1e33;
  --rh-surface-2:  #232842;
  --rh-heading:    #f1f4fc;
}

[data-theme="dark"] body { background: var(--rh-page-bg); color: var(--text); }

/* Scrollbars */
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3a4066; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: transparent; }

/* Generic surfaces (cards / modals / dropdowns / panels) that were
   given a literal white background inline throughout the page templates */
[data-theme="dark"] [style*="background:white"],
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background:#fff;"],
[data-theme="dark"] [style*="background:#fff\""],
[data-theme="dark"] [style*="background: #fff;"],
[data-theme="dark"] [style*="background:#ffffff"],
[data-theme="dark"] [style*="background: #ffffff"] {
  background: var(--rh-surface) !important;
}

/* Muted neutral panel backgrounds (search rows, hover states, subtle
   section dividers) */
[data-theme="dark"] [style*="background:#f1f2f6"],
[data-theme="dark"] [style*="background:#f8f9fc"],
[data-theme="dark"] [style*="background:#f8fafc"],
[data-theme="dark"] [style*="background:#fafafa"],
[data-theme="dark"] [style*="background:#fafbfc"],
[data-theme="dark"] [style*="background:#fcfcfd"],
[data-theme="dark"] [style*="background:#f9fafb"],
[data-theme="dark"] [style*="background:#fafbff"],
[data-theme="dark"] [style*="background:#f3f4f6"],
[data-theme="dark"] [style*="background:#f1f5f9"],
[data-theme="dark"] [style*="background:#f0f4ff"],
[data-theme="dark"] [style*="background:#f0f6ff"],
[data-theme="dark"] [style*="background:#f5f3ff"],
[data-theme="dark"] [style*="background:#f8f0ff"] {
  background: var(--rh-surface-2) !important;
}

/* Tinted status/alert backgrounds (errors, warnings, success chips) —
   dimmed to translucent versions of the same hue so badges still read
   as red/green/yellow, just not paper-bright against a dark page */
[data-theme="dark"] [style*="background:#fee2e2"],
[data-theme="dark"] [style*="background:#fef2f2"],
[data-theme="dark"] [style*="background:#fdeaea"] { background: rgba(248,113,113,.16) !important; }

[data-theme="dark"] [style*="background:#f0fdf4"],
[data-theme="dark"] [style*="background:#dcfce7"],
[data-theme="dark"] [style*="background:#e7f8ee"] { background: rgba(74,222,128,.14) !important; }

[data-theme="dark"] [style*="background:#fff3cd"],
[data-theme="dark"] [style*="background:#fef3c7"],
[data-theme="dark"] [style*="background:#fffbeb"],
[data-theme="dark"] [style*="background:#fef3e0"] { background: rgba(251,191,36,.16) !important; }

[data-theme="dark"] [style*="background:#eff6ff"],
[data-theme="dark"] [style*="background:#eff4ff"] { background: rgba(96,165,250,.14) !important; }

[data-theme="dark"] [style*="background:#eef0ff"] { background: var(--rh-surface-2) !important; }

/* Dashboard notice widget (rendered via JS in dashboard.php) uses its own
   saturated type colours for the reseller notice cards — these hex values
   aren't covered by the generic heading/mid-grey text rules above, so they
   stay near-illegible (dark blue/green/amber/red) against the dark page.
   Lighten each to a tint that still reads as its status colour. */
[data-theme="dark"] [style*="color:#1e40af"],
[data-theme="dark"] [style*="color:#1d4ed8"] { color: #93c5fd !important; }
[data-theme="dark"] [style*="color:#166534"],
[data-theme="dark"] [style*="color:#15803d"] { color: #86efac !important; }
[data-theme="dark"] [style*="color:#92400e"],
[data-theme="dark"] [style*="color:#b45309"] { color: #fcd34d !important; }
[data-theme="dark"] [style*="color:#991b1b"],
[data-theme="dark"] [style*="color:#dc2626"] { color: #fca5a5 !important; }

/* Product price cards (product-view.php Base/Wholesale, Last Sell, Stock)
   keep a pale border regardless of theme — dim it to the same border token
   used everywhere else in dark mode so it doesn't read as a stray light ring */
[data-theme="dark"] .pv-price-card { border-color: var(--border) !important; }

/* Heading / body text that was hardcoded near-black for readability on
   white cards — flip to a light colour so it stays readable on dark
   surfaces. (var(--dark) is left alone site-wide since the sidebar and
   login screen use it as a navy background colour, not text.) */
[data-theme="dark"] [style*="color:var(--dark)"],
[data-theme="dark"] [style*="color:#1a1a2e"],
[data-theme="dark"] [style*="color:#111827"],
[data-theme="dark"] [style*="color:#0f172a"],
[data-theme="dark"] [style*="color:#2d3748"],
[data-theme="dark"] [style*="color:#334155"],
[data-theme="dark"] [style*="color:#1e1b4b"],
[data-theme="dark"] [style*="color:#374151"] {
  color: var(--rh-heading) !important;
}

/* Mid-grey secondary/meta text — lighten to stay legible */
[data-theme="dark"] [style*="color:#6b7280"],
[data-theme="dark"] [style*="color:#718096"],
[data-theme="dark"] [style*="color:#64748b"],
[data-theme="dark"] [style*="color:#9ca3af"],
[data-theme="dark"] [style*="color:#8a93a3"],
[data-theme="dark"] [style*="color:#94a3b8"],
[data-theme="dark"] [style*="color:#4b5563"],
[data-theme="dark"] [style*="color:#475569"] {
  color: var(--text-light) !important;
}

/* Headings styled via CSS classes (not inline style attributes) that use
   var(--dark) as a TEXT colour — page titles, card titles, stat numbers,
   settings labels, login logo. The attribute-selector rules above only
   catch inline style="color:var(--dark)", so these class-based headings
   need their own override or they stay near-black on the dark page bg. */
[data-theme="dark"] .rh-page-title,
[data-theme="dark"] .rh-card-title,
[data-theme="dark"] .rh-stat-value,
[data-theme="dark"] .rh-coming-soon h3,
[data-theme="dark"] .rh-setting-info h4,
[data-theme="dark"] .rh-login-logo h1 {
  color: var(--rh-heading);
}
[data-theme="dark"] .rh-stat-card:hover .rh-stat-value { color: var(--primary); }

/* Inputs keep a dark field surface instead of inheriting the page bg */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--rh-surface);
  color: var(--text);
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--text-light); opacity: .8; }

/* Browser autofill (e.g. a saved Customer Name / Phone Number on the Order
   Now and Site Order forms) paints its own light fill + text colour at the
   browser-UI level, completely ignoring the input rule above — that's why a
   filled field shows as a stark white box with barely-visible text even
   though every other field on the same form is correctly dark. Chrome/Edge/
   Safari don't expose the autofill background as a normal CSS property, so
   the fix is the standard trick: force the text colour and fake the
   background via a huge inset box-shadow, and push the built-in fade
   transition out far enough that it never has time to run. */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] input:-webkit-autofill:active,
[data-theme="dark"] textarea:-webkit-autofill,
[data-theme="dark"] textarea:-webkit-autofill:hover,
[data-theme="dark"] textarea:-webkit-autofill:focus,
[data-theme="dark"] select:-webkit-autofill,
[data-theme="dark"] select:-webkit-autofill:hover,
[data-theme="dark"] select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--rh-surface) inset !important;
  box-shadow: 0 0 0 1000px var(--rh-surface) inset !important;
  transition: background-color 9999s ease-in-out 0s, color 9999s ease-in-out 0s;
}

/* Order modal (products.php + offers.php "Order Now" popup, including the
   Order Summary side panel) and the product-view gallery frame — these are
   styled through page-level <style> blocks using CSS classes rather than
   inline style="" attributes, so the [style*="..."] rules above never
   reach them. Overridden here by class/ID instead so the modal doesn't stay
   stuck in light mode while the rest of the page is dark. */
[data-theme="dark"] .pv-main-img-wrap,
[data-theme="dark"] #modal-order .rh-om-section,
[data-theme="dark"] #modal-order .rh-om-input,
[data-theme="dark"] #modal-order select.rh-om-input,
[data-theme="dark"] #modal-order .rh-om-dbtn,
[data-theme="dark"] #modal-order .rh-om-pay-btn,
[data-theme="dark"] .rh-om-col-summary,
[data-theme="dark"] .rh-os-addr {
  background: var(--rh-surface-2) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
[data-theme="dark"] .rh-os-img { background: var(--rh-surface) !important; }

/* The blanket dark-mode override above (background/color !important on
   every .rh-om-dbtn / .rh-om-pay-btn inside #modal-order) has higher
   specificity than the plain selected-state styling those buttons get
   from JS (rhSelectDelivery / rhSelectPayment), so in dark mode the
   Post Office / Fardar Courier / Custom delivery buttons and the COD /
   Bank Transfer payment buttons never visibly showed as selected — they
   always looked reset back to the dark surface colour. These rules
   match the same #modal-order scope plus the selected class so they win
   the specificity tie and restore the highlight in dark mode. */
[data-theme="dark"] #modal-order .rh-om-dbtn.rh-dbtn-selected {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #2563eb !important;
}
[data-theme="dark"] #modal-order .rh-om-pay-btn.rh-pay-selected-cod {
  background: #16a34a !important;
  color: #fff !important;
  border-color: #16a34a !important;
}
[data-theme="dark"] #modal-order .rh-om-pay-btn.rh-pay-selected-bank {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #2563eb !important;
}
[data-theme="dark"] #modal-order .rh-om-eyebrow,
[data-theme="dark"] .rh-os-item { border-color: var(--border) !important; }
[data-theme="dark"] #modal-order .rh-om-eyebrow-title,
[data-theme="dark"] .rh-os-title,
[data-theme="dark"] .rh-os-name,
[data-theme="dark"] .rh-os-line-total,
[data-theme="dark"] .rh-os-row span:last-child,
[data-theme="dark"] .rh-os-total {
  color: var(--rh-heading) !important;
}
[data-theme="dark"] #modal-order label.rh-om-label,
[data-theme="dark"] .rh-os-variant,
[data-theme="dark"] .rh-os-qty,
[data-theme="dark"] .rh-os-row,
[data-theme="dark"] .rh-os-addr-title,
[data-theme="dark"] #rh-os-addr-text {
  color: var(--text-light) !important;
}

/* Core layout components (topbar, cards, stat boxes, quick-action
   shortcuts, mobile bottom nav) all set "background:white" directly on
   the CSS class itself, not via an inline style="" attribute — so none
   of the [style*="..."] rules above ever reach them. These are the
   single most-used containers in the whole theme (literally every page
   wraps its content in .rh-card), so leaving them out is what made card
   titles/values — already flipped to a light colour by the .rh-card-title
   / .rh-stat-value overrides further up — turn nearly invisible (light
   text on a card that stayed white). Fixed here by class instead. */
[data-theme="dark"] .rh-header,
[data-theme="dark"] .rh-card,
[data-theme="dark"] .rh-stat-card,
[data-theme="dark"] .rh-quick-card,
[data-theme="dark"] .rh-bottom-nav {
  background: var(--rh-surface) !important;
}
[data-theme="dark"] .rh-card-header {
  background: rgba(255,255,255,.03) !important;
}
[data-theme="dark"] .rh-table th {
  background: rgba(255,255,255,.03) !important;
}

/* Theme toggle button icon swap handled in JS by swapping the <i> class;
   just make sure the button matches the other header icons */
#rh-theme-toggle { cursor:pointer; border:none; background:transparent; }

/* ── How To Use page — dark mode ──
   The step titles / stat numbers / product text use var(--dark) as a TEXT
   colour (near-black) and the mini stat cards + outline buttons have a hard
   white background, so in dark mode titles vanished and card labels looked
   faded (light text on white). Flip them to the dark surfaces + light text. */
[data-theme="dark"] .htu-item-title,
[data-theme="dark"] .htu-stat-num,
[data-theme="dark"] .htu-prod-name,
[data-theme="dark"] .htu-prod-price {
  color: var(--rh-heading);
}
[data-theme="dark"] .htu-stat {
  background: var(--rh-surface-2);
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
[data-theme="dark"] .htu-stat-label { color: var(--text); }
[data-theme="dark"] .htu-stat-sub { color: var(--text-light); }
[data-theme="dark"] .htu-btn-outline {
  background: var(--rh-surface-2);
  color: var(--text);
}
[data-theme="dark"] .htu-prod-price-box { background: var(--rh-surface-2); }
[data-theme="dark"] .htu-phone-mock { background: var(--rh-surface); }
[data-theme="dark"] .htu-item p,
[data-theme="dark"] .htu-item li { color: var(--text); }
