:root {
  --bg-app: #0b1329;
  --bg-surface: #131c36;
  --bg-card: #1c2744;
  --bg-input: #0f172a;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: #38bdf8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

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

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Modern Enterprise Sleek Scrollbars (MacBook & Desktop) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(11, 19, 41, 0.75);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.55);
}

/* Enterprise Focus Rings & Smooth Transitions */
input, select, textarea, button {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease, background 0.2s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
  outline: none;
}

.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 0%, #1e293b 0%, var(--bg-app) 60%);
  padding: 12px 14px 140px; /* Ample space for AdMob banner and bottom clearance */
  position: relative;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-icon {
  font-size: 24px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.brand-info h1 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #fff;
  line-height: 1.1;
}

.brand-info .sub {
  font-size: 11px;
  color: #38bdf8;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.header-ai-badge-btn {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  border: none;
  padding: 6px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: aiGlowPulse 2.5s infinite ease-in-out;
}

@keyframes aiGlowPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(139, 92, 246, 0.45); transform: translateY(0); }
  50% { box-shadow: 0 4px 20px rgba(192, 132, 252, 0.85); transform: translateY(-1px); }
}

.header-ai-badge-btn:active {
  transform: scale(0.94);
}

.header-icon-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-subtle);
  color: #cbd5e1;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.header-icon-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #f8fafc;
  border-color: #38bdf8;
}

.header-icon-btn:active {
  transform: scale(0.94);
}

.pro-badge-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.pro-badge-btn:active {
  transform: scale(0.94);
}

.btn-company-switcher {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

#header-company-name {
  max-width: 85px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-caret {
  font-size: 8px;
  opacity: 0.7;
}

/* Navigation Tabs (6 Columns: Dashboard, New Bill, Invoices, Profit, AI Copilot, Settings) */
.nav-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 2px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 11px;
}

.nav-tab.nav-tab-ai {
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.nav-tab.nav-tab-ai:hover, .nav-tab.nav-tab-ai:active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(99, 102, 241, 0.3));
  color: #f8fafc;
}

