/**
 * Plain 2-Color Minimalist Design System
 * AdminForge · Aligned with Storefront (shopfront.php)
 * Monochromatic Architecture · Pure White & Ink Black · JetBrains Mono Meta
 * Strictly 0 Emojis · Production Standard
 */

/* ==========================================================================
   1. SEMANTIC COLOR TOKENS & THEMING (Plain 2-Color Monochrome)
   ========================================================================== */
:root {
  /* Storefront Pure 2-Color Minimalist Palette */
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --label: #000000;
  --label-secondary: #555555;
  --label-tertiary: #888888;
  --separator: rgba(0, 0, 0, 0.08);
  --blue: #000000;
  --red: #DC2626;
  --green: #16A34A;
  --orange: #D97706;

  /* Supplemental Fills & Radii */
  --fill-secondary: rgba(0, 0, 0, 0.05);
  --fill-tertiary: rgba(0, 0, 0, 0.03);
  --fill-quaternary: rgba(0, 0, 0, 0.015);
  --tab-bar-bg: rgba(255, 255, 255, 0.94);
  --nav-bar-bg: rgba(255, 255, 255, 0.86);
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --main-bg: #FFFFFF;
  --main-surface: #FFFFFF;
  --accent: #000000;

  /* 8pt Grid Spacing Metrics */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Sizing & Insets matching Storefront */
  --group-margin: 16px;
  --group-radius: 16px;
  --row-padding-h: 16px;
  --section-gap: 24px;
  --section-header-gap: 10px;
  --row-height: 48px;
  --row-height-compact: 40px;
  --icon-size: 20px;
  --icon-gap: 12px;
  --separator-inset: 16px;
  --min-tap: 40px;
  --tab-bar-height: 52px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #111111;
    --label: #FFFFFF;
    --label-secondary: #999999;
    --label-tertiary: #666666;
    --separator: rgba(255, 255, 255, 0.12);
    --blue: #FFFFFF;
    --red: #EF4444;
    --green: #22C55E;
    --orange: #F59E0B;

    --fill-secondary: rgba(255, 255, 255, 0.08);
    --fill-tertiary: rgba(255, 255, 255, 0.06);
    --fill-quaternary: rgba(255, 255, 255, 0.03);
    --tab-bar-bg: rgba(17, 17, 17, 0.94);
    --nav-bar-bg: rgba(0, 0, 0, 0.88);
    --overlay-bg: rgba(0, 0, 0, 0.75);
    --main-bg: #000000;
    --main-surface: #111111;
    --accent: #FFFFFF;
  }
}

/* Explicit data-theme override support */
[data-theme="dark"] {
  --bg: #000000;
  --surface: #111111;
  --label: #FFFFFF;
  --label-secondary: #999999;
  --label-tertiary: #666666;
  --separator: rgba(255, 255, 255, 0.12);
  --blue: #FFFFFF;
  --red: #EF4444;
  --green: #22C55E;
  --orange: #F59E0B;

  --fill-secondary: rgba(255, 255, 255, 0.08);
  --fill-tertiary: rgba(255, 255, 255, 0.06);
  --fill-quaternary: rgba(255, 255, 255, 0.03);
  --tab-bar-bg: rgba(17, 17, 17, 0.94);
  --nav-bar-bg: rgba(0, 0, 0, 0.88);
  --overlay-bg: rgba(0, 0, 0, 0.75);
  --main-bg: #000000;
  --main-surface: #111111;
  --accent: #FFFFFF;
}

[data-theme="light"] {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --label: #000000;
  --label-secondary: #555555;
  --label-tertiary: #888888;
  --separator: rgba(0, 0, 0, 0.08);
  --blue: #000000;
  --red: #DC2626;
  --green: #16A34A;
  --orange: #D97706;

  --fill-secondary: rgba(0, 0, 0, 0.05);
  --fill-tertiary: rgba(0, 0, 0, 0.03);
  --fill-quaternary: rgba(0, 0, 0, 0.015);
  --tab-bar-bg: rgba(255, 255, 255, 0.94);
  --nav-bar-bg: rgba(255, 255, 255, 0.86);
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --main-bg: #FFFFFF;
  --main-surface: #FFFFFF;
  --accent: #000000;
}

/* ==========================================================================
   DARK MODE: AdminForge Component Overrides
   ========================================================================== */

