/* =============================================================================
   next.css — live-app additions on top of the ported Blueprint styles
   Only what the wired shell needs that the static prototype didn't. Tokens only.
   ============================================================================= */

/* The ui_next flag gate runs in app.js; keep the shell hidden until it passes so
   an unflagged user is sent back to classic without a flash of the new design. */
html.booting body { visibility: hidden; }

/* Voice error line in the thread (fail loudly, with a way to retry). */
.msg.err {
  align-self: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--stop);
  color: var(--ink);
}
.msg.err button { margin-top: var(--s-2); }

/* Confirm cards (confirm.js): a saved card keeps its Undo line when the write
   has a real inverse; a failed save shows why, in the card. */
.confirm.saved .confirm-say { display: block; }
.confirm-say .text-btn { min-height: var(--tap); padding: 0 var(--s-1); font: inherit; font-weight: 600; }
.confirm-dismiss { color: var(--stop); }
.confirm-error {
  margin: var(--s-2) 0 var(--s-1);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-xs);
  background: var(--stop-50);
  color: var(--stop);
  font-size: var(--fs-sm);
}
.confirm-actions .btn:disabled { opacity: .55; cursor: default; }

/* Did you mean…? — the label sits above the options, so no option is styled as
   the default (moments.css highlights :first-child; here that's the label). */
