/* ==========================================================================
   UBER & APPLE-INSPIRED MINIMALIST CHAUFFEUR INVOICE STYLESHEET
   With 10 Radically Different Structural & Positional Layouts
   ========================================================================== */

:root {
  --uber-black: #000000;
  --uber-dark: #121212;
  --apple-text: #1d1d1f;
  --apple-subtext: #86868b;
  --apple-border: #e5e5ea;
  --apple-light-bg: #f5f5f7;
  --apple-card-bg: #ffffff;
  --apple-blue: #0071e3;
  --apple-green: #34c759;
  
  --bg-workspace: #09090b;
  --sidebar-bg: #111113;
  --sidebar-card: #18181b;
  --sidebar-border: #27272a;
  --sidebar-text: #f4f4f5;
  --sidebar-muted: #a1a1aa;
  
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Menlo', monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-workspace);
  color: var(--apple-text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.text-right { text-align: right; }

/* ==========================================================================
   TOP BAR (APPLE STYLE GLASS BAR)
   ========================================================================== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 24px;
  background: rgba(17, 17, 19, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--sidebar-border);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

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

.limo-badge {
  width: 32px;
  height: 32px;
  background: #ffffff;
  color: #000000;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-info strong {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #ffffff;
  display: block;
  white-space: nowrap;
}

.brand-info .sub {
  font-size: 0.72rem;
  color: var(--sidebar-muted);
  display: block;
  white-space: nowrap;
}

/* Theme Swatches Picker in Header */
.theme-picker-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--sidebar-border);
  padding: 4px 10px;
  border-radius: 9999px;
}

.theme-picker-lbl {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sidebar-muted);
}

.theme-swatches {
  display: flex;
  align-items: center;
  gap: 5px;
}