.nav-tab.active {
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.tab-icon {
  font-size: 16px;
}

.tab-label {
  font-size: 11px;
}

/* Tab Contents */
.tab-content {
  display: none;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.2s ease-out;
}

.tab-content.active {
  display: flex;
}

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

/* Dashboard Summaries */
.summary-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.total-card {
  background: linear-gradient(135deg, #1e3a8a, #0f172a);
  border-color: rgba(56, 189, 248, 0.3);
}

.card-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.8px;
}

.card-value {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  margin: 4px 0 2px;
}

.card-sub {
  font-size: 12px;
  color: #38bdf8;
  font-weight: 600;
}

.summary-row {
  display: flex;
  gap: 10px;
}

.summary-row .summary-card {
  flex: 1;
}

.summary-row .card-value {
  font-size: 18px;
}

.text-emerald { color: #10b981 !important; }
.text-amber { color: #f59e0b !important; }

/* Hero Action Button */
.btn-hero-create {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transition: transform 0.15s ease;
  text-align: left;
}

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

.hero-icon {
  font-size: 26px;
  background: rgba(255, 255, 255, 0.2);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hero-text strong {
  font-size: 15px;
  font-weight: 800;
}

.hero-text span {
  font-size: 11px;
  opacity: 0.9;
}

.hero-arrow {
  font-size: 18px;
  font-weight: 800;
}

/* Sections & Lists */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.section-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.btn-text {
  background: none;
  border: none;
  color: #38bdf8;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.invoices-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.invoice-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.invoice-item-card:active {
  background: #273557;
  transform: scale(0.98);
}

.item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inv-id {
  font-size: 12px;
  font-weight: 800;
  color: #38bdf8;
}

.inv-client {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.inv-date {
  font-size: 11px;
  color: var(--text-muted);
}

.item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.inv-amount {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.status-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
}

.status-badge.paid {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-badge.pending {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.status-badge.overdue {
  background: rgba(244, 63, 94, 0.2);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

/* Forms & Inputs */
.invoice-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.form-card-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.form-row {
  display: flex;
  gap: 10px;
}

.flex-1 { flex: 1; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

input, select {
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

input:focus, select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Line Items Table */
.items-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.items-table th {
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.items-table td {
  padding: 6px 4px;
}

.table-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
}

.btn-remove-row {
  background: none;
  border: none;
  color: #f43f5e;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
}

.btn-pill-action {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* Totals Breakdown */
.totals-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
}

.inline-input-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-input {
  width: 60px;
  padding: 4px 6px;
  font-size: 12px;
  text-align: right;
}

.grand-total-row {
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
  color: #fff;
  font-size: 16px;
}

.grand-total-val {
  font-size: 20px;
  font-weight: 800;
  color: #10b981;
}

/* Signature Pad */
.signature-wrapper {
  background: #ffffff;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  justify-content: center;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
}

#sig-canvas {
  width: 100%;
  height: 120px;
  cursor: crosshair;
  touch-action: none;
}

/* Form Actions */
.form-actions-bottom {
  position: sticky;
  bottom: 60px;
  z-index: 100;
}

.btn-primary-action {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
  transition: transform 0.15s ease;
}

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

.btn-secondary-action {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-danger-outline {
  background: none;
  border: 1px solid #f43f5e;
  color: #f43f5e;
  padding: 10px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}

/* History Filters */
.history-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: var(--radius-md);
}

.search-box input {
  background: none;
  border: none;
  padding: 0;
  width: 100%;
}

.filter-pills {
  display: flex;
  gap: 8px;
}

.filter-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.filter-pill.active {
  background: #2563eb;
  color: #fff;
}

/* Developer Info Box in Settings */
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  box-sizing: border-box;
  overflow: visible;
  word-break: break-word;
}

.settings-card input,
.settings-card select,
.settings-card textarea {
  max-width: 100%;
  box-sizing: border-box;
}

/* Dedicated Settings Tab Clearance & Responsiveness */
#tab-settings {
  padding-bottom: 140px !important;
  box-sizing: border-box;
}

.settings-card h3 {
  font-size: 15px;
  color: #fff;
  margin-bottom: 6px;
}

.dev-info-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.dev-avatar {
  font-size: 28px;
  background: rgba(37, 99, 235, 0.2);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dev-text {
  display: flex;
  flex-direction: column;
}

.dev-text strong {
  font-size: 15px;
  color: #fff;
}

.dev-text span {
  font-size: 11px;
  color: #10b981;
  font-weight: 700;
}

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

.legal-links {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.link-privacy {
  color: #38bdf8;
  text-decoration: none;
}

/* AdMob Banner Slot (Strict Google AdMob Policy Compliance & Separation) */
.ad-banner-slot {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 52px;
  background: #090e1a;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  z-index: 999;
}

.ad-pill {
  position: absolute;
  top: -8px;
  left: 14px;
  background: #2563eb;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
}

.ad-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.ad-text {
  font-size: 11px;
  color: #cbd5e1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 270px;
}

.ad-cta {
  background: #10b981;
  color: #fff;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

/* ==========================================================================
   ENTERPRISE TACTILE MICRO-INTERACTIONS & ELEVATION
   ========================================================================== */
button:active,
.btn-primary-action:active,
.btn-secondary-action:active,
.btn-action-outline:active,
.btn-danger-outline:active,
.nav-tab:active,
.btn-hero-fast-pos:active,
.filter-pill:active,
.btn-template-chip:active,
.btn-regional-pack:active {
  transform: scale(0.975);
  transition: transform 0.08s ease;
}

/* Tabular numerals for clean financial readability */
.card-value,
.grand-total-val,
.summary-num,
.inv-amount,
.metric-val,
#dash-total,
#dash-paid,
#dash-pending,
#dash-net-profit,
#dash-margin-pct {
  font-variant-numeric: tabular-nums;
}

/* Smooth card transitions & hover lifts on pointer devices */
.settings-card,
.summary-card,
.invoice-card,
.modal-card {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (hover: hover) and (pointer: fine) {
  .settings-card:hover,
  .summary-card:hover,
  .invoice-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
  }
}

/* Modal Entrance Animation */
@keyframes modalEntrance {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-backdrop.active .modal-card,
.preview-modal-backdrop.active .preview-modal-container {
  animation: modalEntrance 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ==========================================================================
   OFFICIAL A4 PRINTABLE INVOICE SHEET (SCREEN & PDF PRINT)
   ========================================================================== */
.preview-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: none !important;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  padding: 14px;
}

.preview-modal-backdrop.active {
  display: flex !important;
}

.preview-modal-container {
  width: 100%;
  max-width: 640px;
  min-height: min-content;
  height: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-top-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e293b;
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.btn-close-white {
  background: none;
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.btn-toolbar {
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-whatsapp {
  background: #25d366;
  color: #fff;
}

.btn-print {
  background: #2563eb;
  color: #fff;
}

.btn-reminder {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}
.btn-reminder:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
}

/* The Paper Sheet */
.invoice-paper {
  background: #ffffff;
  color: #1e293b;
  border-radius: 8px;
  padding: 32px 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-size: 12px;
  line-height: 1.5;
}

.inv-header-section {
  display: flex;
  justify-content: space-between;
}

.inv-brand-left h1 {
  font-size: 22px;
  font-weight: 900;
  color: #0f172a;
}

.inv-brand-left p {
  color: #475569;
  font-size: 11px;
}

.inv-meta-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.inv-title-badge {
  font-size: 14px;
  font-weight: 900;
  color: #2563eb;
  letter-spacing: 1px;
}

.inv-divider {
  border: none;
  border-top: 2px solid #e2e8f0;
}

.inv-bill-to {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bill-to-title {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.5px;
}

.inv-bill-to h3 {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.inv-paper-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}

.inv-paper-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 800;
  text-align: left;
  padding: 8px;
  border-bottom: 2px solid #cbd5e1;
}

.inv-paper-table td {
  padding: 8px;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}

.inv-footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-top: 14px;
}

.inv-paper-totals-wrapper {
  display: flex;
  justify-content: flex-end;
}

.inv-paper-totals {
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.p-total-row {
  display: flex;
  justify-content: space-between;
  color: #475569;
}

.p-total-row.grand {
  border-top: 2px solid #0f172a;
  padding-top: 6px;
  font-size: 15px;
  font-weight: 900;
  color: #0f172a;
}

.inv-paper-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 20px;
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
}

.inv-terms {
  max-width: 260px;
  font-size: 10px;
  color: #64748b;
}

.inv-signature-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 150px;
}

#paper-signature-img {
  max-height: 48px;
  max-width: 120px;
}

.sig-line {
  width: 100%;
  border-top: 1px dashed #94a3b8;
  margin-top: 6px;
}

.inv-signature-box span {
  font-size: 10px;
  font-weight: 700;
  color: #475569;
}

.inv-watermark-tag {
  text-align: center;
  font-size: 9px;
  color: #94a3b8;
  margin-top: 12px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-backdrop.active {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  max-height: 90vh;
  overflow-y: auto;
  margin: auto;
  box-sizing: border-box;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-card h2 {
  font-size: 20px;
  color: #fff;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.pro-perks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  margin-bottom: 16px;
}

.perk-item {
  font-size: 12px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 10px;
  border-radius: 6px;
}

.vip-pricing {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.price-strike {
  font-size: 16px;
  color: var(--text-muted);
  text-decoration: line-through;
}

.price-current {
  font-size: 28px;
  font-weight: 800;
  color: #fbbf24;
}

.price-badge {
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
}

.btn-text-only {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 10px;
  cursor: pointer;
  text-decoration: underline;
}

/* Interstitial Ad Mock */
.ad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 20000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ad-overlay.active {
  display: flex;
}

.ad-card {
  background: #1e293b;
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ad-header-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 700;
}

.ad-biz-logo {
  font-size: 48px;
  margin-bottom: 6px;
}

.btn-ad-cta {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.ad-timer-bar {
  width: 100%;
  height: 4px;
  background: #334155;
  border-radius: 2px;
  overflow: hidden;
}

.ad-timer-fill {
  width: 0%;
  height: 100%;
  background: #10b981;
  transition: width 0.1s linear;
}

/* ==========================================================================
   PRINT / PDF MEDIA QUERY (CRITICAL FOR PLAY STORE UTILITY)
   ========================================================================== */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .no-print {
    display: none !important;
  }

  .preview-modal-backdrop {
    position: static !important;
    background: none !important;
    padding: 0 !important;
    display: block !important;
  }

  .preview-modal-container {
    max-width: 100% !important;
  }

  .invoice-paper {
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  /* 58mm / 80mm Bluetooth Thermal POS Receipt Print Mode */
  body.printing-thermal {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }
  body.printing-thermal .preview-modal-backdrop,
  body.printing-thermal .preview-modal-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  body.printing-thermal .invoice-paper.template-thermal {
    width: 72mm !important;
    max-width: 72mm !important;
    margin: 0 auto !important;
    padding: 4mm !important;
    font-size: 11px !important;
    border: none !important;
    box-shadow: none !important;
  }
}

/* ==========================================================================
   PROMINENT PUBLISHER BRANDING (NARAYAN MODAK)
   ========================================================================== */
.badge-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #10b981;
  color: #fff;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 900;
  margin-right: 3px;
}

/* Startup Splash Screen */
.app-splash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, #1e293b 0%, #090e1a 85%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.app-splash.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: splashPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes splashPop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.splash-logo {
  font-size: 56px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.4);
  margin-bottom: 16px;
}

.splash-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  margin-bottom: 4px;
}

.splash-sub {
  font-size: 13px;
  color: #38bdf8;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.splash-sub-desc {
  font-size: 10.5px;
  color: #94a3b8;
  font-weight: 600;
  letter-spacing: 0.8px;
  margin-bottom: 20px;
}

.splash-dev-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 18px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 24px;
}

.splash-dev-badge span {
  font-size: 9px;
  color: #38bdf8;
  letter-spacing: 1.5px;
  font-weight: 700;
}

.splash-dev-badge strong {
  font-size: 16px;
  color: #fbbf24;
  letter-spacing: 1px;
}

.splash-bar {
  width: 140px;
  height: 4px;
  background: #1e293b;
  border-radius: 2px;
  overflow: hidden;
}

.splash-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #10b981);
  animation: splashFillAnim 1.2s ease-in-out forwards;
}

@keyframes splashFillAnim {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* Prominent Dashboard Publisher Card (Shows in Front!) */
.publisher-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(16, 185, 129, 0.1));
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.pub-avatar {
  font-size: 26px;
  background: linear-gradient(135deg, #1e3a8a, #0f172a);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.pub-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pub-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pub-badge {
  font-size: 9px;
  font-weight: 800;
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  padding: 1px 6px;
  border-radius: 4px;
}

.pub-edition {
  font-size: 9px;
  color: #38bdf8;
  font-weight: 700;
}

.pub-name {
  font-size: 15px;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: -0.2px;
}

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

/* Document Type Pills */
.doc-type-pills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.doc-pill {
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.doc-pill input[type="radio"] {
  display: none;
}

.doc-pill.active {
  background: rgba(37, 99, 235, 0.2);
  border-color: #38bdf8;
  color: #fff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* Logo Upload & Preview */
.upload-logo-btn {
  cursor: pointer;
}

.logo-preview-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

#logo-preview-img {
  max-height: 48px;
  max-width: 120px;
  border-radius: 4px;
}

.paper-logo-container {
  margin-bottom: 8px;
}

#paper-logo-img {
  max-height: 60px;
  max-width: 160px;
  object-fit: contain;
}

/* Middle Section: UPI QR Code & Totals Side-by-Side */
.inv-middle-payment-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-top: 10px;
}

.inv-upi-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 150px;
}

.upi-header {
  font-size: 10px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.paper-qr-code {
  width: 100px;
  height: 100px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  margin: 4px 0;
  overflow: hidden;
}

.paper-qr-code svg {
  width: 100%;
  height: 100%;
  display: block;
}

.upi-footer {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.upi-footer small {
  font-size: 8px;
  color: #64748b;
  font-weight: 700;
}

.paper-upi-id {
  font-size: 9px;
  font-weight: 800;
  color: #0284c7;
  word-break: break-all;
}



/* ==========================================================================
   INTERNATIONAL ENTERPRISE STYLING & TEMPLATES
   ========================================================================== */

/* Language Selector */
.lang-selector-wrap {
  display: flex;
  align-items: center;
}

.lang-dropdown {
  background-color: rgba(30, 41, 59, 0.85);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 4px 26px 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  -webkit-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
  background-position: right 8px center !important;
  background-repeat: no-repeat !important;
  background-size: 14px 14px !important;
}

.lang-dropdown:focus, .lang-dropdown:hover {
  background-color: rgba(51, 65, 85, 0.95);
  border-color: #38bdf8;
}

body.light-mode .lang-dropdown {
  background-color: rgba(255, 255, 255, 0.95) !important;
  color: #0f2b5c !important;
  border: 1px solid rgba(15, 43, 92, 0.25) !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%230f2b5c' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
  background-position: right 8px center !important;
  background-repeat: no-repeat !important;
  background-size: 14px 14px !important;
  padding: 4px 26px 4px 10px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

body.light-mode .lang-dropdown:focus, body.light-mode .lang-dropdown:hover {
  background-color: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2) !important;
}

/* RTL Layout & Bi-directional Isolation Support (Arabic, Persian/Farsi, Urdu, Hebrew) */
[dir="rtl"],
html.rtl-mode,
.rtl-mode body {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}

/* Bi-Directional Isolation: Keep critical numbers, codes, phone numbers, and URLs strictly LTR */
bdi,
.ltr-data,
.phone-val,
.invoice-number,
.amount-val,
.currency-val,
.tax-id-val,
.iban-val,
.email-val,
.url-val,
.card-number,
.barcode-text,
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="url"],
[dir="rtl"] input[type="number"],
[dir="rtl"] .inv-meta-num,
[dir="rtl"] .money,
[dir="rtl"] .stat-val,
[dir="rtl"] .calc-result {
  direction: ltr !important;
  unicode-bidi: isolate;
  text-align: left;
}

[dir="rtl"] .inv-meta-right {
  text-align: left;
}

[dir="rtl"] .inv-brand-left {
  text-align: right;
}

[dir="rtl"] .inv-paper-table th:last-child,
[dir="rtl"] .inv-paper-table td:last-child {
  text-align: left;
}

[dir="rtl"] .inv-paper-table th:first-child,
[dir="rtl"] .inv-paper-table td:first-child {
  text-align: right;
}

[dir="rtl"] .header-actions {
  flex-direction: row-reverse;
}

[dir="rtl"] .inv-total-row {
  flex-direction: row-reverse;
}

[dir="rtl"] .back-arrow {
  transform: scaleX(-1);
  display: inline-block;
}

[dir="rtl"] .breadcrumb-sep {
  transform: scaleX(-1);
  display: inline-block;
}

/* Template Switcher Bar in Preview Modal */
.template-switcher-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.7);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.template-bar-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  margin-right: 2px;
}

.btn-template-chip {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid transparent;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-template-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.btn-template-chip.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #3b82f6;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

/* Template Themes */
/* 1. Corporate Executive (Default) */
.invoice-paper.template-corporate {
  border-top: 6px solid #1e40af;
}

/* 2. Modern Minimalist (Monochrome & Emerald) */
.invoice-paper.template-modern {
  border-top: 6px solid #059669;
  border-radius: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}
.invoice-paper.template-modern .inv-title-badge {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.invoice-paper.template-modern .inv-paper-table th {
  background: #f0fdf4;
  color: #065f46;
  border-bottom: 2px solid #059669;
}
.invoice-paper.template-modern .grand-row .grand-val {
  color: #047857;
}

/* 3. Classic Commercial (Warm Amber & Gold) */
.invoice-paper.template-classic {
  border-top: 6px solid #d97706;
  border: 2px solid #e2e8f0;
}
.invoice-paper.template-classic .inv-title-badge {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}
.invoice-paper.template-classic .inv-paper-table th {
  background: #fef3c7;
  color: #92400e;
  border-bottom: 2px solid #d97706;
}
.invoice-paper.template-classic .grand-row .grand-val {
  color: #b45309;
}

/* 4. Thermal POS Receipt (58mm / 80mm Roll for Retail & Dining) */
.invoice-paper.template-thermal {
  max-width: 360px;
  margin: 0 auto;
  padding: 16px 14px;
  font-family: 'Consolas', 'Courier New', Courier, monospace;
  font-size: 11px;
  background: #ffffff;
  color: #000;
  border-radius: 0;
  border: 1px dashed #64748b;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}
.invoice-paper.template-thermal .inv-header-section {
  flex-direction: column;
  text-align: center;
  align-items: center;
  gap: 8px;
  border-bottom: 1px dashed #94a3b8;
  padding-bottom: 12px;
}
.invoice-paper.template-thermal .inv-brand-left {
  text-align: center;
}
.invoice-paper.template-thermal .inv-meta-right {
  text-align: center;
}
.invoice-paper.template-thermal .inv-title-badge {
  background: transparent;
  color: #000;
  border: 1px solid #000;
  padding: 2px 8px;
  font-size: 11px;
  letter-spacing: 1px;
}
.invoice-paper.template-thermal .inv-parties-section {
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px dashed #94a3b8;
  padding-bottom: 10px;
}
.invoice-paper.template-thermal .inv-paper-table th {
  background: transparent;
  color: #000;
  border-top: 1px dashed #000;
  border-bottom: 1px dashed #000;
  padding: 4px 2px;
  font-size: 10px;
}
.invoice-paper.template-thermal .inv-paper-table td {
  padding: 4px 2px;
  font-size: 11px;
}
.invoice-paper.template-thermal .inv-totals-table {
  border-top: 1px dashed #94a3b8;
  padding-top: 8px;
}
.invoice-paper.template-thermal .grand-row {
  border-top: 2px solid #000;
  border-bottom: 2px solid #000;
  padding: 4px 0;
}
.invoice-paper.template-thermal .grand-row .grand-val {
  color: #000;
  font-size: 14px;
}
.invoice-paper.template-thermal .inv-footer-payment {
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-top: 1px dashed #94a3b8;
  padding-top: 12px;
}
.invoice-paper.template-thermal #paper-milestone-banner {
  background: transparent !important;
  border: 1px solid #000 !important;
  border-left: 3px solid #000 !important;
  color: #000 !important;
  font-family: inherit !important;
  padding: 4px 6px !important;
  font-size: 10px !important;
}
.invoice-paper.template-thermal #paper-loyalty-banner {
  background: transparent !important;
  border: 1px dashed #000 !important;
  color: #000 !important;
  font-family: inherit !important;
  padding: 4px 6px !important;
  font-size: 10px !important;
}
.invoice-paper.template-thermal #paper-shipping-row {
  color: #000 !important;
  font-size: 11px !important;
}

/* Action Outline Buttons for Data Management */
.btn-action-outline {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-action-outline:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: #38bdf8;
  transform: translateY(-1px);
}

/* Address Book & Catalog Modals */
.address-book-list, .catalog-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.modal-item-chip {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 12px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-item-chip:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: #38bdf8;
}

.modal-item-chip strong {
  font-size: 13px;
  color: #f8fafc;
  display: block;
}

.modal-item-chip small {
  font-size: 11px;
  color: #94a3b8;
}

.modal-item-action {
  font-size: 12px;
  color: #38bdf8;
  font-weight: 700;
}

/* ==========================================================================
   OFFICIAL DIAGONAL RUBBER STAMP (PAID / PENDING / OVERDUE)
   ========================================================================== */
.invoice-rubber-stamp {
  position: absolute;
  top: 110px;
  right: 32px;
  border: 3px dashed #16a34a;
  color: #16a34a;
  padding: 6px 16px;
  text-align: center;
  text-transform: uppercase;
  font-family: 'Impact', 'Arial Black', -apple-system, sans-serif;
  letter-spacing: 2px;
  transform: rotate(-13deg);
  opacity: 0.86;
  border-radius: 6px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px currentColor, 0 4px 12px rgba(0,0,0,0.1);
  z-index: 20;
  transition: all 0.2s ease;
}

.invoice-rubber-stamp.stamp-paid {
  border-color: #16a34a;
  color: #16a34a;
}

.invoice-rubber-stamp.stamp-pending {
  border-color: #d97706;
  color: #d97706;
}

.invoice-rubber-stamp.stamp-overdue {
  border-color: #dc2626;
  color: #dc2626;
}

.stamp-main-text {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.stamp-date-text {
  font-size: 8px;
  letter-spacing: 1.5px;
  margin-top: 3px;
  font-weight: 700;
  font-family: monospace;
}

.stamp-sub-text {
  font-size: 7px;
  border-top: 1px solid currentColor;
  padding-top: 2px;
  margin-top: 2px;
  letter-spacing: 1.5px;
}

/* ==========================================================================
   CAMERA BARCODE SCANNER ANIMATIONS
   ========================================================================== */
@keyframes scanLaser {
  0% { top: 15%; opacity: 0.3; }
  50% { top: 85%; opacity: 1; }
  100% { top: 15%; opacity: 0.3; }
}

.scanner-laser {
  animation: scanLaser 2s infinite ease-in-out;
}

/* ==========================================================================
   EXPENSES & PROFIT TRACKER TAB
   ========================================================================== */
.expense-item-row {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.15s ease;
}

.expense-item-row:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.expense-item-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.expense-item-title {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
}

.expense-item-meta {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-category {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.expense-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.expense-item-amount {
  font-size: 15px;
  font-weight: 800;
  color: #f43f5e;
}

.btn-del-expense {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.btn-del-expense:hover {
  color: #f43f5e;
}

/* ==========================================================================
   AI VOICE-TO-BILL ("TALK TO INVOICE") MODAL
   ========================================================================== */
.voice-mic-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin: 18px auto 14px auto;
}

.btn-voice-record {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  border: 3px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.5);
  position: relative;
  transition: all 0.2s ease;
  outline: none;
}

.btn-voice-record:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.7);
}

.btn-voice-record:active {
  transform: scale(0.96);
}

.voice-mic-icon {
  font-size: 30px;
  pointer-events: none;
}

.voice-pulse-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid #a855f7;
  opacity: 0;
  pointer-events: none;
}

.voice-mic-container.listening .btn-voice-record {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.7);
}

.voice-mic-container.listening .voice-pulse-ring {
  animation: micPulse 1.4s infinite cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes micPulse {
  0% {
    transform: scale(0.95);
    opacity: 0.9;
    border-color: #ef4444;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    transform: scale(1.45);
    opacity: 0;
    border-color: #f87171;
  }
}

.voice-status-text {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  margin-top: 10px;
  transition: color 0.2s ease;
}

.voice-mic-container.listening .voice-status-text {
  color: #ef4444;
  font-weight: 700;
}

.voice-transcript-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
  min-height: 65px;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}

.voice-parsed-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.voice-parsed-item-desc {
  font-weight: 600;
  color: #f8fafc;
  flex: 1;
}

.voice-parsed-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-parsed-badge {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11px;
}

/* ==========================================================================
   INVENTORY STOCK & RESTOCK BADGES
   ========================================================================== */
.badge-stock {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.badge-stock-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-stock-low {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-stock-out {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-restock-sm {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-restock-sm:hover {
  background: #0284c7;
  color: #fff;
}

/* ==========================================================================
   CLIENT KHATA CREDIT LEDGER & WHATSAPP REMINDER
   ========================================================================== */
.badge-credit-due {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.badge-credit-clear {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.btn-whatsapp-khata {
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.3);
  transition: all 0.15s ease;
}

.btn-whatsapp-khata:hover {
  background: #1ebd5b;
  transform: translateY(-1px);
}

/* Toolbar Additional Action Buttons */
.btn-duplicate {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  transition: all 0.2s ease;
}
.btn-duplicate:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
}

.btn-share {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  transition: all 0.2s ease;
}
.btn-share:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  transform: translateY(-1px);
}

/* ==========================================================================
   GLOBAL APP TOAST NOTIFICATION SYSTEM (Universal & Non-Blocking)
   ========================================================================== */
.app-toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 90vw;
  width: 420px;
}

.app-toast {
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-16px) scale(0.96);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-toast.toast-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.app-toast.toast-hide {
  opacity: 0;
  transform: translateY(-12px) scale(0.95);
}

.app-toast-success {
  border-left: 4px solid #10b981;
}

.app-toast-warning {
  border-left: 4px solid #f59e0b;
}

.app-toast-error {
  border-left: 4px solid #ef4444;
}

.app-toast-info {
  border-left: 4px solid #8b5cf6;
}

.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.toast-msg {
  flex: 1;
  line-height: 1.4;
  word-break: break-word;
}

/* ==========================================================================
   UNIVERSAL DEVICE POLISH: iOS, Android, Tablet, Desktop, Mac
   ========================================================================== */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: max(76px, calc(70px + env(safe-area-inset-bottom, 10px)));
}

/* iPhone Safe Area Navigation */
.nav-tabs {
  padding-bottom: max(6px, env(safe-area-inset-bottom, 6px));
}

/* Smooth Momentum Scrolling */
.app-container, .invoices-list, .voice-parsed-list, .modal-container, .preview-modal-container {
  -webkit-overflow-scrolling: touch;
}

/* Prevent unwanted Safari zoom on inputs while keeping styling crisp */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="number"],
  input[type="tel"],
  input[type="email"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ==========================================================================
   SMART ASSISTANT & INTERNATIONAL UPGRADES STYLING
   ========================================================================== */
.nav-tab.nav-tab-assistant {
  color: #38bdf8;
  position: relative;
}
.nav-tab.nav-tab-assistant .tab-icon {
  font-size: 18px;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.4));
}

.btn-tax-preset {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-tax-preset:hover, .btn-tax-preset.active {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.6);
  color: #a5b4fc;
}

.btn-wholesale-tier {
  background: rgba(245, 158, 11, 0.1);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-wholesale-tier:hover, .btn-wholesale-tier.active {
  background: rgba(245, 158, 11, 0.3);
  border-color: #f59e0b;
  color: #fbbf24;
}

.btn-deposit-preset {
  background: rgba(14, 165, 233, 0.1);
  color: #bae6fd;
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-deposit-preset:hover, .btn-deposit-preset.active {
  background: rgba(14, 165, 233, 0.3);
  border-color: #0ea5e9;
  color: #38bdf8;
}

.btn-image {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  transition: all 0.2s ease;
}
.btn-image:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
}

.btn-assistant-topic {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-assistant-topic.active, .btn-assistant-topic:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
}

.assistant-faq-card {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.assistant-faq-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(30, 41, 59, 0.9);
}
.assistant-faq-title {
  font-weight: 700;
  font-size: 13px;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.assistant-faq-body {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.55;
  color: #94a3b8;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 8px;
}

/* ==========================================================================
   20-YEAR FUTURE-PROOF UPGRADES (SIGNATURE, ESTIMATES, STATEMENTS, BARCODES)
   ========================================================================== */

/* Document Type Badges */
.doc-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.doc-badge-invoice {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.4);
}
.doc-badge-estimate {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}
.doc-badge-proforma {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}
.doc-badge-receipt {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

/* Barcode Sticker Cards */
.barcode-sticker-card {
  background: #ffffff;
  border: 1px dashed #94a3b8;
  border-radius: 4px;
  padding: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  page-break-inside: avoid;
}
.barcode-sticker-name {
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.barcode-sticker-price {
  font-size: 12px;
  font-weight: 800;
  color: #2563eb;
  margin-top: 2px;
}
.barcode-sticker-card svg {
  max-width: 100%;
  height: 48px;
}

/* Retail Shelf Price Tag Stencil */
.barcode-shelf-tag-card {
  background: #ffffff;
  border: 2px solid #0f172a;
  border-radius: 6px;
  padding: 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  page-break-inside: avoid;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #0f172a;
}
.barcode-shelf-store {
  font-size: 9px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.barcode-shelf-title {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  margin: 2px 0 4px 0;
  line-height: 1.2;
}
.barcode-shelf-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0;
}
.barcode-shelf-bold-price {
  font-size: 24px;
  font-weight: 900;
  color: #059669;
  line-height: 1;
}
.barcode-shelf-mrp {
  font-size: 12px;
  color: #94a3b8;
  text-decoration: line-through;
  font-weight: 600;
}
.barcode-shelf-save-badge {
  font-size: 10px;
  font-weight: 800;
  background: #fef08a;
  color: #854d0e;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #facc15;
}
.barcode-shelf-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  border-top: 1px dashed #cbd5e1;
  padding-top: 4px;
}
.barcode-shelf-footer svg {
  height: 28px;
  max-width: 110px;
}
.barcode-shelf-sku-text {
  font-size: 9px;
  font-family: monospace;
  color: #64748b;
}

/* Print Overrides for Statement & Barcode Label Sheets */
@media print {
  body.printing-statement #app-header,
  body.printing-statement .nav-tabs,
  body.printing-statement .tab-content,
  body.printing-statement .modal-backdrop:not(#customer-statement-modal),
  body.printing-statement #customer-statement-modal .modal-top,
  body.printing-statement #customer-statement-modal .modal-sub,
  body.printing-statement #customer-statement-modal .form-row,
  body.printing-statement #customer-statement-modal > .modal-card > div:last-child {
    display: none !important;
  }
  body.printing-statement #customer-statement-modal {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
  }
  body.printing-statement #customer-statement-modal .modal-card {
    max-width: 100% !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }

  body.printing-barcodes #app-header,
  body.printing-barcodes .nav-tabs,
  body.printing-barcodes .tab-content,
  body.printing-barcodes .modal-backdrop:not(#barcode-maker-modal),
  body.printing-barcodes #barcode-maker-modal .modal-top,
  body.printing-barcodes #barcode-maker-modal .modal-sub,
  body.printing-barcodes #barcode-maker-modal .form-row,
  body.printing-barcodes #barcode-maker-modal > .modal-card > div:last-child {
    display: none !important;
  }
  body.printing-barcodes #barcode-maker-modal {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
  }
  body.printing-barcodes #barcode-maker-modal .modal-card {
    max-width: 100% !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
  body.printing-barcodes #barcode-printable-area {
    border: none !important;
    max-height: none !important;
    padding: 0 !important;
  }

  body.printing-tax-report #app-header,
  body.printing-tax-report .nav-tabs,
  body.printing-tax-report .tab-content,
  body.printing-tax-report .modal-backdrop:not(#monthly-tax-modal),
  body.printing-tax-report #monthly-tax-modal .modal-top,
  body.printing-tax-report #monthly-tax-modal .modal-sub,
  body.printing-tax-report #monthly-tax-modal .form-row {
    display: none !important;
  }
  body.printing-tax-report #monthly-tax-modal {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
  }
  body.printing-tax-report #monthly-tax-modal .modal-card {
    max-width: 100% !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }

  /* Daily Z-Report Thermal / A4 Print Engine */
  body.printing-z-report #app-header,
  body.printing-z-report .nav-tabs,
  body.printing-z-report .tab-content,
  body.printing-z-report .modal-backdrop:not(#register-close-modal),
  body.printing-z-report #register-close-modal .modal-top,
  body.printing-z-report #register-close-modal .modal-sub,
  body.printing-z-report #register-close-modal > .modal-card > div:nth-child(3) {
    display: none !important;
  }
  body.printing-z-report #register-close-modal {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
  }
  body.printing-z-report #register-close-modal .modal-card {
    max-width: 100% !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
  body.printing-z-report #z-report-sheet {
    border: none !important;
    max-width: 76mm !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  /* Shop Counter QR Standee Print Engine */
  body.printing-standee #app-header,
  body.printing-standee .nav-tabs,
  body.printing-standee .tab-content,
  body.printing-standee .modal-backdrop:not(#shop-standee-modal),
  body.printing-standee #shop-standee-modal .modal-top,
  body.printing-standee #shop-standee-modal .modal-sub,
  body.printing-standee #shop-standee-modal > .modal-card > div:nth-child(3) {
    display: none !important;
  }
  body.printing-standee #shop-standee-modal {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
  }
  body.printing-standee #shop-standee-modal .modal-card {
    max-width: 100% !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
  body.printing-standee #standee-printable-card {
    border: 3px solid #1e3a8a !important;
    max-width: 140mm !important;
    margin: 20px auto !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
  }
}

