/* ═══════════════════════════════════════════════════════════════
   SPARK AGENT — Base44 UI Redesign
   Fonts: Oswald (headings) + Inter (body)
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Base44 Design System Colors (HSL → Hex) */
  --bg: #0F1B2D;           /* hsl(213 55% 11%) */
  --card-bg: #152238;      /* hsl(213 45% 15%) */
  --primary: #F28C28;      /* hsl(27 88% 55%) - Orange */
  --secondary: #4A9BA5;    /* hsl(184 38% 47%) - Teal */
  --muted-bg: #1F2D42;     /* hsl(213 40% 20%) */
  --muted-text: #8899AA;   /* hsl(210 20% 60%) */
  --destructive: #E84545;  /* hsl(0 84% 60%) */
  --border: var(--primary); /* Orange borders for KPIs */
  --emerald: #10B981;
  --emerald-text: #34D399;
  
  /* Additional status colors */
  --green: #10B981;
  --red: #E84545;
  --amber: #FFB547;
  
  /* Typography */
  --font-heading: 'Oswald', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Spacing */
  --spacing-1: 4px;
  --spacing-2: 8px;
  --spacing-3: 12px;
  --spacing-4: 16px;
  --spacing-6: 24px;
  
  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-full: 9999px;
  
  /* Bottom nav height */
  --bottom-nav-height: 72px;

  /* ── Legacy variable aliases (used by 130+ inline styles) ── */
  --s1: #152238;
  --s2: #1F2D42;
  --s3: #263750;
  --border2: rgba(255, 255, 255, 0.11);
  --text: #e8edf5;
  --text2: #8899AA;
  --text3: #4a6080;
  --shark: #F28C28;
  --shark-dim: rgba(242, 140, 40, 0.09);
  --shark-glow: rgba(242, 140, 40, 0.22);
  --teal: #4A9BA5;
  --teal-dim: rgba(74, 155, 165, 0.1);
  --teal-glow: rgba(74, 155, 165, 0.2);
  --fd: 'Barlow Condensed', 'Oswald', sans-serif;
  --fb: 'Inter', sans-serif;
  --fm: 'JetBrains Mono', monospace;
  --nav-h: 72px;
  --hdr-h: 52px;
  --green-dim: rgba(16, 185, 129, 0.07);
  --red-dim: rgba(228, 69, 69, 0.07);
  --amber-dim: rgba(255, 181, 71, 0.08);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.07);
}

/* ═══════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: white;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* Subtle gradient overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: 
    radial-gradient(ellipse 80% 50% at 10% 0%, rgba(242,140,40,0.04) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(74,155,165,0.035) 0%, transparent 50%);
}

/* ═══════════════════════════════════════════════════════════════
   LAYOUT CONTAINERS
   ═══════════════════════════════════════════════════════════════ */

.app-container {
  position: relative;
}

.metric-card {
  border: 1px solid var(--orange);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
  background: var(--bg);
}

.page {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--spacing-4);
  padding-bottom: calc(var(--bottom-nav-height) + var(--spacing-4));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  background: var(--bg);
  z-index: 2;
}

.page.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 3;
}

/* ═══════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

.subtitle {
  font-size: 12px;
  color: var(--muted-text);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* ═══════════════════════════════════════════════════════════════
   CARDS & CONTAINERS
   ═══════════════════════════════════════════════════════════════ */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--spacing-4);
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.4s ease forwards;
}

.card:nth-child(1) { animation-delay: 0.03s; }
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.09s; }
.card:nth-child(4) { animation-delay: 0.12s; }
.card:nth-child(5) { animation-delay: 0.15s; }
.card:nth-child(6) { animation-delay: 0.18s; }

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

.card:active {
  transform: scale(0.98);
}

/* ═══════════════════════════════════════════════════════════════
   PAGE HEADERS
   ═══════════════════════════════════════════════════════════════ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-4);
}

.page-header h1 {
  flex: 1;
}

.back-btn {
  background: none;
  border: none;
  color: var(--muted-text);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  margin-right: var(--spacing-3);
  line-height: 1;
}

.refresh-btn {
  background: var(--muted-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--muted-text);
}

.refresh-btn svg {
  width: 16px;
  height: 16px;
}

.refresh-btn:active {
  transform: scale(0.95);
  color: var(--primary);
}

.refresh-btn.spinning svg {
  animation: spin 1s linear infinite;
}

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

/* ═══════════════════════════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════════════════════════ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-3);
  margin-bottom: var(--spacing-3);
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--orange);
  border-radius: var(--radius-md);
  padding: var(--spacing-4);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.kpi-value {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: white;
}

.kpi-label {
  font-size: 11px;
  color: var(--muted-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-subtitle {
  font-size: 10px;
  color: var(--muted-text);
  margin-top: -4px;
}

/* ═══════════════════════════════════════════════════════════════
   PROGRESS BARS
   ═══════════════════════════════════════════════════════════════ */

