
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-hyperlegible-next.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #15202b;
  --canvas: #f2f4f6;
  --surface: #ffffff;
  --level: #17766a;
  --level-deep: #115c52;
  --level-tint: #e3f1ee;
  --brick: #b42318;
  --brick-deep: #8f1c13;
  --brick-tint: #fdecea;
  --brick-text: #7a1711;
  --amber: #9a4b00;
  --amber-tint: #fff3e0;
  --n100: #f7f8fa;
  --n200: #e4e7eb;
  --n300: #cbd1d8;
  --n500: #6b7684;
  --n700: #3b4654;
  --shadow: 0 1px 2px rgba(21, 32, 43, 0.06), 0 8px 24px rgba(21, 32, 43, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --rail: 240px;
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, figure, fieldset, figcaption { margin: 0; }
h1 { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
h2 { font-size: 20px; line-height: 26px; font-weight: 600; }
h3 { font-size: 16px; line-height: 24px; font-weight: 600; }
.display { font-size: 36px; line-height: 40px; font-weight: 700; letter-spacing: -0.02em; max-width: 20ch; text-wrap: balance; }
.lead { font-size: 18px; line-height: 28px; color: var(--n700); max-width: 56ch; }
.meta { font-size: 13px; line-height: 18px; color: var(--n500); }
.muted { color: var(--n500); }
.hint { font-size: 13px; line-height: 18px; color: var(--n500); margin-top: 6px; }
.prose { max-width: 62ch; }
.prose > * + * { margin-top: 12px; }

a { color: var(--level); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
svg.i { width: 20px; height: 20px; flex: none; }
:focus-visible { outline: 2px solid var(--level); outline-offset: 2px; }

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

/* Shell */

.app { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
.rail { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 56px;
  padding: 0 12px 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--n200);
}
.topbar nav { display: flex; align-items: center; gap: 2px; }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.wordmark:hover { text-decoration: none; }
.wordmark .mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
}

.navlink {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--n700);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}
.navlink:hover { background: var(--n100); color: var(--ink); text-decoration: none; }
.navlink[aria-current="page"] { background: var(--n100); color: var(--ink); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--level-tint);
  color: var(--level-deep);
  font-weight: 600;
  font-size: 14px;
  display: grid;
  place-items: center;
  flex: none;
}
a.avatar:hover { text-decoration: none; background: var(--level); color: #fff; }

.icon-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--n300);
  background: var(--surface);
  color: var(--n700);
  cursor: pointer;
}
.icon-btn:hover { background: var(--n100); color: var(--ink); }

.work { padding: 24px 16px 56px; min-width: 0; }
.work-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 20px;
}
.work-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs { font-size: 14px; line-height: 20px; color: var(--n500); margin-bottom: 6px; }
.crumbs a { color: var(--n500); }
.crumbs a:hover { color: var(--ink); }

@media (min-width: 960px) {
  .app { grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-rows: minmax(100vh, auto); }
  /* The rail's background runs the full page height; the rail itself stays put. */
  .app::before { content: ""; grid-column: 1; grid-row: 1; background: var(--surface); border-right: 1px solid var(--n200); }
  .app > .rail { grid-column: 1; grid-row: 1; }
  .app > .work { grid-column: 2; grid-row: 1; }
  .app[data-rail="closed"] { --rail: 72px; }
  .topbar { display: none; }
  .rail {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 16px 12px;
    overflow: hidden;
  }
  .rail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 4px 16px;
  }
  .rail .navlink { padding: 0 10px; }
  .rail-foot { margin-top: auto; border-top: 1px solid var(--n200); padding-top: 10px; }
  .identity { display: flex; align-items: center; gap: 10px; padding: 8px 6px; min-width: 0; }
  .identity .who { min-width: 0; font-size: 14px; line-height: 18px; }
  .identity .who strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .identity .who span { display: block; color: var(--n500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rail-foot form { padding: 0 6px; }
  .app[data-rail="closed"] .rail .label,
  .app[data-rail="closed"] .wordmark .name,
  .app[data-rail="closed"] .identity .who,
  .app[data-rail="closed"] .rail-foot form { display: none; }
  .app[data-rail="closed"] .rail-head { justify-content: center; }
  .app[data-rail="closed"] .rail-head .wordmark { display: none; }
  .work { padding: 32px 40px 64px; }
}

/* Public shell: landing, sign in, sign up, terms, errors */

.public { min-height: 100vh; display: flex; flex-direction: column; }
.public-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 64px;
  padding: 0 16px;
}
.public-bar nav { display: flex; gap: 4px; }
@media (max-width: 519px) { .public-bar nav .btn { display: none; } }
.public-main { flex: 1; padding: 8px 16px 56px; }
.narrow { width: 100%; max-width: 440px; margin: 0 auto; }
.narrow .panel { padding: 24px; }
.narrow h1 { margin-bottom: 6px; }
.form-foot { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 15px; }
@media (min-width: 960px) {
  .public-bar { padding: 0 40px; }
  .public-main { padding: 32px 40px 80px; }
}

