/* ==========================================================================
   WALink Pro - 100% Mobile-Friendly & Clean Design System
   ========================================================================== */

:root {
  /* Color Palette */
  --brand-wa: #25d366;
  --brand-wa-light: #25d366;
  --brand-wa-dark: #128c7e;
  --brand-wa-deep: #075e54;
  --brand-accent: #10b981;
  --brand-light: #ecfdf5;

  /* Theme Neutrals */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --bg-input: #f8fafc;
  
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #10b981;

  --text-main: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* Elevation */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);

  /* Border Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  /* WhatsApp Simulation */
  --wa-chat-bg: #efeae2;
  --wa-bubble-sent: #d9fdd3;
  --wa-bubble-meta: #667781;
}

[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-surface: #111827;
  --bg-surface-subtle: #1e293b;
  --bg-input: #1e293b;
  
  --border-subtle: #1f293d;
  --border-strong: #334155;
  --border-focus: #10b981;

  --text-main: #f8fafc;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --wa-chat-bg: #0b141a;
  --wa-bubble-sent: #005c4b;
  --wa-bubble-meta: #8696a0;
}

/* Strict Zero Horizontal Overflow */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
}

html {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Ambient glow - hidden on mobile to prevent overflow */
.glow-sphere {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: -1;
  opacity: 0.35;
}
.sphere-1 {
  top: -80px;
  right: -50px;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #10b981 0%, rgba(16, 185, 129, 0.05) 70%);
}
.sphere-2 {
  top: 500px;
  left: -100px;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #38bdf8 0%, rgba(56, 189, 248, 0.05) 70%);
}
@media (max-width: 640px) {
  .glow-sphere { display: none; }
}

/* Container */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Clean Responsive Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.6rem 0;
  width: 100%;
}
[data-theme="dark"] .app-header {
  background: rgba(17, 24, 39, 0.94);
}
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex-shrink: 1;
}
.brand a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  min-width: 0;
}
.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-wa), var(--brand-wa-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
  flex-shrink: 0;
}
.brand-text {
  min-width: 0;
}
.brand-text h1 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-main);
  white-space: nowrap;
}
.brand-text h1 span {
  color: var(--brand-wa-dark);
}
.tagline {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* Theme Toggle */
.btn-theme-toggle {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.btn-history-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.775rem;
  font-weight: 600;
  flex-shrink: 0;
}
.badge-count {
  background: var(--brand-wa-dark);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.08rem 0.4rem;
  border-radius: var(--radius-pill);
}

/* Main Layout Grid */
.main-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  margin-top: 1.25rem;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.form-column, .preview-column {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

/* Card Styling */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.card-header {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  min-width: 0;
  box-sizing: border-box;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-wa-dark);
  color: white;
  font-size: 0.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-title h2 {
  font-size: 1rem;
  font-weight: 700;
}
.card-title p {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.card-body {
  padding: 1.15rem;
  min-width: 0;
  box-sizing: border-box;
}

/* Mode Tabs - Horizontal scrollable without breaking width */
.mode-tabs {
  display: flex;
  gap: 0.35rem;
  background: var(--bg-surface-subtle);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.mode-tabs::-webkit-scrollbar {
  display: none;
}
.tab-btn {
  flex: 1 1 auto;
  min-width: max-content;
  padding: 0.55rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.775rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
  font-weight: 700;
}
[data-theme="dark"] .tab-btn.active {
  color: var(--brand-accent);
}
.tab-content { display: none; width: 100%; min-width: 0; }
.tab-content.active { display: block; }

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
  width: 100%;
  min-width: 0;
}
.form-group:last-child {
  margin-bottom: 0;
}
.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-main);
  width: 100%;
}
.form-label-sm {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}
.badge-tag, .badge-info {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-tag { background: rgba(16, 185, 129, 0.12); color: #059669; }
.badge-info { background: rgba(56, 189, 248, 0.12); color: #0284c7; }

/* Phone Input */
.phone-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.2rem 0.35rem;
  width: 100%;
}
.phone-input-wrapper:focus-within {
  border-color: var(--brand-wa-dark);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(18, 140, 126, 0.1);
}
.country-prefix {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.55rem;
  background: var(--bg-surface);
  border-radius: var(--radius-xs);
  font-weight: 700;
  font-size: 0.8rem;
  border: 1px solid var(--border-subtle);
  user-select: none;
  flex-shrink: 0;
}
.phone-input-wrapper .form-control {
  border: none;
  background: transparent;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-main);
  flex: 1;
  min-width: 0;
  width: 100%;
}
.phone-input-wrapper .form-control:focus {
  outline: none;
  box-shadow: none;
}
.btn-clear-input {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.helper-text {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
}
.form-control:focus {
  outline: none;
  border-color: var(--brand-wa-dark);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(18, 140, 126, 0.1);
}
.form-control-sm {
  padding: 0.4rem 0.6rem;
  font-size: 0.775rem;
  border-radius: var(--radius-sm);
}
.message-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.4;
  width: 100%;
}

/* Template Chips */
.template-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
  width: 100%;
  max-width: 100%;
}
.template-chip {
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  font-size: 0.725rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  box-sizing: border-box;
}
.template-chip:hover, .template-chip.active {
  background: var(--brand-wa-dark);
  color: white;
  border-color: var(--brand-wa-dark);
}

/* Quick Tags */
.quick-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.4rem;
  width: 100%;
}
.quick-tag-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}
.btn-tag {
  padding: 0.15rem 0.45rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin-bottom: 0.35rem;
  width: 100%;
}
.char-counter {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

/* Accordion */
.accordion-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 0.75rem;
  width: 100%;
}
.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface-subtle);
  border: none;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.775rem;
  cursor: pointer;
}
.acc-title { display: flex; align-items: center; gap: 0.4rem; }
.acc-title i { color: var(--brand-wa-dark); }
.acc-arrow { transition: transform 0.2s ease; font-size: 0.7rem; color: var(--text-muted); }
.accordion-item.open .acc-arrow { transform: rotate(180deg); }
.accordion-content {
  display: none;
  padding: 0.75rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}
