/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  /* Colors */
  --bg-body: #f0f2f5;
  --bg-sidebar: #1e1e2d;
  --bg-sidebar-hover: #2a2a3c;
  --bg-sidebar-active: #3a3a50;
  --bg-panel: #ffffff;
  --bg-topbar: #ffffff;
  --bg-input: #f7f8fa;

  --text-primary: #1a1a2e;
  --text-secondary: #4a4a68;
  --text-muted: #8c8ca1;
  --text-white: #ffffff;
  --text-sidebar: #a2a3b7;
  --text-sidebar-active: #ffffff;

  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-bg: rgba(99, 102, 241, 0.08);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.08);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.08);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.08);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.08);

  --border: #e5e7eb;
  --border-light: #f0f0f5;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --sidebar-width: 260px;
  --topbar-height: 64px;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.6;
}

code {
  background: var(--accent-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent);
}

/* ============================================
   LAYOUT
   ============================================ */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 1.6rem;
}

.brand-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: -0.3px;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-sidebar);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.sidebar-close:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-white);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px 20px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 16px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  color: var(--text-sidebar);
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.nav-item.active {
  background: var(--accent);
  color: var(--text-white);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 14px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 8px;
  color: #ef4444;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: background 0.2s;
}
.logout-btn:hover {
  background: rgba(239,68,68,0.2);
}

/* ============================================
   TOGGLE SWITCH
   ============================================ */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle-checkbox { display: none; }

.toggle-slider {
  display: inline-block;
  width: 40px;
  height: 22px;
  background: rgba(255,255,255,0.15);
  border-radius: 11px;
  position: relative;
  transition: 0.3s;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: 0.3s;
}

.toggle-checkbox:checked + .toggle-slider {
  background: var(--success);
}

.toggle-checkbox:checked + .toggle-slider::after {
  transform: translateX(18px);
}

.toggle-text {
  color: var(--text-sidebar);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: 0.3s;
}

.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Stat Pills */
.stat-pills {
  display: flex;
  gap: 8px;
}

.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-input);
  border-radius: 20px;
  border: 1px solid var(--border);
}

.pill-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pill-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pill-success .pill-value { color: var(--success); }
.pill-danger .pill-value { color: var(--danger); }
.pill-warning .pill-value { color: var(--warning); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover {
  background: var(--accent-light);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--border-light);
  border-color: #d1d5db;
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  background: var(--bg-input);
}

.btn-outline-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  opacity: 0.85;
}
.btn-outline-danger:hover {
  background: var(--danger-bg);
  opacity: 1;
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ============================================
   CONTENT AREA
   ============================================ */
.content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  width: 100%;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-panel);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-card-icon {
  font-size: 2rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.stat-card-green .stat-card-icon { background: var(--success-bg); }
.stat-card-teal .stat-card-icon  { background: rgba(20, 184, 166, 0.08); }
.stat-card-amber .stat-card-icon { background: var(--warning-bg); }
.stat-card-blue .stat-card-icon  { background: var(--info-bg); }

.stat-card-body {
  display: flex;
  flex-direction: column;
}

.stat-card-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card-green .stat-card-value { color: var(--success); }
.stat-card-teal .stat-card-value  { color: #14b8a6; }
.stat-card-amber .stat-card-value { color: var(--warning); }
.stat-card-blue .stat-card-value  { color: var(--info); }

.stat-card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* ============================================
   SEARCH SECTION
   ============================================ */
.search-section {
  margin-bottom: 20px;
}

.search-bar-inline {
  display: flex;
  gap: 8px;
}

.search-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  background: var(--bg-panel);
  color: var(--text-primary);
  transition: all 0.2s;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.search-input::placeholder {
  color: var(--text-muted);
}

.result-container {
  margin-top: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  animation: slideIn 0.3s ease;
}
.result-container.hidden { display: none; }

.result-text {
  font-size: 0.92rem;
  line-height: 1.6;
}

.result-found {
  background: var(--success-bg);
  border-left: 3px solid var(--success);
  color: #166534;
}

.result-not-found {
  background: var(--danger-bg);
  border-left: 3px solid var(--danger);
  color: #991b1b;
}

/* ============================================
   PANELS & TAB CONTENT
   ============================================ */
.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

.panel {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.panel-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
}

.panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.panel-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ============================================
   TOOLBAR (filter bars)
   ============================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  background: var(--bg-input);
}

.toolbar-search {
  flex: 1;
  min-width: 180px;
}

.toolbar-info {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0 4px;
}

.toolbar-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.select-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--bg-panel);
  color: var(--text-secondary);
  cursor: pointer;
}
.select-input:focus {
  outline: none;
  border-color: var(--accent);
}

