/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

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

:root {
  /* Bicon brand palette — deep navy + cyan accent */
  --blue:        #14b8a6;  /* cyan/teal — primary action color */
  --blue-dark:   #0f9b8a;  /* darker cyan for hover */
  --blue-light:  #f0fdfa;  /* very pale mint background */
  --blue-mid:    #ccfbf1;  /* mint highlight */
  --navy:        #0f2847;  /* deep navy — hero, headers */
  --navy-light:  #1a3a5c;
  --green:       #16a34a;
  --green-light: #dcfce7;
  --red:         #dc2626;
  --red-light:   #fee2e2;
  --amber:       #d97706;
  --amber-light: #fef3c7;
  --purple:      #7c3aed;
  --purple-light:#ede9fe;
  --text:        #0f172a;
  --muted:       #64748b;
  --border:      #e2e8f0;
  --bg:          #f1f5f9;
  --card:        #ffffff;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.06);
  --shadow:      0 4px 16px rgba(0,0,0,0.08);
  --radius:      16px;
  --radius-sm:   10px;
}

/* DARK MODE */
[data-theme="dark"] {
  --text:        #f1f5f9;
  --muted:       #94a3b8;
  --border:      #334155;
  --bg:          #0a1d36;       /* deeper navy backdrop */
  --card:        #102b4a;       /* navy card */
  --navy:        #0a1d36;
  --navy-light:  #1a3a5c;
  --blue-light:  #134e4a;       /* dark teal */
  --blue-mid:    #115e59;
  --green-light: #14532d;
  --red-light:   #450a0a;
  --amber-light: #431407;
  --purple-light:#3b0764;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.3);
  --shadow:      0 4px 16px rgba(0,0,0,0.4);
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  transition: background 0.3s, color 0.3s;
}

/* =========================
   LAYOUT
========================= */
.app-container { max-width: 1100px; margin: 0 auto; padding: 40px 20px 80px; }

/* =========================
   HERO
========================= */
.hero-section { margin-bottom: 24px; }

.hero-content {
  background: linear-gradient(135deg, #0a1d36 0%, #0f2847 60%, #1a3a5c 100%);
  color: white;
  padding: 28px 36px 30px;
  border-radius: 20px;
  box-shadow: 0 14px 40px rgba(15,40,71,0.32);
  position: relative;
  overflow: hidden;
}

/* Subtle dot grid pattern instead of giant circles */
.hero-content::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.13) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to right, transparent 50%, black 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 50%, black 100%);
  pointer-events: none;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  margin-bottom: 10px;
  gap: 16px;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

#heroBrandLogo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(255,255,255,0.16);
  padding: 6px;
  flex-shrink: 0;
  display: none;
}
#heroBrandLogo.is-visible { display: block; }

.hero-content h1 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.4px;
  position: relative;
  margin: 0;
}

.dark-toggle {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.dark-toggle:hover { background: rgba(255,255,255,0.22); }
.dark-toggle:active { transform: scale(0.94); }
.dark-toggle svg { display: block; width: 16px; height: 16px; }

.hero-content p#heroTagline {
  font-size: 14px;
  opacity: 0.82;
  max-width: 580px;
  position: relative;
  font-weight: 400;
  line-height: 1.5;
}

/* =========================
   REMINDER BANNER
========================= */
.reminder-banner {
  display: none;
  background: #fef3c7;
  border: 1.5px solid #fbbf24;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
  color: #92400e;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideDown 0.35s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
[data-theme="dark"] .reminder-banner { background: #431407; border-color: #d97706; color: #fbbf24; }

.reminder-banner button {
  background: none; border: none; cursor: pointer; font-weight: 700;
  color: #92400e; font-size: 13px; white-space: nowrap;
}
[data-theme="dark"] .reminder-banner button { color: #fbbf24; }

/* =========================
   TAB NAVIGATION
========================= */
.tab-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.04);
  flex-wrap: wrap;
  /* Sticky on desktop / wide tablets — keeps tabs visible while scrolling */
  position: sticky;
  top: 12px;
  z-index: 50;
}

.tab-btn {
  flex: 1;
  min-width: 120px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-btn svg {
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.2s, transform 0.2s;
}
.tab-btn:hover svg { opacity: 1; }
.tab-btn.active svg { opacity: 1; }

.tab-btn:hover { background: var(--bg); color: var(--text); }
.tab-btn.active { background: var(--blue); color: white; }

/* =========================
   TAB CONTENT
========================= */
.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: fadeInUp 0.32s ease-out;
}

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

/* =========================
   CARDS
========================= */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.04);
}
[data-theme="dark"] .card { border-color: var(--border); }

.section-title { margin-bottom: 24px; }
.section-title h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.section-title p  { color: var(--muted); font-size: 14px; }

/* =========================
   FORMS
========================= */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.input-group { display: flex; flex-direction: column; gap: 7px; }
.input-group label { font-size: 13px; font-weight: 600; color: var(--text); }
.input-group small { font-size: 11px; color: var(--muted); margin-top: 2px; }

