@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800&display=swap');

/* ─────────────────────────────────────────
   TOKENS — Zenith dark system
───────────────────────────────────────── */
:root {
  --bg: #09090B;
  --surface: #111113;
  --surface2: #18181B;
  --surface3: #1C1C21;
  --border: rgba(255,255,255,0.07);
  --border-bright: rgba(255,255,255,0.12);

  --primary: #7C3AED;
  --primary-dim: rgba(124,58,237,0.12);
  --primary-glow: rgba(124,58,237,0.22);
  --accent: #F59E0B;
  --accent-dim: rgba(245,158,11,0.10);

  --green: #10B981;
  --green-bright: #34D399;
  --red: #EF4444;
  --yellow: #F59E0B;
  --blue: #60A5FA;
  --orange: #F97316;
  --purple: #A78BFA;
  --pink: #F472B6;

  --text: #FAFAFA;
  --text2: #71717A;
  --text3: #52525B;

  --sidebar-w: 220px;
  --header-h: 58px;
  --radius: 12px;
  --radius-sm: 8px;
}

/* ── Light theme ── (overrides the dark tokens; everything uses var(--*)) */
[data-theme="light"] {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface2: #F1F2F4;
  --surface3: #E8EAED;
  --border: rgba(0,0,0,0.09);
  --border-bright: rgba(0,0,0,0.16);

  --primary: #7C3AED;
  --primary-dim: rgba(124,58,237,0.10);
  --primary-glow: rgba(124,58,237,0.16);
  --accent: #D97706;
  --accent-dim: rgba(217,119,6,0.10);

  --green: #059669;
  --green-bright: #10B981;
  --red: #DC2626;
  --yellow: #D97706;
  --blue: #2563EB;
  --orange: #EA580C;
  --purple: #7C3AED;
  --pink: #DB2777;

  --text: #18181B;
  --text2: #52525B;
  --text3: #8A8A93;
}

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

body {
  font-family: 'Inter', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────
   APP LAYOUT — SIDEBAR + MAIN
───────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─────────────────────────────────────────
   SIDEBAR
───────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

/* top brand stripe — purple → pink → orange */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #7C3AED, #EC4899, #F97316);
  pointer-events: none;
  z-index: 2;
}

.sidebar-brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.sidebar-brand img { height: 36px; object-fit: contain; display: block; filter: brightness(1.08); }
.sidebar-brand::before { display: none; }
.sidebar-brand::after {
  content: 'OPS DASHBOARD';
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text3);
  display: block;
  margin-top: 5px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

/* NAV SECTION LABELS */
.nav-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 10px 14px 5px;
}

/* Tab items — keep .tab class for JS, style via sidebar-nav context */
.sidebar-nav .tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  border: none;
  border-bottom: none;
  background: transparent;
  width: 100%;
  text-align: left;
  margin-bottom: 1px;
  position: relative;
  user-select: none;
}
.sidebar-nav .tab:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
.sidebar-nav .tab.active {
  background: rgba(124,58,237,0.15);
  color: #C4B5FD;
  border-bottom: none;
  font-weight: 600;
}
.sidebar-nav .tab.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 2.5px;
  background: linear-gradient(180deg, #A78BFA, #EC4899);
  border-radius: 0 3px 3px 0;
}
.nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar-nav .tab:hover .nav-icon { opacity: 0.9; }
.sidebar-nav .tab.active .nav-icon { opacity: 1; }

/* sidebar footer — user badge + actions */
.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.sidebar-user:hover { background: rgba(255,255,255,0.04); }
.sidebar-avatar {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #7C3AED, #EC4899);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.sidebar-username { font-size: 12px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); }
.sidebar-user-role { font-size: 10px; color: var(--text3); }

/* ─────────────────────────────────────────
   MAIN AREA
───────────────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─────────────────────────────────────────
   HEADER (topbar)
───────────────────────────────────────── */
.header {
  height: var(--header-h);
  background: rgba(9,9,11,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-page-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

/* sync actions group */
.sync-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.last-sync { font-size: 11px; color: var(--text2); white-space: nowrap; }

.auto-sync-badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(16,185,129,0.15);
  color: var(--green);
  font-weight: 600;
  border: 1px solid rgba(16,185,129,0.25);
  white-space: nowrap;
}
.auto-sync-badge.off {
  background: rgba(91,115,148,0.15);
  color: var(--text2);
  border-color: var(--border);
}

.sync-btn {
  background: var(--primary-dim);
  color: var(--purple);
  border: 1px solid rgba(124,58,237,0.25);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  display: flex; align-items: center; gap: 5px;
}
.sync-btn:hover {
  background: rgba(124,58,237,0.2);
  border-color: rgba(124,58,237,0.45);
  box-shadow: 0 0 14px rgba(124,58,237,0.2);
}
.sync-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.sync-btn:active { transform: scale(0.97); }

.sync-btn.quick { background: rgba(124,58,237,0.1); color: var(--purple); border-color: rgba(124,58,237,0.2); }

/* Specific button colors */
#fix-status-btn  { background: var(--primary-dim); color: var(--purple); }
#fincart-poll-btn  { background: rgba(245,158,11,0.10); color: var(--accent); border-color: rgba(245,158,11,0.25); }
#fincart-poll-btn:hover { box-shadow: 0 0 12px rgba(245,158,11,0.15); }
#fincart-complete-btn { background: rgba(16,185,129,0.10); color: var(--green); border-color: rgba(16,185,129,0.25); }
#fincart-complete-btn:hover { box-shadow: 0 0 12px rgba(16,185,129,0.15); }
#wa-sync-btn { background: rgba(37,211,102,0.10); color: #25d366; border-color: rgba(37,211,102,0.25); }
#force-sync-btn { background: rgba(239,68,68,0.10); color: var(--red); border-color: rgba(239,68,68,0.25); }

/* Theme toggle */
.theme-toggle {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--surface3); border-color: var(--border-bright); }

/* User menu in header */
.user-badge {
  background: var(--primary-dim);
  color: var(--purple);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(124,58,237,0.25);
  position: relative;
  transition: background 0.15s;
}
.user-badge:hover { background: rgba(124,58,237,0.2); }
.user-menu {
  position: absolute;
  top: calc(var(--header-h) + 2px);
  right: 16px;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  min-width: 170px;
  z-index: 200;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(59,130,246,0.08);
  overflow: hidden;
}
.um-item {
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.12s;
}
.um-item:hover { background: var(--surface2); color: var(--primary); }

/* ─────────────────────────────────────────
   SYNC PROGRESS BAR
───────────────────────────────────────── */
.sync-progress {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: none;
}
.sync-progress.show { display: block; }
.sync-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.sync-stat { text-align: center; }
.sync-stat .lbl { display: block; font-size: 11px; color: var(--text2); margin-bottom: 2px; letter-spacing: 0.04em; }
.sync-stat span:last-child { font-size: 18px; font-weight: 700; color: var(--primary); }

/* ─────────────────────────────────────────
   CONTAINER + TABS
───────────────────────────────────────── */
.container { width: 100%; padding: 20px; }

/* Hide old horizontal .tabs — we use sidebar now */
.tabs { display: none; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─────────────────────────────────────────
   DASHBOARD CONTROLS
───────────────────────────────────────── */
.dash-controls {
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.date-presets { display: flex; gap: 4px; }
.preset {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text2);
  padding: 6px 13px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s;
}
.preset:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.preset.active { background: rgba(124,58,237,0.18); border-color: rgba(124,58,237,0.35); color: var(--purple); font-weight: 600; }
.custom-dates { display: flex; gap: 8px; align-items: center; }

/* ─────────────────────────────────────────
   WIDGET SIDEBAR
───────────────────────────────────────── */
.widget-toggle-btn {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  right: 14px;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.widget-toggle-btn:hover { background: var(--surface2); color: var(--text); }
.widget-sidebar {
  position: fixed;
  top: var(--header-h);
  right: -280px;
  width: 260px;
  height: calc(100vh - var(--header-h));
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 45;
  padding: 16px;
  overflow-y: auto;
  transition: right 0.28s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -8px 0 24px rgba(0,0,0,0.2);
}
.widget-sidebar.open { right: 0; }
.widget-sidebar h4 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.ws-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s;
  margin-bottom: 2px;
}
.ws-item:hover { background: var(--surface2); }
.ws-item input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; }
.ws-item label { cursor: pointer; flex: 1; color: var(--text); }
.widget-section { margin-bottom: 4px; }
.widget-section.hidden { display: none; }
.wdl-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text3);
  width: 24px; height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: auto;
  transition: all 0.15s;
}
.wdl-btn:hover { background: var(--primary-dim); color: var(--primary); border-color: var(--primary); }

/* ─────────────────────────────────────────
   STAT CARDS
───────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 0;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
  cursor: default;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  border-color: var(--border-bright);
}

/* Colored card tints based on value color */
.stat-card:has(.value.green) {
  background: linear-gradient(135deg, rgba(16,185,129,0.1) 0%, rgba(9,9,11,0) 60%);
  border-color: rgba(52,211,153,0.2);
}
.stat-card:has(.value.blue) {
  background: linear-gradient(135deg, rgba(96,165,250,0.08) 0%, rgba(9,9,11,0) 60%);
  border-color: rgba(96,165,250,0.2);
}
.stat-card:has(.value.orange) {
  background: linear-gradient(135deg, rgba(249,115,22,0.09) 0%, rgba(9,9,11,0) 60%);
  border-color: rgba(249,115,22,0.2);
}
.stat-card:has(.value.primary) {
  background: linear-gradient(135deg, rgba(167,139,250,0.09) 0%, rgba(9,9,11,0) 60%);
  border-color: rgba(167,139,250,0.2);
}
.stat-card:has(.value.red) {
  background: linear-gradient(135deg, rgba(239,68,68,0.09) 0%, rgba(9,9,11,0) 60%);
  border-color: rgba(239,68,68,0.2);
}

/* ── Sparklines via SVG data-URI ::after — fires when dashboard.js renders value classes ── */
.stat-card { padding-bottom: 46px; }
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 44px;
  pointer-events: none;
  background-size: 100% 44px;
  background-repeat: no-repeat;
  background-position: bottom;
  border-radius: 0 0 var(--radius) var(--radius);
}
.stat-card:has(.value.green)::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 44' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%2310B981' stop-opacity='.28'/%3E%3Cstop offset='1' stop-color='%2310B981' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpolygon points='0,36 28,30 56,24 84,16 112,9 140,5 168,4 200,2 200,44 0,44' fill='url(%23g)'/%3E%3Cpolyline points='0,36 28,30 56,24 84,16 112,9 140,5 168,4 200,2' fill='none' stroke='%2310B981' stroke-width='1.5' stroke-opacity='.65'/%3E%3C/svg%3E");
}
.stat-card:has(.value.blue)::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 44' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%2360A5FA' stop-opacity='.22'/%3E%3Cstop offset='1' stop-color='%2360A5FA' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpolygon points='0,38 28,34 56,28 84,22 112,14 140,10 168,7 200,6 200,44 0,44' fill='url(%23g)'/%3E%3Cpolyline points='0,38 28,34 56,28 84,22 112,14 140,10 168,7 200,6' fill='none' stroke='%2360A5FA' stroke-width='1.5' stroke-opacity='.6'/%3E%3C/svg%3E");
}
.stat-card:has(.value.primary)::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 44' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23A78BFA' stop-opacity='.22'/%3E%3Cstop offset='1' stop-color='%23A78BFA' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpolygon points='0,24 25,28 50,20 75,26 100,18 125,23 150,16 175,20 200,17 200,44 0,44' fill='url(%23g)'/%3E%3Cpolyline points='0,24 25,28 50,20 75,26 100,18 125,23 150,16 175,20 200,17' fill='none' stroke='%23A78BFA' stroke-width='1.5' stroke-opacity='.6'/%3E%3C/svg%3E");
}
.stat-card:has(.value.orange)::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 44' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23F97316' stop-opacity='.22'/%3E%3Cstop offset='1' stop-color='%23F97316' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpolygon points='0,32 28,26 56,20 84,14 112,8 140,6 168,5 200,4 200,44 0,44' fill='url(%23g)'/%3E%3Cpolyline points='0,32 28,26 56,20 84,14 112,8 140,6 168,5 200,4' fill='none' stroke='%23F97316' stroke-width='1.5' stroke-opacity='.6'/%3E%3C/svg%3E");
}
.stat-card:has(.value.red)::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 44' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23EF4444' stop-opacity='.2'/%3E%3Cstop offset='1' stop-color='%23EF4444' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpolygon points='0,20 28,24 56,18 84,26 112,20 140,24 168,22 200,18 200,44 0,44' fill='url(%23g)'/%3E%3Cpolyline points='0,20 28,24 56,18 84,26 112,20 140,24 168,22 200,18' fill='none' stroke='%23EF4444' stroke-width='1.5' stroke-opacity='.55'/%3E%3C/svg%3E");
}

.stat-card .label {
  font-size: 10px;
  color: var(--text2);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
}
.stat-card .value {
  font-size: 34px;
  font-weight: 900;
  margin-bottom: 10px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-card .value.green  { color: var(--green-bright); }
.stat-card .value.blue   { color: var(--blue); }
.stat-card .value.orange { color: var(--orange); }
.stat-card .value.primary{ color: var(--purple); }
.stat-card .value.red    { color: var(--red); }
.stat-card .change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}
.stat-card .change.up    { color: #10B981; background: rgba(16,185,129,0.12); }
.stat-card .change.down  { color: var(--red); background: rgba(239,68,68,0.12); }
.stat-card .change.flat  { color: var(--text2); background: rgba(255,255,255,0.05); }
.stat-card .change.inv-up   { color: var(--red); background: rgba(239,68,68,0.12); }
.stat-card .change.inv-down { color: var(--green); background: rgba(16,185,129,0.12); }
.stat-card .sub-change { font-size: 11px; color: var(--text2); margin-top: 6px; }
.stat-card .sub-change span { font-weight: 600; }

/* Orders card carries the delivery corner badge — the decorative sparkline
   wave underneath collided with it visually, so it's off for this card only. */
.stat-card:has(.stat-corner-badge)::after { display: none; }

/* Free vs Paid delivery corner badge (Orders card) */
.stat-corner-badge {
  position: absolute; top: 14px; right: 14px;
  display: flex; flex-direction: column; gap: 3px;
  max-width: 68%; text-align: right;
}
.stat-corner-row {
  font-size: 14px; line-height: 1.4; color: var(--text2);
  padding: 0;
  display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap;
}
.stat-corner-row strong { color: var(--text); font-weight: 700; }
.stat-corner-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.stat-corner-sub { display: block; width: 100%; color: var(--text2); font-size: 13px; font-weight: 600; }
@media (max-width: 900px) {
  /* Was hidden here before — now it just drops out of the absolute corner
     and flows as a normal block under the rest of the card instead, so it
     stays visible (and readable) on tablets/phones instead of disappearing. */
  .stat-corner-badge {
    position: static; max-width: 100%; text-align: left;
    margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
  }
  .stat-corner-row { justify-content: flex-start; }
  .stat-corner-sub { text-align: left; }
  .stat-card:has(.stat-corner-badge) { padding-bottom: 16px; }
}

/* secondary stat row */
.exec-row {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 12px;
  margin-bottom: 20px;
}

/* ─────────────────────────────────────────
   DASH PANELS + GRID
───────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px; }
.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.18s;
}
.dash-panel:hover { border-color: rgba(124,58,237,0.25); }
.dash-panel h3 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #9090B8;
}
.panel-sub { font-size: 11.5px; color: var(--text2); font-weight: 400; }

/* ─────────────────────────────────────────
   REAL-TIME PANEL
───────────────────────────────────────── */
.realtime-panel {
  border-color: rgba(16,185,129,0.2) !important;
  background: linear-gradient(135deg, var(--surface) 0%, rgba(16,185,129,0.03) 100%);
}
.rt-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.rt-header h3 { margin-bottom: 0; gap: 8px; }
.rt-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  margin-right: 6px;
  animation: rtPulse 2s ease-in-out infinite;
}
@keyframes rtPulse {
  0%,100% { opacity:1; box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50%      { opacity:.7; box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}
.rt-live {
  background: rgba(16,185,129,0.15);
  color: var(--green);
  border: 1px solid rgba(16,185,129,0.3);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.08em;
}
.rt-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.rt-section { min-width: 0; }
.rt-label { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 8px; }
.rt-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; font-size: 12.5px; }
.rt-row-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 8px; color: var(--text); }
.rt-row-val { font-weight: 700; flex-shrink: 0; color: var(--primary); }
#rt-count { font-size: 22px; font-weight: 800; color: var(--green); margin-left: 4px; }

