:root {
  --bg-main: #070d18;
  --bg-card: #0e1726;
  --bg-card-hover: #131f33;
  --bg-input: #152238;
  --bg-input-focus: #1a2c47;
  --border-color: #1e2f4a;
  --border-focus: #10b981;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --color-primary: #10b981;
  --color-primary-dark: #059669;
  --color-primary-light: #34d399;
  --color-accent: #06b6d4;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  
  --wa-bg: #0b141a;
  --wa-bubble: #005c4b;
  --wa-bubble-text: #e9edef;
  --wa-meta: #8696a0;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-brand: 'Outfit', var(--font-sans);
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.25);
}

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

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

/* APP CONTAINER */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

/* HEADER */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #064e3b, #047857);
}

.brand-svg {
  width: 100%;
  height: 100%;
}

.brand-text h1 {
  font-family: var(--font-brand);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.badge-ops {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #042f2e;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-pill.offline {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.25);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #34d399;
  box-shadow: 0 0 8px #34d399;
}

.status-pill.offline .status-dot {
  background-color: #fbbf24;
  box-shadow: 0 0 8px #fbbf24;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--text-muted);
}

.btn-icon.danger-hover:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

/* SERVICE SELECTOR CARD */
.service-selector-card {
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.service-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
}

.tab-btn .tab-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.tab-title {
  display: block;
  font-family: var(--font-brand);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
}

.tab-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.tab-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(6, 182, 212, 0.12));
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.tab-btn.active .tab-title {
  color: #34d399;
}

.tab-btn.active .tab-sub {
  color: #94a3b8;
}

/* MAIN LAYOUT */
.main-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: start;
  min-width: 0;
}

@media (max-width: 980px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* FORM STYLES */
.form-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  min-width: 0;
  overflow: hidden;
  will-change: transform;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.section-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-header h3 {
  font-family: var(--font-brand);
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  flex-grow: 1;
}

.card-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  letter-spacing: 0.03em;
}

.card-badge.smart {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.pax-counter-pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  color: #38bdf8;
  border: 1px solid var(--border-color);
}

/* INPUT CONTROLS */
.form-grid {
  display: grid;
  gap: 14px;
}

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

@media (max-width: 600px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.req {
  color: #f87171;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  font-size: 0.95rem;
  pointer-events: none;
  font-family: var(--font-mono);
}

input[type="text"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: all 0.2s ease;
  outline: none;
}

.autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), 0 0 15px rgba(16, 185, 129, 0.2);
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.autocomplete-item {
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: var(--bg-input-focus);
  color: var(--color-primary-light);
}

.autocomplete-meta {
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  color: var(--text-dim);
}

.autocomplete-meta.smart {
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
}

.autocomplete-meta.distressed {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
}

/* Flight Item Suggestion Styling */
.flight-suggestion-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 12px;
}

.flight-main-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flight-number-dest {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flight-num-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #38bdf8;
  font-size: 0.88rem;
}

.flight-dest {
  color: var(--text-main);
  font-size: 0.82rem;
}

.flight-sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.flight-term-tag {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  color: #cbd5e1;
  font-weight: 600;
}

.flight-status-badge {
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.7rem;
}

.status-delayed {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-cancelled {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-ontime {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  background-color: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-dim);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.field-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* QUICK CHIPS */
.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.chip {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--text-dim);
}

.chip:active {
  transform: scale(0.94);
  transition: transform 0.08s ease;
}

.chip.note-chip {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.25);
  color: #67e8f9;
}

.chip.note-chip:hover {
  background: rgba(6, 182, 212, 0.18);
  border-color: rgba(6, 182, 212, 0.4);
}

/* PAX & ROOMS DYNAMIC LISTS */
.pax-inputs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pax-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: rgba(21, 34, 56, 0.5);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: border-color 0.2s;
}

.pax-row:hover {
  border-color: rgba(16, 185, 129, 0.3);
}

.pax-row input[type="text"] {
  text-transform: uppercase;
}

.pax-name-input {
  flex: 1 1 200px;
  min-width: 160px;
}

