/* ==========================================================================
   Instant Invoice • Web App Styles (Full Home Screen & Template Studio)
   100% Private On-Device Invoice & Receipt Studio
   Colors: Deep Obsidian (#090B10), Cyber Jade (#00E599), Champagne Gold (#F59E0B)
   NO BLUE. Dedicated Non-Overlapping Ad Layouts.
   © 2026 Instant Invoice | supply4uapps
   ========================================================================== */

:root {
  /* Canvas & Surfaces (Zero Blue) */
  --bg-canvas: #090B10;
  --bg-elevated: #11141D;
  --surface-card: #151824;
  --surface-card-hover: #1C2030;
  --surface-border: rgba(255, 255, 255, 0.08);
  --surface-border-active: rgba(0, 229, 153, 0.45);

  /* Primary Accent: Cyber Jade Emerald */
  --primary: #00E599;
  --primary-hover: #00C882;
  --primary-glow: rgba(0, 229, 153, 0.22);
  --primary-dim: rgba(0, 229, 153, 0.12);
  --primary-dark: #054F3B;

  /* Secondary Accents */
  --accent-gold: #F59E0B;
  --accent-gold-dim: rgba(245, 158, 11, 0.15);
  --accent-coral: #F43F5E;
  --accent-coral-dim: rgba(244, 63, 94, 0.15);

  /* Neutrals */
  --text-main: #FFFFFF;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  --input-bg: #0C0E15;
  --input-border: rgba(255, 255, 255, 0.12);

  /* Paper Output (Preview) */
  --paper-bg: #FFFFFF;
  --paper-text: #0F172A;
  --paper-muted: #64748B;
  --paper-border: #E2E8F0;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-card: 0 16px 36px -10px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-glow: 0 0 25px rgba(0, 229, 153, 0.18);
}

/* Instant Invoice 2.0 Light Mode (Complete Full-App Overrides) */
body.light-mode {
  --bg-canvas: #F3F6FA;
  --bg-elevated: #FFFFFF;
  --surface-card: #FFFFFF;
  --surface-card-hover: #F8FAFC;
  --surface-border: rgba(15, 23, 42, 0.10);
  --surface-border-active: rgba(5, 150, 105, 0.45);
  --primary: #059669;
  --primary-hover: #047857;
  --primary-dim: rgba(5, 150, 105, 0.12);
  --text-main: #0F172A;
  --text-muted: #475569;
  --text-dim: #64748B;
  --input-bg: #F1F5F9;
  --input-border: rgba(15, 23, 42, 0.16);
  --shadow-card: 0 10px 28px -8px rgba(15, 23, 42, 0.10), 0 0 0 1px rgba(15, 23, 42, 0.06);
}
body.light-mode .ambient-lighting { opacity: 0.18; }
body.light-mode .app-navbar {
  background: rgba(255, 255, 255, 0.94) !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.10) !important;
}
body.light-mode .home-hero-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #EEF4FA 100%) !important;
  border: 1px solid rgba(5, 150, 105, 0.28) !important;
  box-shadow: 0 14px 32px -12px rgba(15, 23, 42, 0.12) !important;
}
body.light-mode .btn-secondary {
  background: #F1F5F9 !important;
  color: #0F172A !important;
  border-color: rgba(15, 23, 42, 0.14) !important;
}
body.light-mode .btn-secondary:hover {
  background: #E2E8F0 !important;
}
body.light-mode .app-footer,
body.light-mode footer {
  background: #FFFFFF !important;
  border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
  color: #475569 !important;
}
body.light-mode .ad-slot-dedicated,
body.light-mode .modal-card,
body.light-mode .step-stepper-container {
  background: #FFFFFF !important;
  border-color: rgba(15, 23, 42, 0.10) !important;
}
body.light-mode .cockpit-pill {
  background: #F1F5F9 !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
}
#signatureCanvas {
  touch-action: none;
  cursor: crosshair;
  display: block;
}
.cockpit-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 18px 0 16px;
}
.cockpit-pill {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 12px 14px;
}
.cockpit-velocity {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  align-items: end;
  height: 68px;
  margin-top: 8px;
  margin-bottom: 18px;
}
.velocity-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.velocity-bar {
  width: 100%;
  border-radius: 5px;
  background: rgba(0, 229, 153, 0.28);
  min-height: 7px;
  transition: height 0.25s ease;
}
.velocity-bar.active { background: var(--primary); }
.theme-swatch-btn {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform 0.15s ease;
}
.theme-swatch-btn.active { border-color: var(--text-main); transform: scale(1.15); }
.lang-pill-btn {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--surface-border); background: var(--surface-card); color: var(--text-main); font-size: 12px; font-weight: 700; cursor: pointer;
}
.lang-pill-btn.active { background: var(--primary); color: #000; border-color: transparent; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-canvas);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Atmospheric Glow */
.ambient-lighting {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 229, 153, 0.12) 0%, rgba(245, 158, 11, 0.04) 45%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================================
   Top Header Navigation Bar
   ========================================================================== */
.app-navbar {
  background: rgba(17, 20, 29, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--surface-border);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
  cursor: pointer;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  border: 1px solid rgba(0, 229, 153, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-icon img {
  width: 26px;
  height: 26px;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-tag {
  background: var(--primary-dim);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0, 229, 153, 0.3);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Screens Management (Home, Templates, Editor)
   ========================================================================== */
.app-screen {
  display: none;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 10;
  flex: 1;
}

.app-screen.active-screen {
  display: block;
}

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

/* ==========================================================================
   SCREEN 1: Home Dashboard Layout
   ========================================================================== */
.home-container {
  max-width: 980px;
  margin: 32px auto 50px;
  padding: 0 20px;
  width: 100%;
}

/* Hero Card on Home */
.home-hero-card {
  background: linear-gradient(135deg, rgba(22, 25, 37, 0.95) 0%, rgba(13, 16, 24, 0.95) 100%);
  border: 1px solid rgba(0, 229, 153, 0.3);
  box-shadow: 0 20px 45px -15px rgba(0, 0, 0, 0.8), var(--shadow-glow);
  border-radius: var(--radius-xl);
  padding: 36px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.home-hero-title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
  line-height: 1.2;
}

.home-hero-sub {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Big Action Cards on Home */
.home-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 32px;
}

@media (max-width: 640px) {
  .home-actions-grid {
    grid-template-columns: 1fr;
  }
}

.action-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: 24px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 18px;
  text-decoration: none;
  color: var(--text-main);
  box-shadow: var(--shadow-card);
}

.action-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7), var(--shadow-glow);
  background: var(--surface-card-hover);
}

.action-card-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.action-icon-green {
  background: rgba(0, 229, 153, 0.15);
  border: 1px solid rgba(0, 229, 153, 0.4);
  color: var(--primary);
}

.action-icon-gold {
  background: var(--accent-gold-dim);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-gold);
}

