/* ============================================================
   RYZE CRM Admin — Midnight Copper Premium Design System
   Complete UI/UX Redesign | RTL Persian | 2026
   ============================================================ */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

/* ============================================================
   SECTION 1: CSS VARIABLES (Design Tokens)
   ============================================================ */
:root {
  /* Foundation */
  --bg-darkest:  #070708;
  --bg-dark:     #0B0B0E;
  --bg-base:     #0F0F13;
  --bg-elevated: #141419;
  --bg-card:     #18181D;
  --bg-hover:    #1E1E24;
  --bg-active:   #222228;
  --bg-input:    #121216;

  /* Text */
  --text-primary:   #F0EFE9;
  --text-secondary: #A0A0AA;
  --text-muted:     #6B6B75;
  --text-faint:     #4A4A52;
  --text-inverse:   #0B0B0E;

  /* Border */
  --border-dim:    rgba(255,255,255,0.03);
  --border-subtle: rgba(255,255,255,0.06);
  --border-default:rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.12);
  --border-focus:  rgba(255,255,255,0.18);

  /* Brand: Warm Copper */
  --accent:        #D4843D;
  --accent-hover:  #E0954A;
  --accent-glow:   rgba(212,132,61,0.25);
  --accent-bg:     rgba(212,132,61,0.12);
  --accent-text:   #F0B06A;

  /* Semantic */
  --success:       #2D9B5E;
  --success-bg:    rgba(45,155,94,0.12);
  --success-glow:  rgba(45,155,94,0.20);

  --danger:        #D13B3B;
  --danger-bg:     rgba(209,59,59,0.12);
  --danger-glow:   rgba(209,59,59,0.20);

  --warning:       #D9A03E;
  --warning-bg:    rgba(217,160,62,0.12);
  --warning-glow:  rgba(217,160,62,0.20);

  --info:          #3B82D1;
  --info-bg:       rgba(59,130,209,0.12);
  --info-glow:     rgba(59,130,209,0.20);

  /* Status */
  --status-pending:    #D9A03E;
  --status-pending-bg: rgba(217,160,62,0.10);
  --status-verified:   #2D9B5E;
  --status-verified-bg:rgba(45,155,94,0.10);
  --status-shipped:    #3B82D1;
  --status-shipped-bg: rgba(59,130,209,0.10);
  --status-delivered:  #2D9B5E;
  --status-delivered-bg:rgba(45,155,94,0.10);
  --status-cancelled:  #D13B3B;
  --status-cancelled-bg:rgba(209,59,59,0.10);

  /* Typography */
  --font-sans: 'Vazirmatn', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Courier New', monospace;

  --text-xs:  0.6875rem;  /* 11px */
  --text-sm:  0.8125rem;  /* 13px */
  --text-base:0.875rem;   /* 14px */
  --text-md:  0.9375rem;  /* 15px */
  --text-lg:  1.0625rem;  /* 17px */
  --text-xl:  1.25rem;     /* 20px */
  --text-2xl: 1.5rem;      /* 24px */
  --text-3xl: 1.875rem;    /* 30px */
  --text-4xl: 2.25rem;     /* 36px */

  --font-normal:  400;
  --font-medium:  500;
  --font-semibold:600;
  --font-bold:    700;
  --font-black:   800;

  /* Spacing */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10:2.5rem;    /* 40px */
  --space-12:3rem;      /* 48px */
  --space-16:4rem;      /* 64px */

  /* Layout */
  --sidebar-width: 280px;
  --header-height: 64px;
  --content-max:   1440px;

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl:24px;
  --radius-full:9999px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md:  0 4px 6px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
  --shadow-lg:  0 10px 15px rgba(0,0,0,0.4), 0 4px 6px rgba(0,0,0,0.2);
  --shadow-xl:  0 20px 25px rgba(0,0,0,0.5), 0 8px 10px rgba(0,0,0,0.2);
  --shadow-glow-accent: 0 0 20px var(--accent-glow);
  --shadow-glow-success:0 0 20px var(--success-glow);

  /* Transitions */
  --ease-fast:  150ms cubic-bezier(0.4,0,0.2,1);
  --ease-base:  250ms cubic-bezier(0.4,0,0.2,1);
  --ease-slow:  400ms cubic-bezier(0.4,0,0.2,1);
  --ease-bounce:500ms cubic-bezier(0. frenzy,1.5,0.6,1);

  /* Backward compat */
  --primary: var(--accent);
  --primary-dark: var(--accent-hover);
  --secondary: var(--text-secondary);
  --bg-sidebar: var(--bg-dark);
  --bg-sidebar-active: var(--bg-elevated);
  --border-default-color: var(--border-default);
  --border-hairline: var(--border-dim);
  --text-light: var(--text-faint);
  --text-on-dark: var(--text-primary);

  /* Legacy aliases */
  --font-size-xs:  var(--text-xs);
  --font-size-sm:  var(--text-sm);
  --font-size-base:var(--text-base);
  --font-size-md:  var(--text-md);
  --font-size-lg:  var(--text-lg);
  --font-size-xl:  var(--text-xl);
  --font-size-2xl: var(--text-2xl);
  --font-size-3xl: var(--text-3xl);
  --font-weight-normal:   var(--font-normal);
  --font-weight-medium:   var(--font-medium);
  --font-weight-semibold: var(--font-semibold);
  --font-weight-bold:     var(--font-bold);
  --font-weight-black:    var(--font-black);
  --radius-sm-old:  var(--radius-sm);
  --radius-md-old:  var(--radius-md);
  --radius-lg-old:  var(--radius-lg);
  --radius-xl-old:  var(--radius-xl);
  --shadow-overlay: var(--shadow-xl);
  --success-dark: var(--success);
  --danger-dark:  var(--danger);
  --warning-dark: var(--warning);
  --info-dark:    var(--info);
  --bg-primary:   var(--accent);
}