.pax-type-select {
  width: auto;
  min-width: 115px;
  font-size: 0.8rem !important;
  padding: 8px 28px 8px 10px !important;
  background-color: var(--bg-card) !important;
  cursor: pointer;
}

.pax-age-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pax-age-input {
  width: 75px !important;
  font-size: 0.8rem !important;
  padding: 8px 8px !important;
  text-align: center;
  background-color: var(--bg-card) !important;
}

.room-warning-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 0.76rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  animation: pulse-warn 2s infinite;
}

@keyframes pulse-warn {
  0%, 100% { border-color: rgba(239, 68, 68, 0.4); }
  50% { border-color: rgba(239, 68, 68, 0.8); }
}

.btn-remove-row {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  width: 36px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-remove-row:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

.rooms-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.room-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
}

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

.room-label {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 0.85rem;
  color: #34d399;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px dashed var(--text-dim);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-light);
  background: rgba(16, 185, 129, 0.08);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

/* PHOTO UPLOAD */
.photo-upload-area {
  margin-top: 4px;
}

.upload-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.upload-box:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-light);
  background: rgba(16, 185, 129, 0.05);
}

.photo-preview-wrap {
  position: relative;
  display: inline-block;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  max-width: 100%;
}

.photo-preview-wrap img {
  max-height: 180px;
  width: auto;
  display: block;
  border-radius: var(--radius-md);
}

.btn-remove-photo {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-remove-photo:hover {
  background: #ef4444;
}

/* PREVIEW SECTION (STICKY ON DESKTOP, NORMAL ON MOBILE) */
.preview-section {
  position: sticky;
  top: 16px;
  min-width: 0;
  overflow: hidden;
}

.preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.preview-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.preview-header h4 {
  font-family: var(--font-brand);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* EXPORT ACTION BUTTONS — FULL WIDTH, NO OVERFLOW */
.export-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.btn-export {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s ease,
              background 0.2s ease;
  position: relative;
  overflow: hidden;
  width: 100%;
  min-width: 0;
  will-change: transform;
  -webkit-font-smoothing: antialiased;
}

.btn-export:active {
  transform: scale(0.97);
  transition: transform 0.08s ease;
}

.export-btn-icon {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
}

.export-btn-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.export-title {
  font-family: var(--font-brand);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.export-desc {
  font-size: 0.68rem;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* BUTTON 1: FULL / HOTEL */
.btn-full {
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff;
  border-color: #10b981;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

.btn-full:hover {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

/* BUTTON 2: TRANSPORTADORA (IN) */
.btn-transporte-in {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

.btn-transporte-in:hover {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.4);
}

/* BUTTON 3: SALIDA (OUT) */
.btn-salida {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #ffffff;
  border-color: #a78bfa;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
}

.btn-salida:hover {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.4);
}

/* BUTTON 4: PICK UP / REGRESO */
.btn-pickup-out {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff;
  border-color: #fbbf24;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.3);
}

.btn-pickup-out:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.4);
}

/* DIRECT WHATSAPP BUTTON */
.btn-whatsapp-direct {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: #25d366;
  color: #064e3b;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-brand);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 3px 10px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp-direct:hover {
  background: #22c55e;
  transform: translateY(-1px);
}

/* WHATSAPP CHAT REPLICA */
.whatsapp-chat-bg {
  background-color: var(--wa-bg);
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 0);
  background-size: 16px 16px;
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--border-color);
  max-height: 480px;
  overflow-y: auto;
}

.whatsapp-bubble {
  background-color: var(--wa-bubble);
  color: var(--wa-bubble-text);
  border-radius: var(--radius-md) var(--radius-md) 2px var(--radius-md);
  padding: 12px 14px 6px 14px;
  font-size: 0.85rem;
  line-height: 1.45;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  position: relative;
  word-break: break-word;
}

.whatsapp-bubble pre {
  font-family: var(--font-sans);
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-photo-thumb {
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-height: 160px;
}

.preview-photo-thumb img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 0.68rem;
  color: var(--wa-meta);
  margin-top: 4px;
}

.read-ticks {
  color: #53bdeb;
  font-weight: 700;
}

/* DRAWER HISTORIAL */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
}