input, select, textarea {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;  /* 16px prevents iOS auto-zoom-on-focus */
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  /* Prevent WebView dropdown transparency bug */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
/* Restore native chevron on selects via SVG arrow */
select {
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%2364748b%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
select option {
  background: var(--card);
  color: var(--text);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.12);
}
input[readonly] {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 600;
  border-color: var(--blue-mid);
}

/* =========================
   PAYMENT TOGGLE
========================= */
.payment-toggle-row {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.payment-label { font-size: 13px; font-weight: 600; }
.toggle-group {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.toggle-btn {
  padding: 9px 20px; border: none; background: var(--card);
  cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit;
  color: var(--muted); transition: background 0.2s, color 0.2s;
}
.toggle-btn:first-child { border-right: 1.5px solid var(--border); }
.toggle-btn.active[data-value="paid"]   { background: var(--green-light); color: var(--green); }
.toggle-btn.active[data-value="unpaid"] { background: var(--amber-light); color: var(--amber); }

/* =========================
   BUTTONS
========================= */
.primary-btn {
  background: var(--blue); color: white; border: none;
  border-radius: var(--radius-sm); padding: 13px 26px;
  font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(20,184,166,0.3);
}
.primary-btn:hover { background: var(--blue-dark); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(20,184,166,0.35); }
.primary-btn:active { transform: translateY(0); }

.secondary-btn {
  background: var(--blue-light); color: var(--blue); border: none;
  border-radius: var(--radius-sm); padding: 10px 16px;
  font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: background 0.2s;
}
.secondary-btn:hover { background: var(--blue-mid); }

/* =========================
   LOW STOCK BANNER
========================= */
.low-stock-banner {
  background: var(--amber-light);
  border: 1.5px solid #fbbf24;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: #92400e;
  margin-top: 16px;
}
[data-theme="dark"] .low-stock-banner { color: #fbbf24; border-color: #d97706; }

/* =========================
   STOCK BADGES
========================= */
.stock-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  white-space: nowrap;
}
.stock-ok  { background: var(--green-light); color: var(--green); }
.stock-low { background: var(--amber-light); color: var(--amber); }
.stock-out { background: var(--red-light);   color: var(--red); }

/* =========================
   DASHBOARD — HERO METRICS
========================= */
.metrics-hero-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.metric-hero {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 18px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.2s;
}

.metric-hero::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--blue);
}

.metric-hero-icon {
  background: var(--blue-light);
  color: var(--blue);
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.metric-hero-icon svg { width: 26px; height: 26px; }
.metric-hero-profit .metric-hero-icon { color: var(--green); }
.metric-hero-profit.is-loss .metric-hero-icon { color: var(--red); }
.metric-hero-profit.is-neutral .metric-hero-icon { color: var(--muted); }

.metric-hero-body { flex: 1; min-width: 0; }

.metric-hero-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.metric-hero-value {
  font-size: 34px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.metric-hero-meta {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* Net profit dynamic states */
.metric-hero-profit::before          { background: var(--green); }
.metric-hero-profit .metric-hero-icon { background: var(--green-light); }
.metric-hero-profit .metric-hero-value { color: var(--green); }

.metric-hero-profit.is-loss::before          { background: var(--red); }
.metric-hero-profit.is-loss .metric-hero-icon { background: var(--red-light); }
.metric-hero-profit.is-loss .metric-hero-value { color: var(--red); }

.metric-hero-profit.is-neutral::before          { background: var(--muted); }
.metric-hero-profit.is-neutral .metric-hero-icon { background: var(--bg); }
.metric-hero-profit.is-neutral .metric-hero-value { color: var(--muted); }

@media (max-width: 720px) {
  .metrics-hero-row { grid-template-columns: 1fr; }
  .metric-hero-value { font-size: 28px; }
}

/* =========================
   DASHBOARD
========================= */
.dashboard-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 20px; margin-bottom: 20px;
}
.dashboard-header h2 { font-size: 22px; font-weight: 700; }
.dashboard-header p  { color: var(--muted); font-size: 14px; margin-top: 4px; }

.filter-box { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.filter-box label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* =========================
   DATE RANGE FILTER
========================= */
.range-filter { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.range-filter > label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.range-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.range-controls > .range-type {
  padding: 8px 12px; font-size: 13px; border-radius: var(--radius-sm);
  min-width: 170px;
}
.range-controls > .range-month,
.range-controls > .range-year {
  padding: 8px 12px; font-size: 13px; border-radius: var(--radius-sm);
  min-width: 120px;
}
.range-custom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-custom input[type="date"] {
  padding: 8px 12px; font-size: 13px; border-radius: var(--radius-sm);
}
.range-sep { color: var(--muted); font-size: 14px; font-weight: 600; }

/* Inline variant for the orders history header */
.inline-range { min-width: 0; }
.inline-range .range-controls { gap: 6px; }

.goal-hint {
  font-size: 12px; color: var(--muted); font-style: italic;
  margin-top: 4px; padding: 8px 12px;
  background: var(--blue-light); border-radius: var(--radius-sm);
  border-left: 3px solid var(--blue);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 24px;
}

.dashboard-card {
  background: var(--card); border-radius: var(--radius-sm); padding: 18px 20px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
[data-theme="dark"] .dashboard-card { border-color: var(--border); }

.dashboard-card h3 {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--muted); margin-bottom: 6px;
}
.dashboard-card span {
  font-size: 22px; font-weight: 700; color: var(--text);
  letter-spacing: -0.4px; font-variant-numeric: tabular-nums;
}

.card-unpaid h3 { color: var(--amber); }
.card-unpaid span { color: var(--amber); }
.card-expense h3 { color: var(--red); }
.card-expense span { color: var(--red); }

/* =========================
   GOAL PROGRESS
========================= */
.goal-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }

.goal-stats {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.goal-stats span:first-child { font-size: 28px; font-weight: 800; color: var(--blue); }
.goal-pct { font-size: 18px; font-weight: 700; color: var(--muted); }

.progress-track {
  width: 100%; height: 14px; background: var(--border);
  border-radius: 999px; overflow: hidden; margin-bottom: 10px;
}
.progress-fill { height: 100%; border-radius: 999px; transition: width 0.6s ease, background 0.4s; }
.goal-msg { font-size: 13px; color: var(--muted); }
.goal-msg svg { display: inline-block; vertical-align: -2px; margin-right: 4px; }

/* Icons inside buttons, banners, badges */
.primary-btn svg, .secondary-btn svg, .empty-cta svg,
.insight-btn svg, .receipt-btn svg, .edit-btn svg, .delete-btn svg {
  vertical-align: -2px;
  margin-right: 4px;
}
.reminder-banner, .low-stock-banner {
  align-items: center;
  gap: 8px;
}
.reminder-banner svg, .low-stock-banner svg { flex-shrink: 0; }

/* =========================
   CHARTS
========================= */
.chart-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.chart-header h3 { font-size: 17px; font-weight: 700; }
.chart-filter-group { display: flex; align-items: center; gap: 10px; }
.chart-filter-group label { font-size: 13px; font-weight: 600; color: var(--muted); }
.chart-filter-group select { padding: 8px 12px; font-size: 13px; }
canvas { width: 100% !important; max-height: 380px; }

/* =========================
   TABLES
========================= */
.table-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.table-header h3 { font-size: 17px; font-weight: 700; }
.table-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.table-actions select { padding: 8px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table th {
  background: var(--bg);
  color: var(--muted);
  text-align: left;
  padding: 13px 18px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
}

/* Zebra striping — even rows get a hint of background */
table tbody tr:nth-child(even) td { background: rgba(0,0,0,0.018); }
[data-theme="dark"] table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.025); }

table tbody tr:last-child td { border-bottom: none; }

/* Hover wins over zebra */
table tbody tr:hover td { background: var(--blue-light); }

.notes-cell { font-size: 12px; color: var(--muted); max-width: 180px; }

/* =========================
   TABLE NUMERIC ALIGNMENT
   Right-align numerical columns + tabular figures so digits stack cleanly.
========================= */

/* Products table — cols: Product | Price | Cost | Margin | Stock | Actions */
#productTable th:nth-child(2),
#productTable th:nth-child(3),
#productTable td:nth-child(2),
#productTable td:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Orders table — cols: Date | Customer | Product | Qty | Revenue | Cost | Profit | Status | Notes | Receipt */
#ordersTable th:nth-child(4),
#ordersTable th:nth-child(5),
#ordersTable th:nth-child(6),
#ordersTable th:nth-child(7),
#ordersTable td:nth-child(4),
#ordersTable td:nth-child(5),
#ordersTable td:nth-child(6),
#ordersTable td:nth-child(7) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Customers table — cols: Customer | Orders | Spent | Outstanding | Top Product | Last */
#customersTable th:nth-child(2),
#customersTable th:nth-child(3),
#customersTable td:nth-child(2),
#customersTable td:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Expenses table — cols: Date | Category | Description | Amount | Action */
#expensesTable th:nth-child(4),
#expensesTable td:nth-child(4) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Unpaid monitor table — cols: Customer | Product | Amount | Date | Days | Action */
#unpaidTable th:nth-child(3),
#unpaidTable td:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* =========================
   EMPTY STATES
========================= */
tr.empty-row td {
  padding: 0 !important;
  background: transparent !important;
  border-bottom: none !important;
  text-align: center !important;
}
tr.empty-row:hover td { background: transparent !important; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
  gap: 6px;
}

.empty-icon {
  font-size: 44px;
  line-height: 1;
  margin-bottom: 10px;
  opacity: 0.9;
  filter: grayscale(0.1);
}

.empty-state h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.2px;
}

.empty-state p {
  font-size: 13px;
  color: var(--muted);
  max-width: 340px;
  line-height: 1.55;
  margin: 0 0 16px;
}

.empty-cta {
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid var(--blue-mid);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.empty-cta:hover { background: var(--blue-mid); transform: translateY(-1px); }
.empty-cta span { transition: transform 0.2s; }
.empty-cta:hover span { transform: translateX(2px); }

/* =========================
   ACTION & RECEIPT BUTTONS
========================= */
.action-buttons { display: flex; gap: 8px; }

.edit-btn, .delete-btn, .receipt-btn {
  border: none; padding: 7px 14px; border-radius: 8px;
  cursor: pointer; font-size: 12px; font-weight: 600;
  font-family: inherit; transition: opacity 0.2s;
}
.edit-btn    { background: var(--blue-mid);  color: var(--blue); }
.delete-btn  { background: var(--red-light); color: var(--red); }
.receipt-btn { background: var(--purple-light); color: var(--purple); }
.edit-btn:hover, .delete-btn:hover, .receipt-btn:hover { opacity: 0.8; }

/* =========================
   BADGES
========================= */
.margin-badge {
  display: inline-block; background: var(--green-light); color: var(--green);
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}

.status-badge {
  border: none; padding: 5px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: opacity 0.2s, transform 0.1s;
}
.status-badge:hover { opacity: 0.8; transform: scale(0.97); }
.badge-paid   { background: var(--green-light); color: var(--green); }
.badge-unpaid { background: var(--amber-light); color: var(--amber); }

.cat-badge {
  display: inline-block; background: var(--blue-light); color: var(--blue);
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
}

/* =========================
   WHATSAPP PARSER
========================= */
.parsed-result {
  margin-top: 20px;
  background: var(--green-light);
  border-radius: var(--radius-sm);
  border: 1.5px solid #bbf7d0;
  padding: 20px;
}
[data-theme="dark"] .parsed-result { border-color: #14532d; }

.parsed-result h4 { font-size: 14px; font-weight: 700; color: var(--green); margin-bottom: 12px; }

.parsed-item {
  display: flex; gap: 10px; align-items: center;
  font-size: 14px; margin-bottom: 8px;
}
.parsed-item span { color: var(--muted); min-width: 80px; font-size: 13px; }

/* =========================
   CUSTOMER DIRECTORY
========================= */
#customersTable td:nth-child(2),
#customersTable td:nth-child(3) { font-weight: 600; }

/* =========================
   EXPENSE SUMMARY
========================= */
.expense-summary {
  display: flex; gap: 16px; margin: 24px 0;
  flex-wrap: wrap;
}
.exp-stat {
  background: var(--bg); border-radius: var(--radius-sm); padding: 16px 20px;
  display: flex; flex-direction: column; gap: 4px; min-width: 160px;
  border: 1px solid var(--border);
}
.exp-stat span  { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.exp-stat strong { font-size: 22px; font-weight: 800; color: var(--red); }

/* =========================
   BREAK-EVEN
========================= */
.be-header { font-size: 15px; color: var(--text); margin-bottom: 16px; }

.be-item {
  background: var(--bg); border-radius: var(--radius-sm); padding: 16px 20px;
  margin-bottom: 10px; border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.be-item.be-danger { background: var(--red-light); border-color: #fca5a5; color: var(--red); }
.be-name  { font-size: 15px; font-weight: 700; }
.be-stats { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.be-stats strong { color: var(--text); }

/* =========================
   AI INSIGHTS
========================= */
.api-key-row { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 28px; }
#apiKeyStatus { font-size: 13px; font-weight: 600; }

.insight-btns {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px;
}
.insight-btn {
  background: var(--blue-light); color: var(--blue); border: 1.5px solid var(--blue-mid);
  border-radius: var(--radius-sm); padding: 11px 20px;
  font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.insight-btn:hover { background: var(--blue-mid); transform: translateY(-1px); }

.insights-loading {
  display: flex; align-items: center; gap: 14px;
  padding: 20px; color: var(--muted); font-size: 14px;
}

.spinner {
  width: 22px; height: 22px; border: 3px solid var(--border);
  border-top-color: var(--blue); border-radius: 50%;
  animation: spin 0.8s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.insights-content {
  background: var(--bg); border-radius: var(--radius-sm); padding: 24px;
  font-size: 14px; line-height: 1.8; color: var(--text);
  border: 1px solid var(--border);
}
.insights-content p  { margin-bottom: 12px; }
.insights-content strong { color: var(--blue); }

/* =========================
   UNPAID TABLE
========================= */
.overdue-yes td { border-left: 3px solid var(--amber); }

/* =========================
   BRANDING TAB
========================= */
.brand-preview {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 28px;
}
.preview-hero {
  padding: 24px 28px; display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, #0a1d36, #0f2847);
  transition: background 0.4s;
}
.preview-appname { font-size: 18px; font-weight: 800; color: white; }
.preview-tagline { font-size: 12px; color: rgba(255,255,255,0.8); margin-top: 3px; }
.preview-chips { padding: 14px 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.preview-btn,
.preview-badge,
.preview-tab {
  background: #14b8a6;
  color: white;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  height: 30px;
  display: inline-flex;
  align-items: center;
  transition: background 0.3s;
}
.preview-badge { border-radius: 999px; }

.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px; margin-bottom: 8px;
}
.brand-block {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.brand-block h4 { font-size: 14px; font-weight: 700; margin-bottom: 14px; }

.logo-upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 24px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: border-color 0.2s, background 0.2s; min-height: 110px;
  justify-content: center;
}
.logo-upload-area:hover { border-color: var(--blue); background: var(--blue-light); }
#logoUploadPrompt { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#logoUploadPrompt p    { font-size: 13px; font-weight: 600; color: var(--text); margin: 0; }
#logoUploadPrompt small { font-size: 11px; color: var(--muted); }

.color-swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.swatch {
  width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent;
  cursor: pointer; transition: transform 0.15s, border-color 0.15s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: var(--text); transform: scale(1.1); }

.custom-color-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.custom-color-row label { font-size: 13px; font-weight: 600; color: var(--muted); }
.custom-color-row input[type="color"] {
  width: 44px; height: 36px; border-radius: 8px; border: 1.5px solid var(--border);
  padding: 2px; cursor: pointer; background: var(--card);
}

.style-options { display: flex; flex-direction: column; gap: 12px; }
.style-opt {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 500; cursor: pointer;
  padding: 8px 4px;
}
.style-opt input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
  margin: 0;
  padding: 0;
}
.style-opt input[type="radio"]:checked {
  border-color: var(--blue);
  background: var(--card);
}
.style-opt input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--blue);
}
.style-opt:has(input:checked) {
  color: var(--text);
  font-weight: 600;
}

/* =========================
   ORDER BASKET
========================= */
.add-item-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.add-item-btn { height: 42px; white-space: nowrap; }

.basket {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.basket-empty {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  font-style: normal;
}
.basket-empty svg { flex-shrink: 0; opacity: 0.55; }
.basket-empty strong { color: var(--blue); font-weight: 600; }
.basket-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.basket-table th {
  background: var(--bg);
  color: var(--muted);
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
}
.basket-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.basket-table tbody tr:last-child td { border-bottom: 1px solid var(--border); }
.basket-table th:nth-child(2), .basket-table th:nth-child(3), .basket-table th:nth-child(4),
.basket-table td:nth-child(2), .basket-table td:nth-child(3), .basket-table td:nth-child(4) { text-align: right; }
.basket-table tfoot td { padding: 14px; font-weight: 700; font-size: 15px; }
.basket-total-label { text-align: right !important; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; font-size: 12px !important; }
.basket-grand-total { color: var(--blue); font-size: 18px !important; font-variant-numeric: tabular-nums; }

.basket-remove {
  background: var(--red-light);
  color: var(--red);
  border: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s, transform 0.1s;
}
.basket-remove:hover { background: var(--red); color: white; }
.basket-remove:active { transform: scale(0.9); }

/* Universal hidden helper for class-based toggling */
.is-hidden { display: none !important; }

/* Tab label swap — show full on desktop, short on mobile */
.tab-label-short { display: none; }
.tab-label-full  { display: inline; }

.multi-badge {
  display: inline-block;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  margin-left: 4px;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
  vertical-align: middle;
}
.multi-badge:hover { background: var(--blue); color: white; }
.multi-badge:active { transform: scale(0.92); }

/* Expandable order items (multi-item orders) */
.order-items-detail {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
}
.order-items-detail.is-expanded { display: block; }
.order-item-line {
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px dashed var(--border);
  line-height: 1.4;
}
.order-item-line:last-child { border-bottom: none; }
.order-item-qty {
  font-weight: 700;
  color: var(--blue);
  min-width: 28px;
}
.order-item-price {
  margin-left: auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* On desktop, empty notes cells still occupy space (just no content) */
/* On mobile (card mode), they're hidden entirely — see media query */

@media (max-width: 720px) {
  .add-item-row { grid-template-columns: 1fr 1fr; }
  .add-item-btn { grid-column: 1 / -1; }
}

/* =========================
   MICRO-INTERACTIONS
========================= */

/* Table rows fade in on render */
@keyframes rowFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
table tbody tr { animation: rowFadeIn 0.28s ease-out; }
tr.empty-row { animation: fadeInUp 0.4s ease-out; }

/* Stat cards lift subtly on hover */
.metric-hero, .dashboard-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: default;
}
.metric-hero:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--blue-mid);
}
[data-theme="dark"] .metric-hero:hover  { box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
[data-theme="dark"] .dashboard-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.4); }

/* Hover lift on product/expense action cards too */
.exp-stat, .be-item, .brand-block {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.exp-stat:hover, .be-item:hover { transform: translateY(-1px); }

/* Tab buttons — smoother active transition */
.tab-btn { transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease; }
.tab-btn:active:not(.active) { transform: scale(0.97); }

/* Insight buttons subtle scale on press */
.insight-btn:active { transform: scale(0.97); }

/* Swatch press feedback */
.swatch:active { transform: scale(0.95); }

/* Smooth color transitions on theme/brand change */
body, .card, .dashboard-card, .metric-hero, .brand-block, .exp-stat, .be-item,
input, select, textarea, .toggle-btn, .tab-btn, .empty-cta {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1024px) {
  /* ---- Container & hero ---- */
  .app-container {
    padding: 16px 12px 92px;  /* bottom padding makes room for fixed nav */
  }
  .hero-section { margin-bottom: 14px; }
  .hero-content {
    padding: 18px 18px 20px;
    border-radius: 14px;
  }
  .hero-content h1 { font-size: 20px; }
  .hero-content p#heroTagline { font-size: 13px; }

  #heroBrandLogo {
    width: 44px;
    height: 44px;
  }
  .dark-toggle { width: 36px; height: 36px; }

  /* ---- BOTTOM TAB BAR (mobile-first nav) ---- */
  .tab-nav {
    position: fixed;
    left: 0; right: 0; top: auto; bottom: 0;
    z-index: 100;
    margin: 0;
    border-radius: 16px 16px 0 0;
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
    background: var(--card);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    border: none;
    border-top: 1px solid var(--border);
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-nav::-webkit-scrollbar { display: none; }

  .tab-btn {
    flex: 1 0 auto;
    min-width: 64px;
    flex-direction: column;
    gap: 3px;
    padding: 6px 4px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.1;
    border-radius: 10px;
    white-space: nowrap;
  }
  .tab-btn svg { width: 20px; height: 20px; opacity: 0.7; }
  .tab-btn.active {
    background: transparent;
    color: var(--blue);
  }
  .tab-btn.active svg { opacity: 1; }
  .tab-btn:hover { background: transparent; }

  /* On mobile: hide full label, show short label */
  .tab-label-full  { display: none; }
  .tab-label-short { display: inline; }

  /* ---- Cards ---- */
  .card {
    padding: 18px 16px;
    border-radius: 14px;
    margin-bottom: 14px;
  }
  .section-title h2 { font-size: 19px; }
  .section-title p  { font-size: 13px; }

  /* ---- Forms ---- */
  .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 14px;
  }
  .input-group label { font-size: 13px; }
  input, select, textarea {
    padding: 13px 14px;
    font-size: 16px;  /* iOS no-zoom rule */
  }
  .primary-btn {
    width: 100%;
    padding: 14px 22px;
    font-size: 15px;
    min-height: 48px;  /* touch target */
  }
  .secondary-btn {
    padding: 11px 16px;
    min-height: 40px;
  }

  /* ---- ORDER BASKET — stacks on mobile ---- */
  .add-item-row {
    grid-template-columns: 1fr;
    padding: 14px;
    gap: 12px;
  }
  .add-item-btn {
    height: 46px;
    width: 100%;
    grid-column: 1;
  }
  .basket-table th,
  .basket-table td {
    padding: 8px 6px;
    font-size: 12px;
  }
  .basket-table th { font-size: 10px; }
  /* On very small screens, hide unit price column to make room */
  @media (max-width: 380px) {
    .basket-table th:nth-child(3),
    .basket-table td:nth-child(3) { display: none; }
  }
  .basket-grand-total { font-size: 16px !important; }
  .basket-empty {
    padding: 18px;
    font-size: 12px;
  }

  /* ---- DASHBOARD ---- */
  .dashboard-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .range-filter { width: 100%; }
  .range-controls .range-type { width: 100%; min-width: 0; }

  .metrics-hero-row { grid-template-columns: 1fr; gap: 12px; }
  .metric-hero {
    padding: 18px 18px;
    border-radius: 14px;
  }
  .metric-hero-icon { width: 44px; height: 44px; border-radius: 10px; }
  .metric-hero-icon svg { width: 22px; height: 22px; }
  .metric-hero-value { font-size: 26px; }
  .metric-hero-meta { font-size: 12px; }

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .dashboard-card { padding: 14px 14px; border-radius: 12px; }
  .dashboard-card h3 { font-size: 10px; margin-bottom: 4px; }
  .dashboard-card span { font-size: 18px; }

  /* ---- GOAL ---- */
  .goal-row { flex-direction: column; align-items: stretch; }
  .goal-row .input-group { max-width: none !important; }
  .goal-row .primary-btn { margin-top: 0 !important; }
  .goal-stats span:first-child { font-size: 22px; }

  /* ---- CHARTS ---- */
  canvas { max-height: 260px; }
  .chart-header { flex-direction: column; align-items: flex-start; gap: 10px; }

  /* ---- TABLES → CARD MODE ---- */
  /* Hide regular tables. Show stacked card list instead. */
  .table-wrapper { border: none; overflow: visible; }
  #productTable thead,
  #ordersTable thead,
  #customersTable thead,
  #expensesTable thead,
  #unpaidTable thead { display: none; }
  #productTable, #ordersTable, #customersTable, #expensesTable, #unpaidTable {
    display: block;
  }
  #productTable tbody, #ordersTable tbody, #customersTable tbody,
  #expensesTable tbody, #unpaidTable tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  #productTable tbody tr, #ordersTable tbody tr, #customersTable tbody tr,
  #expensesTable tbody tr, #unpaidTable tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    padding: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    border-bottom: 1px solid var(--border) !important;
  }
  #productTable tbody tr td, #ordersTable tbody tr td, #customersTable tbody tr td,
  #expensesTable tbody tr td, #unpaidTable tbody tr td {
    padding: 0;
    border: none;
    font-size: 14px;
    background: transparent !important;
  }
  /* Empty state rows on mobile */
  tr.empty-row { display: block !important; padding: 0 !important; background: transparent !important; border: none !important; }
  tr.empty-row td { display: block !important; padding: 0 !important; }

  /* ---- PRODUCT CARD (Setup tab) ----
     Cols: Product | Unit Price | Unit Cost | Margin | Stock | Actions */
  #productTable tbody tr td:nth-child(1) {
    grid-column: 1 / -1;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 6px;
  }
  #productTable tbody tr td:nth-child(2)::before { content: "Price · "; color: var(--muted); font-weight: 500; }
  #productTable tbody tr td:nth-child(3)::before { content: "Cost · ";  color: var(--muted); font-weight: 500; }
  #productTable tbody tr td:nth-child(2), #productTable tbody tr td:nth-child(3) { text-align: left; font-size: 13px; }
  #productTable tbody tr td:nth-child(4) { text-align: left; }
  #productTable tbody tr td:nth-child(5) { text-align: right; }
  #productTable tbody tr td:nth-child(6) {
    grid-column: 1 / -1;
    margin-top: 6px;
    border-top: 1px solid var(--border);
    padding-top: 10px !important;
  }
  #productTable .action-buttons { width: 100%; justify-content: flex-start; gap: 10px; }
  #productTable .edit-btn, #productTable .delete-btn {
    flex: 1; padding: 10px; font-size: 13px; min-height: 40px;
  }

  /* ---- ORDERS CARD ----
     Cols: Date | Customer | Product | Qty | Revenue | Cost | Profit | Status | Notes | Receipt */
  #ordersTable tbody tr {
    grid-template-columns: 1fr auto;
  }
  #ordersTable tbody tr td:nth-child(1) { /* Date */
    grid-column: 1; grid-row: 1;
    font-size: 12px; color: var(--muted);
  }
  #ordersTable tbody tr td:nth-child(8) { /* Status */
    grid-column: 2; grid-row: 1; text-align: right;
  }
  #ordersTable tbody tr td:nth-child(2) { /* Customer */
    grid-column: 1 / -1; grid-row: 2;
    font-weight: 700; font-size: 16px;
  }
  #ordersTable tbody tr td:nth-child(3) { /* Product */
    grid-column: 1 / -1; grid-row: 3;
    color: var(--muted); font-size: 13px;
  }
  #ordersTable tbody tr td:nth-child(4)::before { content: "Qty: "; color: var(--muted); }
  #ordersTable tbody tr td:nth-child(4) { grid-column: 1; grid-row: 4; text-align: left; font-size: 13px; }
  #ordersTable tbody tr td:nth-child(5) { /* Revenue (large) */
    grid-column: 2; grid-row: 4;
    text-align: right;
    font-size: 17px; font-weight: 800; color: var(--text);
  }
  #ordersTable tbody tr td:nth-child(6) { display: none; } /* Cost - hide on mobile */
  #ordersTable tbody tr td:nth-child(7)::before { content: "Profit: "; color: var(--muted); }
  #ordersTable tbody tr td:nth-child(7) { grid-column: 1 / -1; grid-row: 5; text-align: left; font-size: 13px; color: var(--green); }
  #ordersTable tbody tr td:nth-child(9) { /* Notes */
    grid-column: 1 / -1; grid-row: 6;
    font-size: 12px; color: var(--muted);
  }
  #ordersTable tbody tr td:nth-child(9):empty,
  #ordersTable tbody tr td.notes-cell.is-empty { display: none !important; }
  #ordersTable tbody tr td:nth-child(10) { /* Receipt button */
    grid-column: 1 / -1; grid-row: 7;
    margin-top: 6px;
    border-top: 1px solid var(--border);
    padding-top: 10px !important;
  }
  #ordersTable .receipt-btn {
    width: 100%; padding: 11px; font-size: 13px; min-height: 42px;
    justify-content: center; display: inline-flex; align-items: center; gap: 6px;
  }

  /* ---- CUSTOMERS CARD ----
     Cols: Name | Orders | Spent | Outstanding | Top Product | Last Order */
  #customersTable tbody tr td:nth-child(1) {
    grid-column: 1 / -1;
    font-weight: 700; font-size: 16px;
    margin-bottom: 4px;
  }
  #customersTable tbody tr td:nth-child(2)::before { content: "Orders · "; color: var(--muted); font-weight: 500; }
  #customersTable tbody tr td:nth-child(3)::before { content: "Spent · ";  color: var(--muted); font-weight: 500; }
  #customersTable tbody tr td:nth-child(2), #customersTable tbody tr td:nth-child(3) { text-align: left; font-size: 13px; }
  #customersTable tbody tr td:nth-child(4)::before { content: "Owes · "; color: var(--muted); font-weight: 500; }
  #customersTable tbody tr td:nth-child(4) { text-align: left; font-size: 13px; }
  #customersTable tbody tr td:nth-child(5)::before { content: "Top · "; color: var(--muted); font-weight: 500; }
  #customersTable tbody tr td:nth-child(5) { grid-column: 1 / -1; font-size: 13px; }
  #customersTable tbody tr td:nth-child(6)::before { content: "Last · "; color: var(--muted); font-weight: 500; }
  #customersTable tbody tr td:nth-child(6) { grid-column: 1 / -1; font-size: 13px; }

  /* ---- EXPENSES CARD ----
     Cols: Date | Category | Description | Amount | Remove */
  #expensesTable tbody tr td:nth-child(3) { /* Description */
    grid-column: 1 / -1; grid-row: 1;
    font-weight: 700; font-size: 15px;
  }
  #expensesTable tbody tr td:nth-child(1) { /* Date */
    grid-column: 1; grid-row: 2; font-size: 12px; color: var(--muted);
  }
  #expensesTable tbody tr td:nth-child(2) { /* Category */
    grid-column: 2; grid-row: 2; text-align: right;
  }
  #expensesTable tbody tr td:nth-child(4) { /* Amount */
    grid-column: 1 / -1; grid-row: 3;
    font-size: 18px; font-weight: 800; color: var(--red); text-align: left;
  }
  #expensesTable tbody tr td:nth-child(5) { /* Remove */
    grid-column: 1 / -1; grid-row: 4;
    margin-top: 4px;
  }
  #expensesTable .delete-btn { width: 100%; padding: 10px; min-height: 40px; }

  /* ---- UNPAID TABLE ----
     Cols: Customer | Product | Amount | Date | Days Overdue | Action */
  #unpaidTable tbody tr td:nth-child(1) { /* Customer */
    grid-column: 1 / -1; grid-row: 1;
    font-weight: 700; font-size: 16px;
  }
  #unpaidTable tbody tr td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; color: var(--muted); font-size: 13px; }
  #unpaidTable tbody tr td:nth-child(3) { /* Amount */
    grid-column: 1; grid-row: 3; text-align: left;
    font-size: 18px; font-weight: 800; color: var(--amber);
  }
  #unpaidTable tbody tr td:nth-child(5) { grid-column: 2; grid-row: 3; text-align: right; }
  #unpaidTable tbody tr td:nth-child(4) { grid-column: 1 / -1; grid-row: 4; font-size: 12px; color: var(--muted); }
  #unpaidTable tbody tr td:nth-child(6) { grid-column: 1 / -1; grid-row: 5; margin-top: 6px; }
  #unpaidTable .status-badge { width: 100%; padding: 11px; }

  /* ---- TABLE FILTERS (orders history) ---- */
  .table-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .table-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .table-actions select, .table-actions .secondary-btn { width: 100%; }
  .inline-range .range-controls { flex-direction: column; align-items: stretch; }
  .inline-range .range-type { width: 100%; }

  /* ---- AI INSIGHTS / EXPENSES SUMMARY ---- */
  .api-key-row { flex-direction: column; align-items: stretch; }
  .insight-btns { flex-direction: column; }
  .insight-btn { width: 100%; text-align: left; }
  .expense-summary { flex-direction: column; gap: 10px; }
  .exp-stat { width: 100%; }

  /* ---- BRANDING / CUSTOMIZE ---- */
  .brand-grid { grid-template-columns: 1fr; }
  .brand-preview .preview-hero { flex-direction: row; padding: 18px 16px; }
  .preview-appname { font-size: 16px; }
  .preview-tagline { font-size: 11px; }
  .preview-chips { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }

  /* Standardize the chip sizing so "Active" looks consistent */
  .preview-btn, .preview-badge, .preview-tab {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    height: 30px;
  }

  /* Reminder banner on mobile */
  .reminder-banner {
    font-size: 12px;
    padding: 10px 14px;
    flex-direction: column;
    align-items: flex-start;
  }

  /* Payment toggle pills should be larger on mobile */
  .toggle-btn { padding: 11px 18px; font-size: 13px; min-height: 42px; }

  /* Stock badge sizing — make pill-shaped not oval */
  .stock-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    white-space: nowrap;
    line-height: 1.3;
  }
}