/* ─────────────────────────────────────────
   HOURLY BAR CHART
───────────────────────────────────────── */
.hourly-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 140px;
  padding: 8px 0 20px;
  position: relative;
}
.hourly-bar {
  flex: 1;
  height: 100%;
  min-width: 6px;
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
}
.hourly-bar .bar-fill {
  width: 100%;
  background: linear-gradient(to top, var(--primary), rgba(59,130,246,0.6));
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: background 0.2s;
}
.hourly-bar:hover .bar-fill { background: linear-gradient(to top, #60A5FA, rgba(96,165,250,0.8)); }
.hourly-bar .bar-tip {
  position: absolute;
  top: -4px; left: 50%;
  transform: translate(-50%,-100%);
  background: var(--surface3);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  white-space: nowrap;
  display: none;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  color: var(--text);
}
.hourly-bar:hover .bar-tip { display: block; }
.hourly-labels { display: flex; justify-content: space-between; padding-top: 6px; }
.hourly-labels span { font-size: 9.5px; color: var(--text3); font-weight: 500; }

/* ─────────────────────────────────────────
   PAYMENT SPLIT
───────────────────────────────────────── */
.pay-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pay-row:last-child { border-bottom: none; }
.pay-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.pay-icon.cod  { background: rgba(249,115,22,0.12); color: var(--orange); }
.pay-icon.card { background: var(--primary-dim); color: var(--primary); }
.pay-info { flex: 1; }
.pay-info .pay-label { font-size: 13px; font-weight: 600; }
.pay-info .pay-sub   { font-size: 11.5px; color: var(--text2); }
.pay-amount { font-size: 15px; font-weight: 700; text-align: right; }
.pay-bar { height: 5px; background: var(--surface2); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.pay-bar .pay-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }

/* ─────────────────────────────────────────
   STATUS DISTRIBUTION
───────────────────────────────────────── */
.status-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.status-row:last-child { border-bottom: none; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.status-info { flex: 1; min-width: 0; }
.status-name { font-size: 13px; font-weight: 600; text-transform: capitalize; }
.status-bar { height: 4px; background: var(--surface2); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.status-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.status-meta { text-align: right; flex-shrink: 0; }
.status-count { font-size: 14px; font-weight: 700; }
.status-pct   { font-size: 11px; color: var(--text2); }

/* ─────────────────────────────────────────
   TOP CITIES
───────────────────────────────────────── */
.city-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.city-row:last-child { border-bottom: none; }
.city-rank { width: 20px; font-size: 11px; font-weight: 700; color: var(--text3); text-align: center; flex-shrink: 0; }
.city-name { flex: 1; font-size: 13px; font-weight: 600; }
.city-stat { text-align: right; flex-shrink: 0; }
.city-orders { font-size: 14px; font-weight: 700; }
.city-rev    { font-size: 11px; color: var(--text2); }

/* ─────────────────────────────────────────
   HEALTH CARDS
───────────────────────────────────────── */
.health-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s;
}
.health-card:hover { transform: translateY(-2px); border-color: var(--border-bright); }
.health-card .hc-val   { font-size: 22px; font-weight: 800; margin: 4px 0; }
.health-card .hc-label { font-size: 10px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.07em; }
.health-card .hc-sub   { font-size: 11.5px; color: var(--text2); margin-top: 4px; }

/* ─────────────────────────────────────────
   TOP CUSTOMERS / PRODUCTS
───────────────────────────────────────── */
.cust-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cust-row:last-child { border-bottom: none; }
.cust-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.cust-info { flex: 1; min-width: 0; }
.cust-name   { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-detail { font-size: 11px; color: var(--text2); }
.cust-spend { text-align: right; flex-shrink: 0; }
.cust-spend-val { font-size: 14px; font-weight: 700; }
.cust-spend-sub { font-size: 11px; color: var(--text2); }

/* Segments */
.seg-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.seg-row:last-child { border-bottom: none; }
.seg-badge { padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; flex-shrink: 0; min-width: 80px; text-align: center; }
.seg-info { flex: 1; font-size: 13px; }
.seg-count { font-weight: 700; }
.seg-meta  { font-size: 11px; color: var(--text2); }
.seg-amount { text-align: right; flex-shrink: 0; font-size: 14px; font-weight: 700; }

/* Segment badge colors */
.seg-badge.green   { background: rgba(16,185,129,0.12); color: var(--green); }
.seg-badge.blue    { background: var(--primary-dim);     color: var(--blue); }
.seg-badge.orange  { background: rgba(249,115,22,0.12);  color: var(--orange); }
.seg-badge.yellow  { background: rgba(245,158,11,0.12);  color: var(--yellow); }
.seg-badge.red     { background: rgba(239,68,68,0.12);   color: var(--red); }
.seg-badge.primary { background: var(--primary-dim);     color: var(--primary); }

/* Products */
.prod-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.prod-row:last-child { border-bottom: none; }
.prod-rank {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--text2); flex-shrink: 0;
}
.prod-row:nth-child(1) .prod-rank { background: rgba(245,158,11,0.18); color: #D97706; }
.prod-row:nth-child(2) .prod-rank { background: rgba(148,163,184,0.15); color: #94A3B8; }
.prod-row:nth-child(3) .prod-rank { background: rgba(180,83,9,0.18);   color: #B45309; }
.prod-info { flex: 1; min-width: 0; }
.prod-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-sku  { font-size: 11px; color: var(--text2); }
.prod-stat { text-align: right; flex-shrink: 0; }
.prod-stat .prod-val { font-size: 14px; font-weight: 700; }
.prod-stat .prod-sub { font-size: 11px; color: var(--text2); }
.prod-bar-wrap { width: 60px; flex-shrink: 0; }
.prod-bar-bg { height: 5px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.prod-bar-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.5s ease; }

/* ─────────────────────────────────────────
   FUNNEL + CONVERSION
───────────────────────────────────────── */
.funnel-step { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.funnel-bar-wrap { flex: 1; height: 28px; background: var(--surface2); border-radius: 6px; overflow: hidden; position: relative; }
.funnel-bar-fill { height: 100%; border-radius: 6px; transition: width 0.6s ease; display: flex; align-items: center; padding-left: 10px; }
.funnel-bar-fill span { font-size: 11px; font-weight: 600; color: #fff; white-space: nowrap; }
.funnel-label { width: 80px; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.funnel-val { width: 50px; font-size: 13px; font-weight: 700; text-align: right; flex-shrink: 0; }

.conv-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.conv-row:last-child { border-bottom: none; }
.conv-method { flex: 1; font-size: 13px; font-weight: 600; }
.conv-rate   { font-size: 14px; font-weight: 700; flex-shrink: 0; width: 55px; text-align: right; }
.conv-bar    { width: 80px; height: 5px; background: var(--surface2); border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.conv-bar-fill { height: 100%; border-radius: 3px; background: var(--green); }
.conv-detail { font-size: 11px; color: var(--text2); flex-shrink: 0; width: 90px; text-align: right; }

/* Day-of-week chart */
.dow-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 8px 0 24px; position: relative; }
.dow-bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; cursor: pointer; position: relative; }
.dow-bar-fill { width: 100%; background: linear-gradient(to top, var(--primary), rgba(59,130,246,0.5)); border-radius: 4px 4px 0 0; min-height: 2px; transition: background 0.2s; }
.dow-bar:hover .dow-bar-fill { background: linear-gradient(to top, #60A5FA, rgba(96,165,250,0.7)); }
.dow-bar-label { font-size: 10px; color: var(--text3); font-weight: 600; }
.dow-bar .bar-tip {
  position: absolute; top: -4px; left: 50%;
  transform: translate(-50%,-100%);
  background: var(--surface3);
  border: 1px solid var(--border-bright);
  border-radius: 8px; padding: 6px 10px;
  font-size: 11px; white-space: nowrap; display: none; z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.dow-bar:hover .bar-tip { display: block; }

.basket-stat { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.basket-stat:last-child { border-bottom: none; }
.basket-stat .bs-label { color: var(--text2); }
.basket-stat .bs-val   { font-weight: 700; }

/* refresh button */
.refresh-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
}
.refresh-btn:hover { background: var(--surface3); color: var(--text); }

/* ─────────────────────────────────────────
   FILTERS / SEARCH BAR
───────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }

.search-box, .filter-select, .filter-date {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.search-box { min-width: 220px; }
.search-box:focus, .filter-select:focus, .filter-date:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.filter-select option { background: var(--surface2); color: var(--text); }

.search-btn {
  background: linear-gradient(135deg, #7C3AED, #A855F7);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 4px 14px rgba(124,58,237,0.3);
}
.search-btn:hover { opacity: 0.9; }
.search-btn:active { transform: scale(0.97); }
.search-btn.sm { padding: 6px 12px; font-size: 12px; }

/* ─────────────────────────────────────────
   BULK ACTION BAR
───────────────────────────────────────── */
.bulk-bar {
  background: var(--surface);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  box-shadow: 0 0 20px rgba(59,130,246,0.06);
}
.bulk-bar span { font-size: 13px; font-weight: 600; color: var(--primary); }
.bulk-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.bulk-btn:hover { background: var(--surface3); border-color: var(--border-bright); }
.bulk-btn.cancel { color: var(--red); border-color: rgba(239,68,68,0.3); }
.bulk-btn.cancel:hover { background: rgba(239,68,68,0.08); }

/* ─────────────────────────────────────────
   EXPORT
───────────────────────────────────────── */
.export-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.export-btn {
  border: none;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  display: flex; align-items: center; gap: 6px;
  transition: opacity 0.15s, transform 0.1s;
}
.export-btn:hover { opacity: 0.88; }
.export-btn:active { transform: scale(0.97); }
.export-btn.csv     { background: rgba(16,185,129,0.15); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.export-btn.xls     { background: rgba(59,130,246,0.12); color: var(--blue); border: 1px solid rgba(59,130,246,0.25); }
.export-btn.cols    { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.export-btn.preview { background: rgba(249,115,22,0.12); color: var(--orange); border: 1px solid rgba(249,115,22,0.3); }

/* ─────────────────────────────────────────
   TABLES
───────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin-top: 10px; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: var(--surface2); }
th {
  padding: 9px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 11.5px;
  letter-spacing: 0.02em;
}
th.sortable { cursor: pointer; user-select: none; position: relative; padding-right: 18px; }
th.sortable:hover { color: var(--text); background: rgba(59,130,246,0.06); }
th.sortable::after { content: ''; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--text2); opacity: 0.3; }
th.sortable.sort-asc::after  { content: '▲'; opacity: 1; color: var(--primary); }
th.sortable.sort-desc::after { content: '▼'; opacity: 1; color: var(--primary); }

td { padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(124,58,237,0.05); }
tr { cursor: pointer; transition: background 0.1s; }

/* ─────────────────────────────────────────
   BADGES
───────────────────────────────────────── */
.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-block;
  text-transform: capitalize;
}
.badge.processing { background: rgba(59,130,246,0.12); color: var(--blue); }
.badge.completed  { background: rgba(16,185,129,0.12); color: var(--green); }
.badge.on-hold    { background: rgba(245,158,11,0.12); color: var(--yellow); }
.badge.cancelled,.badge.failed { background: rgba(239,68,68,0.12); color: var(--red); }
.badge.pending    { background: rgba(249,115,22,0.12); color: var(--orange); }
.badge.refunded   { background: rgba(91,115,148,0.12); color: var(--text2); }

.fc-badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; color: var(--text2); background: var(--surface2); }

/* Order age */
.age-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.age-today { background: rgba(16,185,129,0.12); color: var(--green); }
.age-1d    { background: rgba(59,130,246,0.12);  color: var(--blue); }
.age-2d    { background: rgba(245,158,11,0.12);  color: var(--yellow); }
.age-3d    { background: rgba(249,115,22,0.12);  color: var(--orange); }
.age-old   { background: rgba(239,68,68,0.12);   color: var(--red); }

.badge-active   { background: rgba(16,185,129,0.12); color: var(--green); padding: 3px 10px; border-radius: 20px; font-size: 12px; }
.badge-inactive { background: rgba(239,68,68,0.12);  color: var(--red);   padding: 3px 10px; border-radius: 20px; font-size: 12px; }

/* ─────────────────────────────────────────
   PAGINATION
───────────────────────────────────────── */
.pagination { display: flex; gap: 6px; margin-top: 16px; justify-content: center; align-items: center; }
.pagination button {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  font-family: inherit;
  transition: all 0.12s;
}
.pagination button.active { background: linear-gradient(135deg,#7C3AED,#A855F7); border-color: #7C3AED; color: #fff; }
.pagination button:hover:not(.active):not(:disabled) { background: var(--surface3); border-color: var(--border-bright); }
.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }
.pagination .info { color: var(--text2); font-size: 12.5px; }

/* ─────────────────────────────────────────
   MODALS
───────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(4,7,14,0.7);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 16px;
  max-width: 700px; width: 100%;
  max-height: 85vh; overflow-y: auto;
  padding: 24px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(59,130,246,0.08);
}
.modal h2 { font-size: 17px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.modal .close { background: none; border: none; color: var(--text2); font-size: 22px; cursor: pointer; transition: color 0.12s; line-height: 1; }
.modal .close:hover { color: var(--text); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-section { background: var(--surface2); border-radius: 10px; padding: 14px; }
.detail-section h3 { font-size: 13px; color: var(--primary); margin-bottom: 8px; font-weight: 600; }
.detail-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.detail-row .lbl { color: var(--text2); }
.items-table { width: 100%; margin-top: 16px; font-size: 13px; }
.items-table th { font-size: 11px; }
.cust-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 16px; }
.cust-stat { background: var(--surface2); border-radius: 10px; padding: 12px; text-align: center; }
.cust-stat .cs-label { font-size: 10px; color: var(--text2); text-transform: uppercase; margin-bottom: 4px; letter-spacing: 0.06em; }
.cust-stat .cs-value { font-size: 20px; font-weight: 800; }
.col-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 8px; margin: 16px 0; }
.col-grid label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; padding: 6px 8px; background: var(--surface2); border-radius: 6px; transition: background 0.12s; }
.col-grid label:hover { background: var(--surface3); }
.col-grid input[type=checkbox] { accent-color: var(--primary); }
.col-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.col-actions button { padding: 8px 16px; border-radius: var(--radius-sm); border: none; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit; }
.col-actions .apply  { background: var(--primary); color: #fff; }
.col-actions .selall { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }

/* ─────────────────────────────────────────
   CALL CENTER
───────────────────────────────────────── */
.cc-layout { display: flex; gap: 20px; min-height: calc(100vh - 180px); }
.cc-sidebar { width: 240px; flex-shrink: 0; }
.cc-main { flex: 1; min-width: 0; }
.cc-recent-box { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.cc-recent-box h4 { margin: 0 0 12px; font-size: 13px; color: var(--primary); font-weight: 600; }
.cc-recent-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text); transition: background 0.12s; }
.cc-recent-item:hover { background: var(--surface3); }
.cc-recent-item .cc-ri-icon { color: var(--text2); font-size: 15px; flex-shrink: 0; }
.cc-recent-item .cc-ri-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-recent-item .cc-ri-time { font-size: 11px; color: var(--text2); flex-shrink: 0; }
.cc-empty { color: var(--text2); font-size: 13px; text-align: center; padding: 12px 0; }
.cc-search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.cc-search-input { flex: 1; font-size: 15px !important; padding: 12px 16px !important; }
.cc-placeholder { text-align: center; padding: 80px 20px; color: var(--text2); }
.cc-placeholder-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.35; }
.cc-placeholder p { font-size: 15px; margin: 0; }
.cc-order-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 12px; transition: border-color 0.2s; }
.cc-order-card:hover { border-color: var(--border-bright); }
.cc-order-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.cc-order-header h3 { margin: 0; font-size: 16px; color: var(--primary); }
.cc-order-header .badge { font-size: 13px; }
.cc-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 12px; }
.cc-field { display: flex; flex-direction: column; gap: 2px; }
.cc-field .cc-lbl { font-size: 10px; color: var(--text2); text-transform: uppercase; font-weight: 600; letter-spacing: 0.06em; }
.cc-field .cc-val { font-size: 14px; color: var(--text); }
.cc-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.cc-section h4 { margin: 0 0 10px; font-size: 13px; color: var(--primary); font-weight: 600; }
.cc-items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cc-items-table th { text-align: left; padding: 6px 8px; color: var(--text2); font-weight: 600; font-size: 11px; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.cc-items-table td { padding: 8px; border-bottom: 1px solid var(--border); }
.cc-auto-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--green); background: rgba(16,185,129,0.1); padding: 3px 8px; border-radius: 4px; margin-left: 8px; }
.cc-auto-badge::before { content: ""; width: 6px; height: 6px; background: var(--green); border-radius: 50%; animation: ccpulse 2s infinite; }
@keyframes ccpulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ─────────────────────────────────────────
   ORDERS BREAKDOWN
───────────────────────────────────────── */
.bd-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.bd-main { min-width: 0; }
.bd-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.bd-summary { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap: 10px; margin-bottom: 16px; }
.bd-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 2px;
  transition: border-color 0.2s;
}
.bd-stat:hover { border-color: var(--border-bright); }
.bd-stat-lbl { font-size: 10px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.04em; }
.bd-stat-val { font-size: 20px; font-weight: 800; color: var(--text); }
.bd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bd-table th { text-align: left; padding: 8px 6px; border-bottom: 2px solid var(--border); color: var(--text2); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.bd-table td { padding: 7px 6px; border-bottom: 1px solid var(--border); }
.bd-table tr:hover td { background: rgba(124,58,237,0.05); }
.bd-prod { font-weight: 500; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-mono { font-family: 'SF Mono', Consolas, monospace; font-size: 12px; color: var(--text2); }

/* Breakdown sidebar */
.bd-sidebar { position: sticky; top: calc(var(--header-h) + 20px); align-self: start; }
.bd-sub-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.bd-sub-box h4 { font-size: 14px; margin-bottom: 12px; color: var(--text); font-weight: 600; }
.bd-sub-list { max-height: 300px; overflow-y: auto; }
.bd-sub-empty { color: var(--text2); font-size: 13px; text-align: center; padding: 16px 0; }
.bd-sub-item { display: flex; justify-content: space-between; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; transition: border-color 0.2s; }
.bd-sub-item:hover { border-color: var(--primary); }
.bd-sub-item.inactive { opacity: 0.5; }
.bd-sub-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.bd-sub-info strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-sub-info span { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-sub-time { color: var(--primary) !important; }
.bd-sub-actions { display: flex; gap: 4px; flex-shrink: 0; }
.bd-sub-toggle,.bd-sub-del { background: var(--surface2); border: 1px solid var(--border); color: var(--text2); width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; font-family: inherit; transition: all 0.12s; }
.bd-sub-toggle:hover { border-color: var(--primary); color: var(--primary); }
.bd-sub-del:hover { border-color: var(--red); color: var(--red); }
.bd-sub-form { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.bd-sub-form .search-box { padding: 6px 10px; font-size: 12px; min-width: 0; }
.bd-sub-form .filter-select { padding: 6px 8px; font-size: 12px; }
.bd-sub-form .search-btn { padding: 6px 12px; font-size: 12px; }

/* ─────────────────────────────────────────
   USERS TAB
───────────────────────────────────────── */
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.perm-item { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 10px; background: var(--surface2); border-radius: 6px; }
.perm-item input { accent-color: var(--primary); }
.role-select,.user-input { width: 100%; padding: 10px 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; margin-bottom: 10px; font-family: inherit; outline: none; transition: border-color 0.15s; }
.user-input:focus,.role-select:focus { border-color: var(--primary); }
.form-label { font-size: 12px; color: var(--text2); margin-bottom: 4px; display: block; }
.save-user-btn { background: var(--primary); color: #fff; border: none; padding: 10px 24px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 10px; font-family: inherit; transition: opacity 0.15s; }
.save-user-btn:hover { opacity: 0.9; }
.action-btn { background: none; border: 1px solid var(--border); color: var(--text); padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; margin-right: 4px; font-family: inherit; transition: background 0.12s; }
.action-btn:hover { background: var(--surface2); }
.action-btn.danger { border-color: rgba(239,68,68,0.4); color: var(--red); }
.action-btn.danger:hover { background: rgba(239,68,68,0.08); }

/* ─────────────────────────────────────────
   NOTES + ACTIVITY
───────────────────────────────────────── */
.activity-cell { cursor: pointer; font-size: 12px; line-height: 1.3; display: inline-block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.activity-cell:hover { color: var(--primary); text-decoration: underline; }
.activity-cell small { font-size: 10px; display: block; }
.note-preview { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--text2); cursor: pointer; }
.note-preview:hover { color: var(--primary); }
.note-add-btn { background: none; border: 1px dashed var(--border); color: var(--text2); padding: 2px 8px; border-radius: 4px; cursor: pointer; font-size: 11px; font-family: inherit; transition: all 0.12s; }
.note-add-btn:hover { border-color: var(--primary); color: var(--primary); }
.notes-thread { max-height: 400px; overflow-y: auto; margin-bottom: 16px; }
.note-item { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface); }
.note-item .note-header { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 12px; color: var(--text2); }
.note-item .note-author { font-weight: 600; color: var(--primary); }
.note-item .note-text { font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.note-input { width: 100%; min-height: 80px; padding: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; resize: vertical; font-family: inherit; outline: none; transition: border-color 0.15s; }
.note-input:focus { border-color: var(--primary); }
.note-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Split modal */
#split-modal .items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#split-modal .items-table th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); color: var(--text2); font-weight: 500; font-size: 12px; }
#split-modal .items-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); }
#split-modal .items-table input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
#split-modal .items-table input[type="number"] { background: var(--surface); color: var(--text); font-size: 13px; }
#split-modal .items-table input[type="number"]:disabled { opacity: .4; cursor: not-allowed; }

/* ─────────────────────────────────────────
   SPINNER
───────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 15px; height: 15px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────
   FOOTER
───────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 18px;
  color: var(--text3);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.app-footer a { color: var(--primary); text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }

/* ─────────────────────────────────────────
   SIDEBAR OVERLAY (tablet drawer)
───────────────────────────────────────── */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center; justify-content: center;
  font-size: 18px;
  font-family: inherit;
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(4,7,14,0.6);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ─────────────────────────────────────────
   MOBILE BOTTOM NAV
───────────────────────────────────────── */
.mobile-bottom-nav {
  display: none; /* shown only at ≤768px */
}

.mob-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  cursor: pointer;
  color: var(--text2);
  font-size: 10px;
  font-weight: 500;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  min-width: 0;
}
.mob-tab svg {
  width: 22px; height: 22px;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.mob-tab span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.mob-tab.active {
  color: var(--purple);
}
.mob-tab.active svg {
  transform: scale(1.12);
}
.mob-tab:active svg {
  transform: scale(0.9);
}

/* ─────────────────────────────────────────
   MOBILE MORE SHEET
───────────────────────────────────────── */
.mob-more-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(4,7,14,0.5);
  z-index: 299;
  backdrop-filter: blur(2px);
}
.mob-more-overlay.show { display: block; }

.mob-more-sheet {
  position: fixed;
  bottom: -100%;
  left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border-bright);
  border-radius: 20px 20px 0 0;
  z-index: 300;
  padding: 0 0 calc(env(safe-area-inset-bottom) + 8px);
  transition: bottom 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 -16px 48px rgba(0,0,0,0.5);
}
.mob-more-sheet.show { bottom: 0; }

.mob-more-header {
  padding: 14px 20px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mob-more-header::before {
  content: '';
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 36px; height: 4px;
  background: var(--border-bright);
  border-radius: 2px;
}

.mob-more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.mob-more-item:active { background: var(--surface2); }
.mob-more-item svg {
  width: 20px; height: 20px;
  color: var(--text2);
  flex-shrink: 0;
}
.mob-more-item.danger { color: var(--red); }
.mob-more-item.danger svg { color: var(--red); }

/* ─────────────────────────────────────────
   REDUCED MOTION
───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.1ms !important; }
}

/* ─────────────────────────────────────────
   RESPONSIVE — TABLET (1100px)
───────────────────────────────────────── */
@media (max-width: 1100px) {
  :root { --sidebar-w: 60px; }
  .sidebar-brand img { display: block; height: 26px; }
  .sidebar-brand { padding: 14px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
  .sidebar-brand::before { display: none; }
  .sidebar-brand::after { display: none; }
  .sidebar-nav .tab { padding: 10px; justify-content: center; gap: 0; border-radius: 10px; margin: 2px 4px; }
  .tab-label { display: none; }
  .nav-label { display: none; }
  .sidebar-footer { padding: 8px 4px; }
  .sidebar-user { justify-content: center; padding: 8px; }
  .sidebar-username, .sidebar-user-role { display: none; }
  .sidebar-nav .tab.active::before { top: 10%; bottom: 10%; left: 0; }
  .stats { grid-template-columns: repeat(2,1fr); }
  .exec-row { grid-template-columns: repeat(2,1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────
   RESPONSIVE — MOBILE (768px)
───────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  /* ── Layout ── */
  .main-area { margin-left: 0; width: 100%; }
  .container { padding: 14px 14px calc(76px + env(safe-area-inset-bottom)); }

  /* ── Sidebar: hidden on mobile (use bottom nav instead) ── */
  .sidebar { display: none; }
  .mobile-menu-btn { display: none; }

  /* ── Bottom nav ── */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(60px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 200;
    align-items: stretch;
  }

  /* ── Header ── */
  .header { padding: 0 14px; }
  .sync-group { display: none; }
  .auto-sync-badge { display: none; }
  .last-sync { display: none; }
  .header-right { gap: 8px; }
  .user-badge { padding: 6px 10px; font-size: 11px; }
  .user-menu { right: 8px; left: 8px; width: auto; min-width: 0; }

  /* ── Stat cards ── */
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .exec-row { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .stat-card { padding: 12px 14px; }
  .stat-card .value { font-size: 20px; }
  .stat-card .label { font-size: 10px; }

  /* ── Dash panels ── */
  .dash-grid { grid-template-columns: 1fr; gap: 12px; }
  .rt-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* ── Filters ── */
  .filters { flex-direction: column; align-items: stretch; gap: 8px; }
  .date-presets { flex-wrap: wrap; gap: 4px; }
  .search-box { min-width: 0; width: 100%; font-size: 16px; }
  .filter-select, .filter-date { width: 100%; }
  .search-btn { width: 100%; }
  .export-bar { flex-direction: column; }
  .export-btn { width: 100%; justify-content: center; }

  /* ── Bulk bar ── */
  .bulk-bar { flex-wrap: wrap; gap: 6px; padding: 10px; }

  /* ── Tables: edge-to-edge on mobile ── */
  .table-wrap {
    border-radius: 0;
    border-left: none; border-right: none;
    margin-left: -14px; margin-right: -14px;
  }
  table { font-size: 12px; }
  th { padding: 7px 8px; font-size: 10.5px; }
  td { padding: 6px 8px; }

  /* ── Modals ── */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: 20px 20px 0 0;
    max-height: 88vh;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
    max-width: 100%;
    width: 100%;
  }
  .modal h2 { font-size: 15px; }
  .detail-grid { grid-template-columns: 1fr; }
  .cust-stats { grid-template-columns: 1fr 1fr; }

  /* ── Other layouts ── */
  .sync-grid { grid-template-columns: 1fr 1fr; }
  .cc-layout { flex-direction: column; }
  .cc-sidebar { width: 100%; }
  .bd-layout { grid-template-columns: 1fr; }
  .bd-sidebar { position: static; }
  .widget-toggle-btn { display: none; }
  .widget-sidebar { display: none; }

  /* ── Pagination ── */
  .pagination { flex-wrap: wrap; justify-content: center; }
  .pagination button { padding: 5px 10px; font-size: 12px; }
}

@media (max-width: 480px) {
  .rt-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .exec-row { grid-template-columns: 1fr; }
  .stat-card .value { font-size: 18px; }
  .cust-stats { grid-template-columns: 1fr 1fr; }
}

/* ─────────────────────────────────────────
   ANALYTICS TAB
───────────────────────────────────────── */

/* Controls bar */
.analytics-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.analytics-presets {
  display: flex;
  gap: 4px;
}
.aperiod {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.aperiod:hover { color: var(--text); border-color: var(--border-bright); }
.aperiod.active {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--text);
}
.analytics-custom-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Chart header (title + metric pills row) */
.a-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.a-chart-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.a-chart-pills {
  display: flex;
  gap: 4px;
}
.a-pill {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.a-pill:hover { color: var(--text); }
.a-pill.active {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--text);
}

/* Trend chart container */
.a-trend-canvas {
  min-height: 160px;
}

/* SVG axis labels & grid */
.a-axis-lbl {
  font-size: 11px;
  fill: var(--text3);
  font-family: inherit;
}
.a-grid {
  stroke: var(--border);
  stroke-width: 1;
}

/* Bar rows (used in Fincart, cities, products, payment) */
.a-bars { display: flex; flex-direction: column; gap: 8px; }
.a-bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 80px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.a-bar-label {
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.a-bar-track {
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
}
.a-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}
.a-bar-val {
  color: var(--text);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}
.a-pct { color: var(--text2); }

/* Status dot */
.a-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

/* Rank number */
.a-rank { gap: 8px; }
.a-rank-n {
  min-width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--surface3);
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.a-prod-n {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* WA confirmation section */
.a-wa-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 0;
}
.a-wa-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.a-wa-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text2);
}
.a-wa-row strong { color: var(--text); margin-left: auto; }
.a-wa-total {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text2);
  display: flex;
  justify-content: space-between;
}
.a-wa-total strong { color: var(--text); }

/* Product toggle button */
.a-toggle-btn {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  margin-left: 8px;
  font-family: inherit;
  transition: color .15s, border-color .15s;
}
.a-toggle-btn:hover { color: var(--text); border-color: var(--border-bright); }

/* Loading / empty states */
.a-loading, .a-empty {
  padding: 24px 0;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
}

/* Responsive */
@media (max-width: 860px) {
  .a-bar-row { grid-template-columns: 110px 1fr 64px; }
}
@media (max-width: 600px) {
  .analytics-controls { flex-direction: column; align-items: flex-start; }
  .a-bar-row { grid-template-columns: 90px 1fr 56px; font-size: 11.5px; }
  .a-wa-wrap { flex-direction: column; align-items: flex-start; }
}

/* ─────────────────────────────────────────
   TAB NEW BADGE
───────────────────────────────────────── */
.tab-new-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
  vertical-align: middle;
  margin-left: 4px;
  line-height: 14px;
  white-space: nowrap;
}
/* Sidebar context: keep tab label + badge on a single line; tighten the badge
   so "Development Area NEW" fits the narrow sidebar without wrapping. */
.sidebar-nav .tab-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.sidebar-nav .tab-label .tab-new-badge {
  font-size: 8px;
  padding: 0 4px;
  line-height: 13px;
  margin-left: 6px;
  vertical-align: 1px;
}
.tab-beta-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  vertical-align: middle;
  margin-left: 4px;
  line-height: 14px;
}

/* Floating bubble badges */
.zai-float-badge {
  position: absolute;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 1px 5px;
  border-radius: 6px;
  color: #fff;
  line-height: 13px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  pointer-events: none;
}
.zai-float-badge.new {
  top: -6px;
  right: -6px;
  background: #ef4444;
}
.zai-float-badge.beta {
  bottom: -6px;
  right: -6px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
}

/* ─────────────────────────────────────────
   ZENITH AI CHAT
───────────────────────────────────────── */

/* Full-height layout inside the tab pane */
#pane-ai-chat {
  display: none;
  flex-direction: column;
  height: calc(100vh - var(--header-h) - 48px);
  min-height: 500px;
  position: relative;
}
#pane-ai-chat.active {
  display: flex;
}

.zai-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Header bar */
.zai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.zai-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.zai-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #9333ea);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 16px var(--primary-glow);
}
.zai-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.zai-subtitle {
  font-size: 11.5px;
  color: var(--text3);
  margin-top: 1px;
}
.zai-clear-btn {
  font-size: 12px;
  color: var(--text3);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: color .15s, border-color .15s;
}
.zai-clear-btn:hover { color: var(--text2); border-color: var(--border-bright); }

/* Message list */
.zai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}
.zai-messages::-webkit-scrollbar { width: 4px; }
.zai-messages::-webkit-scrollbar-track { background: transparent; }
.zai-messages::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }

/* Message rows */
.zai-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 82%;
  animation: zaiSlideIn .18s ease;
}
@keyframes zaiSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.zai-ai  { align-self: flex-start; }
.zai-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

/* Bubbles */
.zai-bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
}
.zai-ai .zai-bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text);
}
.zai-user .zai-bubble {
  background: var(--primary);
  border-bottom-right-radius: 4px;
  color: #fff;
}