/* Landing */

.hero { display: grid; gap: 32px; max-width: 1120px; margin: 0 auto; padding-top: 16px; }
.hero-copy { display: grid; gap: 20px; align-content: start; }
.hero-copy .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-steps { list-style: none; padding: 0; display: grid; gap: 16px; margin-top: 8px; }
.hero-step { display: flex; gap: 12px; align-items: flex-start; }
.hero-step .n {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: grid;
  place-items: center;
}
.hero-step p { font-size: 15px; line-height: 22px; color: var(--n700); }
.hero-step strong { display: block; color: var(--ink); }
@media (min-width: 960px) {
  .hero { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; gap: 48px; padding-top: 32px; }
}

/* The sample reveal drawn on the landing: a room before and after, no photo needed */

.sample-frame { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--surface); }
.sample-room { position: relative; aspect-ratio: 4 / 3; background: linear-gradient(#ebe7df 0 62%, #b89f7f 62%); overflow: hidden; }
.sample-room .window { position: absolute; left: 36%; top: 14%; width: 28%; height: 30%; background: #d7e6ec; border: 6px solid #f6f4ee; box-shadow: inset 0 0 0 2px #cfd9dd; }
.sample-room .cabinets { position: absolute; left: 0; right: 0; top: 50%; height: 12%; background: #7b6a58; }
.sample-room .counter { position: absolute; left: 0; right: 0; top: 49%; height: 2.5%; background: #ded9cf; }
.sample-room .light { position: absolute; left: 50%; top: 0; width: 2px; height: 10%; background: #8c8477; display: none; }
.sample-room.after { position: absolute; inset: 0; width: 100%; clip-path: inset(0 0 0 54%); background: linear-gradient(#ebe7df 0 62%, #d9b98c 62%); }
.sample-room.after .cabinets { background: #f3efe6; box-shadow: inset 0 -2px 0 #d8d2c6; }
.sample-room.after .light { display: block; }
.sample-room.after .light::after { content: ""; position: absolute; left: -14px; top: 100%; width: 30px; height: 14px; border-radius: 0 0 15px 15px; background: #2d2a26; }
.sample-line { position: absolute; top: 0; bottom: 0; left: 54%; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(21, 32, 43, 0.25); }
.sample-handle {
  position: absolute;
  top: 50%;
  left: 54%;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  color: var(--ink);
}
.sample-band { background: var(--ink); color: #fff; font-size: 14px; line-height: 20px; padding: 10px 14px; }

/* Buttons */

button,
.btn,
a.button,
a.danger,
a.rv-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: 500 16px/1.2 var(--font);
  color: #fff;
  background: var(--level);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s;
}
button:hover, .btn:hover, a.button:hover { background: var(--level-deep); text-decoration: none; }
button:active { transform: translateY(1px); }
.secondary, .rv-secondary, a.rv-button {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--n300);
}
.secondary:hover, .rv-secondary:hover, a.rv-button:hover { background: var(--n100); text-decoration: none; }
.danger, a.danger, button.danger { background: var(--brick); color: #fff; border-color: transparent; }
.danger:hover, a.danger:hover, button.danger:hover { background: var(--brick-deep); }
.quiet, button.link { background: transparent; color: var(--n700); padding: 0 10px; }
.quiet:hover, button.link:hover { background: var(--n100); color: var(--ink); }
button:disabled, button[disabled] {
  background: var(--n200);
  color: var(--n500);
  border-color: transparent;
  cursor: not-allowed;
  transform: none;
}
.block { width: 100%; }
form button.block[type="submit"] { margin-top: 20px; }
/* Jump links land below the sticky phone bar. */
html { scroll-padding-top: 72px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row-end { justify-content: flex-end; }

/* Forms */

label {
  display: block;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--n700);
}
label > input, label > textarea { margin-top: 6px; }
label + input, label + textarea { margin-top: 6px; }
input + label, textarea + label, .field + .field, p + label, label + label, input + .drop, .drop + label { margin-top: 16px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]),
textarea {
  appearance: none;
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--n300);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
}
input:focus, textarea:focus { border-color: var(--level); }
input[readonly] { background: var(--n100); color: var(--n700); }
textarea { min-height: 7.5rem; resize: vertical; }

label.check, .check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  padding: 6px 0;
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: var(--ink);
  cursor: pointer;
}
input[type="checkbox"], input[type="radio"] {
  appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  border: 1.5px solid var(--n300);
  border-radius: 6px;
  background: var(--surface);
  display: grid;
  place-content: center;
  cursor: pointer;
}
input[type="radio"] { border-radius: 999px; }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--level); border-color: var(--level); }
input[type="checkbox"]:checked::before {
  content: "";
  width: 11px;
  height: 6px;
  border: 2.5px solid #fff;
  border-top: 0;
  border-right: 0;
  transform: translateY(-1px) rotate(-45deg);
}
input[type="radio"]:checked::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: #fff; }

fieldset { border: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--n700); }

.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  min-height: 72px;
  padding: 14px 16px;
  border: 1.5px dashed var(--n300);
  border-radius: var(--radius-sm);
  background: var(--n100);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.drop:hover, .drop:focus-within { border-color: var(--level); background: var(--level-tint); }
.drop input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop .hint { margin: 0; font-weight: 400; }
.drop label { color: var(--ink); font-size: 15px; }

/* Alerts and status */

.alert, .error, #error, .ok, #ok, .rv-ok, .rv-error, #generate-message, #generate-reason,
#marks-error, #marks-status, #check-result, #next-step, #share-stale, #pending:not(:empty) {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--n200);
  border-left: 3px solid var(--n500);
  background: var(--n100);
  color: var(--n700);
  font-size: 15px;
  line-height: 22px;
}
.error, #error, .rv-error, #generate-message, #marks-error {
  border-color: var(--brick-tint);
  border-left-color: var(--brick);
  background: var(--brick-tint);
  color: var(--brick-text);
}
.ok, #ok, .rv-ok {
  border-color: var(--level-tint);
  border-left-color: var(--level);
  background: var(--level-tint);
  color: var(--level-deep);
}
#pending { margin-top: 16px; }
#pending:empty { display: none; }

/* Panels, cards, tags */

.panel { background: var(--surface); border: 1px solid var(--n200); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.panel > * + *, .card > * + *, .side > section > * + * { margin-top: 12px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { flex: 1; }
.stack { display: grid; gap: 16px; }
.layout-2 { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1100px) {
  .layout-2 { grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; }
  .side { position: sticky; top: 24px; }
}
.side { display: grid; gap: 16px; }
.side > section > * + * { margin-top: 12px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--n200);
  background: var(--n100);
  color: var(--n700);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  white-space: nowrap;
}
.tag-ok { background: var(--level-tint); color: var(--level-deep); border-color: transparent; }
.tag-bad { background: var(--brick-tint); color: var(--brick-text); border-color: transparent; }
.tag-warn, .layout { background: var(--amber-tint); color: var(--amber); border-color: transparent; }
.tag svg.i { width: 16px; height: 16px; }

.label-band, #label {
  display: block;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  line-height: 20px;
}

.signoff {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--level-tint);
  color: var(--level-deep);
  font-size: 15px;
  line-height: 22px;
}
.signoff svg.i { margin-top: 1px; }