/* --- Sidebar Dark Mode --- */
[data-theme="dark"] .sidebar,
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sidebar {
  background: #000000;
  border-right-color: rgba(255, 255, 255, 0.1);
}}
[data-theme="dark"] .sidebar {
  background: #000000;
  border-right-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .nav-link {
  color: #A1A1AA;
}
[data-theme="dark"] .nav-link:hover:not(.active) {
  background: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
}
[data-theme="dark"] .nav-link.active {
  background: #FFFFFF;
  color: #000000 !important;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .nav-badge {
  background: #FFFFFF;
  color: #000000;
}
[data-theme="dark"] .nav-link.active .nav-badge {
  background: rgba(0, 0, 0, 0.2);
  color: #000000;
}
[data-theme="dark"] .shop-name-text {
  color: #FFFFFF;
}
[data-theme="dark"] .shop-loc {
  color: #888888;
}
[data-theme="dark"] .shop-icon {
  background: #FFFFFF;
  color: #000000;
}
[data-theme="dark"] .anna-status {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .anna-status-text {
  color: #CCCCCC;
}
[data-theme="dark"] .nav-section-label {
  color: #FFFFFF;
}

/* --- Buttons & Nav Actions Dark Mode --- */
[data-theme="dark"] .hig-nav-action {
  background: #FFFFFF;
  color: #000000 !important;
  border-color: #FFFFFF;
}
[data-theme="dark"] .hig-nav-action:hover {
  background: #E5E5E5;
  border-color: #E5E5E5;
}
[data-theme="dark"] .hig-nav-action.action-bold {
  background: #FFFFFF;
  color: #000000 !important;
  border-color: #FFFFFF;
}
[data-theme="dark"] .hig-nav-action.action-bold:hover {
  background: #E5E5E5;
}
[data-theme="dark"] .hig-nav-action.action-destructive {
  background: rgba(239, 68, 68, 0.12);
  color: #EF4444 !important;
  border-color: rgba(239, 68, 68, 0.25);
}
[data-theme="dark"] .hig-nav-action.action-destructive:hover {
  background: rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] .hig-btn-primary {
  background: #FFFFFF;
  color: #000000 !important;
  border-color: #FFFFFF;
}
[data-theme="dark"] .hig-btn-primary:hover {
  background: #E5E5E5;
  border-color: #E5E5E5;
}
[data-theme="dark"] .hig-btn-secondary {
  background: #1C1C1E;
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.16);
}
[data-theme="dark"] .hig-btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.4);
}
[data-theme="dark"] .hig-btn-destructive {
  background: rgba(239, 68, 68, 0.12);
  color: #EF4444 !important;
  border-color: rgba(239, 68, 68, 0.25);
}
[data-theme="dark"] .hig-btn-destructive:hover {
  background: rgba(239, 68, 68, 0.2);
}
[data-theme="dark"] .hig-btn {
  color: var(--label);
}
[data-theme="dark"] .hig-btn-ghost {
  background: transparent;
  color: var(--label);
  border-color: transparent;
}
[data-theme="dark"] .hig-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--label);
}

/* --- Badges Dark Mode --- */
[data-theme="dark"] .hig-badge.badge-black {
  background: #FFFFFF;
  color: #000000;
}
[data-theme="dark"] .hig-badge.badge-blue,
[data-theme="dark"] .hig-badge.badge-green {
  background: rgba(34, 197, 94, 0.12);
  color: #4ADE80;
  border-color: rgba(34, 197, 94, 0.25);
}
[data-theme="dark"] .hig-badge.badge-orange {
  background: rgba(245, 158, 11, 0.12);
  color: #FBBF24;
  border-color: rgba(245, 158, 11, 0.25);
}
[data-theme="dark"] .hig-badge.badge-red {
  background: rgba(239, 68, 68, 0.12);
  color: #F87171;
  border-color: rgba(239, 68, 68, 0.25);
}
[data-theme="dark"] .hig-badge.badge-gray {
  background: rgba(255, 255, 255, 0.06);
  color: #999999;
  border-color: rgba(255, 255, 255, 0.12);
}

/* --- Inputs & Form Controls Dark Mode --- */
[data-theme="dark"] .hig-input,
[data-theme="dark"] .hig-select,
[data-theme="dark"] .hig-textarea {
  background: #1C1C1E;
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.16);
}
[data-theme="dark"] .hig-input:focus,
[data-theme="dark"] .hig-select:focus,
[data-theme="dark"] .hig-textarea:focus {
  border-color: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

/* --- Search Bar Dark Mode --- */
[data-theme="dark"] .hig-search-bar {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .hig-search-bar:focus-within {
  border-color: #FFFFFF;
  background: #1C1C1E;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

/* --- Segmented Control Dark Mode --- */
[data-theme="dark"] .hig-segment-item {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: #CCCCCC;
}
[data-theme="dark"] .hig-segment-item:hover {
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .hig-segment-item.active {
  background: #FFFFFF;
  color: #000000 !important;
  border-color: #FFFFFF;
}
[data-theme="dark"] .hig-segment-badge {
  background: rgba(255, 255, 255, 0.08);
  color: #999999;
}
[data-theme="dark"] .hig-segment-item.active .hig-segment-badge {
  background: rgba(0, 0, 0, 0.15);
  color: #000000;
}
[data-theme="dark"] .hig-segment-badge.badge-urgent {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
}
[data-theme="dark"] .hig-segment-item.active .hig-segment-badge.badge-urgent {
  background: rgba(245, 158, 11, 0.2);
  color: #92400E;
}

/* --- Tab Bar Dark Mode --- */
[data-theme="dark"] .hig-tab-item.active {
  color: #FFFFFF;
}

/* --- Metric Card Hover Dark Mode --- */
[data-theme="dark"] .hig-metric-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* --- Row Action Label Dark Mode --- */
[data-theme="dark"] .row-action-label {
  color: #FFFFFF;
}

/* --- Modal Dark Mode --- */
[data-theme="dark"] .hig-modal-card {
  background: #1C1C1E;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"] .hig-modal-header {
  background: #1C1C1E;
}

/* --- Sheet Dark Mode --- */
[data-theme="dark"] .hig-sheet {
  background: #1C1C1E;
}

/* --- Logout Button Dark Mode --- */
[data-theme="dark"] .logout-btn {
  color: #888888;
}
[data-theme="dark"] .logout-btn:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #EF4444;
}

/* --- Sidebar Close Button Dark Mode --- */
[data-theme="dark"] .sidebar-close-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #888888;
}
[data-theme="dark"] .sidebar-close-btn:hover,
[data-theme="dark"] .sidebar-close-btn:active {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}

/* --- Mobile Full-Screen Modal Background Override --- */
@media (max-width: 768px) {
  [data-theme="dark"] .hig-modal-overlay,
  [data-theme="dark"] #bannerDetailsModal,
  [data-theme="dark"] #bannerModal,
  [data-theme="dark"] #addOrderModal,
  [data-theme="dark"] #addProductModal,
  [data-theme="dark"] #editProductModal,
  [data-theme="dark"] #editSettingsSheet,
  [data-theme="dark"] #changePasswordSheet,
  [data-theme="dark"] #changePinSheet {
    background: #000000 !important;
  }
  [data-theme="dark"] .hig-modal-card,
  [data-theme="dark"] #bannerDetailsModal > div,
  [data-theme="dark"] #editSettingsSheet > div,
  [data-theme="dark"] #changePasswordSheet > div,
  [data-theme="dark"] #changePinSheet > div {
    background: #000000 !important;
  }
}