/* ==========================================================================
   20-YEAR HIGH-IMPACT EXTENSION STYLES
   ========================================================================== */

/* 1. Delivery Challan & Packing Slip Mode */
.delivery-challan-mode .inv-paper-table th:nth-child(4),
.delivery-challan-mode .inv-paper-table th:nth-child(5),
.delivery-challan-mode .inv-paper-table td:nth-child(4),
.delivery-challan-mode .inv-paper-table td:nth-child(5),
.delivery-challan-mode .inv-footer-grid,
.delivery-challan-mode #paper-payment-box,
.delivery-challan-mode .invoice-rubber-stamp,
.delivery-challan-mode #paper-terms-col {
  display: none !important;
}

.delivery-challan-mode .inv-paper-table th:nth-child(2),
.delivery-challan-mode .inv-paper-table td:nth-child(2) {
  width: 75% !important;
}

.delivery-challan-mode #paper-challan-receiver-box {
  display: block !important;
}

/* 2. WhatsApp Action Options */
.whatsapp-opt-btn {
  transition: all 0.2s ease;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}
.whatsapp-opt-btn:hover {
  background: rgba(56, 189, 248, 0.12) !important;
  border-color: #38bdf8 !important;
  transform: translateY(-1px);
}

/* 3. Multi-Company Profile Cards */
.company-profile-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}
.company-profile-card.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}
.company-profile-card:hover {
  border-color: rgba(56, 189, 248, 0.5);
}

.btn-company-switcher:hover {
  background: rgba(30, 41, 59, 1) !important;
  border-color: #38bdf8 !important;
}

/* Quick Terms & Conditions Presets */
.btn-term-preset {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.btn-term-preset:hover, .btn-term-preset:active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #fff;
  transform: translateY(-1px);
}

/* Printable Bank Wire Transfer Details Box */
.inv-bank-details-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 10px;
  color: #1e293b;
  font-family: inherit;
}

/* ==========================================================================
   DESKTOP, LAPTOP, MACBOOK & TABLET RESPONSIVE WORKSPACE (WORLDWIDE STANDARD)
   ========================================================================== */

/* Tablet Optimization (768px to 1023px, iPad Pro / Air / Galaxy Tab) */
@media screen and (min-width: 768px) and (max-width: 1023px) {
  .app-container {
    max-width: 820px;
    width: 96%;
    padding: 18px 24px 140px;
  }

  /* Tablet Header Layout: Prevent Action Collisions and Overflow */
  .app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .ad-banner-slot {
    max-width: 820px;
    border-radius: 12px 12px 0 0;
  }

  .nav-tabs {
    gap: 6px;
    padding: 6px 8px;
    border-radius: 12px;
  }
  .nav-tab {
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 700;
  }
  .tab-icon {
    font-size: 16px;
  }

  .summary-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .summary-cards .total-card {
    grid-column: 1 / -1;
  }
  .summary-cards .summary-row {
    display: contents;
  }
  #dash-profit-card {
    grid-column: 1 / -1;
    margin-top: 0 !important;
  }

  /* 2-Column Workstation on iPad */
  .invoice-form {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 8px;
    align-items: start;
  }
  #card-global-banner { grid-column: 1 / -1; }
  #card-doc-type { grid-column: 1 / -1; }
  #card-active-biz-bar { grid-column: 1 / -1; }
  #card-client-info { grid-column: 1; }
  #card-doc-meta { grid-column: 2; }
  #card-b2b-logistics { grid-column: 1 / -1; }
  #card-items-table { grid-column: 1 / -1; }
  #card-totals { grid-column: 1 / -1; }
  #card-notes-terms { grid-column: 1 / -1; }
  #card-form-actions,
  .form-actions-bottom {
    grid-column: 1 / -1 !important;
    position: sticky !important;
    bottom: 75px !important;
    z-index: 90 !important;
  }

  #recent-invoices-list,
  #all-invoices-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  /* Tablet Settings: Modern Balanced 2-Column Responsive Grid */
  #tab-settings.active {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
    align-items: start !important;
    padding-bottom: 140px !important;
  }
  #tab-settings .settings-card {
    grid-row: auto !important;
    grid-column: auto !important;
    margin-bottom: 0 !important;
  }
  #card-industry-vertical,
  #tab-settings .settings-card:last-child {
    grid-column: 1 / -1 !important;
  }

  .modal-card {
    max-width: 580px;
  }
}

/* Desktop, Laptop, MacBook & Large Displays (>= 1024px) */
@media screen and (min-width: 1024px) {
  body {
    background: radial-gradient(circle at 50% -10%, #1a2749 0%, #0b1329 60%, #050914 100%);
    background-attachment: fixed;
  }

  /* Full-Page Executive Container */
  .app-container {
    max-width: 1280px;
    width: 94%;
    margin: 0 auto;
    padding: 24px 36px 140px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5), 0 0 100px rgba(14, 28, 64, 0.4);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }

  .ad-banner-slot {
    max-width: 1280px;
    border-radius: 12px 12px 0 0;
    padding: 8px 24px;
  }

  /* Executive Header */
  .app-header {
    padding-bottom: 16px;
    margin-bottom: 20px;
  }

  .brand-icon {
    width: 48px;
    height: 48px;
    font-size: 26px;
    border-radius: 14px;
  }

  .brand-info h1 {
    font-size: 24px;
    letter-spacing: -0.4px;
  }

  .brand-info .sub {
    font-size: 13px;
  }

  .header-actions {
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
    flex-shrink: 0;
  }

  .lang-dropdown {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 8px;
  }

  .btn-company-switcher {
    padding: 8px 14px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
  }

  #header-company-name {
    max-width: 180px !important;
  }

  .pro-badge-btn {
    padding: 8px 16px;
    font-size: 13px;
  }

  /* Desktop Top Navigation Bar (Sticky Blur Header) */
  .nav-tabs {
    position: sticky;
    top: 14px;
    z-index: 95;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 8px 12px;
    gap: 8px;
    border-radius: 14px;
    margin-bottom: 24px;
    background: rgba(19, 28, 54, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }

  .nav-tab {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
  }

  .nav-tab .tab-icon {
    font-size: 18px;
  }

  .nav-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    transform: translateY(-1px);
  }

  .nav-tab.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.45);
  }

  /* TAB 1: DASHBOARD METRICS & WIDE CARDS */
  #tab-dashboard .summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 22px;
  }

  #tab-dashboard .summary-row {
    display: contents;
  }

  #dash-profit-card {
    margin-top: 0 !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .dash-quick-utilities {
    gap: 14px !important;
    margin: 18px 0 24px 0 !important;
  }

  .dash-quick-utilities .btn-action-outline {
    padding: 14px 20px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    transition: all 0.2s ease;
  }

  .dash-quick-utilities .btn-action-outline:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  }

  #recent-invoices-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
  }

  .invoice-item-card {
    padding: 16px 18px;
  }

  .invoice-item-card:hover {
    background: #233154;
    border-color: #38bdf8;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  }

  /* TAB 2: INVOICE CREATOR WORKSTATION (COMPACT SIDE-BY-SIDE PRO DESKTOP LAYOUT) */
  .invoice-form {
    display: grid;
    grid-template-columns: 1.25fr 0.85fr;
    gap: 10px;
    align-items: start;
  }

  #card-global-banner {
    grid-column: 1 / -1;
  }

  #card-doc-type {
    grid-column: 1 / -1;
  }

  #card-active-biz-bar {
    grid-column: 1 / -1;
  }

  /* Compact Client (Left) & Document Meta (Right) side-by-side */
  #card-client-info {
    grid-column: 1;
  }

  #card-doc-meta {
    grid-column: 2;
  }

  #card-b2b-logistics {
    grid-column: 1 / -1;
  }

  /* Products Table (Left Column) & Totals Calculation (Right Column) side-by-side */
  #card-items-table {
    grid-column: 1;
    align-self: start;
  }

  #card-totals {
    grid-column: 2;
    align-self: start;
    position: sticky !important;
    top: 12px !important;
    background: #1c2744;
    border: 1px solid rgba(56, 189, 248, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    z-index: 10 !important;
  }

  #card-notes-terms {
    grid-column: 1 / -1;
  }

  #card-form-actions,
  .form-actions-bottom {
    grid-column: 1 / -1 !important;
    position: sticky !important;
    bottom: 16px !important;
    margin-top: 12px !important;
    width: 100% !important;
    z-index: 95 !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35) !important;
  }

  #card-form-actions .btn-primary-action {
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 800;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
  }

  /* Products & Items Table Styling */
  .items-table th,
  .items-table td {
    padding: 10px 8px;
  }

  .table-input {
    padding: 8px 10px;
    font-size: 13px;
  }

  /* TAB 3: INVOICE HISTORY DESKTOP */
  .history-filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
  }

  .history-filter-bar .search-box {
    flex: 1;
  }

  #all-invoices-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
  }

  /* TAB 4: EXPENSES & PROFIT TRACKER DESKTOP */
  #tab-profit .summary-cards {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 18px;
    margin-bottom: 20px;
  }

  #tab-profit .summary-row {
    display: contents;
  }

  #expenses-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)) !important;
    gap: 14px !important;
  }

  /* TAB 5: SETTINGS & PREFERENCES — Modern Balanced 2-Column Responsive SaaS Grid (Desktop) */
  #tab-settings.active {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 22px !important;
    align-items: start !important;
    padding-bottom: 140px !important;
  }

  #tab-settings .settings-card {
    grid-row: auto !important;
    grid-column: auto !important;
    margin-bottom: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 20px 24px !important;
  }

  /* Clean full-width sections for showcase chips and footer */
  #card-industry-vertical,
  #tab-settings .settings-card:last-child {
    grid-column: 1 / -1 !important;
  }

  /* INVOICE PREVIEW MODAL (FULL A4 SIZING ON DESKTOP) */
  .preview-modal-container {
    max-width: 980px;
    width: 95%;
    margin: 20px auto;
  }

  .preview-top-toolbar {
    position: sticky;
    top: 12px;
    z-index: 200;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .preview-top-toolbar .template-switcher-bar {
    width: 100% !important;
    order: 2 !important;
    display: flex !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(56, 189, 248, 0.4) transparent !important;
    padding: 6px 4px !important;
    gap: 6px !important;
  }

  .preview-top-toolbar .template-switcher-bar::-webkit-scrollbar {
    height: 5px !important;
  }

  .preview-top-toolbar .template-switcher-bar::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.4) !important;
    border-radius: 4px !important;
  }

  .btn-toolbar {
    padding: 9px 16px;
    font-size: 13px;
  }

  .invoice-paper {
    padding: 40px 48px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  }

  /* POPUP DIALOGS ON DESKTOP */
  .modal-card {
    max-width: 580px;
    padding: 30px;
    border-radius: 20px;
  }

  #smart-assistant-modal .modal-card {
    max-width: 680px;
  }

  #catalog-modal .modal-card,
  #address-book-modal .modal-card,
  #monthly-tax-modal .modal-card,
  #register-close-modal .modal-card,
  #customer-statement-modal .modal-card {
    max-width: 720px;
  }
}

/* Ultra-Wide Monitors & iMacs (>= 1440px) */
@media screen and (min-width: 1440px) {
  .app-container {
    max-width: 1360px;
  }
}

/* ==========================================================================
   RETAIL, SUPERMARKET & POS SPEED BILLING ENHANCEMENTS
   ========================================================================== */
.btn-hero-fast-pos:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.55) !important;
}
.btn-hero-fast-pos:active {
  transform: scale(0.98);
}

#dash-low-stock-alert:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(217, 119, 6, 0.14)) !important;
  border-color: #f59e0b !important;
}

.btn-fast-checkout:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.55) !important;
}

.catalog-filter-pill {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.catalog-filter-pill.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #fff;
}

/* ==========================================================================
   ENTERPRISE DESKTOP & LAPTOP COMMAND PALETTE & KEYBOARD PRODUCTIVITY
   ========================================================================== */

/* Keyboard Shortcut Badges */
.kbd-shortcut {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 2px 5px;
  color: #94a3b8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.2px;
}
.desktop-only-inline {
  display: none;
}
@media screen and (min-width: 1024px) {
  .desktop-only-inline {
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
  }
}

/* Desktop Command Palette Header Trigger */
.btn-desktop-cmd-trigger {
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-desktop-cmd-trigger:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: #38bdf8;
  color: #fff;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
}
@media screen and (min-width: 1024px) {
  .btn-desktop-cmd-trigger {
    display: flex;
  }
}

/* Command Palette Modal Card */
.command-palette-card {
  max-width: 620px !important;
  width: 92% !important;
  background: rgba(15, 23, 42, 0.96) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  border-radius: 16px !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 40px rgba(56, 189, 248, 0.18) !important;
  padding: 0 !important;
  overflow: hidden !important;
  text-align: left !important;
}

.command-palette-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(30, 41, 59, 0.5);
}

.command-palette-header input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  outline: none;
  box-shadow: none !important;
}

.command-palette-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.command-palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13px;
  user-select: none;
}

.command-palette-item:hover, .command-palette-item.active {
  background: rgba(56, 189, 248, 0.2);
  color: #fff;
  border-left: 3px solid #38bdf8;
  padding-left: 11px;
}

.command-palette-item .cmd-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.command-palette-item .cmd-badge {
  font-size: 11px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
}

.command-palette-footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: #64748b;
}

/* A4 Magnification & Zoom Controls */
.zoom-controls-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 3px 6px;
}

.btn-zoom-action {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 700;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-zoom-action:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-zoom-fit {
  font-size: 11px;
  width: auto;
  padding: 2px 6px;
}

#zoom-level-text {
  font-size: 11px;
  color: #94a3b8;
  min-width: 34px;
  text-align: center;
  font-family: monospace;
}

