/* ════════════════════════════════════════════
   RESTAURANT DASHBOARD — COMPLETE STYLESHEET
   Modern Dark Theme + RTL Arabic
   ════════════════════════════════════════════ */

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

:root {
  --bg-primary:    #0f1117;
  --bg-secondary:  #161b27;
  --bg-card:       #1e2435;
  --bg-card-hover: #252d42;
  --bg-input:      #252d42;

  --accent:        #6c63ff;
  --accent-light:  #8b85ff;
  --accent-glow:   rgba(108,99,255,0.25);

  --success:       #22c55e;
  --success-bg:    rgba(34,197,94,0.12);
  --warning:       #f59e0b;
  --warning-bg:    rgba(245,158,11,0.12);
  --danger:        #ef4444;
  --danger-bg:     rgba(239,68,68,0.12);
  --info:          #3b82f6;
  --info-bg:       rgba(59,130,246,0.12);

  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;

  --border:        rgba(255,255,255,0.06);
  --border-hover:  rgba(255,255,255,0.12);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.5);

  --sidebar-w:  260px;
  --topbar-h:   68px;
  --transition: 0.2s ease;
}

html { font-size: 16px; }

body {
  font-family: 'Tajawal', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.login-bg { position: fixed; inset: 0; pointer-events: none; }
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
}
.orb-1 { width: 400px; height: 400px; background: var(--accent); top: -100px; right: -100px; }
.orb-2 { width: 300px; height: 300px; background: var(--success); bottom: -80px; left: -80px; }
.orb-3 { width: 200px; height: 200px; background: var(--warning); top: 50%; left: 40%; }

.login-container { position: relative; z-index: 10; width: 100%; max-width: 420px; padding: 1rem; }

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
}

.login-logo { text-align: center; margin-bottom: 2rem; }
.logo-icon { font-size: 3rem; line-height: 1; margin-bottom: .5rem; }
.login-logo h1 { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); }
.login-logo p { color: var(--text-muted); font-size: .9rem; margin-top: .25rem; }

.login-form { display: flex; flex-direction: column; gap: 1.25rem; }

.form-group label {
  display: block;
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 600;
  margin-bottom: .5rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  right: .9rem;
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
}

.input-wrapper input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: .75rem 2.5rem .75rem .75rem;
  color: var(--text-primary);
  font-family: 'Tajawal', sans-serif;
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  direction: ltr;
  text-align: right;
}

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

.toggle-password {
  position: absolute;
  left: .75rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
}

.error-msg {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,.25);
  color: #fca5a5;
  padding: .75rem 1rem;
  border-radius: var(--radius-md);
  font-size: .875rem;
}

.btn-login {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: .875rem;
  font-family: 'Tajawal', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: .5rem;
}
.btn-login:hover { background: var(--accent-light); transform: translateY(-1px); }
.btn-login:disabled { opacity: .7; cursor: not-allowed; transform: none; }

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

/* ════════════════════════════════
   DASHBOARD LAYOUT
   ════════════════════════════════ */
.dashboard-page { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 200;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo { display: flex; align-items: center; gap: .75rem; }
.logo-star { font-size: 1.75rem; }
.logo-text h2 { font-size: 1rem; font-weight: 800; line-height: 1.2; }
.logo-text p { font-size: .75rem; color: var(--text-muted); margin-top: .15rem; }

.sidebar-close { display: none; background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; }

.sidebar-nav {
  flex: 1;
  padding: 1rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .9rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent-light);
  border: 1px solid rgba(108,99,255,.2);
}

.nav-icon { font-size: 1.1rem; width: 1.5rem; text-align: center; flex-shrink: 0; }
.nav-label { flex: 1; }

