:root {
  --bg: #f8f9fa;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #273142;
  --text-muted: #5a5a5a;
  --text-faint: #94a3b8;
  --primary: #2476c6;
  --primary-dark: #1d5f9f;
  --primary-bright: #3981c9;
  --primary-light: #eaf3fc;
  --danger: #dc2626;
  --danger-bg: #fdeaea;
  --green: #4a7c1c;
  --green-bg: #f3fce0;
  --green-border: #cbe594;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.04);
  --radius: 12px;

  --sidebar-bg: #ffffff;
  --sidebar-bg-2: #f8f9fa;
  --sidebar-text: #273142;
  --sidebar-text-muted: #5a5a5a;
  --sidebar-border: #e2e8f0;
  --sidebar-track: #e2e8f0;
  --sidebar-icon-bg: #f2f3f7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  gap: 24px;
}

.topbar-left { display: flex; align-items: center; gap: 20px; min-width: 0; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--bg); }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; padding-left: 10px; border-left: 1px solid var(--border); }
.brand-sub { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
}
.breadcrumb .chev { width: 14px; height: 14px; color: var(--text-faint); }
.crumb-active { color: var(--primary); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.ssl-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}
.ssl-badge svg { width: 15px; height: 15px; }

.bell-btn { position: relative; }
.bell-btn .dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid var(--card);
}

.avatar-wrap { display: flex; align-items: center; gap: 6px; cursor: pointer; position: relative; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.status-dot {
  position: absolute;
  bottom: 0;
  left: 24px;
  width: 9px;
  height: 9px;
  background: var(--green);
  border: 2px solid var(--card);
  border-radius: 50%;
}
.chev.sm { width: 14px; height: 14px; color: var(--text-muted); }

/* ===== Layout ===== */
.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  padding: 24px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 14px; }

.side-dark-card {
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2) 160%);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius);
  padding: 24px 22px;
  box-shadow: var(--shadow);
}
.side-dark-card h3 { margin: 0 0 8px; font-size: 18px; font-weight: 800; color: var(--sidebar-text); }
.side-dark-card p { margin: 0 0 22px; font-size: 13.5px; color: var(--sidebar-text-muted); line-height: 1.5; }

/* Progress block */
.progress-block { margin-bottom: 22px; }
.progress-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--sidebar-text);
  margin-bottom: 10px;
}
.progress-labels span:last-child { color: var(--sidebar-text-muted); font-weight: 500; }
.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--sidebar-track);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-bright));
  border-radius: 999px;
  transition: width 0.6s ease;
}
.progress-percent {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-bright);
}

/* Step list */
.step-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.step-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
}
.step-row + .step-row { margin-top: 2px; }
.step-row:hover { background: rgba(36, 118, 198, 0.06); }

.step-icon-col { position: relative; display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.step-icon-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--sidebar-icon-bg);
  color: var(--sidebar-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
  transition: background 0.15s, color 0.15s;
}
.step-icon-circle svg { width: 17px; height: 17px; }
.step-connector {
  width: 2px;
  flex: 1;
  min-height: 18px;
  background: var(--sidebar-border);
  margin-top: 2px;
}
.step-row:last-child .step-connector { display: none; }

.step-num { font-size: 12.5px; color: var(--sidebar-text-muted); font-weight: 600; }
.step-name { font-size: 14.5px; color: var(--sidebar-text-muted); font-weight: 600; flex: 1; }
.step-row .chev { width: 16px; height: 16px; color: var(--sidebar-text-muted); opacity: 0; transition: opacity 0.15s; }