/* ============================================================
   SECTION 2: BASE RESET
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  direction: rtl;
  text-align: right;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--ease-fast);
}

::selection {
  background: rgba(212,132,61,0.3);
  color: var(--text-primary);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   SECTION 3: LAYOUT
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-dark);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  z-index: 100;
  transition: transform var(--ease-slow);
}

/* Sidebar Header */
.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-dark);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--text-inverse);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--accent-glow);
  transition: box-shadow var(--ease-base);
}

.brand-icon:hover {
  box-shadow: 0 0 20px var(--accent-glow);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-name {
  font-size: var(--text-lg);
  font-weight: var(--font-black);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--font-normal);
}

.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--ease-fast);
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Sidebar Navigation */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-3) 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

.sidebar-menu {
  list-style: none;
  padding: 0 var(--space-3);
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-3) var(--space-1);
  letter-spacing: 0.06em;
  margin-top: var(--space-2);
}

.sidebar-section-label:first-child { margin-top: 0; }

.sidebar-item { margin-bottom: 2px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  border-radius: var(--radius-md);
  transition: all var(--ease-fast);
  position: relative;
  overflow: hidden;
}

.sidebar-link::before {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  border-radius: var(--radius-full);
  transition: transform var(--ease-base);
}

.sidebar-link:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* Active State */
.sidebar-item.active .sidebar-link {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: var(--font-semibold);
}

.sidebar-item.active .sidebar-link::before {
  transform: translateY(-50%) scaleY(1);
}

.link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  flex-shrink: 0;
  color: var(--text-muted);
  transition: all var(--ease-fast);
}

.sidebar-link:hover .link-icon {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.sidebar-item.active .link-icon {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--text-inverse);
  border-color: transparent;
  box-shadow: 0 0 8px var(--accent-glow);
}

.link-text { flex: 1; white-space: nowrap; }

/* Sidebar Badge */
.sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 var(--space-2);
  font-size: 0.7rem;
  font-weight: var(--font-bold);
  border-radius: var(--radius-full);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--text-inverse);
  box-shadow: 0 2px 8px var(--accent-glow);
  animation: badge-pulse 2.5s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.sidebar-item.active .sidebar-badge {
  background: rgba(255,255,255,0.15);
  color: var(--text-primary);
  box-shadow: none;
  animation: none;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-3) var(--space-4);
}

.sidebar-link--danger { color: var(--danger); }
.sidebar-link--danger:hover {
  background: var(--danger-bg);
  color: #E8A0A0;
}
.sidebar-link--danger .link-icon {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(209,59,59,0.2);
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-3) var(--space-5);
  flex-shrink: 0;
}

.footer-info {
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-version {
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-weight: var(--font-normal);
}

/* Sidebar Overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 199;
  pointer-events: none;
  transition: background var(--ease-slow);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}

.sidebar-overlay.active {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: auto;
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-y: auto;
  min-width: 0;
  max-width: 100%;
  background: var(--bg-base);
}

/* ===== HEADER ===== */
.header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: 90;
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-container {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

.header-right, .header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-left { flex-shrink: 0; }

/* Mobile Toggle */
.header-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--ease-fast);
  flex-shrink: 0;
  padding: 0;
}

.header-menu-toggle:hover {
  background: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 18px;
}

.hamburger-icon span {
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: all var(--ease-fast);
}

/* Header Info */
.header-page-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-datetime {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  white-space: nowrap;
  direction: ltr;
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--border-default);
}

