/* Griffin Business Application — app.css
   Layout, rail, banner, sidebar, form fields, repeating rows, mobile (<720px). */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); color: var(--navy); margin: 0 0 0.4em; }
a { color: var(--navy); }
button { font-family: inherit; }

.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;
}

/* ---------- Top brand bar ---------- */
.topbar {
  background: var(--navy-deep);
  color: #fff;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: 0.01em;
}
.topbar .wordmark small {
  display: block;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.68rem;
  color: var(--line-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topbar .agency-link { color: var(--line-2); font-size: 0.85rem; text-decoration: none; }
.topbar .agency-link:hover { color: #fff; text-decoration: underline; }

/* ---------- Amwins-style helper banner ---------- */
.helper-banner {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 1.25rem;
  font-size: 0.92rem;
  text-align: center;
}
.helper-banner strong { font-weight: 700; }

/* ---------- App shell ---------- */
.app-shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.75rem;
  align-items: start;
}

/* ---------- Rail ---------- */
.rail { list-style: none; margin: 0; padding: 0; }
.rail-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
  font-size: 0.92rem;
  color: var(--ink);
  min-height: 44px;
}
.rail-step:hover { background: var(--paper); }
.rail-step .dot {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--line-2);
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: transparent;
}
.rail-step.is-current { background: var(--paper); box-shadow: var(--shadow); font-weight: 600; }
.rail-step.is-current .dot { border-color: var(--navy); background: var(--navy); box-shadow: 0 0 0 3px rgba(10,34,64,0.15); }
.rail-step.is-outstanding .dot { border-color: #c0392b; }
.rail-step.is-outstanding .dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #c0392b; }
.rail-step.is-complete .dot { border-color: var(--green); background: var(--green); color: #fff; }
.rail-step.is-complete .dot::after { content: "✓"; font-size: 0.7rem; color: #fff; }

/* ---------- Step 4 ("Line details") nested sub-page list ---------- */
.rail-sub { list-style: none; margin: 0.2rem 0 0.5rem 1.4rem; padding: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.rail-substep {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.6rem; border-radius: 8px; border: 1px solid transparent;
  background: transparent; width: 100%; text-align: left;
  font-size: 0.82rem; color: var(--muted); cursor: pointer; min-height: 36px;
}
.rail-substep:hover { background: var(--paper); }
.rail-substep .dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line-2); flex: 0 0 auto;
}
.rail-substep.is-current { background: var(--paper); font-weight: 600; color: var(--ink); }
.rail-substep.is-current .dot { border-color: var(--navy); background: var(--navy); }
.rail-substep.is-complete .dot { border-color: var(--green); background: var(--green); }
.rail-substep.is-outstanding .dot { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192,57,57,0.18); }

.sidebar-card {
  margin-top: 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.sidebar-card h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.6rem; }
.sidebar-card dl { margin: 0; }
.sidebar-card dt { font-size: 0.72rem; color: var(--muted); margin-top: 0.5rem; }
.sidebar-card dd { margin: 0; font-size: 0.92rem; }

/* ---------- Main panel ---------- */
.main-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  min-height: 420px;
}
.step-title { margin-bottom: 0.25rem; }
.step-sub { color: var(--muted); margin-bottom: 1.5rem; }

.section-block { margin-bottom: 2rem; }
.section-block h3 { font-size: 1.05rem; border-bottom: 1px solid var(--line); padding-bottom: 0.4rem; margin-bottom: 1rem; }

.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.25rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 1rem; }
.field.span-2 { grid-column: 1 / -1; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--navy); }
.field .help-text { font-size: 0.78rem; color: var(--muted); }
.field input[type=text], .field input[type=email], .field input[type=tel],
.field input[type=number], .field input[type=date], .field select,
.field textarea {
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  font-size: 0.95rem;
  font-family: inherit;
  min-height: 44px;
  background: var(--paper);
  color: var(--ink);
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
.field.required > label::after { content: " *"; color: #c0392b; }
/* Soft-required and optional fields show NO marker text at all (2026-09-27
   polish pass, Fable ruling #2) — only a hard-required field gets the red
   asterisk above. Soft fields are surfaced instead via the outstanding-
   questions list on step 6. */

.yesno-row { display: flex; gap: 0.75rem; }
.yesno-row button {
  flex: 1; min-height: 44px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--paper); cursor: pointer; font-weight: 600; font-size: 0.9rem;
}
.yesno-row button.is-selected { background: var(--navy); color: #fff; border-color: var(--navy); }

.multi-choice { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.multi-choice label {
  display: flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--line-2); border-radius: 999px; padding: 0.45rem 0.9rem;
  font-size: 0.86rem; font-weight: 500; cursor: pointer; min-height: 44px;
}
.multi-choice input:checked + span { font-weight: 700; }
.multi-choice label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }

.prefill-note {
  font-size: 0.74rem; color: var(--green); margin-top: 0.15rem;
}
.prefill-note.is-typed { color: var(--muted); }

/* ---------- Industry search ---------- */
.combo-wrap { position: relative; }
.combo-list {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 260px; overflow-y: auto; background: var(--paper);
  border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow-lg);
  margin: 0; padding: 0.25rem; list-style: none;
}
.combo-list li { padding: 0.5rem 0.6rem; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.combo-list li:hover, .combo-list li.is-active { background: var(--accent-soft); }
.combo-list .group-label { font-size: 0.7rem; text-transform: uppercase; color: var(--muted); padding: 0.4rem 0.6rem 0.1rem; }

/* ---------- Places autocomplete dropdown lives in browser chrome via .pac-container (Google's own class) ---------- */

/* ---------- Building card ---------- */
.building-card {
  border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 10px;
  padding: 1rem; margin: 1rem 0;
}
.building-card h4 { margin: 0 0 0.5rem; color: var(--accent-ink); }
.building-card .facts { display: grid; grid-template-columns: repeat(2,1fr); gap: 0.4rem 1rem; font-size: 0.88rem; margin-bottom: 0.8rem; }
.building-card .actions { display: flex; gap: 0.6rem; }

/* ---------- Repeating sections ---------- */
.repeating-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }
.repeating-row {
  border: 1px solid var(--line); border-radius: 10px; padding: 1rem; position: relative; background: var(--cream);
}
.repeating-row .row-title { font-weight: 700; margin-bottom: 0.6rem; color: var(--navy); }
.repeating-row .remove-row {
  position: absolute; top: 0.6rem; right: 0.6rem; background: none; border: none;
  color: #c0392b; cursor: pointer; font-size: 0.82rem; min-height: 32px;
}
.repeating-row .vin-decode { display: flex; gap: 0.5rem; align-items: flex-end; }
.repeating-row .vin-decode .field { flex: 1; margin-bottom: 0; }
.add-row-btn {
  align-self: flex-start; background: var(--paper); border: 1px dashed var(--accent);
  color: var(--accent-2); border-radius: 8px; padding: 0.55rem 1rem; cursor: pointer;
  font-weight: 600; min-height: 44px;
}