.date-input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: inherit;
  background: var(--bg-panel);
}
.date-input:focus {
  outline: none;
  border-color: var(--accent);
}

.custom-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-sep {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 12px;
  white-space: nowrap;
}
.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ============================================
   ORDERS LIST
   ============================================ */
.orders-list {
  padding: 16px 24px;
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
}

.order-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  transition: all 0.2s ease;
  gap: 12px;
  flex-wrap: wrap;
}

.order-item:hover {
  background: #eef0f4;
  transform: translateX(3px);
}

.order-id {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
  white-space: nowrap;
}

.order-time {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.order-time-info {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.7;
  flex-grow: 1;
  text-align: right;
}

.time-label {
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 4px;
}

.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
  font-size: 0.88rem;
}

/* ============================================
   PHONE NUMBERS
   ============================================ */
.phone-numbers-info {
  width: 100%;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

.toggle-phones-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s ease;
  font-family: inherit;
}
.toggle-phones-btn:hover {
  background: var(--accent-light);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.toggle-icon {
  display: inline-block;
  transition: transform 0.3s ease;
  font-size: 0.75rem;
}

.phone-container { margin-top: 10px; animation: slideIn 0.3s ease; }
.phone-container.hidden { display: none; }

.phone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}

.phone-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--accent);
  color: white;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: all;
  transition: 0.2s;
}
.phone-badge:hover {
  background: var(--accent-light);
}

/* Completed order styling */
.completed-order {
  background: var(--success-bg);
  border: 1px solid rgba(34, 197, 94, 0.15);
}
.completed-order .order-id { color: var(--success); }

/* ============================================
   REFRESH STATUS BUTTON
   ============================================ */