.progress-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--spacing-4);
  margin-bottom: var(--spacing-3);
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-2);
}

.progress-label {
  font-size: 12px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-pct {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-text);
}

.progress-track {
  height: 12px;
  background: var(--muted-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--spacing-2);
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  width: 0;
  transition: width 1s ease-out;
}

.progress-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.progress-actual {
  font-family: var(--font-mono);
  color: var(--primary);
  font-weight: 600;
}

.progress-goal {
  color: var(--muted-text);
}

/* ═══════════════════════════════════════════════════════════════
   APP SHELL — Header, Logo, Sync, Toast, PTR, Install Bar
   ═══════════════════════════════════════════════════════════════ */

.header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 27, 45, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.logo:active { opacity: 0.7; }

.logo-bolt {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(242, 140, 40, 0.22);
}

.logo-bolt svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: #000;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--secondary);
}

.logo-sub {
  font-size: 9px;
  color: var(--muted-text);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-top: -3px;
}

.hdr-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 500;
}

.sync-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.sync-live .sync-dot {
  background: var(--emerald);
  animation: ldot 2.5s infinite;
}

.sync-live { color: var(--emerald); }

.sync-syncing .sync-dot { background: var(--amber); }
.sync-syncing { color: var(--amber); }

@keyframes ldot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.hdr-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted-text);
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.hdr-btn:active {
  border-color: var(--primary);
  color: white;
}

.hdr-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 11px;
  color: var(--muted-text);
  z-index: 300;
  opacity: 0;
  transition: all 0.28s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--emerald);
}

/* Pull-to-refresh */
.ptr-zone {
  position: relative;
  z-index: 5;
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--muted-bg);
  transition: height 0.2s;
  flex-shrink: 0;
}

.ptr-zone.open { height: 42px; }

.ptr-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted-text);
}

.ptr-spin {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border);
  border-top-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Main content container */
.main {
  flex: 1;
  overflow: hidden;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

/* Install prompt bar — overlays, doesn't push content */
.install-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: rgba(242, 140, 40, 0.12);
  border-bottom: 1px solid rgba(242, 140, 40, 0.15);
  padding: 9px 16px;
  z-index: 25;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.install-bar.show { display: flex; }

.install-txt {
  font-size: 12px;
  color: var(--primary);
}

.install-btn {
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-body);
}

.install-x {
  background: none;
  border: none;
  color: var(--muted-text);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  line-height: 1;
}

/* More menu buttons — HIDDEN (legacy, replaced by quick-access + bottom nav) */
.more-menu-btn {
  display: none !important;
}

/* Version screen overlay */
.ver-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: none;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0);
}

.ver-screen.open { display: flex; }

.ver-screen-hdr {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ver-screen-back {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-text);
}

.ver-screen-back svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ver-screen-title {
  font-size: 16px;
  font-weight: 600;
  color: white;
}

.ver-screen-sub {
  font-size: 11px;
  color: var(--muted-text);
  margin-top: 1px;
}

.ver-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

/* Versions overlay (full screen) */
.versions-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--bg);
  display: none;
  flex-direction: column;
}

.versions-overlay.show { display: flex; }

.versions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 27, 45, 0.96);
  backdrop-filter: blur(24px);
}

.versions-title {
  font-family: var(--font-heading);
  font-size: 20px;
  letter-spacing: 1.5px;
  color: var(--primary);
}

.versions-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted-text);
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.versions-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.versions-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted-text);
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════
   QUICK ACCESS ICONS — Premium App Store Quality
   ═══════════════════════════════════════════════════════════════ */

.quick-access {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  margin-bottom: var(--spacing-3);
  -webkit-overflow-scrolling: touch;
  justify-content: center;
}

.quick-access::-webkit-scrollbar {
  display: none;
}

.quick-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 60px;
  cursor: pointer;
  transition: transform 0.2s;
}

.quick-icon:active {
  transform: scale(0.92);
}

.quick-icon-circle {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: all 0.2s;
}

.quick-icon-circle svg {
  width: 22px;
  height: 22px;
  position: relative;
  z-index: 1;
}