/* Glowing border on AI reply bubbles */
@keyframes zai-bubble-glow {
  0%   { box-shadow: 0 0 0 0 rgba(139,92,246,0), 0 2px 8px rgba(0,0,0,.12); }
  50%  { box-shadow: 0 0 12px 3px rgba(139,92,246,.28), 0 2px 8px rgba(0,0,0,.12); }
  100% { box-shadow: 0 0 0 0 rgba(139,92,246,0), 0 2px 8px rgba(0,0,0,.12); }
}
.zai-ai .zai-bubble {
  animation: zai-bubble-glow 3.5s ease-in-out infinite;
  border: 1px solid rgba(139,92,246,.18);
}

/* AI avatar circle */
.zai-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #9333ea);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Typing indicator */
.zai-typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 13px 16px;
}
.zai-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text3);
  animation: zaiDot 1.2s infinite ease-in-out;
}
.zai-dot:nth-child(2) { animation-delay: .18s; }
.zai-dot:nth-child(3) { animation-delay: .36s; }
@keyframes zaiDot {
  0%,80%,100% { transform: scale(.8); opacity: .4; }
  40%         { transform: scale(1.1); opacity: 1; }
}

/* Markdown rendering inside bubbles */
.zai-bubble strong { font-weight: 700; }
.zai-bubble .zai-h { display: block; font-weight: 700; margin: 8px 0 4px; }
.zai-bubble ul { padding-left: 16px; margin: 6px 0; }
.zai-bubble li { margin: 3px 0; }
.zai-bubble .zai-code {
  background: rgba(0,0,0,.25);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
}
.zai-user .zai-bubble .zai-code { background: rgba(255,255,255,.15); }