/* ==========================================================================
   THEME TOGGLE COMPONENT (Sidebar Segmented Pill)
   ========================================================================== */
.sidebar-theme-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .sidebar-theme-toggle {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}
.sidebar-theme-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 4px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #888888;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.sidebar-theme-btn:hover {
  color: #555555;
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .sidebar-theme-btn:hover {
  color: #CCCCCC;
  background: rgba(255, 255, 255, 0.06);
}
.sidebar-theme-btn.active {
  background: #FFFFFF;
  color: #000000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
[data-theme="dark"] .sidebar-theme-btn.active {
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.sidebar-theme-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Quick Toggle Button (Top Nav) */
.theme-quick-toggle {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  border: 1px solid var(--separator);
  background: transparent;
  color: var(--label-secondary);
  cursor: pointer !important;
  pointer-events: auto !important;
  position: relative;
  z-index: 102 !important;
  touch-action: manipulation;
  transition: all 0.15s ease;
  flex-shrink: 0;
  padding: 0;
}
.theme-quick-toggle:hover {
  background: var(--fill-tertiary);
  color: var(--label);
}
.theme-quick-toggle:active {
  transform: scale(0.95);
}
.theme-quick-toggle svg,
.mobile-nav-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none !important;
}
/* Hide sun icon by default (light mode shows moon, dark mode shows sun) */
.theme-quick-toggle .icon-sun { display: none; }
.theme-quick-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-quick-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-quick-toggle .icon-moon { display: none; }

/* Settings Appearance Card */
.appearance-segment {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--fill-tertiary);
  border-radius: 10px;
  border: 1px solid var(--separator);
}
.appearance-segment-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 12px 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--label-tertiary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.appearance-segment-btn:hover {
  color: var(--label-secondary);
  background: var(--fill-quaternary);
}
.appearance-segment-btn.active {
  background: var(--surface);
  color: var(--label);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  border: 0.5px solid var(--separator);
}
[data-theme="dark"] .appearance-segment-btn.active {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.appearance-segment-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==========================================================================
   2. GLOBAL BASE & RESET
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  background-color: var(--bg);
  color: var(--label);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: clip;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ==========================================================================
   3. SCREEN WRAPPER & NAVIGATION BAR (Storefront Minimalist Architecture)
   ========================================================================== */
.hig-screen {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding-bottom: calc(var(--tab-bar-height) + 36px + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
}

.hig-nav-bar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100 !important;
  background: var(--nav-bar-bg);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border-bottom: 1px solid var(--separator);
  padding: max(16px, env(safe-area-inset-top, 16px)) var(--group-margin) 16px;
  margin-bottom: 24px;
  pointer-events: auto !important;
}

.hig-nav-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  position: relative;
  z-index: 101 !important;
  pointer-events: auto !important;
}

.hig-nav-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--label);
  letter-spacing: -0.4px;
  line-height: 1.2;
  margin: 0;
  display: inline-flex;
  align-items: center;
}

@media (min-width: 769px) {
  .hig-nav-title {
    font-size: 24px;
    font-weight: 800;
  }
}

.mobile-nav-toggle {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-right: 12px;
  background: transparent;
  border: 1px solid var(--separator, rgba(0, 0, 0, 0.1));
  border-radius: 8px;
  color: var(--label, #111111);
  cursor: pointer !important;
  pointer-events: auto !important;
  position: relative;
  z-index: 102 !important;
  touch-action: manipulation;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mobile-nav-toggle:hover {
  background: var(--fill-tertiary, rgba(0, 0, 0, 0.04));
  border-color: var(--separator, rgba(0, 0, 0, 0.2));
}

.mobile-nav-toggle:active {
  background: var(--fill-secondary, rgba(0, 0, 0, 0.08));
}

.hig-nav-bar-inner .mobile-nav-toggle {
  margin-right: 0 !important;
}

.hig-nav-large-title-zone {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
}

.hig-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--label-secondary);
}

.hig-nav-title-large {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--label);
  line-height: 1.15;
  margin: 0;
}

.hig-nav-action {
  font-size: 13px;
  font-weight: 600;
  color: #FFFFFF !important;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #000000;
  border: 1px solid #000000;
  padding: 6px 18px;
  border-radius: 9999px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

.hig-nav-action:hover {
  background: #222222;
  border-color: #222222;
  transform: translateY(-1px);
}

.hig-nav-action:active {
  transform: translateY(0);
}

.hig-nav-action.action-destructive {
  color: var(--red) !important;
  background: #FEF2F2;
  border-color: #FECACA;
}

.hig-nav-action.action-destructive:hover {
  background: #FEE2E2;
}

.hig-nav-action.action-bold {
  font-weight: 600;
  background: #000000;
  color: #FFFFFF !important;
  border-color: #000000;
}

.hig-nav-action.action-bold:hover {
  background: #222222;
}

/* ==========================================================================
   4. SECTION & GROUPED LIST CONTAINERS (Storefront Apple-Card Pattern)
   ========================================================================== */
.hig-section {
  margin-bottom: var(--section-gap);
  padding: 0 var(--group-margin);
}

.hig-section-header,
.group-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--label-secondary);
  padding: 0 var(--space-2);
  margin-bottom: var(--section-header-gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hig-section-footer,
.group-footer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 400;
  color: var(--label-tertiary);
  padding: var(--space-2) var(--space-2) 0;
  line-height: 1.4;
}