/* Subtle shimmer on each icon */
.quick-icon-circle::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 100%);
  border-radius: 14px 14px 0 0;
}

.quick-icon-label {
  font-size: 10px;
  color: var(--muted-text);
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════════
   STATUS BADGES
   ═══════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-completed {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
}

.badge-scheduled {
  background: rgba(74, 155, 165, 0.2);
  color: #4A9BA5;
}

.badge-open {
  background: rgba(242, 140, 40, 0.2);
  color: #F28C28;
}

.badge-canceled, .badge-rejected {
  background: rgba(228, 69, 69, 0.2);
  color: #E84545;
}

.badge-inprogress {
  background: rgba(255, 181, 71, 0.2);
  color: #FFB547;
}

.badge-sold {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
}

.badge-expired {
  background: rgba(136, 153, 170, 0.2);
  color: #8899AA;
}

/* ═══════════════════════════════════════════════════════════════
   FILTER PILLS
   ═══════════════════════════════════════════════════════════════ */

.filter-pills {
  display: flex;
  gap: var(--spacing-2);
  overflow-x: auto;
  padding: var(--spacing-2) 0;
  margin-bottom: var(--spacing-3);
  -webkit-overflow-scrolling: touch;
}

.filter-pills::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--muted-text);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.filter-pill:active {
  transform: scale(0.95);
}

.filter-pill.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.pill-count {
  opacity: 0.7;
  font-size: 11px;
  margin-left: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   SEARCH BARS
   ═══════════════════════════════════════════════════════════════ */

.search-bar {
  position: relative;
  margin-bottom: var(--spacing-3);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted-text);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 12px 12px 40px;
  color: white;
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
}

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

/* ═══════════════════════════════════════════════════════════════
   LIST ITEMS (Jobs, Customers, Estimates, etc.)
   ═══════════════════════════════════════════════════════════════ */

.list-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--spacing-4);
  margin-bottom: var(--spacing-2);
  cursor: pointer;
  transition: all 0.2s;
}

.list-item:active {
  transform: scale(0.98);
}

.list-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--spacing-2);
}

.list-item-title {
  font-weight: 600;
  color: white;
  font-size: 14px;
}

.list-item-subtitle {
  font-size: 12px;
  color: var(--muted-text);
  margin-top: 2px;
}

.list-item-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.list-item-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted-text);
}

.list-item-expandable {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.list-item-expandable.open {
  max-height: 500px;
  padding-top: var(--spacing-3);
  border-top: 1px solid var(--border);
  margin-top: var(--spacing-3);
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */

.btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  min-height: 44px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: var(--secondary);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted-text);
}

.btn-destructive {
  background: var(--destructive);
}

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: var(--spacing-6) var(--spacing-4);
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--spacing-4);
  background: var(--muted-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-text);
}

.empty-icon svg {
  width: 32px;
  height: 32px;
}

.empty-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  color: white;
  margin-bottom: var(--spacing-2);
}

.empty-subtitle {
  font-size: 14px;
  color: var(--muted-text);
}

/* ═══════════════════════════════════════════════════════════════
   BOTTOM NAVIGATION
   ═══════════════════════════════════════════════════════════════ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--navy);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 var(--spacing-2);
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--spacing-2);
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  max-width: 80px;
}

.nav-item:active {
  transform: scale(0.95);
}

.nav-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  color: var(--muted-text);
  transition: color 0.2s;
}

.nav-item.active .nav-icon {
  background: rgba(242, 140, 40, 0.15);
}

.nav-item.active .nav-icon svg {
  color: var(--primary);
}

.nav-label {
  font-size: 10px;
  color: var(--muted-text);
  transition: color 0.2s;
  font-weight: 500;
}

.nav-item.active .nav-label {
  color: var(--primary);
}

/* ═══════════════════════════════════════════════════════════════
   SPARK AI — Chat Interface
   ═══════════════════════════════════════════════════════════════ */

/* Chat messages container */
.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msgs::-webkit-scrollbar { width: 2px; }
.chat-msgs::-webkit-scrollbar-thumb { background: var(--border); }

/* Message row */
.msg {
  display: flex;
  gap: 9px;
  max-width: 100%;
}

.msg.user { flex-direction: row-reverse; }

/* Avatars */
.msg-av {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  margin-top: 1px;
}

.av-spark {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-family: var(--font-heading);
  font-size: 13px;
  letter-spacing: 0.5px;
}

.av-user {
  background: var(--muted-bg);
  border: 1px solid var(--border);
  color: var(--muted-text);
}