/* Tablet refinements (small phones won't see these) */
@media (min-width: 481px) and (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =========================
   ONBOARDING WIZARD
========================= */
.wizard-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: wizardFadeIn 0.25s ease-out;
}
@keyframes wizardFadeIn { from { opacity: 0; } to { opacity: 1; } }

.wizard-card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 28px 24px 24px;
  position: relative;
}

.wizard-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
}
.wizard-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, transform 0.2s;
}
.wizard-dot.is-active {
  background: var(--blue);
  transform: scale(1.4);
}
.wizard-dot.is-done {
  background: var(--blue);
  opacity: 0.5;
}

.wizard-step { display: none; }
.wizard-step.is-active { display: block; animation: stepIn 0.3s ease-out; }
@keyframes stepIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wizard-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 18px;
  background: var(--blue-light);
  color: var(--blue);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wizard-title {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  margin: 0 0 10px;
  color: var(--text);
}
.wizard-text {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  margin: 0 0 18px;
  line-height: 1.5;
}

.wizard-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.wizard-option {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.1s;
  font-family: inherit;
}
.wizard-option:hover { border-color: var(--blue); }
.wizard-option:active { transform: scale(0.98); }
.wizard-option strong { font-size: 15px; font-weight: 700; color: var(--text); }
.wizard-option span   { font-size: 13px; color: var(--muted); }