/* Mobile Screens Polish (< 768px) */
@media screen and (max-width: 767px) {
  .app-container {
    padding: 8px 10px 140px;
  }

  /* Fluid Compact Navigation on Mobile (iPhone & Android) */
  .nav-tabs {
    gap: 2px;
    padding: 3px;
  }
  .nav-tab {
    padding: 7px 1px;
    min-height: 44px;
    border-radius: 8px;
  }
  .nav-tab .tab-icon {
    font-size: 15px;
  }
  .nav-tab .tab-label {
    font-size: clamp(9px, 2.4vw, 10.5px);
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.1;
  }

  /* 1. Header Layout: Prevent Language Selector & Brand Title Collisions */
  .app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    row-gap: 6px;
    padding-bottom: 8px;
    margin-bottom: 10px;
  }

  .brand-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    min-width: 0;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    font-size: 18px;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .brand-info h1 {
    font-size: 15px;
    letter-spacing: -0.3px;
    line-height: 1.1;
    white-space: nowrap;
  }

  .brand-info .sub {
    font-size: 9.5px;
    letter-spacing: 0.2px;
    white-space: nowrap;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    justify-content: flex-end;
    margin-left: auto;
  }

  /* Compact Language Dropdown on Mobile */
  .lang-selector-wrap {
    flex-shrink: 0;
  }

  .lang-dropdown {
    padding: 4px 22px 4px 6px;
    font-size: 11px;
    max-width: 100px;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-position: right 6px center !important;
    background-size: 12px 12px !important;
  }

  /* Compact Business / Company Profile Switcher on Mobile */
  #header-company-name {
    display: none !important;
  }

  .btn-company-switcher {
    padding: 4px 7px !important;
    font-size: 11px !important;
    gap: 3px !important;
  }

  /* Compact Staff PIN Lock on Mobile */
  #staff-lock-label {
    display: none !important;
  }

  .btn-staff-lock {
    padding: 4px 7px !important;
    font-size: 12px !important;
  }

  /* Compact Pro Badge on Mobile */
  .pro-badge-btn {
    padding: 4px 7px !important;
    font-size: 11px !important;
    gap: 2px !important;
  }

  .pro-badge-btn .txt {
    display: none !important;
  }

  /* 2. Form Rows: Vertical Stacking so Phone/WhatsApp & Payment are 100% visible */
  .form-row {
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .form-row > .form-group,
  .form-group.flex-1,
  .form-group {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Settings Bank Wire Inputs Grid */
  .settings-bank-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .settings-bank-grid input {
    grid-column: span 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Modal Dialogs */
  .modal-backdrop {
    padding: 10px 8px !important;
  }

  .modal-card {
    padding: 16px 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Invoice Printable Sheet & Payment Section */
  .preview-modal-backdrop {
    padding: 8px 6px !important;
  }

  .invoice-paper {
    padding: 10px 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: min-content !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  #invoice-printable-sheet {
    padding: 10px 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: min-content !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  .bm-invoice-sheet {
    padding: 12px 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: min-content !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  /* Reset Top Accent Bar / International Header on mobile */
  .bm-tpl-corporate > div:first-child {
    margin: -12px -10px 14px -10px !important;
  }
  .bm-tpl-international .bm-intl-header {
    margin: -12px -10px 14px -10px !important;
    padding: 10px 12px !important;
  }

  /* Flex Header Stacking */
  .bm-header-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .bm-meta-box {
    text-align: left !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  .bm-meta-box table {
    margin-left: 0 !important;
    width: 100% !important;
  }

  /* Bill To / Ship To Grid Stacking */
  .bm-bill-ship-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 10px 12px !important;
    margin-bottom: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* Modern Template Ribbon */
  .bm-ribbon-row {
    flex-direction: column !important;
    gap: 12px !important;
    padding: 10px 12px !important;
    margin-bottom: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* Executive Template */
  .bm-executive-header {
    flex-direction: column !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .bm-executive-client {
    flex-direction: column !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Retail Template */
  .bm-retail-meta {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Service Template */
  .bm-service-client {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 10px 12px !important;
    margin-bottom: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* International Template */
  .bm-intl-boxes {
    grid-template-columns: 1fr !important;
    margin-bottom: 14px !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .bm-intl-exporter {
    border-right: none !important;
    border-bottom: 1px solid #cbd5e1 !important;
  }
  .bm-intl-strip {
    grid-template-columns: 1fr 1fr !important;
    margin-top: -14px !important;
    margin-bottom: 14px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .bm-intl-strip > div {
    border-bottom: 1px solid #cbd5e1 !important;
  }
  .bm-intl-wire-grid {
    grid-template-columns: 1fr !important;
    gap: 4px !important;
  }

  /* Responsive Items Table Container */
  .bm-table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin-bottom: 16px !important;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-sizing: border-box !important;
  }

  .bm-items-table {
    margin-bottom: 0 !important;
    width: 100% !important;
    min-width: 440px !important;
  }

  .bm-items-table th,
  .bm-items-table td {
    padding: 6px 4px !important;
    font-size: 11px !important;
  }

  /* Financial Summary & QR */
  .bm-summary-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    margin-bottom: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* Footer & Signature */
  .bm-footer-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .bm-footer-row > div:last-child {
    width: 100% !important;
    text-align: left !important;
  }
  .bm-footer-row img {
    margin-left: 0 !important;
    margin-right: auto !important;
  }

  .inv-header-section {
    flex-direction: column !important;
    gap: 10px !important;
  }

  .inv-parties-section {
    flex-direction: column !important;
    gap: 10px !important;
  }

  .inv-bill-to,
  .inv-ship-to {
    min-width: 0 !important;
    width: 100% !important;
  }

  .inv-footer-grid {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
  }

  .inv-footer-grid > div:first-child {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  .inv-paper-totals {
    width: 100% !important;
    max-width: 100% !important;
  }

  .inv-upi-box {
    width: 100% !important;
    max-width: 220px !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
  }

  .paper-upi-id {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    word-break: break-all !important;
  }

  .inv-bank-details-box {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .invoice-paper table.inv-paper-table th,
  .invoice-paper table.inv-paper-table td {
    padding: 6px 4px !important;
    font-size: 11px !important;
  }

  .nav-tabs {
    gap: 3px;
    padding: 3px;
  }
  .nav-tab {
    padding: 6px 1px;
    gap: 2px;
  }
  .tab-icon {
    font-size: 15px;
  }
  .tab-label {
    font-size: 9.5px;
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .preview-top-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .template-switcher-bar {
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .toolbar-actions {
    flex-wrap: wrap;
    width: 100%;
  }
  .toolbar-actions .btn-toolbar {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }
}

/* ==========================================================================
   CASHIER / STAFF PIN LOCK MODE (MYBILLBOOK KILLER)
   ========================================================================== */
.btn-staff-lock {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-staff-lock:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #34d399;
}

body.staff-locked .btn-staff-lock {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
  animation: pulse-staff-lock 2s infinite ease-in-out;
}

@keyframes pulse-staff-lock {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* Elements completely concealed when in Staff / Cashier Mode */
body.staff-locked .staff-hide-profit,
body.staff-locked .staff-hide-profit-tab,
body.staff-locked #btn-dash-add-expense,
body.staff-locked #btn-open-monthly-tax,
body.staff-locked #btn-open-new-company-modal,
body.staff-locked .btn-delete,
body.staff-locked .btn-inv-delete,
body.staff-locked #setting-business-section {
  display: none !important;
}

body.staff-locked .staff-mask-val {
  filter: blur(5px);
  user-select: none;
  pointer-events: none;
}

/* ==========================================================================
   JOYFUL UNIVERSAL MULTI-FORMAT SHARING HUB (SWIPE & ZOHO KILLER)
   ========================================================================== */
.universal-share-card {
  max-width: 580px !important;
  background: rgba(15, 23, 42, 0.96) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  border-radius: 16px !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 40px rgba(56, 189, 248, 0.18) !important;
}

.share-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media screen and (min-width: 540px) {
  .share-options-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.share-option-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.share-option-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.share-card-whatsapp:hover {
  border-color: #25d366;
  background: rgba(37, 211, 102, 0.14);
}

.share-card-telegram:hover {
  border-color: #0088cc;
  background: rgba(0, 136, 204, 0.18);
}

.share-card-email:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.18);
}

.share-card-sms:hover {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.18);
}

.btn-telegram:hover {
  background: rgba(0, 136, 204, 0.35) !important;
  border-color: #38bdf8 !important;
  color: #fff !important;
}

.share-card-image:hover {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
}

.share-card-pdf:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.14);
}

.share-card-text:hover {
  border-color: #a855f7;
  background: rgba(168, 85, 247, 0.14);
}

.share-card-system:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.14);
}

.share-card-icon {
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.share-card-info {
  flex: 1;
  min-width: 0;
}

.share-card-info h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.share-card-info p {
  margin: 2px 0 0 0;
  font-size: 10px;
  color: #94a3b8;
  line-height: 1.3;
}

.share-card-badge {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* ==========================================================================
   CONFETTI CELEBRATION ANIMATION (DELIGHT & JOY)
   ========================================================================== */
.confetti-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  opacity: 0.95;
  border-radius: 2px;
  animation: confetti-fall 2.4s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(var(--x-start), -20px, 0) rotate(0deg);
    opacity: 1;
  }
  80% {
    opacity: 0.9;
  }
  100% {
    transform: translate3d(var(--x-end), 105vh, 0) rotate(720deg);
    opacity: 0;
  }
}

/* ==========================================================================
   INDUSTRY STARTER PACKS & CUSTOMER PURCHASE PORTAL (1-TAP PDF DOWNLOAD)
   ========================================================================== */
.btn-industry-pack {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-industry-pack:hover, .btn-industry-pack:active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #fff;
  transform: translateY(-1px);
}

.btn-industry-pack.active {
  background: rgba(56, 189, 248, 0.3) !important;
  border-color: #38bdf8 !important;
  color: #fff !important;
  font-weight: 700 !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35) !important;
}

.customer-portal-card {
  background: rgba(15, 23, 42, 0.96) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  border-radius: 16px !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(56, 189, 248, 0.15) !important;
}

#portal-items-tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#portal-items-tbody td {
  padding: 8px;
  color: #f1f5f9;
}

/* ==========================================================================
   THANK YOU & REVIEW MESSAGE STYLING (LIMEROAD / RETAIL ENGAGEMENT)
   ========================================================================== */
.share-card-thankyou:hover {
  border-color: #ec4899;
  background: rgba(236, 72, 153, 0.14);
}

.btn-thankyou:hover {
  background: rgba(236, 72, 153, 0.28) !important;
  border-color: #f472b6 !important;
  color: #fff !important;
}

.thankyou-preview-bubble {
  background: #0f172a;
  border: 1px solid rgba(236, 72, 153, 0.35);
  border-left: 4px solid #ec4899;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #f1f5f9;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.thankyou-preview-bubble a {
  color: #38bdf8;
  text-decoration: underline;
}

/* ==========================================================================
   ENTERPRISE SUITE: POS QUICK-BAR, B2B BADGES & STRIPE-STYLE MULTI-RAIL
   ========================================================================== */
.pos-quick-item-opt {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease;
}

.pos-quick-item-opt:last-child {
  border-bottom: none;
}

.pos-quick-item-opt:hover, .pos-quick-item-opt.active {
  background: rgba(56, 189, 248, 0.18);
}

.pos-quick-item-opt .opt-title {
  font-weight: 600;
  color: #fff;
  font-size: 13px;
}

.pos-quick-item-opt .opt-meta {
  font-size: 11px;
  color: #94a3b8;
}

.pos-quick-item-opt .opt-price {
  font-weight: 700;
  color: #34d399;
  font-size: 13px;
}

.btn-copy-wire-detail {
  transition: all 0.15s ease;
}

.btn-copy-wire-detail:hover {
  background: rgba(56, 189, 248, 0.4) !important;
  color: #fff !important;
}

.btn-copy-wire-detail:active {
  transform: scale(0.95);
}

@media print {
  #paper-b2b-badge-bar {
    display: flex !important;
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #paper-dual-currency-row {
    display: flex !important;
    background: #fef3c7 !important;
    color: #92400e !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ==========================================================================
   VIRAL FEATURES SUITE: MINI STORE, SOUNDBOX, P2P SYNC & OCR SCANNER
   ========================================================================== */
.store-product-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.store-product-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

.store-item-badge {
  font-size: 10px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  display: inline-block;
  margin-bottom: 6px;
}

.store-item-title {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.3;
  margin-bottom: 4px;
}

.store-item-price {
  font-size: 14px;
  font-weight: 800;
  color: #34d399;
}

.store-qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.btn-store-qty {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-store-qty:hover {
  background: #10b981;
  border-color: #10b981;
}

.store-qty-val {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  min-width: 18px;
  text-align: center;
}

/* Viral Growth Referral Watermark on Printable Invoices */
.inv-watermark-row {
  text-align: center;
  margin-top: 14px;
  padding-top: 8px;
  border-top: 1px dotted #e2e8f0;
}

#paper-viral-footer {
  display: inline-block;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #64748b;
  text-transform: uppercase;
  background: #f8fafc;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

@media print {
  .inv-watermark-row {
    margin-top: 10px !important;
    padding-top: 6px !important;
    border-top: 1px dotted #cbd5e1 !important;
  }
  #paper-viral-footer {
    color: #475569 !important;
    background: transparent !important;
    border: none !important;
    font-size: 8px !important;
  }
}

/* Demo Preset Selector Modal Styling */
.demo-preset-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.demo-preset-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  border-color: rgba(56, 189, 248, 0.6) !important;
}
.demo-preset-card:active {
  transform: translateY(0);
}





/* ==========================================================================
   ENTERPRISE PREMIUM INVOICE THEME (BillMaster97 — World-Class)
   Beats: Vyapar, Zoho Books, MyBillBook, QuickBooks
   ========================================================================== */

/* Premium Invoice Paper */
#invoice-printable-sheet {
  font-family: 'Inter', 'Segoe UI', -apple-system, sans-serif !important;
  background: #ffffff !important;
  color: #1e293b !important;
}

/* Business name in invoice */
#paper-biz-name {
  font-size: 22px !important;
  font-weight: 900 !important;
  letter-spacing: -0.5px !important;
  color: #0f172a !important;
}

/* Grand total value — make it pop */
#paper-retail-grand-total {
  font-size: 26px !important;
  font-weight: 900 !important;
  color: #0f172a !important;
}

/* Grand total color */
#paper-grand-total {
  color: #2563eb !important;
  font-weight: 900 !important;
}

/* Invoice number */
#paper-inv-num {
  font-family: 'Courier New', monospace !important;
  color: #1e3a8a !important;
  font-weight: 800 !important;
}

/* Client name */
#paper-client-name {
  font-weight: 800 !important;
  color: #0f172a !important;
}

/* Premium items table */
#inv-paper-table thead tr {
  background: linear-gradient(135deg, #1e3a8a, #1e40af) !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

#inv-paper-table thead th {
  color: #fff !important;
  font-weight: 700 !important;
  letter-spacing: 0.8px !important;
  padding: 10px 8px !important;
}

#inv-paper-table tbody tr:nth-child(even) {
  background: #f8fafc !important;
}

/* Grand total row */
.grand-row {
  border-top: 2px solid #2563eb !important;
  padding-top: 8px !important;
}

/* Premium watermark/footer strip */
#paper-watermark {
  background: linear-gradient(135deg, #1e3a8a 0%, #0891b2 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

/* Status badges */
.status-badge {
  display: inline-block !important;
  padding: 3px 10px !important;
  border-radius: 20px !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
}
.status-badge.paid { background: #dcfce7 !important; color: #15803d !important; }
.status-badge.pending { background: #fef3c7 !important; color: #92400e !important; }
.status-badge.overdue { background: #fee2e2 !important; color: #991b1b !important; }
.status-badge.draft { background: #f1f5f9 !important; color: #475569 !important; }

/* UPI box */
#paper-payment-box {
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  border-radius: 10px !important;
}

/* Notes box */
#paper-custom-notes-box {
  background: #fffbeb !important;
  border: 1px solid #fcd34d !important;
  border-radius: 8px !important;
  padding: 10px 14px !important;
}


/* ==========================================================================
   GLOBAL INVOICE DESIGN ENGINE (BillMaster97 Enterprise Suite)
   ========================================================================== */

/* Base Sheet Styling */
.bm-invoice-sheet {
  background: #ffffff !important;
  color: #1e293b !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  padding: 28px !important;
  box-sizing: border-box !important;
  line-height: 1.45 !important;
  position: relative !important;
  margin: 0 auto !important;
  max-width: 820px !important;
}

/* Template Switcher Chips & Color Dots */
.template-switcher-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
}
.template-switcher-bar::-webkit-scrollbar {
  display: none;
}

.btn-template-chip {
  background: rgba(30, 41, 59, 0.85);
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-template-chip:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #fff;
  border-color: #64748b;
}

.btn-template-chip.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  border-color: #60a5fa !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.btn-color-dot {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-color-dot:hover {
  transform: scale(1.2);
}
.btn-color-dot.active {
  transform: scale(1.25);
  box-shadow: 0 0 0 2px #38bdf8, 0 0 10px rgba(56, 189, 248, 0.6);
}

/* Demo Preset Cards */
.demo-preset-card {
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.demo-preset-card:hover {
  transform: translateY(-2px);
  border-color: #38bdf8 !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Multi-Page Print & PDF Controls */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .no-print,
  .preview-top-toolbar,
  .app-header,
  .app-nav,
  .modal-backdrop:not(.preview-modal-backdrop) {
    display: none !important;
  }

  .preview-modal-backdrop {
    position: static !important;
    display: block !important;
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .preview-modal-container {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .invoice-paper,
  .bm-invoice-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 12mm 15mm !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    page-break-after: auto !important;
  }

  /* Repeat table headers on every printed page */
  table.bm-items-table {
    page-break-inside: auto !important;
  }
  table.bm-items-table thead {
    display: table-header-group !important;
  }
  table.bm-items-table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Avoid breaking summary and footers midway */
  .bm-financial-summary,
  .bm-invoice-footer {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  @page {
    size: A4 portrait;
    margin: 10mm 8mm 10mm 8mm;
  }
}

/* ==========================================================================
   PART 3 UX ENHANCEMENTS: ONBOARDING, MOBILE ACTIONS & DELIVERY CONFIRMATION
   ========================================================================== */

/* Quick Start Wizard Card */
.quick-start-card {
  transition: all 0.25s ease;
}
.wizard-step-item:hover {
  border-color: #38bdf8 !important;
  background: rgba(30, 41, 59, 0.9) !important;
  transform: translateY(-1px);
}
.wizard-step-item.completed {
  border-color: rgba(16, 185, 129, 0.4) !important;
  background: rgba(16, 185, 129, 0.08) !important;
}
.wizard-step-item.completed .wizard-check-icon {
  background: #10b981 !important;
  color: #fff !important;
}
.wizard-step-item.completed .wizard-step-action {
  color: #10b981 !important;
}

/* Mobile Counter Billing Floating Action Bar */
.mobile-floating-bar {
  display: none;
}

@media screen and (max-width: 768px) {
  body.tab-active-create .mobile-floating-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
    gap: 8px;
    z-index: 999;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.5);
  }

  body.tab-active-create #invoice-form {
    padding-bottom: 70px;
  }

  .btn-mfloat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 6px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.1s ease;
  }
  .btn-mfloat:active {
    transform: scale(0.97);
  }
  .btn-mfloat-cash {
    background: linear-gradient(135deg, #10b981, #059669);
  }
  .btn-mfloat-wa {
    background: linear-gradient(135deg, #25d366, #128c7e);
  }
  .btn-mfloat-preview {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
  }
}

/* Real-Time Delivery Confirmation Toast */
.delivery-confirm-toast {
  position: fixed;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 420px;
  width: calc(100% - 32px);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98));
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  z-index: 100000;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: slideDownFade 0.3s ease-out;
}
@keyframes slideDownFade {
  from { opacity: 0; transform: translate(-50%, -15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.delivery-toast-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.delivery-toast-icon {
  font-size: 24px;
}
.delivery-toast-info {
  flex: 1;
}
.delivery-toast-info strong {
  display: block;
  font-size: 13px;
  color: #fff;
}
.delivery-toast-info p {
  margin: 0;
  font-size: 11px;
  color: #94a3b8;
}
.btn-close-toast {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
}
.delivery-toast-actions {
  display: flex;
  gap: 8px;
}
.btn-copy-portal-link,
.btn-preview-customer-view {
  flex: 1;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.btn-copy-portal-link {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
}
.btn-preview-customer-view {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Quick Cash Note Chips (F9 Tender) */
.quick-cash-chip {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.8);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.quick-cash-chip:hover {
  border-color: #10b981;
  color: #fff;
  background: rgba(16, 185, 129, 0.2);
  transform: translateY(-1px);
}
.quick-cash-chip.active {
  border-color: #10b981;
  color: #fff;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* Counter Speed Billing: Next Customer Floating Bar */
.counter-next-bill-bar {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border: 1px solid rgba(16, 185, 129, 0.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(16, 185, 129, 0.25);
  animation: slideDownToast 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 92vw;
}

@keyframes slideDownToast {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.btn-counter-next-action {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-counter-next-action:hover {
  transform: scale(1.04);
  background: linear-gradient(135deg, #34d399, #10b981);
}

.btn-counter-view-action {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-counter-view-action:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* ==========================================================================
   MOBILE UX TRANSFORMATION (RESPONSIVE STACKED CARDS & CLEAN PREVIEW BAR)
   ========================================================================== */
@media screen and (max-width: 768px) {
  /* 1. Mobile Item Cards: Eliminates awkward 5-column horizontal table scrolling */
  .items-table-wrapper {
    overflow-x: visible !important;
  }
  .items-table thead {
    display: none !important;
  }
  .items-table, 
  .items-table tbody {
    display: block !important;
    width: 100% !important;
  }
  .items-table tr.item-row {
    display: block !important;
    width: 100% !important;
    background: rgba(30, 41, 59, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 10px !important;
    padding: 10px 12px !important;
    margin-bottom: 10px !important;
    position: relative !important;
    box-sizing: border-box !important;
  }
  .items-table tr.item-row td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
  }
  /* Item Description & Serial Number */
  .items-table tr.item-row td:first-child {
    padding-right: 36px !important;
    margin-bottom: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .items-table tr.item-row td:first-child .item-desc {
    font-size: 13.5px !important;
    font-weight: 600 !important;
    width: 100% !important;
  }
  /* Delete Button: Top Right Corner */
  .items-table tr.item-row td:last-child {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    width: auto !important;
  }
  .items-table tr.item-row .btn-remove-row {
    font-size: 18px !important;
    padding: 2px 6px !important;
    color: #ef4444 !important;
  }
  /* Qty, Rate, and Line Total Inline Row */
  .items-table tr.item-row td:nth-child(2),
  .items-table tr.item-row td:nth-child(3),
  .items-table tr.item-row td:nth-child(4),
  .items-table tr.item-row td:nth-child(5) {
    display: inline-block !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
  }
  .items-table tr.item-row td:nth-child(2) {
    width: 26% !important;
    margin-right: 3% !important;
  }
  .items-table tr.item-row td:nth-child(3) {
    width: 32% !important;
    margin-right: 3% !important;
  }
  .items-table tr.item-row td:nth-child(5) {
    width: 36% !important;
    text-align: right !important;
  }
  .items-table tr.item-row td:nth-child(5) .item-total {
    font-size: 14px !important;
    color: #34d399 !important;
    font-weight: 800 !important;
  }

  /* 2. Swipable Template Chips on Mobile */
  .template-switcher-bar {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    white-space: nowrap !important;
    padding: 4px 0 !important;
    gap: 6px !important;
    max-width: 100% !important;
    scrollbar-width: none !important;
  }
  .template-switcher-bar::-webkit-scrollbar {
    display: none !important;
  }
  .btn-template-chip {
    flex-shrink: 0 !important;
    font-size: 11px !important;
    padding: 5px 9px !important;
  }

  /* 3. Hide desktop zoom controls, but SHOW Color Palette on Mobile */
  .zoom-controls-bar {
    display: none !important;
  }
  .theme-palette-bar {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 3px 8px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border-radius: 20px !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    flex-shrink: 0 !important;
  }
  .theme-palette-bar .btn-color-dot {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    border: 2px solid #fff !important;
    cursor: pointer !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
  }
  .theme-palette-bar .btn-color-dot:active,
  .theme-palette-bar .btn-color-dot.active {
    transform: scale(1.25) !important;
    box-shadow: 0 0 0 2px #38bdf8, 0 0 8px rgba(56, 189, 248, 0.8) !important;
  }

  /* 4. Mobile Sticky Bottom Action Bar inside Preview */
  .mobile-preview-bottom-bar {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: rgba(15, 23, 42, 0.97) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.16) !important;
    padding: 10px 14px !important;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 10px)) !important;
    gap: 8px !important;
    z-index: 10002 !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.7) !important;
  }
  .mobile-preview-bottom-bar button {
    flex: 1 !important;
    padding: 10px 6px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    white-space: nowrap !important;
  }
  .btn-mob-prev-whatsapp {
    flex: 1.4 !important;
    background: linear-gradient(135deg, #25d366, #128c7e) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35) !important;
  }
  .btn-mob-prev-img {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9) !important;
    color: #fff !important;
  }
  .btn-mob-prev-print {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
  }
  .btn-mob-prev-more {
    flex: 0.8 !important;
    background: rgba(30, 41, 59, 0.8) !important;
    color: #94a3b8 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
  }

  /* Leave comfortable room above preview bottom bar */
  .preview-modal-backdrop.active .preview-modal-container {
    padding-bottom: 75px !important;
  }
}

/* Hide mobile preview bottom bar on desktop */
.mobile-preview-bottom-bar {
  display: none;
}

/* ==========================================================================
   ENTERPRISE STREAMLINED BILL CREATION & ACTIVE BUSINESS BAR
   ========================================================================== */

.active-biz-banner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.96));
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  transition: all 0.25s ease;
}

.active-biz-banner:hover {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.active-biz-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 240px;
}

.active-biz-logo-container {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  overflow: hidden;
}

.active-biz-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  padding: 2px;
}

.active-biz-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.active-biz-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.active-biz-title-row h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.2px;
}

.active-biz-badge {
  font-size: 10px;
  background: rgba(52, 211, 153, 0.18);
  color: #34d399;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 700;
  border: 1px solid rgba(52, 211, 153, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.active-biz-details-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: #94a3b8;
  flex-wrap: wrap;
}

.active-biz-details-row .meta-dot {
  color: rgba(255, 255, 255, 0.2);
}

.active-biz-details-row #active-biz-display-sig {
  color: #38bdf8;
  font-weight: 600;
}

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

.active-biz-right #btn-edit-biz-settings {
  font-size: 11.5px;
  padding: 7px 14px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.active-biz-right #btn-edit-biz-settings:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .active-biz-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px;
    gap: 10px;
  }
  .active-biz-right {
    width: 100%;
  }
  .active-biz-right #btn-edit-biz-settings {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}

/* ==========================================================================
   Industry Verticals & Business Scale Selector Styling
   ========================================================================== */
.btn-industry-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #f8fafc;
}

.btn-industry-chip:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.btn-industry-chip.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(56, 189, 248, 0.15));
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.btn-industry-chip.active strong {
  color: #38bdf8 !important;
}

.btn-category-tab {
  transition: all 0.2s ease;
}

.btn-category-tab:hover {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #fff !important;
}

.btn-category-tab.active {
  background: #2563eb !important;
  border-color: #3b82f6 !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}


/* ===== EXECUTIVE CALMING LIGHT SKY EYE-CARE LIGHT MODE ===== */
body.light-mode {
  background: #eef5fb !important;
  background-attachment: scroll !important;
  color: #0f172a !important;
  --bg-app: #eef5fb;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-surface-raised: #e1edf7;
  --border-subtle: #cbdde9;
  --border-active: #0284c7;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --text-main: #0f172a;
  --text-secondary: #1e293b;
  --text-muted: #475569;
}

body.light-mode .app-container {
  background: #f4f8fc !important;
  box-shadow: 0 4px 25px rgba(15, 23, 42, 0.08) !important;
  border-left: 1px solid #cbdde9 !important;
  border-right: 1px solid #cbdde9 !important;
}

@media screen and (min-width: 1024px) {
  body.light-mode {
    background: #e1edf7 !important;
    background-attachment: scroll !important;
  }
  body.light-mode .app-container {
    background: #f8fbfe !important;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08) !important;
    border-left: 1px solid #cbdde9 !important;
    border-right: 1px solid #cbdde9 !important;
  }
}

/* Modals & Dialogs in Light Mode */
body.light-mode .modal-card,
body.light-mode .bottom-sheet-card {
  background: #ffffff !important;
  border: 1.5px solid #cbdde9 !important;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12) !important;
  color: #0f172a !important;
}
body.light-mode .modal-card h2,
body.light-mode .modal-card h3,
body.light-mode .modal-card h4,
body.light-mode .bottom-sheet-header h3 {
  color: #0f172a !important;
  font-weight: 800 !important;
}
body.light-mode .modal-sub {
  color: #475569 !important;
}
body.light-mode .modal-item-chip {
  background: #f0f6fb !important;
  border: 1px solid #cbdde9 !important;
  color: #0f172a !important;
}
body.light-mode .btn-close,
body.light-mode .btn-close-white {
  background: #e1edf7 !important;
  color: #334155 !important;
  border: 1px solid #cbdde9 !important;
}
body.light-mode .btn-close:hover,
body.light-mode .btn-close-white:hover {
  background: #cbdde9 !important;
  color: #0f172a !important;
}

/* Header & Navigation: High Contrast & Calming */
body.light-mode .app-header {
  background: linear-gradient(135deg, #0f2b5c, #0284c7) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12) !important;
  box-shadow: 0 2px 10px rgba(15, 43, 92, 0.2) !important;
}
body.light-mode .nav-tabs {
  background: #ffffff !important;
  border-bottom: 2px solid #cbdde9 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}
body.light-mode .nav-tab {
  color: #334155 !important;
  font-weight: 600 !important;
}
body.light-mode .nav-tab:hover {
  color: #0284c7 !important;
}
body.light-mode .nav-tab.active {
  color: #0284c7 !important;
  border-bottom-color: #0284c7 !important;
  background: rgba(2, 132, 199, 0.08) !important;
  font-weight: 800 !important;
}

/* Cards & Surfaces: Crisp, sharp, no washed-out fade */
body.light-mode .tab-content,
body.light-mode .summary-card,
body.light-mode .form-card,
body.light-mode .settings-card,
body.light-mode .invoice-card {
  background: #ffffff !important;
  border: 1.5px solid #cbdde9 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}

/* Section Headers: Deep bold text */
body.light-mode .form-card-header h3,
body.light-mode .settings-card h3 {
  color: #0f172a !important;
  font-weight: 800 !important;
}

/* Form Inputs: Crisp dark text, distinct borders, sky focus */
body.light-mode input,
body.light-mode select,
body.light-mode textarea {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
  font-weight: 500 !important;
}
body.light-mode input::placeholder,
body.light-mode textarea::placeholder {
  color: #94a3b8 !important;
}
body.light-mode input:focus,
body.light-mode select:focus,
body.light-mode textarea:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18) !important;
  outline: none !important;
}

/* Labels: Dark Slate & Easy on the Eyes */
body.light-mode label,
body.light-mode .card-label,
body.light-mode .field-hint {
  color: #334155 !important;
  font-weight: 700 !important;
}
body.light-mode .card-value {
  color: #0f172a !important;
  font-weight: 800 !important;
}

/* Items Table: Crisp lines and high contrast */
body.light-mode .items-table th {
  color: #1e293b !important;
  font-weight: 800 !important;
  border-bottom: 2px solid #cbdde9 !important;
  background: #f0f6fb !important;
}
body.light-mode .items-table td {
  color: #0f172a !important;
  border-bottom: 1px solid #e2edf7 !important;
}
body.light-mode .items-table input.table-input {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  font-weight: 600 !important;
}
body.light-mode .items-table input.table-input:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2) !important;
}
body.light-mode strong.item-total {
  color: #0f172a !important;
  font-weight: 800 !important;
}

/* Document Type Pills: Distinct and vibrant */
body.light-mode .doc-type-pills {
  background: #e1edf7 !important;
  border: 1px solid #cbdde9 !important;
}
body.light-mode .doc-pill {
  color: #334155 !important;
  font-weight: 700 !important;
}
body.light-mode .doc-pill.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3) !important;
}