.empty { display: grid; gap: 12px; justify-items: start; }
.panel.empty { padding: 24px; }
.empty p { color: var(--n700); max-width: 48ch; }

/* Data table */

.project-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tracker { list-style: none; margin: 0; padding: 4px; display: flex; flex-wrap: wrap; gap: 2px; background: var(--surface); border: 1px solid var(--n200); border-radius: 999px; }
.tracker li { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--n500); }
.tracker li.done { color: var(--level-deep); }
.tracker li[aria-current="step"] { background: var(--ink); color: #fff; font-weight: 600; }
.tracker .dot { width: 8px; height: 8px; border-radius: 999px; border: 1.5px solid currentColor; }
.tracker-phone { display: none; }
@media (max-width: 599px) {
  /* On a phone the list stays for screen readers and one plain line shows where the project is. */
  .tracker { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .tracker-phone { display: block; width: 100%; margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--level-deep); }
}
.tracker svg.i { width: 14px; height: 14px; }
.project-card { display: flex; flex-direction: column; height: 100%; background: var(--surface); border: 1px solid var(--n200); border-radius: var(--radius); overflow: hidden; color: var(--ink); text-decoration: none; }
.project-card:hover { border-color: var(--n300); }
.project-card .card-thumb { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--n100); }
.project-card .card-thumb img { display: block; width: 100%; aspect-ratio: 16 / 10; height: auto; object-fit: cover; }
.project-card .thumb-empty { display: grid; place-items: center; height: 100%; color: var(--n500); }
.project-card .card-body { display: grid; gap: 4px; padding: 14px 16px 16px; }
.project-card .card-title { font-size: 16px; line-height: 24px; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; border: 1px solid var(--n200); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--n100);
  text-align: left;
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--n500);
  padding: 10px 16px;
  border-bottom: 1px solid var(--n200);
  white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--n200); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--n100); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td a { color: var(--ink); font-weight: 500; }