.accordion-item.open .accordion-content { display: block; }
.source-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}
.btn-source-preset {
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  cursor: pointer;
}
.btn-source-preset.active {
  background: var(--brand-wa-dark);
  color: white;
  border-color: var(--brand-wa-dark);
  font-weight: 600;
}

/* Multi-CS & Calculator */
.cs-item-card {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem;
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 0.45rem;
  border: 1px solid var(--border-subtle);
  width: 100%;
}
.cs-num-badge {
  background: var(--brand-wa-dark);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}
.btn-remove-cs {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 0.35rem;
  flex-shrink: 0;
}
.calc-item-row {
  display: grid;
  grid-template-columns: 2fr 1.2fr 0.8fr auto;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.35rem;
  width: 100%;
}
.calc-summary-box {
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  border: 1px solid var(--border-subtle);
  width: 100%;
}
.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.775rem;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
}
.ongkir-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 110px;
}
.total-row {
  border-top: 1px dashed var(--border-subtle);
  padding-top: 0.45rem;
  margin-top: 0.45rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
}
.calc-val-total {
  color: var(--brand-wa-dark);
  font-size: 1.05rem;
  font-family: 'JetBrains Mono', monospace;
}

/* QR Customizer Grid */
.qr-config-card .card-body {
  padding: 1.25rem;
}

.qr-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem 1.25rem;
  width: 100%;
}

.qr-options-grid .form-group {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.qr-options-grid .form-label-sm {
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0;
  letter-spacing: -0.01em;
}

/* Color Presets */
.color-presets {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 2px 0;
  min-height: 38px;
}

.color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  flex-shrink: 0;
}

.color-btn:hover {
  transform: scale(1.1);
}

.color-btn.active {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--brand-wa-dark);
}