.wizard-skip {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  padding: 12px;
  margin: 4px auto 0;
  display: block;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.wizard-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 4px;
}
.wizard-input:focus {
  border-color: var(--blue);
  outline: none;
}

.wizard-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.wizard-input-group label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 600;
}
.wizard-input-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
}

.wizard-logo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 6px;
}
.wizard-logo-preview {
  width: 64px;
  height: 64px;
  background: var(--bg);
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
  overflow: hidden;
}
.wizard-logo-preview img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 12px;
}
.wizard-upload-btn {
  background: var(--blue-light);
  color: var(--blue);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.wizard-upload-btn:hover { background: rgba(20,184,166,0.16); }

.wizard-color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin: 16px 0 8px;
  justify-items: center;
}
.wizard-color {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--card);
  box-shadow: 0 0 0 2px var(--border);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  padding: 0;
}
.wizard-color:hover { transform: scale(1.1); }
.wizard-color.is-selected {
  box-shadow: 0 0 0 3px var(--text);
  transform: scale(1.1);
}

.wizard-nav {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}
.wizard-btn-secondary, .wizard-btn-primary {
  flex: 1;
  padding: 13px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: background 0.2s, transform 0.1s;
}
.wizard-btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.wizard-btn-primary {
  background: var(--blue);
  color: white;
}
.wizard-btn-primary:active, .wizard-btn-secondary:active { transform: scale(0.98); }