/* Chat bubbles */
.bubble {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
}

.spark-bubble {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: white;
  border-top-left-radius: 3px;
}

.user-bubble {
  background: rgba(242, 140, 40, 0.09);
  border: 1px solid rgba(242, 140, 40, 0.13);
  color: white;
  border-top-right-radius: 3px;
}

.msg-time {
  font-size: 10px;
  color: var(--muted-text);
  margin-top: 3px;
}

.msg.user .msg-time { text-align: right; }

/* Typing indicator */
.typing {
  display: flex;
  gap: 4px;
  padding: 3px 0;
}

.typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  animation: tdot 1.2s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes tdot {
  0%, 60%, 100% { opacity: 0.2; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* Follow-up suggestions in bot messages */
.follow-ups {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 9px;
}

.fup {
  background: var(--muted-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-family: var(--font-body);
}

.fup:active {
  background: rgba(242, 140, 40, 0.09);
  border-color: var(--primary);
}

/* Chip row */
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 4px 14px 8px;
  flex-shrink: 0;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px 11px;
  font-size: 11px;
  color: var(--muted-text);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body);
  white-space: nowrap;
  flex-shrink: 0;
}

.chip:active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(242, 140, 40, 0.09);
}

/* Voice status */
.voice-status {
  font-size: 11px;
  text-align: center;
  padding: 5px 14px;
  display: none;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.voice-status.show { display: block; }
.voice-status.dictate-mode { color: var(--amber); }
.voice-status.convo-mode { color: var(--primary); animation: jarvisFlicker 2s infinite; }

@keyframes jarvisFlicker {
  0%, 100% { opacity: 1; }
  45% { opacity: 0.7; }
  50% { opacity: 1; }
  55% { opacity: 0.85; }
  60% { opacity: 1; }
}

/* API mode pill */
.api-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(167, 139, 250, 0.07);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 10px;
  color: #a78bfa;
  margin: 0 14px 6px;
  flex-shrink: 0;
}

.api-mode-pill.active {
  background: rgba(16, 185, 129, 0.07);
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--emerald);
}

.api-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* Input bar */
.input-bar {
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0));
  border-top: 1px solid var(--border);
  background: rgba(15, 27, 45, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-end;
  gap: 7px;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: var(--muted-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 13px;
  color: white;
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  resize: none;
  max-height: 96px;
  overflow-y: auto;
  transition: border-color 0.15s;
  line-height: 1.4;
}

.chat-input:focus { border-color: var(--secondary); }
.chat-input::placeholder { color: var(--muted-text); }

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.send-btn:active { opacity: 0.85; }

.send-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #000;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Dictate button */
.dictate-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--muted-bg);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  color: var(--muted-text);
}

.dictate-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dictate-btn.active {
  background: rgba(255, 181, 71, 0.08);
  border-color: var(--amber);
  color: var(--amber);
  animation: dpulse 1s infinite;
}

@keyframes dpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 181, 71, 0.3); }
  50% { box-shadow: 0 0 0 5px rgba(255, 181, 71, 0); }
}

/* Voice conversation button — "Talk to Spark" */
.voice-convo-wrap {
  display: flex;
  justify-content: center;
  padding: 4px 0;
  flex-shrink: 0;
}

.voice-convo-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 16px;
  -webkit-tap-highlight-color: transparent;
}

.voice-convo-btn:active { transform: scale(0.95); }

.vcb-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
  z-index: 1;
}

.vcb-icon svg {
  width: 20px;
  height: 20px;
  color: var(--muted-text);
}

.voice-convo-btn.active .vcb-icon {
  border-color: var(--primary);
  background: rgba(242, 140, 40, 0.09);
  box-shadow: 0 0 20px rgba(242, 140, 40, 0.2);
}

.voice-convo-btn.active .vcb-icon svg {
  color: var(--primary);
}

.vcb-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-text);
  letter-spacing: 0.3px;
}

.voice-convo-btn.active .vcb-label {
  color: var(--primary);
}

/* Animated rings around voice button when active */
.vcb-rings {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% - 6px));
  width: 48px;
  height: 48px;
  pointer-events: none;
  display: none;
}

.voice-convo-btn.active .vcb-rings { display: block; }

.vcb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--primary);
  opacity: 0;
}

.voice-convo-btn.active .vcb-ring {
  animation: voiceRing 2s ease-out infinite;
}

.vcb-ring.r2 { animation-delay: 0.5s !important; }
.vcb-ring.r3 { animation-delay: 1s !important; }