.custom-color-picker-label {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px dashed var(--border-subtle);
  background: var(--bg-surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: border-color 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.custom-color-picker-label:hover {
  border-color: var(--brand-wa-dark);
  color: var(--brand-wa-dark);
  transform: scale(1.08);
}

.custom-color-picker-label input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Pattern Presets (Dots Segmented Control) */
.pattern-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
  background: var(--bg-surface-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  min-height: 38px;
  align-items: center;
}

.btn-pattern {
  padding: 0.45rem 0.2rem;
  font-size: 0.725rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-pattern:hover {
  color: var(--text-primary);
}

.btn-pattern.active {
  background: var(--bg-surface);
  color: var(--brand-wa-dark);
  box-shadow: var(--shadow-xs);
}

[data-theme="dark"] .btn-pattern.active {
  background: var(--brand-wa-dark);
  color: #ffffff;
}

/* Logo Presets (Center Logo Segmented Control) */
.logo-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
  background: var(--bg-surface-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  min-height: 38px;
  align-items: center;
}

.btn-logo-option {
  padding: 0.45rem 0.25rem;
  font-size: 0.725rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-logo-option:hover {
  color: var(--text-primary);
}

.btn-logo-option.active {
  background: var(--bg-surface);
  color: var(--brand-wa-dark);
  box-shadow: var(--shadow-xs);
}

[data-theme="dark"] .btn-logo-option.active {
  background: var(--brand-wa-dark);
  color: #ffffff;
}

/* Frame Select Dropdown */
.qr-options-grid select.form-control {
  height: 38px;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.qr-options-grid select.form-control:focus {
  border-color: var(--brand-wa);
  background: var(--bg-surface);
}

/* ==========================================================================
   Right Column: WhatsApp Mockup & Result
   ========================================================================== */
.sticky-preview-wrapper {
  position: sticky;
  top: 4.5rem;
  width: 100%;
}

.phone-preview-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
  width: 100%;
  margin-bottom: 1rem;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 0.85rem 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.95rem;
}

.preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-wa-dark);
  background: rgba(18, 140, 126, 0.08);
  border: 1px solid rgba(18, 140, 126, 0.18);
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
}

[data-theme="dark"] .preview-badge {
  color: var(--brand-wa-light);
  background: rgba(37, 211, 102, 0.12);
  border-color: rgba(37, 211, 102, 0.25);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--brand-wa);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
  animation: pulse 2s infinite;
}

.preview-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Smartphone Device Mockup */
.phone-mockup {
  border: 6px solid #1e293b;
  border-radius: 32px;
  background-color: #efeae2;
  background-image: radial-gradient(rgba(0,0,0,0.06) 1px, transparent 0);
  background-size: 14px 14px;
  overflow: hidden;
  box-shadow: 0 16px 32px -8px rgba(0,0,0,0.22), 0 0 0 1px rgba(255,255,255,0.08) inset;
  display: flex;
  flex-direction: column;
  min-height: 380px;
  max-width: 350px;
  width: 100%;
  margin: 0 auto;
  position: relative;
}

[data-theme="dark"] .phone-mockup {
  border-color: #0f172a;
  background-color: #0b141a;
  background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 0);
  box-shadow: 0 16px 32px -8px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04) inset;
}

.phone-status-bar {
  background: #075E54;
  color: #ffffff;
  padding: 0.45rem 1rem 0.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  position: relative;
  letter-spacing: 0.02em;
}

.phone-status-bar::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 5px;
  transform: translateX(-50%);
  width: 50px;
  height: 4px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 99px;
}

.phone-status-bar .icons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.65rem;
  opacity: 0.9;
}

.wa-chat-header {
  background: linear-gradient(180deg, #075E54 0%, #128C7E 100%);
  color: #ffffff;
  padding: 0.55rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.12);
  z-index: 2;
}

.wa-back-btn {
  font-size: 0.85rem;
  color: #ffffff;
  opacity: 0.9;
}

.wa-avatar img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,0.35);
}

.wa-contact-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}

.wa-contact-name {
  font-size: 0.825rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  display: block;
}

.wa-contact-status {
  font-size: 0.68rem;
  color: #dcf8c6;
  line-height: 1;
  font-weight: 500;
  display: block;
}

.wa-header-icons {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #ffffff;
  opacity: 0.9;
}

.wa-chat-body {
  flex: 1;
  padding: 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 200px;
}