/* Demo data banner */
.demo-banner {
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  color: #78350f;
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-bottom: 1px solid #fcd34d;
  flex-wrap: wrap;
}
.demo-banner button {
  background: #78350f;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Customer input row with walk-in quick button */
.customer-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.customer-input-row input {
  flex: 1;
  min-width: 0;
}
.walkin-btn {
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--muted);
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.walkin-btn:hover {
  background: var(--blue-light);
  color: var(--blue);
  border-color: var(--blue);
}
.walkin-btn:active { transform: scale(0.96); }

input.is-walkin {
  background: var(--blue-light) !important;
  color: var(--blue) !important;
  font-style: italic;
}

.label-optional {
  font-weight: normal;
  color: var(--muted);
  font-size: 11px;
  margin-left: 4px;
}

@media (max-width: 480px) {
  .wizard-card { padding: 22px 18px 18px; border-radius: 16px; }
  .wizard-title { font-size: 19px; }
  .wizard-icon  { width: 64px; height: 64px; border-radius: 18px; }
  .wizard-icon svg { width: 36px; height: 36px; }
  .wizard-color { width: 38px; height: 38px; }
  .wizard-color-grid { grid-template-columns: repeat(5, 1fr); gap: 10px; }
}

/* =========================
   FLOATING ACTION BUTTON
========================= */
.fab {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));  /* clear bottom tab bar */
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45), 0 2px 6px rgba(0,0,0,0.15);
  cursor: pointer;
  z-index: 90;
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.fab:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.55), 0 2px 8px rgba(0,0,0,0.2);
}
.fab:active {
  transform: scale(0.95);
}

/* On desktop (no fixed bottom tabs), pull FAB up a bit less */
@media (min-width: 1025px) {
  .fab {
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
  }
}

/* =========================
   CUSTOMER ROWS — tappable
========================= */
.customer-row {
  cursor: pointer;
  transition: background 0.15s;
}
.customer-row:hover {
  background: var(--bg) !important;
}
.customer-row:active {
  background: var(--blue-light) !important;
}

/* =========================
   CUSTOMER DETAIL MODAL
========================= */
.customer-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: cmFade 0.2s ease-out;
}
@keyframes cmFade { from { opacity: 0; } to { opacity: 1; } }

.customer-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.customer-modal-panel {
  position: relative;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px 20px 28px;
  animation: cmSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cmSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Tablet/desktop: center the modal as a card instead of bottom sheet */
@media (min-width: 1025px) {
  .customer-modal { align-items: center; }
  .customer-modal-panel {
    border-radius: 20px;
    margin: 20px;
    max-height: 80vh;
  }
}

.customer-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--bg);
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
  z-index: 1;
}
.customer-modal-close:hover { background: var(--border); color: var(--text); }