@keyframes voiceRing {
  0% { transform: scale(1); opacity: 0.4; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Convo button (in input bar) */
.convo-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--muted-bg);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  color: var(--muted-text);
}

.convo-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.convo-btn.active {
  background: rgba(242, 140, 40, 0.09);
  border-color: var(--primary);
  color: var(--primary);
  animation: cpulse 1.4s infinite;
}

@keyframes cpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 140, 40, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(242, 140, 40, 0); }
}

/* ═══════════════════════════════════════════════════════════════
   LEGACY COMMON STYLES — used by old tab-pages
   ═══════════════════════════════════════════════════════════════ */

/* Spark AI needs flex column layout for chat/input stacking */
#page-spark {
  display: none;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden;
  padding-bottom: var(--bottom-nav-height) !important;
}

#page-spark.active {
  display: flex;
}

#page-spark .page-header {
  padding: 12px 16px 4px;
}

/* Suggestions area should scroll with chat, not be fixed */
#sparkSuggestions {
  padding: 0 14px;
  flex-shrink: 0;
}

/* Input bar sticks to bottom above nav */
#page-spark .input-bar {
  padding-bottom: 10px;
}

/* Pricebook needs flex column layout */
#page-pricebook {
  display: none;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden;
  padding-bottom: var(--bottom-nav-height) !important;
}

#page-pricebook.active { display: flex; }

.sec-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted-text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.sec-label .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   SETTINGS — Connection items, toggles, setting rows
   ═══════════════════════════════════════════════════════════════ */

.conn-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.conn-item:last-child { border-bottom: none; }

.conn-l {
  display: flex;
  align-items: center;
  gap: 10px;
}

.conn-ico {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--muted-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.conn-ico svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.conn-name {
  font-size: 13px;
  font-weight: 500;
}

.conn-status {
  font-size: 10px;
  color: var(--muted-text);
}

.conn-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  transition: all 0.15s;
}

.btn-connect {
  background: rgba(242, 140, 40, 0.09);
  color: var(--primary);
  border: 1px solid rgba(242, 140, 40, 0.18);
}

.btn-connect:active {
  background: var(--primary);
  color: #000;
}

.btn-connected {
  background: rgba(16, 185, 129, 0.07);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.18);
  cursor: default;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child { border-bottom: none; }

.sr-lbl {
  font-size: 13px;
  font-weight: 500;
}

.sr-sub {
  font-size: 11px;
  color: var(--muted-text);
  margin-top: 2px;
}

.sr-input {
  background: var(--muted-bg);
  border: 1px solid var(--border);
  color: white;
  border-radius: 6px;
  padding: 5px 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  width: 80px;
  outline: none;
  text-align: right;
}

.toggle {
  width: 38px;
  height: 20px;
  border-radius: 10px;
  background: var(--muted-bg);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle.on {
  background: var(--primary);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.toggle.on::after {
  transform: translateX(18px);
}

.danger-btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  background: rgba(228, 69, 69, 0.07);
  border: 1px solid rgba(228, 69, 69, 0.18);
  color: var(--destructive);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  margin-top: 4px;
}

.notif-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   PRICEBOOK
   ═══════════════════════════════════════════════════════════════ */

.pb-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 27, 45, 0.95);
  flex-shrink: 0;
}

.pb-search-wrap {
  position: relative;
}

.pb-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--muted-text);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.pb-search {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: white;
  border-radius: 10px;
  padding: 10px 14px 10px 38px;
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  color-scheme: dark;
  transition: border-color 0.2s;
}

.pb-search:focus { border-color: var(--secondary); }
.pb-search::placeholder { color: var(--muted-text); }

.pb-cats {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 14px 0;
  flex-shrink: 0;
}

.pb-cats::-webkit-scrollbar { display: none; }

.pb-cat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-text);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.pb-cat.active {
  background: rgba(242, 140, 40, 0.09);
  border-color: var(--primary);
  color: var(--primary);
}

.pb-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px 80px;
  background: var(--bg);
}

.pb-list::-webkit-scrollbar { width: 2px; }
.pb-list::-webkit-scrollbar-thumb { background: var(--border); }

.pb-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px;
  margin-bottom: 8px;
}

.pb-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
}

.pb-item-name {
  font-size: 13px;
  font-weight: 600;
  color: white;
  flex: 1;
  padding-right: 10px;
  line-height: 1.3;
}