.choices-q { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.choice-opt.choice-none { border-style: dashed; }
.choice-opt.choice-none b { font-weight: 500; color: var(--ink-2); }

/* Voice states (1.10): "Your turn" — the mic is open but nobody's talking. The
   bars sit still at a low, live height instead of pretending to hear speech. */
.wave[data-state="waiting"] i { background: var(--blue); height: 8px; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .wave i { animation: none !important; }
}

/* Answer cards (answers.js): a small leading icon for rows without a job thumb,
   and a note's full text (wraps, unlike a row title). */
.answer-ic { width: 32px; height: 32px; border-radius: var(--r-xs); flex: none; }
.answer-ic svg { width: 18px; height: 18px; }
.answer-note { display: block; margin-top: 2px; font-size: var(--fs-sm); color: var(--ink); white-space: normal; }
.card-more a { color: var(--blue); }

/* ─── Phase 3: Jobs tab, job + contact detail, schedule, tasks ───────────── */

/* Stage tracker with any number of stages (stages.js sets --inset = 50%/n). */
.stages-line::before { left: var(--inset, 10%); right: var(--inset, 10%); }
.stages-line .fill { left: var(--inset, 10%); }

/* JN fallback: the job's real board status, how far along, the list on tap. */
.stage-steps summary .row-main { display: grid; gap: 2px; }
.step-bar { display: block; height: 4px; margin-top: var(--s-2); border-radius: 2px; background: var(--line); overflow: hidden; }
.step-bar i { display: block; height: 100%; background: var(--blue); }
.step-list { margin: 0; padding: var(--s-1) 14px var(--s-3) 34px; font-size: var(--fs-sm); color: var(--ink-3); }
.step-list li { padding: 3px 0; }
.step-list li.done { color: var(--ink-2); }
.step-list li.now { color: var(--ink); font-weight: 600; }

/* Hero: a real photo or aerial covers the placeholder art once it loads. */
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* CompanyCam photos. */
.photos .ph { padding: 0; border: 0; background: var(--paper-2); cursor: pointer; }
.photos .ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-grid { display: grid; gap: var(--s-3); }
.photo-grid figure { margin: 0; }
.photo-grid img { display: block; width: 100%; border-radius: var(--r-sm); background: var(--paper-2); }
.photo-grid figcaption { margin-top: 4px; font-size: var(--fs-xs); color: var(--ink-3); }
.photo-grid figure.focus img { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Notes: which job (on feeds that span jobs), and "by voice" (2.5). */
.tl-job { display: block; font-weight: 600; color: var(--ink); text-decoration: none; }
.by-voice { font-weight: 600; color: var(--navy); }
.section-foot { margin: var(--s-2) 2px 0; font-size: var(--fs-xs); color: var(--ink-3); }

.task-due.due-overdue { color: var(--stop); }
.card.detail-facts { padding: 0 14px; }
.card.detail-facts a { text-decoration: none; }

/* brief_job answer card. */
.brief-next { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.brief-next svg { width: 18px; height: 18px; flex: none; color: var(--navy); }
.brief-next b { display: block; font-size: var(--fs-xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.brief-note { display: grid; gap: 2px; padding: 10px 14px; border-top: 1px solid var(--line); }

/* Screens that still live in the classic app during the rollout. */
.classic-note { display: grid; gap: var(--s-3); padding: var(--s-5); }
.classic-note p { margin: 0; color: var(--ink-2); }

/* Phase 4 — forms as confirmation (forms.js). */
.form-card .form-summary .kv { padding: 0; }
.form-card .form-summary .kv dd { white-space: pre-wrap; overflow-wrap: anywhere; }
/* A field Cory (or you) changed on an edit form — warm accent, not action blue. */
.f-input.f-changed { border-color: var(--wood); background: var(--wood-50); }
.f-say { margin: var(--s-3) 0 0; font-size: var(--fs-xs); color: var(--ink-3); text-align: center; }
.f-picker .picker-using:empty { display: none; }
.empty-row .text-btn { margin-left: 4px; }
.xrow-actions > :only-child { grid-column: 1 / -1; }

/* Sheet action buttons (from the prototype onboarding.css, not ported until
   Phase 4 — the first sheets with a pinned primary action). */
.btn-lg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 54px;
  border-radius: var(--r-pill);
  background: var(--blue);
  color: var(--ink-inv);
  font-size: var(--fs-lg);
  font-weight: 600;
  box-shadow: 0 10px 22px -10px rgba(30, 91, 255, 0.8);
  transition: background var(--t-fast), transform var(--t-fast) var(--ease);
}
.btn-lg:active { transform: scale(0.98); }
.btn-lg:disabled {
  background: var(--paper-2);
  color: var(--ink-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
  cursor: not-allowed;
}
.btn-lg:focus-visible { border-radius: var(--r-pill); }
.btn-link {
  display: block;
  width: 100%;
  min-height: var(--tap);
  margin-top: 6px;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--link);
}
.btn-link:disabled { color: var(--ink-3); }

/* Phase 5 — Company screen (company.js). */
.logo-preview { width: 96px; height: 96px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.logo-preview img, .logo-box img { object-fit: contain; }
.invite-row { flex-wrap: wrap; }
.invite-acts { display: flex; gap: 6px; margin-left: auto; }
.set-card > .text-btn { min-height: var(--tap); }
.logo-row .row-sub { white-space: normal; }

/* Phase 6 — Reports + Estimates builders (builders.js). The prototype kept
   .bar / .spin in onboarding.css, which isn't ported (email.js's summarizing
   spinner was invisible until now). */
.bar { height: 6px; margin: 10px 0 6px; border-radius: var(--r-pill); background: var(--paper-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--go); transition: width 500ms var(--ease); }
.spin {
  display: inline-block;
  width: 18px; height: 18px;
  flex: none;
  vertical-align: -3px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pick-ph { padding: 0; border: 0; background: var(--paper-2); cursor: pointer; }
.pick-ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pick-ph[aria-pressed="false"] > img { opacity: 0.55; }
.rb-photos .ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rb-photo-notes summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: var(--tap); cursor: pointer; list-style: none; }
.rb-photo-notes summary::-webkit-details-marker { display: none; }
.rb-photo-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; }
.rb-photo-row .ph { width: 64px; height: 64px; flex: none; border-radius: 8px; overflow: hidden; background: var(--paper-2); }
.rb-photo-row .ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rb-photo-row textarea { flex: 1; min-width: 0; }
.builder-err { margin: 0; font-size: var(--fs-sm); }
.eb-export-note { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.builder-actions .xrow-actions { margin-top: 0; }
.takeoff .row-sub:empty { display: none; }
/* Links styled as buttons (Open PDF, Review scope): centre like <button>s do. */
a.btn, a.btn-link { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.xrow-body > .btn-link { margin-top: 0; }
.rb-pinned { display: grid; gap: 8px; }
.rb-pinned > .f-hint { margin: 0; text-align: center; }
.takeoff .row-title { white-space: normal; }

/* Phase 7 — first-run setup (onboarding.js). The prototype's "tell Cory" box was
   a scripted mic; live it's a sentence box (the keyboard's dictation mic works
   there) sent to /api/setup/classify. */
.tell-text { align-items: stretch; }
.tell-text .tell-main { flex: 1; }
.tell-text textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--surface);
  font: inherit;
  font-size: var(--fs-md);
  color: var(--ink);
  resize: vertical;
}
.tell-text textarea:focus { outline: none; border-color: var(--navy); box-shadow: var(--focus-ring); }
.tell-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: var(--fs-xs); color: var(--ink-3); }
.tell-foot .btn { flex: none; min-height: var(--tap); }
.tell-foot .spin { width: 14px; height: 14px; border-width: 2px; margin-right: 6px; }
.ob-error { margin-top: 14px; align-items: flex-start; }
.ob-error svg { margin-top: 3px; }
.ob-note span { flex: 1; }
.ob-steps { margin: 14px 0 0; padding-left: 20px; display: grid; gap: 10px; color: var(--ink-2); font-size: var(--fs-sm); }
.ob-steps b { color: var(--ink); }
.onboarding .orb-slot, .onboarding .voice, .onboarding .scrim { display: none; }
