* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --border: #e4e7eb;
  --border-active: #3b82f6;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --green: #10b981;
  --red: #ef4444;
  --notice-bg: #fffbeb;
  --notice-border: #fde68a;
  --section-divider: #d1d5db;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  padding: 32px 24px;
}

.page-wrap { max-width: 1280px; margin: 0 auto; }

/* ── Global header (sticky) ─────────────── */
.header {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
  position: sticky;
  top: 12px;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.app-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.tabs {
  display: flex;
  gap: 4px;
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.tab-btn {
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  background: var(--text);
  color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* ── Sub-account picker (now inside header) ─── */
.picker {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.picker-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.picker-combobox {
  position: relative;
  flex: 1;
  min-width: 280px;
}
.picker-input {
  width: 100%;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}
.picker-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.picker-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
  z-index: 100;
  display: none;
}
.picker-dropdown.open { display: block; }
.picker-option {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid #f3f4f6;
}
.picker-option:last-child { border-bottom: none; }
.picker-option:hover, .picker-option.highlighted {
  background: var(--blue-light);
  color: var(--blue);
}
.picker-status {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.picker-status.loaded { color: var(--green); }
.picker-status.error { color: var(--red); }

/* ── Tab content visibility ─────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Flow type toggle (A2P-only) ─── */
.flow-toggle {
  display: flex;
  gap: 4px;
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  flex-shrink: 0;
}
.flow-pill {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}
.flow-pill:hover { color: var(--text); }
.flow-pill.active {
  background: var(--text);
  color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.flow-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.flow-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Flow-pick prompt ─── */
.flow-prompt {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-secondary);
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.flow-prompt .arrow { font-size: 36px; opacity: 0.4; margin-bottom: 12px; }
.flow-prompt h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.flow-prompt p { font-size: 14px; max-width: 480px; margin: 0 auto; }

/* ── Banner ─── */
.banner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 24px;
}
.banner h1 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.banner p { color: var(--text-secondary); font-size: 13px; }

/* ── Sections ─── */
.section-block { margin-bottom: 28px; }

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.section-step-num {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.section-title { font-size: 16px; font-weight: 600; }
.section-description {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
  margin-left: 38px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-left: 38px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.form-row:last-child { margin-bottom: 0; }
.form-row.single { grid-template-columns: 1fr; }

.field { display: flex; flex-direction: column; }
.field-label {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
}
.required { color: var(--red); margin-left: 2px; }

.field-input {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.field-input:hover {
  border-color: var(--blue);
  background: #fafbfc;
}
.field-input.copied {
  border-color: var(--green);
  background: #ecfdf5;
}
.field-input.dropdown::after {
  content: '⌄';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-65%);
  color: var(--text-muted);
  font-size: 18px;
}
.field-input.textarea { min-height: 90px; align-items: flex-start; padding-top: 12px; }

.field-input.info-only {
  cursor: default;
  background: #f9fafb;
}
.field-input.info-only:hover {
  border-color: var(--border);
  background: #f9fafb;
}
.field-input.info-only .field-value {
  color: var(--text-muted);
  font-style: italic;
}
.field-input.info-only .copy-icon { display: none; }

.field-value {
  color: var(--text);
  word-break: break-word;
  flex: 1;
}
.field-value.placeholder {
  color: var(--text-muted);
  font-style: italic;
}
.field-value.empty {
  color: var(--red);
  font-style: italic;
  font-weight: 500;
}

.copy-icon {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
  padding-left: 8px;
}
.field-input.copied .copy-icon { color: var(--green); }
.copy-icon::before { content: '⎘ Click to copy'; }
.field-input.copied .copy-icon::before { content: '✓ Copied'; }

.field-helper {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ── Notice box ─── */
.notice {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-radius: 6px;
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 13px;
  color: #78350f;
  line-height: 1.6;
}
.notice-title { font-weight: 600; margin-bottom: 6px; }
.notice ul { padding-left: 18px; margin-top: 4px; }
.notice li { margin-bottom: 3px; }
.notice a {
  color: #78350f;
  text-decoration: underline;
  font-weight: 600;
}
.notice a:hover { color: #92400e; }

/* ── Radio mock ─── */
.radio-group { display: flex; gap: 24px; margin-top: 8px; }
.radio-mock {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.radio-circle {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--text-muted);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}
.radio-circle.selected { border-color: var(--blue); }
.radio-circle.selected::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: var(--blue);
  border-radius: 50%;
}

.subsection-divider {
  border-top: 2px dashed var(--section-divider);
  margin: 24px 0;
  margin-left: 38px;
  position: relative;
}
.subsection-divider span {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.step-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.step-group-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.step-group-header .num {
  background: var(--text);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}
.step-group-header .title { font-size: 18px; font-weight: 700; }
.step-group-header .subtitle { font-size: 13px; color: var(--text-secondary); }

/* ── Major step divider ── */
.major-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 56px 0 40px 0;
  padding: 0 8px;
}
.major-divider-line {
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--section-divider), transparent);
}
.major-divider-badge {
  background: var(--text);
  color: white;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ── Checkbox mock ─── */
.checkbox-mock {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 16px;
}
.checkbox-square {
  width: 16px;
  height: 16px;
  background: var(--blue);
  border-radius: 3px;
  flex-shrink: 0;
  position: relative;
  margin-top: 2px;
}
.checkbox-square::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: 700;
}
.checkbox-square.unchecked {
  background: white;
  border: 1.5px solid var(--text-muted);
}
.checkbox-square.unchecked::after { content: ''; }

.add-details-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 10px;
}

/* ── Selectable card ─── */
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}
.selectable-card {
  border: 2px solid var(--blue);
  border-radius: 10px;
  padding: 18px 20px;
  position: relative;
  background: white;
}
.selectable-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}
.selectable-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.selectable-card li {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.selectable-card li::before {
  content: '✓';
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
}
.selectable-card-check {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 22px;
  height: 22px;
  background: var(--blue);
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.selectable-card.unselected {
  border: 1px solid var(--border);
}
.selectable-card.unselected .selectable-card-check {
  background: white;
  border: 1.5px solid var(--text-muted);
  color: transparent;
}
.selectable-card-recommended {
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

/* ── Choice card ─── */
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.choice-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  background: white;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}
.choice-card.selected {
  border: 2px solid var(--blue);
  padding: 15px 19px;
}
.choice-card.muted { opacity: 0.55; }
.choice-icon {
  width: 36px;
  height: 36px;
  background: #eff6ff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  font-size: 16px;
  flex-shrink: 0;
}
.choice-body { flex: 1; }
.choice-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.choice-title-badge {
  font-size: 11px;
  color: var(--blue);
  font-weight: 600;
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 999px;
}
.choice-bullets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 18px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.choice-bullets li {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.choice-bullets li.ok::before { content: '✓'; color: var(--green); font-weight: 700; }
.choice-bullets li.warn::before { content: '⚠'; color: #f59e0b; font-weight: 700; }
.choice-radio {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--text-muted);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}
.choice-radio.selected {
  border-color: var(--blue);
  background: var(--blue);
}
.choice-radio.selected::after {
  content: '';
  position: absolute;
  inset: 4px;
  background: white;
  border-radius: 50%;
}

/* ── Message preview block ─── */
.message-block {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.6;
  margin-top: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  color: var(--text);
}
.message-block:hover {
  border-color: var(--blue);
  background: #fafbfc;
}
.message-block.copied {
  border-color: var(--green);
  background: #ecfdf5;
}
.message-block .merge-token {
  background: #dbeafe;
  color: var(--blue);
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 13px;
}
.message-block .copy-hint {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 11px;
  color: var(--text-muted);
}
.message-block.copied .copy-hint {
  color: var(--green);
  font-weight: 600;
}
.message-block .copy-hint::before { content: '⎘ Copy message'; }
.message-block.copied .copy-hint::before { content: '✓ Copied'; }

/* ── Loading state ─── */
.content-area {
  transition: opacity 0.2s ease;
}
.content-area.loading { opacity: 0.4; pointer-events: none; }
.content-area.empty {
  opacity: 0.4;
  pointer-events: none;
}

/* ────────────────────────────────────── */
/* Realtor Photo tab                       */
/* ────────────────────────────────────── */

.photo-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.photo-wrap + .photo-wrap { margin-top: 24px; }

.claude-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.claude-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  padding: 8px 16px;
}
.claude-edit {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 14px;
  border-radius: 4px;
  font-family: inherit;
  line-height: 1;
}
.claude-edit:hover {
  color: var(--text);
  background: #f3f4f6;
  border-color: var(--border);
}
.claude-hint {
  font-size: 12px;
  color: var(--text-secondary);
}
.photo-wrap h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}
.photo-wrap > p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 20px;
}

.photo-no-loc {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-secondary);
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.photo-no-loc .arrow { font-size: 36px; opacity: 0.4; margin-bottom: 12px; }
.photo-no-loc h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.photo-no-loc p { font-size: 14px; max-width: 480px; margin: 0 auto; }

.photo-grid {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: stretch;
}
.photo-grid > * {
  flex: 1 1 0;
  min-width: 200px;
  max-width: 280px;
}
#result-wrap:empty { display: none; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--blue);
  background: var(--blue-light);
}
.dropzone-icon { font-size: 36px; opacity: 0.5; margin-bottom: 8px; }
.dropzone-text { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.dropzone-hint { font-size: 12px; color: var(--text-secondary); }

.cropper-wrap {
  display: none;
}
.cropper-wrap.active { display: block; }
.cropper-container-wrap {
  background: #1f2937;
  border-radius: 8px;
  overflow: hidden;
  max-height: 600px;
}
.cropper-container-wrap img { display: block; max-width: 100%; }

.photo-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  font-family: inherit;
  transition: all 0.15s ease;
}
.btn:hover { background: #f9fafb; border-color: var(--text-muted); }
.btn-primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.upload-status {
  font-size: 13px;
  color: var(--text-secondary);
}
.upload-status.error { color: var(--red); font-weight: 600; }
.upload-status.success { color: var(--green); font-weight: 600; }

.current-photo {
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  align-items: stretch;
}
.current-photo img {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}
.current-photo-info { padding: 10px 4px 4px; }
.current-photo-info .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.current-photo-info .url {
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-all;
  font-family: ui-monospace, monospace;
  line-height: 1.4;
}

.preview-result {
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  align-items: stretch;
  height: 100%;
}
.preview-result img {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #a7f3d0;
  display: block;
}
.preview-result-info { padding: 10px 4px 4px; }
.preview-result-info .title {
  font-size: 13px;
  font-weight: 700;
  color: #047857;
  margin-bottom: 4px;
}
.preview-result-info .url {
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-all;
  font-family: ui-monospace, monospace;
  line-height: 1.4;
}