/* Header User */
.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--text-inverse);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
  box-shadow: 0 0 8px var(--accent-glow);
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.user-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.user-role {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ===== CONTENT ===== */
.content {
  padding: var(--space-6);
  flex: 1;
  width: 100%;
  min-height: calc(100vh - var(--header-height));
  position: relative;
}

/* Background subtle pattern */
.content::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(212,132,61,0.02) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(59,130,209,0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.content > * { position: relative; z-index: 1; }

.page-title-wrapper {
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-title-welcome {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ============================================================
   SECTION 4: KPI CARDS
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  width: 100%;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: all var(--ease-base);
  backdrop-filter: blur(10px);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  opacity: 0;
  transition: opacity var(--ease-base);
}

.kpi-card:hover {
  border-color: var(--border-default);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(212,132,61,0.05);
}

.kpi-card:hover::before { opacity: 1; }

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
  position: relative;
  flex-shrink: 0;
}

.kpi-icon svg { width: 24px; height: 24px; }

.kpi-icon.success {
  background: var(--success-bg);
  color: var(--success);
  box-shadow: 0 0 12px var(--success-glow);
}

.kpi-icon.info {
  background: var(--info-bg);
  color: var(--info);
  box-shadow: 0 0 12px var(--info-glow);
}

.kpi-icon.warning {
  background: var(--warning-bg);
  color: var(--warning);
  box-shadow: 0 0 12px var(--warning-glow);
}

.kpi-icon.danger {
  background: var(--danger-bg);
  color: var(--danger);
  box-shadow: 0 0 12px var(--danger-glow);
}

.kpi-title {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: var(--font-medium);
  margin-bottom: var(--space-2);
}

.kpi-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-black);
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: var(--space-1);
}

.kpi-trend {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--font-normal);
}

.kpi-trend.positive { color: var(--success); }
.kpi-trend.negative { color: var(--danger); }

/* ============================================================
   SECTION 5: TABLES
   ============================================================ */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  width: 100%;
  position: relative;
}

.table-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-elevated);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.table-title {
  font-size: var(--text-md);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}

.admin-table thead {
  background: var(--bg-elevated);
}

.admin-table th {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-weight: var(--font-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.admin-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-dim);
  color: var(--text-primary);
  font-size: var(--text-sm);
  vertical-align: middle;
  transition: background var(--ease-fast);
}

.admin-table tbody tr:hover td {
  background: var(--bg-elevated);
}

.admin-table tr:last-child td { border-bottom: none; }

.admin-table a {
  color: var(--accent);
  font-weight: var(--font-semibold);
  transition: all var(--ease-fast);
}

.admin-table a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============================================================
   SECTION 6: STATUS BADGES
   ============================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.4;
}

.status-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge--pending {
  background: var(--status-pending-bg);
  color: var(--status-pending);
  border-color: rgba(217,160,62,0.2);
}
.status-badge--pending::before { background: var(--status-pending); box-shadow: 0 0 4px var(--status-pending); }

.status-badge--verified {
  background: var(--status-verified-bg);
  color: var(--status-verified);
  border-color: rgba(45,155,94,0.2);
}
.status-badge--verified::before { background: var(--status-verified); box-shadow: 0 0 4px var(--status-verified); }

.status-badge--shipped {
  background: var(--status-shipped-bg);
  color: var(--status-shipped);
  border-color: rgba(59,130,209,0.2);
}
.status-badge--shipped::before { background: var(--status-shipped); box-shadow: 0 0 4px var(--status-shipped); }

.status-badge--delivered {
  background: var(--status-delivered-bg);
  color: var(--status-delivered);
  border-color: rgba(45,155,94,0.2);
}
.status-badge--delivered::before { background: var(--status-delivered); box-shadow: 0 0 4px var(--status-delivered); }

.status-badge--cancelled {
  background: var(--status-cancelled-bg);
  color: var(--status-cancelled);
  border-color: rgba(209,59,59,0.2);
}
.status-badge--cancelled::before { background: var(--status-cancelled); box-shadow: 0 0 4px var(--status-cancelled); }

.status-badge--paid { composes: status-badge--verified; }
.status-badge--processing { composes: status-badge--shipped; }
.status-badge--completed { composes: status-badge--delivered; }
.status-badge--refunded { composes: status-badge--cancelled; }