.nav-badge {
  background: var(--danger);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 20px;
  min-width: 1.3rem;
  text-align: center;
}
.error-badge { background: #f97316; }

.sidebar-footer {
  padding: 1rem .75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.user-info-sidebar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .75rem;
  background: var(--bg-card);
  border-radius: var(--radius-md);
}

.user-avatar {
  width: 2.25rem;
  height: 2.25rem;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  color: #fff;
  flex-shrink: 0;
}

.user-name-sm { font-size: .85rem; font-weight: 600; }
.user-role-sm { font-size: .75rem; color: var(--text-muted); }

.btn-logout {
  display: flex;
  align-items: center;
  gap: .5rem;
  justify-content: center;
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,.2);
  color: #fca5a5;
  border-radius: var(--radius-md);
  padding: .65rem;
  font-family: 'Tajawal', sans-serif;
  font-size: .875rem;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-logout:hover { background: rgba(239,68,68,.2); }

/* ── Overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 190;
  backdrop-filter: blur(2px);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.topbar-right { display: flex; align-items: center; gap: .75rem; }
.menu-btn { display: none; background: none; border: none; font-size: 1.4rem; color: var(--text-primary); cursor: pointer; padding: .25rem; }

.topbar-title h3 { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.page-date { font-size: .75rem; color: var(--text-muted); }

.topbar-left { display: flex; align-items: center; gap: .75rem; }

.realtime-indicator {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--success);
  background: var(--success-bg);
  padding: .3rem .7rem;
  border-radius: 20px;
}

.dot {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}
.dot.green { color: var(--success); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

.btn-refresh {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: .4rem .7rem;
  cursor: pointer;
  font-size: .9rem;
  transition: all var(--transition);
}
.btn-refresh:hover { border-color: var(--accent); color: var(--accent); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  padding: .35rem .75rem;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}
.topbar-user:hover { background: var(--bg-card); }

.user-avatar-sm {
  width: 1.9rem;
  height: 1.9rem;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  color: #fff;
}

/* ════════════════════════════════
   TAB CONTENT
   ════════════════════════════════ */
.tab-content {
  display: none;
  padding: 1.75rem 1.5rem;
  flex: 1;
}
.tab-content.active { display: block; }

.section-header { margin-bottom: 1.75rem; }
.section-header h2 { font-size: 1.4rem; font-weight: 800; }
.section-header p { color: var(--text-muted); font-size: .9rem; margin-top: .25rem; }

.section-header-flex {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-header-flex h2 { font-size: 1.4rem; font-weight: 800; }
.section-header-flex p { color: var(--text-muted); font-size: .9rem; }

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(255,255,255,.02));
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon { font-size: 2rem; line-height: 1; flex-shrink: 0; }
.stat-info { flex: 1; min-width: 0; }
.stat-value { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1.2; color: var(--text-primary); }
.stat-label { display: block; font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }
.stat-trend { font-size: .75rem; margin-top: .25rem; }

.stat-card.revenue  { border-top: 2px solid var(--warning); }
.stat-card.orders   { border-top: 2px solid var(--info); }
.stat-card.preparing{ border-top: 2px solid var(--warning); }
.stat-card.pending  { border-top: 2px solid var(--danger); }
.stat-card.success  { border-top: 2px solid var(--success); }
.stat-card.danger   { border-top: 2px solid var(--danger); }

/* ── Charts Grid ── */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.chart-card.wide { grid-column: span 2; }

.chart-header { margin-bottom: 1rem; }
.chart-header h3 { font-size: 1rem; font-weight: 700; }

.chart-container { position: relative; }
.chart-container canvas { max-height: 260px; }
.chart-sm canvas { max-height: 200px; }

/* ── Card ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 1rem; font-weight: 700; }

/* ── Top Items List ── */
.top-items-list { padding: .5rem 0; }
.top-item {
  display: flex;
  align-items: center;
  padding: .8rem 1.25rem;
  gap: 1rem;
  transition: background var(--transition);
}
.top-item:hover { background: var(--bg-card-hover); }
.top-item:not(:last-child) { border-bottom: 1px solid var(--border); }

.item-rank {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .85rem;
  color: var(--accent-light);
  flex-shrink: 0;
}
.item-rank.gold { background: rgba(245,158,11,.15); color: var(--warning); }
.item-rank.silver { background: rgba(148,163,184,.15); color: #94a3b8; }
.item-rank.bronze { background: rgba(180,83,9,.15); color: #b45309; }

.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 600; font-size: .9rem; }
.item-units { font-size: .8rem; color: var(--text-muted); margin-top: .1rem; }
.item-revenue { font-weight: 700; color: var(--warning); font-size: .9rem; }

/* ── Period Tabs ── */
.period-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  padding: .3rem;
  border-radius: var(--radius-md);
  width: fit-content;
}
.period-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: .5rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  transition: all var(--transition);
}
.period-btn.active { background: var(--accent); color: #fff; }
.period-btn:hover:not(.active) { background: var(--bg-input); color: var(--text-primary); }

/* ── Performance Grid ── */
.performance-card { padding: 1.25rem; }
.performance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.perf-item { text-align: center; background: var(--bg-input); padding: 1rem; border-radius: var(--radius-md); }
.perf-value { display: block; font-size: 1.3rem; font-weight: 800; color: var(--accent-light); }
.perf-label { display: block; font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Orders / Filters ── */
.filters-bar {
  display: flex;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-select, .filter-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: .6rem .9rem;
  font-family: 'Tajawal', sans-serif;
  font-size: .9rem;
  transition: border-color var(--transition);
}
.filter-select:focus, .filter-input:focus {
  outline: none;
  border-color: var(--accent);
}
.filter-select { min-width: 160px; cursor: pointer; }
.filter-input { flex: 1; min-width: 200px; }

.orders-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.realtime-badge {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--success);
  background: var(--success-bg);
  padding: .3rem .7rem;
  border-radius: 20px;
}

/* ── Tables ── */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  min-width: 600px;
}

