/* MyBillingApp shared theme layer.
   Component styling follows the public website design system (mba web: tailwind.config.ts, globals.css,
   components/ui): white surfaces with line borders, ink text, solid brand CTAs, 12/16/24px radii.
   Tokens live in app.css :root. Loaded after every page/vertical stylesheet so shared components stay consistent. */

/* Skip link: clipped instead of pushed off-screen, so RTL pages don't gain a sideways scroll. */
.skip:not(:focus) {
  left: auto;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus { left: 8px; right: auto; top: 8px; }
[dir="rtl"] .skip:focus { left: auto; right: 8px; }

/* ===== Surfaces ===== */
.app-body { background: var(--background); }
html[data-theme="dark"] .app-body { background: var(--background); }

.content:not(:has(.dash)) { padding: 22px 24px 48px; }
.content:has(.dash) { background: var(--background); }
.content.fade-up { animation: mbaPageIn var(--motion-slow) var(--ease-out) both; }
@keyframes mbaPageIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ===== Page header (text-section: display 700, -0.015em, 1.12) ===== */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; margin-bottom: 18px; flex-wrap: wrap; min-width: 0; }
.page-head h1,
.page-head h2,
.ws-head h1,
.pharm-header h1,
.gym-header h1,
.rst-header h1,
.inf-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.12;
  color: var(--text);
}
.page-head p,
.ws-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; font-weight: 500; max-width: 60ch; }
.page-breadcrumb,
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.page-breadcrumb a,
.breadcrumb a { color: var(--primary); }
.page-breadcrumb a:hover,
.breadcrumb a:hover { text-decoration: underline; }
.ws-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; min-width: 0; }
.ws-head .icon-btn {
  width: var(--icon-btn); height: var(--icon-btn); border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm);
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px; color: var(--text);
}

/* Greeting block: brand eyebrow (text-eyebrow), then a text-hero heading */
.dash-hero-kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}
.dash-greeting,
.pharm-dash .pharm-header h1,
.gym-dash .gym-header h1,
.rst-dash .rst-header h1,
.inf-dash .inf-header h1 {
  margin: 6px 0 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--text);
}
.dash-welcome-line { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.dash-welcome-line strong { color: var(--text); font-weight: 800; }
.pharm-header .dash-welcome-line,
.gym-header .dash-welcome-line,
.rst-header .dash-welcome-line,
.inf-header .dash-welcome-line { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary); }
.pharm-header .dash-welcome-line strong,
.gym-header .dash-welcome-line strong,
.rst-header .dash-welcome-line strong,
.inf-header .dash-welcome-line strong { color: inherit; font-weight: 700; }
.dash-subtitle,
.pharm-header p,
.gym-header p,
.rst-header p,
.inf-header p { color: var(--text-muted); font-size: 13.5px; font-weight: 500; }

/* ===== Cards (rounded-2xl, border surface-line, white, shadow-soft; hover shadow-card) ===== */
.card,
.mba-card,
.mba-glass-card,
.mba-table-card,
.mba-form-card,
.mba-chart-card,
.mba-detail-card,
.mba-alert-card,
.dash-card,
.dash-premium .dash-card,
.dash-premium .gym-card,
.dash-premium .pharm-card,
.dash-premium .rst-card,
.dash-premium .inf-card,
.gym-dash .gym-card,
.pharm-dash .pharm-card,
.inf-dash .inf-card,
.rst-dash .rst-card,
.cat-page .card,
.gym-card,
.pharm-card,
.inf-card,
.inv-card,
.wallet-card,
.wallet-hero,
.wallet-balance,
.plan-card,
.report-card,
.pay-method-card,
.membership-card {
  position: relative;
  background-color: var(--surface);
  background-image: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  transition: box-shadow var(--motion-base) var(--ease-out), border-color var(--motion-base) var(--ease-out), transform var(--motion-fast) var(--ease-out);
}
.card,
.mba-card { padding: 18px; }
.wallet-hero,
.wallet-balance,
.plan-card,
.report-card,
.pay-method-card,
.membership-card { border-radius: var(--radius-xl) !important; background-color: var(--surface) !important; background-image: none !important; border: 1px solid var(--border) !important; box-shadow: var(--shadow-card) !important; }
a.card:hover,
a.mba-card:hover,
.card[data-href]:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
a.card:active,
a.mba-card:active { transform: scale(0.99); }
html[data-theme="dark"] .card,
html[data-theme="dark"] .mba-card,
html[data-theme="dark"] .dash-card,
html[data-theme="dark"] .dash-premium .dash-card,
html[data-theme="dark"] .gym-card,
html[data-theme="dark"] .pharm-card,
html[data-theme="dark"] .rst-card,
html[data-theme="dark"] .inf-card,
html[data-theme="dark"] .inv-card,
html[data-theme="dark"] .wallet-card {
  background-image: none;
  background-color: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-card);
}
#settings-form > .card,
form.form > .card,
.mba-form-card { margin-bottom: 16px; padding: 20px; }
#settings-form > .card > h2,
#settings-form > .card > h3,
form.form > .card > h2,
form.form > .card > h3,
.card > h2:first-child,
.card > h3:first-child { margin: 0 0 14px; font-size: 16px; font-weight: 700; letter-spacing: -0.015em; color: var(--text); }