.swatch-btn {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background-color: var(--swatch-color);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.swatch-btn:hover {
  transform: scale(1.2);
  border-color: #ffffff;
}

.swatch-btn.active {
  transform: scale(1.25);
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: #ffffff;
  color: #000000;
  font-weight: 600;
}

.btn-primary:hover {
  background: #f4f4f5;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #27272a;
  color: #f4f4f5;
  border: 1px solid #3f3f46;
}

.btn-secondary:hover {
  background: #3f3f46;
}

.btn-ghost {
  background: transparent;
  color: var(--sidebar-muted);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  margin-top: 14px;
}

/* ==========================================================================
   APP LAYOUT (SPLIT SCREEN)
   ========================================================================== */
.app-layout {
  display: flex;
  max-width: 1520px;
  margin: 0 auto;
  min-height: calc(100vh - 52px);
}

/* Quick Form Panel */
.quick-form-panel {
  width: 440px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 18px 16px;
  color: var(--sidebar-text);
  overflow-y: auto;
  max-height: calc(100vh - 52px);
  position: sticky;
  top: 52px;
}

.theme-section-card {
  border-color: #3f3f46;
  background: #18181b;
}

/* Company Settings Accordion */
.company-settings-accordion {
  background: var(--sidebar-card);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.company-settings-accordion[open] {
  border-color: #52525b;
}

.company-settings-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #e4e4e7;
  user-select: none;
  list-style: none;
}

.company-settings-summary::-webkit-details-marker {
  display: none;
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chevron-icon {
  font-size: 0.9rem;
  transition: transform 0.2s ease;
  color: #a1a1aa;
}

.company-settings-accordion[open] .chevron-icon {
  transform: rotate(180deg);
}

.company-settings-body {
  padding: 12px 14px;
  border-top: 1px solid var(--sidebar-border);
  background: #141417;
}

.panel-header {
  margin-bottom: 14px;
  border-bottom: 1px solid var(--sidebar-border);
  padding-bottom: 8px;
}

.panel-header h2 {
  font-size: 1.05rem;
  color: #ffffff;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-header p {
  font-size: 0.78rem;
  color: var(--sidebar-muted);
  margin-top: 2px;
}

.form-section {
  background: var(--sidebar-card);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
}

.section-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #e4e4e7;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.form-group {
  margin-bottom: 10px;
  flex: 1;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.mini-lbl {
  display: block;
  font-size: 0.72rem;
  color: var(--sidebar-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

/* Vehicle Quick Pills */
.vehicle-quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.veh-pill {
  background: #27272a;
  border: 1px solid #3f3f46;
  color: #e4e4e7;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.veh-pill:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.form-control {
  width: 100%;
  background: #09090b;
  border: 1px solid #27272a;
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 8px 10px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.15s ease;
  min-height: 38px;
}

.form-control:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px #ffffff;
}

.route-input {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.route-input > div:last-child {
  flex: 1;
}

.route-icon {
  margin-top: 24px;
  width: 14px;
  display: flex;
  justify-content: center;
}

.route-icon .dot {
  width: 8px;
  height: 8px;
  background: #ffffff;
  border-radius: 50%;
}

.route-icon .square {
  width: 8px;
  height: 8px;
  background: #ffffff;
}

.price-input {
  color: #38bdf8;
  font-size: 0.95rem;
  font-weight: 600;
}

.tax-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #e4e4e7;
  background: #09090b;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid #27272a;
  min-height: 38px;
}

.tax-status input {
  cursor: pointer;
}

/* ==========================================================================
   INVOICE SHEET BASE STYLES
   ========================================================================== */
.invoice-container {
  flex: 1;
  padding: 28px 36px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #000000;
}

.invoice-sheet {
  width: 100%;
  max-width: 780px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  padding: 36px 40px;
  position: relative;
  overflow: hidden;
  color: var(--apple-text);
  transition: all 0.2s ease;
}

/* Contenteditable Elements */
[contenteditable="true"] {
  outline: none;
  border-radius: 3px;
  padding: 1px 3px;
  margin: -1px -3px;
  transition: background 0.15s ease;
}

[contenteditable="true"]:hover {
  background: #f4f4f5;
}

[contenteditable="true"]:focus {
  background: #ffffff;
  box-shadow: 0 0 0 1.5px var(--theme-primary, #000000);
}

/* Header base */
.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--apple-border);
  gap: 16px;
}

.brand-block {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1 1 auto;
}

.logo-mark {
  width: 42px;
  height: 42px;
  background: var(--theme-primary, #000000);
  color: #ffffff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-letter {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
  letter-spacing: -0.02em;
}

.comp-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--theme-heading, #000000);
  line-height: 1.15;
}

.comp-addr, .comp-contact {
  font-size: 0.76rem;
  color: var(--apple-subtext);
  margin-top: 2px;
}

.inv-meta {
  text-align: right;
  flex: 0 0 auto;
  margin-left: auto;
}

.inv-badge {
  display: inline-block;
  background: var(--theme-badge-bg, #f4f4f5);
  color: var(--theme-badge-text, #18181b);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  border: 1px solid var(--theme-badge-border, #e4e4e7);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.meta-rows {
  font-size: 0.8rem;
}

.meta-row {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 2px;
}

.meta-row .lbl {
  color: var(--apple-subtext);
  font-weight: 400;
}

.meta-row .val {
  font-weight: 600;
  color: #000000;
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.info-card {
  background: var(--theme-card-bg, #f5f5f7);
  border: 1px solid var(--theme-card-border, transparent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.card-tag {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--theme-accent, #86868b);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.passenger-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #000000;
  letter-spacing: -0.01em;
}

.p-detail, .v-detail {
  font-size: 0.78rem;
  color: #3f3f46;
  margin-top: 2px;
}

/* Route Display Box */
.route-display-box {
  background: #ffffff;
  border: 1px solid var(--theme-card-border, #e5e5ea);
  border-radius: var(--radius-md);
  margin-top: 16px;
  padding: 16px 18px;
}

.route-box-header {
  margin-bottom: 12px;
}

.route-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--theme-accent, #86868b);
  text-transform: uppercase;
}

.route-timeline-wrap {
  display: flex;
  gap: 14px;
  align-items: stretch;
}

.uber-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 16px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.uber-dot {
  width: 8px;
  height: 8px;
  background: var(--theme-primary, #000000);
  border-radius: 50%;
  flex-shrink: 0;
}

.uber-line {
  width: 2px;
  flex: 1;
  background: #e5e5ea;
  margin: 4px 0;
}

.uber-sq {
  width: 8px;
  height: 8px;
  background: var(--theme-primary, #000000);
  flex-shrink: 0;
}

.uber-stops {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.stop-block .stop-type {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--theme-accent, #86868b);
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}

.stop-address {
  font-size: 0.88rem;
  font-weight: 600;
  color: #000000;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* Charges Table */
.charges-section {
  margin-top: 18px;
}

.charges-table {
  width: 100%;
  border-collapse: collapse;
}

.charges-table thead th {
  border-bottom: 1.5px solid var(--theme-primary, #000000);
  color: var(--theme-heading, #18181b);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 8px 4px;
  text-align: left;
}

.charges-table tbody td {
  padding: 11px 4px;
  border-bottom: 1px solid #f2f2f7;
  font-size: 0.84rem;
  color: #18181b;
}

.charges-table tbody td strong {
  font-weight: 600;
}

/* Financial Summary & Payment Grid */
.summary-payment-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  margin-top: 16px;
  align-items: flex-start;
}

.payment-instructions {
  background: var(--theme-card-bg, #f5f5f7);
  border: 1px solid var(--theme-card-border, transparent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.pay-title {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--theme-accent, #86868b);
  margin-bottom: 8px;
}

.methods-badges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.method-pill {
  background: #ffffff;
  border: 1px solid var(--apple-border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: #18181b;
  font-weight: 500;
}

.payment-card-pill {
  gap: 6px;
}

.card-logos-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.logo-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 900;
  border-radius: 2px;
  height: 13px;
  padding: 0 3px;
  line-height: 1;
}

.chip-visa {
  background: #1434cb;
  color: #ffffff;
  font-style: italic;
}

.chip-mc {
  background: #000000;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
}

.mc-c1, .mc-c2 {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.mc-c1 {
  background: #eb001b;
  margin-right: -2px;
}

.mc-c2 {
  background: #f79e1b;
}

.chip-amex {
  background: #006fcf;
  color: #ffffff;
}

.card-text-lbl {
  font-size: 0.68rem;
  font-weight: 600;
  color: #18181b;
  white-space: nowrap;
}

.brand-badge-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  flex-shrink: 0;
}

.badge-cash-green {
  background: #000000;
  color: #ffffff;
}

.badge-v {
  background: #008cff;
  color: #ffffff;
}

.badge-cash {
  background: #00d632;
  color: #ffffff;
}

/* Totals Card */
.totals-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  padding: 3px 0;
  color: #3f3f46;
}

.tot-row .lbl { font-weight: 400; color: var(--apple-subtext); }
.tot-row .val { font-weight: 600; color: #000000; }

.total-highlight {
  border-top: 2px solid var(--theme-primary, #000000);
  padding-top: 8px;
  margin-top: 4px;
}

.total-highlight .lbl {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--theme-heading, #000000);
}

.total-amt {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--theme-primary, #000000);
}

/* Footer */
.inv-footer {
  margin-top: 20px;
  border-top: 1px solid var(--apple-border);
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.policy-block {
  font-size: 0.72rem;
  color: var(--apple-subtext);
  max-width: 480px;
  line-height: 1.35;
}

.policy-block strong {
  color: #18181b;
}

.thank-you-stamp {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--theme-primary, #000000);
  background: var(--theme-card-bg, #f5f5f7);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* ==========================================================================
   10 RADICALLY DIFFERENT POSITIONAL LAYOUT ARCHITECTURES
   ========================================================================== */

/* --------------------------------------------------------------------------
   LAYOUT 1: Apple Minimal Monochrome (Classic Clean Linear Stack)
   -------------------------------------------------------------------------- */
.invoice-sheet[data-theme="monochrome"] {
  --theme-primary: #000000;
  --theme-heading: #000000;
  --theme-accent: #71717a;
  --theme-card-bg: #f4f4f5;
  --theme-card-border: #e4e4e7;
  --theme-badge-bg: #f4f4f5;
  --theme-badge-text: #18181b;
  --theme-badge-border: #e4e4e7;
  border-top: 4px solid #000000;
}

/* --------------------------------------------------------------------------
   LAYOUT 2: Royal Gold & Noir (Centered Header + Side-by-Side Info & Route)
   - Route box placed directly beside Client & Vehicle info in a 2-col split!
   -------------------------------------------------------------------------- */
.invoice-sheet[data-theme="gold"] {
  --theme-primary: #c5a059;
  --theme-heading: #17191c;
  --theme-accent: #9a7836;
  --theme-card-bg: #fcfaf5;
  --theme-card-border: #f0e6d2;
  --theme-badge-bg: #fbf7ee;
  --theme-badge-text: #8c6d2d;
  --theme-badge-border: #e6d5b8;
  border: 2px solid #c5a059;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 3px #ffffff, inset 0 0 0 4px #e6d5b8;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.invoice-sheet[data-theme="gold"] .inv-header {
  grid-column: 1 / -1;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-bottom: 2px double #c5a059;
  padding-bottom: 14px;
}

.invoice-sheet[data-theme="gold"] .brand-block {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.invoice-sheet[data-theme="gold"] .inv-meta {
  margin-left: 0;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fbf7ee;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #e6d5b8;
}

.invoice-sheet[data-theme="gold"] .meta-rows {
  display: flex;
  gap: 14px;
}

.invoice-sheet[data-theme="gold"] .meta-row {
  margin-bottom: 0;
}

.invoice-sheet[data-theme="gold"] .info-grid {
  grid-column: 1;
  grid-template-columns: 1fr;
  margin-top: 16px;
  gap: 10px;
}

.invoice-sheet[data-theme="gold"] .route-display-box {
  grid-column: 2;
  margin-top: 16px;
  height: calc(100% - 16px);
}

.invoice-sheet[data-theme="gold"] .charges-section {
  grid-column: 1 / -1;
}

.invoice-sheet[data-theme="gold"] .summary-payment-grid {
  grid-column: 1 / -1;
}

.invoice-sheet[data-theme="gold"] .inv-footer {
  grid-column: 1 / -1;
}

/* --------------------------------------------------------------------------
   LAYOUT 3: Executive Navy Blue (Solid Header Banner + Bottom Strip)
   -------------------------------------------------------------------------- */
.invoice-sheet[data-theme="navy"] {
  --theme-primary: #1e40af;
  --theme-heading: #0f172a;
  --theme-accent: #3b82f6;
  --theme-card-bg: #f0f7ff;
  --theme-card-border: #dbeafe;
  --theme-badge-bg: #eff6ff;
  --theme-badge-text: #1e40af;
  --theme-badge-border: #bfdbfe;
  border-top: none;
  padding-top: 0;
}

.invoice-sheet[data-theme="navy"] .inv-header {
  background: #0f2b5c;
  color: #ffffff;
  margin: 0 -40px 18px -40px;
  padding: 22px 36px;
  border-bottom: 3px solid #1e40af;
}

.invoice-sheet[data-theme="navy"] .comp-title {
  color: #ffffff;
}

.invoice-sheet[data-theme="navy"] .comp-addr,
.invoice-sheet[data-theme="navy"] .comp-contact,
.invoice-sheet[data-theme="navy"] .meta-row .lbl {
  color: #93c5fd;
}

.invoice-sheet[data-theme="navy"] .meta-row .val {
  color: #ffffff;
}

.invoice-sheet[data-theme="navy"] .charges-table thead th {
  background: #1e40af;
  color: #ffffff;
  padding: 8px 10px;
  border-radius: 4px 4px 0 0;
}

.invoice-sheet[data-theme="navy"] .charges-table tbody td {
  padding: 10px 10px;
}

/* --------------------------------------------------------------------------
   LAYOUT 4: Emerald Prestige (3-Column Top Quadrant Bauhaus Grid)
   -------------------------------------------------------------------------- */
.invoice-sheet[data-theme="emerald"] {
  --theme-primary: #059669;
  --theme-heading: #064e3b;
  --theme-accent: #10b981;
  --theme-card-bg: #f0fdf4;
  --theme-card-border: #059669;
  --theme-badge-bg: #ecfdf5;
  --theme-badge-text: #047857;
  --theme-badge-border: #a7f3d0;
  border-radius: 0;
  border-top: 6px solid #064e3b;
  border-left: 1px solid #d1fae5;
  border-right: 1px solid #d1fae5;
  border-bottom: 1px solid #d1fae5;
}

.invoice-sheet[data-theme="emerald"] .info-grid {
  grid-template-columns: 1fr 1fr;
  border: 1px solid #059669;
  border-radius: 0;
  background: #f0fdf4;
}

.invoice-sheet[data-theme="emerald"] .info-card {
  background: transparent;
  border: none;
  border-radius: 0;
}

.invoice-sheet[data-theme="emerald"] .info-card:first-child {
  border-right: 1px solid #059669;
}

.invoice-sheet[data-theme="emerald"] .route-display-box {
  border-radius: 0;
  border: 1.5px solid #059669;
}

.invoice-sheet[data-theme="emerald"] .card-tag,
.invoice-sheet[data-theme="emerald"] .route-title,
.invoice-sheet[data-theme="emerald"] .pay-title {
  background: #064e3b;
  color: #ffffff;
  padding: 2px 6px;
  display: inline-block;
  margin-bottom: 6px;
  letter-spacing: 0.08em;
}

/* --------------------------------------------------------------------------
   LAYOUT 5: Crimson Bold (Table-First Performance Flow)
   - Itemized Charges Table moved UP before Route Details!
   -------------------------------------------------------------------------- */
.invoice-sheet[data-theme="crimson"] {
  --theme-primary: #dc2626;
  --theme-heading: #7f1d1d;
  --theme-accent: #ef4444;
  --theme-card-bg: #fef2f2;
  --theme-card-border: #fee2e2;
  --theme-badge-bg: #fff1f2;
  --theme-badge-text: #b91c1c;
  --theme-badge-border: #fecdd3;
  border-top: 5px solid #dc2626;
  display: flex;
  flex-direction: column;
}

.invoice-sheet[data-theme="crimson"] .inv-header { order: 1; }
.invoice-sheet[data-theme="crimson"] .info-grid { order: 2; }
.invoice-sheet[data-theme="crimson"] .charges-section { 
  order: 3; 
  background: #fff;
  border: 1px solid #fee2e2;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.invoice-sheet[data-theme="crimson"] .route-display-box { order: 4; }
.invoice-sheet[data-theme="crimson"] .summary-payment-grid { order: 5; }
.invoice-sheet[data-theme="crimson"] .inv-footer { order: 6; }

.invoice-sheet[data-theme="crimson"] .totals-card {
  background: #18181b;
  color: #ffffff;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid #27272a;
}

.invoice-sheet[data-theme="crimson"] .tot-row {
  color: #a1a1aa;
}

.invoice-sheet[data-theme="crimson"] .tot-row .val {
  color: #ffffff;
}

.invoice-sheet[data-theme="crimson"] .total-highlight {
  border-top: 1.5px solid #dc2626;
}

.invoice-sheet[data-theme="crimson"] .total-highlight .lbl {
  color: #ffffff;
}

.invoice-sheet[data-theme="crimson"] .total-amt {
  color: #ef4444;
}

/* --------------------------------------------------------------------------
   LAYOUT 6: Midnight Purple (Asymmetric Split Cards + Glow)
   -------------------------------------------------------------------------- */
.invoice-sheet[data-theme="midnight"] {
  --theme-primary: #7c3aed;
  --theme-heading: #3b0764;
  --theme-accent: #8b5cf6;
  --theme-card-bg: #faf5ff;
  --theme-card-border: #e9d5ff;
  --theme-badge-bg: #3b0764;
  --theme-badge-text: #ffffff;
  --theme-badge-border: #7c3aed;
  border-top: 4px solid #7c3aed;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 0 16px;
}

.invoice-sheet[data-theme="midnight"] .inv-header {
  grid-column: 1 / -1;
}

.invoice-sheet[data-theme="midnight"] .info-grid {
  grid-column: 1;
  grid-template-columns: 1fr;
  margin-top: 16px;
  gap: 10px;
}

.invoice-sheet[data-theme="midnight"] .route-display-box {
  grid-column: 2;
  margin-top: 16px;
  height: calc(100% - 16px);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.06);
  border: 1px solid #ddd6fe;
}

.invoice-sheet[data-theme="midnight"] .charges-section {
  grid-column: 1 / -1;
}

.invoice-sheet[data-theme="midnight"] .summary-payment-grid {
  grid-column: 1 / -1;
}

.invoice-sheet[data-theme="midnight"] .inv-footer {
  grid-column: 1 / -1;
}

.invoice-sheet[data-theme="midnight"] .logo-mark {
  background: linear-gradient(135deg, #3b0764, #7c3aed);
}

/* --------------------------------------------------------------------------
   LAYOUT 7: Cyber Amber (Route Strip Top Placement)
   - Route Timeline sits prominently directly under the header!
   -------------------------------------------------------------------------- */
.invoice-sheet[data-theme="amber"] {
  --theme-primary: #d97706;
  --theme-heading: #78350f;
  --theme-accent: #b45309;
  --theme-card-bg: #fffbeb;
  --theme-card-border: #fde68a;
  --theme-badge-bg: #fef3c7;
  --theme-badge-text: #92400e;
  --theme-badge-border: #f59e0b;
  border-top: 4px solid #d97706;
  display: flex;
  flex-direction: column;
}

.invoice-sheet[data-theme="amber"] .inv-header { 
  order: 1; 
  border-bottom: 2px solid #d97706;
}

.invoice-sheet[data-theme="amber"] .route-display-box { 
  order: 2;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  margin-top: 14px;
}

.invoice-sheet[data-theme="amber"] .info-grid { 
  order: 3; 
  margin-top: 14px;
}

.invoice-sheet[data-theme="amber"] .charges-section { 
  order: 4; 
}

.invoice-sheet[data-theme="amber"] .charges-table thead th {
  background: #fef3c7;
  color: #78350f;
  padding: 8px 6px;
  border-bottom: 2px solid #d97706;
}

.invoice-sheet[data-theme="amber"] .summary-payment-grid { order: 5; }
.invoice-sheet[data-theme="amber"] .inv-footer { order: 6; }

/* --------------------------------------------------------------------------
   LAYOUT 8: Slate & Platinum (4-Quadrant Blueprint Matrix)
   -------------------------------------------------------------------------- */
.invoice-sheet[data-theme="slate"] {
  --theme-primary: #334155;
  --theme-heading: #0f172a;
  --theme-accent: #64748b;
  --theme-card-bg: #ffffff;
  --theme-card-border: #cbd5e1;
  --theme-badge-bg: #f1f5f9;
  --theme-badge-text: #1e293b;
  --theme-badge-border: #94a3b8;
  border: 1px solid #cbd5e1;
  border-top: 4px solid #334155;
  border-radius: 4px;
}

.invoice-sheet[data-theme="slate"] .info-card,
.invoice-sheet[data-theme="slate"] .route-display-box,
.invoice-sheet[data-theme="slate"] .payment-instructions {
  border-radius: 3px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
}

.invoice-sheet[data-theme="slate"] .charges-table {
  border: 1px solid #cbd5e1;
}

.invoice-sheet[data-theme="slate"] .charges-table thead th {
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  padding: 8px 10px;
}

.invoice-sheet[data-theme="slate"] .charges-table tbody td {
  border-bottom: 1px solid #e2e8f0;
  padding: 9px 10px;
}

/* --------------------------------------------------------------------------
   LAYOUT 9: Pacific Teal (Smooth Rounded Capsules & Balanced Flow)
   -------------------------------------------------------------------------- */
.invoice-sheet[data-theme="teal"] {
  --theme-primary: #0d9488;
  --theme-heading: #134e4a;
  --theme-accent: #14b8a6;
  --theme-card-bg: #f0fdfa;
  --theme-card-border: #99f6e4;
  --theme-badge-bg: #ccfbf1;
  --theme-badge-text: #0f766e;
  --theme-badge-border: #5eead4;
  border-top: 5px solid #0d9488;
  border-radius: 22px;
}

.invoice-sheet[data-theme="teal"] .info-card,
.invoice-sheet[data-theme="teal"] .route-display-box,
.invoice-sheet[data-theme="teal"] .payment-instructions {
  border-radius: 16px;
  border: 1.5px solid #ccfbf1;
}

.invoice-sheet[data-theme="teal"] .logo-mark {
  border-radius: 12px;
  background: linear-gradient(135deg, #0d9488, #0f766e);
}

/* --------------------------------------------------------------------------
   LAYOUT 10: Rose Gold & Espresso (Vintage Boutique Boxed Certificate)
   -------------------------------------------------------------------------- */
.invoice-sheet[data-theme="rose"] {
  --theme-primary: #9d174d;
  --theme-heading: #500724;
  --theme-accent: #be185d;
  --theme-card-bg: #fdf2f8;
  --theme-card-border: #fbcfe8;
  --theme-badge-bg: #fce7f3;
  --theme-badge-text: #831843;
  --theme-badge-border: #f472b6;
  border: 2px solid #fbcfe8;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 4px #ffffff, inset 0 0 0 6px #fdf2f8;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.invoice-sheet[data-theme="rose"] .inv-header {
  grid-column: 1 / -1;
  border-bottom: 2px solid #f472b6;
}

.invoice-sheet[data-theme="rose"] .info-grid {
  grid-column: 1;
  grid-template-columns: 1fr;
  margin-top: 16px;
  gap: 10px;
}

.invoice-sheet[data-theme="rose"] .route-display-box {
  grid-column: 2;
  margin-top: 16px;
  height: calc(100% - 16px);
}

.invoice-sheet[data-theme="rose"] .charges-section {
  grid-column: 1 / -1;
}

.invoice-sheet[data-theme="rose"] .summary-payment-grid {
  grid-column: 1 / -1;
}

.invoice-sheet[data-theme="rose"] .inv-footer {
  grid-column: 1 / -1;
}

.invoice-sheet[data-theme="rose"] .logo-mark {
  background: #831843;
}

/* ==========================================================================
   PRINT / PDF STYLESHEET (STRICT 1 SINGLE US LETTER PAGE)
   ========================================================================== */
@media print {
  @page {
    size: letter portrait;
    margin: 0.3in 0.35in !important;
  }

  html, body {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

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

  .app-layout {
    display: block !important;
    max-width: 100% !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .invoice-container {
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    display: block !important;
  }

  .invoice-sheet {
    max-width: 100% !important;
    width: 100% !important;
    box-shadow: none !important;
    padding: 6px 0 0 0 !important;
    box-sizing: border-box !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .invoice-sheet[data-theme="navy"] .inv-header {
    margin: 0 0 14px 0 !important;
    padding: 14px 18px !important;
    border-radius: 4px !important;
  }

  .invoice-sheet[data-theme="gold"] {
    box-shadow: none !important;
    border: 1.5px solid #c5a059 !important;
  }

  .charges-section {
    margin-top: 12px !important;
  }

  .summary-payment-grid {
    display: grid !important;
    grid-template-columns: 1.15fr 0.85fr !important;
    gap: 16px !important;
    margin-top: 12px !important;
  }

  .inv-footer {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-top: 14px !important;
    padding-top: 10px !important;
    border-top: 1px solid #e5e5ea !important;
  }

  .policy-block {
    display: block !important;
  }

  .thank-you-stamp {
    display: inline-block !important;
  }
}

/* Screen-only Responsive */
@media screen and (max-width: 1024px) {
  .top-bar {
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .theme-picker-header {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .app-layout {
    flex-direction: column;
  }

  .quick-form-panel {
    width: 100%;
    position: static;
    max-height: none;
  }

  .invoice-container {
    padding: 20px 12px;
  }

  .invoice-sheet {
    padding: 24px 20px;
    border-radius: var(--radius-sm);
  }

  .invoice-sheet[data-theme="gold"],
  .invoice-sheet[data-theme="midnight"],
  .invoice-sheet[data-theme="rose"] {
    grid-template-columns: 1fr !important;
  }

  .inv-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .inv-meta {
    text-align: left;
    margin-left: 0;
    margin-top: 10px;
  }

  .meta-row {
    justify-content: flex-start;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .summary-payment-grid {
    grid-template-columns: 1fr;
  }

  .inv-footer {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
}