/* The project page: the room fills the stage, context floats over it, the steps sit beside it */

.project-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "stage" "steps" "changes" "existing" "danger";
}
.area-danger { grid-area: danger; display: flex; justify-content: flex-start; }
.area-stage { grid-area: stage; min-width: 0; }
.area-steps { grid-area: steps; min-width: 0; }
.area-changes { grid-area: changes; }
.area-existing { grid-area: existing; min-width: 0; }
.area-existing:empty { display: none; }
@media (min-width: 1100px) {
  .project-grid {
    grid-template-columns: minmax(0, 1fr) 360px;
    grid-template-rows: auto auto auto 1fr;
    grid-template-areas: "stage steps" "changes steps" "existing steps" "danger steps";
    gap: 20px 24px;
    align-items: start;
  }
  .area-steps { position: sticky; top: 24px; }
}

.stage-wrap { position: relative; }
.stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--ink);
  height: clamp(240px, 66vw, 520px);
}
@media (min-width: 1100px) { .stage { height: clamp(460px, calc(100vh - 250px), 760px); } }
.stage-frame { position: absolute; inset: 0; }
/* The toolbar gets its own strip at the bottom, so it never covers the label band in the picture. */
@media (min-width: 600px) { .stage.has-modes .stage-frame { bottom: 64px; } }
.layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.layer-concept { transition: opacity 0.18s; }
.stage-wrap[data-mode="photo"] .layer-concept,
.stage-wrap:has(input[value="photo"]:checked) .layer-concept { opacity: 0; }
.stage-wrap:has(input[value="compare"]:checked) .layer-concept { clip-path: inset(0 0 0 var(--cut, 50%)); transition: none; }

.cut-line, .stage-cut { display: none; }
.stage-wrap:has(input[value="compare"]:checked) .cut-line {
  display: block;
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--cut, 50%);
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(21, 32, 43, 0.3);
  pointer-events: none;
}
.cut-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
}
.stage-wrap:has(input[value="compare"]:checked) .stage-cut {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  touch-action: pan-y;
}
.stage-wrap:has(.stage-cut:focus-visible) .cut-handle { outline: 2px solid var(--level); outline-offset: 2px; }

.float { position: absolute; z-index: 2; background: rgba(255, 255, 255, 0.96); border-radius: var(--radius); box-shadow: var(--shadow); }
.stage-card {
  top: 12px;
  left: 12px;
  display: grid;
  gap: 2px;
  max-width: min(300px, calc(100% - 24px));
  padding: 10px 14px 12px;
}
.stage-card strong { font-size: 17px; line-height: 22px; font-weight: 600; }
.stage-card .meta { color: var(--n500); }
.stage-wrap .card-concept, .stage-wrap .card-compare { display: none; }
.stage-wrap[data-mode="concept"] .card-photo { display: none; }
.stage-wrap[data-mode="concept"] .card-concept { display: grid; }
.stage-wrap:has(input[value="photo"]:checked) .card-photo { display: grid; }
.stage-wrap:has(input[value="photo"]:checked) .card-concept,
.stage-wrap:has(input[value="compare"]:checked) .card-concept { display: none; }
.stage-wrap:has(input[value="compare"]:checked) .card-compare { display: grid; }
@media (max-width: 599px) {
  .stage-card { top: 8px; left: 8px; padding: 6px 10px 8px; }
  .stage-card > .meta:first-child { display: none; }
  .stage-card strong { font-size: 15px; line-height: 20px; }
  .stage-card .meta { font-size: 12px; line-height: 16px; }
}