/* ---------- Underwriting grid ---------- */
.uw-toolbar { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.privacy-notice { font-size: 0.82rem; color: var(--muted); margin-top: 1.5rem; line-height: 1.45; }
.privacy-notice a { color: inherit; text-decoration: underline; }
.uw-defaulted-notice { color: var(--green); font-size: 0.86rem; text-align: right; margin: -0.5rem 0 1rem; }
.uw-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.uw-row .uw-label { font-size: 0.92rem; }
.explain-box { margin-top: 0.5rem; }

/* ---------- Outstanding list ---------- */
.outstanding-list { list-style: none; margin: 0; padding: 0; }
.outstanding-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.outstanding-list a { font-size: 0.92rem; }
.outstanding-empty { color: var(--green); font-weight: 600; }

/* ---------- Buttons / nav ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.7rem 1.3rem; border-radius: 999px; font-weight: 600; font-size: 0.92rem;
  border: 1px solid transparent; cursor: pointer; min-height: 44px;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px rgba(200,155,60,.32); }
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: transparent; border: 1.5px solid var(--navy); color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: var(--line-2); }

.step-nav { display: flex; justify-content: space-between; margin-top: 2rem; gap: 0.75rem; flex-wrap: wrap; }
.step-nav .left, .step-nav .right { display: flex; gap: 0.75rem; }

.autosave-status { font-size: 0.78rem; color: var(--muted); margin-top: 0.75rem; min-height: 1.1em; }

/* ---------- Start screen ---------- */
.start-screen { max-width: 640px; margin: 3rem auto; text-align: center; padding: 0 1.25rem; }
.start-screen p { color: var(--muted); }

/* ---------- Save & Exit modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6,24,47,0.55); display: flex;
  align-items: center; justify-content: center; z-index: 100; padding: 1rem;
}
.modal {
  background: var(--paper); border-radius: var(--radius); padding: 1.5rem; max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal h3 { margin-bottom: 0.75rem; }
.modal .field { margin-bottom: 0.9rem; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }

/* ---------- Agency dashboard ---------- */
.agency-shell { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.agency-table { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.agency-table th, .agency-table td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.agency-table th { background: var(--cream); font-size: 0.75rem; text-transform: uppercase; color: var(--muted); }
.status-pill { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.status-pill.draft { background: var(--accent-soft); color: var(--accent-ink); }
.status-pill.submitted { background: #e3f5ec; color: #1f7a4d; }
.status-pill.expired { background: #f3e3e3; color: #8a2c2c; }

/* ---------- Mobile (<720px) ---------- */
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; padding: 1rem 0.85rem 3rem; gap: 1rem; }
  .rail { display: none; }
  .rail.is-open { display: block; }
  .mobile-rail-toggle {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
    padding: 0.75rem 1rem; font-weight: 600; cursor: pointer; min-height: 44px; width: 100%;
  }
  .field-grid { grid-template-columns: 1fr; }
  .main-panel { padding: 1.1rem; }
  .step-nav { flex-direction: column-reverse; }
  .step-nav .left, .step-nav .right { width: 100%; }
  .step-nav .left button, .step-nav .right button { flex: 1; }
  .building-card .facts { grid-template-columns: 1fr; }
}
.mobile-rail-toggle { display: none; }
@media (max-width: 720px) {
  .mobile-rail-toggle { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* 2026-09-30: required-field gating */
.required-error { color: #c0392b; font-weight: 600; margin: 0.5rem 0 1rem; }
.field.is-missing > label { color: #c0392b; }
.field.is-missing input, .field.is-missing select, .field.is-missing textarea,
.field.is-missing .yesno-row button, .field.is-missing .multi-choice label,
.field.is-missing .combo-wrap input { border-color: #c0392b; }

/* Google address search suggestions (step 3) */
.addr-search { position: relative; }
[data-address-id] input[data-addr="line1"] { width: 100%; box-sizing: border-box; }
.addr-suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  list-style: none; margin: 0; padding: 0.25rem 0;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 260px; overflow-y: auto;
}
.addr-suggestions li { padding: 0.6rem 0.85rem; cursor: pointer; font-size: 0.95rem; color: var(--ink); }
.addr-suggestions li:hover, .addr-suggestions li.active { background: var(--accent-soft); }