.step-row.active { background: linear-gradient(90deg, var(--primary), var(--primary-bright)); }
.step-row.active .step-icon-circle { background: rgba(255, 255, 255, 0.22); color: #fff; }
.step-row.active .step-num,
.step-row.active .step-name { color: #fff; }
.step-row.active .chev { opacity: 1; color: #fff; }

.step-row.completed .step-icon-circle { background: var(--primary); color: #fff; }
.step-row.completed .step-connector { background: var(--primary); }
.step-row.completed .step-num,
.step-row.completed .step-name { color: var(--sidebar-text); }

/* Need help card */
.help-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, var(--primary), var(--primary-bright));
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 18px;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.help-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.help-icon svg { width: 19px; height: 19px; }
.help-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.help-text strong { font-size: 14.5px; font-weight: 700; }
.help-text small { font-size: 12.5px; opacity: 0.9; font-weight: 500; }
.help-card .chev { width: 16px; height: 16px; }

/* Panel */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 32px; min-width: 0; }

.panel-header { display: flex; align-items: center; gap: 16px; }
.panel-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.panel-header h2 { margin: 0 0 3px; font-size: 19px; font-weight: 800; }
.panel-header p { margin: 0; font-size: 13.5px; color: var(--text-muted); }

.panel-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0 26px; }

/* Server-side validation banner */
.alert {
  background: var(--danger-bg);
  border: 1px solid #f3c6c1;
  color: #8c2018;
  border-radius: 10px;
  padding: 13px 16px;
  margin: 0 0 22px;
  font-size: 13.5px;
  font-weight: 600;
}

/* Wizard step panels */
.panel-wrap { min-width: 0; }
.step-panel { display: none; }
.step-panel.active { display: block; animation: rise 0.25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 24px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field.hide { display: none; }
.field .lbl { font-size: 13.5px; font-weight: 700; color: var(--text); }
.field .lbl .req, .req { color: var(--danger); margin-left: 2px; }

.ctl {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select.ctl { padding-right: 40px; appearance: none; -webkit-appearance: none; cursor: pointer; }
textarea.ctl { resize: vertical; }
.ctl::placeholder { color: var(--text-faint); }
.ctl:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36, 118, 198, 0.14); }
.ctl.error { border-color: var(--danger); }
.ctl:disabled { opacity: 0.5; cursor: not-allowed; }

/* Server-side field errors */
.field-error { margin: -2px 0 0; font-size: 12.5px; color: var(--danger); font-weight: 700; }
.field.has-error .ctl,
.field.has-error .filebox { border-color: var(--danger); }
.check-line.has-error { border-color: var(--danger); }
.sigwrap.has-error .sigpad { border-color: var(--danger); }

/* Subhead divider */
.subhead {
  grid-column: 1 / -1;
  font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--primary); margin: 6px 0 -4px; padding-top: 16px; border-top: 1px dashed var(--border);
}
.subhead:first-child { border-top: 0; padding-top: 0; }

/* Checkbox grid (Business Description / Certification) */
.checkboxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.check-line { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--text); }
.check-line input { margin-top: 2px; width: 17px; height: 17px; accent-color: var(--primary); flex: 0 0 auto; }
.field-checkbox { border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; background: var(--bg); }
.certs.grid { grid-template-columns: 1fr; gap: 10px; }
.certs .field-checkbox { background: var(--primary-light); }

/* Yes/No radio pills */
.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); padding: 9px 18px; border-radius: 999px;
  cursor: pointer; font-size: 13.5px; background: #fff; color: var(--text);
}
.pill input { accent-color: var(--primary); }
.pill.checked { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); font-weight: 700; }

/* Billing dimmed state */
.field[data-billing] { transition: opacity 0.15s; }

/* File inputs */
.filebox {
  width: 100%; padding: 12px; border: 1.5px dashed var(--border); border-radius: 10px;
  font-size: 13px; background: var(--bg); color: var(--text-muted);
}
.filebox:hover { border-color: var(--primary); }
.field:has(.filebox) { grid-column: 1 / -1; }

/* FUSF download prompt — only rendered when this brand has a form attached */
.dl-note {
  grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center;
  gap: 14px; flex-wrap: wrap; background: var(--primary-light);
  border: 1px solid #cfe1f5; border-radius: 10px;
  padding: 13px 16px; font-size: 13px; color: var(--primary-dark);
}
.dl-note a {
  background: var(--primary); color: #fff; text-decoration: none;
  padding: 9px 18px; border-radius: 9px; font-weight: 700; white-space: nowrap; font-size: 12.5px;
}
.dl-note a:hover { background: var(--primary-dark); }

/* Signature pad */
.sigwrap { grid-column: 1 / -1; }
.sigpad {
  border: 1.5px dashed var(--border); border-radius: 12px; background: var(--bg);
  width: 100%; height: 180px; touch-action: none; cursor: crosshair; display: block;
}
.sigbar { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.sig-help { color: var(--text-faint); font-size: 12.5px; }
.btn-ghost {
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 15px; font-size: 13px; cursor: pointer; color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); border-color: var(--primary); }

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.saved-msg { color: var(--primary); font-size: 12.5px; font-weight: 700; opacity: 0; transition: opacity 0.3s; margin-left: auto; margin-right: 16px; }
.saved-msg.show { opacity: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
}
.btn svg { width: 17px; height: 17px; }

.btn-outline {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg); }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn[hidden] { display: none; }

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 12px 22px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  z-index: 50;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .breadcrumb { display: none; }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .checkboxes { grid-template-columns: 1fr 1fr; }
  .panel { padding: 22px 18px; }
  .topbar { padding: 12px 16px; }
}