.action-card-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.action-card-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Home Stats Banner */
.stats-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

@media (max-width: 640px) {
  .stats-banner {
    grid-template-columns: 1fr;
  }
}

.stat-box {
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 24px;
  font-weight: 900;
  color: var(--primary);
}

/* Recent Invoices on Home */
.recent-invoices-section {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 32px;
}

.recent-invoices-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--surface-border);
}

.recent-invoices-title {
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   SCREEN 2: Dedicated Template Gallery Screen
   ========================================================================== */
.templates-screen-container {
  max-width: 980px;
  margin: 28px auto 50px;
  padding: 0 20px;
  width: 100%;
}

.templates-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 36px;
}

.template-tile-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-card);
}

.template-tile-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 16px 32px -10px rgba(0, 0, 0, 0.7), var(--shadow-glow);
}

.template-tile-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.template-tile-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(0, 229, 153, 0.12);
  border: 1px solid rgba(0, 229, 153, 0.25);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.template-tile-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.template-tile-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  display: inline-block;
}

.template-tile-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.template-tile-preview-items {
  background: var(--input-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 11.5px;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.template-tile-preview-items div {
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   SCREEN 3: Multi-Step Studio Layout
   ========================================================================== */
.editor-screen-container {
  max-width: 860px;
  margin: 20px auto 40px;
  padding: 0 16px;
  width: 100%;
}

/* Stepper Pill Bar */
.step-stepper-container {
  margin-bottom: 24px;
}

.step-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  padding: 6px;
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  gap: 4px;
}

.step-nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.step-nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.step-nav-btn.active {
  background: var(--surface-card);
  color: var(--primary);
  border: 1px solid rgba(0, 229, 153, 0.3);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3), var(--shadow-glow);
}

.step-nav-btn.completed .step-num {
  background: rgba(0, 229, 153, 0.18);
  color: var(--primary);
  border-color: rgba(0, 229, 153, 0.4);
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.step-nav-btn.active .step-num {
  background: var(--primary);
  color: #000000;
  border-color: var(--primary);
}

/* Multi-Step Panels */
.step-panel {
  display: none;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.step-panel.active {
  display: block;
}

.studio-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--surface-border);
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title-icon {
  font-size: 20px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

@media (max-width: 680px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.input-box {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  width: 100%;
}

.input-box:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 229, 153, 0.15);
  background: #10131B;
}

.input-box::placeholder {
  color: #4B5563;
}

textarea.input-box {
  resize: vertical;
  min-height: 70px;
  font-family: inherit;
}

/* Logo Uploader */
.logo-upload-zone {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--input-bg);
  border: 1.5px dashed var(--surface-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.logo-upload-zone:hover {
  border-color: var(--primary);
}

.logo-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.logo-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Line Items */
.line-items-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.line-item-card {
  background: var(--input-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
}

@media (max-width: 720px) {
  .line-item-card {
    grid-template-columns: 1fr 1fr;
  }
  .line-item-card .item-desc-cell {
    grid-column: 1 / -1;
  }
}

.line-total-badge {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  text-align: right;
  padding-right: 6px;
}

.btn-icon-danger {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: all 0.15s;
}

.btn-icon-danger:hover {
  color: var(--accent-coral);
  background: var(--accent-coral-dim);
}

/* Digital Signature Box */
.signature-box {
  background: #FFFFFF;
  border-radius: var(--radius-md);
  border: 2px dashed #D4D4D8;
  overflow: hidden;
  position: relative;
}

.signature-canvas {
  width: 100%;
  height: 110px;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* Step Footer Navigation */
.step-nav-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--surface-border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 22px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #00E599 0%, #059669 100%);
  color: #000000;
  box-shadow: 0 4px 16px rgba(0, 229, 153, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 229, 153, 0.5);
  background: linear-gradient(135deg, #00F5A3 0%, #047857 100%);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Step 4: Live Invoice Sheet (Preview)
   ========================================================================== */
.invoice-sheet-preview {
  background: var(--paper-bg);
  color: var(--paper-text);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 48px;
  position: relative;
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .invoice-sheet-preview {
    padding: 24px 16px;
    border-radius: var(--radius-md);
  }
}

.sheet-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--paper-border);
  padding-bottom: 24px;
  margin-bottom: 28px;
}

.sheet-title {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #0F172A;
}

.sheet-num-tag {
  font-size: 15px;
  font-weight: 800;
  color: #059669;
  margin-top: 4px;
}

.sheet-parties-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

@media (max-width: 600px) {
  .sheet-parties-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.sheet-party-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sheet-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #059669;
  margin-bottom: 4px;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.sheet-table th {
  background: #042F24;
  color: #00E599;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
}

.sheet-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--paper-border);
  font-size: 13.5px;
}

.sheet-totals-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 280px;
  margin-left: auto;
  margin-bottom: 28px;
}

.sheet-total-line {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  color: #475569;
}

.sheet-grand-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  font-weight: 900;
  color: #0F172A;
  padding-top: 10px;
  border-top: 2px solid #0F172A;
}

.sheet-grand-amount {
  font-size: 22px;
  color: #059669;
}

/* ==========================================================================
   DEDICATED NON-OVERLAPPING AD SLOTS (Never covers any text)
   ========================================================================== */
.ad-slot-dedicated {
  width: 100%;
  max-width: 900px;
  margin: 28px auto;
  padding: 0 16px;
  position: static; /* Strictly non-overlapping */
  clear: both;
}

.ad-banner-isolated-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-label-pill {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

/* ==========================================================================
   REWARDED VIDEO AD MODAL (Mandatory Watch to Unlock PDF)
   ========================================================================== */
.video-ad-modal-dialog {
  max-width: 540px;
  text-align: center;
}

.video-player-simulation {
  background: #000000;
  border: 2px solid rgba(0, 229, 153, 0.4);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  margin: 18px 0;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.video-progress-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 14px;
}

.video-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00E599 0%, #F59E0B 100%);
  transition: width 1s linear;
}

.video-countdown-badge {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

/* ==========================================================================
   Settings Modal & Drawer
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.88);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  max-width: 560px;
  width: 100%;
  padding: 28px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-backdrop.open .modal-dialog {
  transform: scale(1);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-close-modal {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.btn-close-modal:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
}

.settings-section {
  background: var(--input-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.settings-section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13.5px;
}

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

.settings-link {
  color: var(--text-main);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 0;
  font-weight: 600;
  transition: color 0.15s;
}

.settings-link:hover {
  color: var(--primary);
}

/* App Footer */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--surface-border);
  background: #06070B;
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--primary);
}

/* Print Optimization */
@media print {
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }

  .ambient-lighting,
  .app-navbar,
  .step-stepper-container,
  .ad-slot-dedicated,
  .app-footer,
  .step-nav-footer,
  .modal-backdrop,
  #screenHome,
  #screenTemplates,
  #step1, #step2, #step3 {
    display: none !important;
  }

  #screenEditor, #step4 {
    display: block !important;
  }

  .editor-screen-container {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .invoice-sheet-preview {
    box-shadow: none !important;
    padding: 0 !important;
  }
}