.data-table thead tr {
  background: var(--bg-input);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: .85rem 1rem;
  text-align: right;
  font-weight: 700;
  color: var(--text-muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}

.data-table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-card-hover); }
.loading-row { text-align: center; color: var(--text-muted); padding: 2rem !important; }

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .7rem;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-pending     { background: var(--warning-bg);  color: var(--warning);  border: 1px solid rgba(245,158,11,.25); }
.status-confirmed   { background: var(--info-bg);     color: var(--info);     border: 1px solid rgba(59,130,246,.25); }
.status-preparing   { background: rgba(139,85,255,.12); color: #a78bfa; border: 1px solid rgba(139,85,255,.25); }
.status-ready       { background: rgba(20,184,166,.12);  color: #2dd4bf; border: 1px solid rgba(20,184,166,.25); }
.status-delivering  { background: var(--info-bg);     color: var(--info);     border: 1px solid rgba(59,130,246,.25); }
.status-delivered   { background: var(--success-bg);  color: var(--success);  border: 1px solid rgba(34,197,94,.25); }
.status-cancelled   { background: var(--danger-bg);   color: var(--danger);   border: 1px solid rgba(239,68,68,.25); }

/* Status Select inline */
.status-select-inline {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: .3rem .5rem;
  font-family: 'Tajawal', sans-serif;
  font-size: .8rem;
  cursor: pointer;
  min-width: 130px;
}

/* Customer Tabs */
.customer-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.cust-tab {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: .5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  transition: all var(--transition);
}
.cust-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cust-tab:hover:not(.active) { border-color: var(--accent); color: var(--accent); }

/* Category Filter */
.category-filter {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.cat-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: .45rem .9rem;
  border-radius: 20px;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  transition: all var(--transition);
}
.cat-btn.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent-light); }

