/* NovaFlow Inquiry Assistant — brand styles */
:root {
  --nf-indigo: #4F46E5;
  --nf-cyan: #06B6D4;
  --nf-gradient: linear-gradient(135deg, var(--nf-indigo), var(--nf-cyan));

  --bg: #F4F6FB;
  --surface: #FFFFFF;
  --surface-2: #F8FAFD;
  --border: #E3E8F2;
  --text: #0E1A36;
  --muted: #5F6B85;
  --accent: var(--nf-indigo);
  --accent-soft: #EEF0FF;

  --ok: #0F9D6E;      --ok-soft: #E3F7EF;
  --warn: #B26A00;    --warn-soft: #FFF3DC;
  --bad: #C2334D;     --bad-soft: #FDE8EC;

  --hl-company: #C7D2FE;
  --hl-contactName: #BAE6FD;
  --hl-email: #DDD6FE;
  --hl-service: #A7F3D0;
  --hl-deadline: #FDE68A;
  --hl-budget: #FBCFE8;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(14, 26, 54, .04), 0 8px 24px rgba(14, 26, 54, .06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A1022;
    --surface: #111A33;
    --surface-2: #0D1529;
    --border: #22304F;
    --text: #E8ECF7;
    --muted: #93A0BD;
    --accent: #818CF8;
    --accent-soft: #1C2350;
    --ok: #34D399;   --ok-soft: #0E2E25;
    --warn: #FBBF24; --warn-soft: #33270B;
    --bad: #F87171;  --bad-soft: #3A1620;
    --hl-company: #3730A3;
    --hl-contactName: #075985;
    --hl-email: #5B21B6;
    --hl-service: #065F46;
    --hl-deadline: #854D0E;
    --hl-budget: #9D174D;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.section-title, .review-card, .input-panel { scroll-margin-top: 84px; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h2, h3 { margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; font-weight: 400; }
a { color: var(--accent); }
kbd {
  font-family: inherit; font-size: 11px; padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--surface-2);
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 36px; height: 36px; flex: none; }
.brand-name {
  font-size: 18px; font-weight: 750; letter-spacing: -.02em;
  background: var(--nf-gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: 12px; color: var(--muted); margin-top: -2px; }
.topbar-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.pill { font-size: 11px; font-weight: 650; padding: 3px 9px; border-radius: 999px; }
.pill-demo { background: var(--accent-soft); color: var(--accent); }
.offline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.offline.is-external .dot-live { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.reply-check { display: block; margin-top: 2px; }
.reply-check.has-errors { color: var(--bad); }
.reply-check.has-warnings { color: var(--warn); }

/* ---------- layout ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 270px minmax(320px, 1fr) minmax(380px, 1.25fr);
  gap: 18px;
  padding: 18px 24px;
  align-items: start;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 14px; }

/* ---------- inbox ---------- */
.inbox-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.inbox-item {
  width: 100%; text-align: left; font: inherit; color: inherit;
  border: 1px solid transparent; background: transparent;
  border-radius: 10px; padding: 10px 12px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.inbox-item:hover { background: var(--surface-2); }
.inbox-item.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.inbox-top { display: flex; justify-content: space-between; gap: 8px; }
.inbox-from { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-time { font-size: 11px; color: var(--muted); flex: none; }
.inbox-subject { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-preview { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- input ---------- */
textarea, input[type="text"] {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea:focus, input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#inquiryText { min-height: 260px; resize: vertical; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.input-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 12px; }
.hint { margin: 8px 0 0; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-weight: 600; font-size: 13px;
  border-radius: 10px; padding: 9px 16px; cursor: pointer;
  border: 1px solid transparent; transition: transform .1s, opacity .15s, background .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--nf-gradient); color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, .3); }
.btn-primary:hover:not(:disabled) { opacity: .92; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); padding: 7px 12px; }
.btn-ghost:hover { background: var(--surface-2); }

/* progress */
.progress { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.progress li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.progress li::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid var(--border);
}
.progress li.running { color: var(--text); }
.progress li.running::before { border-color: var(--accent); border-top-color: transparent; animation: spin .7s linear infinite; }
.progress li.done { color: var(--text); }
.progress li.done::before {
  border-color: var(--ok); background: var(--ok)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* highlighted inquiry */
.highlight-wrap { margin-top: 20px; }
.highlighted {
  margin-top: 10px; padding: 14px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--border); white-space: pre-wrap; word-wrap: break-word; font-size: 13px; line-height: 1.65;
}
.highlighted mark { color: inherit; border-radius: 4px; padding: 1px 3px; }
.hl-company { background: var(--hl-company); }
.hl-contactName, .hl-role { background: var(--hl-contactName); }
.hl-email, .hl-phone { background: var(--hl-email); }
.hl-service { background: var(--hl-service); }
.hl-deadline { background: var(--hl-deadline); }
.hl-budget { background: var(--hl-budget); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- results ---------- */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.empty-icon svg { width: 34px; height: 34px; }
.empty-state p { max-width: 320px; margin: 8px auto 0; }

.summary {
  display: flex; align-items: center; gap: 18px; padding: 16px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
}
.ring-wrap { position: relative; width: 76px; height: 76px; flex: none; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring-bg { stroke: var(--border); }
.ring-fg { stroke: url(#nfGrad); stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s ease, stroke .3s; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring-label strong { font-size: 17px; }
.ring-label span { font-size: 10px; color: var(--muted); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11.5px; font-weight: 650; padding: 3px 10px; border-radius: 999px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-neutral { background: var(--accent-soft); color: var(--accent); }
.summary-line { margin-top: 8px; font-size: 13px; color: var(--muted); }
.summary-line strong { color: var(--text); }

.summary-why { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 8px; font-size: 11.5px; color: var(--muted); align-items: center; }
.why { padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.why-up { background: var(--ok-soft); color: var(--ok); }
.why-down { background: var(--bad-soft); color: var(--bad); }
.ring-wrap { cursor: help; }

.section-title { margin: 22px 0 10px; }
.fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 9px;
  background: var(--surface); transition: border-color .2s, background .2s;
}
.field-card.wide { grid-column: 1 / -1; }
.field-card.is-missing { border-style: dashed; border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); background: color-mix(in srgb, var(--bad-soft) 40%, var(--surface)); }
.field-card.is-low { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.field-top { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field-top .swatch { width: 8px; height: 8px; border-radius: 2px; }
.field-top .req { margin-left: auto; font-size: 10px; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--muted); }
.field-card input[type="text"] {
  background: transparent; border: 1px solid transparent; padding: 4px 6px; margin: 3px -6px 2px; width: calc(100% + 12px);
  font-size: 14px; font-weight: 600; border-radius: 6px;
}
.field-card input[type="text"]:hover { border-color: var(--border); }
.field-card input::placeholder { color: var(--muted); font-weight: 500; opacity: .8; }
.field-card.is-missing input::placeholder { color: var(--bad); }
.field-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); min-height: 16px; }
.conf { width: 46px; height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; flex: none; }
.conf span { display: block; height: 100%; background: var(--ok); border-radius: 4px; }
.is-low .conf span { background: var(--warn); }
.field-meta .src { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.missing-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.missing-list li {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.sev { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex: none; margin-top: 1px; }
.sev-required { background: var(--bad-soft); color: var(--bad); }
.sev-recommended { background: var(--accent-soft); color: var(--accent); }
.sev-verify { background: var(--warn-soft); color: var(--warn); }
.missing-list .m-label { font-weight: 600; }
.missing-list .m-q { font-size: 12px; color: var(--muted); }
.all-good {
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 10px;
  background: var(--ok-soft); color: var(--ok); font-weight: 600;
}
.notes { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
.notes li { font-size: 12.5px; color: var(--muted); padding-left: 18px; position: relative; }
.notes li::before { content: "ⓘ"; position: absolute; left: 0; color: var(--accent); }

.reply-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.head-actions { display: flex; align-items: center; gap: 8px; }

/* Inbox / History */
.segmented.view-tabs { margin-top: 0; width: 100%; }
.segmented.view-tabs button { flex: 1; }
.tab-count { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.view-note { margin: -4px 0 10px; }
.inbox-tools { display: flex; gap: 6px; margin-bottom: 10px; }
.inbox-tools select { flex: 1; min-width: 0; font: inherit; font-size: 12.5px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.inbox-tools .btn { padding: 6px 10px; font-size: 12px; }
.history-search, .history-filters select, .status-select {
  width: 100%; font: inherit; font-size: 12.5px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; outline: none;
}
.history-search:focus, .history-filters select:focus, .status-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.history-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0 10px; }
.inbox-meta { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.mini-pill { font-size: 10px; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.mini-pill.st-new { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.mini-pill.st-in_review { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.mini-pill.st-replied { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.mini-pill.pr-High { color: var(--bad); }
.history-bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.history-bar .status-select { width: auto; padding: 4px 8px; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }

/* Parts profile (Elcar demo) */
.review-banner {
  display: flex; flex-direction: column; gap: 2px; margin: 0 0 10px; padding: 10px 14px; border-radius: 10px;
  background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); font-size: 12.5px;
}
.review-banner strong { color: var(--warn); font-size: 13px; }
.missing-group { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); }

/* Confirmation dialog (replaces the browser's confirm() window) */
.confirm-dialog {
  width: min(420px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(14, 26, 54, .25);
}
.confirm-dialog::backdrop { background: rgba(10, 16, 34, .45); }
.confirm-dialog h2 { font-size: 16px; margin-bottom: 8px; }
.confirm-dialog p { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; white-space: pre-line; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.confirm-dialog .btn-primary.is-danger { background: var(--bad); box-shadow: none; }

/* Draft versions */
.versions-dialog { width: min(820px, calc(100vw - 32px)); }
.versions-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.versions-head h2 { margin: 0; }
.versions-body { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 14px; }
.versions-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 60vh; overflow: auto; align-content: start; }
.version-item { width: 100%; text-align: left; font: inherit; color: inherit; background: transparent; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.version-item:hover { background: var(--surface-2); }
.version-item.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.version-item strong { font-size: 13px; }
.version-item .small { display: block; }
.version-preview { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.version-subject { font-weight: 600; font-size: 13.5px; }
.version-text { margin: 0; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); white-space: pre-wrap; word-wrap: break-word; font: inherit; font-size: 13px; line-height: 1.55; max-height: 46vh; overflow: auto; }
.version-preview .confirm-actions { align-items: center; margin-top: 4px; }
.version-preview .confirm-actions .muted { margin-right: auto; }
.mini-pill.st-approved { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.mini-pill.st-sent_manually { color: var(--muted); background: var(--surface-2); }
#replyBody[readonly], #replySubject[readonly], #replyTo[readonly] { opacity: .75; cursor: default; }
@media (max-width: 760px) {
  .versions-body { grid-template-columns: minmax(0, 1fr); }
  .versions-list { max-height: 20vh; }
  .version-text { max-height: 30vh; }
}
.segmented.mode-toggle { margin-top: 0; }
.segmented button:disabled { opacity: .45; cursor: not-allowed; }
.mode-hint { margin: 6px 0 0; padding-left: 18px; position: relative; color: var(--muted); }
.mode-hint::before { content: ""; position: absolute; left: 4px; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.mode-hint.is-ai::before { background: var(--accent); }
.mode-hint.is-paid::before { background: var(--warn); }
.mode-hint.is-error { color: var(--bad); }
.mode-hint.is-error::before { background: var(--bad); }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); margin-top: 12px; }
.segmented button {
  font: inherit; font-size: 12px; font-weight: 600; border: 0; background: transparent; color: var(--muted);
  padding: 5px 12px; border-radius: 7px; cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(14, 26, 54, .12); }
.reply-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.reply-row { display: flex; align-items: center; border-bottom: 1px solid var(--border); padding: 0 12px; }
.reply-row span { width: 62px; flex: none; font-size: 12px; color: var(--muted); }
.reply-row input[type="text"] { border: 0; background: transparent; padding: 10px 0; border-radius: 0; box-shadow: none; }
#replyBody { border: 0; border-radius: 0; background: var(--surface); min-height: 240px; resize: vertical; line-height: 1.6; padding: 14px; box-shadow: none; }
.reply-actions { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
.reply-actions .muted { margin-right: auto; }

.footer { text-align: center; padding: 6px 24px 22px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 13px;
  transition: opacity .2s, transform .2s; pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px); text-align: center; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ================= Universal demo: start screen, navigation, review ================= */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.brand { text-decoration: none; color: inherit; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 12px 22px; font-size: 14.5px; text-decoration: none; }
a.btn-ghost { color: var(--text); }
.pill-demo { background: var(--nf-gradient); color: #fff; letter-spacing: .02em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.home { max-width: 1180px; margin: 0 auto; padding: 36px 24px 12px; width: 100%; }
.hero { text-align: center; max-width: 780px; margin: 0 auto; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 650; color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; }
.hero h1 { font-size: clamp(26px, 4vw, 40px); line-height: 1.15; letter-spacing: -.025em; margin: 16px 0 12px; }
.hero-sub { font-size: 16px; color: var(--muted); margin: 0 auto; max-width: 660px; }
.hero-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

.flow { list-style: none; padding: 0; margin: 34px 0 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; counter-reset: flow; }
.flow li {
  position: relative; display: flex; flex-direction: column; gap: 3px; padding: 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 12.5px;
}
.flow li span:last-child { color: var(--muted); }
.flow li:last-child { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: color-mix(in srgb, var(--warn-soft) 45%, var(--surface)); }
.flow-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--nf-gradient); color: #fff; font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.flow strong { font-size: 13px; }

.section-head { margin: 38px 0 14px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 20px; }
.section-head p { margin: 0; }
.industry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.industry-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.ic-head {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; font: inherit; color: inherit;
  background: transparent; border: 0; padding: 18px 18px 14px; cursor: pointer;
}
.ic-head:hover .ic-arrow { transform: translateX(3px); color: var(--accent); }
.ic-head strong { display: block; font-size: 15.5px; }
.ic-head .small { display: block; margin-top: 2px; }
.ic-arrow { margin-left: auto; font-size: 18px; color: var(--muted); transition: transform .15s, color .15s; }
.ic-icon { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.ic-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic-list { list-style: none; margin: 0; padding: 0 10px 12px; display: grid; gap: 4px; }
.ic-list button {
  width: 100%; text-align: left; font: inherit; color: inherit; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; cursor: pointer; display: grid; gap: 2px; transition: border-color .15s, background .15s;
}
.ic-list button:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); }
.ic-subject { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.honesty { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 28px 0 10px; }
.honesty > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.honesty h3 { font-size: 14px; margin-bottom: 6px; }
.honesty ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; display: grid; gap: 3px; }
.honesty > div:first-child h3 { color: var(--ok); }
.honesty > div:last-child h3 { color: var(--warn); }

.workspace { width: 100%; }
.ws-head { display: flex; align-items: center; gap: 12px; padding: 14px 24px 0; }
.industry-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.industry-tabs::-webkit-scrollbar { display: none; }
.ind-tab {
  display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px 6px 7px; cursor: pointer; white-space: nowrap;
}
.ind-tab .ic-icon { width: 26px; height: 26px; border-radius: 8px; }
.ind-tab .ic-icon svg { width: 16px; height: 16px; }
.ind-tab:hover { color: var(--text); }
.ind-tab.active { color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); background: var(--accent-soft); }

.stepper { list-style: none; margin: 12px 24px 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.stepper button {
  width: 100%; display: flex; align-items: center; gap: 8px; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 10px; cursor: pointer; white-space: nowrap;
}
.st-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--border); flex: none; }
.stepper .done button { color: var(--text); }
.stepper .done .st-dot { background: var(--ok); border-color: var(--ok); }
.stepper .warn button { color: var(--text); }
.stepper .warn .st-dot { background: var(--warn); border-color: var(--warn); }
.stepper .active button { color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.stepper .active .st-dot { border-color: var(--accent); background: var(--accent-soft); animation: pulse 1.6s ease-in-out infinite; }
.stepper .running .st-dot { border-color: var(--accent); border-top-color: transparent; animation: spin .7s linear infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px var(--accent-soft); } }

.mail-head { display: grid; gap: 2px; font-size: 12.5px; margin-bottom: 10px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.mail-head > div { display: flex; gap: 8px; min-width: 0; }
.mail-head > div > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-label { width: 64px; flex: none; color: var(--muted); }
.engine-note { display: flex; gap: 8px; margin: 10px 0 0; color: var(--muted); }
.dot-rule { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; margin-top: .5em; }
.hl-role { background: var(--hl-contactName); }

.mini-pill.st-ready { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.mini-pill.st-clarify { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.field-card.is-optional-missing { border-style: dashed; }
.field-card.is-optional-missing input::placeholder { color: var(--muted); }

.review-card {
  margin-top: 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--border));
  background: color-mix(in srgb, var(--warn-soft) 50%, var(--surface));
}
.review-card.is-approved { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); background: color-mix(in srgb, var(--ok-soft) 55%, var(--surface)); }
.review-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.review-top strong { font-size: 14px; margin-right: 8px; }
.review-state { font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.review-state.is-approved { background: var(--ok-soft); color: var(--ok); }
.review-checks { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 3px; font-size: 12.5px; }
.review-checks .ok { color: var(--text); }
.review-checks .bad { color: var(--bad); font-weight: 600; }
.review-foot { margin: 8px 0 0; }
.about-dialog { width: min(560px, calc(100vw - 32px)); }
.about-dialog p { white-space: normal; }

.lang-switch { margin-top: 0; }
.lang-switch button { padding: 4px 9px; font-size: 11.5px; letter-spacing: .03em; }
.hero-engine { display: inline-flex; gap: 8px; align-items: flex-start; text-align: left; margin: 18px auto 0; color: var(--muted); max-width: 620px; }
.estimate-note { margin: 8px 2px 0; color: var(--muted); display: flex; gap: 6px; }
.estimate-note > span:first-child { color: var(--accent); }
.field-top { align-items: flex-start; }
.field-top .swatch { margin-top: 4px; flex: none; }
.field-top .f-label { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.field-top .req { flex: none; padding-left: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .results-panel { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stepper { display: flex; overflow-x: auto; scrollbar-width: none; }
  .stepper::-webkit-scrollbar { display: none; }
  .stepper li { flex: none; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; gap: 12px; }
  .topbar { padding: 10px 16px; gap: 8px; }
  .offline, #aboutBtn { display: none; }
  .brand-sub { font-size: 11px; white-space: nowrap; }
  .logo { width: 32px; height: 32px; }
  /* Two rows on phones: brand + language, then the demo badge + reset. */
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; position: static; }
  .topbar-meta { display: contents; }
  .lang-switch { order: 1; justify-self: end; }
  .pill-demo { order: 2; justify-self: start; align-self: center; }
  #resetBtn { order: 3; justify-self: end; }
  .pill-demo { font-size: 10px; padding: 3px 8px; white-space: nowrap; }
  #resetBtn { padding: 5px 9px; font-size: 12px; white-space: nowrap; }
  .lang-switch button { padding: 3px 7px; }
  .flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .flow li > span:last-child { display: none; }
  .flow strong { font-size: 11.5px; line-height: 1.25; }
  .hero h1 { margin-top: 12px; }
  .eyebrow { display: none; }
  .fields-grid { grid-template-columns: minmax(0, 1fr); }
  .summary { flex-direction: column; align-items: flex-start; }
  .home { padding: 22px 16px 8px; }
  .hero-sub { font-size: 14.5px; }
  .flow { gap: 6px; margin-top: 22px; }
  .flow li { padding: 11px; }
  .industry-grid, .honesty { grid-template-columns: minmax(0, 1fr); }
  .ws-head { padding: 10px 16px 0; }
  .ws-head #backBtn { flex: none; }
  .stepper { margin: 10px 16px 0; }
  .panel { padding: 14px; }
  #inquiryText { min-height: 200px; }
  .reply-actions { flex-wrap: wrap; }
  .reply-actions .muted { flex-basis: 100%; }
  .inbox-list { max-height: 290px; overflow-y: auto; }
}
@media (max-width: 420px) {
  .ind-tab span:last-child { display: none; }
  .ind-tab { padding: 5px; }
  .ind-tab.active span:last-child { display: inline; }
  .ind-tab.active { padding-right: 10px; }
}