/* ============================================================
   SECTION 7: BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--ease-fast);
  border: 1px solid transparent;
  outline: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--ease-fast);
  pointer-events: none;
  border-radius: inherit;
}

.btn:hover::after { opacity: 1; }

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(212,132,61,0.25);
  outline: none;
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--text-inverse);
  border-color: transparent;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn--secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn--secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn--success {
  background: linear-gradient(135deg, var(--success), #3BBF6E);
  color: var(--text-inverse);
  box-shadow: 0 4px 14px var(--success-glow);
}

.btn--danger {
  background: linear-gradient(135deg, var(--danger), #E85A5A);
  color: var(--text-inverse);
  box-shadow: 0 4px 14px var(--danger-glow);
}

.btn--warning {
  background: linear-gradient(135deg, var(--warning), #EFB54F);
  color: var(--text-inverse);
  box-shadow: 0 4px 14px var(--warning-glow);
}

.btn--info {
  background: linear-gradient(135deg, var(--info), #5BA3E8);
  color: var(--text-inverse);
  box-shadow: 0 4px 14px var(--info-glow);
}

.btn--sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.btn--lg { padding: var(--space-3) var(--space-6); font-size: var(--text-base); }
.btn--icon { padding: var(--space-2); min-width: 38px; min-height: 38px; }

.btn__icon { width: 16px; height: 16px; }

.w-full { width: 100%; }

/* ============================================================
   SECTION 8: FORMS
   ============================================================ */
.form-group { margin-bottom: var(--space-5); }

.form-label {
  display: block;
  font-weight: var(--font-medium);
  margin-bottom: var(--space-2);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.form-label--required::after {
  content: ' *';
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: var(--space-3);
  border: 1.5px solid var(--border-default);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--text-sm);
  outline: none;
  transition: all var(--ease-fast);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder { color: var(--text-faint); }

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

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6B75' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left var(--space-3) center;
  padding-left: var(--space-8);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
}

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

/* ============================================================
   SECTION 9: SEARCH & FILTERS
   ============================================================ */
.search-wrapper {
  position: relative;
  max-width: 320px;
}

.search-wrapper svg {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: var(--space-2) var(--space-4);
  padding-right: calc(var(--space-3) + 24px);
  border: 1.5px solid var(--border-default);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  outline: none;
  transition: all var(--ease-fast);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input::placeholder { color: var(--text-faint); }

/* Filter pills */
.filter-pills {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.filter-pill { display: inline-flex; }

.filter-pill__btn {
  padding: var(--space-2) var(--space-4);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--ease-fast);
  white-space: nowrap;
}

.filter-pill__btn:hover {
  background: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.filter-pill__btn--active {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: rgba(212,132,61,0.3);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ============================================================
   SECTION 10: TOOLBAR, PAGINATION, ALERTS
   ============================================================ */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.toolbar__group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: var(--space-3);
  background: var(--bg-elevated);
}

.pagination__info { font-size: var(--text-sm); color: var(--text-secondary); }
.pagination__controls { display: flex; align-items: center; gap: var(--space-2); }

.pagination__btn {
  min-width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--ease-fast);
  font-family: var(--font-sans);
}

.pagination__btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.pagination__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination__btn--active {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: rgba(212,132,61,0.3);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* Alerts */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border-right: 3px solid transparent;
  background: var(--bg-card);
}

.alert--success { border-color: var(--success); color: var(--success); background: var(--success-bg); }
.alert--danger  { border-color: var(--danger);  color: var(--danger);  background: var(--danger-bg); }
.alert--warning { border-color: var(--warning); color: var(--warning); background: var(--warning-bg); }
.alert--info    { border-color: var(--info);    color: var(--info);    background: var(--info-bg); }

/* ============================================================
   SECTION 11: EMPTY STATE
   ============================================================ */
.empty-state {
  padding: var(--space-12) var(--space-6);
  text-align: center;
  background: var(--bg-card);
}

.empty-state__icon {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-4);
  color: var(--text-faint);
  opacity: 0.6;
}

.empty-state__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state__description {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 300px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ============================================================
   SECTION 12: MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-overlay.active { display: flex; animation: modalFadeIn 0.25s ease; }

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl), 0 0 60px rgba(0,0,0,0.3);
  animation: modalContentIn 0.35s cubic-bezier(0.4,0,0.2,1);
}

@keyframes modalContentIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-content--lg { max-width: 850px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title { font-size: var(--text-lg); font-weight: var(--font-semibold); color: var(--text-primary); }

.modal-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-lg);
  cursor: pointer;
  color: var(--text-secondary);
  padding: var(--space-1) var(--space-2);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ease-fast);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.modal-body { padding: var(--space-6); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

/* ============================================================
   SECTION 13: UPLOAD
   ============================================================ */
.upload-area {
  border: 2px dashed var(--border-default);
  padding: var(--space-10);
  text-align: center;
  cursor: pointer;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  transition: all var(--ease-fast);
  position: relative;
  overflow: hidden;
}

.upload-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--ease-fast);
}