.cm-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding-right: 40px;  /* avoid close button */
}
.cm-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  flex-shrink: 0;
}
.cm-name {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  color: var(--text);
}
.cm-phone {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
}
.cm-phone-missing {
  font-style: italic;
  font-size: 12px;
}

.cm-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.cm-stat {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 14px;
}
.cm-stat-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.cm-stat-value {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.cm-stat-warn .cm-stat-value { color: var(--amber); }

.cm-section { margin-bottom: 22px; }
.cm-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 0 0 10px;
}

.cm-products {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cm-product {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 14px;
}
.cm-product-qty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.cm-orders {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cm-order-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13px;
}
.cm-order-meta {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.cm-order-date {
  color: var(--muted);
  font-size: 12px;
}
.cm-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}
.cm-status-paid    { background: var(--green-light); color: var(--green); }
.cm-status-unpaid  { background: var(--amber-light); color: var(--amber); }

.cm-order-product { grid-column: 1; grid-row: 2; color: var(--text); }
.cm-order-amount  {
  grid-column: 2; grid-row: 1 / span 2;
  align-self: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.cm-more {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 10px 0 0;
}

.cm-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.cm-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  text-decoration: none;
  transition: transform 0.1s, background 0.15s;
  min-height: 46px;
}
.cm-action:active { transform: scale(0.98); }
.cm-action-primary {
  background: #25D366;  /* WhatsApp green */
  color: white;
}
.cm-action-primary:hover { background: #20bd58; }
.cm-action-secondary {
  background: var(--blue-light);
  color: var(--blue);
}
.cm-action-secondary:hover { background: rgba(20,184,166,0.16); }
.cm-action-tertiary {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.cm-action-tertiary:hover { background: var(--border); }

/* =========================
   DANGER ZONE (Customize tab)
========================= */
.danger-zone {
  margin-top: 28px;
  padding: 18px;
  background: rgba(220, 38, 38, 0.04);
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: 12px;
}
.danger-zone h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--red);
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.danger-zone p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 14px;
}
.danger-zone p strong { color: var(--text); }

.danger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  background: var(--card);
  color: var(--red);
  border: 1.5px solid var(--red);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.danger-btn:hover {
  background: var(--red);
  color: white;
}
.danger-btn:active { transform: scale(0.97); }

/* =========================
   ORDER ROW ACTIONS
========================= */
.order-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
  white-space: nowrap;
}
/* The cell containing actions should center its content vertically */
#ordersTable td.order-actions {
  vertical-align: middle;
}
#ordersTable .receipt-btn {
  height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.order-edit-btn, .order-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.order-edit-btn:hover {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
}
.order-delete-btn:hover {
  background: var(--red-light);
  border-color: var(--red);
  color: var(--red);
}
.order-edit-btn:active, .order-delete-btn:active { transform: scale(0.92); }

/* On mobile: action buttons go full-width in their grid cell */
@media (max-width: 1024px) {
  #ordersTable tbody tr td.order-actions {
    grid-column: 1 / -1;
    grid-row: 7;
    margin-top: 6px;
    border-top: 1px solid var(--border);
    padding-top: 10px !important;
    display: flex;
    gap: 8px;
  }
  #ordersTable .receipt-btn {
    flex: 1;
  }
  .order-edit-btn, .order-delete-btn {
    width: 42px;
    height: 42px;
  }
}

/* =========================
   EDIT ORDER MODAL
========================= */
.edit-order-panel { max-width: 540px; }
.edit-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.edit-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 480px) {
  .edit-form-row { grid-template-columns: 1fr; }
}
.edit-input-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.edit-input-group input,
.edit-input-group select {
  width: 100%;
}

.edit-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 6px;
}

.edit-basket-list {
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 56px;
}
.edit-basket-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  margin: 14px 0;
}
.edit-basket-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card);
  border-radius: 8px;
}
.edit-basket-item strong { font-size: 14px; display: block; }
.edit-basket-meta {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.edit-basket-remove {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--red-light);
  color: var(--red);
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}
.edit-basket-remove:hover { background: var(--red); color: white; }

.edit-add-row {
  display: grid;
  grid-template-columns: 1fr 80px auto;
  gap: 8px;
  align-items: stretch;
}
@media (max-width: 480px) {
  .edit-add-row { grid-template-columns: 1fr; }
}

.edit-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
}
.edit-total-value {
  font-size: 18px;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

/* Customer modal — expandable orders section */
.cm-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cm-section-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0;
  text-transform: none;
}
.cm-orders-more {
  display: none;
  margin-top: 6px;
}
.cm-orders-more.is-expanded {
  display: flex;
}
.cm-show-more {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.cm-show-more:hover {
  background: var(--blue-light);
  border-color: var(--blue);
}
.cm-show-more:active { transform: scale(0.99); }


/* =====================================================
   NATIVE OVERRIDE (flattened)
   When running as an installed APK (Capacitor), force
   the mobile design regardless of screen width.
===================================================== */
body.is-native .app-container {
  padding: 16px 12px 92px;
}

body.is-native .hero-section {
  margin-bottom: 14px;
}

body.is-native .hero-content {
  padding: 18px 18px 20px;
    border-radius: 14px;
}

body.is-native .hero-content h1 {
  font-size: 20px;
}

body.is-native .hero-content p#heroTagline {
  font-size: 13px;
}

body.is-native #heroBrandLogo {
  width: 44px;
    height: 44px;
}

body.is-native .dark-toggle,
body.is-native .hero-icon-btn {
  width: 30px; height: 30px;
}
body.is-native .dark-toggle svg,
body.is-native .hero-icon-btn svg {
  width: 15px; height: 15px;
}

body.is-native .tab-nav {
  position: fixed;
    left: 0; right: 0; top: auto; bottom: 0;
    z-index: 100;
    margin: 0;
    border-radius: 16px 16px 0 0;
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
    background: var(--card);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    border: none;
    border-top: 1px solid var(--border);
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

body.is-native .tab-nav::-webkit-scrollbar {
  display: none;
}

body.is-native .tab-btn {
  flex: 1 0 auto;
    min-width: 64px;
    flex-direction: column;
    gap: 3px;
    padding: 6px 4px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.1;
    border-radius: 10px;
    white-space: nowrap;
}

body.is-native .tab-btn svg {
  width: 20px; height: 20px; opacity: 0.7;
}

body.is-native .tab-btn.active {
  background: transparent;
    color: var(--blue);
}

body.is-native .tab-btn.active svg {
  opacity: 1;
}

body.is-native .tab-btn:hover {
  background: transparent;
}

body.is-native .tab-label-full {
  display: none;
}

body.is-native .tab-label-short {
  display: inline;
}

body.is-native .card {
  padding: 18px 16px;
    border-radius: 14px;
    margin-bottom: 14px;
}

body.is-native .section-title h2 {
  font-size: 19px;
}

body.is-native .section-title p {
  font-size: 13px;
}

body.is-native .form-grid {
  grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

body.is-native .input-group label {
  font-size: 13px;
}

body.is-native input, body.is-native select, body.is-native textarea {
  padding: 13px 14px;
    font-size: 16px;
}

body.is-native .primary-btn {
  width: 100%;
    padding: 14px 22px;
    font-size: 15px;
    min-height: 48px;
}

body.is-native .secondary-btn {
  padding: 11px 16px;
    min-height: 40px;
}

body.is-native .add-item-row {
  grid-template-columns: 1fr;
    padding: 14px;
    gap: 12px;
}

body.is-native .add-item-btn {
  height: 46px;
    width: 100%;
    grid-column: 1;
}

body.is-native .basket-table th, body.is-native .basket-table td {
  padding: 8px 6px;
    font-size: 12px;
}

body.is-native .basket-table th {
  font-size: 10px;
}

@media (max-width: 380px) {
body.is-native .basket-table th:nth-child(3), body.is-native .basket-table td:nth-child(3) {
  display: none;
}
}

body.is-native .basket-grand-total {
  font-size: 16px !important;
}

body.is-native .basket-empty {
  padding: 18px;
    font-size: 12px;
}

body.is-native .dashboard-header {
  flex-direction: column; align-items: flex-start; gap: 12px;
}

body.is-native .range-filter {
  width: 100%;
}

body.is-native .range-controls .range-type {
  width: 100%; min-width: 0;
}

body.is-native .metrics-hero-row {
  grid-template-columns: 1fr; gap: 12px;
}

body.is-native .metric-hero {
  padding: 18px 18px;
    border-radius: 14px;
}

body.is-native .metric-hero-icon {
  width: 44px; height: 44px; border-radius: 10px;
}

body.is-native .metric-hero-icon svg {
  width: 22px; height: 22px;
}

body.is-native .metric-hero-value {
  font-size: 26px;
}

body.is-native .metric-hero-meta {
  font-size: 12px;
}

body.is-native .dashboard-grid {
  grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

body.is-native .dashboard-card {
  padding: 14px 14px; border-radius: 12px;
}

body.is-native .dashboard-card h3 {
  font-size: 10px; margin-bottom: 4px;
}

body.is-native .dashboard-card span {
  font-size: 18px;
}

body.is-native .goal-row {
  flex-direction: column; align-items: stretch;
}

body.is-native .goal-row .input-group {
  max-width: none !important;
}

body.is-native .goal-row .primary-btn {
  margin-top: 0 !important;
}

body.is-native .goal-stats span:first-child {
  font-size: 22px;
}

body.is-native canvas {
  max-height: 260px;
}

body.is-native .chart-header {
  flex-direction: column; align-items: flex-start; gap: 10px;
}

body.is-native .table-wrapper {
  border: none; overflow: visible;
}

body.is-native #productTable thead, body.is-native #ordersTable thead, body.is-native #customersTable thead, body.is-native #expensesTable thead, body.is-native #unpaidTable thead {
  display: none;
}

body.is-native #productTable, body.is-native #ordersTable, body.is-native #customersTable, body.is-native #expensesTable, body.is-native #unpaidTable {
  display: block;
}

body.is-native #productTable tbody, body.is-native #ordersTable tbody, body.is-native #customersTable tbody, body.is-native #expensesTable tbody, body.is-native #unpaidTable tbody {
  display: flex;
    flex-direction: column;
    gap: 10px;
}