/* Totals Box: Sky-themed calculation panel */
body.light-mode #card-totals {
  background: #f0f7ff !important;
  border: 1.5px solid #93c5fd !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08) !important;
}
body.light-mode .totals-row {
  color: #1e293b !important;
  font-weight: 600 !important;
}
body.light-mode .totals-row strong {
  color: #0f172a !important;
}
body.light-mode .grand-total-row {
  border-top: 2px solid #93c5fd !important;
  color: #0f2b5c !important;
}
body.light-mode .grand-total-row strong,
body.light-mode #calc-grand-total {
  color: #0284c7 !important;
  font-size: 22px !important;
  font-weight: 900 !important;
}

/* POS Quick Bar & Banners: Soft eye-friendly contrast */
body.light-mode .pos-quick-bar {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
}
body.light-mode #pos-quick-item-input {
  color: #0f172a !important;
}
body.light-mode .active-biz-banner {
  background: #f0f7ff !important;
  border: 1px solid #93c5fd !important;
}
body.light-mode #active-biz-display-name {
  color: #0f2b5c !important;
}
body.light-mode .active-biz-badge {
  background: #e0f2fe !important;
  color: #0369a1 !important;
}
body.light-mode .active-biz-details-row span {
  color: #334155 !important;
}

/* Action Buttons & Badges */
body.light-mode #btn-toggle-theme {
  background: rgba(255,255,255,0.2) !important;
  border-color: rgba(255,255,255,0.3) !important;
  color: #ffffff !important;
}
body.light-mode .btn-action-outline {
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
  background: #ffffff !important;
}
body.light-mode .btn-action-outline:hover {
  border-color: #0284c7 !important;
  color: #0284c7 !important;
  background: #f0f7ff !important;
}
body.light-mode .btn-pill-action {
  background: #f0f7ff !important;
  color: #0284c7 !important;
  border: 1px solid #bae6fd !important;
}
body.light-mode .btn-pill-action:hover {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
}
body.light-mode #btn-add-item {
  background: #f0f7ff !important;
  border-color: #93c5fd !important;
  color: #0284c7 !important;
}
body.light-mode #btn-add-item:hover {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
}
body.light-mode .btn-tax-preset,
body.light-mode .btn-term-preset {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}
body.light-mode .btn-tax-preset:hover,
body.light-mode .btn-term-preset:hover {
  background: #f0f7ff !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}
body.light-mode .form-actions-bottom {
  background: #ffffff !important;
  border-top: 2px solid #e2edf7 !important;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08) !important;
}

@media screen and (max-width: 768px) {
  .nav-tabs { position: fixed !important; bottom: 0 !important; left: 0 !important; top: auto !important; width: 100% !important; margin: 0 !important; border-radius: 16px 16px 0 0 !important; border-bottom: none !important; border-top: 1px solid var(--border-subtle) !important; box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3) !important; z-index: 9999 !important; background: rgba(19, 28, 54, 0.95) !important; backdrop-filter: blur(10px) !important; padding: 8px 8px max(12px, env(safe-area-inset-bottom, 12px)) 8px !important; display: flex !important; justify-content: space-around !important; }
  body.light-mode .nav-tabs { background: rgba(255, 255, 255, 0.95) !important; box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08) !important; border-top: 1px solid rgba(0,0,0,0.1) !important; }
  .nav-tab { flex-direction: column !important; align-items: center !important; gap: 4px !important; padding: 6px 0 !important; min-height: auto !important; flex: 1 !important; background: transparent !important; }
  .nav-tab .tab-icon { font-size: 20px !important; margin-bottom: 2px !important; }
  .nav-tab .tab-label { font-size: 10px !important; font-weight: 700 !important; }
  .nav-tab.active { color: #38bdf8 !important; border-bottom: none !important; }
  body.light-mode .nav-tab.active { color: #2563eb !important; background: transparent !important; }
  .app-container { padding-bottom: 90px !important; }
}
@keyframes slideUp { from { transform: translateX(-50%) translateY(20px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }

/* ===== NEW BILL SECTION UI PREMIUM REDESIGN ===== */

/* 1. Form Cards Elevation & Softness */
#invoice-form .form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  margin-bottom: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
body.light-mode #invoice-form .form-card {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}
#invoice-form .form-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
body.light-mode #invoice-form .form-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

/* 2. Premium Form Labels */
#invoice-form .form-group label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding-left: 4px;
}
body.light-mode #invoice-form .form-group label {
  color: #1e293b;
  font-weight: 700;
}

/* 3. Modern Floating-Style Inputs */
#invoice-form input:not([type="radio"]):not([type="checkbox"]), 
#invoice-form select, 
#invoice-form textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-main);
  transition: all 0.25s ease;
}
body.light-mode #invoice-form input:not([type="radio"]):not([type="checkbox"]), 
body.light-mode #invoice-form select, 
body.light-mode #invoice-form textarea {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  font-weight: 500;
}
#invoice-form input:not([type="radio"]):not([type="checkbox"]):focus, 
#invoice-form select:focus, 
#invoice-form textarea:focus {
  background: rgba(15, 23, 42, 0.8);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15) !important;
  transform: scale(1.01);
}
body.light-mode #invoice-form input:not([type="radio"]):not([type="checkbox"]):focus, 
body.light-mode #invoice-form select:focus, 
body.light-mode #invoice-form textarea:focus {
  background: #ffffff;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2) !important;
}