.upload-area:hover {
  border-color: var(--accent);
  background: var(--bg-card);
}

.upload-area:hover::before { opacity: 0.05; }

.upload-area.drag-over {
  border-color: var(--success);
  background: var(--success-bg);
  border-style: solid;
  box-shadow: 0 0 20px var(--success-glow);
}

.upload-icon { width: 48px; height: 48px; margin: 0 auto var(--space-3); color: var(--text-muted); position: relative; z-index: 1; }
.upload-text { color: var(--text-muted); font-size: var(--text-sm); position: relative; z-index: 1; }

.upload-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
  position: relative;
  z-index: 1;
}

.upload-preview-item {
  width: 110px;
  height: 140px;
  border: 2px solid var(--border-default);
  position: relative;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.upload-preview-item img { width: 100%; height: 100%; object-fit: cover; }

.upload-preview-item--main { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }

.upload-preview-label {
  position: absolute;
  bottom: var(--space-2);
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--text-inverse);
  font-size: var(--text-xs);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: var(--font-semibold);
}

.remove-img-btn {
  position: absolute;
  top: var(--space-1);
  right: var(--space-1);
  background: var(--danger);
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  opacity: 0;
  transition: opacity var(--ease-fast);
  z-index: 2;
}

.upload-preview-item:hover .remove-img-btn { opacity: 1; }

/* Upload Progress Overlay */
.upload-progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  flex-direction: column;
  gap: var(--space-5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.upload-progress-overlay.active { display: flex; }

.upload-progress-box {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  padding: var(--space-10);
  border-radius: var(--radius-xl);
  text-align: center;
  min-width: 320px;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
}

.upload-progress-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-5);
  color: var(--text-primary);
}

.upload-progress-bar-container {
  background: var(--bg-elevated);
  height: 12px;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ============================================================
   SECTION 14: CHARTS, CARDS, SKELETON
   ============================================================ */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-6);
  width: 100%;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.chart-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.chart-card__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chart-card__icon--sales { background: var(--accent-bg); color: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.chart-card__icon--revenue { background: var(--success-bg); color: var(--success); box-shadow: 0 0 8px var(--success-glow); }
.chart-card__icon--products { background: var(--info-bg); color: var(--info); box-shadow: 0 0 8px var(--info-glow); }

.chart-card__title { font-size: var(--text-base); font-weight: var(--font-semibold); color: var(--text-primary); }
.chart-card__body { padding: var(--space-5); }

.chart-container { position: relative; height: 300px; }
.chart-canvas { display: block; }

/* Chart skeleton animation */
.chart-skeleton {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: var(--space-3);
  height: 200px;
  padding: var(--space-4);
}

.skeleton-bar {
  flex: 1;
  max-width: 40px;
  background: linear-gradient(180deg, var(--border-subtle), var(--border-dim));
  border-radius: var(--radius-sm);
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Split grid */
.split-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-5);
  width: 100%;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-header { padding: var(--space-4); border-bottom: 1px solid var(--border-subtle); background: var(--bg-elevated); }
.card-title { font-size: var(--text-base); font-weight: var(--font-semibold); color: var(--text-primary); }
.card-body { padding: var(--space-4); }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  text-align: center;
}

.stat-value { font-size: var(--text-2xl); font-weight: 800; color: var(--text-primary); }
.stat-label { font-size: var(--text-sm); color: var(--text-muted); }

/* ============================================================
   SECTION 15: TOAST, LOADING, SPINNER
   ============================================================ */
.btn-loading-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  flex-direction: column;
  gap: 1rem;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.btn-loading-overlay.active { display: flex; }

.btn-loading-overlay .btn-spinner-lg {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: btnSpin 0.8s linear infinite;
  box-shadow: 0 0 10px var(--accent-glow);
}

.btn-loading-overlay .btn-loading-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

@keyframes btnSpin { to { transform: rotate(360deg); } }

.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
  opacity: 0.85;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 50%;
  transform: translate(50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: btnSpin 0.7s linear infinite;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: btnSpin 0.7s linear infinite;
}

/* Toast */
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  border-radius: var(--radius-lg);
  border-right: 4px solid transparent;
  font-size: var(--text-sm);
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  position: fixed;
  top: 20px;
  left: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  z-index: 9999;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast--visible { opacity: 1; transform: translateX(0); }

.toast--success { border-right-color: var(--success); }
.toast--error   { border-right-color: var(--danger); }
.toast--warning { border-right-color: var(--warning); }
.toast--info    { border-right-color: var(--info); }

.toast__icon { display: flex; flex-shrink: 0; }
.toast__msg { flex: 1; color: var(--text-primary); font-weight: 500; font-size: var(--text-sm); }
.toast__close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.2rem;
  padding: 0; line-height: 1; flex-shrink: 0;
  transition: color var(--ease-fast);
}
.toast__close:hover { color: var(--text-primary); }