.refresh-status-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--info);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s ease;
  font-family: inherit;
}
.refresh-status-btn:hover {
  background: #2563eb;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.refresh-status-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* ============================================
   STATUS TABLE
   ============================================ */
.status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 6px;
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.status-table thead {
  background: var(--bg-input);
}

.status-table th {
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.status-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.status-table tbody tr:hover { background: var(--bg-input); }
.status-table tbody tr:last-child td { border-bottom: none; }

.status-table th:first-child,
.status-table td:first-child {
  width: 35px;
  text-align: center;
  color: var(--text-muted);
}

/* ============================================
   HISTORY ITEMS
   ============================================ */
.history-item {
  background: var(--info-bg);
  border: 1px solid rgba(59, 130, 246, 0.12);
}
.history-item .order-id { color: var(--info); }

.history-count {
  display: inline-block;
  min-width: 28px;
  padding: 2px 8px;
  background: var(--accent);
  color: white;
  border-radius: 4px;
  font-weight: 700;
  text-align: center;
  font-size: 0.82rem;
}

/* ============================================
   BULK SEARCH
   ============================================ */
.bulk-search-area {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.bulk-textarea {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
  font-family: 'Courier New', monospace;
  resize: vertical;
  transition: 0.2s;
  background: var(--bg-panel);
  color: var(--text-primary);
  line-height: 1.6;
}
.bulk-textarea:focus {
  outline: none;
  background: #fafbff;
  box-shadow: inset 0 0 0 2px var(--accent-bg);
}

.bulk-summary {
  display: flex;
  gap: 16px;
  padding: 12px 24px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.bulk-stat {
  font-weight: 600;
  font-size: 0.88rem;
}
.bulk-stat.found { color: var(--success); }
.bulk-stat.not-found { color: var(--danger); }
.bulk-stat.total { color: var(--text-secondary); }

.bulk-results-table .status-sent   { color: var(--success); font-weight: 600; }
.bulk-results-table .status-failed  { color: var(--danger); font-weight: 600; }
.bulk-results-table .status-pending { color: var(--warning); font-weight: 600; }
.bulk-results-table .status-unknown { color: var(--text-muted); font-weight: 600; }

.not-found-row { background: var(--danger-bg) !important; }
.not-found-row:hover { background: rgba(239, 68, 68, 0.12) !important; }

.bulk-fetch-btn {
  display: inline-block;
  padding: 2px 7px;
  margin-left: 6px;
  font-size: 0.72rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent-bg);
  cursor: pointer;
  transition: 0.2s;
}
.bulk-fetch-btn:hover { background: var(--accent); color: white; }
.bulk-fetch-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.bulk-clear-results-btn {
  margin-left: auto;
  padding: 6px 14px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: 0.2s;
}
.bulk-clear-results-btn:hover { background: #dc2626; }

/* ============================================
   FAILED NUMBERS
   ============================================ */
.failed-table tbody tr { background: var(--danger-bg); }
.failed-table tbody tr:hover { background: rgba(239, 68, 68, 0.1) !important; }

.failed-group {
  margin-bottom: 12px;
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-panel);
}

.failed-group-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--danger-bg);
  border-bottom: 1px solid rgba(239, 68, 68, 0.12);
  flex-wrap: wrap;
  cursor: pointer;
  transition: background 0.2s ease;
}
.failed-group-header:hover {
  background: rgba(239, 68, 68, 0.1);
}

.failed-group-id {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.failed-group-date {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.failed-group-count {
  color: var(--danger);
  font-weight: 700;
  font-size: 0.82rem;
}

.failed-toggle-icon {
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.failed-group-body.hidden { display: none; }

.failed-group .status-table { margin: 0; border-radius: 0; border: none; }
.failed-group .status-table thead th { background: rgba(239, 68, 68, 0.04); }

/* ============================================
   SIDEBAR OVERLAY (Mobile)
   ============================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 90;
  backdrop-filter: blur(2px);
}

/* ============================================
   HIDDEN UTILITY
   ============================================ */
.hidden { display: none !important; }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   SCROLLBAR
   ============================================ */
.orders-list::-webkit-scrollbar { width: 5px; }
.orders-list::-webkit-scrollbar-track { background: transparent; }
.orders-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
.orders-list::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

/* ============================================
   FILTER BAR (legacy class compat)
   ============================================ */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

/* Legacy button compat */
.export-btn, .copy-btn {
  padding: 8px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: 0.2s;
  white-space: nowrap;
  font-family: inherit;
}
.export-btn:hover, .copy-btn:hover {
  background: var(--accent-light);
}

.clear-btn {
  padding: 8px 14px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: 0.2s;
  font-family: inherit;
}
.clear-btn:hover { background: #dc2626; }

/* Legacy tab button (hidden, nav is now sidebar) */
.tab-btn { display: none; }
.tabs { display: none; }

/* Date filter select compat */
.date-filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--bg-panel);
  cursor: pointer;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: inherit;
}
.date-filter-select:focus { border-color: var(--accent); outline: none; }

/* Bulk date filter bar compat */
.bulk-date-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.bulk-search-btn {
  padding: 10px 24px;
  font-size: 0.92rem;
}

/* Search Mode Toggle */
.search-mode-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.mode-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-panel);
}

.mode-btn {
  padding: 6px 14px;
  border: none;
  background: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.mode-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}

.mode-btn:hover {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.mode-btn.active {
  background: var(--accent);
  color: white;
}

.mode-btn.active[data-mode="live"] {
  background: #14b8a6;
  color: white;
}

/* Reset btn compat */
.reset-btn {
  padding: 8px 16px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: 0.2s;
  font-family: inherit;
}
.reset-btn:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .stat-pills { display: none; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close {
    display: block;
  }
  .sidebar-overlay.active {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .hamburger {
    display: flex;
  }

  .topbar {
    padding: 0 16px;
  }

  .content {
    padding: 16px;
  }

  .stats-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stat-card { padding: 14px; }
  .stat-card-value { font-size: 1.4rem; }
  .stat-card-icon { width: 42px; height: 42px; font-size: 1.5rem; }

  .search-bar-inline {
    flex-direction: column;
  }

  .orders-list {
    padding: 12px 16px;
    max-height: 400px;
  }

  .panel-header { padding: 16px; }
  .toolbar { padding: 10px 16px; }

  .toolbar-search { min-width: 120px; }

  .page-title { font-size: 1rem; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .topbar-right .btn { display: none; }
}

/* ============================================
   CARRYOVER (Previous Orders) TAB
   ============================================ */
.carryover-date-group {
  margin-bottom: 12px;
}
.carryover-date-header {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 10px 16px;
  background: var(--bg-input);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