.wa-date-badge {
  align-self: center;
  background: rgba(255, 255, 255, 0.9);
  color: #54656f;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

[data-theme="dark"] .wa-date-badge {
  background: #182229;
  color: #8696a0;
}

.wa-bubble-wrapper {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.wa-bubble {
  background: #d9fdd3;
  color: #111b21;
  padding: 0.55rem 0.75rem 0.35rem;
  border-radius: 8px 0px 8px 8px;
  max-width: 90%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  position: relative;
  word-break: break-word;
}

[data-theme="dark"] .wa-bubble {
  background: #005c4b;
  color: #e9edef;
}

.wa-bubble::after {
  content: '';
  position: absolute;
  top: 0;
  right: -6px;
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-top-color: #d9fdd3;
  border-left-color: #d9fdd3;
}

[data-theme="dark"] .wa-bubble::after {
  border-top-color: #005c4b;
  border-left-color: #005c4b;
}

.wa-bubble-text {
  font-size: 0.825rem;
  line-height: 1.45;
  white-space: pre-wrap;
  margin-bottom: 0.15rem;
}

.wa-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  margin-top: 0.15rem;
}

.wa-bubble-time {
  font-size: 0.65rem;
  color: #667781;
}

[data-theme="dark"] .wa-bubble-time {
  color: rgba(233, 237, 239, 0.6);
}

.wa-check {
  font-size: 0.65rem;
  color: #53bdeb;
}

.wa-input-bar {
  padding: 0.45rem 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #f0f2f5;
}

[data-theme="dark"] .wa-input-bar {
  background: #202c33;
}

.wa-input-field {
  flex: 1;
  background: #ffffff;
  border-radius: 24px;
  padding: 0.45rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #8696a0;
  font-size: 0.78rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

[data-theme="dark"] .wa-input-field {
  background: #2a3942;
  color: #8696a0;
}

.wa-input-placeholder {
  flex: 1;
  font-size: 0.78rem;
  color: #8696a0;
}

.wa-input-icons {
  display: flex;
  gap: 0.5rem;
  color: #8696a0;
  font-size: 0.85rem;
}

.wa-mic-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #00a884;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

/* Result Card */
.result-card {
  padding: 1.25rem;
  width: 100%;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.95rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.result-header h3 {
  font-size: 0.95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-primary);
  margin: 0;
}

.status-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

[data-theme="dark"] .status-pill {
  background: rgba(37, 211, 102, 0.15);
  color: #34d399;
}

.link-output-box {
  margin-bottom: 0.95rem;
}

.link-url-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.75rem;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  width: 100%;
  transition: border-color 0.15s ease;
}

.link-url-wrapper:focus-within {
  border-color: var(--brand-wa-dark);
  background: var(--bg-surface);
}

.link-url-wrapper i {
  color: var(--brand-wa-dark);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.link-url-wrapper input {
  background: transparent;
  border: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.775rem;
  color: var(--text-primary);
  width: 100%;
  outline: none;
  font-weight: 600;
}

.link-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
}

.btn-copy-link {
  background: linear-gradient(135deg, #00a884 0%, #075e54 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 168, 132, 0.25);
}

.btn-copy-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 168, 132, 0.35);
}

.btn-test-chat {
  background: #25d366;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.25);
}

.btn-test-chat:hover {
  background: #20bd5a;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 211, 102, 0.35);
}

/* PRO Promo Box */
.pro-promo-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(6, 78, 59, 0.12) 100%);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  margin-bottom: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

[data-theme="dark"] .pro-promo-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(15, 23, 42, 0.6) 100%);
  border-color: rgba(16, 185, 129, 0.35);
}