/* ============================================================
   SECTION 16: PRINT STYLES
   ============================================================ */
/* Print styles moved to static/css/print.css (reference invoice + shipping label design). */

/* ============================================================
   SECTION 17: UTILITIES
   ============================================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--accent) !important; }
.text-muted { color: var(--text-muted) !important; }
.loading { opacity: 0.6; pointer-events: none; }

/* ============================================================
   SECTION 18: ORDERS PAGE SPECIFIC
   ============================================================ */
.page-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-header-bar .page-title { margin-bottom: 0; }

.page-count-badge {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-full);
}

/* Filter Bar */
.filter-bar-container {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.filter-form {
  display: flex;
  gap: 0.875rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 340px;
}

.filter-search-icon {
  position: absolute;
  right: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.filter-search-input {
  width: 100%;
  padding: 0.625rem 1rem;
  padding-right: 2.75rem;
  border: 1.5px solid var(--border-default);
  background: var(--bg-input);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none;
  transition: all var(--ease-fast);
}

.filter-search-input::placeholder { color: var(--text-faint); }

.filter-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-status-select {
  padding: 0.625rem 2.5rem 0.625rem 1rem;
  border: 1.5px solid var(--border-default);
  background: var(--bg-input);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  transition: all var(--ease-fast);
  min-width: 150px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6B75' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
}

.filter-status-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Table specifics */
.th--checkbox { width: 40px; text-align: center; }
.table-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

.table-row { transition: all var(--ease-fast); }
.table-row:hover td { background: var(--bg-hover); }

.td--order-token { white-space: nowrap; }

.order-token-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: var(--font-semibold);
  color: var(--accent);
  transition: color var(--ease-fast);
}

.order-token-link:hover { color: var(--accent-hover); }

.order-token {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
}

.btn--copy {
  padding: 0.25rem 0.5rem;
  font-size: var(--text-xs);
  transition: all var(--ease-fast);
}

.customer-cell { display: flex; align-items: center; gap: 0.75rem; }

.customer-avatar--sm {
  width: 34px;
  height: 34px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.customer-info { display: flex; flex-direction: column; gap: 0.125rem; }
.customer-name { font-weight: var(--font-medium); color: var(--text-primary); }
.customer-phone { font-size: var(--text-xs); color: var(--text-muted); }

.td--amount { font-weight: var(--font-bold); white-space: nowrap; color: var(--text-primary); }
.td--tracking { font-family: var(--font-mono); font-size: var(--text-xs); direction: ltr; text-align: right; color: var(--text-secondary); }
.td--date { white-space: nowrap; color: var(--text-muted); font-size: var(--text-sm); }
.td--actions { white-space: nowrap; }

/* ============================================================
   SECTION 19: ORDER DETAIL PAGE
   ============================================================ */
.order-detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.detail-col-main, .detail-col-side {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.status-change-box {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.form-control--flex { flex: 1; min-width: 0; }
.form-control--sm { max-width: 250px; }
.tracking-btn { white-space: nowrap; }

.item-count { color: var(--text-muted); font-size: 0.875rem; }
.item-title { font-weight: 600; }
.item-total { font-weight: 700; }

.size-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.admin-table tfoot td {
  background: var(--bg-elevated);
  text-align: left;
  font-weight: 700;
}

.total-label { font-weight: 700; }
.total-price { font-weight: 800; font-size: 1.1rem; color: var(--accent); }

.timeline-details {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

/* Timeline */
.timeline { list-style: none; padding: 0; }
.timeline-item {
  position: relative;
  padding-right: 1.5rem;
  padding-bottom: 1.5rem;
  border-right: 2px solid var(--border-default);
  margin-right: 0.75rem;
}

.timeline-item:last-child { border-right: 2px solid transparent; padding-bottom: 0; }

.timeline-item::before {
  content: '';
  position: absolute;
  right: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-glow);
}

.timeline-title { font-weight: 600; color: var(--text-primary); }
.timeline-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Customer profile */
.customer-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.customer-avatar {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--text-inverse);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--accent-glow);
}

.customer-name { font-weight: 600; color: var(--text-primary); }
.customer-phone { font-size: 0.8rem; color: var(--text-muted); }

.info-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1rem 0;
}

.info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.info-row--block { flex-direction: column; gap: 0.25rem; }
.info-label { color: var(--text-muted); font-size: 0.8rem; }
.info-value { font-weight: 500; color: var(--text-primary); }
.info-value--muted {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.info-value--mono { font-family: var(--font-mono); }
.ltr-text { direction: ltr; text-align: right; font-family: var(--font-mono); }

/* Summary */
.summary-row { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.875rem; }
.summary-row--total { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-subtle); }
.summary-label { color: var(--text-muted); font-weight: 400; }
.summary-row--total .summary-label { font-weight: 700; font-size: 1.1rem; }
.summary-value { font-weight: 600; color: var(--text-primary); }
.summary-value--large { font-weight: 800; font-size: 1.2rem; color: var(--accent); }
.mono { font-family: monospace; }

/* ============================================================
   SECTION 20: CLIENT DETAIL
   ============================================================ */
.client-detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.client-detail-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
}