.modes {
  display: flex;
  gap: 4px;
  margin: 8px 0 0;
  padding: 4px;
  border: 1px solid var(--n200);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}
@media (min-width: 600px) {
  .modes {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    margin: 0;
    border: 0;
    box-shadow: var(--shadow);
  }
}
.mode {
  position: relative;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  color: var(--n700);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
@media (max-width: 599px) { .mode { min-height: 44px; padding: 0 8px; font-size: 14px; gap: 6px; } }
.mode:hover { background: var(--n100); color: var(--ink); }
.mode input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.mode:has(input:checked) { background: var(--ink); color: #fff; }
.mode:has(input:focus-visible) { outline: 2px solid var(--level); outline-offset: 2px; }
@media (max-width: 599px) {
  .filmstrip { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .thumbs { flex-wrap: nowrap; }
}

.stage-empty { background: var(--surface); border: 1.5px dashed var(--n300); display: grid; place-items: center; padding: 24px; }
.stage-empty .empty { justify-items: center; text-align: center; max-width: 36ch; }
.empty-icon { width: 48px; height: 48px; border-radius: 999px; background: var(--level-tint); color: var(--level-deep); display: grid; place-items: center; }
label.btn { color: #fff; font-size: 16px; font-weight: 500; }

#label.stage-label { margin-top: 8px; padding: 0 2px; background: transparent; color: var(--n500); font-size: 13px; line-height: 18px; border-radius: 0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
}

.filmstrip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.thumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.thumbs-add { display: flex; align-items: center; gap: 8px; }
.strip-note { margin-top: 6px; }
@media (max-width: 599px) {
  /* One row that scrolls sideways, so no photo sits alone on a second line. */
  .filmstrip { flex-wrap: nowrap; overflow-x: auto; padding: 2px; scrollbar-width: none; }
  .thumbs { flex-wrap: nowrap; }
  .thumb, .thumb-add { width: 76px; height: 57px; }
}
.thumb {
  position: relative;
  flex: none;
  width: 88px;
  height: 66px;
  margin: 0;
  padding: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  background: var(--n200);
  cursor: pointer;
}
span.thumb { cursor: default; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb input[type="radio"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; border-radius: 0; border: 0; background: transparent; opacity: 0; cursor: pointer; }
.thumb input[type="radio"]:checked { background: transparent; }
.thumb:has(input:checked), span.thumb[data-main="yes"] { border-color: var(--level); }
.thumb .n {
  position: absolute;
  left: 4px;
  bottom: 4px;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(21, 32, 43, 0.82);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  font-weight: 500;
}
.thumb:has(input:checked) .n, span.thumb[data-main="yes"] .n { background: var(--level); }
.thumb:has(input:focus-visible) { outline: 2px solid var(--level); outline-offset: 2px; }
.thumb-add {
  flex: none;
  position: relative;
  width: 88px;
  height: 66px;
  margin: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1.5px dashed var(--n300);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--n700);
  font-size: 13px;
  line-height: 16px;
  cursor: pointer;
}
.thumb-add:hover, .thumb-add:focus-within { border-color: var(--level); color: var(--level-deep); background: var(--level-tint); }
.thumb-add input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
[data-js] [data-autosubmit-button] { display: none; }

.lines { list-style: none; padding: 0; display: grid; }
.lines li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--n200); }
.lines li:last-child { border-bottom: 0; }
.lines .n { flex: none; width: 24px; height: 24px; border-radius: 999px; background: var(--n100); border: 1px solid var(--n200); color: var(--n500); font-size: 13px; font-weight: 500; display: grid; place-items: center; }
.lines .text { flex: 1; min-width: 0; overflow-wrap: anywhere; }

details.editor > summary, details.more > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--n300);
  background: var(--surface);
  font-weight: 500;
  color: var(--ink);
}
details.editor > summary::-webkit-details-marker, details.more > summary::-webkit-details-marker { display: none; }
details.editor > summary:hover, details.more > summary:hover { background: var(--n100); }
details.editor[open] > summary { margin-bottom: 16px; }
details.more[open] > summary { margin-bottom: 12px; }
.form-actions { margin-top: 16px; }