/* Streaming cursor */
.zai-cursor {
  display: inline-block;
  color: var(--accent, #6366f1);
  font-weight: 700;
  animation: zai-blink .6s step-end infinite;
  margin-left: 1px;
  vertical-align: middle;
}
@keyframes zai-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Input area */
.zai-input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.zai-input {
  flex: 1;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  padding: 10px 14px;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 140px;
  overflow-y: auto;
  transition: border-color .15s, box-shadow .15s;
}
.zai-input::placeholder { color: var(--text3); }
.zai-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.zai-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .15s, transform .1s;
}
.zai-send:hover { opacity: .88; }
.zai-send:active { transform: scale(.94); }
.zai-send:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* Mobile */
@media (max-width: 640px) {
  #pane-ai-chat { height: calc(100vh - var(--header-h) - 80px); }
  .zai-msg { max-width: 92%; }
}

/* ─────────────────────────────────────────
   QUICK CHIP SUGGESTIONS
───────────────────────────────────────── */
.zai-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.zai-chip {
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid var(--border-bright);
  background: var(--surface3);
  color: var(--text2);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: color .15s, border-color .15s, background .15s;
  line-height: 1.4;
}
.zai-chip:hover {
  border-color: var(--primary);
  color: var(--text);
  background: var(--primary-dim);
}

/* ─────────────────────────────────────────
   FLOATING BUBBLE BUTTON
───────────────────────────────────────── */
/* Hidden on request — !important so it wins over any JS that sets an
   inline display style to show it for admin/beta users. Covers the launcher
   button and its panel, desktop and mobile alike. */
.zai-float-btn, .zai-float-panel { display: none !important; }
.zai-float-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #9333ea);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(124,58,237,0.45);
  z-index: 300;
  transition: transform .2s, box-shadow .2s;
}
.zai-float-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(124,58,237,0.6);
}
.zai-float-btn:active { transform: scale(.95); }

/* Push above mobile bottom nav */
@media (max-width: 768px) {
  .zai-float-btn { bottom: 76px; right: 16px; }
}

/* ─────────────────────────────────────────
   FLOATING CHAT PANEL
───────────────────────────────────────── */
.zai-float-panel {
  position: fixed;
  bottom: 92px;
  right: 28px;
  width: 380px;
  height: 520px;
  z-index: 299;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 70px rgba(0,0,0,0.55), 0 0 0 1px rgba(124,58,237,0.12);

  /* Hidden by default — shown via .open class */
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .2s ease, transform .2s ease;
}
.zai-float-panel.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* Float panel message list inherits .zai-messages but needs smaller max-width */
.zai-float-panel .zai-messages { padding: 14px; }
.zai-float-panel .zai-msg      { max-width: 90%; }
.zai-float-panel .zai-bubble   { font-size: 13px; padding: 9px 13px; }
.zai-float-panel .zai-header   { padding: 11px 14px; }
.zai-float-panel .zai-input-area { padding: 10px 14px; }
.zai-float-panel .zai-quick-chips { gap: 5px; margin-top: 9px; }
.zai-float-panel .zai-chip     { font-size: 11.5px; padding: 4px 10px; }

@media (max-width: 768px) {
  .zai-float-panel {
    bottom: 140px;
    right: 12px;
    left: 12px;
    width: auto;
    height: 460px;
  }
}

/* ── Thinking / loading animation ────────────────────────────────────────── */
.zai-thinking-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  min-width: 180px;
}
.zai-thinking-icon {
  font-size: 16px;
  animation: zaiIconPop .4s ease;
}
@keyframes zaiIconPop {
  0%   { transform: scale(0.6); opacity: 0; }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1);   opacity: 1; }
}
.zai-thinking-text {
  font-size: 13px;
  color: var(--text2);
  flex: 1;
  animation: zaiTextFade .3s ease;
}
@keyframes zaiTextFade {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0);    }
}
.zai-thinking-dots {
  display: flex;
  gap: 3px;
}
.zai-thinking-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
  animation: zaiDot 1.2s ease-in-out infinite;
}
.zai-thinking-dots span:nth-child(2) { animation-delay: .2s; }
.zai-thinking-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes zaiDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: .4; }
  40%           { transform: scale(1.1); opacity: 1;  }
}
.zai-thinking-timer {
  font-size: 11px;
  color: var(--text2);
  font-variant-numeric: tabular-nums;
  opacity: .7;
  min-width: 24px;
  text-align: right;
}

/* ── Token / budget bar ───────────────────────────────────────────────────── */
.zai-token-bar {
  padding: 8px 20px 6px;
  border-bottom: 1px solid var(--border);
  background: rgba(11,17,27,0.6);
  flex-shrink: 0;
}
.zai-token-info {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 5px;
}
.zai-token-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
  font-weight: 600;
}
.zai-token-cost {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.zai-token-detail {
  font-size: 11px;
  color: var(--text2);
  margin-left: auto;
}
.zai-token-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.zai-token-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), #6366f1);
  transition: width .6s ease;
}
.zai-token-fill.warn   { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.zai-token-fill.danger { background: var(--red); }

/* ── Escalation card ──────────────────────────────────────────────────────── */
.zai-escalate-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 10px;
}
.zai-escalate-icon { font-size: 22px; flex-shrink: 0; }
.zai-escalate-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.zai-escalate-body strong { font-size: 13px; color: var(--text); }
.zai-escalate-body span   { font-size: 12px; color: var(--text2); }
.zai-escalate-actions {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}
.zai-esc-yes {
  padding: 6px 13px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s;
}
.zai-esc-yes:hover { opacity: .85; }
.zai-esc-yes:disabled { opacity: .5; cursor: not-allowed; }
.zai-esc-no {
  padding: 6px 13px;
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border-bright);
  border-radius: 7px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, color .15s;
}
.zai-esc-no:hover  { border-color: var(--text2); color: var(--text); }
.zai-esc-sent {
  font-size: 13px;
  color: #10b981;
  padding: 4px 0;
}

/* ── Email preview modal ──────────────────────────────────────────────────── */
.zai-email-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.zai-email-modal {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  overflow: hidden;
}
.zai-email-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.zai-email-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.zai-email-close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s;
}
.zai-email-close:hover { color: var(--text); }
.zai-email-modal-body {
  padding: 18px 22px;
}
.zai-email-field {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.zai-email-field:last-of-type { border-bottom: none; }
.zai-email-field span   { color: var(--text2); min-width: 60px; }
.zai-email-field strong { color: var(--text); }
.zai-email-preview-body {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--surface2);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}
.zai-email-preview-body p { margin: 0 0 10px; }
.zai-email-preview-body p:last-child { margin-bottom: 0; }
.zai-email-preview-body blockquote {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 3px solid var(--primary);
  background: rgba(59,130,246,0.08);
  border-radius: 4px;
  font-style: italic;
  color: var(--text);
}
.zai-email-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
}

/* ── Sync freshness indicator ─────────────────────────────────────────────── */
.zai-synced {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.zai-synced-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
  animation: zaiPulse 2s ease-in-out infinite;
}
.zai-synced-dot.stale {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}
@keyframes zaiPulse {
  0%, 100% { opacity: 1;   }
  50%      { opacity: .45; }
}

/* ── AI header action buttons ─────────────────────────────────────────────── */
.zai-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}
.zai-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.zai-icon-btn:hover { border-color: var(--border-bright); color: var(--text); background: var(--surface); }

/* ── Drawers (history + knowledge) ────────────────────────────────────────── */
.zai-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(3px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  display: flex;
  justify-content: flex-end;
}
.zai-drawer-overlay.open { opacity: 1; pointer-events: all; }
.zai-drawer {
  width: 380px;
  max-width: 90%;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border-bright);
  display: flex;
  flex-direction: column;
  transform: translateX(20px);
  transition: transform .2s ease;
  box-shadow: -20px 0 50px rgba(0,0,0,.4);
}
.zai-drawer-wide { width: 460px; }
.zai-drawer-overlay.open .zai-drawer { transform: translateX(0); }
.zai-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.zai-drawer-title { font-size: 15px; font-weight: 700; color: var(--text); }
.zai-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}
.zai-drawer-empty {
  color: var(--text2);
  font-size: 13px;
  text-align: center;
  padding: 40px 16px;
}