.drawer-panel {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  height: 100%;
  border-left: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-lg);
  animation: slide-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.drawer-body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-grow: 1;
}

.history-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.history-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
}

.history-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  justify-content: space-between;
}

.history-details {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.empty-msg {
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 30px;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #064e3b;
  color: #ecfdf5;
  border: 1px solid #10b981;
  padding: 12px 22px;
  border-radius: var(--radius-full);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 20px rgba(16, 185, 129, 0.3);
  font-weight: 600;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 200;
  animation: toast-fade 0.3s ease;
}

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

/* ANDROID MATERIAL 3 MOBILE ACTION BAR — 5 BUTTONS */
.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: auto;
  min-height: 58px;
  background: rgba(10, 18, 30, 0.97);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid var(--border-color);
  z-index: 90;
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: stretch;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.6);
  gap: 0;
  will-change: transform;
}

.mob-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 2px;
  border-radius: var(--radius-md);
  cursor: pointer;
  flex: 1;
  min-width: 0;
  transition: color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}

.mob-btn:active {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(0.9);
  transition: transform 0.08s ease, background 0.08s ease;
}

.mob-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.mob-label {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52px;
  text-align: center;
}

.mob-btn.mob-btn-wa {
  color: #25d366;
}

.drawer-drag-handle {
  display: none;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--text-dim);
  margin: 0 auto 10px auto;
}

/* RESPONSIVE LAYOUT & ANDROID MOBILE APP STYLING */
@media (max-width: 900px) {
  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .mobile-bottom-bar {
    display: flex;
  }

  .main-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Unset sticky on mobile so preview section flows naturally */
  .preview-section {
    position: static;
    top: auto;
  }

  .app-container {
    padding: 8px;
    gap: 8px;
  }

  .app-header {
    padding: 10px 12px;
    border-radius: var(--radius-md);
  }

  .brand-text h1 {
    font-size: 1rem;
  }

  .subtitle {
    display: none;
  }

  .logo-icon {
    width: 34px;
    height: 34px;
  }

  .form-card {
    padding: 14px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
  }

  .preview-card {
    padding: 12px;
    border-radius: var(--radius-md);
  }

  .export-title {
    font-size: 0.84rem;
  }

  .export-desc {
    font-size: 0.65rem;
  }

  .btn-export {
    padding: 10px 12px;
    gap: 10px;
  }

  /* Quick chips horizontal native momentum scroll */
  .quick-chips {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  .quick-chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex-shrink: 0;
    font-size: 0.74rem;
    padding: 5px 10px;
    scroll-snap-align: start;
  }

  .tab-btn {
    padding: 10px 12px;
    gap: 8px;
  }

  .tab-btn .tab-icon {
    font-size: 1.3rem;
  }

  .tab-title {
    font-size: 0.88rem;
  }

  .tab-sub {
    font-size: 0.68rem;
  }

  /* Drawer as Bottom Sheet on Mobile */
  .drawer-overlay {
    align-items: flex-end;
  }

  .drawer-panel {
    max-width: 100%;
    height: auto;
    max-height: 80vh;
    border-left: none;
    border-top: 1px solid var(--border-color);
    border-radius: 24px 24px 0 0;
    animation: slide-up 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .drawer-drag-handle {
    display: block;
  }

  @keyframes slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  .toast {
    bottom: calc(72px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
    max-width: 380px;
    text-align: center;
    justify-content: center;
    font-size: 0.82rem;
    padding: 10px 18px;
  }
}

/* ─── FLEET BADGES & QS CHIP ────────────────────────────── */
.badge-fleet {
  display: inline-flex;
  align-items: center;
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-primary-light);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  margin-left: 6px;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.badge-qs {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.chip-qs {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.15)) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
  color: #fcd34d !important;
  font-weight: 700 !important;
}

.chip-qs:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.25)) !important;
  border-color: rgba(251, 191, 36, 0.7) !important;
}

.fleet-note {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 6px;
  font-style: italic;
  padding-left: 2px;
  opacity: 0.8;
}