.client-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.client-orders { display: flex; flex-direction: column; gap: 1.5rem; }

.order-link { color: var(--accent); font-weight: 600; }
.order-link:hover { color: var(--accent-hover); }
.order-hash { color: var(--text-faint); }

.price-cell { font-weight: 700; color: var(--text-primary); }
.date-cell { color: var(--text-muted); font-size: var(--text-sm); }

/* ============================================================
   SECTION 21: PRODUCT FORM
   ============================================================ */
.product-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* ============================================================
   SECTION 22: LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(212,132,61,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(59,130,209,0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.login-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.login-background__pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 25% 25%, rgba((255,255,255,0.02), (255,255,255,0.02) 1px, transparent 1px));}
  background-size: 60px 60px;
}

.login-background__gradient {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(212,132,61,0.06) 0%, transparent 60%);
}

.login-container {
  width: 100%;
  max-width: 420px;
  animation: fadeInUp 0.6s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  z-index: 1;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand__logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.login-brand__logo svg {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 4px 16px var(--accent-glow));
}

.login-brand__name {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.login-brand__tagline {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-xl), 0 0 40px rgba(212,132,61,0.05);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 2px 2px 0 0;
}

.login-card__header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-card__title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.login-card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.login-alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: var(--text-sm);
  font-weight: 500;
  border-right-width: 4px;
  border-right-style: solid;
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

.login-alert__icon { width: 20px; height: 20px; flex-shrink: 0; }

.login-form__group { margin-bottom: 1.25rem; }

.login-form__label {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.login-form__input-wrapper { position: relative; }

.login-form__input-icon {
  position: absolute;
  right: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: color var(--ease-fast);
  pointer-events: none;
}

.login-form__input {
  width: 100%;
  padding: 0.875rem 1rem;
  padding-right: 2.75rem;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: all var(--ease-fast);
  text-align: right;
  outline: none;
}

.login-form__input::placeholder { color: var(--text-faint); }

.login-form__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-form__input:focus + .login-form__input-icon,
.login-form__input-wrapper:focus-within .login-form__input-icon { color: var(--accent); }

.login-form__submit {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  transition: all var(--ease-fast);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.login-form__submit svg { width: 18px; height: 18px; }
.login-form__submit:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--accent-glow); }
.login-form__submit:active { transform: scale(0.98); }

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.login-footer__brand { font-weight: 700; color: var(--accent); }

/* ============================================================
   SECTION 23: RESPONSIVE
   ============================================================ */