.pro-promo-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pro-promo-title {
  font-size: 0.825rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pro-promo-title i {
  color: #eab308;
}

.pro-promo-desc {
  font-size: 0.725rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.pro-promo-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
}

.pro-promo-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

/* QR Result Section */
.qr-result-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.qr-canvas-frame-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.qr-frame-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 1rem 1rem 0.85rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 220px;
  max-width: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.qr-frame-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.qr-frame-top-header {
  background: linear-gradient(135deg, #075E54 0%, #128C7E 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 6px rgba(18, 140, 126, 0.25);
}

.qr-frame-card.no-frame .qr-frame-top-header { display: none; }

.qr-canvas-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.qr-canvas-inner canvas, .qr-canvas-inner svg {
  max-width: 100%;
  height: auto !important;
  display: block;
}

.qr-frame-footer {
  margin-top: 0.45rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.qr-frame-footer-store {
  font-size: 0.85rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-frame-footer-phone {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  color: #075E54;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.qr-download-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.btn-download-outline {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-download-outline:hover {
  background: var(--bg-surface);
  border-color: var(--brand-wa-dark);
  color: var(--brand-wa-dark);
  transform: translateY(-1px);
}

.btn-print-cta {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  font-size: 0.825rem;
  font-weight: 800;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

.btn-print-cta:hover {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.35);
}

[data-theme="dark"] .btn-print-cta {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .btn-print-cta:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

.col-span-2 { grid-column: span 2; }

/* General Buttons */
.btn {
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand-wa) 0%, var(--brand-wa-dark) 100%);
  color: white;
}
.btn-whatsapp {
  background: var(--brand-wa);
  color: white;
}
.btn-outline {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-main);
}
.btn-accent {
  background: #0f172a;
  color: white;
}
[data-theme="dark"] .btn-accent {
  background: #38bdf8;
  color: #0b1120;
}
.btn-icon-only {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
}
.btn-block { width: 100%; }
.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.725rem; }
.btn-danger-outline {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.25);

  color: #ef4444;
}
  color: #ef4444;
}

/* History Section */
.history-section { margin-top: 2rem; width: 100%; }
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.title-with-icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.title-with-icon h2 { font-size: 0.95rem; font-weight: 700; }
.title-with-icon p { font-size: 0.725rem; color: var(--text-muted); }
.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  width: 100%;
}
.history-card {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  width: 100%;
}
.history-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.history-phone { font-weight: 700; color: var(--text-main); font-family: 'JetBrains Mono', monospace; }
.history-msg-snippet {
  font-size: 0.775rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.history-actions { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 1.5rem 0.5rem;
  color: var(--text-muted);
}
.empty-state i { font-size: 1.75rem; opacity: 0.5; margin-bottom: 0.4rem; }

/* Tips Section */
.section-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 1rem; }
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  width: 100%;
}
.tip-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}
.tip-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  background: rgba(16, 185, 129, 0.12);
  color: var(--brand-wa-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.tip-card h3 { font-size: 0.825rem; font-weight: 700; margin-bottom: 0.25rem; }
.tip-card p { font-size: 0.725rem; color: var(--text-muted); line-height: 1.35; }

/* SweetAlert2 Custom Theme */
.swal2-popup {
  font-family: inherit !important;
  border-radius: var(--radius-lg) !important;
  padding: 1.5rem !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: var(--shadow-lg) !important;
}
[data-theme="dark"] .swal2-popup {
  background: #111827 !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .swal2-title {
  color: #f8fafc !important;
}
[data-theme="dark"] .swal2-html-container {
  color: #94a3b8 !important;
}
.swal2-actions {
  gap: 0.5rem !important;
}
.swal2-styled {
  border-radius: var(--radius-sm) !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
  padding: 0.6rem 1.25rem !important;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  background: #0f172a;
  color: white;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.775rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}

/* ==========================================================================
   Mobile Responsive Rules (< 768px & < 480px)
   ========================================================================== */
@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .sticky-preview-wrapper {
    position: static;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 0.65rem;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .main-layout {
    margin-top: 0.75rem;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
  }
  .form-column, .preview-column {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .card {
    border-radius: var(--radius-md, 14px);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .app-header {
    padding: 0.45rem 0;
  }
  .header-content {
    gap: 0.35rem;
  }
  .brand a {
    gap: 0.35rem;
  }
  .brand-icon {
    width: 30px;
    height: 30px;
    font-size: 1.05rem;
  }
  .brand-text h1 {
    font-size: 0.95rem;
  }
  .tagline {
    display: none;
  }
  
  /* Compact Header Buttons on Mobile */
  .btn-text-mobile {
    display: inline !important;
  }
  .btn-text-full {
    display: none !important;
  }
  .header-actions .btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.725rem;
  }
  .btn-history-nav {
    padding: 0.35rem 0.5rem;
  }

  .card-header {
    padding: 0.75rem 0.85rem;
  }
  .card-body {
    padding: 0.75rem 0.85rem;
  }
  .card-title h2 {
    font-size: 0.925rem;
  }
  .form-label {
    font-size: 0.775rem;
  }

  .mode-tabs {
    padding: 0.25rem;
    gap: 0.25rem;
    width: 100%;
    max-width: 100%;
  }
  .tab-btn {
    padding: 0.45rem 0.6rem;
    font-size: 0.725rem;
  }
  .phone-input-wrapper {
    padding: 0.15rem 0.25rem;
  }
  .country-prefix {
    padding: 0.35rem 0.45rem;
    font-size: 0.75rem;
  }
  .phone-input-wrapper .form-control {
    font-size: 0.825rem;
    padding: 0.35rem 0.45rem;
  }
  .template-chip {
    padding: 0.3rem 0.55rem;
    font-size: 0.7rem;
  }
  .btn-tag {
    padding: 0.15rem 0.35rem;
    font-size: 0.675rem;
  }
  .accordion-header {
    padding: 0.55rem 0.75rem;
    font-size: 0.75rem;
  }

  .qr-options-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .link-action-buttons {
    grid-template-columns: 1fr 1fr;
  }
  .link-action-buttons .btn-icon-only {
    grid-column: span 2;
    width: 100%;
  }
  .history-list {
    grid-template-columns: 1fr;
  }
  .phone-mockup {
    min-height: 280px;
    border-width: 4px;
    border-radius: 20px;
  }
  .modal-dialog {
    margin: 0.35rem;
    max-width: calc(100% - 0.7rem);
  }
}

/* ==========================================================================
   Print Isolation (Direct Print Sheet - Exactly 1 Page, No Blank Pages)
   ========================================================================== */
#printCardSheet {
  display: none !important;
}

@media print {
  @page {
    size: auto;
    margin: 0mm;
  }

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

  /* Hide ALL website elements during print */
  body > *:not(#printCardSheet) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Show ONLY the generated single-page print card */
  #printCardSheet {
    display: flex !important;
    visibility: visible !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 4mm !important;
    box-sizing: border-box !important;
    page-break-before: avoid !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 999999 !important;
    background: #ffffff !important;
  }

  #printCardSheet img {
    max-width: 95vw !important;
    max-height: 95vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin: auto !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}

/* Utilities */
.text-center { text-align: center; }
.text-emerald { color: var(--brand-wa-dark); }
.mt-2 { margin-top: 0.35rem; }
.mt-3 { margin-top: 0.55rem; }
.mt-4 { margin-top: 0.85rem; }
.mt-5 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 0.55rem; }
.mb-5 { margin-bottom: 1.5rem; }