/* 4. Document Type iOS Segmented Control */
.doc-type-pills {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: 14px;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
body.light-mode .doc-type-pills {
  background: #f1f5f9;
}
.doc-type-pills::-webkit-scrollbar { display: none; }
.doc-pill {
  flex: 1;
  min-width: 100px;
  text-align: center;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.doc-pill.active {
  background: var(--bg-surface);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
body.light-mode .doc-pill.active {
  background: #059669;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35);
}

/* 5. Line Items Grid Redesign */
.item-row {
  background: rgba(15, 23, 42, 0.3) !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  border-radius: 14px !important;
  padding: 12px !important;
  margin-bottom: 12px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  position: relative;
}
body.light-mode .item-row {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}
.item-row .btn-remove-item {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(244, 63, 94, 0.1);
  color: #f43f5e;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
}
body.light-mode .item-row .btn-remove-item {
  background: #ffe4e6;
  color: #e11d48;
}

/* 6. Premium "Add Item" Button */
#btn-add-item {
  width: 100%;
  background: rgba(56, 189, 248, 0.05) !important;
  border: 2px dashed rgba(56, 189, 248, 0.3) !important;
  color: #38bdf8 !important;
  border-radius: 14px !important;
  padding: 16px !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
}
#btn-add-item:hover {
  background: rgba(56, 189, 248, 0.1) !important;
  border-color: rgba(56, 189, 248, 0.5) !important;
}
body.light-mode #btn-add-item {
  background: #f0f9ff !important;
  border-color: #bae6fd !important;
  color: #0284c7 !important;
}
body.light-mode #btn-add-item:hover {
  background: #e0f2fe !important;
  border-color: #7dd3fc !important;
}

/* 7. Action Buttons Bottom Bar */
.form-actions-bottom {
  background: var(--bg-surface);
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  position: sticky;
  bottom: 16px; /* Sits above mobile nav */
  z-index: 90;
}
body.light-mode .form-actions-bottom {
  background: #ffffff;
  border-color: rgba(0,0,0,0.05);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.04);
}
@media screen and (max-width: 768px) {
  .form-actions-bottom {
    bottom: 80px; /* Above mobile nav */
    border-radius: 16px;
    margin: 0 8px 16px 8px;
  }
}

/* Enhance form rows for responsiveness */
@media screen and (max-width: 500px) {
  #invoice-form .form-row {
    flex-direction: column !important;
    gap: 12px !important;
  }
}

/* Ultra Premium Generate Button */
#btn-generate-invoice {
  background: linear-gradient(135deg, var(--primary), #4f46e5) !important;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4) !important;
  border-radius: 12px !important;
  font-weight: 800 !important;
  padding: 16px !important;
  font-size: 14px !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s ease !important;
}
#btn-generate-invoice:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.5) !important;
}
#btn-quick-pos-checkout {
  border-radius: 12px !important;
  padding: 16px !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s ease !important;
}
#btn-quick-pos-checkout:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.5) !important;
}

/* Ensure items-table rows behave as true table rows in desktop */
@media screen and (min-width: 769px) {
  .items-table tr.item-row {
    display: table-row !important;
    background: transparent !important;
  }
  .items-table tr.item-row td {
    display: table-cell !important;
  }
}


/* ==========================================================================
   MOBILE BOTTOM NAVIGATION & FLOATING CREATE ACTION SHEET (BM-UI-002)
   ========================================================================== */

/* Responsive visibility between Desktop & Mobile bottom nav */
@media (min-width: 769px) {
  .nav-mobile-only {
    display: none !important;
  }
  .nav-desktop-only {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  .nav-desktop-only {
    display: none !important;
  }
  .nav-mobile-only {
    display: flex !important;
  }

  /* Center elevated CREATE button */
  .nav-tab.nav-tab-create-elevated {
    position: relative;
    top: -12px;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    z-index: 10001;
  }

  .create-fab-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 900;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5);
    border: 3px solid #0f172a;
    transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.12s ease;
  }

  body.light-mode .create-fab-circle {
    border-color: #ffffff;
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.35);
  }

  .nav-tab-create-elevated:active .create-fab-circle {
    transform: scale(0.92);
  }

  .create-fab-label {
    font-size: 9.5px !important;
    font-weight: 800 !important;
    color: #10b981 !important;
    margin-top: 2px !important;
    letter-spacing: 0.3px;
  }
  body.light-mode .create-fab-label {
    color: #047857 !important;
  }
}

/* Header Live Sync & Offline Ready Badge */
.header-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 14px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-size: 11px;
  font-weight: 700;
  cursor: default;
  white-space: nowrap;
}

body.light-mode .header-sync-badge {
  background: #ecfdf5;
  border-color: #86efac;
  color: #059669;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseSyncDot 2.2s infinite ease-in-out;
}

@keyframes pulseSyncDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Bottom Sheet Drawer Backdrop & Cards */
.bottom-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10500;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-sheet-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet-card {
  background: #1e293b;
  border-radius: 20px 20px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding: 14px 18px max(24px, env(safe-area-inset-bottom, 24px));
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.5);
  transform: translateY(100%);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

body.light-mode .bottom-sheet-card {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.12);
}

.bottom-sheet-backdrop.active .bottom-sheet-card {
  transform: translateY(0);
}

.bottom-sheet-drag-handle {
  width: 40px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.25);
  margin: 0 auto 10px auto;
}

body.light-mode .bottom-sheet-drag-handle {
  background: #cbd5e1;
}

.bottom-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

body.light-mode .bottom-sheet-header h3 {
  color: #0f172a !important;
}

.bottom-sheet-action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sheet-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.6);
  color: #f8fafc;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease;
}

body.light-mode .sheet-action-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

.sheet-action-btn:active {
  transform: scale(0.985);
}

.sheet-action-btn:hover {
  background: rgba(255, 255, 255, 0.09);
}

body.light-mode .sheet-action-btn:hover {
  background: #f1f5f9;
}

.sheet-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}

.sheet-action-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sheet-action-title {
  font-size: 13.5px;
  font-weight: 700;
}

.sheet-action-desc {
  font-size: 11px;
  color: #94a3b8;
}

body.light-mode .sheet-action-desc {
  color: #64748b;
}

.sheet-action-arrow {
  font-size: 13px;
  color: #64748b;
}

/* Paper Format Switcher Chips (A4, A5, 80mm, 58mm) */
.preview-format-switcher-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 6px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.light-mode .preview-format-switcher-bar {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-format-chip {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid transparent;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

body.light-mode .btn-format-chip {
  color: #475569;
}

.btn-format-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

body.light-mode .btn-format-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-format-chip.active {
  background: #059669;
  color: #ffffff;
  border-color: #10b981;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}

/* ==========================================================================
   PRECISION PAPER FORMAT SYSTEM (A4, A5, 80mm POS, 58mm POS)
   ========================================================================== */

/* 1. A4 Format (Standard 210mm x 297mm) */
.invoice-paper.paper-format-a4 {
  max-width: 820px !important;
  width: 100% !important;
  margin: 0 auto !important;
  transition: max-width 0.2s ease;
}
.invoice-paper.paper-format-a4 .bm-invoice-sheet {
  max-width: 820px !important;
  width: 100% !important;
  padding: 28px !important;
  font-size: 11.5px;
}

/* 2. A5 Format (Half-Page / Notebook / Pocket: 148mm x 210mm) */
.invoice-paper.paper-format-a5 {
  max-width: 580px !important;
  width: 100% !important;
  margin: 0 auto !important;
  transition: max-width 0.2s ease;
}
.invoice-paper.paper-format-a5 .bm-invoice-sheet {
  max-width: 580px !important;
  width: 100% !important;
  padding: 16px 14px !important;
  font-size: 10.5px !important;
  line-height: 1.38 !important;
}
.invoice-paper.paper-format-a5 .bm-invoice-sheet h1 {
  font-size: 18px !important;
  margin-bottom: 2px !important;
}
.invoice-paper.paper-format-a5 .bm-invoice-sheet .bm-header-row {
  margin-bottom: 14px !important;
  gap: 12px !important;
}
.invoice-paper.paper-format-a5 .bm-invoice-sheet .bm-bill-ship-grid,
.invoice-paper.paper-format-a5 .bm-invoice-sheet .bm-ribbon-row,
.invoice-paper.paper-format-a5 .bm-invoice-sheet .bm-service-client,
.invoice-paper.paper-format-a5 .bm-invoice-sheet .bm-intl-boxes {
  padding: 8px 10px !important;
  margin-bottom: 12px !important;
  gap: 10px !important;
  font-size: 10px !important;
}
.invoice-paper.paper-format-a5 .bm-invoice-sheet .bm-industry-meta-bar {
  padding: 6px 10px !important;
  margin-bottom: 12px !important;
  font-size: 9.5px !important;
}
.invoice-paper.paper-format-a5 .bm-invoice-sheet .bm-invoice-table {
  font-size: 10px !important;
}
.invoice-paper.paper-format-a5 .bm-invoice-sheet .bm-invoice-table th,
.invoice-paper.paper-format-a5 .bm-invoice-sheet .bm-invoice-table td {
  padding: 6px 6px !important;
  font-size: 10px !important;
}
.invoice-paper.paper-format-a5 .bm-invoice-sheet .bm-summary-grid {
  gap: 14px !important;
  margin-bottom: 14px !important;
}
.invoice-paper.paper-format-a5 .bm-invoice-sheet .bm-summary-grid [style*="font-size: 22px"] {
  font-size: 17px !important;
}
.invoice-paper.paper-format-a5 .bm-invoice-sheet .bm-footer-row {
  gap: 10px !important;
  font-size: 9px !important;
  padding-top: 10px !important;
  margin-top: 12px !important;
}

/* 3. 80mm Thermal POS Receipt (Standard 80mm / 3-inch Roll, 72mm printable) */
.invoice-paper.paper-format-80mm {
  max-width: 340px !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 0 !important;
  background: #ffffff !important;
  transition: max-width 0.2s ease;
}
.invoice-paper.paper-format-80mm .bm-invoice-sheet,
.invoice-paper.paper-format-80mm .bm-tpl-thermal {
  max-width: 340px !important;
  width: 100% !important;
  padding: 10px 8px !important;
  font-size: 11px !important;
  box-sizing: border-box !important;
  font-family: monospace, 'Courier New', monospace !important;
  border-radius: 0 !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
}

/* 4. 58mm Mini Thermal POS Receipt (Compact 58mm / 2-inch Roll, 48mm printable) */
.invoice-paper.paper-format-58mm {
  max-width: 230px !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 0 !important;
  background: #ffffff !important;
  transition: max-width 0.2s ease;
}
.invoice-paper.paper-format-58mm .bm-invoice-sheet,
.invoice-paper.paper-format-58mm .bm-tpl-thermal {
  max-width: 230px !important;
  width: 100% !important;
  padding: 6px 4px !important;
  font-size: 9px !important;
  line-height: 1.3 !important;
  box-sizing: border-box !important;
  font-family: monospace, 'Courier New', monospace !important;
  border-radius: 0 !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
}
.invoice-paper.paper-format-58mm .bm-tpl-thermal > div {
  font-size: 8.5px !important;
}
.invoice-paper.paper-format-58mm .bm-tpl-thermal [style*="font-size: 15px"],
.invoice-paper.paper-format-58mm .bm-tpl-thermal [style*="font-size: 24px"],
.invoice-paper.paper-format-58mm .bm-tpl-thermal h1 {
  font-size: 12px !important;
}
.invoice-paper.paper-format-58mm .bm-tpl-thermal [style*="font-size: 14px"] {
  font-size: 11px !important;
}
.invoice-paper.paper-format-58mm .bm-tpl-thermal [style*="font-size: 10.5px"],
.invoice-paper.paper-format-58mm .bm-tpl-thermal [style*="font-size: 10px"] {
  font-size: 8.5px !important;
}

/* Print Media Paper Formats */
@media print {
  /* A4 Print */
  body.printing-paper-a4 .invoice-paper,
  body.printing-paper-a4 .bm-invoice-sheet {
    width: 100% !important;
    max-width: 100% !important;
    padding: 8mm 10mm !important;
  }

  /* A5 Print */
  body.printing-paper-a5 .invoice-paper,
  body.printing-paper-a5 .bm-invoice-sheet {
    width: 100% !important;
    max-width: 140mm !important;
    padding: 5mm 5mm !important;
    font-size: 9.5pt !important;
    margin: 0 auto !important;
  }
  body.printing-paper-a5 .bm-invoice-sheet h1 {
    font-size: 15pt !important;
  }

  /* 80mm Thermal Print */
  body.printing-paper-80mm,
  body.printing-thermal {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }
  body.printing-paper-80mm .preview-modal-backdrop,
  body.printing-paper-80mm .preview-modal-container,
  body.printing-thermal .preview-modal-backdrop,
  body.printing-thermal .preview-modal-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  body.printing-paper-80mm .invoice-paper,
  body.printing-paper-80mm .bm-invoice-sheet,
  body.printing-paper-80mm .bm-tpl-thermal,
  body.printing-thermal .invoice-paper.paper-format-80mm .bm-tpl-thermal {
    width: 76mm !important;
    max-width: 76mm !important;
    margin: 0 auto !important;
    padding: 2mm 1mm !important;
    font-size: 10pt !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* 58mm Thermal Print */
  body.printing-paper-58mm {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }
  body.printing-paper-58mm .preview-modal-backdrop,
  body.printing-paper-58mm .preview-modal-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  body.printing-paper-58mm .invoice-paper,
  body.printing-paper-58mm .bm-invoice-sheet,
  body.printing-paper-58mm .bm-tpl-thermal {
    width: 50mm !important;
    max-width: 50mm !important;
    margin: 0 auto !important;
    padding: 1mm 0.5mm !important;
    font-size: 8pt !important;
    border: none !important;
    box-shadow: none !important;
  }
}


/* Ensure mobile header fits all action icons without overflow */
@media screen and (max-width: 768px) {
  .brand-section {
    gap: 6px !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }
  .brand-info h1 {
    font-size: 14px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .brand-info .sub {
    display: none !important;
  }
  .brand-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 18px !important;
    border-radius: 8px !important;
  }
  .header-actions {
    gap: 4px !important;
    flex-shrink: 0 !important;
  }
  #header-company-name {
    display: none !important;
  }
  #staff-lock-label {
    display: none !important;
  }
  #header-sync-text {
    display: none !important;
  }
  .header-sync-badge {
    padding: 6px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  #btn-toggle-theme {
    padding: 5px 8px !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
  }
}


/* Ensure bottom sheets are completely hidden and unclickable when not active */
.bottom-sheet-backdrop:not(.active) {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}


/* Robust Bottom Sheet Display Engine */
.bottom-sheet-backdrop {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.7) !important;
  backdrop-filter: blur(4px) !important;
  z-index: 10500 !important;
  display: none !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.bottom-sheet-backdrop.active {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.bottom-sheet-backdrop.active .bottom-sheet-card {
  transform: translateY(0) !important;
}



/* ==========================================================================
   WORLDWIDE PREMIUM UI/UX & RESPONSIVE ENGINE (V3.0 ENTERPRISE SUITE)
   Author & Publisher: Narayan Modak
   Standard: Modern Financial SaaS / Enterprise Fintech Interface
   Zero-Breakage Guarantee: 100% Non-Destructive Presentation Layer
   ========================================================================== */

/* --- 1. GLOBAL DESIGN SYSTEM ENHANCEMENTS --- */
:root {
  --saas-bg: #090d1a;
  --saas-surface: #0f172a;
  --saas-card: #141f36;
  --saas-card-hover: #1a2948;
  --saas-card-elevated: #1e2d4d;
  --saas-border: rgba(255, 255, 255, 0.08);
  --saas-border-highlight: rgba(56, 189, 248, 0.35);
  --saas-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --saas-shadow-md: 0 6px 24px -4px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --saas-shadow-lg: 0 12px 40px -8px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --saas-shadow-emerald: 0 8px 24px -4px rgba(16, 185, 129, 0.35);
  --saas-shadow-blue: 0 8px 24px -4px rgba(37, 99, 235, 0.35);
  --saas-radius-card: 14px;
  --saas-radius-pill: 9999px;
  --saas-radius-btn: 10px;
}

/* Fluid Responsive Typography & Anti-Aliasing */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* --- 2. ADAPTIVE RESPONSIVE CONTAINER BREAKPOINTS --- */

/* Mobile Phones (320px to 480px) */
@media screen and (max-width: 480px) {
  .app-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 14px 140px !important;
    box-shadow: none !important;
    border: none !important;
  }
}

/* Phablets, Foldables & Portrait Mini Tablets (481px to 767px) */
@media screen and (min-width: 481px) and (max-width: 767px) {
  .app-container {
    width: 95% !important;
    max-width: 640px !important;
    margin: 0 auto !important;
    padding: 16px 20px 140px !important;
    border-left: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4) !important;
  }
}