/* ── Buttons ── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: .65rem 1.25rem;
  font-family: 'Tajawal', sans-serif;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-light); transform: translateY(-1px); }

.btn-primary-sm {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: .5rem .9rem;
  font-family: 'Tajawal', sans-serif;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.btn-primary-sm:hover { background: var(--accent-light); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: .65rem 1.25rem;
  font-family: 'Tajawal', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-secondary:hover { border-color: var(--border-hover); color: var(--text-primary); }

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: .35rem .6rem;
  cursor: pointer;
  font-size: .85rem;
  transition: all var(--transition);
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ── Settings ── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.settings-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1.25rem; }
.settings-card.full-width { grid-column: span 2; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .875rem; color: var(--text-secondary); font-weight: 600; margin-bottom: .5rem; }

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: .7rem .9rem;
  color: var(--text-primary);
  font-family: 'Tajawal', sans-serif;
  font-size: .9rem;
  transition: border-color var(--transition);
  resize: vertical;
}
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }

.status-toggle-group {
  display: flex;
  gap: .5rem;
  background: var(--bg-input);
  padding: .3rem;
  border-radius: var(--radius-md);
}
.status-opt {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  transition: all var(--transition);
  text-align: center;
}
.status-opt.active { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }

.time-range { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.phones-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.phone-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  padding: .6rem .9rem;
  border-radius: var(--radius-md);
  font-size: .875rem;
}
.phone-item span { font-family: 'Courier New', monospace; direction: ltr; }

.add-phone-row { display: flex; gap: .5rem; }
.add-phone-row .form-input { flex: 1; }

.settings-actions { display: flex; justify-content: flex-end; }

/* Toggle Switch */
.toggle-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: 0 !important;
}
.toggle-label input { display: none; }
.toggle-switch {
  width: 2.5rem;
  height: 1.4rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  width: 1rem;
  height: 1rem;
  background: var(--text-muted);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  right: .15rem;
  transform: translateY(-50%);
  transition: all var(--transition);
}
.toggle-label input:checked + .toggle-switch { background: var(--accent-glow); border-color: var(--accent); }
.toggle-label input:checked + .toggle-switch::after { background: var(--accent); right: auto; left: .15rem; }

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: .25rem;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
}

/* Order Detail Modal */
.order-detail-section { margin-bottom: 1.25rem; }
.order-detail-section h4 { font-size: .85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .75rem; font-weight: 700; }
.detail-row { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); }
.detail-value { font-weight: 600; }
.items-list-modal { display: flex; flex-direction: column; gap: .5rem; }
.modal-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-input);
  padding: .6rem .9rem;
  border-radius: var(--radius-md);
  font-size: .875rem;
}
.modal-item-name { font-weight: 600; }
.modal-item-qty { color: var(--text-muted); }
.modal-item-price { color: var(--warning); font-weight: 700; }

/* Role Description */
.role-desc {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: .75rem;
  font-size: .85rem;
  color: var(--text-secondary);
  margin-top: .5rem;
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: .85rem 1.25rem;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: .75rem;
  box-shadow: var(--shadow-md);
  animation: toastIn .3s ease;
}
.toast.success { border-color: rgba(34,197,94,.3); background: rgba(34,197,94,.08); }
.toast.error   { border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.08); }
.toast.info    { border-color: rgba(59,130,246,.3); background: rgba(59,130,246,.08); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Skeleton ── */
.loading-skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card-hover) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
  height: 3rem;
  margin: .5rem 1.25rem;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Utility ── */
.hidden { display: none !important; }
.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════
   RESPONSIVE
   ════════════════════════════════ */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: span 1; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(100%);
    width: 280px;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .sidebar-overlay.show { display: block; }

  .main-content { margin-right: 0; }
  .menu-btn { display: flex; }

  .settings-grid { grid-template-columns: 1fr; }
  .settings-card.full-width { grid-column: span 1; }
  .time-range { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .tab-content { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 1rem; }
  .topbar-title h3 { font-size: .95rem; }
  .page-date { display: none; }
  .section-header-flex { flex-direction: column; }
  .filters-bar { flex-direction: column; }
  .filter-input { min-width: unset; }
  .performance-grid { grid-template-columns: 1fr 1fr; }
  .period-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .modal { max-height: 95vh; }
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.25rem; }
}