.hig-group,
.group {
  background: var(--surface);
  border-radius: var(--group-radius);
  border: 1px solid var(--separator);
  overflow: hidden;
  box-shadow: none;
}

/* ==========================================================================
   5. ROW STRUCTURES (Push Row, Control Row, Action Row)
   ========================================================================== */
.hig-row,
.group-row {
  display: flex;
  align-items: center;
  min-height: var(--row-height);
  padding: 0 var(--row-padding-h);
  background: var(--surface);
  position: relative;
  text-decoration: none;
  color: inherit;
  cursor: default;
  transition: background-color 0.12s ease;
}

/* 44pt compact row (without icon) */
.hig-row.no-icon,
.group-row.no-icon {
  min-height: var(--row-height-compact);
}

/* Inset Separator (60pt left inset aligns with label text) */
.hig-row:not(:last-child)::after,
.group-row:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--separator-inset);
  right: 0;
  height: 1px;
  background: var(--separator);
}

.hig-row.no-icon:not(:last-child)::after,
.group-row.no-icon:not(:last-child)::after {
  left: var(--row-padding-h);
}

/* Tap Highlight on interactive rows */
.hig-row.row-push,
.group-row.row-push,
.hig-row.row-action,
.group-row.row-action {
  cursor: pointer;
}

.hig-row.row-push:hover,
.group-row.row-push:hover,
.hig-row.row-action:hover,
.group-row.row-action:hover {
  background: var(--fill-quaternary);
}

.hig-row.row-push:active,
.group-row.row-push:active,
.hig-row.row-action:active,
.group-row.row-action:active {
  background: var(--fill-tertiary);
}

/* Row Icon (24x24pt, single color) */
.row-icon {
  width: var(--icon-size);
  height: var(--icon-size);
  margin-right: var(--icon-gap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--blue);
}

.row-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.row-icon.icon-orange { color: var(--orange); }
.row-icon.icon-green  { color: var(--green); }
.row-icon.icon-red    { color: var(--red); }
.row-icon.icon-blue   { color: #007AFF; }
.row-icon.icon-purple { color: #5856D6; }
.row-icon.icon-gray   { color: var(--label-secondary); }

/* Row Content Layout */
.row-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
}

.row-label {
  font-size: 16px;
  font-weight: 500;
  color: var(--label);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--label-secondary);
  text-align: right;
  margin-left: var(--space-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Single Middle Text for Uncluttered Mobile Grouped Rows */
.row-text {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--label);
  letter-spacing: -0.2px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-text.font-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
}

/* Type 1: Push Row Chevron */
.row-chevron {
  width: 8px;
  height: 13px;
  margin-left: var(--space-2);
  flex-shrink: 0;
  color: var(--label-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.row-chevron svg {
  width: 8px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Type 3: Action Row */
.row-action-label {
  font-size: 16px;
  font-weight: 600;
  color: #000000;
}

.row-action-label.destructive {
  color: var(--red);
}

/* ==========================================================================
   6. MULTI-LINE CARD ROWS (Orders, Products, Shop Keys)
   ========================================================================== */
.card-row {
  display: flex;
  align-items: center;
  padding: 14px var(--row-padding-h);
  background: var(--surface);
  position: relative;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.card-row:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--row-padding-h);
  right: 0;
  height: 1px;
  background: var(--separator);
}

.card-row:hover {
  background: var(--fill-quaternary);
}

.card-row:active {
  background: var(--fill-tertiary);
}

.card-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.card-row-line-1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-row-title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--label);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.card-row-line-2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--label);
}

.card-row-line-3 {
  font-size: 13px;
  font-weight: 400;
  color: var(--label-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-row-line-4 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--label-tertiary);
}

/* 72x72pt Product Thumbnail */
.product-thumb {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: var(--fill-quaternary);
  border: 1px solid var(--separator);
  object-fit: cover;
  flex-shrink: 0;
  margin-right: var(--space-4);
}

/* Responsive Banner Thumbnail (Widescreen 16:10 Proportions) */
.banner-thumb-wrap {
  position: relative;
  width: 88px;
  height: 56px;
  flex-shrink: 0;
  margin-right: var(--space-4);
  border-radius: 8px;
  overflow: hidden;
  background: var(--fill-quaternary);
  border: 1px solid var(--separator);
}

@media (min-width: 769px) {
  .banner-thumb-wrap {
    width: 128px;
    height: 80px;
    border-radius: 10px;
  }
}

.banner-thumb {
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: var(--fill-quaternary);
  border: none;
  object-fit: cover;
  flex-shrink: 0;
  margin: 0;
  display: block;
}

/* ==========================================================================
   7. STATUS BADGES (Storefront JetBrains Mono Pill Badges)
   ========================================================================== */
.hig-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.hig-badge.badge-black {
  background: #000000;
  color: #FFFFFF;
}

.hig-badge.badge-blue,
.hig-badge.badge-green {
  background: #F0FDF4;
  color: #166534;
  border-color: #BBF7D0;
}

.hig-badge.badge-orange {
  background: #FFFBEB;
  color: #92400E;
  border-color: #FDE68A;
}

.hig-badge.badge-red {
  background: #FEF2F2;
  color: #991B1B;
  border-color: #FECACA;
}