/* Tablets (768px to 1023px, iPad Air / Pro / Galaxy Tab) */
@media screen and (min-width: 768px) and (max-width: 1023px) {
  .app-container {
    width: 94% !important;
    max-width: 880px !important;
    margin: 0 auto !important;
    padding: 20px 28px 140px !important;
    border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: var(--saas-shadow-lg) !important;
  }
}

/* Standard Laptops & MacBooks (1024px to 1439px) */
@media screen and (min-width: 1024px) and (max-width: 1439px) {
  .app-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 20px 28px 120px !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none !important;
  }
}

/* Desktop Monitors (1440px to 1919px) */
@media screen and (min-width: 1440px) and (max-width: 1919px) {
  .app-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 24px 36px 120px !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none !important;
  }
}

/* Ultrawide & 4K Displays (>= 1920px) */
@media screen and (min-width: 1920px) {
  .app-container {
    width: 100% !important;
    max-width: 1800px !important;
    margin: 0 auto !important;
    padding: 28px 48px 120px !important;
    border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7) !important;
  }
}

/* --- 3. PREMIUM CARD & SURFACE REFINEMENT --- */
.summary-card,
.form-card,
.settings-card,
.quick-start-card,
.invoice-card,
.card-block {
  background: var(--saas-card) !important;
  border: 1px solid var(--saas-border) !important;
  border-radius: var(--saas-radius-card) !important;
  box-shadow: var(--saas-shadow-md) !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease !important;
}

.summary-card:hover,
.invoice-card:hover {
  border-color: rgba(56, 189, 248, 0.3) !important;
  box-shadow: var(--saas-shadow-lg) !important;
}

/* Net Profit Card Executive Financial Styling */
#dash-profit-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14) 0%, rgba(5, 150, 105, 0.05) 100%) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  box-shadow: var(--saas-shadow-emerald) !important;
}
#dash-profit-card:hover {
  border-color: #10b981 !important;
  transform: translateY(-2px);
}

/* --- 4. EXECUTIVE DASHBOARD GRID ON TABLET & DESKTOP (>= 768px) --- */
@media screen and (min-width: 768px) {
  /* 4 KPI Metrics in Balanced Row */
  #tab-dashboard .summary-cards {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
    margin-bottom: 20px !important;
  }
  #tab-dashboard .summary-row {
    display: contents !important;
  }
}

/* Strict Tab Isolation across all screen sizes (Desktop, Laptop, Tablet & Mobile) */
.tab-content:not(.active) {
  display: none !important;
}

.tab-content.active {
  display: flex !important;
  flex-direction: column !important;
}

@media screen and (min-width: 1024px) {
  #tab-dashboard.active .summary-cards {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 18px !important;
    margin-bottom: 24px !important;
  }

  /* Quick Utilities Bar Grid */
  .dash-quick-utilities {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 12px !important;
    margin: 16px 0 24px 0 !important;
  }
  .dash-quick-utilities .btn-action-outline {
    width: 100% !important;
    min-width: 0 !important;
    padding: 12px 14px !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    border-radius: var(--saas-radius-btn) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  .dash-quick-utilities .btn-action-outline:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35) !important;
  }

  /* Laptop & Desktop Settings Grid */
  #tab-settings.active {
    display: grid !important;
  }
}

/* --- 6. INVOICE HISTORY (BILLS LIST) GRID ON WIDE SCREENS --- */
@media screen and (min-width: 900px) {
  #all-invoices-list,
  #recent-invoices-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)) !important;
    gap: 14px !important;
  }
}

/* --- 7. EXPENSES & PROFIT GRID ON TABLET / LAPTOP (>= 768px) --- */
@media screen and (min-width: 768px) {
  #tab-profit .summary-cards {
    display: grid !important;
    grid-template-columns: 1.4fr 1fr 1fr !important;
    gap: 16px !important;
    align-items: stretch !important;
  }
  #tab-profit .summary-row {
    display: contents !important;
  }
  #expenses-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 12px !important;
  }
}

/* --- 8. MOBILE REFINEMENT & TOUCH TARGET ASSURANCE (<= 480px) --- */
@media screen and (max-width: 480px) {
  /* Safe-Area Padding for Modern Bezel-less Phones (iPhone Dynamic Island / Galaxy S24) */
  .nav-tabs {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 12px)) !important;
  }

  /* Compact Non-Overlapping Header Bar */
  .app-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
  }
  .brand-section {
    min-width: 0 !important;
    flex-shrink: 1 !important;
  }
  .brand-info h1 {
    font-size: 15px !important;
    font-weight: 800 !important;
  }
  .header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }

  /* Form Elements: Generous 44px Minimum Touch Height */
  .form-group input,
  .form-group select,
  .form-group textarea,
  button.btn-primary-action,
  button.btn-hero-create {
    min-height: 44px !important;
  }

  /* Line Items Table: Responsive Horizontal Flow */
  .items-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 8px !important;
  }
}

/* --- 9. MODAL & PREVIEW SHEET ACCESSIBILITY & POSITIONING --- */
.modal-backdrop,
.preview-modal-backdrop {
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
}

.modal-card {
  max-height: calc(100vh - 48px) !important;
  max-height: calc(100dvh - 48px) !important;
  overflow-y: auto !important;
  border-radius: 16px !important;
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
}

/* --- 10. LIGHT MODE HIGH-VALUE SAAS POLISH --- */
body.light-mode {
  --saas-bg: #f8fafc;
  --saas-surface: #ffffff;
  --saas-card: #ffffff;
  --saas-card-hover: #f1f5f9;
  --saas-card-elevated: #f8fafc;
  --saas-border: #e2e8f0;
  --saas-border-highlight: rgba(37, 99, 235, 0.4);
  --saas-shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.08), 0 0 0 1px #e2e8f0;
  --saas-shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.12), 0 0 0 1px #cbd5e1;
  background: radial-gradient(circle at 50% 0%, #e2e8f0 0%, #f8fafc 65%) !important;
  color: #0f172a !important;
}

body.light-mode .app-container {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.06) !important;
}

body.light-mode .summary-card,
body.light-mode .form-card,
body.light-mode .settings-card,
body.light-mode .quick-start-card,
body.light-mode .invoice-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: var(--saas-shadow-md) !important;
}

body.light-mode #dash-profit-card {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%) !important;
  border-color: #6ee7b7 !important;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.15) !important;
}

body.light-mode .modal-card {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px #e2e8f0 !important;
}

/* --- 11. SUBTLE ELEVATED MICRO-INTERACTIONS --- */
button {
  cursor: pointer;
  user-select: none;
}
button:active {
  transform: scale(0.98);
}
.btn-primary-action:hover,
.btn-hero-create:hover {
  transform: translateY(-2px);
  box-shadow: var(--saas-shadow-blue) !important;
}
.nav-tab {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}


/* ==========================================================================
   WORLDWIDE INVOICE LOCALIZATION & BI-DIRECTIONAL (RTL/LTR) ENGINE
   ========================================================================== */

/* Bi-directional isolation for numerals, IDs, phone numbers, IBANs, amounts */
.bm-bidi-iso {
  unicode-bidi: isolate !important;
  direction: ltr !important;
  display: inline-block;
  white-space: nowrap;
}

.bm-bidi-text {
  unicode-bidi: isolate !important;
  display: inline-block;
}

/* RTL Invoice Root Layout Adjustments */
.bm-rtl-invoice,
[dir="rtl"] .bm-invoice-sheet {
  direction: rtl !important;
  text-align: right !important;
  font-family: 'Segoe UI', Tahoma, Arial, 'Noto Sans Arabic', 'Cairo', system-ui, sans-serif;
}

/* RTL Header and Meta Box Alignment */
.bm-rtl-invoice .bm-meta-box,
[dir="rtl"] .bm-meta-box {
  text-align: left !important;
}

.bm-rtl-invoice .bm-meta-table,
[dir="rtl"] .bm-meta-table {
  margin-right: auto !important;
  margin-left: 0 !important;
  text-align: right !important;
}

.bm-rtl-invoice .bm-meta-table td:first-child,
[dir="rtl"] .bm-meta-table td:first-child {
  padding-left: 8px !important;
  padding-right: 0 !important;
}

/* RTL Table Alignments */
.bm-rtl-invoice .bm-invoice-table,
[dir="rtl"] .bm-invoice-table {
  text-align: right !important;
}

.bm-rtl-invoice .bm-invoice-table th,
.bm-rtl-invoice .bm-invoice-table td,
[dir="rtl"] .bm-invoice-table th,
[dir="rtl"] .bm-invoice-table td {
  text-align: right !important;
}

.bm-rtl-invoice .bm-invoice-table th:nth-child(3),
.bm-rtl-invoice .bm-invoice-table td:nth-child(3),
.bm-rtl-invoice .bm-invoice-table th:nth-child(4),
.bm-rtl-invoice .bm-invoice-table td:nth-child(4),
[dir="rtl"] .bm-invoice-table th:nth-child(3),
[dir="rtl"] .bm-invoice-table td:nth-child(3),
[dir="rtl"] .bm-invoice-table th:nth-child(4),
[dir="rtl"] .bm-invoice-table td:nth-child(4) {
  text-align: center !important;
}

.bm-rtl-invoice .bm-invoice-table th:nth-last-child(-n+3),
.bm-rtl-invoice .bm-invoice-table td:nth-last-child(-n+3),
[dir="rtl"] .bm-invoice-table th:nth-last-child(-n+3),
[dir="rtl"] .bm-invoice-table td:nth-last-child(-n+3) {
  text-align: left !important;
}

/* RTL Financial Summary Grid */
.bm-rtl-invoice .bm-summary-grid,
[dir="rtl"] .bm-summary-grid {
  direction: rtl !important;
}

/* RTL Terms & Lists */
.bm-rtl-invoice ol,
[dir="rtl"] .bm-invoice-sheet ol {
  padding-inline-start: 18px !important;
  padding-left: 0 !important;
  padding-right: 18px !important;
}

/* RTL International Two-Box Grid */
.bm-rtl-invoice .bm-intl-exporter,
[dir="rtl"] .bm-intl-exporter {
  border-right: none !important;
  border-left: 1px solid #cbd5e1 !important;
}

.bm-rtl-invoice .bm-intl-strip > div,
[dir="rtl"] .bm-intl-strip > div {
  border-right: none !important;
  border-left: 1px solid #cbd5e1 !important;
}
.bm-rtl-invoice .bm-intl-strip > div:last-child,
[dir="rtl"] .bm-intl-strip > div:last-child {
  border-left: none !important;
}

/* RTL Status Badge */
.bm-rtl-invoice .bm-status-badge,
[dir="rtl"] .bm-status-badge {
  direction: ltr !important;
  unicode-bidi: isolate !important;
}

/* ==========================================================================
   COMMERCIAL ENTERPRISE LUXURY SUITE POLISH & OBSIDIAN CARDS
   ========================================================================== */
.enterprise-pill {
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.enterprise-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

#setting-enterprise-commercial {
  background: radial-gradient(circle at top right, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.95)) !important;
  border: 1px solid rgba(56, 189, 248, 0.25) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

#setting-enterprise-commercial:hover {
  border-color: rgba(56, 189, 248, 0.45) !important;
}

#setting-worldclass-suite {
  background: radial-gradient(circle at top left, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.95)) !important;
  border: 1px solid rgba(16, 185, 129, 0.25) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

.suite-feature-card {
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.suite-feature-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.35) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Speed POS Responsive Touch Ergonomics */
.speed-pos-card {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@media (max-width: 600px) {
  #enterprise-pro-header-pill {
    padding: 3px 8px;
    font-size: 10px;
  }
}


/* ============================================================
   UX REDESIGN v3.8.5 — Two-Column Layout, Collapsible Sections,
   Sticky Total Bar
   ============================================================ */

/* === TWO-COLUMN DESKTOP LAYOUT === */
@media (min-width: 1024px) {
  #invoice-form {
    display: grid !important;
    grid-template-columns: 1fr 360px !important;
    gap: 20px !important;
    align-items: start !important;
  }
  
  .bill-main-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
  }
  
  .bill-sidebar-column {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
  }
  
  .bill-sidebar-column::-webkit-scrollbar { width: 4px; }
  .bill-sidebar-column::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
}

@media (max-width: 1023px) {
  .bill-main-column, .bill-sidebar-column {
    width: 100% !important;
  }
}

/* === COLLAPSIBLE SECTIONS === */
.bill-collapsible-section .form-card {
  transition: all 0.25s ease;
}

.bill-collapsible-section .bill-collapse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 14px 18px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  transition: all 0.2s ease;
  user-select: none;
  margin-bottom: 0;
}

.bill-collapsible-section .bill-collapse-header:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(255, 255, 255, 0.12);
}

.bill-collapsible-section .bill-collapse-header .collapse-title {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bill-collapsible-section .bill-collapse-header .collapse-summary {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  max-width: 50%;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-collapsible-section .bill-collapse-header .collapse-arrow {
  font-size: 14px;
  color: #64748b;
  transition: transform 0.25s ease;
  margin-left: 8px;
  flex-shrink: 0;
}

.bill-collapsible-section.is-open .bill-collapse-header .collapse-arrow {
  transform: rotate(180deg);
}

.bill-collapsible-section .bill-collapse-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.25s ease;
  opacity: 0;
}

.bill-collapsible-section.is-open .bill-collapse-body {
  max-height: 3000px;
  opacity: 1;
}

/* Sticky bottom total bar removed per user request */
.bill-sticky-total-bar { display: none !important; }

/* === COMPACT CUSTOMER ROW === */
@media (min-width: 768px) {
  .client-info-grid-compact {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }
  .client-info-grid-compact .form-group {
    margin-bottom: 0 !important;
  }
}

/* === SIDEBAR TOTALS CARD ENHANCEMENT === */
.bill-sidebar-column #card-totals {
  border: 1px solid rgba(16, 185, 129, 0.2) !important;
  background: rgba(16, 185, 129, 0.03) !important;
}

.bill-sidebar-column .grand-total-row {
  font-size: 20px !important;
}


/* ============================================================
   SETTINGS PAGE PREMIUM OVERHAUL v3.8.5
   Inspired by: Stripe Dashboard, Linear, Notion Settings
   ============================================================ */

/* === SETTINGS TAB LAYOUT === */
#tab-settings {
  max-width: 820px !important;
  margin: 0 auto !important;
  padding: 20px 16px 80px 16px !important;
}

/* === SETTINGS CARD — Premium Glass Style === */
.settings-card {
  background: rgba(15, 23, 42, 0.6) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 16px !important;
  padding: 24px !important;
  margin-bottom: 16px !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.settings-card:hover {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.settings-card.highlight-border {
  border-color: rgba(56, 189, 248, 0.12) !important;
}

/* === SECTION HEADERS — Clean & Minimal === */
.settings-card > div:first-child > h3,
.settings-card > h3 {
  font-size: 16px !important;
  font-weight: 800 !important;
  color: #f1f5f9 !important;
  margin: 0 0 4px 0 !important;
  letter-spacing: -0.3px !important;
}

.settings-card > div:first-child > p,
.settings-card > p:first-of-type {
  font-size: 13px !important;
  color: #64748b !important;
  margin: 0 0 16px 0 !important;
  line-height: 1.4 !important;
}

/* === FORM INPUTS — Unified Premium Style === */
#tab-settings input[type="text"],
#tab-settings input[type="tel"],
#tab-settings input[type="email"],
#tab-settings input[type="url"],
#tab-settings input[type="number"],
#tab-settings input[type="password"],
#tab-settings textarea,
#tab-settings select {
  background: rgba(30, 41, 59, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  color: #e2e8f0 !important;
  font-size: 14px !important;
  padding: 10px 14px !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

#tab-settings input:focus,
#tab-settings textarea:focus,
#tab-settings select:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1) !important;
  outline: none !important;
}

#tab-settings select {
  cursor: pointer !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
  background-position: right 10px center !important;
  background-repeat: no-repeat !important;
  background-size: 20px !important;
  padding-right: 36px !important;
}

/* === LABELS — Clean Typography === */
#tab-settings label {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #94a3b8 !important;
  margin-bottom: 6px !important;
  display: block !important;
  letter-spacing: 0.1px !important;
}