.pb-item-price {
  font-family: var(--font-heading);
  font-size: 22px;
  color: var(--emerald);
  flex-shrink: 0;
}

.pb-item-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.pb-meta-pill {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--muted-bg);
  color: var(--muted-text);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}

.pb-item-desc {
  font-size: 11px;
  color: var(--muted-text);
  line-height: 1.5;
  margin-bottom: 8px;
}

.pb-item-code {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--muted-text);
}

.pb-qty-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--muted-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 12px;
}

.pb-qty-lbl {
  font-size: 11px;
  color: var(--muted-text);
  flex: 1;
}

.pb-add-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(242, 140, 40, 0.09);
  border: 1px solid rgba(242, 140, 40, 0.2);
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
  transition: all 0.12s;
}

.pb-add-btn:active {
  background: var(--primary);
  color: #000;
}

.pb-edit-field {
  background: var(--muted-bg);
  border: 1px solid var(--border);
  color: white;
  border-radius: 5px;
  padding: 3px 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  outline: none;
  width: 70px;
  text-align: right;
}

.pb-edit-field:focus {
  border-color: rgba(242, 140, 40, 0.5);
}

/* Pricebook row items (render.js uses these) */
.pb-row {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: all 0.2s;
}

.pb-row.editing { border-color: var(--primary); }

.pb-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.pb-row-main:active { background: var(--muted-bg); }
.pb-row.editing .pb-row-main { cursor: default; }

.pb-row-left { flex: 1; min-width: 0; }

.pb-row-name {
  font-size: 13px;
  font-weight: 500;
  color: white;
  margin-bottom: 4px;
}

.pb-row-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pb-tag {
  background: var(--muted-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 9px;
  color: var(--muted-text);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pb-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.pb-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--emerald);
}

.pb-val-sm {
  font-size: 10px;
  color: var(--muted-text);
  font-family: var(--font-mono);
}

.pb-edit-panel {
  padding: 12px;
  background: var(--muted-bg);
  border-top: 1px solid var(--border);
}

.pb-edit-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.pb-edit-row label {
  flex: 0 0 100px;
  font-size: 11px;
  color: var(--muted-text);
  font-weight: 500;
}

.pb-edit-row input,
.pb-edit-row textarea {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  color: white;
  font-family: var(--font-body);
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.pb-edit-row input:focus,
.pb-edit-row textarea:focus {
  border-color: var(--primary);
}

.pb-edit-row textarea {
  resize: vertical;
  min-height: 50px;
}

.pb-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.pb-btn-cancel,
.pb-btn-save {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.pb-btn-cancel {
  background: var(--muted-bg);
  border: 1px solid var(--border);
  color: var(--muted-text);
}

.pb-btn-save {
  background: var(--primary);
  border: none;
  color: #000;
}

/* ═══════════════════════════════════════════════════════════════
   LEAD SOURCES & IPAD ROSTER
   ═══════════════════════════════════════════════════════════════ */

.lead-source-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.lead-source-item:last-child { border-bottom: none; }

.ls-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ls-name-wrap { flex: 1; }

.ls-display-name {
  font-size: 13px;
  font-weight: 500;
}

.ls-type {
  font-size: 10px;
  color: var(--muted-text);
}

.ls-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ls-remove {
  background: none;
  border: none;
  color: var(--muted-text);
  cursor: pointer;
  font-size: 16px;
  padding: 3px;
  transition: color 0.15s;
}

.ls-remove:active { color: var(--destructive); }

/* ═══════════════════════════════════════════════════════════════
   VERSION HISTORY ENTRIES
   ═══════════════════════════════════════════════════════════════ */

.ver-entry {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 14px;
  margin-bottom: 9px;
  transition: border-color 0.15s;
}

.ver-entry.current {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.02);
}

.ver-entry-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ver-entry-name {
  font-size: 13px;
  font-weight: 600;
  color: white;
}

.ver-entry-time {
  font-size: 10px;
  color: var(--muted-text);
}

.ver-entry-desc {
  font-size: 11px;
  color: var(--muted-text);
}

.ver-restore-btn {
  background: rgba(242, 140, 40, 0.09);
  border: 1px solid rgba(242, 140, 40, 0.2);
  color: var(--primary);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  width: 100%;
  margin-top: 10px;
  transition: all 0.15s;
}

.ver-restore-btn:active {
  background: var(--primary);
  color: #000;
}

.ver-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted-text);
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .page {
    max-width: 1200px;
    margin: 0 auto;
  }
}