.hig-badge.badge-gray {
  background: rgba(0, 0, 0, 0.04);
  color: #555555;
  border-color: rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   8. 2X2 METRIC CARDS (Storefront Card Architecture)
   ========================================================================== */
.hig-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 var(--group-margin);
  margin-bottom: var(--section-gap);
}

.hig-metric-card {
  background: var(--surface);
  border-radius: var(--group-radius);
  border: 1px solid var(--separator);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 96px;
  box-shadow: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.hig-metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.hig-metric-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--label-secondary);
}

.hig-metric-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--label);
  line-height: 1.15;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   9. CONTROLS (iOS Switch, Search Bar & Storefront Pill Tabs)
   ========================================================================== */
/* iOS Switch Control */
.hig-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.hig-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.hig-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--fill-tertiary);
  border-radius: 31px;
  transition: background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hig-switch-slider::before {
  position: absolute;
  content: "";
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hig-switch input:checked + .hig-switch-slider {
  background-color: var(--green);
}

.hig-switch input:checked + .hig-switch-slider::before {
  transform: translateX(20px);
}

/* Storefront Apple Pill Container Search Bar */
.hig-search-bar {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.025);
  border-radius: 9999px;
  height: 40px;
  padding: 0 16px;
  margin: 0 var(--group-margin) var(--space-4);
  gap: 10px;
  border: 1px solid var(--separator);
  transition: all 0.2s ease;
}

.hig-search-bar:focus-within {
  border-color: #000000;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.hig-search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--label);
}

.hig-search-bar input::placeholder {
  color: var(--label-tertiary);
}

/* Storefront Apple Pill Tab Segmented Control */
.hig-segmented-control {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  align-items: center;
  margin: 0 var(--group-margin) var(--space-4);
  background: transparent;
  border: none;
  -webkit-overflow-scrolling: touch;
}

.hig-segment-item {
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid var(--separator);
  background: rgba(0, 0, 0, 0.03);
  color: #333333;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  font-family: inherit;
}

.hig-segment-item:hover {
  color: #000000;
  border-color: rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.hig-segment-item.active {
  background: #000000;
  color: #FFFFFF !important;
  border-color: #000000;
  font-weight: 600;
  box-shadow: none;
}

.hig-segment-badge {
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  background: rgba(0, 0, 0, 0.06);
  color: #666666;
  transition: all 0.2s ease;
}

.hig-segment-item.active .hig-segment-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.hig-segment-badge.badge-urgent {
  background: #FEF3C7;
  color: #92400E;
}

.hig-segment-item.active .hig-segment-badge.badge-urgent {
  background: #FDE68A;
  color: #78350F;
}

/* ==========================================================================
   10. BOTTOM TAB BAR (Storefront Crisp Navigation)
   ========================================================================== */
.hig-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--tab-bar-bg);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border-top: 1px solid var(--separator);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  height: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.hig-tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--min-tap);
  min-width: var(--min-tap);
  color: var(--label-tertiary);
  text-decoration: none;
  gap: 3px;
  cursor: pointer;
  transition: color 0.15s ease;
  user-select: none;
}

.hig-tab-item.active {
  color: #000000;
  font-weight: 600;
}

.hig-tab-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hig-tab-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hig-tab-item.active .hig-tab-icon svg {
  stroke-width: 2.2;
}

.hig-tab-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1px;
}

/* ==========================================================================
   11. SHEETS & ACTION PANELS (Bottom Modal Pattern)
   ========================================================================== */
.hig-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hig-sheet-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.hig-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  z-index: 95;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  overflow-y: auto;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.hig-sheet.active {
  transform: translateY(0);
}

.hig-sheet-handle {
  width: 36px;
  height: 5px;
  background: var(--fill-tertiary);
  border-radius: 3px;
  margin: 8px auto 12px;
}

.hig-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--group-margin) 16px;
  border-bottom: 1px solid var(--separator);
  margin-bottom: var(--space-4);
}

.hig-sheet-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--label);
}

/* Modals & Dialogs */
.hig-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
}

.hig-modal-card {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border: 0.5px solid var(--separator);
  overflow: hidden;
  animation: higModalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes higModalPop {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.hig-modal-header {
  padding: 18px 20px;
  border-bottom: 0.5px solid var(--separator);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--surface);
}

.hig-modal-close {
  background: var(--fill-tertiary);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--label-secondary);
  font-size: 18px;
  line-height: 1;
  padding: 0;
  transition: all 0.15s ease;
}
.hig-modal-close:hover {
  background: var(--fill-secondary);
  color: var(--label);
}

.hig-modal-form,
.hig-modal-body {
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
}

/* ==========================================================================
   MOBILE FULL-SCREEN MODALS (< 768px)
   Add Banner, Add Order, Add/Edit Product fill 100% of the mobile viewport.
   ========================================================================== */
