/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #00a884; /* WhatsApp Signature Emerald */
  --primary-hover: #008f70;
  --primary-glow: rgba(0, 168, 132, 0.15);
  
  --bg-app: #f8f9fa;
  --bg-card: #ffffff;
  
  --text-primary: #111b21;
  --text-secondary: #54656f;
  --text-muted: #8696a0;
  
  --border-color: #e9edef;
  --border-focus: #8696a0;
  
  --success: #00a884;
  --warning: #e9a100;
  --danger: #ea0038;
  --info: #3b82f6;
  
  --shadow-sm: 0 2px 4px rgba(11, 20, 26, 0.04);
  --shadow-md: 0 4px 16px rgba(11, 20, 26, 0.06);
  --shadow-lg: 0 8px 30px rgba(11, 20, 26, 0.08);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Window Wrapper */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  background-color: var(--bg-app);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 1. Header (Premium App Bar style) */
.window-header {
  background-color: var(--bg-card);
  padding: 16px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.title-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-send-logo {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, #25d366 100%);
  color: white;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(0, 168, 132, 0.25);
}

.window-header h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.window-header p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.window-controls {
  display: flex;
  gap: 8px;
}

.win-btn {
  background: #f0f2f5;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.win-btn:hover {
  background-color: #e1e7eb;
  color: var(--text-primary);
}

.win-btn.danger {
  background-color: #fff0f2;
  color: var(--danger);
}

.win-btn.danger:hover {
  background-color: #ffdce1;
}

/* 2. Wizard Navigation Steps */
.steps-nav {
  background-color: var(--bg-card);
  display: flex;
  align-items: center;
  padding: 12px 24px;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.step-tab {
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background-color: var(--bg-card);
  transition: all 0.2s ease;
}

.step-tab:hover {
  color: var(--text-primary);
  background-color: #f0f2f5;
  border-color: #ccd0d4;
}

.step-tab.active {
  color: white;
  background-color: var(--primary);
  border-color: var(--primary);
  font-weight: 500;
}

.step-tab.active .step-icon {
  filter: brightness(0) invert(1);
}

.step-tab-spacer {
  flex: 1;
}

.step-tab.classic-mode {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background-color: var(--bg-card);
}

.step-tab.classic-mode:hover {
  background-color: #f0f2f5;
  color: var(--text-primary);
}

/* 3. Main Workspace Container */
.step-content-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

.step-pane {
  display: none;
  animation: stepSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.step-pane.active {
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

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

.pane-header h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.pane-header p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* 4. Custom UI Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

/* 5. Inputs & Form Elements */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-select {
  width: 100%;
  height: 42px;
  border: 1px solid #ccd0d4;
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background-color: var(--bg-card);
  transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea {
  width: 100%;
  min-height: 150px;
  height: auto;
  resize: vertical;
  overflow-y: hidden;
  background-color: var(--bg-card);
  border: 1px solid #ccd0d4;
  border-radius: var(--radius-lg);
  padding: 14px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  resize: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

/* 6. Buttons */
.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #f0f2f5;
  color: var(--text-primary);
  border-color: #ccd0d4;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #e1e7eb;
}

.btn-success {
  background-color: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-warning {
  background-color: var(--warning);
  color: white;
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}

.btn-outline {
  background: transparent;
  border-color: #ccd0d4;
  color: var(--text-primary);
}

.btn-outline:hover {
  background: #f8f9fa;
  border-color: var(--border-focus);
}

.btn-outline-primary {
  background: transparent;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline-primary:hover {
  background-color: rgba(0, 168, 132, 0.05);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 11px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 13px;
  font-weight: 700;
}

.mt-4 { margin-top: 1.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mb-3 { margin-bottom: 1rem; }
.ml-2 { margin-left: 0.5rem; }
.p-4 { padding: 1.25rem; }
.justify-center { justify-content: center; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.text-xs { font-size: 11px; }

/* 7. Step 0 (InstÃ¢ncias & ConexÃ£o Layout) */
.config-split-layout {
  display: flex;
  gap: 28px;
  flex: 1;
}

.config-left-col {
  flex: 1.1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.config-right-col {
  flex: 0.9;
}

.instances-tab-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 6px;
}

/* InstÃ¢ncia card */
.instance-card {
  padding: 14px 18px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}

.instance-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.instance-card.connected {
  border-left: 4px solid var(--success);
  background-color: #f6fffa;
}

.instance-card.disconnected {
  border-left: 4px solid #ccd0d4;
}

.instance-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.instance-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.instance-status {
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 700;
}

.instance-status.active {
  background-color: #d1fae5;
  color: #065f46;
}

.instance-status.inactive {
  background-color: #f0f2f5;
  color: var(--text-secondary);
}

.instance-url {
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-all;
}

.instance-btn-delete {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
}

.qr-connect-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 440px;
}

.qr-display-container {
  flex: 1;
  background-color: #f8f9fa;
  border: 2px dashed #ccd0d4;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 250px;
  padding: 24px;
}

.qr-placeholder {
  text-align: center;
  color: var(--text-secondary);
  max-width: 80%;
}

.qr-placeholder-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 14px;
}

.qr-placeholder p {
  font-size: 13px;
  line-height: 1.5;
}

.qr-image {
  max-width: 210px;
  max-height: 210px;
  background-color: white;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.qr-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.98);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  border-radius: var(--radius-lg);
}

.overlay-icon {
  font-size: 48px;
  color: var(--success);
  margin-bottom: 14px;
}

.qr-overlay h4 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.qr-overlay p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* 8. Step 1 (PÃºblico & Drag and Drop CSV) */
.audience-types-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.audience-type-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.audience-type-card:hover {
  border-color: var(--border-focus);
}

.audience-type-card.active {
  background-color: rgba(0, 168, 132, 0.05);
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(0, 168, 132, 0.08);
}

.audience-type-card.active .card-icon {
  color: var(--primary);
}

.manual-input-grid {
  display: flex;
  gap: 24px;
  width: 100%;
}

.file-upload-card {
  flex: 0.8;
  background-color: #f8f9fa;
  border: 2px dashed #ccd0d4;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.file-upload-card:hover, .file-upload-card.dragover {
  border-color: var(--primary);
  background-color: rgba(0, 168, 132, 0.02);
}

.upload-icon {
  font-size: 32px;
  margin-bottom: 10px;
}

.file-status {
  font-size: 11px;
  background-color: #e1e7eb;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  max-width: 100%;
  word-break: break-all;
}

/* Audience sub tab alignment */
.max-w-lg {
  max-width: 512px;
}
.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

/* Audience Stats Row */
.audience-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 20px;
}

.stat-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.stat-value {
  display: block;
  font-size: 20px;
  font-weight: 800;
  margin-top: 4px;
}

.pane-footer {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
}

/* 9. RECONSTRUÃÃO DA ETAPA 2 (PRINT DE MENSAGENS) */
.msg-strategy-selector {
  display: flex;
  gap: 12px;
}

.strategy-option {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.strategy-option.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
}

.strategy-option.active .strategy-icon {
  color: white;
}

.strategy-option.active .strategy-info p {
  color: rgba(255, 255, 255, 0.8);
}

.strategy-icon {
  font-size: 22px;
}

.strategy-info h4 {
  font-size: 13px;
  font-weight: 700;
}

.strategy-info p {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Message Horizontal Tabs */
.message-tabs-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 12px 0;
  margin-bottom: 12px;
}

.message-tab-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.message-tab-btn:hover {
  background-color: #f0f2f5;
  color: var(--text-primary);
}

.message-tab-btn.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Combined card for editor and preview as print */
.message-editor-preview-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  flex: 1;
  display: flex;
}

.message-editor-preview-layout {
  display: flex;
  gap: 20px;
  width: 100%;
}

.message-editor-col {
  flex: 1.1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message-editor-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.message-editor-header-row h4 {
  font-size: 14px;
  font-weight: 700;
}

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

.icon-btn-container {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background-color: #f8f9fa;
  transition: background 0.2s;
}

.icon-btn-container:hover {
  background-color: #e1e7eb;
}

.icon-btn-container.danger {
  background-color: #ffeef1;
  border-color: #fca5b6;
  color: var(--danger);
}

.icon-btn-container.danger:hover {
  background-color: #ffdce1;
}

/* Message media attachments */
.btn-attach-media {
  background-color: #e3f2fd;
  color: #0d47a1;
  border: 1px solid #90caf9;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  transition: background 0.2s;
}

.btn-attach-media:hover {
  background-color: #bbdefb;
}

/* WhatsApp Preview - Print style */
.whatsapp-preview-print-col {
  flex: 0.9;
  background-color: #efeae2;
  border-radius: var(--radius-md);
  border: 1px solid #ccd0d4;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 240px;
}

.whatsapp-preview-print-col .preview-title {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding-bottom: 8px;
}

.wa-preview-print-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto;
}

/* Print bubble style */
.wa-bubble-print {
  background-color: #d9fdd3;
  color: #111b21;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  max-width: 90%;
  align-self: flex-end;
  box-shadow: 0 1px 1.5px rgba(0,0,0,0.15);
  margin-top: 6px;
}

.wa-bubble-print .bubble-header {
  display: block;
  font-weight: 700;
  font-size: 10px;
  color: #075e54;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.wa-bubble-print .bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.wa-bubble-print .bubble-time {
  display: block;
  text-align: right;
  font-size: 8px;
  color: #667781;
  margin-top: 4px;
}

/* 10. Step 3 (ProteÃ§Ã£o & Risk Dial widget) */
.protection-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.protection-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.protection-option-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.protection-option-row h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.protection-option-row p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.protection-inputs {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.inline-flex {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-flex label {
  font-size: 12px;
  font-weight: 600;
  min-width: 110px;
}

.inline-flex input {
  width: 80px;
  height: 36px;
  border: 1px solid #ccd0d4;
  border-radius: var(--radius-sm);
  padding: 0 8px;
  text-align: center;
  font-size: 12px;
  outline: none;
}

.inline-flex input:focus {
  border-color: var(--primary);
}

/* Protection Step redesign matching print */
.protection-card-print {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 800px;
  width: 100%;
}

.protection-row-two-cols {
  display: flex;
  gap: 24px;
  width: 100%;
}

.horiz-split-inputs {
  display: flex;
  gap: 16px;
}

.sub-input-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sub-input-col label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.protection-checkboxes-row {
  display: flex;
  gap: 20px;
  align-items: center;
}

.custom-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-primary);
}

.custom-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Risk Banner styling (replacing the dial speedo) */
.risk-banner {
  background-color: #e6fcf5;
  border: 1px solid #85e8cb;
  border-radius: 8px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.risk-banner.medium {
  background-color: #fffbeb;
  border-color: #fce18a;
}

.risk-banner.high {
  background-color: #fff3f5;
  border-color: #fca5b6;
}

.risk-info-icon {
  font-size: 16px;
  color: #008f70;
}

.risk-banner.medium .risk-info-icon {
  color: #e9a100;
}

.risk-banner.high .risk-info-icon {
  color: #ea0038;
}

.risk-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.risk-banner-title {
  font-weight: 700;
  color: #006b53;
}

.risk-banner.medium .risk-banner-title {
  color: #925c00;
}

.risk-banner.high .risk-banner-title {
  color: #a30026;
}

.risk-banner-desc {
  color: var(--text-secondary);
}

/* 11. Step 4 (RevisÃ£o & Execution) */
.review-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.review-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.review-icon {
  font-size: 22px;
}

.review-card h5 {
  font-size: 9px;
  color: var(--text-secondary);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.review-card h4 {
  font-size: 15px;
  font-weight: 800;
  margin-top: 2px;
}

.campaign-trigger-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.select-instance-group select {
  height: 42px;
  border: 1px solid #ccd0d4;
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-size: 13px;
  outline: none;
  min-width: 220px;
}

.progress-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background-color: #e9edef;
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary);
  border-radius: 5px;
  transition: width 0.3s ease;
}

.console-log {
  background-color: #0c151a;
  color: #f0f2f5;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.4);
}

.log-entry.success { color: #53bdeb; }
.log-entry.error { color: #f15c5c; }
.log-entry.warn { color: var(--warning); }

.countdown-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 168, 132, 0.1);
  border: 1.5px solid var(--primary);
  border-radius: 999px;
  padding: 8px 20px;
  font-size: 14px;
  color: var(--primary);
}

.countdown-badge #countdown-timer {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.log-entry.system { color: #00e676; }

/* Connection Status indicator */
.connection-status-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  background-color: #f8f9fa;
  border: 1px solid var(--border-color);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
}

.status-indicator.yellow { 
  background-color: var(--warning); 
  box-shadow: 0 0 8px var(--warning);
}
.status-indicator.green { 
  background-color: var(--success); 
  box-shadow: 0 0 8px var(--success);
}
.status-indicator.red { 
  background-color: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

.status-indicator.pulse::after {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 1px solid inherit;
  opacity: 0.8;
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Spinner styling */
.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(0, 168, 132, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.audience-input-pane {
  display: none;
}

.audience-input-pane.active {
  display: block;
}

.inline-flex-row {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
}

.flex-1 {
  flex: 1;
}

.hidden {
  display: none !important;
}

.msg-delays-row {
  display: flex;
  gap: 16px;
  width: 100%;
}

.msg-delays-row .form-group {
  flex: 1;
  margin-bottom: 0;
}


/* Campaign Console & Stats */
.console-log {
  background: #1e1e1e;
  color: #a9b7c6;
  font-family: 'Consolas', 'Courier New', monospace;
  padding: 15px;
  border-radius: 8px;
  height: 250px;
  overflow-y: auto;
  font-size: 13px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
  border: 1px solid #333;
}
.log-entry {
  margin-bottom: 6px;
  line-height: 1.4;
  border-bottom: 1px dashed #333;
  padding-bottom: 4px;
}
.log-entry:last-child {
  border-bottom: none;
}
.log-entry.system { color: #569cd6; font-weight: bold; }
.log-entry.info { color: #dcdcaa; }
.log-entry.success { color: #4af626; font-weight: bold; }
.log-entry.warn { color: #f8c555; }
.log-entry.error { color: #f44747; font-weight: bold; }

.campaign-stats-grid {
  display: flex;
  gap: 10px;
}
.stat-box {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
}
.stat-box .stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-box .stat-value {
  display: block;
  font-size: 20px;
  font-weight: 800;
  margin-top: 4px;
}
.countdown-badge {
  display: inline-block;
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 193, 7, 0.3);
  font-size: 14px;
}
.countdown-badge #countdown-timer {
  font-size: 16px;
  margin-left: 6px;
}

/* ==========================================
   MOBILE OPTIMIZATIONS (PWA)
   ========================================== */
@media (max-width: 768px) {
  /* --- Base: allow scrolling on mobile --- */
  html, body {
    width: 100% !important;
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .app-layout {
    padding: 0;
    height: auto !important;
    min-height: 100vh !important;
    overflow: visible !important;
  }

  .main-content {
    border-radius: 0;
    min-height: 100vh;
    height: auto !important;
    overflow: visible !important;
    display: block !important;
  }

  /* --- Sticky header & nav --- */
  .window-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 50 !important;
    padding: 10px 12px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(10px) !important;
  }

  .window-controls { display: none !important; }

  .title-area h2 { font-size: 18px; }

  .steps-nav {
    position: sticky !important;
    top: 62px !important;
    z-index: 45 !important;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 8px 10px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(10px) !important;
  }

  .steps-nav::-webkit-scrollbar { height: 4px; }
  .steps-nav::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 4px;
  }

  .step-tab {
    flex: 0 0 auto !important;
    min-width: 72px !important;
    min-height: 44px !important;
    padding: 7px 10px !important;
    border-radius: 999px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  .step-tab-spacer { display: none !important; }

  /* --- Content area --- */
  .step-content-container {
    overflow: visible !important;
    padding: 12px 10px 86px !important;
  }

  .step-pane.active {
    display: block !important;
    height: auto !important;
    min-height: auto !important;
    padding: 0 !important;
  }

  .pane-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* --- Cards --- */
  .card,
  .message-editor-preview-card,
  .protection-card-print,
  .campaign-trigger-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 13px !important;
  }

  /* --- Grid layouts: collapse on mobile --- */
  .review-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .audience-types-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .audience-stats-row {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }

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

  /* --- Flex layouts: collapse to column --- */
  .config-split-layout,
  .manual-input-grid,
  .message-editor-preview-layout,
  .protection-row-two-cols,
  .msg-strategy-selector,
  .inline-flex-row,
  .campaign-controls,
  .actions-row {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 10px !important;
  }

  /* Reset child flex so they fill full width */
  .config-split-layout > *,
  .manual-input-grid > *,
  .message-editor-preview-layout > * {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    min-width: 0 !important;
  }

  .file-upload-card {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* --- Forms & inputs --- */
  textarea { min-height: 155px; font-size: 16px; }

  .form-input, .form-select, input, select {
    min-height: 46px !important;
    font-size: 15px !important;
  }

  .select-instance-group,
  .select-instance-group select {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* --- Buttons --- */
  .btn,
  .btn-primary, .btn-secondary, .btn-danger, .btn-warning, .btn-success,
  .btn-attach-media,
  #btn-start-campaign, #btn-pause-campaign, #btn-stop-campaign {
    width: 100%;
    justify-content: center;
    margin-bottom: 0;
  }

  /* --- Stats & progress --- */
  .campaign-stats-grid { flex-direction: column; gap: 8px; }
  .progress-info-row { flex-direction: column; gap: 8px; align-items: flex-start; }

  /* --- Modal --- */
  .modal-content {
    width: calc(100% - 20px) !important;
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* ==========================================
   AI ASSISTANT MODALS
   ========================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden {
  display: none;
}
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 90%;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  animation: fadeIn 0.3s ease-out;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary);
}
.modal-body {
  padding: 20px;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