/* ==========================================================================
   Modern App Footer
   ========================================================================== */
.app-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 3.5rem 0 2.5rem;
  margin-top: 4.5rem;
  color: var(--text-secondary);
  position: relative;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.footer-brand .brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
}

.footer-brand .brand-icon-sm {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%) !important;
  color: #ffffff !important;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
  flex-shrink: 0;
}

.footer-brand .brand-icon-sm svg {
  width: 20px;
  height: 20px;
  fill: #ffffff !important;
  display: block;
}

.footer-brand p {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 420px;
  margin: 0;
}

.footer-col h4 {
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.footer-links a:hover {
  color: var(--brand-wa-dark);
  transform: translateX(3px);
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.75rem;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.825rem;
  color: var(--text-muted);
}

.footer-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-subtle);
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: 0.775rem;
  color: var(--text-primary);
}

/* ==========================================================================
   Enhanced Mobile Responsive Footer & Layout (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .app-footer {
    padding: 2rem 0 3.5rem;
    margin-top: 2.5rem;
    background: var(--bg-surface);
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
  }

  .footer-brand {
    background: var(--bg-surface-subtle);
    padding: 1.25rem;
    border-radius: var(--radius-md, 14px);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-xs);
  }

  .footer-brand .brand-logo {
    font-size: 1.2rem;
  }

  .footer-brand p {
    font-size: 0.825rem;
    line-height: 1.55;
    margin-top: 0.25rem;
  }

  .footer-col {
    background: var(--bg-surface-subtle);
    padding: 1.15rem;
    border-radius: var(--radius-md, 14px);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-xs);
  }

  .footer-col h4 {
    margin-bottom: 0.85rem;
    font-size: 0.775rem;
    color: var(--brand-wa-dark);
    letter-spacing: 0.06em;
  }

  .footer-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .footer-links a {
    background: var(--bg-surface);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 100%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .footer-links a i {
    font-size: 0.95rem;
  }

  .footer-links a:active {
    background: var(--bg-surface-subtle);
    transform: scale(0.98);
  }

  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.85rem;
    padding-top: 1.25rem;
  }

  .footer-bottom div:first-child {
    font-size: 0.8rem;
    line-height: 1.5;
  }

  .footer-badge-pill {
    margin: 0 auto;
    font-size: 0.75rem;
    padding: 6px 14px;
  }
}

/* Global Modal Dialog & Overlay Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 1rem;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal-dialog {
  background: var(--bg-surface);
  border-radius: var(--radius-lg, 14px);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalPopIn {
  from { transform: scale(0.94) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-header .modal-title-wrap {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
}
.modal-header h3 {
  margin: 0 !important;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}
.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}
.btn-close-modal:hover {
  color: var(--text-main);
}
.modal-body {
  padding: 20px;
}

/* WhatsApp Text Formatter & Emoji Picker for Generator */
.wa-formatter-container {
  border: 1.5px solid var(--border-subtle, #e2e8f0);
  border-radius: var(--radius-md, 12px);
  overflow: visible;
  background: var(--bg-card, #ffffff);
  transition: all 0.2s ease;
  position: relative;
  display: block;
  margin-bottom: 0.5rem;
}
[data-theme="dark"] .wa-formatter-container {
  background: #111b21;
  border-color: #2a3942;
}
.wa-formatter-container:focus-within {
  border-color: var(--brand-wa-dark, #128c7e);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}
.wa-formatter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.03);
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}
[data-theme="dark"] .wa-formatter-toolbar {
  background: rgba(255, 255, 255, 0.04);
  border-color: #2a3942;
}
.wa-toolbar-btn-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
button.wa-tool-btn {
  appearance: none !important;
  -webkit-appearance: none !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 5px 8px !important;
  font-size: 0.85rem !important;
  font-weight: 600;
  color: var(--text-secondary, #64748b) !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  font-family: inherit !important;
}
button.wa-tool-btn:hover {
  background: rgba(37, 211, 102, 0.15) !important;
  color: var(--brand-wa-dark, #128c7e) !important;
  border-color: rgba(37, 211, 102, 0.25) !important;
}
.wa-emoji-trigger-wrap {
  position: relative;
}
button.wa-tool-btn.wa-emoji-trigger {
  gap: 5px !important;
  font-size: 0.775rem !important;
  padding: 5px 10px !important;
  background: rgba(37, 211, 102, 0.1) !important;
  color: #128c7e !important;
  border: 1px solid rgba(37, 211, 102, 0.25) !important;
  font-weight: 700 !important;
}
[data-theme="dark"] button.wa-tool-btn.wa-emoji-trigger {
  color: #25D366 !important;
  border-color: rgba(37, 211, 102, 0.35) !important;
}
button.wa-tool-btn.wa-emoji-trigger:hover {
  background: rgba(37, 211, 102, 0.22) !important;
}
.wa-emoji-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 270px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.18), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 8px;
  z-index: 9999;
  animation: fadeInDown 0.18s ease-out;
}
[data-theme="dark"] .wa-emoji-popover {
  background: #1f2c34;
  border-color: #2a3942;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
.wa-emoji-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}
[data-theme="dark"] .wa-emoji-popover-header {
  border-color: #2a3942;
}
.wa-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
}
.wa-emoji-item {
  background: transparent !important;
  border: none !important;
  font-size: 1.15rem;
  padding: 4px 2px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
  transition: transform 0.1s ease, background 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wa-emoji-item:hover {
  background: rgba(37, 211, 102, 0.18) !important;
  transform: scale(1.2);
}
.wa-formatter-container textarea.form-control,
.wa-formatter-container textarea.message-textarea {
  border: none !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 10px 14px !important;
  outline: none !important;
  width: 100% !important;
}