@media (max-width: 1280px) {
  :root { --sidebar-width: 250px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { gap: var(--space-4); }
  .split-grid { gap: var(--space-4); }
}

@media (max-width: 1024px) {
  :root { --sidebar-width: 240px; }
  .charts-grid { grid-template-columns: 1fr; }
  .split-grid { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
  .user-info { display: none; }
  .order-detail-grid { grid-template-columns: 1fr 1fr; }
  .client-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
    --header-height: 58px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    transform: translateX(100%);
    z-index: 200;
    box-shadow: none;
    border-left: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  .sidebar-close-btn { display: flex; }
  .sidebar-overlay { display: block; }
  .sidebar-overlay:not(.active) { background: rgba(0,0,0,0); }

  .header { padding: 0 var(--space-4); z-index: 95; }
  .header-menu-toggle { display: flex; }
  .header-page-title { font-size: var(--text-base); }
  .header-datetime { font-size: 0.7rem; }
  .header-divider { display: none; }

  .content { padding: var(--space-4); }

  .page-title { font-size: var(--text-xl); margin-bottom: var(--space-4); }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
  .kpi-card { padding: var(--space-4); border-radius: var(--radius-md); }
  .kpi-value { font-size: var(--text-xl); }
  .kpi-icon { width: 40px; height: 40px; }
  .kpi-icon svg { width: 20px; height: 20px; }

  .table-card { margin-bottom: var(--space-4); border-radius: var(--radius-md); }
  .table-header { padding: var(--space-3) var(--space-4); }
  .table-title { font-size: var(--text-base); }
  .admin-table { font-size: 0.8rem; }
  .admin-table th, .admin-table td { padding: var(--space-2) var(--space-3); }

  .toolbar { flex-direction: column; align-items: stretch; gap: var(--space-3); }
  .toolbar__group { width: 100%; gap: var(--space-2); }
  .search-wrapper { max-width: 100%; width: 100%; }

  .filter-pills { width: 100%; overflow-x: auto; flex-wrap: nowrap;
    padding-bottom: var(--space-1); -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-pills::-webkit-scrollbar { display: none; }

  .pagination { flex-direction: column; gap: var(--space-3); padding: var(--space-3) var(--space-4); }
  .pagination__controls { width: 100%; justify-content: center; }

  .modal-content {
    max-width: calc(100% - var(--space-6));
    margin: var(--space-3);
    max-height: calc(100vh - var(--space-6));
    border-radius: var(--radius-lg);
  }

  .form-row { grid-template-columns: 1fr; }
  .form-group { margin-bottom: var(--space-4); }
  .btn--lg { padding: var(--space-2) var(--space-4); font-size: var(--text-sm); }
  .status-badge { font-size: 0.7rem; padding: 2px 8px; }

  .upload-preview-container { justify-content: center; }
  .upload-preview-item { width: 100px; height: 128px; }

  .order-detail-grid { grid-template-columns: 1fr; gap: 1rem; }
  .client-detail-grid { grid-template-columns: 1fr; }
  .product-form-grid { grid-template-columns: 1fr; }

  .filter-bar-container { padding: 1rem; }
  .filter-form { flex-direction: column; align-items: stretch; }
  .filter-search-wrapper { max-width: 100%; width: 100%; }
  .filter-status-select { width: 100%; min-width: 0; }
  .filter-form .btn { width: 100%; }
  .filter-form .btn--primary { order: -1; }

  .page-header-bar { flex-direction: column; align-items: flex-start; }

  .customer-name { font-size: var(--text-xs); max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .td--tracking, .td--date { font-size: 0.7rem; }
}

@media (max-width: 480px) {
  :root { --header-height: 54px; }

  .content { padding: var(--space-3); }
  .page-title { font-size: var(--text-lg); }
  .header { padding: 0 var(--space-3); }
  .header-page-title { font-size: var(--text-sm); }

  .kpi-grid, .charts-grid, .stats-grid { grid-template-columns: 1fr; }
  .kpi-card { flex-direction: row; align-items: flex-start; text-align: right; gap: var(--space-3); }
  .kpi-icon { margin: 0; }

  .btn { width: 100%; justify-content: center; min-height: 44px; }
  .toolbar__group .btn { width: auto; }
  .action-buttons { flex-direction: column; gap: var(--space-2); }
  .action-buttons .btn { width: auto; flex: 1; }
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; }

  .admin-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .admin-table th, .admin-table td { white-space: nowrap; }

  .upload-area { padding: var(--space-6); }

  .login-page { padding: 1rem; }
  .login-card { padding: 1.75rem; }
  .login-brand__logo svg { width: 48px; height: 48px; }
  .login-brand__name { font-size: 1.75rem; }
}

@media (max-width: 768px) and (orientation: landscape) {
  .sidebar { width: 260px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 44px; min-width: 44px; }
  .form-control { min-height: 44px; }
  .sidebar-link { min-height: 48px; padding: var(--space-3) var(--space-4); }
  .pagination__btn { min-height: 38px; min-width: 38px; }
}

/* High DPI */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .sidebar-link svg, .icon { transform: translateZ(0); }
}

/* Touch active states */
.touch-active, .btn:active, .filter-pill__btn:active,
.sidebar-link:active, button:active, a:active {
  opacity: 0.8;
  transform: scale(0.98);
  transition: all 0.1s ease;
}

/* Keep scrolling on overflow */
.kpi-card, .chart-card, .table-card, .card {
  break-inside: avoid;
  page-break-inside: avoid;
}

/* Mobile scroll fix */
@supports (overflow: hidden) {
  .admin-layout { overflow-y: auto; overflow-x: hidden; height: 100vh; height: 100dvh; }
}

/* Android Chrome fix */
@supports (-webkit-touch-callout: none) {
  .content { min-height: -webkit-fill-available; }
}

/* Client detail responsive */
@media (max-width: 768px) {
  .client-detail-header { margin-bottom: 1rem; }
  .info-row { font-size: 0.8rem; }
  .status-action { flex-direction: column; gap: 0.5rem; }
}

/* Product grid responsive */
@media (max-width: 768px) {
  .product-form-grid { grid-template-columns: 1fr; }
  .table-card .table-body { padding: 1rem !important; }
}