/* Steps: the three things the contractor does after writing the scope */

.steps { display: grid; gap: 12px; align-content: start; }
.step {
  background: var(--surface);
  border: 1px solid var(--n200);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  min-width: 0;
}
.step > * + * { margin-top: 12px; }
.step[data-state="current"] { border-color: var(--n300); box-shadow: var(--shadow); }
.step[data-state="locked"] { background: transparent; border-style: dashed; }
.step-head { display: flex; align-items: center; gap: 10px; }
.step-head h2 { flex: 1; font-size: 17px; line-height: 22px; }
.step-n {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  background: var(--ink);
  color: #fff;
}
.step-n svg.i { width: 16px; height: 16px; }
.step[data-state="done"] .step-n { background: var(--level); }
.step[data-state="locked"] .step-n { background: var(--n200); color: var(--n500); }
.step[data-state="locked"] h2 { color: var(--n500); }
.step-note { color: var(--n700); font-size: 15px; line-height: 22px; }
.step[data-state="locked"] .step-note { color: var(--n500); }
.step-action { display: grid; gap: 6px; }
.step-action button, .step form > button.primary, #create-link { width: 100%; }
.step-foot { justify-content: space-between; }
.label-note { padding: 0 4px; display: grid; gap: 8px; }

.attempts { list-style: none; padding: 0; display: grid; gap: 8px; }
.attempt { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 4px 12px; align-items: start; padding: 8px; border: 1px solid var(--n200); border-radius: var(--radius-sm); }
.attempt > .error, .attempt > .meta { grid-column: 1 / -1; }
.attempt-thumb { display: grid; place-items: center; width: 64px; height: 48px; border-radius: 6px; overflow: hidden; background: var(--ink); color: #fff; }
.attempt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attempt-thumb-empty { background: var(--n100); color: var(--n500); }
.attempt-body { display: grid; gap: 2px; min-width: 0; }
.attempt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-weight: 500; }

.review-rows { list-style: none; padding: 0; display: grid; gap: 10px; }
.review-row { display: grid; gap: 10px; justify-items: start; font-size: 15px; line-height: 22px; }
.review-row + .review-row { padding-top: 10px; border-top: 1px solid var(--n200); }
.review-row .btn { width: 100%; }
.review-row.is-past { color: var(--n500); }
.quiet-link { font-size: 15px; font-weight: 500; }

.copy-row { display: flex; gap: 8px; margin-top: 6px; }
.copy-row input { flex: 1; min-width: 0; margin: 0; }
.copy-row button { flex: none; }

.spinner {
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 999px;
  border: 3px solid var(--level-tint);
  border-top-color: var(--level);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--level-tint); color: var(--level-deep); font-size: 15px; line-height: 22px; }

.check-warn { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--amber-tint); color: var(--ink); }

.walk-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--n200); border-radius: var(--radius-sm); background: var(--n100); }
.walk-icon { flex: none; width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--n200); display: grid; place-items: center; color: var(--n700); }
.walk-body { min-width: 0; display: grid; gap: 2px; }
.walk-body a { overflow-wrap: anywhere; font-size: 15px; }
#existing-room-sentence { font-weight: 500; }

.form-panel { padding: 0; }
.form-section { padding: 20px; }
.form-section > h2 { margin-bottom: 14px; }
.form-section + .form-section { border-top: 1px solid var(--n200); }
.form-panel .form-actions { margin: 0; padding: 16px 20px; border-top: 1px solid var(--n200); background: var(--n100); border-radius: 0 0 var(--radius) var(--radius); }
.input-short { max-width: 120px; }
.next-steps { list-style: none; padding: 0; display: grid; gap: 12px; }
.next-steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 22px; color: var(--n700); }
.next-steps .n { flex: none; width: 24px; height: 24px; border-radius: 999px; background: var(--n100); border: 1px solid var(--n200); color: var(--n700); font-size: 13px; font-weight: 600; display: grid; place-items: center; }

.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; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.danger-ghost { color: var(--brick-text); }
.danger-ghost:hover { background: var(--brick-tint); border-color: var(--brick-tint); color: var(--brick-text); }

.danger-zone { border-color: var(--brick-tint); }
.danger-zone p { color: var(--n700); }

.error-page { display: grid; gap: 16px; justify-items: start; padding-top: 24px; }
.error-page .code { font-size: 13px; color: var(--n500); }