/* ═══════════════════════════════════════════════════════════════
   LEGACY AUTH SCREEN (Keep for PIN entry)
   ═══════════════════════════════════════════════════════════════ */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-3);
  margin-bottom: var(--spacing-6);
}

.auth-bolt {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-bolt svg {
  width: 32px;
  height: 32px;
  stroke: #000;
  stroke-width: 2.5;
}

.auth-title {
  font-family: var(--font-heading);
  font-size: 32px;
  letter-spacing: 4px;
  color: var(--secondary);
}

.auth-sub {
  font-size: 11px;
  color: var(--muted-text);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.pin-input {
  display: flex;
  gap: var(--spacing-3);
  margin-bottom: var(--spacing-6);
}

/* PIN dots — horizontal row */
.pin-dots {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 6px;
  z-index: 1;
}

.pin-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: all 0.15s;
}

.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(242, 140, 40, 0.22);
  transform: scale(1.1);
}

.pin-dot.error {
  background: var(--destructive);
  border-color: var(--destructive);
  animation: dot-shake 0.4s ease-in-out;
}

.pin-dot.success {
  background: var(--emerald);
  border-color: var(--emerald);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

@keyframes dot-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Auth error message */
.auth-err {
  color: var(--destructive);
  font-size: 11px;
  text-align: center;
  margin-bottom: 8px;
  opacity: 0;
  transition: opacity 0.2s;
  min-height: 16px;
  z-index: 1;
}

.auth-err.show { opacity: 1; }

/* PIN keypad */
.pin-keypad,
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  width: 100%;
  max-width: 260px;
  z-index: 1;
}

.pin-key {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 13px;
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
  -webkit-user-select: none;
}

.pin-key:active {
  background: rgba(242, 140, 40, 0.09);
  border-color: var(--primary);
  transform: scale(0.94);
  box-shadow: 0 0 10px rgba(242, 140, 40, 0.22);
}

.pin-key-num {
  font-family: var(--font-heading);
  font-size: 26px;
  color: white;
  letter-spacing: 0.5px;
  line-height: 1;
}

/* Hide letter labels — numeric only for clean look */
.pin-key-alpha {
  display: none;
}

.pin-key-del {
  font-size: 20px;
  color: var(--muted-text);
}

.pin-key-empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.pin-key-empty:active {
  background: transparent;
  border-color: transparent;
  transform: none;
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════
   BASE44 BADGES — Phase 2
   ═══════════════════════════════════════════════════════════════ */

.b44-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  margin-top: 4px;
}
.b44-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.b44-badge-green { background: rgba(16,185,129,0.15); color: var(--emerald); border: 1px solid rgba(16,185,129,0.25); }
.b44-badge-green::before { background: var(--emerald); }
.b44-badge-orange { background: rgba(242,140,40,0.15); color: var(--primary); border: 1px solid rgba(242,140,40,0.25); }
.b44-badge-orange::before { background: var(--primary); }
.b44-badge-red { background: rgba(228,69,69,0.15); color: var(--destructive); border: 1px solid rgba(228,69,69,0.25); }
.b44-badge-red::before { background: var(--destructive); }
.b44-badge-teal { background: rgba(74,155,165,0.15); color: var(--secondary); border: 1px solid rgba(74,155,165,0.25); }
.b44-badge-teal::before { background: var(--secondary); }
.b44-badge-muted { background: rgba(136,153,170,0.12); color: var(--muted-text); border: 1px solid rgba(136,153,170,0.2); }
.b44-badge-muted::before { background: var(--muted-text); }

/* ═══════════════════════════════════════════════════════════════
   JOBS PAGE — page-jobs
   ═══════════════════════════════════════════════════════════════ */

#page-jobs .filter-pills {
  padding: 0 0 4px;
}

/* ═══════════════════════════════════════════════════════════════
   AR PAGE BUCKETS
   ═══════════════════════════════════════════════════════════════ */

