:root {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --card-border: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #ff7a59;
  --primary-hover: #ff5c35;
  --accent-emerald: #10b981;
  --accent-blue: #38bdf8;
  --input-bg: #0f172a;
  --input-border: #475569;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  padding: 16px 20px 36px 20px;
  display: flex;
  justify-content: center;
}

.app-container {
  width: 100%;
  max-width: 1360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--card-border);
}

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


.logo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.logo-wrapper:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.25);
}

.company-logo-img {
  height: 44px;
  width: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.company-logo-badge {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), #e11d48);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 12px rgba(255, 122, 89, 0.4);
}

.brand-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 8px 14px;
  border-radius: 9999px;
  font-size: 13px;
  color: #6ee7b7;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* Hero Job Number Card */
.hero-card {
  background: linear-gradient(145deg, #1e293b, #172554);
  border: 1px solid #3b82f6;
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.6);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.hero-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent-blue);
  margin-bottom: 4px;
}

.hero-job-badge {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}

.job-prefix {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
}

.job-number-val {
  font-size: 40px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -1px;
  text-shadow: 0 2px 10px rgba(56, 189, 248, 0.4);
}

.refresh-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--card-border);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.refresh-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: rotate(90deg);
}

.hero-instruction {
  font-size: 14px;
  color: #cbd5e1;
  max-width: 580px;
  line-height: 1.4;
}

.hero-meta {
  display: flex;
  gap: 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  padding-left: 24px;
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.meta-value {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-top: 2px;
}

/* Form Layout */
.intake-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .hero-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .hero-meta {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 12px;
    width: 100%;
    justify-content: space-between;
  }
}

.form-section-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-lg);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.section-step {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.section-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.section-subdivider {
  height: 1px;
  background: var(--card-border);
  margin: 8px 0;
}

/* Inputs */
.form-row {
  display: grid;
  gap: 14px;
}

.form-row.two-col {
  grid-template-columns: 1fr 1fr;
}

.form-row.three-col {
  grid-template-columns: 2fr 1fr 1fr;
}

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

label {
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}

.req {
  color: #f43f5e;
}

.opt {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

input[type="text"],
input[type="tel"],
input[type="email"],
select,
textarea {
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 10px 12px;
  font-size: 15px;
  transition: all 0.2s ease;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

/* Radio Pills */
.radio-pill-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.radio-pill {
  flex: 1;
  min-width: 100px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  user-select: none;
}

.radio-pill input {
  display: none;
}

.radio-pill:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-blue);
}

.radio-pill.selected {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-blue);
  color: #fff;
  font-weight: 600;
}

/* Job Class Chips */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.chip {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: #cbd5e1;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.chip:hover {
  border-color: var(--primary);
  color: #fff;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(255, 122, 89, 0.4);
}

/* Deal Preview Box */
.preview-box {
  background: #020617;
  border: 1px dashed #38bdf8;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--accent-blue);
  font-weight: 600;
}

.preview-formula {
  font-family: 'Courier New', Courier, monospace;
  font-size: 17px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  word-break: break-word;
}

/* Error Banner */
.error-banner {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid #f43f5e;
  color: #fecdd3;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
}

.hidden {
  display: none !important;
}

/* Big Submit Button */
.submit-container {
  display: flex;
  justify-content: flex-end;
}

.submit-btn {
  background: linear-gradient(135deg, var(--primary), #ea580c);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px 32px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 10px 20px rgba(234, 88, 12, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(234, 88, 12, 0.45);
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn:disabled {
  background: #475569;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Success Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  background: var(--card-bg);
  border: 1px solid #10b981;
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  max-width: 540px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-icon {
  font-size: 54px;
}

.modal-title {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
}

.modal-job-tag {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid #10b981;
  font-size: 20px;
  font-weight: 800;
  padding: 6px 18px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
}

.modal-desc {
  font-size: 15px;
  color: #cbd5e1;
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  width: 100%;
  word-break: break-word;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.modal-btn-hubspot {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 15px;
  transition: all 0.2s ease;
  display: block;
}

.modal-btn-hubspot:hover {
  background: var(--primary-hover);
}

.modal-btn-next {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-btn-next:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   Association Blueprint & Tag Routing Styles
   ========================================================================== */
.assoc-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.assoc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.assoc-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.assoc-icon {
  font-size: 24px;
}

.assoc-title {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}

.assoc-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.assoc-badge-status {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 4px 10px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
}

.assoc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.assoc-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(71, 85, 105, 0.4);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assoc-item-label {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
}

.assoc-select {
  background: #0f172a;
  border: 1px solid #334155;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.assoc-select:focus {
  border-color: #38bdf8;
}

.assoc-footer-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(51, 65, 85, 0.4);
}

.assoc-pill {
  font-size: 11px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(51, 65, 85, 0.6);
  padding: 4px 10px;
  border-radius: 9999px;
}

.assoc-pill strong {
  color: #6ee7b7;
}

/* Modal Associations Breakdown */
.modal-associations-box {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(71, 85, 105, 0.4);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.modal-assoc-title {
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
}

.modal-assoc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-assoc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
}

.assoc-item-badge {
  color: #cbd5e1;
  font-weight: 500;
}

.assoc-item-tag {
  color: #38bdf8;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ==========================================================================
   Operational Badges Preview Styling
   ========================================================================== */
.preview-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.badge-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
  letter-spacing: 0.4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-pill.badge-emergency {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  animation: pulse-red 2s infinite ease-in-out;
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.badge-pill.badge-high {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fcd34d;
}

.badge-pill.badge-warranty {
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(139, 92, 246, 0.5);
  color: #c4b5fd;
}

.badge-pill.badge-leak {
  background: rgba(14, 165, 233, 0.18);
  border: 1px solid rgba(14, 165, 233, 0.5);
  color: #7dd3fc;
}

.badge-pill.badge-trade {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
}

.badge-pill.badge-client {
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.5);
  color: #a5b4fc;
}