body.is-native #productTable tbody tr, body.is-native #ordersTable tbody tr, body.is-native #customersTable tbody tr, body.is-native #expensesTable tbody tr, body.is-native #unpaidTable tbody tr {
  display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    padding: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    border-bottom: 1px solid var(--border) !important;
}

body.is-native #productTable tbody tr td, body.is-native #ordersTable tbody tr td, body.is-native #customersTable tbody tr td, body.is-native #expensesTable tbody tr td, body.is-native #unpaidTable tbody tr td {
  padding: 0;
    border: none;
    font-size: 14px;
    background: transparent !important;
}

body.is-native tr.empty-row {
  display: block !important; padding: 0 !important; background: transparent !important; border: none !important;
}

body.is-native tr.empty-row td {
  display: block !important; padding: 0 !important;
}

body.is-native #productTable tbody tr td:nth-child(1) {
  grid-column: 1 / -1;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 6px;
}

body.is-native #productTable tbody tr td:nth-child(2)::before {
  content: "Price · "; color: var(--muted); font-weight: 500;
}

body.is-native #productTable tbody tr td:nth-child(3)::before {
  content: "Cost · ";  color: var(--muted); font-weight: 500;
}

body.is-native #productTable tbody tr td:nth-child(2), body.is-native #productTable tbody tr td:nth-child(3) {
  text-align: left; font-size: 13px;
}

body.is-native #productTable tbody tr td:nth-child(4) {
  text-align: left;
}

body.is-native #productTable tbody tr td:nth-child(5) {
  text-align: right;
}

body.is-native #productTable tbody tr td:nth-child(6) {
  grid-column: 1 / -1;
    margin-top: 6px;
    border-top: 1px solid var(--border);
    padding-top: 10px !important;
}

body.is-native #productTable .action-buttons {
  width: 100%; justify-content: flex-start; gap: 10px;
}

body.is-native #productTable .edit-btn, body.is-native #productTable .delete-btn {
  flex: 1; padding: 10px; font-size: 13px; min-height: 40px;
}

body.is-native #ordersTable tbody tr {
  grid-template-columns: 1fr auto;
}

body.is-native #ordersTable tbody tr td:nth-child(1) {
  grid-column: 1; grid-row: 1;
    font-size: 12px; color: var(--muted);
}

body.is-native #ordersTable tbody tr td:nth-child(8) {
  grid-column: 2; grid-row: 1; text-align: right;
}

body.is-native #ordersTable tbody tr td:nth-child(2) {
  grid-column: 1 / -1; grid-row: 2;
    font-weight: 700; font-size: 16px;
}

body.is-native #ordersTable tbody tr td:nth-child(3) {
  grid-column: 1 / -1; grid-row: 3;
    color: var(--muted); font-size: 13px;
}

body.is-native #ordersTable tbody tr td:nth-child(4)::before {
  content: "Qty: "; color: var(--muted);
}

body.is-native #ordersTable tbody tr td:nth-child(4) {
  grid-column: 1; grid-row: 4; text-align: left; font-size: 13px;
}

body.is-native #ordersTable tbody tr td:nth-child(5) {
  grid-column: 2; grid-row: 4;
    text-align: right;
    font-size: 17px; font-weight: 800; color: var(--text);
}

body.is-native #ordersTable tbody tr td:nth-child(6) {
  display: none;
}

body.is-native #ordersTable tbody tr td:nth-child(7)::before {
  content: "Profit: "; color: var(--muted);
}

body.is-native #ordersTable tbody tr td:nth-child(7) {
  grid-column: 1 / -1; grid-row: 5; text-align: left; font-size: 13px; color: var(--green);
}

body.is-native #ordersTable tbody tr td:nth-child(9) {
  grid-column: 1 / -1; grid-row: 6;
    font-size: 12px; color: var(--muted);
}

body.is-native #ordersTable tbody tr td:nth-child(9):empty, body.is-native #ordersTable tbody tr td.notes-cell.is-empty {
  display: none !important;
}

body.is-native #ordersTable tbody tr td:nth-child(10) {
  grid-column: 1 / -1; grid-row: 7;
    margin-top: 6px;
    border-top: 1px solid var(--border);
    padding-top: 10px !important;
}

body.is-native #ordersTable .receipt-btn {
  width: 100%; padding: 11px; font-size: 13px; min-height: 42px;
    justify-content: center; display: inline-flex; align-items: center; gap: 6px;
}

body.is-native #customersTable tbody tr td:nth-child(1) {
  grid-column: 1 / -1;
    font-weight: 700; font-size: 16px;
    margin-bottom: 4px;
}

body.is-native #customersTable tbody tr td:nth-child(2)::before {
  content: "Orders · "; color: var(--muted); font-weight: 500;
}

body.is-native #customersTable tbody tr td:nth-child(3)::before {
  content: "Spent · ";  color: var(--muted); font-weight: 500;
}

body.is-native #customersTable tbody tr td:nth-child(2), body.is-native #customersTable tbody tr td:nth-child(3) {
  text-align: left; font-size: 13px;
}

body.is-native #customersTable tbody tr td:nth-child(4)::before {
  content: "Owes · "; color: var(--muted); font-weight: 500;
}

body.is-native #customersTable tbody tr td:nth-child(4) {
  text-align: left; font-size: 13px;
}

body.is-native #customersTable tbody tr td:nth-child(5)::before {
  content: "Top · "; color: var(--muted); font-weight: 500;
}

body.is-native #customersTable tbody tr td:nth-child(5) {
  grid-column: 1 / -1; font-size: 13px;
}

body.is-native #customersTable tbody tr td:nth-child(6)::before {
  content: "Last · "; color: var(--muted); font-weight: 500;
}

body.is-native #customersTable tbody tr td:nth-child(6) {
  grid-column: 1 / -1; font-size: 13px;
}

body.is-native #expensesTable tbody tr td:nth-child(3) {
  grid-column: 1 / -1; grid-row: 1;
    font-weight: 700; font-size: 15px;
}

body.is-native #expensesTable tbody tr td:nth-child(1) {
  grid-column: 1; grid-row: 2; font-size: 12px; color: var(--muted);
}

body.is-native #expensesTable tbody tr td:nth-child(2) {
  grid-column: 2; grid-row: 2; text-align: right;
}

body.is-native #expensesTable tbody tr td:nth-child(4) {
  grid-column: 1 / -1; grid-row: 3;
    font-size: 18px; font-weight: 800; color: var(--red); text-align: left;
}

body.is-native #expensesTable tbody tr td:nth-child(5) {
  grid-column: 1 / -1; grid-row: 4;
    margin-top: 4px;
}

body.is-native #expensesTable .delete-btn {
  width: 100%; padding: 10px; min-height: 40px;
}

body.is-native #unpaidTable tbody tr td:nth-child(1) {
  grid-column: 1 / -1; grid-row: 1;
    font-weight: 700; font-size: 16px;
}

body.is-native #unpaidTable tbody tr td:nth-child(2) {
  grid-column: 1 / -1; grid-row: 2; color: var(--muted); font-size: 13px;
}

body.is-native #unpaidTable tbody tr td:nth-child(3) {
  grid-column: 1; grid-row: 3; text-align: left;
    font-size: 18px; font-weight: 800; color: var(--amber);
}