.ar-bucket-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.ar-bucket {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.ar-bucket:active { transform: scale(0.96); }
.ar-bucket.active { border-color: var(--primary); background: rgba(242,140,40,0.08); }

/* ═══════════════════════════════════════════════════════════════
   SPARK AI — rebuilt chat shell
   ═══════════════════════════════════════════════════════════════ */

.ai-suggestion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 20px 0;
}
.ai-suggestion-chip {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: white;
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
  transition: all 0.2s;
  min-height: 44px;
}
.ai-suggestion-chip:active {
  transform: scale(0.96);
  border-color: var(--secondary);
}
.ai-suggestion-chip .chip-icon {
  display: block;
  font-size: 16px;
  margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   CUSTOMERS PAGE — restyled search bar
   ═══════════════════════════════════════════════════════════════ */

.cust-search-wrap {
  position: relative;
  margin-bottom: 12px;
}
.cust-search-wrap .cust-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted-text);
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cust-search {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 12px 12px 40px;
  color: white;
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.cust-search:focus { border-color: var(--primary); }
.cust-search::placeholder { color: var(--muted-text); }

/* ═══════════════════════════════════════════════════════════════
   STALE DATA INDICATOR — BUG-018
   ═══════════════════════════════════════════════════════════════ */

.stale-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,181,71,0.08);
  border: 1px solid rgba(255,181,71,0.15);
  border-radius: 20px;
  font-size: 11px;
  color: var(--amber);
  margin-bottom: 8px;
}
.stale-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   TAB-PAGE VISIBILITY — BUG-021
   ═══════════════════════════════════════════════════════════════ */
.tab-page {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--spacing-4);
  padding-bottom: calc(var(--bottom-nav-height) + var(--spacing-4));
  background: var(--bg);
  z-index: 2;
}
.tab-page.active {
  display: block;
  z-index: 3;
}

/* ── OFFLINE BAR ────────────────────────────────────────── */
.offline-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--amber, #ecb22e);
  color: #000;
  font-family: var(--font-body, 'Barlow', sans-serif);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 7px 16px;
  letter-spacing: 0.2px;
}
.offline-bar.visible {
  display: block;
}

/* ── NAV BADGES ─────────────────────────────────────────── */
.nav-icon {
  position: relative;
}
.nav-badge {
  display: none;
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--red, #ff4560);
  color: #fff;
  font-family: var(--font-body, 'Barlow', sans-serif);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}
.nav-badge.visible {
  display: block;
}

/* ── PAGE TRANSITIONS ───────────────────────────────────── */
.page {
  transition: opacity 0.15s ease;
}
.tab-page {
  transition: opacity 0.15s ease;
}

/* ── SKELETONS ───────────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--s2) 25%, var(--s1) 50%, var(--s2) 75%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-text    { height: 14px; margin-bottom: 8px; width: 80%; }
.skeleton-heading { height: 28px; width: 50%; margin-bottom: 16px; }
.skeleton-card    { height: 130px; border-radius: 12px; margin-bottom: 12px; }
.skeleton-bar     { height: 80px;  border-radius: 12px; margin-bottom: 12px; }
.skeleton-row     { height: 72px;  border-radius: 12px; margin-bottom: 8px;  }
.skeleton-kpi     { height: 140px; border-radius: 12px; }
.skeleton-container .kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

/* ── ERROR STATES ────────────────────────────────────────── */
.error-state       { text-align: center; padding: 48px 24px; }
.error-state-icon  { font-size: 32px; margin-bottom: 12px; }
.error-state-title { font-family: var(--font-heading,'Barlow Condensed',sans-serif); font-size: 16px; font-weight: 700; text-transform: uppercase; color: white; margin-bottom: 4px; }
.error-state-sub   { font-size: 13px; color: var(--muted-text); margin-bottom: 16px; }
.error-state .btn  { display: inline-block; }

/* ── SELF-EDIT PREVIEW CARD ──────────────────────────────── */
.self-edit-preview  { background: var(--s2); border: 1px solid var(--shark,#4A9BA5); border-radius: 12px; padding: 14px; margin: 8px 0; }
.self-edit-header   { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--shark,#4A9BA5); }
.self-edit-summary  { font-size: 13px; color: white; margin-bottom: 10px; line-height: 1.5; }
.self-edit-meta     { font-size: 11px; color: var(--muted-text); margin-bottom: 12px; }
.self-edit-risk-low    { color: var(--green,#2eb886); }
.self-edit-risk-medium { color: var(--amber,#ecb22e); }
.self-edit-risk-high   { color: var(--red,#ff4560); }
.self-edit-actions     { display: flex; gap: 8px; }
.self-edit-deploy  { flex: 1; background: var(--orange,#F28C28); color: #000; border: none; border-radius: 8px; padding: 10px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: var(--font-body,'Barlow',sans-serif); }
.self-edit-deploy:disabled { opacity: 0.6; cursor: default; }
.self-edit-cancel  { background: var(--s1); border: 1px solid var(--border); color: var(--muted-text); border-radius: 8px; padding: 10px 16px; font-size: 13px; cursor: pointer; font-family: var(--font-body,'Barlow',sans-serif); }