/* Session items */
.zai-session-item {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.zai-session-item:hover { border-color: var(--border-bright); background: var(--surface2); }
.zai-session-item.active { border-color: var(--primary); background: var(--primary-dim); }
.zai-session-title { font-size: 13.5px; color: var(--text); font-weight: 600; margin-bottom: 4px; }
.zai-session-meta  { font-size: 11px; color: var(--text2); }

/* Knowledge stats bar */
.zai-kn-stats {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.zai-kn-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  border-right: 1px solid var(--border);
}
.zai-kn-stat:last-child { border-right: none; }
.zai-kn-stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.zai-kn-stat-lbl {
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 3px;
}

/* Knowledge add box */
.zai-knowledge-add {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.zai-kn-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  transition: border-color .15s;
}
.zai-kn-input:focus { border-color: var(--primary); }
.zai-kn-add-row { display: flex; gap: 8px; align-items: stretch; }
.zai-kn-tags { flex: 1; }
.zai-kn-add-row .zai-esc-yes { white-space: nowrap; }

/* Knowledge sub-tab filters */
.zai-drawer-subtab {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.zai-kn-filter {
  padding: 5px 11px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text2);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.zai-kn-filter.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Knowledge items */
.zai-kn-item {
  position: relative;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 9px;
}
.zai-kn-item.pending { border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.05); }
.zai-kn-q {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 8px;
  padding-right: 20px;
  line-height: 1.5;
}
.zai-kn-badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 2px 7px;
  border-radius: 5px;
  margin-right: 7px;
  vertical-align: middle;
  background: rgba(245,158,11,0.18);
  color: #f59e0b;
}
.zai-kn-badge.ans { background: rgba(16,185,129,0.15); color: #10b981; }
.zai-kn-answer-text { font-size: 12.5px; color: var(--text2); line-height: 1.6; }
.zai-kn-answer-field { margin-bottom: 7px; }
.zai-kn-save-sm { padding: 5px 12px; font-size: 12px; }
.zai-kn-del {
  position: absolute;
  top: 8px;
  right: 9px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  transition: color .15s;
}
.zai-kn-del:hover { color: var(--red); }

/* ── Pending-knowledge badge on Teach button ──────────────────────────────── */
.zai-pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 5px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

/* ── Inline AI tables ─────────────────────────────────────────────────────── */
.zai-table-wrap {
  overflow-x: auto;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.zai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.zai-table th {
  text-align: left;
  padding: 7px 11px;
  background: var(--surface2);
  color: var(--text2);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.zai-table td {
  padding: 7px 11px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.zai-table tr:last-child td { border-bottom: none; }
.zai-table tr:hover td { background: rgba(59,130,246,0.04); }

/* ── Inline AI bar charts ─────────────────────────────────────────────────── */
.zai-chart {
  margin: 10px 0;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.zai-chart-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.zai-chart-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
}
.zai-chart-row:last-child { margin-bottom: 0; }
.zai-chart-label {
  flex: 0 0 88px;
  font-size: 11.5px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.zai-chart-track {
  flex: 1;
  height: 14px;
  background: var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.zai-chart-bar {
  display: block;
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--primary), #6366f1);
  animation: zaiBarGrow .6s ease;
}
@keyframes zaiBarGrow { from { width: 0 !important; } }
.zai-chart-val {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}

/* ═════════════════════════════════════════════════════════════
   ZENITH AI — Claude-style redesign (sidebar + hero + agent img)
═════════════════════════════════════════════════════════════ */
#pane-ai-chat { padding: 0; }

.zai-shell {
  display: flex;
  height: 100%;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── Left sidebar ── */
.zai-sidebar {
  width: 244px;
  flex-shrink: 0;
  background: var(--surface2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 12px;
}
.zai-newchat-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 10px 12px;
  background: var(--primary); color: #fff; border: none; border-radius: 10px;
  font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: opacity .15s;
}
.zai-newchat-btn:hover { opacity: .9; }
.zai-side-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text3); margin: 16px 6px 6px; font-weight: 700;
}
.zai-sidebar-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.zai-sidebar-list::-webkit-scrollbar { width: 4px; }
.zai-sidebar-list::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }
.zai-side-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  padding: 8px 10px; border: none; border-radius: 8px;
  background: transparent; color: var(--text2);
  font-size: 12.5px; font-family: inherit; cursor: pointer;
  white-space: nowrap; overflow: hidden;
  transition: background .15s, color .15s;
}
.zai-side-item svg { flex-shrink: 0; opacity: .55; }
.zai-side-item-title { overflow: hidden; text-overflow: ellipsis; }
.zai-side-item:hover { background: var(--surface3); color: var(--text); }
.zai-side-item.active { background: var(--primary-dim); color: var(--text); }
.zai-side-empty { font-size: 12px; color: var(--text3); padding: 12px 10px; text-align: center; }
.zai-sidebar-foot {
  border-top: 1px solid var(--border); padding-top: 10px; margin-top: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.zai-side-link {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 8px 10px; border: none; border-radius: 8px;
  background: transparent; color: var(--text2);
  font-size: 12.5px; font-family: inherit; cursor: pointer; transition: background .15s;
}
.zai-side-link:hover { background: var(--surface3); color: var(--text); }
.zai-side-sync { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text3); padding: 2px 10px; }

/* ── Main column ── */
.zai-main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; }
.zai-main-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.zai-main-title { display: flex; align-items: center; gap: 8px; }
.zai-main-actions { display: flex; align-items: center; gap: 12px; }

/* messages column, centered like Claude */
.zai-scroll {
  flex: 1; overflow-y: auto;
  padding: 26px 18px;
  display: flex; flex-direction: column; gap: 22px;
  scroll-behavior: smooth;
}
.zai-scroll::-webkit-scrollbar { width: 5px; }
.zai-scroll::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
.zai-scroll .zai-msg { max-width: 768px; width: 100%; margin: 0 auto; align-self: auto; align-items: flex-start; }
.zai-scroll .zai-user { flex-direction: row-reverse; }

/* composer */
.zai-composer { padding: 14px 18px 20px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.zai-composer .zai-input-area {
  width: 100%; max-width: 768px;
  border: 1px solid var(--border-bright); border-top: 1px solid var(--border-bright);
  border-radius: 16px; background: var(--surface2);
  padding: 6px 6px 6px 6px; box-shadow: 0 4px 20px rgba(0,0,0,.18);
  transition: border-color .15s, box-shadow .15s;
}
.zai-composer .zai-input-area:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.zai-composer .zai-input { background: transparent; border: none; padding: 9px 12px; }
.zai-composer .zai-input:focus { border: none; box-shadow: none; }

/* greeting hero */
.zai-greeting { display: none; flex-direction: column; align-items: center; text-align: center; gap: 12px; margin-bottom: 6px; }
.zai-greet-text { font-size: 30px; font-weight: 600; color: var(--text); font-family: 'DM Sans', sans-serif; letter-spacing: -.01em; }
.zai-greet-sub  { font-size: 14px; color: var(--text3); max-width: 440px; line-height: 1.5; }

/* empty state: center composer + show greeting */
.zai-main.empty .zai-scroll { display: none; }
.zai-main.empty .zai-composer { margin: auto; width: 100%; }
.zai-main.empty .zai-greeting { display: flex; }
.zai-main.empty #zai-hero-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 640px; }
.zai-main:not(.empty) .zai-greeting { display: none; }
.zai-main:not(.empty) #zai-hero-chips { display: none; }
.zai-main:not(.empty) .zai-composer { margin-top: auto; }

/* avatar with agent image */
.zai-avatar { position: relative; overflow: hidden; }
.zai-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.zai-avatar-hero { width: 60px; height: 60px; border-radius: 18px; font-size: 22px; box-shadow: 0 0 24px var(--primary-glow); }

/* credit pill styles removed */

/* floating bubble agent image */
.zai-float-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.zai-float-btn:has(.zai-float-img) .zai-float-fallback { display: none; }

@media (max-width: 860px) {
  .zai-sidebar { display: none; }
  .zai-greet-text { font-size: 24px; }
}

/* Powered by Zenith Weave */
.zai-powered {
  font-size: 10.5px;
  color: var(--text3);
  text-align: center;
  padding: 8px 4px 2px;
  letter-spacing: .02em;
}
.zai-powered a { color: var(--text2); text-decoration: none; font-weight: 600; }
.zai-powered a:hover { color: var(--primary); }

/* Float panel powered footer */
.zai-float-panel .zai-powered { padding: 6px 4px 8px; border-top: 1px solid var(--border); }

/* Float header avatar uses the agent image */
.zai-float-panel .zai-logo { position: relative; overflow: hidden; }

/* Dashboard Zenith AI intro card */
.zai-intro {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--surface2), var(--surface));
  border: 1px solid var(--border-bright);
  border-radius: 16px; padding: 16px 18px;
  margin: 12px 20px 0;   /* match .container's 20px side padding; no bottom margin needed */
  position: relative; overflow: hidden;
}
.zai-intro-img { width: 54px; height: 54px; border-radius: 14px; font-size: 20px; flex-shrink: 0; box-shadow: 0 0 20px var(--primary-glow); }
.zai-intro-body { flex: 1; min-width: 0; }
.zai-intro-title { font-size: 16px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.zai-intro-sub { font-size: 12.5px; color: var(--text2); margin: 3px 0 9px; }
.zai-intro-sub a { color: var(--primary); text-decoration: none; }
.zai-intro-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.zai-intro-btn {
  flex-shrink: 0; padding: 10px 16px; border: none; border-radius: 10px;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 13px;
  font-family: inherit; cursor: pointer; transition: opacity .15s;
}
.zai-intro-btn:hover { opacity: .9; }
@media (max-width: 760px) {
  .zai-intro { flex-direction: column; align-items: flex-start; }
  .zai-intro-btn { width: 100%; }
}

/* Daily quota bar (under the composer) */
.zai-quota {
  display: none; align-items: center; gap: 10px;
  width: 100%; max-width: 768px; margin-top: 2px;
  font-size: 11.5px; color: var(--text2);
}
.zai-quota-text { white-space: nowrap; }
.zai-quota-track { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.zai-quota-fill { display: block; height: 100%; background: var(--green); border-radius: 2px; transition: width .4s; }
.zai-quota-fill.full { background: var(--red); }
.zai-quota-btn {
  flex-shrink: 0; padding: 4px 11px; border: 1px solid var(--primary);
  background: var(--primary-dim); color: var(--primary);
  border-radius: 7px; font-size: 11.5px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.zai-quota-btn:hover { background: var(--primary); color: #fff; }

/* ── Access Control (super admin) tab ── */
.sa-head { margin-bottom: 18px; }
.sa-title { font-size: 20px; font-weight: 800; color: var(--text); }
.sa-sub { font-size: 13px; color: var(--text2); margin-top: 4px; max-width: 640px; }
.sa-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
.sa-section-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.sa-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 800;
}
.sa-empty { color: var(--text3); font-size: 13px; padding: 8px 0; }
.sa-req {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 8px;
}
.sa-req-info { display: flex; flex-direction: column; gap: 2px; }
.sa-req-info strong { font-size: 13.5px; color: var(--text); }
.sa-req-info span { font-size: 11.5px; color: var(--text3); }
.sa-req-actions { display: flex; align-items: center; gap: 7px; }
.sa-limit-input {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); padding: 6px 8px;
  font-family: inherit; font-size: 12.5px; outline: none;
}
.sa-limit-input:focus { border-color: var(--primary); }

/* ── Tab Permissions Grid ─────────────────────────────────────────────────── */
.perm-table-wrap { overflow-x: auto; }
.perm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm-table thead th {
  padding: 9px 14px; text-align: center; font-size: 12px; font-weight: 600;
  color: var(--text3); text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 2px solid var(--border); background: var(--surface2);
}
.perm-table thead th:first-child { text-align: left; }
.perm-table tbody tr:nth-child(even) { background: var(--surface2); }
.perm-table tbody td { padding: 9px 14px; border-bottom: 1px solid var(--border); }
.perm-tab-name { font-size: 13px; font-weight: 500; color: var(--text); }

/* Toggle switch */
.perm-toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.perm-toggle input { opacity: 0; width: 0; height: 0; }
.perm-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--border); border-radius: 20px; transition: .2s;
}
.perm-slider::before {
  content: ''; position: absolute; width: 14px; height: 14px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s;
}
.perm-toggle input:checked + .perm-slider { background: var(--primary); }
.perm-toggle input:checked + .perm-slider::before { transform: translateX(16px); }
.perm-toggle input:disabled + .perm-slider { opacity: .5; cursor: not-allowed; }

/* ── Help & Support ───────────────────────────────────────────────────────── */
/* ── Announcement bar ──────────────────────────────────────────────────── */
@keyframes ann-slide-in {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.ann-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 2000;
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px; min-height: 48px;
  font-size: 13.5px; font-weight: 500; line-height: 1.45;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
  animation: ann-slide-in .3s cubic-bezier(.22,.68,0,1.2) both;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.ann-bar-inner {
  display: flex; align-items: center; gap: 12px;
  max-width: 900px; margin: 0 auto; width: 100%; padding: 10px 0;
}
.ann-icon {
  font-size: 18px; flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(255,255,255,.5));
}
.ann-msg  { flex: 1; }
.ann-dismiss {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 20px; padding: 3px 10px;
  cursor: pointer; font-size: 12px; font-weight: 600;
  color: inherit; display: flex; align-items: center; gap: 5px;
  flex-shrink: 0; transition: background .15s, transform .1s;
  white-space: nowrap;
}
.ann-dismiss:hover { background: rgba(255,255,255,.28); transform: scale(1.04); }
.ann-dismiss::before { content: '✕'; font-size: 11px; opacity: .8; }