@media (max-width: 768px) {
  .hig-modal-overlay,
  #bannerDetailsModal,
  #bannerModal,
  #addOrderModal,
  #addProductModal,
  #editProductModal,
  #editSettingsSheet,
  #changePasswordSheet,
  #changePinSheet {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    z-index: 9999 !important;
    background: var(--surface) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .hig-modal-card,
  #bannerDetailsModal > div,
  #bannerModal > div,
  #addOrderModal > div,
  #addProductModal > div,
  #editProductModal > div,
  #editSettingsSheet > div,
  #changePasswordSheet > div,
  #changePinSheet > div {
    width: 100vw !important;
    width: 100% !important;
    max-width: 100vw !important;
    max-width: 100% !important;
    min-width: 100vw !important;
    min-width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    min-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: var(--surface) !important;
  }

  .hig-modal-header,
  #bannerDetailsModal > div > div:first-child,
  #bannerModal > div > div:first-child,
  #addOrderModal > div > div:first-child,
  #addProductModal > div > div:first-child,
  #editProductModal > div > div:first-child,
  #editSettingsSheet > div > div:first-child,
  #changePasswordSheet > div > div:first-child,
  #changePinSheet > div > div:first-child {
    flex-shrink: 0 !important;
    padding: max(16px, env(safe-area-inset-top, 16px)) 16px 14px 16px !important;
    background: var(--surface) !important;
    border-bottom: 0.5px solid var(--separator) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
  }

  .hig-modal-form,
  .hig-modal-body,
  #bannerDetailsModal > div > div:nth-child(2),
  #bannerModal > div > form,
  #addOrderModal > div > form,
  #addProductModal > div > form,
  #editProductModal > div > form,
  #editSettingsSheet > div > form,
  #changePasswordSheet > div > form,
  #changePinSheet > div > form {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 16px 16px calc(36px + env(safe-area-inset-bottom, 16px)) 16px !important;
    overscroll-behavior: contain !important;
  }

  /* Prevent zoom on mobile inputs */
  .hig-modal-form input[type="text"],
  .hig-modal-form input[type="number"],
  .hig-modal-form input[type="password"],
  .hig-modal-form select,
  .hig-modal-form textarea,
  #bannerModal input, #bannerModal select, #bannerModal textarea,
  #addOrderModal input, #addOrderModal select, #addOrderModal textarea,
  #addProductModal input, #addProductModal select, #addProductModal textarea,
  #editProductModal input, #editProductModal select, #editProductModal textarea {
    font-size: 16px !important;
  }
}

/* ==========================================================================
   12. BUTTONS & FORM CONTROLS (Storefront Plain 2-Color Architecture)
   ========================================================================== */
.hig-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 18px;
  border-radius: 9999px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  color: var(--label);
  font-family: inherit;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-sizing: border-box;
}

.hig-btn svg {
  stroke: currentColor;
}

.hig-btn:active {
  transform: scale(0.98);
}

.hig-btn-sm {
  min-height: 32px;
  padding: 5px 14px;
  font-size: 12px;
  border-radius: 9999px;
}

.hig-btn-primary {
  background: #000000;
  color: #FFFFFF !important;
  border-color: #000000;
}

.hig-btn-primary:hover {
  background: #222222;
  border-color: #222222;
  transform: translateY(-1px);
}

.hig-btn-secondary {
  background: #FFFFFF;
  color: #000000;
  border-color: var(--separator);
}

.hig-btn-secondary:hover {
  border-color: #000000;
  transform: translateY(-1px);
}

.hig-btn-destructive {
  background: #FEF2F2;
  color: #991B1B !important;
  border-color: #FECACA;
}

.hig-btn-destructive:hover {
  background: #FEE2E2;
}

.hig-btn-block {
  width: 100%;
}

.hig-btn-ghost {
  background: transparent;
  color: var(--label);
  border-color: transparent;
}

.hig-btn-ghost:hover {
  background: var(--fill-tertiary);
  color: var(--label);
}

.hig-btn-ghost:active {
  background: var(--fill-quaternary);
}

.hig-btn-ghost svg {
  stroke: currentColor;
}

/* --- Email UI Controls --- */
.email-search-input {
  width: 100%;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--separator);
  background: var(--fill-tertiary);
  padding: 0 36px;
  font-size: 14px;
  color: var(--label);
  outline: none;
  transition: all 0.2s ease;
}

.email-search-input:focus {
  background: var(--surface);
  border-color: var(--label-secondary);
}

.email-search-input::placeholder {
  color: var(--label-tertiary);
}

[data-theme="dark"] .email-search-input {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}

[data-theme="dark"] .email-search-input:focus {
  background: #1A1A1A;
  border-color: rgba(255, 255, 255, 0.3);
}

.mail-row-card {
  transition: background 0.15s ease;
}

.mail-row-card:hover {
  background: var(--fill-tertiary) !important;
}

[data-theme="dark"] .mail-row-card:hover {
  background: rgba(255, 255, 255, 0.06) !important;
}

/* Stepper Control */
.hig-stepper {
  display: inline-flex;
  align-items: center;
  background: var(--fill-tertiary);
  border-radius: 8px;
  overflow: hidden;
  height: 32px;
  flex-shrink: 0;
}

.hig-stepper-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  background: transparent;
  border: none;
  user-select: none;
  padding: 0;
  line-height: 1;
}

.hig-stepper-btn:active {
  background: var(--fill-quaternary);
}

.hig-stepper-val {
  min-width: 28px;
  padding: 0 4px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--label);
}