body.is-native #unpaidTable tbody tr td:nth-child(5) {
  grid-column: 2; grid-row: 3; text-align: right;
}

body.is-native #unpaidTable tbody tr td:nth-child(4) {
  grid-column: 1 / -1; grid-row: 4; font-size: 12px; color: var(--muted);
}

body.is-native #unpaidTable tbody tr td:nth-child(6) {
  grid-column: 1 / -1; grid-row: 5; margin-top: 6px;
}

body.is-native #unpaidTable .status-badge {
  width: 100%; padding: 11px;
}

body.is-native .table-header {
  flex-direction: column; align-items: stretch; gap: 12px;
}

body.is-native .table-actions {
  flex-direction: column; align-items: stretch; gap: 10px;
}

body.is-native .table-actions select, body.is-native .table-actions .secondary-btn {
  width: 100%;
}

body.is-native .inline-range .range-controls {
  flex-direction: column; align-items: stretch;
}

body.is-native .inline-range .range-type {
  width: 100%;
}

body.is-native .api-key-row {
  flex-direction: column; align-items: stretch;
}

body.is-native .insight-btns {
  flex-direction: column;
}

body.is-native .insight-btn {
  width: 100%; text-align: left;
}

body.is-native .expense-summary {
  flex-direction: column; gap: 10px;
}

body.is-native .exp-stat {
  width: 100%;
}

body.is-native .brand-grid {
  grid-template-columns: 1fr;
}

body.is-native .brand-preview .preview-hero {
  flex-direction: row; padding: 18px 16px;
}

body.is-native .preview-appname {
  font-size: 16px;
}

body.is-native .preview-tagline {
  font-size: 11px;
}

body.is-native .preview-chips {
  padding: 12px 16px; flex-wrap: wrap; gap: 8px;
}

body.is-native .preview-btn, body.is-native .preview-badge, body.is-native .preview-tab {
  padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    height: 30px;
}

body.is-native .reminder-banner {
  font-size: 12px;
    padding: 10px 14px;
    flex-direction: column;
    align-items: flex-start;
}

body.is-native .toggle-btn {
  padding: 11px 18px; font-size: 13px; min-height: 42px;
}

body.is-native .stock-badge {
  display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    white-space: nowrap;
    line-height: 1.3;
}

body.is-native #ordersTable tbody tr td.order-actions {
  grid-column: 1 / -1;
    grid-row: 7;
    margin-top: 6px;
    border-top: 1px solid var(--border);
    padding-top: 10px !important;
    display: flex;
    gap: 8px;
}

body.is-native #ordersTable .receipt-btn {
  flex: 1;
}

body.is-native .order-edit-btn, body.is-native .order-delete-btn {
  width: 42px;
    height: 42px;
}

/* =========================
   COMPARISON BADGES
   "+12.4% vs last month" pill under metric values
========================= */
.metric-compare {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  margin-top: 8px;
  line-height: 1.3;
  white-space: nowrap;
  background: var(--bg);
  color: var(--muted);
  width: fit-content;
}
.metric-compare:empty { display: none; }
.metric-compare .compare-arrow {
  font-weight: 800;
  font-size: 13px;
}

/* Color polarity */
.metric-compare.compare-good {
  background: var(--green-light);
  color: var(--green);
}
.metric-compare.compare-bad {
  background: var(--red-light);
  color: var(--red);
}
.metric-compare.compare-flat {
  background: var(--bg);
  color: var(--muted);
}

/* Smaller variant for secondary cards */
.metric-compare-sm {
  font-size: 10px;
  padding: 2px 7px;
  margin-top: 4px;
  gap: 2px;
}
.metric-compare-sm .compare-arrow { font-size: 11px; }

/* =========================
   HERO ACTIONS — gear + dark toggle stacked side-by-side
========================= */
.hero-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.hero-icon-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.16);
  color: white;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.hero-icon-btn:hover { background: rgba(255,255,255,0.22); }
.hero-icon-btn:active { transform: scale(0.94); }
.hero-icon-btn svg { width: 16px; height: 16px; display: block; }

/* =========================
   GEAR DROPDOWN MENU
========================= */
.gear-menu {
  position: fixed;
  top: 70px;
  right: 16px;
  width: 280px;
  max-width: calc(100% - 32px);
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  z-index: 200;
  overflow: hidden;
  animation: gearFadeIn 0.18s ease-out;
}
@keyframes gearFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.gear-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 14px 16px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: var(--text);
  transition: background 0.12s;
}
.gear-menu-item + .gear-menu-item {
  border-top: 1px solid var(--border);
}
.gear-menu-item:hover, .gear-menu-item:active {
  background: var(--blue-light);
}
.gmi-icon {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--blue-light);
  color: var(--blue);
  border-radius: 10px;
  flex-shrink: 0;
}
.gmi-text { flex: 1; min-width: 0; }
.gmi-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.gmi-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}
.gmi-chev {
  color: var(--muted);
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}

/* =========================
   CUSTOMER DIRECTORY — visual refresh
========================= */
.customers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cd-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.18s, border-color 0.12s;
  position: relative;
}
.cd-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15,40,71,0.08);
  border-color: var(--blue-mid);
}
.cd-card:active { transform: scale(0.99); }

/* Avatar */
.cd-avatar {
  position: relative;
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(15,40,71,0.18);
}
.cd-crown {
  position: absolute;
  top: -4px; right: -4px;
  background: #fbbf24;
  color: white;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 800;
  border: 2px solid var(--card);
}

/* Body — main info column */
.cd-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cd-line1 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cd-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cd-status {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cd-status-active   { background: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,0.15); }
.cd-status-recent   { background: var(--blue);  box-shadow: 0 0 0 3px rgba(20,184,166,0.15); }
.cd-status-owes     { background: var(--amber); box-shadow: 0 0 0 3px rgba(217,119,6,0.15); }
.cd-status-inactive { background: #cbd5e1; }

.cd-line2 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.cd-spent {
  color: var(--blue);
  font-weight: 800;
  font-size: 15px;
}
.cd-dot {
  color: var(--muted);
}
.cd-orders {
  color: var(--muted);
  font-weight: 500;
}

.cd-line3 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.cd-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--blue-light);
  color: var(--blue);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cd-chip-dot {
  width: 5px; height: 5px;
  background: var(--blue);
  border-radius: 50%;
  flex-shrink: 0;
}
.cd-last {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.cd-owes-row {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--amber-light);
  padding: 6px 10px;
  border-radius: 8px;
  border-left: 3px solid var(--amber);
}
.cd-owes-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cd-owes-amount {
  font-size: 13px;
  font-weight: 800;
  color: var(--amber);
}

/* Chevron */
.cd-chev {
  color: var(--muted);
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
  align-self: center;
  flex-shrink: 0;
  opacity: 0.5;
}

/* Empty state */
.customer-empty {
  text-align: center;
  padding: 50px 24px;
  color: var(--muted);
}
.customer-empty svg {
  margin: 0 auto 14px;
  color: var(--muted);
  opacity: 0.5;
  display: block;
}
.customer-empty h3 {
  color: var(--text);
  font-size: 16px;
  margin-bottom: 6px;
}
.customer-empty p {
  font-size: 13px;
  margin: 0 auto 18px;
  max-width: 320px;
  line-height: 1.5;
}

/* Customer directory controls — search + sort */
.cd-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.cd-controls input[type="text"] {
  flex: 1;
  min-width: 200px;
  max-width: 380px;
}
.cd-controls select {
  min-width: 170px;
  flex-shrink: 0;
}

/* On narrow mobile, stack the controls so each is full-width */
body.is-native .cd-controls {
  flex-direction: column;
  align-items: stretch;
}
body.is-native .cd-controls input[type="text"],
body.is-native .cd-controls select {
  width: 100%;
  max-width: none;
}

/* =========================
   DEMO MODE BANNER (web-only)
   Displayed at the very top of the page when window.BICON_DEMO_MODE is set.
   Doesn't appear in the APK build.
========================= */
.demo-mode-banner {
  position: sticky;
  top: 0;
  z-index: 500;
  background: linear-gradient(90deg, #0f2847 0%, #14b8a6 100%);
  color: white;
  padding: 10px 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}
.dmb-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.dmb-message {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.4;
}
.dmb-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #5eead4;
  box-shadow: 0 0 0 0 rgba(94,234,212,0.6);
  animation: dmbPulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes dmbPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(94,234,212,0.6); }
  50%      { box-shadow: 0 0 0 8px rgba(94,234,212, 0); }
}
.dmb-sub {
  opacity: 0.85;
  font-weight: 400;
}
.dmb-cta {
  background: white;
  color: #0f2847;
  padding: 7px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.dmb-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* On phones, stack message and CTA */
@media (max-width: 600px) {
  .dmb-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .dmb-cta {
    text-align: center;
  }
  .dmb-sub { display: none; }
}