/* ── Support shell ─────────────────────────────────────────────────────── */
.support-shell {
  display: flex; gap: 16px; padding: 20px; height: calc(100vh - 56px);
  overflow: hidden; box-sizing: border-box;
}
.support-left  { display: flex; flex-direction: column; gap: 14px; width: 340px; flex-shrink: 0; overflow-y: auto; }
.support-right { display: flex; flex-direction: column; gap: 14px; flex: 1; min-width: 0; overflow-y: auto; }
.support-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 10px;
}
.support-card-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.support-card-title svg { flex-shrink: 0; stroke: var(--primary); }
.support-input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); padding: 9px 12px;
  font-family: inherit; font-size: 13px; outline: none; box-sizing: border-box;
  transition: border-color .15s;
}
.support-input:focus { border-color: var(--primary); }
.support-textarea { resize: vertical; min-height: 80px; }
.support-row { display: flex; gap: 8px; align-items: flex-start; }
.support-select {
  flex: 1; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); padding: 8px 10px;
  font-family: inherit; font-size: 13px; outline: none; cursor: pointer;
}
.support-submit-btn {
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: 10px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: opacity .15s; margin-top: 4px;
}
.support-submit-btn:hover   { opacity: .88; }
.support-submit-btn:disabled { opacity: .5; cursor: wait; }
.support-action-btn {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); padding: 5px 10px; font-size: 12px; cursor: pointer;
  transition: border-color .12s;
}
.support-action-btn:hover { border-color: var(--primary); color: var(--primary); }
.sup-del-btn { color: #dc2626 !important; border-color: #fca5a5 !important; }
.sup-del-btn:hover { background: #fee2e2 !important; }
.sup-loading { color: var(--text3); font-size: 13px; padding: 16px 0; text-align: center; }
.sup-empty   { color: var(--text3); font-size: 13px; padding: 16px 0; text-align: center; }
.sup-error   { color: #dc2626; font-size: 13px; padding: 16px 0; }

/* ── Ticket filter bar ─────────────────────────────────────────────────── */
.sup-tickets-card { flex: 1; min-height: 0; }
.sup-filter-bar {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  padding: 10px 0 4px; border-bottom: 1px solid var(--border); margin-bottom: 6px;
}
.sup-filter-sel    { flex: 1; min-width: 110px; font-size: 12px; padding: 6px 8px; }
.sup-filter-search { flex: 2; min-width: 140px; padding: 6px 10px; font-size: 12px; }

/* ── Ticket rows ───────────────────────────────────────────────────────── */
.ticket-row {
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px;
  margin-bottom: 7px; cursor: pointer; transition: border-color .12s, background .12s;
}
.ticket-row:hover  { border-color: var(--primary); background: var(--surface2); }
.trow-active       { border-color: var(--primary) !important; background: color-mix(in srgb, var(--primary) 8%, var(--surface)) !important; }
.ticket-row-head   { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; flex-wrap: wrap; }
.ticket-title      { font-size: 13.5px; font-weight: 600; color: var(--text); margin: 2px 0; }
.ticket-row-foot   { display: flex; align-items: center; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.ticket-meta       { font-size: 11.5px; color: var(--text3); }
.ticket-num        { font-size: 11px; font-weight: 700; color: var(--text3); font-family: monospace; }
.tpri              { font-size: 13px; }
.tlink-order       { font-size: 11px; color: var(--primary); }
.treply-count      { font-size: 11px; color: var(--text3); }

/* ── Status badges ─────────────────────────────────────────────────────── */
.tbadge {
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px;
  text-transform: uppercase; letter-spacing: .3px; white-space: nowrap;
}
.tbadge-open    { background: #dbeafe; color: #1e40af; }
.tbadge-await   { background: #ede9fe; color: #5b21b6; }
.tbadge-prog    { background: #fef3c7; color: #92400e; }
.tbadge-done    { background: #d1fae5; color: #065f46; }
.tbadge-closed  { background: var(--surface2); color: var(--text3); }

/* ── Ticket detail panel ───────────────────────────────────────────────── */
.tdet-panel {
  display: flex; flex-direction: column; gap: 0;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); overflow: hidden;
}
.tdet-header {
  padding: 20px 22px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface);
}
.tdet-back {
  background: none; border: none; cursor: pointer; color: var(--primary);
  font-size: 13px; font-weight: 600; padding: 0; text-align: left; width: fit-content;
}
.tdet-badge-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tdet-title     { font-size: 18px; font-weight: 700; color: var(--text); margin: 0; line-height: 1.35; }
.tdet-meta      { font-size: 12px; color: var(--text3); }
.tdet-controls  { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; padding-top: 6px; }

.tdet-section-title {
  font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase;
  letter-spacing: .6px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.tdet-desc     { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.tdet-thread   { padding: 16px 22px; display: flex; flex-direction: column; gap: 12px; }

/* ── Reply bubbles ─────────────────────────────────────────────────────── */
.reply-bubble {
  border-radius: 12px; padding: 14px 16px;
  border: 1px solid var(--border);
}
.reply-sa   { background: color-mix(in srgb, var(--primary) 7%, var(--surface)); border-color: color-mix(in srgb, var(--primary) 25%, var(--border)); }
.reply-user { background: var(--surface2); }
.reply-internal { border-style: dashed; opacity: .8; }
.reply-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 8px;
}
.reply-author      { font-size: 12.5px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 5px; }
.reply-ts          { font-size: 11px; color: var(--text3); flex-shrink: 0; }
.reply-sa-badge    { background: var(--primary); color: #fff; border-radius: 4px; padding: 1px 5px; font-size: 10px; font-weight: 700; }
.reply-internal-badge { background: #7c3aed; color: #fff; border-radius: 4px; padding: 1px 5px; font-size: 10px; font-weight: 700; }
.reply-content     { font-size: 13.5px; line-height: 1.6; color: var(--text); }
.reply-content .inline-code { background: var(--surface2); padding: 1px 5px; border-radius: 4px; font-size: 12px; font-family: monospace; }
.reply-content a   { color: var(--primary); }
.reply-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.reply-img {
  max-width: 220px; max-height: 160px; border-radius: 8px; cursor: zoom-in;
  object-fit: cover; border: 1px solid var(--border);
}
.reply-yt { width: 100%; margin-top: 8px; }
.reply-yt iframe { width: 100%; aspect-ratio: 16/9; border-radius: 8px; border: 0; }
.reply-file-link { font-size: 12px; color: var(--primary); text-decoration: none; }

/* ── Reply editor ──────────────────────────────────────────────────────── */
.tdet-reply-editor {
  padding: 16px 22px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.reply-toolbar {
  display: flex; gap: 5px; flex-wrap: wrap;
}
.rtb-btn {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); padding: 4px 9px; font-size: 12px; cursor: pointer;
  transition: border-color .1s;
}
.rtb-btn:hover { border-color: var(--primary); }
.rtb-sep { width: 1px; background: var(--border); align-self: stretch; margin: 0 3px; }
.rtb-saved { color: var(--primary); font-weight: 600; border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.reply-textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); padding: 10px 12px;
  font-family: inherit; font-size: 13px; outline: none; resize: vertical;
  box-sizing: border-box; min-height: 90px; transition: border-color .15s;
}
.reply-textarea:focus { border-color: var(--primary); }
.reply-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.reply-att-preview { display: flex; gap: 6px; flex-wrap: wrap; }
.att-preview-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.internal-toggle { font-size: 12px; color: var(--text3); cursor: pointer; display: flex; align-items: center; gap: 4px; }

/* ── Order context block ───────────────────────────────────────────────── */
.tdet-order-ctx {
  margin: 0 22px 0; padding: 14px 16px; border-radius: 10px;
  background: color-mix(in srgb, #f59e0b 8%, var(--surface));
  border: 1px solid color-mix(in srgb, #f59e0b 30%, var(--border));
}
.tdet-ctx-title {
  font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 10px;
  text-transform: uppercase; letter-spacing: .4px;
}
.tdet-ctx-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px;
}
.tdet-ctx-cell span   { font-size: 10.5px; color: var(--text3); display: block; }
.tdet-ctx-cell strong { font-size: 13px; color: var(--text); }

/* ── Activity log ──────────────────────────────────────────────────────── */
.tdet-activity {
  padding: 16px 22px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.activity-item {
  display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--text2);
}
.activity-icon { font-size: 13px; flex-shrink: 0; }
.activity-text { flex: 1; }
.activity-ts   { color: var(--text3); font-size: 11px; flex-shrink: 0; }

/* ── KB ────────────────────────────────────────────────────────────────── */
.kb-category {
  font-size: 10.5px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .5px; padding: 10px 4px 4px;
}
.kb-item {
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
  transition: background .12s; display: flex; align-items: center; gap: 8px;
}
.kb-item:hover { background: var(--surface2); }
.kb-item-title { font-size: 13px; font-weight: 500; color: var(--text); }
.kb-article-body { font-size: 14px; line-height: 1.7; color: var(--text); }
.kb-article-body a    { color: var(--primary); }
.kb-article-body code { background: var(--surface2); padding: 2px 5px; border-radius: 4px; font-size: 12px; }
.inline-code { background: var(--surface2); padding: 1px 5px; border-radius: 4px; font-size: 12px; font-family: monospace; }

/* ── Announcements tab ─────────────────────────────────────────────────── */
.ann-pane  { padding: 20px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 56px); overflow-y: auto; }
.ann-row {
  border: 1px solid var(--border); border-radius: 10px; padding: 13px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.ann-row-active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.ann-row-head   { display: flex; align-items: flex-start; gap: 10px; }
.ann-row-icon   { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.ann-row-msg    { font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.4; flex: 1; }
.ann-row-foot   { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ann-row-meta   { font-size: 11.5px; color: var(--text3); flex: 1; }
.ann-row-status { font-size: 11.5px; font-weight: 700; }
.ann-status-live { color: #10b981; }
.ann-status-off  { color: var(--text3); }
.ann-row-btns   { display: flex; gap: 6px; }

/* ── Saved responses modal ─────────────────────────────────────────────── */
.sr-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 5000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.sr-modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 500px; max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.4); overflow: hidden;
}
.sr-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700; color: var(--text); flex-shrink: 0;
}
.sr-close {
  background: none; border: none; color: var(--text3); font-size: 18px;
  cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.sr-close:hover { background: var(--surface2); color: var(--text); }
.sr-list {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.sr-cat-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text3); padding: 6px 4px 2px;
}
.sr-item {
  position: relative; padding: 10px 36px 10px 12px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: border-color .12s, background .12s;
}
.sr-item:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--surface2)); }
.sr-item-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.sr-item-preview { font-size: 12px; color: var(--text3); line-height: 1.4; }
.sr-del-btn {
  position: absolute; top: 8px; right: 8px;
  background: none; border: none; color: var(--text3); font-size: 13px;
  cursor: pointer; padding: 2px 5px; border-radius: 4px; line-height: 1;
}
.sr-del-btn:hover { background: rgba(239,68,68,.15); color: #ef4444; }
.sr-empty { padding: 20px; text-align: center; color: var(--text3); font-size: 13px; }
.sr-add-form {
  border-top: 1px solid var(--border); padding: 16px;
  display: flex; flex-direction: column; gap: 8px; flex-shrink: 0;
}
.sr-add-title { font-size: 12px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.sr-input, .sr-textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); padding: 8px 10px; font-size: 13px; font-family: inherit;
  outline: none; transition: border-color .12s;
}
.sr-input:focus, .sr-textarea:focus { border-color: var(--primary); }
.sr-textarea { resize: vertical; min-height: 70px; }

@media (max-width: 900px) {
  .support-shell { flex-direction: column; height: auto; overflow: visible; }
  .support-left  { width: 100%; }
  .tdet-ctx-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Update Log ───────────────────────────────────────────────────────────── */
.ulog-shell { padding: 8px 4px 24px; }
.ulog-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.ulog-title {
  margin: 0 0 8px; font-size: 22px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.ulog-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.ulog-stat {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(16,185,129,0.12); color: var(--green);
  border: 1px solid rgba(16,185,129,0.25);
  font-size: 12px; font-weight: 500;
}
.ulog-stat b { font-weight: 700; }
.ulog-stat-progress { background: rgba(234,179,8,0.12); color: #eab308; border-color: rgba(234,179,8,0.25); }
.ulog-stat-plugin   { background: rgba(139,92,246,0.12); color: #a78bfa; border-color: rgba(139,92,246,0.25); }
.ulog-head-right { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.ulog-search {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; color: var(--text);
  font-size: 13px; width: 280px; max-width: 100%;
}
.ulog-search:focus { outline: none; border-color: var(--primary); }
.ulog-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.ulog-filter {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 14px; color: var(--text2);
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: all 0.15s ease;
}
.ulog-filter:hover { color: var(--text); border-color: var(--border-bright); }
.ulog-filter.active {
  background: rgba(139,92,246,0.15); color: #a78bfa;
  border-color: rgba(139,92,246,0.4);
}
.ulog-section-head {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text2);
  margin: 24px 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.ulog-section-head:first-child { margin-top: 4px; }
.ulog-section-sub {
  font-size: 11px; font-weight: 400; text-transform: none;
  letter-spacing: 0; color: var(--text3); margin-left: 6px;
}
.ulog-section-plugins { color: #a78bfa; }
.ulog-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.ulog-card {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.ulog-card:hover { border-color: var(--border-bright); transform: translateY(-1px); }
.ulog-card-actions {
  position: absolute; top: 6px; right: 6px;
  display: none; gap: 4px;
}
.ulog-card:hover .ulog-card-actions { display: inline-flex; }
.ulog-edit-btn, .ulog-del-btn {
  width: 22px; height: 22px; border: none; border-radius: 4px;
  background: transparent; color: var(--text3);
  cursor: pointer; font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.ulog-del-btn { font-size: 18px; }
.ulog-edit-btn:hover { background: rgba(139,92,246,0.18); color: #a78bfa; }
.ulog-del-btn:hover { background: rgba(239,68,68,0.15); color: var(--red); }
.ulog-form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text2); margin: 12px 0 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.ulog-form-label:first-child { margin-top: 0; }
.ulog-form-input {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; color: var(--text);
  font-size: 13px; font-family: inherit; box-sizing: border-box;
}
.ulog-form-input:focus { outline: none; border-color: var(--primary); }
textarea.ulog-form-input { resize: vertical; min-height: 60px; }
.ulog-card-plugin { border-left: 3px solid rgba(139,92,246,0.5); }
.ulog-card-meta {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-size: 11px;
}
.ulog-date {
  color: var(--text3); font-weight: 600; letter-spacing: 0.02em;
}
.ulog-card-title {
  font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px;
  line-height: 1.35;
}
.ulog-card-desc {
  font-size: 12.5px; color: var(--text2); line-height: 1.5;
}
.ulog-pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em;
}
.ulog-pill-done { background: rgba(16,185,129,0.15); color: var(--green); }
.ulog-pill-progress { background: rgba(234,179,8,0.15); color: #eab308; }
.ulog-pill-requested { background: rgba(59,130,246,0.15); color: #60a5fa; }
.ulog-pill-plugin { background: rgba(139,92,246,0.15); color: #a78bfa; }
.ulog-stat-requested { background: rgba(59,130,246,0.12); color: #60a5fa; border-color: rgba(59,130,246,0.25); }
.ulog-new-inline { vertical-align: middle; font-size: 8px; padding: 0 4px; line-height: 13px; }
.ulog-attachments {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px;
}
.ulog-thumb {
  display: block; width: 60px; height: 60px; border-radius: 6px;
  overflow: hidden; border: 1px solid var(--border);
  transition: transform 0.15s ease;
}
.ulog-thumb:hover { transform: scale(1.05); border-color: var(--primary); }
.ulog-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ulog-card-byline {
  font-size: 10.5px; color: var(--text3); margin-top: 8px;
  font-style: italic;
}
.ulog-loading, .ulog-empty {
  padding: 40px 20px; text-align: center; color: var(--text2);
}

/* ── Admin Requests widget (top of Development Area) ─────────────────────── */
.ureq-widget {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; margin-bottom: 24px;
}
.ureq-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.ureq-title {
  margin: 0; font-size: 16px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.ureq-form {
  background: rgba(139,92,246,0.04);
  border: 1px solid rgba(139,92,246,0.18);
  border-radius: 10px; padding: 14px;
  margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px;
}
.ureq-form .ulog-form-input { margin: 0; }
.ureq-attach-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.ureq-attach-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px;
  background: var(--surface); border: 1px dashed var(--border);
  color: var(--text2); font-size: 12px; cursor: pointer;
  transition: all 0.15s ease;
}
.ureq-attach-btn:hover { border-color: var(--primary); color: var(--text); }
.ureq-attach-preview {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.ureq-stage-thumb {
  position: relative; width: 70px; height: 70px;
  border-radius: 6px; overflow: hidden;
  border: 1px solid var(--border);
}
.ureq-stage-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ureq-stage-remove {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border: none; border-radius: 50%;
  background: rgba(0,0,0,0.7); color: #fff;
  cursor: pointer; font-size: 12px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.ureq-stage-name {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.7); color: #fff;
  font-size: 9px; padding: 1px 3px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ureq-form-error {
  color: var(--red); font-size: 12.5px;
  padding: 6px 10px; background: rgba(239,68,68,0.08);
  border-radius: 6px;
}
.ureq-form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.ureq-body { display: flex; flex-direction: column; gap: 10px; }
.ureq-empty {
  padding: 20px; text-align: center; color: var(--text3);
  font-size: 13px;
}
.ureq-card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px;
}
.ureq-card.ureq-resolved { opacity: 0.65; }
.ureq-actions {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 4px; align-items: center;
}
.ureq-toggle {
  background: transparent; border: 1px solid var(--border);
  border-radius: 5px; padding: 3px 8px; color: var(--text2);
  font-size: 11px; cursor: pointer; transition: all 0.15s ease;
}
.ureq-toggle:hover { border-color: var(--primary); color: var(--text); }
.ureq-card-head {
  font-size: 11px; color: var(--text3); margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.ureq-card-author { color: var(--text2); font-weight: 500; }
.ureq-card-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 4px; padding-right: 130px;
}
.ureq-card-desc {
  font-size: 12.5px; color: var(--text2); line-height: 1.5;
  margin-bottom: 8px; white-space: pre-wrap;
}
.ureq-attachments {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px;
}
.ureq-thumb {
  display: block; width: 80px; height: 80px; border-radius: 6px;
  overflow: hidden; border: 1px solid var(--border);
  transition: transform 0.15s ease;
}
.ureq-thumb:hover { transform: scale(1.05); border-color: var(--primary); }
.ureq-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 600px) {
  .ureq-card-title { padding-right: 0; margin-top: 24px; }
  .ureq-actions { position: static; margin-bottom: 6px; }
}
@media (max-width: 768px) {
  .ulog-head { flex-direction: column; align-items: stretch; }
  .ulog-head-right { align-items: stretch; }
  .ulog-search { width: 100%; }
  .ulog-grid { grid-template-columns: 1fr; }
}

/* ── Bundles widget (dashboard) ──────────────────────────────────────────── */
.bundles-panel { padding: 18px 20px; }
.bundles-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.bundles-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.bundles-attach {
  font-size: 12px; color: var(--text2);
}
.bundles-attach-num {
  font-size: 18px; font-weight: 700; color: #a78bfa; margin-right: 4px;
}
.bundles-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.bundles-stat {
  background: rgba(139,92,246,0.06);
  border: 1px solid rgba(139,92,246,0.18);
  border-radius: 10px; padding: 12px 14px;
}
.bundles-stat-lbl {
  font-size: 11px; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.bundles-stat-val {
  font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.1;
}
.bundles-stat-sub {
  font-size: 11px; color: var(--text3); margin-top: 4px;
}
.bundles-tiers { margin-top: 16px; }
.bundles-tiers-label {
  font-size: 11px; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px;
}
.bundles-tier-row {
  display: grid; grid-template-columns: 140px 1fr 50px;
  align-items: center; gap: 10px; padding: 4px 0;
  font-size: 12.5px;
}
.bundles-tier-name { color: var(--text); font-weight: 500; }
.bundles-tier-bar {
  height: 8px; background: rgba(139,92,246,0.12); border-radius: 4px; overflow: hidden;
}
.bundles-tier-bar-fill {
  height: 100%; background: linear-gradient(90deg, #8b5cf6, #a78bfa);
  border-radius: 4px;
}
.bundles-tier-count { text-align: right; color: var(--text2); font-weight: 600; }
.bundles-loading {
  padding: 20px; text-align: center; color: var(--text2); font-size: 13px;
}
/* Classics vs EVA — two detail boxes */
.bundles-vs { margin-top: 18px; }
.bundles-vs-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.bundles-vs-box {
  position: relative;
  background: color-mix(in srgb, var(--vs-color) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--vs-color) 28%, transparent);
  border-radius: 12px; padding: 16px 16px 14px;
}
.bundles-vs-box.bundles-vs-lead {
  border-color: color-mix(in srgb, var(--vs-color) 55%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--vs-color) 20%, transparent);
}
.bundles-vs-box-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: var(--vs-color); margin-bottom: 10px;
}
.bundles-vs-crown { font-size: 13px; line-height: 1; }
.bundles-vs-box-rev { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.1; }
.bundles-vs-box-sub {
  font-size: 13px; color: var(--text2); margin-top: 3px; margin-bottom: 14px; line-height: 1.4;
}
.bundles-vs-pct { font-weight: 700; font-size: 14px; }
.bundles-vs-box-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.bundles-vs-box-stat-val { font-size: 15px; font-weight: 700; color: var(--text); }
.bundles-vs-box-stat-units {
  font-size: 16px; font-weight: 700; color: var(--text2); margin-left: 4px;
}
.bundles-vs-box-stat-lbl {
  font-size: 10px; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.03em; margin-top: 2px;
}
/* Stats grid drops from 4 to 2 columns before boxes get cramped — 700px
   (not 420px) is roughly where a single-column box on a real phone starts
   squeezing 4 cells with the (units) text. */
@media (max-width: 700px) {
  .bundles-vs-grid { grid-template-columns: 1fr; }
  .bundles-vs-box-stats { grid-template-columns: repeat(2, 1fr); gap: 12px 10px; }
  .bundles-vs-box-rev { font-size: 22px; }
}
@media (max-width: 360px) {
  .bundles-vs-box-stat-units { font-size: 13px; } /* avoid wrapping on the narrowest phones */
}
@media (max-width: 600px) {
  .bundles-tier-row { grid-template-columns: 100px 1fr 40px; font-size: 11.5px; }
}

/* ══════════════════════════════════════════════════════════════════
   LOYALTY TRACKER
   Uses only the shared theme tokens so light/dark both work.
   ══════════════════════════════════════════════════════════════════ */
.loy-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:18px;flex-wrap:wrap}
.loy-title{font-size:22px;font-weight:700;margin:0 0 4px;color:var(--text)}
.loy-sub{margin:0;color:var(--text2);font-size:13px}
.loy-stamp{color:var(--text3);margin-left:6px}
.loy-error{background:rgba(239,68,68,.10);border:1px solid var(--red);color:var(--red);
  padding:12px 14px;border-radius:var(--radius-sm);font-size:13px;margin-bottom:16px}

/* KPI boxes */
.loy-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(215px,1fr));gap:14px;margin-bottom:14px}
.loy-kpi{position:relative;background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius);padding:16px 16px 14px;overflow:hidden;transition:border-color .15s ease,transform .15s ease}
.loy-kpi:hover{border-color:var(--border-bright);transform:translateY(-1px)}
.loy-kpi::before{content:"";position:absolute;inset:0 auto 0 0;width:3px;background:var(--text3)}
.loy-kpi-redeem::before{background:var(--accent)}
.loy-kpi-earn::before{background:var(--blue)}
.loy-kpi-vouchers::before{background:var(--green)}
.loy-kpi-liability::before{background:var(--purple)}
.loy-kpi-top{display:flex;align-items:center;gap:8px;margin-bottom:10px}
.loy-kpi-icon{width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;
  background:var(--surface3);color:var(--text2);flex-shrink:0}
.loy-kpi-icon svg{width:15px;height:15px}
.loy-kpi-redeem .loy-kpi-icon{color:var(--accent)}
.loy-kpi-earn .loy-kpi-icon{color:var(--blue)}
.loy-kpi-vouchers .loy-kpi-icon{color:var(--green)}
.loy-kpi-liability .loy-kpi-icon{color:var(--purple)}
.loy-kpi-label{font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--text2);font-weight:600}
.loy-kpi-value{font-size:26px;font-weight:700;color:var(--text);line-height:1.15;font-variant-numeric:tabular-nums}
.loy-kpi-sub{font-size:12px;color:var(--text2);margin-top:3px}
.loy-kpi-delta{font-size:11.5px;margin-top:9px;font-weight:600}
.loy-kpi-delta.up{color:var(--green)}
.loy-kpi-delta.down{color:var(--red)}
.loy-kpi-delta.flat{color:var(--text3)}
.loy-skeleton{height:118px;background:var(--surface2);animation:loyPulse 1.4s ease-in-out infinite}
@keyframes loyPulse{0%,100%{opacity:.55}50%{opacity:.85}}

/* mini strip */
.loy-minis{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px;margin-bottom:18px}
.loy-mini{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm);padding:11px 13px}
.loy-mini-lbl{font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--text3);font-weight:600}
.loy-mini-val{font-size:16px;font-weight:700;color:var(--text);margin-top:3px;font-variant-numeric:tabular-nums}

/* cards + charts */
.loy-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:18px;margin-bottom:16px}
.loy-charts{display:grid;grid-template-columns:1fr 1fr;gap:16px}
@media(max-width:1100px){.loy-charts{grid-template-columns:1fr}}
.loy-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.loy-card-head-wrap{flex-wrap:wrap}
.loy-card-head h3{margin:0;font-size:15px;font-weight:700;color:var(--text)}
.loy-ranges,.loy-types{display:flex;gap:4px;background:var(--surface2);padding:3px;border-radius:8px}
.loy-range,.loy-type{background:none;border:0;color:var(--text2);font-size:12px;font-weight:600;
  padding:5px 11px;border-radius:6px;cursor:pointer;transition:.12s}
.loy-range:hover,.loy-type:hover{color:var(--text)}
.loy-range.active,.loy-type.active{background:var(--surface3);color:var(--text)}
.loy-chart-slot{min-height:236px}
.loy-svg{width:100%;height:220px;display:block}
.loy-grid{stroke:var(--border);stroke-width:1}
.loy-axis{fill:var(--text3);font-size:10px;font-family:inherit}
.loy-legend{display:flex;gap:16px;margin-bottom:6px}
.loy-lg{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;color:var(--text2);font-weight:600}
.loy-lg i{width:9px;height:9px;border-radius:2px;display:inline-block}

/* tiers */
.loy-tiers{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:16px}
.loy-tier-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:7px}
.loy-tier-name{font-size:13px;font-weight:700;color:var(--text)}
.loy-tier-mult{font-size:11px;color:var(--text3);font-variant-numeric:tabular-nums}
.loy-tier-bar{height:7px;border-radius:99px;background:var(--surface3);overflow:hidden}
.loy-tier-bar span{display:block;height:100%;border-radius:99px;transition:width .5s ease}
.loy-tier-foot{font-size:11.5px;color:var(--text2);margin-top:6px;font-variant-numeric:tabular-nums}

/* activity table */
.loy-controls{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.loy-search{min-width:230px}
.loy-perpage{min-width:110px}
.loy-table-wrap{max-height:560px;overflow:auto}
.loy-table th{position:sticky;top:0;background:var(--surface2);z-index:1}
.loy-table td{font-size:12.5px;vertical-align:middle}
.loy-right,.loy-pts{text-align:right}
.loy-nowrap{white-space:nowrap;color:var(--text2);font-variant-numeric:tabular-nums}
.loy-email{max-width:230px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)}
.loy-pts{font-weight:700;font-variant-numeric:tabular-nums;white-space:nowrap}
.loy-pts.credit{color:var(--green)}
.loy-pts.debit{color:var(--red)}
.loy-pts.pending{color:var(--text3)}
.loy-pill{display:inline-block;font-size:10.5px;font-weight:700;letter-spacing:.03em;
  padding:3px 9px;border-radius:99px;text-transform:capitalize;white-space:nowrap}
.loy-pill.credit{background:rgba(16,185,129,.13);color:var(--green)}
.loy-pill.debit{background:rgba(239,68,68,.13);color:var(--red)}
.loy-pill.pending{background:rgba(245,158,11,.14);color:var(--accent)}
.loy-empty{text-align:center;color:var(--text3);padding:26px 0;font-size:13px}
.loy-pager{display:flex;align-items:center;justify-content:center;gap:14px;margin-top:14px}
.loy-page-info{font-size:12.5px;color:var(--text2);font-variant-numeric:tabular-nums;min-width:150px;text-align:center}
.loy-pager button:disabled{opacity:.4;cursor:not-allowed}

/* ── Loyalty: date range controls ── */
.loy-daterow{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:16px}
.loy-presets{display:flex;gap:4px;background:var(--surface2);padding:3px;border-radius:8px;flex-wrap:wrap}
.loy-preset{background:none;border:0;color:var(--text2);font-size:12px;font-weight:600;
  padding:6px 12px;border-radius:6px;cursor:pointer;transition:.12s;white-space:nowrap}
.loy-preset:hover{color:var(--text)}
.loy-preset.active{background:var(--surface3);color:var(--text)}
.loy-custom{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.loy-dash{color:var(--text3);font-size:12px}
.loy-rangelabel{color:var(--text3);font-size:12px;font-variant-numeric:tabular-nums;margin-left:auto}
.loy-kpi-members::before{background:var(--green-bright)}
.loy-kpi-members .loy-kpi-icon{color:var(--green-bright)}

/* ══ Loyalty: mobile ══ */
@media (max-width: 900px){
  .loy-charts{grid-template-columns:1fr}
  .loy-kpis{grid-template-columns:repeat(auto-fit,minmax(165px,1fr));gap:10px}
  .loy-kpi{padding:13px}
  .loy-kpi-value{font-size:21px}
}
@media (max-width: 640px){
  .loy-head{flex-direction:column;align-items:stretch;gap:10px}
  .loy-title{font-size:19px}
  .loy-head .search-btn{width:100%}

  .loy-daterow{gap:8px}
  .loy-presets{width:100%;overflow-x:auto;flex-wrap:nowrap;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .loy-presets::-webkit-scrollbar{display:none}
  .loy-preset{flex:0 0 auto;padding:8px 13px;font-size:12.5px}
  .loy-custom{width:100%}
  .loy-custom .filter-date{flex:1 1 40%;min-width:0}
  .loy-custom .search-btn{flex:1 1 100%}
  .loy-rangelabel{margin-left:0}

  /* two-up KPI grid reads better than a single tall column */
  .loy-kpis{grid-template-columns:1fr 1fr;gap:8px}
  .loy-kpi{padding:12px 11px}
  .loy-kpi-value{font-size:18px;letter-spacing:-.01em}
  .loy-kpi-label{font-size:9.5px;letter-spacing:.04em}
  .loy-kpi-sub{font-size:11px}
  .loy-kpi-delta{font-size:10.5px;margin-top:7px}
  .loy-kpi-icon{width:22px;height:22px}
  .loy-kpi-icon svg{width:13px;height:13px}

  .loy-minis{grid-template-columns:1fr 1fr;gap:8px}
  .loy-mini{padding:9px 11px}
  .loy-mini-val{font-size:14px}

  .loy-card{padding:14px}
  .loy-card-head{flex-wrap:wrap;gap:10px}
  .loy-svg{height:190px}
  .loy-legend{flex-wrap:wrap;gap:10px}

  .loy-tiers{grid-template-columns:1fr;gap:13px}

  .loy-controls{width:100%}
  .loy-types{width:100%}
  .loy-type{flex:1}
  .loy-search{width:100%;min-width:0}
  .loy-perpage{width:100%}

  /* activity table: drop low-value columns, keep it readable */
  .loy-table th:nth-child(3), .loy-table td:nth-child(3),
  .loy-table th:nth-child(5), .loy-table td:nth-child(5){display:none}
  .loy-table th, .loy-table td{padding:9px 8px}
  .loy-table td{font-size:12px}
  .loy-email{max-width:150px}
  .loy-table-wrap{max-height:none}

  .loy-pager{gap:8px}
  .loy-pager .search-btn{flex:1}
  .loy-page-info{min-width:0;font-size:11.5px}
}
@media (max-width: 380px){
  .loy-kpis{grid-template-columns:1fr}
  .loy-minis{grid-template-columns:1fr}
}

/* ── Loyalty: activity icons + tier cards ── */
.loy-act{display:inline-flex;align-items:center;gap:9px;min-width:0}
.loy-act-ic{width:24px;height:24px;flex-shrink:0;border-radius:6px;
  display:inline-flex;align-items:center;justify-content:center;
  background:var(--surface3);color:var(--text2)}
.loy-act-ic svg{width:13px;height:13px}
tr:hover .loy-act-ic{color:var(--text)}

.loy-tiercard{background:var(--surface2);border:1px solid var(--border);
  border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column;
  transition:border-color .15s ease,transform .15s ease}
.loy-tiercard:hover{border-color:var(--border-bright);transform:translateY(-2px)}
.loy-tiercard-art{background:var(--surface3);padding:10px 10px 0;display:flex;
  align-items:flex-end;justify-content:center;overflow:hidden;min-height:96px}
.loy-card-img{width:100%;max-width:190px;height:auto;display:block;
  filter:drop-shadow(0 8px 16px rgba(0,0,0,.45));transform:translateY(4px)}
.loy-card-img-missing{height:88px;width:150px;border-radius:8px;background:var(--surface)}
.loy-tiercard-body{padding:13px 14px 14px}
.loy-tiercard-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px}
.loy-tiercard-name{font-size:13.5px;font-weight:700;color:var(--text)}
.loy-tiercard-mult{font-size:12px;font-weight:700;font-variant-numeric:tabular-nums}
.loy-tiercard-range{font-size:11px;color:var(--text3);margin:3px 0 9px}
.loy-tiercard-foot{display:flex;align-items:baseline;justify-content:space-between;
  gap:8px;margin-top:7px;font-size:11.5px;color:var(--text2)}
.loy-tiercard-foot strong{color:var(--text);font-size:14px;font-variant-numeric:tabular-nums}
.loy-tiercard-pct{color:var(--text3);font-variant-numeric:tabular-nums}
.loy-kpi-spent::before{background:var(--pink)}
.loy-kpi-spent .loy-kpi-icon{color:var(--pink)}
@media(max-width:640px){
  .loy-tiercard-art{min-height:78px}
  .loy-card-img{max-width:150px}
  .loy-act-ic{width:21px;height:21px}
}

/* ── Bundles tab + Bundle Prices widget ───────────────────────────────── */
.bdl-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.bdl-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.bdl-sub { color: var(--text2); font-size: 13px; margin: 0; max-width: 620px; }
.bdl-note { display: none; font-size: 13px; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid var(--border); background: var(--surface2); }
.bdl-note.show { display: block; }
.bdl-note.ok { border-color: rgba(16,185,129,.35); color: var(--green-bright); }
.bdl-note.err { border-color: rgba(239,68,68,.4); color: var(--red); }
.bdl-note.warn { border-color: rgba(245,158,11,.4); color: var(--accent); }
.bdl-note.info { color: var(--text2); }
.bdl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.bdl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; transition: border-color .18s, opacity .18s; }
.bdl-card:hover { border-color: rgba(124,58,237,.25); }
.bdl-card.off { opacity: .6; }
.bdl-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.bdl-name { font-weight: 700; font-size: 15px; line-height: 1.3; }
.bdl-rule { color: var(--text2); font-size: 12px; margin-top: 3px; }
.bdl-status { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.bdl-status.on { color: var(--green); }
.bdl-status.off { color: var(--text3); }
.bdl-price-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bdl-price { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bdl-edit { display: flex; gap: 6px; }
.bdl-input { width: 110px; margin: 0; }
.bdl-toggle { flex-shrink: 0; }
.bdl-toggle.disabled { opacity: .7; }
.bdl-empty { color: var(--text2); font-size: 13px; padding: 10px 0; }
.bdl-log { display: flex; flex-direction: column; }
.bdl-log-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; align-items: baseline; }
.bdl-log-row:first-child { border-top: 0; }
.bdl-log-when { color: var(--text2); font-variant-numeric: tabular-nums; }
.bdl-log-who { color: var(--text2); font-size: 12px; }
.bdl-open { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--purple); cursor: pointer; text-decoration: none; }
#bundle-prices-panel h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bdl-wrow { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.bdl-wrow:first-child { border-top: 0; }
.bdl-wrow.off .bdl-wname, .bdl-wrow.off .bdl-wprice { color: var(--text3); }
.bdl-wname { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.bdl-wprice { font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .bdl-grid { grid-template-columns: 1fr; }
  .bdl-log-row { grid-template-columns: 1fr; gap: 2px; }
  .bdl-edit { width: 100%; }
  .bdl-input { flex: 1; width: auto; }
  .bdl-price-row { align-items: stretch; }
}

/* ── Header: manual sync buttons hidden (auto-sync keeps running) ── */
.header .sync-group { display: none !important; }

/* ── Loyalty: Customer Lookup ── */
.lkp-card{border-color:rgba(245,158,11,.22)}
.lkp-hint{margin:4px 0 0;font-size:12.5px;color:var(--text2)}
.lkp-form{position:relative;display:flex;gap:8px;margin-bottom:12px}
.lkp-form-ic{position:absolute;inset-inline-start:12px;top:50%;width:17px;height:17px;transform:translateY(-50%);color:var(--text3);pointer-events:none}
.lkp-input{flex:1;min-width:0;background:var(--surface2);border:1px solid var(--border-bright);border-radius:var(--radius-sm);
  color:var(--text);font:inherit;font-size:14px;padding:11px 12px 11px 38px;outline:none;transition:border-color .15s,box-shadow .15s}
[dir="rtl"] .lkp-input{padding:11px 38px 11px 12px}
.lkp-input:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-dim)}
.lkp-note{font-size:13px;color:var(--text2);padding:10px 2px}
.lkp-alert{border-radius:var(--radius-sm);padding:10px 12px;font-size:13px;margin:8px 0;border:1px solid}
.lkp-alert.warn{background:rgba(245,158,11,.10);border-color:rgba(245,158,11,.35);color:var(--text)}
.lkp-alert.info{background:rgba(96,165,250,.08);border-color:rgba(96,165,250,.3);color:var(--text)}
.lkp-alert.bad{background:rgba(239,68,68,.10);border-color:rgba(239,68,68,.4);color:var(--text)}
.lkp-bad-text{color:var(--red);font-weight:600}
.lkp-list{display:flex;flex-direction:column;gap:6px;margin-top:6px}
.lkp-row{display:grid;grid-template-columns:minmax(0,2.2fr) 1fr 1fr auto;gap:12px;align-items:center;text-align:start;
  background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius-sm);padding:10px 12px;color:var(--text);font:inherit;cursor:pointer;transition:border-color .15s}
.lkp-row:hover{border-color:var(--accent)}
.lkp-row-main{display:flex;flex-direction:column;min-width:0}
.lkp-row-main b{font-size:13.5px}
.lkp-row-main span{font-size:12px;color:var(--text2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lkp-row-meta{font-size:12px;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lkp-row-pts{font-weight:700;font-variant-numeric:tabular-nums;color:var(--accent);white-space:nowrap}
@media(max-width:700px){.lkp-row{grid-template-columns:1fr auto}.lkp-row-meta{display:none}}
.lkp-vgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:10px;margin:8px 0}
.lkp-voucher{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius-sm);padding:12px}
.lkp-voucher.hl{border-color:rgba(245,158,11,.55)}
.lkp-voucher-top{display:flex;align-items:center;gap:6px;margin-bottom:8px}
.lkp-voucher-top .lkp-pill{margin-inline-start:auto}
.lkp-code{font-family:ui-monospace,Consolas,monospace;font-size:15px;font-weight:700;letter-spacing:.04em;color:var(--text);direction:ltr}
.lkp-voucher-body{font-size:12.5px;color:var(--text2);display:flex;flex-direction:column;gap:3px}
.lkp-voucher-body b{color:var(--text)}
.lkp-link{background:none;border:0;padding:0;margin-top:8px;color:var(--accent);font:inherit;font-size:12.5px;font-weight:600;cursor:pointer}
.lkp-link:hover{text-decoration:underline}
.lkp-copy{background:none;border:0;padding:2px;margin-inline-start:2px;color:var(--text3);cursor:pointer;vertical-align:middle;line-height:0}
.lkp-copy svg{width:13px;height:13px}
.lkp-copy:hover{color:var(--text)}
.lkp-copy.done{color:var(--green)}
.lkp-pill{display:inline-block;font-size:10.5px;font-weight:700;letter-spacing:.03em;padding:2px 8px;border-radius:99px;white-space:nowrap;text-transform:capitalize}
.lkp-pill.ok{background:rgba(16,185,129,.13);color:var(--green)}
.lkp-pill.info{background:rgba(96,165,250,.13);color:var(--blue)}
.lkp-pill.warn{background:rgba(245,158,11,.14);color:var(--accent)}
.lkp-pill.bad{background:rgba(239,68,68,.13);color:var(--red)}
.lkp-pill.muted{background:var(--surface3);color:var(--text2)}
#lkp-member:not(:empty){margin-top:16px;padding-top:16px;border-top:1px solid var(--border)}
.lkp-profile{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:12px}
.lkp-avatar{width:46px;height:46px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex:none;
  background:var(--accent-dim);color:var(--accent);font-weight:800;font-size:19px;border:1px solid rgba(245,158,11,.35)}
.lkp-who{flex:1;min-width:220px}
.lkp-name{font-size:17px;font-weight:700;color:var(--text)}
.lkp-tier{font-size:11px;font-weight:700;padding:2px 9px;border-radius:99px;background:var(--surface3);color:var(--accent);vertical-align:middle;margin-inline-start:6px}
.lkp-contact{font-size:12.5px;color:var(--text2);margin-top:3px}
.lkp-contact b{color:var(--text)}
.lkp-admin{text-decoration:none}
.lkp-flags{margin-bottom:12px}
.lkp-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin-bottom:14px}
.lkp-stat{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius-sm);padding:11px 13px}
.lkp-stat.gold{border-color:rgba(245,158,11,.35)}
.lkp-stat-lbl{font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--text3);font-weight:600}
.lkp-stat-val{font-size:20px;font-weight:700;color:var(--text);margin-top:3px;font-variant-numeric:tabular-nums}
.lkp-stat.gold .lkp-stat-val{color:var(--accent)}
.lkp-stat-sub{font-size:11.5px;color:var(--text2);margin-top:2px}
.lkp-tabs{flex-wrap:wrap;width:fit-content;max-width:100%;margin-bottom:12px}
.lkp-sub{font-size:11px;color:var(--text3)}
.lkp-table-wrap{max-height:520px;overflow:auto}
.lkp-table-wrap a{color:var(--accent);text-decoration:none;font-weight:600}
.lkp-chips{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}
.lkp-chip{background:var(--surface2);border:1px solid var(--border);color:var(--text2);border-radius:99px;padding:4px 11px;font:inherit;font-size:12px;font-weight:600;cursor:pointer}
.lkp-chip span{color:var(--text3);font-weight:500;margin-inline-start:3px}
.lkp-chip.active{border-color:var(--accent);color:var(--text)}
.lkp-timeline{list-style:none;margin:0;padding:0;max-height:620px;overflow:auto}
.lkp-day{font-size:11px;font-weight:700;letter-spacing:.06em;color:var(--text3);padding:12px 0 6px;position:sticky;top:0;background:var(--surface);z-index:1}
.lkp-ev{display:grid;grid-template-columns:30px minmax(0,1fr) auto 80px;gap:10px;align-items:center;padding:8px 0;border-bottom:1px solid var(--border)}
.lkp-ev-ic{width:28px;height:28px;border-radius:8px;display:flex;align-items:center;justify-content:center;background:var(--surface2);color:var(--text2)}
.lkp-ev-ic svg{width:15px;height:15px}
.lkp-ev-points.credit .lkp-ev-ic{color:var(--green)}
.lkp-ev-points.debit .lkp-ev-ic{color:var(--red)}
.lkp-ev-vouchers .lkp-ev-ic{color:var(--accent)}
.lkp-ev-orders .lkp-ev-ic{color:var(--blue)}
.lkp-ev-account .lkp-ev-ic{color:var(--purple)}
.lkp-ev.warn .lkp-ev-ic{color:var(--red)}
.lkp-ev-body{display:flex;flex-direction:column;min-width:0}
.lkp-ev-title{font-size:13px;color:var(--text)}
.lkp-ev-sub{font-size:11.5px;color:var(--text2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lkp-ev-time{font-size:11.5px;color:var(--text3);font-variant-numeric:tabular-nums}
.lkp-ev .loy-pts{text-align:end}
@media(max-width:700px){.lkp-ev{grid-template-columns:28px minmax(0,1fr) 64px}.lkp-ev-time{display:none}}

/* ── Language toggle ── */
.lang-toggle{background:var(--surface2);border:1px solid var(--border-bright);color:var(--text);border-radius:var(--radius-sm);
  min-width:34px;height:32px;padding:0 9px;font:inherit;font-size:14px;font-weight:700;cursor:pointer;line-height:1}
.lang-toggle:hover{border-color:var(--accent);color:var(--accent)}

/* ── Arabic (RTL) ──
   ZeeArabicVF is the brand face from mrbeard-egypt.com (Arabic glyphs only, Bold).
   It carries headings, navigation, buttons and labels; running text and table
   cells use the system Arabic face, the same pairing the website uses. Latin
   text and numbers fall through to Inter/DM Sans. */
@font-face{font-family:'ZeeArabicVF';src:url('/fonts/ZeeArabicVF-Bold.otf') format('opentype');font-weight:100 900;font-display:swap;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF}
html.lang-ar body{font-family:'Inter','DM Sans','Segoe UI',Tahoma,'Noto Sans Arabic',sans-serif}
html.lang-ar :is(h1,h2,h3,h4,h5,.tab-label,.nav-label,.header-page-title,button,.btn,.search-btn,.sync-btn,
  .loy-title,.loy-kpi-label,.loy-mini-lbl,.lkp-stat-lbl,.loy-pill,.lkp-pill,.hc-label,th,.mob-more-item,.mob-more-header,
  .dash-panel h3,.kpi-label,.stat-label,.lkp-name,.lkp-chip,.date-presets button,.loy-preset,.loy-type,.loy-range){
  font-family:'Inter','DM Sans','ZeeArabicVF',Tahoma,sans-serif}
html.lang-ar :is(.loy-kpi-label,.loy-mini-lbl,.lkp-stat-lbl,.hc-label){letter-spacing:0;text-transform:none}
html.lang-ar .lkp-pill{text-transform:none}
html.lang-ar body{line-height:1.55}
/* Things that must stay left-to-right inside an Arabic page */
html.lang-ar :is(input[type=email],input[type=tel],input[type=date],.lkp-code,.loy-email,.loy-nowrap,.loy-pts,.lkp-row-pts,code,pre){direction:ltr;unicode-bidi:isolate}
html.lang-ar :is(.loy-nowrap,.loy-pts){text-align:end}
html.lang-ar td,html.lang-ar th{text-align:start}
html.lang-ar .loy-right,html.lang-ar .loy-pts{text-align:end}
html.lang-ar .loy-kpi::before{inset:0 0 0 auto}
html.lang-ar svg text{direction:ltr}
html.lang-ar .widget-toggle-btn{right:auto;left:14px}
html.lang-ar .widget-sidebar{right:auto;left:-280px;border-left:0;border-right:1px solid var(--border);transition:left .28s cubic-bezier(.4,0,.2,1);box-shadow:8px 0 24px rgba(0,0,0,.2)}
html.lang-ar .widget-sidebar.open{left:0;right:auto}
.lkp-form .search-btn{width:auto;flex:none}

/* Arabic: sidebar on the right, content shifted left of it */
html.lang-ar .sidebar{left:auto;right:0;border-right:0;border-left:1px solid var(--border)}
html.lang-ar .main-area{margin-left:0;margin-right:var(--sidebar-w)}
html.lang-ar .sidebar-nav .tab.active::before{left:auto;right:0;border-radius:3px 0 0 3px}
@media (max-width:768px){html.lang-ar .main-area{margin-right:0}}

/* ── Liquid glass (Customer Lookup + Referrals) ──
   Colour glows sit behind the card (::before) so the blur has something to
   bend; a gradient rim (::after) gives the bright iOS edge. */
.glass-card{
  --g-fill:rgba(255,255,255,.055);--g-fill2:rgba(255,255,255,.015);--g-line:rgba(255,255,255,.10);
  --g-tile:rgba(255,255,255,.045);--g-tile-line:rgba(255,255,255,.09);--g-hi:rgba(255,255,255,.22);
  position:relative;isolation:isolate;overflow:hidden;border-radius:24px;padding:22px;
  background:linear-gradient(140deg,var(--g-fill),var(--g-fill2));
  -webkit-backdrop-filter:blur(28px) saturate(170%);backdrop-filter:blur(28px) saturate(170%);
  border:1px solid var(--g-line);
  box-shadow:inset 0 1px 0 var(--g-hi),inset 0 -1px 0 rgba(255,255,255,.03),0 24px 60px -28px rgba(0,0,0,.75);
}
.glass-card::before{content:"";position:absolute;inset:-20%;z-index:-2;pointer-events:none;filter:blur(40px);opacity:.55;
  background:
    radial-gradient(38% 42% at 8% 4%,rgba(245,158,11,.35),transparent 70%),
    radial-gradient(34% 40% at 96% 10%,rgba(124,58,237,.38),transparent 70%),
    radial-gradient(40% 40% at 60% 108%,rgba(59,130,246,.22),transparent 70%)}
.ref-card::before{background:
    radial-gradient(38% 42% at 92% 4%,rgba(16,185,129,.30),transparent 70%),
    radial-gradient(34% 40% at 4% 18%,rgba(236,72,153,.28),transparent 70%),
    radial-gradient(40% 40% at 40% 110%,rgba(124,58,237,.25),transparent 70%)}
.glass-card::after{content:"";position:absolute;inset:0;border-radius:inherit;padding:1px;pointer-events:none;z-index:-1;
  background:linear-gradient(135deg,rgba(255,255,255,.45),rgba(255,255,255,0) 32%,rgba(255,255,255,0) 68%,rgba(255,255,255,.16));
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;
  mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0)}
.glass-card.lkp-card{border-color:var(--g-line)}

/* glass tiles inside */
.glass-card :is(.lkp-stat,.lkp-voucher,.lkp-row,.lkp-chip,.lkp-input,.lkp-alert,.lkp-table-wrap,.loy-types){
  background:var(--g-tile);border:1px solid var(--g-tile-line);
  -webkit-backdrop-filter:blur(14px) saturate(160%);backdrop-filter:blur(14px) saturate(160%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.10)}
.glass-card :is(.lkp-stat,.lkp-voucher,.lkp-row,.lkp-table-wrap){border-radius:16px}
.glass-card .lkp-input{border-radius:14px}
.glass-card .loy-types{border-radius:12px}
.glass-card .loy-type.active{background:rgba(255,255,255,.12);box-shadow:inset 0 1px 0 rgba(255,255,255,.18),0 2px 8px rgba(0,0,0,.25)}
.glass-card .lkp-chip{border-radius:99px}
.glass-card .lkp-chip.active{background:rgba(245,158,11,.14);border-color:rgba(245,158,11,.55)}
.glass-card .lkp-stat.gold{background:linear-gradient(140deg,rgba(245,158,11,.16),rgba(245,158,11,.04));border-color:rgba(245,158,11,.35)}
.glass-card .lkp-stat.warn{background:linear-gradient(140deg,rgba(239,68,68,.14),rgba(239,68,68,.03));border-color:rgba(239,68,68,.35)}
.glass-card .lkp-alert.warn{background:rgba(245,158,11,.10);border-color:rgba(245,158,11,.35)}
.glass-card .lkp-alert.bad{background:rgba(239,68,68,.10);border-color:rgba(239,68,68,.38)}
.glass-card .lkp-alert.info{background:rgba(96,165,250,.08);border-color:rgba(96,165,250,.30)}
.glass-card :is(.lkp-stat,.lkp-voucher,.lkp-row){transition:transform .25s ease,border-color .2s,box-shadow .25s}
.glass-card :is(.lkp-stat,.lkp-voucher,.lkp-row):hover{transform:translateY(-2px);box-shadow:inset 0 1px 0 rgba(255,255,255,.16),0 12px 28px -14px rgba(0,0,0,.7)}
.glass-card .search-btn{border-radius:14px;box-shadow:inset 0 1px 0 rgba(255,255,255,.35),0 8px 22px -8px rgba(124,58,237,.7)}
.glass-card .lkp-avatar{background:linear-gradient(140deg,rgba(245,158,11,.28),rgba(245,158,11,.06));box-shadow:inset 0 1px 0 rgba(255,255,255,.25)}
.glass-card .lkp-day{background:transparent;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}
.glass-card #lkp-member:not(:empty){border-top-color:var(--g-tile-line)}
.glass-card .bd-table th{background:rgba(255,255,255,.05);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}
.glass-card .bd-table td{border-color:rgba(255,255,255,.06)}
.glass-card .lkp-ev{border-bottom-color:rgba(255,255,255,.06)}
.glass-card .lkp-ev-ic{background:rgba(255,255,255,.06);box-shadow:inset 0 1px 0 rgba(255,255,255,.12)}
.ref-person{display:flex;flex-direction:column;align-items:flex-start;margin:0;text-align:start;color:var(--text)}
.ref-person b{font-size:12.5px}
.ref-person span{font-size:11.5px;color:var(--accent);font-weight:500}
.ref-flagged td{background:rgba(245,158,11,.05)}
.ref-card .loy-card-head{align-items:flex-start}

[data-theme="light"] .glass-card{
  --g-fill:rgba(255,255,255,.72);--g-fill2:rgba(255,255,255,.45);--g-line:rgba(0,0,0,.08);
  --g-tile:rgba(255,255,255,.6);--g-tile-line:rgba(0,0,0,.07);--g-hi:rgba(255,255,255,.9);
  box-shadow:inset 0 1px 0 var(--g-hi),0 24px 60px -30px rgba(30,20,60,.35)}
[data-theme="light"] .glass-card::before{opacity:.35}
[data-theme="light"] .glass-card .loy-type.active{background:rgba(255,255,255,.95)}
@media (prefers-reduced-transparency:reduce){.glass-card,.glass-card *{-webkit-backdrop-filter:none!important;backdrop-filter:none!important}.glass-card{background:var(--surface)}}
.glass-card .lkp-day{background:rgba(17,17,21,.82)}
[data-theme="light"] .glass-card .lkp-day{background:rgba(255,255,255,.85)}

/* Loyalty lookup: return unused vouchers */
.lkp-revert{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:10px 0;padding:10px 12px;border:1px dashed rgba(235,230,152,.45);border-radius:var(--radius-sm);background:rgba(235,230,152,.06)}
.lkp-revert-txt{font-size:13px;color:var(--text2)}
.lkp-revert-txt b{color:var(--text)}
.lkp-revert-btn[disabled]{opacity:.55;cursor:wait}
@media (max-width:600px){.lkp-revert-btn{width:100%}}