/* === FORM GROUPS — Compact Grid === */
#tab-settings .form-group {
  margin-bottom: 14px !important;
}

/* === 2-Column Grid for form fields in settings === */
@media (min-width: 640px) {
  .settings-form-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 14px !important;
  }
  .settings-form-grid .form-group {
    margin-bottom: 0 !important;
  }
}

/* === TOGGLE SWITCHES — Premium iOS-style === */
#tab-settings .module-toggle-row,
#tab-settings .settings-toggle-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 14px 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
  gap: 16px !important;
}

#tab-settings .module-toggle-row:last-child,
#tab-settings .settings-toggle-row:last-child {
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

#tab-settings .module-toggle-row .toggle-label,
#tab-settings .module-toggle-info {
  flex: 1 !important;
}

#tab-settings .module-toggle-row .toggle-title {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #e2e8f0 !important;
}

#tab-settings .module-toggle-row .toggle-desc {
  font-size: 12px !important;
  color: #64748b !important;
  margin-top: 2px !important;
}

/* Premium toggle switch */
#tab-settings input[type="checkbox"].premium-toggle {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 44px !important;
  height: 24px !important;
  background: rgba(100, 116, 139, 0.3) !important;
  border-radius: 12px !important;
  border: none !important;
  position: relative !important;
  cursor: pointer !important;
  transition: background 0.2s ease !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
}

#tab-settings input[type="checkbox"].premium-toggle::after {
  content: '' !important;
  position: absolute !important;
  top: 2px !important;
  left: 2px !important;
  width: 20px !important;
  height: 20px !important;
  background: #fff !important;
  border-radius: 50% !important;
  transition: transform 0.2s ease !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important;
}

#tab-settings input[type="checkbox"].premium-toggle:checked {
  background: #10b981 !important;
}

#tab-settings input[type="checkbox"].premium-toggle:checked::after {
  transform: translateX(20px) !important;
}

/* === BUTTONS — Settings Page === */
#tab-settings .btn-pill-action,
#tab-settings .btn-action-outline {
  border-radius: 10px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  padding: 8px 16px !important;
  transition: all 0.15s ease !important;
}

#tab-settings .btn-pill-action:hover,
#tab-settings .btn-action-outline:hover {
  transform: translateY(-1px) !important;
}

/* === SECTION DIVIDERS — Subtle === */
.settings-card + .settings-card {
  margin-top: 12px !important;
}

/* === SIGNATURE CANVAS — Clean Border === */
#tab-settings canvas {
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  background: rgba(30, 41, 59, 0.4) !important;
}

/* === QR & LOGO UPLOAD AREAS === */
#tab-settings .upload-area,
#tab-settings [onclick*="upload"],
#tab-settings .logo-upload-zone {
  border: 2px dashed rgba(255, 255, 255, 0.1) !important;
  border-radius: 12px !important;
  transition: border-color 0.2s ease !important;
}

#tab-settings .upload-area:hover,
#tab-settings [onclick*="upload"]:hover {
  border-color: rgba(56, 189, 248, 0.3) !important;
}

/* === ABOUT SECTION — Minimal === */
#tab-settings .settings-card:last-child {
  text-align: center !important;
  padding: 32px !important;
}

/* === COLOR PICKER — Inline === */
#tab-settings input[type="color"] {
  width: 36px !important;
  height: 36px !important;
  border: 2px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 10px !important;
  padding: 2px !important;
  cursor: pointer !important;
  background: transparent !important;
}

/* === RANGE SLIDER — Styled === */
#tab-settings input[type="range"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  height: 6px !important;
  background: rgba(100, 116, 139, 0.3) !important;
  border-radius: 3px !important;
  outline: none !important;
}

#tab-settings input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  width: 18px !important;
  height: 18px !important;
  border-radius: 50% !important;
  background: #38bdf8 !important;
  cursor: pointer !important;
  box-shadow: 0 2px 6px rgba(56, 189, 248, 0.3) !important;
}

/* ============================================================
   EXECUTIVE EMERALD & PEARL LIGHT MODE — LUXURY ENTERPRISE THEME
   ============================================================ */
body.light-mode {
  background: #f8fafc !important;
  color: #0f172a !important;
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-surface-raised: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-active: #059669;
  --primary: #059669;
  --primary-hover: #047857;
  --text-main: #0f172a;
  --text-secondary: #1e293b;
  --text-muted: #475569;
}

body.light-mode .app-container {
  background: #f8fafc !important;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.05) !important;
  border-left: 1px solid #e2e8f0 !important;
  border-right: 1px solid #e2e8f0 !important;
}

body.light-mode .app-header {
  background: linear-gradient(135deg, #064e3b 0%, #047857 60%, #059669 100%) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15) !important;
  box-shadow: 0 4px 16px rgba(6, 78, 59, 0.2) !important;
}

body.light-mode .nav-tabs {
  background: #ffffff !important;
  border-bottom: 1.5px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

body.light-mode .nav-tab {
  color: #475569 !important;
  font-weight: 600 !important;
}

body.light-mode .nav-tab:hover {
  color: #059669 !important;
  background: #f0fdf4 !important;
}

body.light-mode .nav-tab.active {
  color: #059669 !important;
  border-bottom-color: #059669 !important;
  background: rgba(5, 150, 105, 0.09) !important;
  font-weight: 800 !important;
}

/* All Cards in Light Mode */
body.light-mode .settings-card,
body.light-mode .form-card,
body.light-mode .summary-card,
body.light-mode .card-block,
body.light-mode .invoice-card {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 16px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 6px 16px -2px rgba(15, 23, 42, 0.04) !important;
}

body.light-mode .settings-card:hover,
body.light-mode .form-card:hover {
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.08) !important;
}

body.light-mode .settings-card.highlight-border {
  border: 1.5px solid rgba(5, 150, 105, 0.3) !important;
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.06) !important;
}

/* Headings & Text in Light Mode */
body.light-mode .settings-card h3,
body.light-mode .settings-card > div:first-child > h3,
body.light-mode .form-card h3,
body.light-mode .form-card-header h3,
body.light-mode h2,
body.light-mode h3,
body.light-mode h4 {
  color: #0f172a !important;
  font-weight: 800 !important;
  letter-spacing: -0.3px !important;
}

body.light-mode .settings-card p,
body.light-mode .settings-card .field-hint,
body.light-mode .settings-card > div:first-child > p,
body.light-mode .settings-card > p:first-of-type,
body.light-mode .field-hint,
body.light-mode .card-label {
  color: #475569 !important;
  font-weight: 500 !important;
}

body.light-mode #tab-settings label,
body.light-mode label {
  color: #1e293b !important;
  font-weight: 700 !important;
  font-size: 12.5px !important;
}

/* Form Inputs, Selects, and Textareas in Light Mode */
body.light-mode #tab-settings input[type="text"],
body.light-mode #tab-settings input[type="tel"],
body.light-mode #tab-settings input[type="email"],
body.light-mode #tab-settings input[type="url"],
body.light-mode #tab-settings input[type="number"],
body.light-mode #tab-settings input[type="password"],
body.light-mode #tab-settings textarea,
body.light-mode #tab-settings select,
body.light-mode input,
body.light-mode select,
body.light-mode textarea {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 10px !important;
  color: #0f172a !important;
  font-weight: 600 !important;
  font-size: 13.5px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
}

body.light-mode #tab-settings input::placeholder,
body.light-mode #tab-settings textarea::placeholder,
body.light-mode input::placeholder,
body.light-mode textarea::placeholder {
  color: #94a3b8 !important;
  font-weight: 400 !important;
}

body.light-mode #tab-settings input:focus,
body.light-mode #tab-settings textarea:focus,
body.light-mode #tab-settings select:focus,
body.light-mode input:focus,
body.light-mode select:focus,
body.light-mode textarea:focus {
  background: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.16) !important;
  outline: none !important;
}

body.light-mode #tab-settings select,
body.light-mode select {
  cursor: pointer !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%231e293b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
  background-position: right 10px center !important;
  background-repeat: no-repeat !important;
  background-size: 16px 16px !important;
  padding-right: 32px !important;
}

/* Signature Canvas & Dropzones in Light Mode */
body.light-mode #tab-settings canvas,
body.light-mode canvas {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 12px !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03) !important;
}

body.light-mode .sig-mode-tabs {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-mode .sig-mode-tab {
  color: #475569 !important;
}

body.light-mode .sig-mode-tab.active {
  background: #0284c7 !important;
  color: #ffffff !important;
}

body.light-mode .sig-drop-zone,
body.light-mode .seal-drop-zone {
  background: #f8fafc !important;
  border: 2px dashed #94a3b8 !important;
  color: #0f172a !important;
}

body.light-mode .sig-drop-zone div,
body.light-mode .seal-drop-zone div {
  color: #0f172a !important;
}

/* Toggle Switches & Rows in Light Mode */
body.light-mode .settings-toggle-row,
body.light-mode .module-toggle-row {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  padding: 10px 14px !important;
  margin-bottom: 6px !important;
}

body.light-mode .module-toggle-info strong,
body.light-mode .settings-toggle-row strong {
  color: #0f172a !important;
  font-weight: 700 !important;
}

body.light-mode .module-toggle-info span,
body.light-mode .settings-toggle-row span {
  color: #475569 !important;
}

body.light-mode #tab-settings input[type="checkbox"].premium-toggle {
  background: #cbd5e1 !important;
}

body.light-mode #tab-settings input[type="checkbox"].premium-toggle:checked {
  background: #0284c7 !important;
}

/* Action Buttons in Light Mode */
body.light-mode .btn-pill-action {
  background: #f0f7ff !important;
  color: #0284c7 !important;
  border: 1.5px solid #bae6fd !important;
  font-weight: 700 !important;
}

body.light-mode .btn-pill-action:hover {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
}

body.light-mode .btn-action-outline {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  font-weight: 700 !important;
}

body.light-mode .btn-action-outline:hover {
  background: #f0f7ff !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}

body.light-mode .btn-secondary-action {
  background: #0f172a !important;
  color: #ffffff !important;
  border: 1.5px solid #0f172a !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2) !important;
}

body.light-mode .btn-secondary-action:hover {
  background: #1e293b !important;
  border-color: #1e293b !important;
}

body.light-mode .btn-danger-outline {
  background: #fff1f2 !important;
  color: #e11d48 !important;
  border: 1.5px solid #fecdd3 !important;
  font-weight: 700 !important;
}

body.light-mode .btn-danger-outline:hover {
  background: #ffe4e6 !important;
  border-color: #e11d48 !important;
}

/* Regional Pack Buttons in Light Mode */
body.light-mode .btn-regional-pack[data-region="india"] {
  background: #fffbeb !important;
  border-color: #f59e0b !important;
  color: #b45309 !important;
}

body.light-mode .btn-regional-pack[data-region="usa"] {
  background: #eff6ff !important;
  border-color: #3b82f6 !important;
  color: #1d4ed8 !important;
}

body.light-mode .btn-regional-pack[data-region="uk_eu"] {
  background: #f5f3ff !important;
  border-color: #8b5cf6 !important;
  color: #6d28d9 !important;
}

body.light-mode .btn-regional-pack[data-region="gulf"] {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #047857 !important;
}

body.light-mode .btn-regional-pack[data-region="aus_can"] {
  background: #fff1f2 !important;
  border-color: #f43f5e !important;
  color: #be123c !important;
}

/* Status Badges, Dev Info & Previews in Light Mode */
body.light-mode .cloud-status-badge {
  background: #eff6ff !important;
  border: 1.5px solid #bfdbfe !important;
  color: #1e40af !important;
}

body.light-mode #setting-qr-preview,
body.light-mode #qr-preview-box,
body.light-mode #logo-preview-box {
  background: #f8fafc !important;
  border: 1.5px solid #e2e8f0 !important;
}

body.light-mode .dev-info-box {
  background: #f8fafc !important;
  border: 1.5px solid #e2e8f0 !important;
}

body.light-mode .dev-avatar {
  background: rgba(5, 150, 105, 0.15) !important;
}

body.light-mode .dev-text strong {
  color: #0f172a !important;
  font-weight: 800 !important;
}

body.light-mode .dev-text span {
  color: #334155 !important;
}

body.light-mode .dev-text small {
  color: #059669 !important;
  font-weight: 700 !important;
}

body.light-mode #bank-wire-fields {
  background: #f8fafc !important;
  border: 1.5px solid #ddd6fe !important;
}

/* === RESPONSIVE SETTINGS === */
@media (max-width: 640px) {
  #tab-settings {
    padding: 12px 10px 80px 10px !important;
  }
  .settings-card {
    padding: 16px !important;
    border-radius: 12px !important;
  }
}

/* ============================================================
   DESKTOP FULL SCREEN PREMIUM SETTINGS GRID (Worldwide Standard)
   ============================================================ */
#tab-settings {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 20px 28px 120px 28px !important;
  box-sizing: border-box !important;
}

@media (min-width: 1024px) {
  #tab-settings.active {
    display: grid !important;
    grid-template-columns: repeat(12, 1fr) !important;
    gap: 20px !important;
    align-items: stretch !important;
  }

  /* Grid column spans for balanced full-width view */
  /* Row 1: Top Quick Config Row (4 + 4 + 4) */
  #tab-settings > #card-theme,
  #tab-settings > .settings-card:nth-of-type(1) { grid-column: span 4 !important; } /* Appearance */
  #tab-settings > #card-company-profiles,
  #tab-settings > .settings-card:nth-of-type(2) { grid-column: span 4 !important; } /* Business Profiles */
  #tab-settings > #card-industry-vertical { grid-column: span 4 !important; }      /* Industry Type */

  /* Row 2: Core Business Profile & Signature (8 + 4) */
  #tab-settings > #card-biz-profile { grid-column: span 8 !important; }            /* Business Profile (Wide) */
  #tab-settings > #card-sig { grid-column: span 4 !important; }                    /* Signature & Stamp */

  /* Row 3: Regional Config & Payment Fiscal Engine (6 + 6) */
  #tab-settings > #card-settings-localization { grid-column: span 6 !important; }
  #tab-settings > #card-settings-payment-fiscal { grid-column: span 6 !important; }

  /* Row 4: Modules & Customer Engagement (6 + 6) */
  #tab-settings > #card-settings-modules-workflow { grid-column: span 6 !important; }
  #tab-settings > #setting-customer-engagement { grid-column: span 6 !important; }

  /* Row 5: Cloud Transfer Hub & Local Data Vault (6 + 6) */
  #tab-settings > #card-settings-cloud-hub { grid-column: span 6 !important; }
  #tab-settings > #card-settings-local-backup { grid-column: span 6 !important; }

  /* Row 6: Branding / Referral & About Publisher (6 + 6) */
  #tab-settings > #card-settings-branding { grid-column: span 6 !important; }
  #tab-settings > #card-settings-about-dev { grid-column: span 6 !important; }
}

@media (min-width: 640px) and (max-width: 1023px) {
  #tab-settings.active {
    display: grid !important;
    grid-template-columns: repeat(12, 1fr) !important;
    gap: 16px !important;
  }
  #tab-settings > #card-theme,
  #tab-settings > #card-company-profiles,
  #tab-settings > #card-industry-vertical { grid-column: span 4 !important; }
  #tab-settings > #card-biz-profile { grid-column: span 12 !important; }
  #tab-settings > #card-sig { grid-column: span 12 !important; }
  #tab-settings > #card-settings-localization,
  #tab-settings > #card-settings-payment-fiscal,
  #tab-settings > #card-settings-modules-workflow,
  #tab-settings > #setting-customer-engagement,
  #tab-settings > #card-settings-cloud-hub,
  #tab-settings > #card-settings-local-backup,
  #tab-settings > #card-settings-branding,
  #tab-settings > #card-settings-about-dev { grid-column: span 6 !important; }
}

/* Mobile Screens (<= 639px): Full-Width Settings Cards & Elements */
@media (max-width: 639px) {
  #tab-settings {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 6px 0 120px 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    box-sizing: border-box !important;
  }

  #tab-settings .settings-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px 14px !important;
    margin: 0 0 12px 0 !important;
    border-radius: 14px !important;
    box-sizing: border-box !important;
  }

  #tab-settings .form-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
  }

  #tab-settings .form-group {
    width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 12px !important;
  }

  #tab-settings select,
  #tab-settings input[type="text"],
  #tab-settings input[type="tel"],
  #tab-settings input[type="email"],
  #tab-settings input[type="url"],
  #tab-settings input[type="number"],
  #tab-settings input[type="password"],
  #tab-settings textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

@media (min-width: 1440px) {
  #tab-settings {
    padding: 24px 36px 120px 36px !important;
  }
}

/* Absolute guard: inactive tabs are always hidden regardless of other rules */
#tab-dashboard:not(.active),
#tab-create:not(.active),
#tab-history:not(.active),
#tab-profit:not(.active),
#tab-ai-business-assistant:not(.active),
#tab-settings:not(.active) {
  display: none !important;
}