/* Form Controls */
.hig-form-group {
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hig-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--label-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hig-req {
  color: var(--red, #ff3b30);
  font-weight: 700;
  margin-left: 2px;
}

.hig-input,
.hig-select,
.hig-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--label);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.hig-input:focus,
.hig-select:focus,
.hig-textarea:focus {
  border-color: #000000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.hig-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .hig-form-row {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   14. RESPONSIVE BREAKPOINTS (Desktop vs Mobile HIG)
   ========================================================================== */
@media (min-width: 769px) {
  .hig-tab-bar {
    display: none !important;
  }
  .hig-screen {
    padding-bottom: 48px;
  }
  .sidebar {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  }
  .main {
    transition: margin-left 0.25s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  body.sidebar-collapsed .sidebar,
  .app.sidebar-collapsed .sidebar,
  .sidebar.collapsed {
    transform: translate3d(-250px, 0, 0) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }
  body.sidebar-collapsed .main,
  .app.sidebar-collapsed .main {
    margin-left: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }
}

@media (max-width: 768px) {
  .hig-tab-bar {
    display: none !important;
  }
  .hig-screen {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
  }
  .mobile-nav-toggle {
    display: inline-flex !important;
  }
  .hig-metric-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  :root {
    --group-margin: 12px;
    --row-padding-h: 12px;
  }
  .hig-metric-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .hig-metric-card {
    padding: 12px 14px;
    min-width: 0;
  }
  .hig-metric-value {
    font-size: 22px;
    word-break: break-word;
  }
  .product-thumb {
    width: 60px;
    height: 60px;
  }
}

/* ==========================================================================
   15. STOREFRONT MINIMALIST SIDEBAR (Pure White Canvas & Jet Black Accents)
   ========================================================================== */
.sidebar {
  width: 250px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  overflow: hidden;
  border-right: 1px solid var(--separator);
}

.sidebar-top {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--separator);
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--label);
  padding: 16px 12px 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  min-height: 42px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--label);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: all 0.15s ease;
  position: relative;
  user-select: none;
}

.nav-link:hover:not(.active) {
  background: rgba(0, 0, 0, 0.04);
  color: var(--label);
}

