/* Walkthrough editor (spec v3 W7, W15): stepper, steps, items, finding sheet. Mobile first (360–430 px). */

/* ---------------------------------------------------------------- stepper */

.wt-sticky { padding-top: 6px; padding-bottom: 6px; box-shadow: 0 1px 0 var(--border); }
.wt-stepper {
  overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  scroll-padding: 0 16px;
}
.wt-stepper::-webkit-scrollbar { display: none; }
.wt-steps { list-style: none; display: flex; gap: 8px; width: max-content; margin: 0; padding: 2px 0; }
.wt-step {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 5px 12px 5px 5px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 0.9rem; white-space: nowrap; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.wt-step-num {
  position: relative; width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #eef1f5; color: var(--text); font-size: 0.82rem; font-weight: 800;
}
.wt-step-num svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.wt-step:not(.wt-step-wrap) .wt-step-num svg { display: none; }
.wt-step.is-done .wt-step-num { background: var(--ok); color: #fff; }
.wt-step.is-done .wt-step-num svg { display: block; }
.wt-step.is-done .wt-step-n { display: none; }
.wt-step-title { max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.wt-step-count { color: var(--muted); font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.wt-step.is-current { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.wt-step-wrap .wt-step-num { background: #1b2430; color: #fff; }
.wt-step-count-word { font-weight: 600; }

/* ---------------------------------------------------------------- steps */

.wt-section { margin: 22px 0 30px; scroll-margin-top: 124px; }
.wt-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.wt-num {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 1.05rem;
  transition: background-color 0.2s;
}
.wt-num svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.wt-section.is-done .wt-num { background: var(--ok); }
.wt-num-wrap, .wt-section.is-done .wt-num-wrap { background: #1b2430; }
.wt-head-main { flex: 1; min-width: 0; }
.wt-kicker { color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.wt-title { margin: 0; font-size: 1.2rem; overflow-wrap: anywhere; }
.wt-prog {
  flex: none; padding: 4px 11px; border-radius: 999px; background: #eef1f5;
  font-size: 0.85rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.wt-section.is-done .wt-prog { background: #dcf1e5; color: var(--ok); }

.wt-body { padding: 0; overflow: hidden; }
.wt-instructions {
  display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: #f2f6fb; color: #253545; font-size: 0.95rem;
}
.wt-instructions:last-child { border-bottom: 0; }
.wt-instructions svg {
  width: 20px; height: 20px; flex: none; margin-top: 1px;
  fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.wt-left { margin: 0; padding: 10px 16px; border-top: 1px solid var(--border); background: #fdf6ea; color: #8a5300; font-size: 0.85rem; font-weight: 700; }

/* ---------------------------------------------------------------- items */

.wt-items { list-style: none; margin: 0; padding: 0; }
.wt-item { padding: 14px 16px; border-bottom: 1px solid var(--border); scroll-margin-top: 130px; }
.wt-item:last-child { border-bottom: 0; }
.wt-item-head { display: flex; align-items: flex-start; gap: 10px; }
.wt-item-main { flex: 1; min-width: 0; }
.wt-mark {
  position: relative; width: 22px; height: 22px; flex: none; margin-top: 1px;
  border: 2px solid #c3ccd6; border-radius: 50%; transition: background-color 0.15s, border-color 0.15s;
}
.wt-item.is-done .wt-mark { background: var(--ok); border-color: var(--ok); }
.wt-item.is-done .wt-mark::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.wt-label { display: inline; margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.field .wt-label, label.wt-label { display: inline; margin: 0; font-size: 1rem; }
.wt-req {
  display: inline-block; padding: 0 7px; border-radius: 999px; background: #fdf0dc; color: #8a5300;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em; line-height: 1.7; text-transform: uppercase; vertical-align: 2px;
}
.wt-item.is-done .wt-req { background: #eef1f5; color: var(--muted); }
.wt-help { margin: 2px 0 0; color: var(--muted); font-size: 0.85rem; }
.wt-count {
  flex: none; padding: 2px 9px; border-radius: 999px; background: #eef1f5;
  font-size: 0.8rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.wt-item.is-done .wt-count { background: #dcf1e5; color: var(--ok); }
.wt-item .saved-indicator { flex: none; }

/* Everything under an item's label lines up with the label, not the round mark. */
.wt-photo > .photo-grid, .wt-q-form > .pills, .wt-q-form > input, .wt-q-form > select,
.wt-q-form > .form-status, .wt-check > form, .wt-check > .wt-flink, .wt-check > .wt-add-issue { margin-left: 32px; }

.wt-photo .photo-grid { margin: 10px 0 0 32px; }
.wt-photo .camera-row { margin-top: 10px; }
.camera-row-compact { grid-template-columns: 1fr 1fr; }
.camera-row-compact .btn { min-height: 46px; gap: 6px; padding: 8px; font-size: 0.95rem; white-space: nowrap; }

.wt-q-form { margin: 0; }
.wt-q-form > input, .wt-q-form > select { display: block; width: calc(100% - 32px); margin-top: 10px; }
.wt-q-number { max-width: 180px; }
.wt-choice { margin-top: 10px; gap: 6px; }
.wt-choice label { min-height: 42px; padding: 6px 14px; font-size: 0.95rem; }
.wt-yesno { display: grid; grid-template-columns: 1fr 1fr; max-width: 260px; }
.wt-yesno label { justify-content: center; }
.wt-q-form .form-status .errorlist { margin-top: 6px; }
.wt-item .pills label, .wt-sheet .pills label, .wt-sheet .btn { -webkit-tap-highlight-color: transparent; }

.wt-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.wt-pill {
  min-height: 46px; padding: 6px 4px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background-color 0.12s, border-color 0.12s;
}
.wt-pill:active { transform: translateY(1px); }
.wt-pill:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.wt-pill-ok[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.wt-pill-issue[aria-pressed="true"] { background: var(--danger); border-color: var(--danger); color: #fff; }
.wt-pill-na[aria-pressed="true"] { background: var(--muted); border-color: var(--muted); color: #fff; }
.wt-note { margin: 8px 0 0 32px; }
.wt-note input { min-height: 42px; }
.wt-flink {
  display: inline-flex; align-items: center; gap: 4px; min-height: 40px; margin-top: 6px;
  color: var(--danger); font-size: 0.9rem; font-weight: 700; text-decoration: none;
}
.wt-flink svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.wt-add-issue { margin-top: 8px; border-color: #efc2bc; color: var(--danger); }

/* ---------------------------------------------------------------- step findings + actions */

.wt-findings { margin-top: 12px; }
.wt-findings:empty { display: none; }
.wt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.wt-actions > :only-child { grid-column: span 2; }
.wt-actions .btn { min-height: 48px; }
.wt-actions svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wt-add { border-color: var(--brand); color: var(--brand); }

.wt-next {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; margin-top: 12px;
  padding: 10px 16px; border-radius: var(--radius); background: #e6edf6; color: var(--brand);
  font-weight: 700; text-decoration: none;
}
.wt-next > .min0 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wt-next > span[aria-hidden] { font-size: 1.4rem; line-height: 1; }
.wt-next-kicker { margin-right: 4px; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------------------------------------------------------------- wrap-up */

.wt-wrap-intro { margin: 0 0 14px; color: var(--muted); font-size: 0.95rem; }
.wt-sub { margin: 20px 0 2px; font-size: 1rem; scroll-margin-top: 130px; }
.wt-sub-help { margin: 0 0 8px; color: var(--muted); font-size: 0.875rem; }
.wt-wrap .finalize-box { margin-top: 16px; }

@keyframes wt-flash {
  0% { box-shadow: 0 0 0 3px var(--brand), var(--shadow); }
  100% { box-shadow: 0 0 0 3px transparent, var(--shadow); }
}
.wt-flash { animation: wt-flash 1.6s ease-out; }

/* ---------------------------------------------------------------- finding sheet */

html.wt-sheet-open, html.wt-sheet-open body { overflow: hidden; }

.wt-sheet {
  position: fixed; top: auto; bottom: 0; left: 0; right: 0;
  width: 100%; max-width: 640px; max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); margin: 0 auto; padding: 0;
  border: 0; border-radius: 18px 18px 0 0; background: var(--surface); color: var(--text);
  box-shadow: 0 -8px 32px rgba(16, 24, 40, 0.28); overflow: hidden;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
.wt-sheet:not([open]) { display: none; }
.wt-sheet[open] { display: flex; flex-direction: column; animation: wt-sheet-in 0.22s ease-out; }
.wt-sheet::backdrop { background: rgba(16, 24, 40, 0.5); }
@keyframes wt-sheet-in { from { transform: translateY(48px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .wt-sheet[open], .wt-flash { animation: none; } }

.wt-sheet-panel { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; margin: 0; }
.wt-sheet-head {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 18px 12px 10px 16px; border-bottom: 1px solid var(--border);
}
.wt-sheet-grab { position: absolute; top: 6px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: #d0d6de; }
.wt-sheet-titles { flex: 1; min-width: 0; }
.wt-sheet-head h2 { margin: 0; font-size: 1.15rem; outline: none; }
.wt-sheet-where { overflow: hidden; color: var(--muted); font-size: 0.875rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.wt-sheet-x {
  width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: #eef1f5; color: var(--text); cursor: pointer;
}
.wt-sheet-x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.wt-sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 6px; -webkit-overflow-scrolling: touch; }
.wt-sheet-from {
  margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius-sm);
  background: #fbe4e1; color: #7f1d14; font-size: 0.9rem; font-weight: 600; overflow-wrap: anywhere;
}
.fs-photos { margin-bottom: 14px; }
.fs-photos .photo-grid { margin: 0 0 10px; }
.wt-sheet .field textarea { min-height: 84px; }
.wt-sheet-foot {
  display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface);
}
.wt-sheet-foot .btn { min-height: 52px; }
.fs-save-busy { display: none; }
.is-busy .fs-save-busy { display: inline; }
.is-busy .fs-save-idle { display: none; }
.fs-errors:empty { display: none; }
.fs-errors .errorlist { margin: 0 0 10px; font-weight: 600; }
.fs-note { margin: 0 0 10px; padding: 8px 12px; border-radius: var(--radius-sm); background: #dcf1e5; color: #1f5c39; font-size: 0.9rem; }

.fs-lib { margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.fs-lib > summary {
  list-style: none; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px;
  color: var(--brand); font-weight: 700; cursor: pointer;
}
.fs-lib > summary::-webkit-details-marker { display: none; }
.fs-lib > summary svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fs-lib[open] > summary { border-bottom: 1px solid var(--border); }
.fs-lib-inner { padding: 10px 12px 12px; }
.fs-lib-results { max-height: 42vh; margin-top: 8px; overflow-y: auto; overscroll-behavior: contain; }
.fs-lib-results .lib-hint:first-child { display: none; } /* the picker's "tap to add" hint; here a tap fills the sheet */
.fs-lib-loading { margin: 8px 0; color: var(--muted); font-size: 0.9rem; }