/* Section header (text-section title; brand link action) */
.mba-section-head,
.dash-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; min-width: 0; }
.mba-section-head h2,
.dash-actions-head h2,
.dash-section-title { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.3px; color: var(--text); }
.dash-card-head h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.015em; color: var(--text); }
.dash-link,
.mba-section-head a { font-size: 14px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.dash-link:hover,
.mba-section-head a:hover { color: var(--primary-hover); }
.dash-chip {
  font-size: 12.5px; font-weight: 600; color: var(--text-soft);
  padding: 5px 12px; border-radius: 999px;
  background: var(--surface-muted); border: 1px solid var(--border);
}

/* ===== KPI cards (stat cards: white, line border, rounded-2xl) ===== */
.dash-kpi,
.dash-premium .dash-kpi,
.mba-kpi-card,
.stat.card,
.card.stat,
.grid .stat.card,
.grid .card.stat,
.gym-dash .gym-kpi,
.pharm-dash .pharm-kpi,
.inf-dash .inf-kpi,
.rst-dash .rst-kpi,
.gym-kpi,
.pharm-kpi,
.inf-kpi,
.rst-kpi {
  position: relative;
  background-color: var(--surface);
  background-image: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.mba-kpi-card,
.stat.card,
.card.stat,
.grid .stat.card,
.grid .card.stat { display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 12px; min-height: 0; }
a.dash-kpi:hover,
a.gym-kpi:hover,
a.pharm-kpi:hover,
a.inf-kpi:hover,
a.rst-kpi:hover,
a.stat:hover,
a.mba-kpi-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
a.dash-kpi:active,
a.gym-kpi:active,
a.pharm-kpi:active,
a.inf-kpi:active,
a.rst-kpi:active { transform: scale(0.985); }
html[data-theme="dark"] .dash-kpi,
html[data-theme="dark"] .dash-premium .dash-kpi,
html[data-theme="dark"] .mba-kpi-card,
html[data-theme="dark"] .stat.card,
html[data-theme="dark"] .card.stat,
html[data-theme="dark"] .gym-kpi,
html[data-theme="dark"] .pharm-kpi,
html[data-theme="dark"] .inf-kpi,
html[data-theme="dark"] .rst-kpi { background-image: none; background-color: var(--surface); border-color: var(--border); }
.dash-kpi-label,
.stat .label,
.card.stat .label,
.mba-kpi-card .label,
.gym-kpi-label,
.pharm-kpi-label,
.inf-kpi-label,
.rst-kpi-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.25;
  color: var(--text-muted);
}
.dash-kpi-value,
.stat .value,
.card.stat .value,
.mba-kpi-card .value,
.gym-kpi-value,
.pharm-kpi-value,
.inf-kpi-value,
.rst-kpi-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.dash-kpi-hint,
.stat .hint,
.gym-kpi-hint,
.pharm-kpi-hint,
.inf-kpi-hint,
.rst-kpi-hint { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.dash-kpi-trend,
.kpi-trend { font-size: 13px; font-weight: 700; }
.dash-kpi-icon,
.mba-kpi-icon {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--kpi-c, var(--primary)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--kpi-c, var(--primary)) 20%, transparent);
  color: var(--kpi-c, var(--primary));
  box-shadow: none;
  animation: none;
}
.dash-kpi-icon svg,
.mba-kpi-icon svg { width: 19px; height: 19px; }
.dash-kpi--orange { --kpi-c: #ff6b00; }
.dash-kpi--amber { --kpi-c: #d97706; }
.dash-kpi--navy { --kpi-c: #2563eb; }
.dash-kpi--slate { --kpi-c: #475569; }
.dash-kpi--green { --kpi-c: #059669; }
.dash-kpi--blue { --kpi-c: #2563eb; }
.dash-kpi--red { --kpi-c: #dc2626; }
.dash-kpi .dash-kpi-icon { background: color-mix(in srgb, var(--kpi-c, var(--primary)) 12%, transparent); color: var(--kpi-c, var(--primary)); }
.mba-kpi-icon.orange { --kpi-c: #ff6b00; }
.mba-kpi-icon.gold,
.mba-kpi-icon.amber { --kpi-c: #d97706; }
.mba-kpi-icon.blue { --kpi-c: #2563eb; }
.mba-kpi-icon.green { --kpi-c: #059669; }
.mba-kpi-icon.purple { --kpi-c: #7c3aed; }
.mba-kpi-icon.pink { --kpi-c: #db2777; }

/* ===== Buttons (ui/Button: rounded-xl, bold, primary = solid brand + shadow-cta) ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 0; border-radius: var(--radius-field);
  font-size: 15px; font-weight: 700; letter-spacing: 0; line-height: 1.2;
  cursor: pointer; text-decoration: none;
  transition: transform var(--motion-fast) var(--ease-out), box-shadow var(--motion-base) var(--ease-out), background var(--motion-base) var(--ease-out), border-color var(--motion-base) var(--ease-out), filter var(--motion-base) var(--ease-out);
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary,
.btn.btn-primary {
  position: relative;
  overflow: hidden;
  background: var(--cta-gradient);
  color: #fff;
  border: 0;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: var(--shadow-primary); transform: translateY(-2px); color: #fff; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary::after { content: none; }
.btn-primary[disabled],
.btn-primary:disabled,
.btn-primary.is-disabled { background: var(--cta-gradient-disabled); color: #fff; box-shadow: none; opacity: 1; cursor: not-allowed; }
.btn-ghost,
.btn-secondary,
.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn-ghost:hover,
.btn-secondary:hover,
.btn-outline:hover { background: var(--surface); border-color: var(--primary); color: var(--primary); }
html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .btn-outline { background: var(--surface); color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .btn-ghost:hover,
html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] .btn-outline:hover { border-color: var(--primary); color: #fdba74; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: none; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-dark { background: var(--navy); color: #fff; }
.btn-block { width: 100%; min-height: var(--btn-h); font-size: 16px; }
.btn-lg { min-height: var(--btn-h); padding: 0 22px; font-size: 16px; }
.btn-sm,
.table-actions .btn { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: var(--radius-sm); }
.btn[disabled],
.btn:disabled { cursor: not-allowed; opacity: 0.6; }
.btn.loading { opacity: 0.75; pointer-events: none; }

/* ===== Fields (rounded-xl, surface-line border, brand focus ring) ===== */
input:not([type]),
input[type="text"],
input[type="search"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="time"],
input[type="url"],
select,
textarea {
  border-radius: var(--radius-field) !important;
  border: 1px solid var(--line-strong) !important;
  background-color: var(--surface) !important;
  color: var(--text);
  min-height: 48px;
  font-size: 15.5px;
  font-weight: 500;
  transition: border-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
}
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]),
.field select,
.form .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]),
.form .field select { min-height: 52px; padding: 12px 16px; }
.field textarea { min-height: 104px; padding: 14px 16px; }
textarea { min-height: 96px; }
td input:not([type="checkbox"]):not([type="radio"]),
td select,
.item-row input:not([type="checkbox"]):not([type="radio"]),
.item-row select { border-radius: var(--radius-sm) !important; }
input::placeholder,
textarea::placeholder { color: var(--text-muted); opacity: 1; font-weight: 500; }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):focus,
select:focus,
textarea:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.18) !important;
}
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"],
.is-invalid,
.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--danger) !important; }
input[aria-invalid="true"]:focus,
.is-invalid:focus,
.field.has-error input:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16) !important; }
input:disabled,
select:disabled,
textarea:disabled,
.field input:disabled,
.field select:disabled,
.field textarea:disabled { background-color: var(--surface-muted) !important; color: var(--text-muted); opacity: 1; cursor: not-allowed; }
input[type="file"] { font-size: 14px; color: var(--text-muted); max-width: 100%; }
input[type="file"]::file-selector-button {
  margin-right: 12px; min-height: 40px; padding: 0 16px;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
input[type="checkbox"],
input[type="radio"] { accent-color: var(--primary); }
.field { gap: 6px; }
.field label,
.form label:not(.check):not(.filter-chip):not(.filter-chip-toggle) { font-size: 14px; font-weight: 600; color: var(--text-soft); }
.help { color: var(--text-muted); font-size: 13px; }
.error,
.field-error { color: var(--danger); font-size: 13.5px; font-weight: 600; }
@media (max-width: 768px) {
  input:not([type]),
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  input[type="date"],
  input[type="url"],
  select,
  textarea { font-size: 16px; }
}

/* ===== Choice chips and tabs (segmented pills; active = brand-soft) ===== */
.chip-btn,
.filter-chip,
.filter-chip-toggle,
.range-chip,
.tabs a,
.tab,
.pill,
.pharm-range a,
.gym-range a,
.inf-range a,
.rst-range a,
.pharm-filter-chips a,
.pharm-quick a,
.gym-chip,
.inf-chip,
.rst-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 14px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  box-shadow: none;
  transition: background var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
}
.chip-btn:hover,
.filter-chip-toggle:hover,
.range-chip:hover,
.tabs a:hover,
.pharm-range a:hover:not(.on),
.gym-range a:hover:not(.on),
.inf-range a:hover:not(.on),
.rst-range a:hover:not(.on),
.pharm-filter-chips a:hover:not(.on),
.pharm-quick a:hover { background: var(--surface-hover); border-color: var(--line-strong); color: var(--text); }
.chip-btn.on,
.chip-btn[aria-pressed="true"],
.filter-chip.on,
.filter-chip:has(input:checked),
.filter-chip-toggle:has(input:checked),
.range-chip.on,
.tabs a.active,
.tab.active,
.pill.on,
.pharm-range a.on,
.gym-range a.on,
.inf-range a.on,
.rst-range a.on,
.pharm-filter-chips a.on,
.gym-chip.on,
.inf-chip.on,
.rst-chip.on,
.rsx-chip.on,
.rsx-chip[aria-pressed="true"] {
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  color: var(--primary-ink);
  font-weight: 700;
}
html[data-theme="dark"] .pharm-range a,
html[data-theme="dark"] .gym-range a,
html[data-theme="dark"] .inf-range a,
html[data-theme="dark"] .rst-range a,
html[data-theme="dark"] .pharm-filter-chips a,
html[data-theme="dark"] .pharm-quick a { background: var(--surface); color: var(--text-soft); border-color: var(--border); color-scheme: dark; }
html[data-theme="dark"] .chip-btn.on,
html[data-theme="dark"] .filter-chip.on,
html[data-theme="dark"] .pharm-range a.on,
html[data-theme="dark"] .gym-range a.on,
html[data-theme="dark"] .inf-range a.on,
html[data-theme="dark"] .rst-range a.on,
html[data-theme="dark"] .rsx-chip.on,
html[data-theme="dark"] .rsx-chip[aria-pressed="true"] { background: var(--primary-soft); border-color: rgba(255, 138, 61, 0.55); color: #fdba74; }
.pharm-quick-primary a.is-primary { min-height: 44px; background: var(--surface); border-color: var(--border); color: var(--text-soft); font-weight: 700; }
.pharm-quick-primary a.is-primary:hover { background: var(--primary-soft); border-color: rgba(255, 107, 0, 0.55); color: var(--primary-ink); }

/* ===== Tags / status badges (rounded-full pills, tone colours) ===== */
.badge,
.dash-badge,
.status-badge {
  --t-fg: var(--tone-neutral-fg); --t-bg: var(--tone-neutral-bg);
  display: inline-flex; align-items: center; gap: 5px;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: 0; line-height: 1.25;
  color: var(--t-fg);
  background: var(--t-bg);
  border: 1px solid color-mix(in srgb, var(--t-fg) 22%, transparent);
  white-space: nowrap;
}
.badge-paid, .badge-active, .badge-success, .badge-available, .badge-completed, .badge-accepted, .badge-converted, .badge-received, .badge-ready, .badge-served,
.dash-badge-paid { --t-fg: var(--tone-success-fg); --t-bg: var(--tone-success-bg); }
.badge-partial, .badge-unpaid, .badge-pending, .badge-warning, .badge-low-stock, .badge-low, .badge-expiring, .badge-cleaning, .badge-preparing, .badge-due,
.dash-badge-partial, .dash-badge-unpaid { --t-fg: var(--tone-warning-fg); --t-bg: var(--tone-warning-bg); }
.badge-overdue, .badge-cancelled, .badge-danger, .badge-expired, .badge-failed, .badge-rejected, .badge-void, .badge-out, .badge-out-of-stock,
.dash-badge-overdue { --t-fg: var(--tone-danger-fg); --t-bg: var(--tone-danger-bg); }
.badge-issued, .badge-info, .badge-draft, .badge-sent, .badge-viewed,
.dash-badge-issued, .dash-badge-draft { --t-fg: var(--tone-info-fg); --t-bg: var(--tone-info-bg); }
.badge-reserved, .badge-scheduled, .badge-booked, .badge-premium { --t-fg: var(--tone-purple-fg); --t-bg: var(--tone-purple-bg); }
.badge-occupied, .badge-running, .badge-new, .badge-kot { --t-fg: var(--tone-orange-fg); --t-bg: var(--tone-orange-bg); }
.badge-inactive, .badge-closed, .badge-archived { --t-fg: var(--tone-neutral-fg); --t-bg: var(--tone-neutral-bg); }
html[data-theme="dark"] .badge,
html[data-theme="dark"] .dash-badge { background: color-mix(in srgb, var(--t-fg) 20%, transparent); color: color-mix(in srgb, var(--t-fg) 45%, #ffffff); }
.stock-badge { border-radius: 999px; font-size: 12px; font-weight: 700; padding: 4px 10px; }

/* ===== Alerts / banners (FormErrorBanner, RetryBanner) ===== */
.alert {
  --t-fg: var(--tone-info-fg); --t-bg: var(--tone-info-bg);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  border: 1px solid color-mix(in srgb, var(--t-fg) 22%, transparent);
  background: var(--t-bg);
  color: var(--t-fg);
  font-size: 14px; font-weight: 600;
  box-shadow: none;
}
.alert-success { --t-fg: var(--tone-success-fg); --t-bg: var(--tone-success-bg); background: var(--t-bg); color: var(--t-fg); border: 1px solid color-mix(in srgb, var(--t-fg) 22%, transparent); border-radius: var(--radius-md); padding: 12px 14px; }
.alert-error { --t-fg: var(--tone-danger-fg); --t-bg: var(--danger-soft); }
.alert-warning { --t-fg: var(--primary-ink); --t-bg: var(--warning-soft); }
.alert-info { --t-fg: var(--tone-info-fg); --t-bg: var(--tone-info-bg); }
html[data-theme="dark"] .alert { background: color-mix(in srgb, var(--t-fg) 18%, var(--surface)); color: color-mix(in srgb, var(--t-fg) 40%, #ffffff); }

/* ===== Empty / error states (EmptyState: icon badge 60, title 16/800, subtitle 13 muted) ===== */
.empty,
.mba-empty-card {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 13.5px;
  border-radius: var(--radius-xl);
  background: var(--surface-secondary);
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  box-shadow: var(--shadow-sm);
}
div.empty::before,
section.empty::before,
.mba-empty-card::before {
  content: '';
  display: block;
  width: 60px; height: 60px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background-color: var(--tone-brand-bg);
  border: 1px solid color-mix(in srgb, var(--tone-brand-fg) 14%, transparent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff6b00' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 30px 30px;
}
td.empty::before,
.empty.empty-inline::before { content: none; }
.empty h3,
.mba-empty-card h3,
.empty strong:first-child { display: block; margin: 0 0 6px; color: var(--text); font-size: 16px; font-weight: 800; }
.empty p { margin: 4px auto 0; max-width: 46ch; }
.empty .btn,
.mba-empty-card .btn { margin-top: 14px; }
.empty-mark { width: 60px; height: 60px; border-radius: 18px; background: var(--tone-brand-bg); border: 1px solid color-mix(in srgb, var(--tone-brand-fg) 14%, transparent); }
.dash-empty-icon { width: 60px; height: 60px; border-radius: 18px; background: var(--tone-brand-bg); color: var(--primary); border: 1px solid color-mix(in srgb, var(--tone-brand-fg) 14%, transparent); }
.dash-empty-hero h2 { font-size: 16px; font-weight: 800; }
.dash-empty-hero p,
.dash-empty-inline { font-size: 13.5px; color: var(--text-muted); }
html[data-theme="dark"] .empty,
html[data-theme="dark"] .mba-empty-card { background: var(--surface); border-color: var(--border); }
html[data-theme="dark"] .empty h3 { color: var(--text); }

/* ===== Tables and list rows (EntityRow inside a card) ===== */
.table-wrap,
.table-responsive,
.mba-table-card {
  overflow: auto;
  border-radius: var(--radius-xl);
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  min-width: 0;
  max-width: 100%;
}
table.table,
table.data { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 560px; }
table.table th,
table.data th {
  padding: 13px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.table td,
table.data td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14.5px;
  color: var(--text);
  background: transparent;
  transition: background var(--motion-fast) var(--ease-out);
}
table.table tbody tr:hover td,
table.data tbody tr:hover td { background: var(--surface-hover); }
table.table tbody tr:last-child td,
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num,
table.table td.num { font-weight: 700; font-variant-numeric: tabular-nums; }
html[data-theme="dark"] table.table th,
html[data-theme="dark"] table.data th { background: var(--surface-muted); color: var(--text-muted); }
[dir="rtl"] table.table th,
[dir="rtl"] table.table td,
[dir="rtl"] table.data th,
[dir="rtl"] table.data td { text-align: right; }

.list-cards { display: grid; gap: 10px; }
.list-card {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  box-shadow: var(--shadow-card);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--motion-base) var(--ease-out), transform var(--motion-fast) var(--ease-out);
}
.list-card:hover { border-color: var(--line-strong); }
.list-card:active { transform: scale(0.99); }
.list-card strong { font-size: 15.5px; font-weight: 700; letter-spacing: -0.1px; color: var(--text); }
.list-card span,
.list-card small { font-size: 13.5px; font-weight: 500; color: var(--text-muted); }
@media (min-width: 769px) { .list-cards { display: none; } }
html[data-theme="dark"] .list-card { background: var(--surface); border-color: var(--border); }

/* ===== List toolbars and pager ===== */
.list-toolbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; justify-content: space-between; margin: 0 0 16px; }
.list-toolbar-main { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; flex: 1 1 280px; min-width: 0; }
.list-toolbar-main input[type="search"],
.list-toolbar-main input[type="text"] { min-width: min(280px, 100%); flex: 1; padding-left: 16px; }
.list-toolbar-main select,
.list-toolbar-main input[type="date"],
.toolbar input,
.toolbar select { min-height: 44px; padding: 8px 14px; }
.list-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-chip { min-height: 36px; padding: 0 12px; font-size: 13px; }
.pagination,
.pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.pagination a,
.pagination span,
.pager-page {
  min-width: 40px; min-height: 40px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-weight: 700; font-size: 13.5px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
}
.pagination a:hover,
.pager-page:hover { background: var(--surface-hover); border-color: var(--line-strong); }
.pagination .active,
.pagination a.active,
.pager-page.is-current { background: var(--primary-soft); color: var(--primary-ink); border: 1.3px solid rgba(255, 107, 0, 0.55); }
html[data-theme="dark"] .pager-page:not(.is-current),
html[data-theme="dark"] .pager-size select { background: var(--surface); color: var(--text-soft); color-scheme: dark; }

.pager a,
.pager span {
  min-width: 40px; min-height: 40px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-weight: 700; font-size: 13.5px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
}
.pager a:hover { background: var(--surface-hover); border-color: var(--line-strong); }
.pager .active,
.pager a.active { background: var(--primary-soft); color: var(--primary-ink); border: 1.3px solid rgba(255, 107, 0, 0.55); }

/* ===== Invoice workspace (create/edit) ===== */
.invoice-workspace { gap: 18px; }
.invoice-workspace .ws-editor { gap: 16px; }
.invoice-workspace .ws-section.card { padding: 20px; }
.invoice-workspace .ws-section h3,
.invoice-workspace .ws-section-head h3 { margin: 0 0 14px; font-size: 16px; font-weight: 800; letter-spacing: -0.2px; color: var(--text); }
.invoice-workspace .ws-section-head { margin-bottom: 14px; }
.invoice-workspace .item-row {
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 10px;
}
.invoice-workspace .ws-preview { position: sticky; top: 16px; }
.invoice-workspace .ws-preview-bar,
.invoice-workspace .inv-preview-shell { border-radius: var(--radius-lg); }
.invoice-sticky-bar {
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  border-top: 0.8px solid var(--border);
  box-shadow: 0 -6px 20px rgba(40, 30, 10, 0.08);
}
.invoice-plan-presets .btn { border-radius: 999px; }
html[data-theme="dark"] .invoice-workspace .item-row { background: var(--surface-muted); }

/* Icon circle utility (MbaIconCircle: solid colour, white glyph, soft glow) */
.mba-icon-box {
  --ic: var(--icon-orange);
  width: 46px; height: 46px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; background: var(--ic);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--ic) 28%, transparent);
}
.mba-icon-box.orange { --ic: var(--icon-orange); }
.mba-icon-box.blue { --ic: var(--icon-blue); }
.mba-icon-box.purple { --ic: var(--icon-purple); }
.mba-icon-box.green { --ic: var(--icon-green); }
.mba-icon-box.pink { --ic: var(--icon-pink); }
.table-floor .card { border-radius: var(--radius-xl); }

/* ===== Menus, popovers, sheets ===== */
.dropdown-menu,
.menu-popover,
.firm-switcher-menu,
.top-create-menu,
.quick-create-menu,
.action-panel,
.dash-row-menu-panel,
.mba-overflow-menu {
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow-lg) !important;
}
.dropdown-menu a:hover,
.menu-popover a:hover,
.quick-create-menu a:hover,
.action-panel a:hover,
.action-panel button:hover,
.firm-switcher-item:hover { background: var(--primary-soft) !important; color: var(--text); }
.quick-create-menu a,
.action-panel a,
.action-panel button { min-height: 44px; display: flex; align-items: center; font-weight: 600; border-radius: var(--radius-md); }

/* Firm switcher: items and title pill */
.firm-switcher-avatar {
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  box-shadow: none;
}
.firm-switcher-menu .firm-switcher-avatar,
.firm-switcher-item .firm-switcher-avatar {
  background: var(--primary-soft);
  color: var(--primary-ink);
  border: 1px solid rgba(255, 107, 0, 0.18);
  box-shadow: none;
}
.firm-switcher-menu-label { font-size: 18px; font-weight: 700; letter-spacing: -0.2px; text-transform: none; color: var(--text); padding: 8px 10px 10px; }
.firm-switcher-item { min-height: 56px; border-radius: var(--radius-md); }
.firm-switcher-item.is-active { background: var(--primary-soft); }
.firm-switcher-item-name { font-size: 15px; font-weight: 600; }
.firm-switcher-item-cat { font-size: 12px; font-weight: 600; border-radius: 8px; background: var(--surface-muted); color: var(--text-soft); }
.firm-switcher-action { color: var(--primary); font-weight: 700; min-height: 48px; }
.firm-switcher-action + .firm-switcher-action { color: var(--text); font-weight: 600; }

/* Bottom sheet (mobile quick create) */
@media (max-width: 768px) {
  .mobile-sheet.open {
    border-radius: 24px 24px 0 0;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    padding-top: 28px;
  }
  .mobile-sheet.open::before {
    content: '';
    position: absolute;
    top: 10px; left: 50%;
    width: 36px; height: 4px; margin-left: -18px;
    border-radius: 999px;
    background: var(--line-strong);
  }
}

/* ===== Dialogs (rounded-[1.5rem], white, shadow-lift) ===== */
.modal { background: rgba(11, 15, 25, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal .card,
.modal-card,
dialog.pwa-dialog {
  border-radius: var(--radius-xl) !important;
  background: var(--surface) !important;
  background-image: none !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
  animation: mbaModalIn var(--motion-slow) var(--ease-out) both;
}
@keyframes mbaModalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ===== Toasts (floating, ink) ===== */
.toast {
  background: var(--navy);
  color: #fff;
  border: 0;
  border-left: 4px solid transparent;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 14.5px;
  font-weight: 600;
}
.toast-success { border-left-color: #34d399; }
.toast-error { border-left-color: #f87171; }
.toast-warning { border-left-color: #fbbf24; }

/* ===== Skeletons (pulse 0.55 ↔ 1, 900 ms) ===== */
.mba-skeleton,
.skeleton {
  background: var(--surface-muted);
  border-radius: 10px;
  animation: mbaPulse 900ms ease-in-out infinite alternate;
}
@keyframes mbaPulse { from { opacity: 0.55; } to { opacity: 1; } }
html[data-theme="dark"] .skeleton { background: var(--surface-muted); }

/* ===== Icon badge utility (MbaIconBadge) ===== */
.mba-icon-badge {
  --t-fg: var(--tone-brand-fg); --t-bg: var(--tone-brand-bg);
  width: 38px; height: 38px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 11px;
  background: var(--t-bg);
  color: var(--t-fg);
  border: 1px solid color-mix(in srgb, var(--t-fg) 13%, transparent);
}
.mba-icon-badge svg { width: 20px; height: 20px; }
.tone-success { --t-fg: var(--tone-success-fg); --t-bg: var(--tone-success-bg); }
.tone-warning { --t-fg: var(--tone-warning-fg); --t-bg: var(--tone-warning-bg); }
.tone-danger { --t-fg: var(--tone-danger-fg); --t-bg: var(--tone-danger-bg); }
.tone-info { --t-fg: var(--tone-info-fg); --t-bg: var(--tone-info-bg); }
.tone-purple { --t-fg: var(--tone-purple-fg); --t-bg: var(--tone-purple-bg); }
.tone-orange { --t-fg: var(--tone-orange-fg); --t-bg: var(--tone-orange-bg); }
.tone-teal { --t-fg: var(--tone-teal-fg); --t-bg: var(--tone-teal-bg); }
.tone-pink { --t-fg: var(--tone-pink-fg); --t-bg: var(--tone-pink-bg); }
.tone-neutral { --t-fg: var(--tone-neutral-fg); --t-bg: var(--tone-neutral-bg); }
.tone-brand { --t-fg: var(--tone-brand-fg); --t-bg: var(--tone-brand-bg); }
html[data-theme="dark"] .mba-icon-badge { background: color-mix(in srgb, var(--t-fg) 20%, transparent); color: color-mix(in srgb, var(--t-fg) 40%, #ffffff); }

/* ===== Grouped list (More hub, settings lists) ===== */
.mba-list-group { margin: 0 0 8px; }
.mba-list-group-title { margin: 4px 2px 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-muted); }
.mba-list-card { padding: 0; }
.mba-list-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 60px; padding: 11px 14px;
  color: var(--text); text-decoration: none;
  background: transparent; border: 0; font: inherit; text-align: left; cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out);
}
.mba-list-row + .mba-list-row,
.mba-list-row + form,
form + .mba-list-row { border-top: 1px solid var(--border); }
.mba-list-row[hidden] { display: none; }
.mba-list-row:hover { background: var(--surface-hover); }
.mba-list-card form { margin: 0; }
.mba-more { display: grid; gap: 14px; max-width: 760px; }
.mba-more-head h1 { font-size: 24px; }
.mba-more-head p { font-size: 13px; font-weight: 600; }
.mba-list-row-label { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.mba-list-row-label small { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-top: 1px; }
.mba-list-row-chevron { width: 20px; height: 20px; color: var(--text-muted); flex: none; }
.mba-list-row.is-danger .mba-list-row-label { color: var(--danger); }
[dir="rtl"] .mba-list-row { text-align: right; }
[dir="rtl"] .mba-list-row-chevron { transform: scaleX(-1); }

/* ===== Top bar (Navbar: sticky white/95, blur, surface-line border; 40px rounded-lg buttons) ===== */
.topbar {
  height: var(--top-h);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.topbar .icon-btn,
.top-actions .icon-btn {
  width: var(--icon-btn); height: var(--icon-btn);
  min-width: var(--icon-btn); min-height: var(--icon-btn);
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: none;
  color: var(--text-soft);
}
.topbar .icon-btn .icon,
.topbar .icon-btn svg { width: 22px; height: 22px; }
.topbar .icon-btn:hover { background: var(--surface-muted); border-color: var(--line-strong); color: var(--text); }
.topbar .menu-btn,
.topbar .top-more-btn { border-color: transparent; background: transparent; box-shadow: none; color: var(--text); }
.topbar .search-toggle { color: var(--tone-info-fg); }
.topbar .notif-dot { color: var(--tone-warning-fg); }
.topbar .top-ai { color: var(--primary); }
.notif-dot[data-count]::after {
  top: -5px; right: -5px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  border: 2px solid var(--surface);
  color: #fff;
  font-size: 10.5px; font-weight: 800;
}
.search input { border-radius: var(--radius-md) !important; background-color: var(--surface-muted) !important; min-height: 44px; font-size: 14.5px; }
.search input:focus { background-color: var(--surface) !important; }
.top-user { border-color: var(--border); background: var(--surface); box-shadow: none; }
.avatar { background: var(--primary-soft); color: var(--primary-ink); }
.top-create-btn { min-height: var(--icon-btn); border-radius: var(--radius-md); padding: 0 16px; font-size: 14px; }
html[data-theme="dark"] .topbar { background: color-mix(in srgb, var(--surface) 95%, transparent); border-color: var(--border); }
html[data-theme="dark"] .topbar .icon-btn { background: var(--surface); border-color: var(--border); }
html[data-theme="dark"] .topbar .search-toggle { color: #93c5fd; }
html[data-theme="dark"] .topbar .notif-dot { color: #fcd34d; }

/* Title firm pill */
.topbar-firm .firm-switcher-summary {
  padding: 5px 10px 5px 5px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: none;
}
.topbar-firm .firm-switcher.is-compact .firm-switcher-summary { grid-template-columns: 34px minmax(0, 1fr) 18px; gap: 9px; }
.topbar-firm .firm-switcher-avatar { width: 34px; height: 34px; border-radius: 8px; font-size: 15px; }
.topbar-firm .firm-switcher-name { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; color: var(--text); }
.topbar-firm .firm-switcher-cat {
  margin-top: 2px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cat-c, var(--primary-ink));
  background: color-mix(in srgb, var(--cat-c, var(--primary)) 12%, transparent);
}
.topbar-firm .firm-switcher-chevron { width: 18px; height: 18px; color: var(--text-soft); }
.firm-switcher[data-cat="RETAILER"] { --cat-c: var(--cat-retailer); }
.firm-switcher[data-cat="KIRANA"] { --cat-c: var(--cat-kirana); }
.firm-switcher[data-cat="ELECTRONICS"] { --cat-c: var(--cat-electronics); }
.firm-switcher[data-cat="GYM"] { --cat-c: var(--cat-gym); }
.firm-switcher[data-cat="MEDICAL_PHARMACY"] { --cat-c: var(--cat-pharmacy); }
.firm-switcher[data-cat="RESTAURANT"] { --cat-c: var(--cat-restaurant); }
.firm-switcher[data-cat="INFLUENCER_CREATOR"] { --cat-c: var(--cat-influencer); }
html[data-theme="dark"] .topbar-firm .firm-switcher-summary { background: var(--surface); }
html[data-theme="dark"] .topbar-firm .firm-switcher-cat { color: color-mix(in srgb, var(--cat-c, var(--primary)) 45%, #ffffff); }

/* Phone app bar: menu, firm title, search, bell, overflow */
.top-more { position: relative; display: none; }
.mba-overflow-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 220px; max-width: calc(100vw - 24px);
  padding: 6px;
  display: grid; gap: 2px;
}
.mba-overflow-menu[hidden] { display: none; }
.mba-overflow-menu a,
.mba-overflow-menu button {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 48px; padding: 0 12px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text);
  font: inherit; font-size: 15px; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer;
}
.mba-overflow-menu a:hover,
.mba-overflow-menu button:hover { background: var(--primary-soft); }
.mba-overflow-menu .icon { width: 20px; height: 20px; color: var(--text-soft); }
.mba-overflow-menu .is-danger,
.mba-overflow-menu .is-danger .icon { color: var(--danger); }
.mba-overflow-menu form { margin: 0; }
[dir="rtl"] .mba-overflow-menu { right: auto; left: 0; }
[dir="rtl"] .mba-overflow-menu a,
[dir="rtl"] .mba-overflow-menu button { text-align: right; }

/* ===== Bottom navigation (white/95, blur, surface-line border, brand active pill) ===== */
.bottom-nav {
  min-height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  align-items: center;
}
.bottom-nav a:not(.nav-fab) {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 56px;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0;
  color: var(--text-muted);
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav .bn-pill {
  display: grid; place-items: center;
  padding: 5px 14px;
  border-radius: 999px;
  transition: background var(--motion-base) var(--ease-out);
}
.bottom-nav .bn-pill .icon { width: 22px; height: 22px; color: var(--text-muted); }
.bottom-nav .bn-label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottom-nav a.active { color: var(--primary); font-weight: 700; }
.bottom-nav a.active .bn-pill { background: var(--primary-soft); }
.bottom-nav a.active .bn-pill .icon { color: var(--primary); }
.bottom-nav .nav-fab {
  width: 52px; height: 52px; margin: -22px auto 0;
  border-radius: 16px;
  background: var(--primary);
  box-shadow: var(--shadow-fab);
  border: 3px solid var(--surface);
  color: #fff !important;
}
.bottom-nav .nav-fab .icon { width: 24px; height: 24px; color: #fff; }
html[data-theme="dark"] .bottom-nav { background: color-mix(in srgb, var(--surface) 95%, transparent); border-color: var(--border); }
html[data-theme="dark"] .bottom-nav a.active { color: #fdba74; }

/* ===== Sidebar (white like the site's menu drawer: ink-soft links, brand-soft active) ===== */
.sidebar { background: var(--sidebar); border-right: 1px solid var(--border); color: var(--sidebar-text); }
.brand-name { color: var(--text); font-weight: 800; letter-spacing: -0.01em; }
.brand-sub { color: var(--text-muted); }
.sidebar-biz { border-bottom-color: var(--border); }
.sidebar .firm-switcher-summary { border-radius: var(--radius-md); background: var(--surface-muted); border-color: var(--border); }
.sidebar .firm-switcher-name { color: var(--text); }
.sidebar .firm-switcher-cat,
.sidebar .firm-switcher-chevron { color: var(--text-muted); }
.sidebar .firm-switcher-avatar { width: 30px; height: 30px; font-size: 13px; border-radius: 8px; }
.sidebar .firm-switcher-summary { grid-template-columns: 30px minmax(0, 1fr) 16px; }
.nav a,
.nav summary { border-radius: var(--radius-md); color: var(--sidebar-text); font-weight: 600; }
.nav a:hover,
.nav summary:hover,
.subnav a:hover { background: var(--surface-muted); color: var(--text); }
.subnav a { color: var(--sidebar-text); }
.nav details > summary,
.nav details[open] > summary { color: var(--text-muted); background: transparent; letter-spacing: 0.08em; }
.nav a.active,
.subnav a.active { background: var(--primary-soft); box-shadow: none; color: var(--primary-ink); font-weight: 700; }
.nav a.active::before,
.subnav a.active::before { background: var(--primary); box-shadow: none; }
/* Colored medium nav icons (do not mute production-readiness sidebar polish) */
.nav > a .icon { color: #38bdf8; width: 20px; height: 20px; }
.nav > a[href*="invoice"] .icon,
.nav > a.nav-cta .icon { color: #fb923c; }
.nav > a[href*="inventory"] .icon,
.nav > a[href*="product"] .icon { color: #34d399; }
.nav > a[href*="purchase"] .icon { color: #60a5fa; }
.nav > a[href*="finance"] .icon,
.nav > a[href*="report"] .icon { color: #a78bfa; }
.nav > a[href*="wallet"] .icon,
.nav > a[href*="billing"] .icon { color: #fbbf24; }
.nav > a[href*="whatsapp"] .icon { color: #4ade80; }
.nav > a[href*="customer"] .icon,
.nav > a[href*="team"] .icon { color: #f472b6; }
.nav > a.active .icon,
.nav > a:hover .icon { color: var(--primary); filter: drop-shadow(0 0 6px rgba(255, 107, 0, .28)); }
.sidebar-toggle {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-soft);
}
.sidebar-toggle:hover { background: var(--primary-soft); color: var(--primary-ink); }
.sidebar-plan { border-radius: var(--radius-lg); background: var(--primary-soft); border: 1px solid rgba(255, 107, 0, 0.22); box-shadow: none; }
.sidebar-plan strong { color: var(--text); }
.sidebar-plan span { color: var(--text-soft); }
.sidebar-plan .btn { background: var(--primary); color: #fff; box-shadow: none; min-height: 40px; border-radius: var(--radius-md); }
.sidebar-foot { border-top-color: var(--border); }
.sidebar-foot a { color: var(--text-muted); }
.sidebar-foot a:hover { background: var(--surface-muted); color: var(--text); }
.lang-row a { color: var(--text-muted); }
.lang-row a.active { color: var(--primary-ink); background: var(--primary-soft); }
html[data-theme="dark"] .sidebar { background: var(--surface); border-right-color: var(--border); }
html[data-theme="dark"] .brand-name,
html[data-theme="dark"] .sidebar .firm-switcher-name { color: var(--text); }
html[data-theme="dark"] .nav a,
html[data-theme="dark"] .subnav a,
html[data-theme="dark"] .nav summary { color: var(--text-soft); }
html[data-theme="dark"] .nav a:hover,
html[data-theme="dark"] .subnav a:hover { background: var(--surface-muted); color: var(--text); }
html[data-theme="dark"] .nav a.active,
html[data-theme="dark"] .subnav a.active { background: rgba(255, 107, 0, 0.14); color: #fdba74; }
html[data-theme="dark"] .sidebar-plan { background: rgba(255, 107, 0, 0.1); border-color: rgba(255, 138, 61, 0.28); }
html[data-theme="dark"] .lang-row a.active { color: #fdba74; background: rgba(255, 107, 0, 0.14); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .content:not(:has(.dash)) { padding: 14px 20px calc(var(--bottom-h) + 28px + env(safe-area-inset-bottom)); }
  .content:has(.dash) { padding: 12px 20px calc(var(--bottom-h) + 28px + env(safe-area-inset-bottom)); }
  .page-head h1,
  .page-head h2,
  .ws-head h1 { font-size: 25px; }
  table.table,
  table.data { min-width: 520px; }
}
@media (max-width: 768px) {
  .dash-kpi-grid,
  .grid-4:has(> .stat),
  .grid-3:has(> .stat),
  .finance-kpis { grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px; }
  .dash-kpi-value,
  .stat .value,
  .gym-kpi-value,
  .pharm-kpi-value,
  .inf-kpi-value,
  .rst-kpi-value { font-size: 22px; }
  .topbar { padding: 0 8px 0 4px; gap: 6px; }
  .top-ai,
  #themeToggle,
  .top-user,
  .top-create-wrap { display: none !important; }
  .top-more { display: block; }
  .topbar .search { margin-left: auto; }
  .topbar-firm { flex: 1 1 auto; min-width: 0; max-width: none; margin-right: 0; }
  .topbar-firm .firm-switcher.is-compact .firm-switcher-summary { width: fit-content; max-width: 100%; }
  .topbar-firm .firm-switcher-menu { position: fixed; left: 8px; right: 8px; top: calc(var(--top-h) + 4px); min-width: 0; max-height: calc(100dvh - var(--top-h) - var(--bottom-h) - 24px); overflow: auto; }
  .topbar .top-actions { gap: 6px; }
}
@media (max-width: 420px) {
  .topbar-firm .firm-switcher-copy { display: flex; }
  .topbar-firm .firm-switcher.is-compact .firm-switcher-summary { grid-template-columns: 30px minmax(0, 1fr) 16px; gap: 7px; padding: 4px 8px 4px 4px; }
  .topbar-firm .firm-switcher-avatar { width: 30px; height: 30px; font-size: 13px; }
  .topbar-firm .firm-switcher-name { font-size: 14px; }
  .topbar-firm .firm-switcher-cat { font-size: 11px; }
}
@media (max-width: 360px) {
  .content:not(:has(.dash)),
  .content:has(.dash) { padding-left: 14px; padding-right: 14px; }
  .topbar .icon-btn,
  .top-actions .icon-btn { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }
  .topbar-firm .firm-switcher.is-compact .firm-switcher-summary { grid-template-columns: 30px minmax(0, 1fr); }
  .topbar-firm .firm-switcher-chevron { display: none; }
  .bottom-nav .bn-pill { padding: 5px 10px; }
  .bottom-nav a:not(.nav-fab) { font-size: 11.5px; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .content.fade-up,
  .page-head,
  .modal .card,
  .modal-card,
  .skeleton,
  .mba-skeleton,
  dialog.pwa-dialog { animation: none !important; }
  .btn:active,
  a.card:active,
  .list-card:active,
  a.dash-kpi:active { transform: none; }
}