.nav-link.active {
  background: var(--label);
  color: var(--bg) !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.nav-badge {
  background: var(--label);
  color: var(--bg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  min-width: 19px;
  height: 19px;
  border-radius: 9999px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

.nav-link.active .nav-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.sidebar-bottom {
  padding: 12px 10px;
  border-top: 1px solid var(--separator);
}

.logout-btn {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--label-secondary);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s ease;
}

.logout-btn:hover {
  background: rgba(220, 38, 38, 0.06);
  color: #DC2626;
}

/* ==========================================================================
   MOBILE FULL-SCREEN NAVIGATION MENU (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
  body.sidebar-open {
    overflow: hidden;
  }
  body.sidebar-open .app {
    overflow: visible !important;
    overflow-x: visible !important;
  }
  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    max-width: 100vw !important;
    height: 100vh;
    height: 100dvh;
    z-index: 99999 !important;
    transform: translate3d(-100%, 0, 0);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.22s ease,
                visibility 0.3s;
    box-shadow: none;
    background: var(--sidebar-bg, var(--bg, #FFFFFF)) !important;
    will-change: transform, opacity;
  }
  /* ==========================================================================
     DARK MODE MOBILE ONLY: Subtle Green Theme (Protocol 66 & Apple HIG Aligned)
     ========================================================================== */
  [data-theme="dark"] .sidebar {
    background: radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.04) 50%, transparent 80%),
                linear-gradient(180deg, #07130E 0%, #030806 35%, #000000 100%) !important;
    border-right: none !important;
  }
  [data-theme="dark"] .sidebar-nav {
    background: transparent !important;
  }
  [data-theme="dark"] .sidebar-nav-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding-bottom: 12px !important;
    margin-bottom: 10px !important;
  }
  [data-theme="dark"] .sidebar-nav .nav-section-label,
  [data-theme="dark"] .sidebar-nav .sidebar-nav-header .nav-section-label {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    letter-spacing: 1.5px !important;
    text-transform: uppercase !important;
    color: #A7F3D0 !important;
  }
  [data-theme="dark"] .sidebar-nav .sidebar-nav-header .nav-section-label {
    padding: 0 0 0 14px !important;
    margin: 0 !important;
  }
  [data-theme="dark"] .sidebar-close-btn {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #FFFFFF !important;
  }
  [data-theme="dark"] .sidebar-close-btn svg {
    stroke: #FFFFFF !important;
  }
  [data-theme="dark"] .sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.88) !important;
    background: transparent !important;
    border-radius: 10px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    min-height: 44px !important;
    margin-bottom: 4px !important;
  }
  [data-theme="dark"] .sidebar-nav .nav-link span {
    color: rgba(255, 255, 255, 0.88) !important;
    font-size: 18px !important;
    font-weight: 700 !important;
  }
  [data-theme="dark"] .sidebar-nav .nav-link:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06) !important;
  }
  [data-theme="dark"] .sidebar-nav .nav-link.active {
    background: rgba(16, 185, 129, 0.16) !important;
    border: 1px solid rgba(52, 211, 153, 0.35) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
  }
  [data-theme="dark"] .sidebar-nav .nav-link.active span {
    color: #FFFFFF !important;
    font-weight: 700 !important;
  }
  [data-theme="dark"] .sidebar-nav .nav-badge {
    background: rgba(16, 185, 129, 0.18) !important;
    color: #6EE7B7 !important;
    border: 1px solid rgba(52, 211, 153, 0.3) !important;
    font-weight: 800 !important;
  }
  [data-theme="dark"] .sidebar-nav a[href="shopfront.php"].nav-link {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #FFFFFF !important;
    border-radius: 10px !important;
    min-height: 46px !important;
  }
  [data-theme="dark"] .sidebar-nav a[href="shopfront.php"].nav-link span {
    color: #FFFFFF !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 14px !important;
  }
  [data-theme="dark"] .sidebar-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    background: transparent !important;
  }
  [data-theme="dark"] .sidebar-bottom .logout-btn {
    background: rgba(239, 68, 68, 0.08) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    border-radius: 10px !important;
    min-height: 46px !important;
    padding: 0 16px !important;
  }
  [data-theme="dark"] .sidebar-bottom .logout-btn span {
    color: #F87171 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .sidebar {
      background: radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.04) 50%, transparent 80%),
                  linear-gradient(180deg, #07130E 0%, #030806 35%, #000000 100%) !important;
      border-right: none !important;
    }
    :root:not([data-theme="light"]) .sidebar-nav {
      background: transparent !important;
    }
    :root:not([data-theme="light"]) .sidebar-nav-header {
      border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
      padding-bottom: 12px !important;
      margin-bottom: 10px !important;
    }
    :root:not([data-theme="light"]) .sidebar-nav .nav-section-label,
    :root:not([data-theme="light"]) .sidebar-nav .sidebar-nav-header .nav-section-label {
      font-family: 'JetBrains Mono', monospace !important;
      font-size: 13px !important;
      font-weight: 800 !important;
      letter-spacing: 1.5px !important;
      text-transform: uppercase !important;
      color: #A7F3D0 !important;
    }
    :root:not([data-theme="light"]) .sidebar-nav .sidebar-nav-header .nav-section-label {
      padding: 0 0 0 14px !important;
      margin: 0 !important;
    }
    :root:not([data-theme="light"]) .sidebar-close-btn {
      background: rgba(255, 255, 255, 0.08) !important;
      border: 1px solid rgba(255, 255, 255, 0.14) !important;
      color: #FFFFFF !important;
    }
    :root:not([data-theme="light"]) .sidebar-close-btn svg {
      stroke: #FFFFFF !important;
    }
    :root:not([data-theme="light"]) .sidebar-nav .nav-link {
      color: rgba(255, 255, 255, 0.88) !important;
      background: transparent !important;
      border-radius: 10px !important;
      font-size: 18px !important;
      font-weight: 700 !important;
      min-height: 44px !important;
      margin-bottom: 4px !important;
    }
    :root:not([data-theme="light"]) .sidebar-nav .nav-link span {
      color: rgba(255, 255, 255, 0.88) !important;
      font-size: 18px !important;
      font-weight: 700 !important;
    }
    :root:not([data-theme="light"]) .sidebar-nav .nav-link:hover:not(.active) {
      background: rgba(255, 255, 255, 0.06) !important;
    }
    :root:not([data-theme="light"]) .sidebar-nav .nav-link.active {
      background: rgba(16, 185, 129, 0.16) !important;
      border: 1px solid rgba(52, 211, 153, 0.35) !important;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }
    :root:not([data-theme="light"]) .sidebar-nav .nav-link.active span {
      color: #FFFFFF !important;
      font-weight: 700 !important;
    }
    :root:not([data-theme="light"]) .sidebar-nav .nav-badge {
      background: rgba(16, 185, 129, 0.18) !important;
      color: #6EE7B7 !important;
      border: 1px solid rgba(52, 211, 153, 0.3) !important;
      font-weight: 800 !important;
    }
    :root:not([data-theme="light"]) .sidebar-nav a[href="shopfront.php"].nav-link {
      background: rgba(255, 255, 255, 0.04) !important;
      border: 1px solid rgba(255, 255, 255, 0.08) !important;
      color: #FFFFFF !important;
      border-radius: 10px !important;
      min-height: 46px !important;
    }
    :root:not([data-theme="light"]) .sidebar-nav a[href="shopfront.php"].nav-link span {
      color: #FFFFFF !important;
      font-family: 'JetBrains Mono', monospace !important;
      font-size: 14px !important;
    }
    :root:not([data-theme="light"]) .sidebar-bottom {
      border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
      background: transparent !important;
    }
    :root:not([data-theme="light"]) .sidebar-bottom .logout-btn {
      background: rgba(239, 68, 68, 0.08) !important;
      border: 1px solid rgba(239, 68, 68, 0.2) !important;
      border-radius: 10px !important;
      min-height: 46px !important;
      padding: 0 16px !important;
    }
    :root:not([data-theme="light"]) .sidebar-bottom .logout-btn span {
      color: #F87171 !important;
      font-size: 14px !important;
      font-weight: 700 !important;
    }
  }
  body.sidebar-open .sidebar,
  .app.sidebar-open .sidebar,
  .sidebar.open {
    transform: translate3d(0, 0, 0) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  .sidebar-overlay {
    display: none !important;
  }
  .sidebar-top {
    padding: max(16px, env(safe-area-inset-top, 16px)) 20px 14px;
  }
  .sidebar-nav {
    padding: 16px 20px;
  }
  .sidebar-nav .nav-section-label {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: 18px 14px 10px;
  }
  .sidebar-nav .nav-link {
    padding: 14px 16px;
    font-size: 21px;
    font-weight: 700;
    min-height: 52px;
    border-radius: 12px;
    margin-bottom: 5px;
    letter-spacing: -0.02em;
  }
  .sidebar-nav .nav-link span {
    font-size: 21px;
    font-weight: 700;
  }
  .sidebar-nav .nav-badge {
    font-size: 13px;
    min-width: 24px;
    height: 24px;
    border-radius: 9999px;
  }
  .sidebar-bottom {
    padding: 14px 18px max(20px, env(safe-area-inset-bottom, 20px));
  }
  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
  }
  .mobile-nav-toggle:active {
    background: var(--main-surface);
  }
  .sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(120, 120, 128, 0.12);
    border: none;
    border-radius: 50%;
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease;
  }
  .sidebar-close-btn:hover, .sidebar-close-btn:active {
    background: rgba(120, 120, 128, 0.22);
  }
  html, body {
    overflow-x: clip;
    max-width: 100vw;
  }
  .app {
    display: block !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    overflow-x: clip !important;
  }
  .main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
    box-sizing: border-box !important;
  }
  .main-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }
  .hig-screen {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }
}



