/* One stylesheet, no build step, no framework, and no CDN.
   That last one is a product decision, not a shortcut: this app has to open on a
   phone at the foot of a ladder, on a job site, on whatever signal is going. Every
   font is a system font and every graphic is inline SVG, so the page cannot be
   half-rendered because someone else's server was slow.

   Only English text may appear in generated content. */

/* ---------------------------------------------------------------------------
   COLOUR

   Deep navy carries the product; it is the colour of the documents this thing
   exists to produce, and it stays out of the way of the three colours that have
   to mean exactly one thing each:

     amber  = look at this, nothing is broken   (unread photos, money owed,
                                                 an identifier spotted in a file)
     green  = settled, nothing owed
     red    = refused, stopped, wrong

   Those three are load-bearing. The accent is never allowed to borrow them, which
   is why it is not the orange a roofing product would reach for first.
   --------------------------------------------------------------------------- */
:root {
  --ink: #10151c;
  --ink-soft: #39434f;
  /* Measured 2026-08-19 in the browser: at #667281 the small print under the
     price cleared WCAG AA by 0.06 (4.56 against 4.5). That is a pass on paper
     and a coin toss on a phone in daylight, which is exactly where this page
     gets read. Darkened for headroom. */
  --muted: #5b6675;
  --line: #dfe4ea;
  --line-soft: #edf0f3;
  --bg: #f5f7f9;
  --card: #ffffff;
  --card-sunk: #fafbfc;

  --accent: #14507d;
  --accent-strong: #0e3a5c;
  --accent-soft: #e9f1f8;
  --accent-ink: #14507d;

  --ok: #1d6b3a;
  --ok-ink: #1d6b3a;
  --ok-soft: #edf8f1;
  --warn: #7a5300;
  --warn-ink: #7a5300;
  --warn-bg: #fdf6e6;
  --warn-line: #d7a03a;
  --error: #a3242b;
  --pending: #6b7683;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 21, 28, 0.05), 0 1px 3px rgba(16, 21, 28, 0.04);
  --shadow-lift: 0 4px 12px rgba(16, 21, 28, 0.08);

  --measure: 68ch;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* Dark mode follows the reader, and the guard on the selector matters: the
   default "system" setting stamps nothing on the root element, so a page that
   only checked [data-theme] would ignore the reader's own preference. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8ecf1;
    --ink-soft: #b6c0cc;
    --muted: #8c98a6;
    --line: #2a323c;
    --line-soft: #212831;
    --bg: #0d1116;
    --card: #151b23;
    --card-sunk: #11171e;

    --accent: #6ba8dc;
    --accent-strong: #8cc0ec;
    --accent-soft: #17293a;
    --accent-ink: #9cc9ea;

    --ok: #6ed295;
    --ok-ink: #6ed295;
    --ok-soft: #14251b;
    --warn: #e8b95c;
    --warn-ink: #e8b95c;
    --warn-bg: #251e10;
    --warn-line: #6b5426;
    --error: #f08b8b;
    --pending: #8c98a6;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lift: 0 4px 14px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.6 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: -0.012em;
  color: var(--accent-ink);
  text-decoration: none;
}

/* The mark scales with the text around it rather than sitting at a fixed pixel
   size, so it keeps its proportion when the reader has enlarged type. */
.brand-mark {
  width: 1.45em;
  height: 1.45em;
  flex: none;
  display: block;
}

.brand-word { white-space: nowrap; }

/* The tagline is the first sentence a stranger reads, but it is not worth a line
   of its own on a phone: at that width the brand and the sign-out control are
   what the returning customer came for. */
.tagline {
  color: var(--muted);
  font-size: 0.9rem;
  border-left: 1px solid var(--line);
  padding-left: 0.9rem;
}

.page { max-width: 62rem; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.footer {
  max-width: 62rem;
  margin: 0 auto;
  padding: 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.35rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}

/* Type scale. Headings are set tight and dark; body copy is capped at a readable
   measure so a paragraph on a wide desktop does not run to 200 characters. */
h1 {
  font-size: 1.55rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}
h2 {
  font-size: 1.15rem;
  line-height: 1.3;
  letter-spacing: -0.012em;
  margin: 0 0 0.6rem;
}
h3 {
  font-size: 0.98rem;
  letter-spacing: -0.006em;
  margin: 1.15rem 0 0.4rem;
}

.card > p,
.card > ul,
.card > ol { max-width: var(--measure); }

.lede { margin-top: 0; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.error { color: var(--error); }

.notice { max-width: 60rem; margin: 0 auto; padding: 0 1.25rem; }
.notice:empty { padding: 0; }

button, .primary-link {
  font: inherit;
  font-weight: 550;
  padding: 0.52rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
button:hover:not([disabled]) { background: var(--card-sunk); border-color: var(--muted); }
/* a.primary and button.primary must look identical.
   Measured 2026-08-18: the rule existed only for `button.primary`, but
   `<a class="primary">` is used in two places — "Open the photo plan" on the job
   screen and "Download the photo plan" on the shot list. Both rendered as plain
   blue text. The most-tapped control on the one screen that is opened on a phone,
   at the foot of the ladder, was not a button. */
button.primary,
a.primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.58rem 1.15rem;
  font: inherit;
  font-weight: 600;
  display: inline-block;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background-color 0.12s ease, transform 0.06s ease;
}
button.primary:hover:not([disabled]),
a.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
button.primary:active:not([disabled]),
a.primary:active { transform: translateY(1px); }

/* In dark mode the accent is a light blue, so white text on it fails contrast.
   The button flips to dark ink instead of quietly becoming unreadable. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) button.primary,
  :root:not([data-theme="light"]) a.primary { color: #0d1116; }
}
button[disabled] { opacity: 0.5; cursor: default; }
.primary-link { display: inline-block; text-decoration: none; color: var(--accent); }

/* Keyboard focus. There was no :focus rule at all (grep: 0 hits), and the
   buttons' own border swallowed the browser's default ring, so someone moving
   through the page with Tab could not see where they were. */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}



/* The shot list. The product's one measured difference, and the least styled
   screen in it: there was not a single rule for `<ol class="frames">`. The frames
   ran together as a plain numbered list — the worst possible shape for text read
   on a phone, one-handed, in sunlight, on a roof. */
ol.frames { list-style: decimal; padding-left: 2.2rem; margin: 0.5rem 0; }
ol.frames > li {
  border-top: 1px solid var(--line);
  padding: 0.7rem 0 0.7rem 0.3rem;
}
ol.frames > li:first-child { border-top: 0; }
ol.frames > li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
ol.frames strong { display: block; }
ol.frames ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }

/* Mobile. There were zero @media queries (grep matched only @keyframes), so if
   anything worked on a phone it worked by accident. The shot list screen is opened
   on a phone by design — before tear-off, at the foot of the ladder. */
@media (max-width: 640px) {
  /* The upload row overflowed a 375px screen at its 256px base width. */
  form.uploadform label { min-width: 0; width: 100%; }
  form.uploadform { align-items: stretch; }

  /* Text read in sunlight does not get smaller. 12px floors are raised. */
  .progress-text, .pill, .risk-disclaimer { font-size: 0.9rem; }

  /* Touch target for a gloved finger. */
  button, a.primary { padding: 0.6rem 1rem; }
  a.primary { display: block; text-align: center; }

  ol.frames { padding-left: 1.6rem; }
}

/* Reduced-motion preference — the intake animation could not be turned off. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

form.uploadform { display: flex; gap: 0.5rem; align-items: center; margin: 0.4rem 0; flex-wrap: wrap; }
form.uploadform label { min-width: 16rem; }

fieldset { border: 1px solid var(--line); border-radius: 4px; margin: 0 0 1rem; padding: 0.75rem; }
legend { color: var(--muted); font-size: 0.85rem; padding: 0 0.35rem; }
fieldset label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; }
fieldset label.check { display: flex; gap: 0.4rem; align-items: center; }
fieldset input[type="text"], fieldset select {
  display: block;
  width: 100%;
  padding: 0.35rem 0.5rem;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 4px;
}
fieldset input[type="checkbox"] { width: auto; }

ul { margin: 0.35rem 0; padding-left: 1.1rem; }
.joblist, .uploadlist, .filelist { list-style: none; padding-left: 0; }
.joblist li, .uploadlist li { display: flex; gap: 0.75rem; align-items: baseline; padding: 0.2rem 0; }

.pill { font-size: 0.75rem; padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }

.status dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 0.75rem; font-size: 0.9rem; }
.status dl.facts dt { color: var(--muted); }
.status dl.facts dd { margin: 0; }

/* --- approval screen ---------------------------------------------------- */

.counter { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin: 0.5rem 0; }
.counter .count { font-size: 0.9rem; padding: 0.15rem 0.5rem; border-radius: 4px; background: var(--bg); }
.counter .approved { color: var(--ok); }
.counter .pending { color: var(--pending); }

.candidate {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
/* Four states, four looks. "Not decided" must never look like "left out", and
   an item already before the carrier must not look like either. */
.candidate.state-pending { border-left-color: var(--pending); }
.candidate.state-included { border-left-color: var(--ok); background: #f4fbf6; }
.candidate.state-excluded { border-left-color: var(--line); background: #fafafa; opacity: 0.75; }
.candidate.state-carried { border-left-color: var(--accent); background: #f6f7fb; }

.candidate-head { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; font-size: 0.85rem; }
.candidate-head .cid { font-weight: 700; }
.candidate-head .argument { color: var(--muted); }
.candidate-head .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.candidate-head .code-blank { color: var(--muted); }
.candidate-head .state-label { margin-left: auto; font-weight: 600; }

.risk { padding: 0.05rem 0.4rem; border-radius: 3px; }
.risk-medium { background: #fdf3e0; color: var(--warn); }
.risk-high { background: #fdeaea; color: var(--error); }

.candidate .description { margin: 0.5rem 0 0.25rem; }
.candidate .why, .candidate .photos, .candidate .state-note,
.candidate .contractor-note, .candidate .policy-note, .candidate .risk-note {
  margin: 0.2rem 0; font-size: 0.9rem;
}
.candidate .contractor-note { color: var(--accent); }
.candidate .policy-note { color: var(--warn); }
.candidate .missing { font-size: 0.9rem; color: var(--warn); }

.decisions { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.decisions button.include { border-color: var(--ok); color: var(--ok); }
.decisions button.exclude { border-color: var(--muted); color: var(--muted); }
.decisions-locked { margin-top: 0.6rem; font-size: 0.9rem; color: var(--accent); }

/* --- approval screen: detail surfaces (agent B) --------------------------- */

/* Badges next to the item id. The policy flag is a MARKER, not a verdict. */
.candidate-head .flag { padding: 0.05rem 0.4rem; border-radius: 3px; font-size: 0.8rem; }
.candidate-head .policy-flag { background: #fdf3e0; color: var(--warn); }
.candidate-head .carried-flag { background: #eef0f8; color: var(--accent); }

.candidate .code-reason, .candidate .prior-note, .candidate .carried-note {
  margin: 0.2rem 0; font-size: 0.9rem; color: var(--muted);
}
.candidate .carried-note { color: var(--accent); }

/* Photo anchors. Small on purpose: the preview confirms which frame is
   attached, it is not the place to judge the damage. */
.photo-strip { display: flex; gap: 0.5rem; flex-wrap: wrap; list-style: none; padding: 0; margin: 0.3rem 0; }
.photo-strip .photo { text-align: center; font-size: 0.75rem; }
.photo-strip img { width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; display: block; }
.photo-strip .photo-placeholder {
  display: flex; align-items: center; justify-content: center;
  width: 96px; height: 96px; border: 1px dashed var(--line); border-radius: 3px; color: var(--muted);
}
.photo-strip .photo-id { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Rejection risk. No percentage is rendered anywhere in this block. */
.risk-block { margin: 0.5rem 0; border: 1px solid var(--line); border-radius: 4px; padding: 0.4rem 0.6rem; font-size: 0.9rem; }
.risk-block summary { cursor: pointer; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.risk-block .risk-title { font-weight: 600; }
.risk-block .risk-evidence { color: var(--muted); font-size: 0.85rem; }
.risk-block ul { margin: 0.2rem 0 0.5rem 1.1rem; padding: 0; }
.risk-block .risk-raised { color: var(--warn); }
.risk-block .risk-supported { color: var(--ok); }
.risk-block .risk-disclaimer { color: var(--muted); font-size: 0.8rem; margin: 0.3rem 0 0; }

/* The internal block must read as a different document from the rest of the
   row: everything above it can go to the carrier, nothing inside it can. */
.internal-block {
  margin: 0.6rem 0 0; padding: 0.5rem 0.7rem;
  border: 1px dashed var(--warn); border-radius: 4px; background: #fffdf7;
}
.internal-block .internal-title { margin: 0; font-size: 0.85rem; letter-spacing: 0.03em; color: var(--warn); }
.internal-block .internal-intro { margin: 0.2rem 0 0.4rem; font-size: 0.8rem; color: var(--muted); }
.internal-block p { margin: 0.2rem 0; font-size: 0.9rem; }
.internal-hint { font-size: 0.85rem; color: var(--muted); }

/* View bar. These controls change what is SHOWN, never what is approved. */
.view-bar { border-bottom: 1px solid var(--line); padding-bottom: 0.6rem; margin-bottom: 0.8rem; }
.view-group { display: flex; gap: 0.4rem; align-items: baseline; flex-wrap: wrap; margin-bottom: 0.3rem; }
.view-group .view-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.view-option { font-size: 0.85rem; padding: 0.1rem 0.45rem; border: 1px solid var(--line); border-radius: 3px; text-decoration: none; }
.view-option.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.view-note, .view-hidden { font-size: 0.8rem; color: var(--muted); margin: 0.3rem 0 0; }

.notice-block { border: 1px solid var(--line); border-radius: 4px; padding: 0.6rem 0.9rem; margin-bottom: 0.75rem; font-size: 0.9rem; background: var(--card); }
.notice-block h2 { font-size: 1rem; margin: 0 0 0.3rem; }
.notice-block ul { margin: 0 0 0 1.1rem; padding: 0; }
.carried-summary { border-color: var(--accent); background: #f6f7fb; }

.dropped li, .questions li, .warnings li { font-size: 0.9rem; margin-bottom: 0.2rem; }
.dropped .argument { font-weight: 600; }
.dropped .reason { color: var(--muted); }
.filelist.internal a { color: var(--warn); }

/* --- intake screen (agent A) --------------------------------------------- */
/* Upload box: drop target, the limits written out, and a progress bar. */
.uploadform {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.8rem;
  margin-top: 0.7rem;
}
.uploadform.dragging { border-color: var(--accent); background: #f2f7ff; }
.uploadform > label { font-weight: 600; display: block; margin-bottom: 0.2rem; }
.uploadform .limits { margin: 0.1rem 0 0.45rem; font-size: 0.85rem; }
.uploadform .drophint { margin: 0.35rem 0 0.5rem; font-size: 0.85rem; }

/* Refused files sit in their own titled block. Loose lines mixed into the rest
   of the list read as "accepted", and nothing here may be mistaken for that. */
.rejected-block {
  border-left: 3px solid var(--error);
  padding-left: 0.6rem;
  margin: 0.5rem 0;
}
.rejected-block .error-title { font-weight: 600; color: var(--error); margin: 0 0 0.25rem; }

/* Progress. htmx injects its own indicator rule using opacity, which hides the
   bar but still reserves its height, leaving an empty strip under every box.
   Visibility is set here instead: htmx puts the htmx-request class on whatever
   hx-indicator points at, for as long as the request runs. */
.progress.htmx-indicator { display: none; }
.progress.htmx-indicator.htmx-request { display: block; }

.progress {
  position: relative;
  height: 1.1rem;
  background: #eef0f3;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.4rem;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.15s linear;
}
/* When the browser cannot compute a total, no percentage is invented: the bar
   runs indeterminate instead. */
.progress-bar.indeterminate {
  width: 40%;
  animation: intake-slide 1.1s ease-in-out infinite;
}
@keyframes intake-slide {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}
.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--ink);
}

/* A required identity box is marked while it is still missing. */
.field-missing input { border-color: var(--error); }
.req { font-weight: 400; font-size: 0.8rem; color: var(--muted); }

/* Facet counts by elevation: four small number boxes side by side. */
.elevations { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.elevations .elevation { flex: 0 0 auto; }
.elevations .elevation input { width: 5rem; }

/* --- run screen: progress, failure, budget, cost, package (agent C) -------- */

/* Each block inside the run card is separated by a rule rather than a colour:
   the card is read top to bottom and the sections must not compete. */
.progress,
.failure,
.budget,
.cost,
.package {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}
.progress h3,
.failure h3,
.budget h3,
.cost h3,
.package h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.progress-step { margin: 0.2rem 0; }
.step-count {
  display: inline-block;
  min-width: 5.5rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.step-name { font-weight: 600; }

.failure { border-left: 3px solid var(--error); padding-left: 0.75rem; }
.failure .detail { margin-top: 0.5rem; }
.failure summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
/* The technical line wraps instead of stretching the card sideways. */
.detail-line {
  margin: 0.4rem 0 0;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.warning { color: var(--warn); }
.gone { color: var(--muted); text-decoration: line-through; }

/* The two file groups never share a frame. The carrier group and the group that
   must NOT reach the carrier are told apart by a heading and a border, not by a
   colour alone. */
.filegroup {
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.filegroup.carrier { border-left: 3px solid var(--ok); }
.filegroup.internal { border-left: 3px solid var(--warn); background: #fffdf6; }
.filegroup h4 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.filelist { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.filelist li { margin: 0.2rem 0; }
.filelist .muted { font-size: 0.8rem; margin-left: 0.4rem; }

.cost dd { font-variant-numeric: tabular-nums; }

.events { margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid var(--line); }
.events summary { cursor: pointer; font-weight: 600; }
.eventlist { margin: 0.5rem 0 0; padding-left: 1.2rem; font-size: 0.85rem; }
.eventlist li { margin: 0.15rem 0; }
.event-at { color: var(--muted); font-variant-numeric: tabular-nums; }
.event-status { font-weight: 600; margin: 0 0.35rem; }


/* -------------------------------------------------------------------------
   Top bar account controls.
   The sign-out control has to be a POST (a GET link would let any page sign
   the user out by embedding an image). It is styled to read as a link so the
   bar does not gain a heavy button.
   ------------------------------------------------------------------------- */
.topbar-account {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.linklike {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--muted, #5a6472);
  cursor: pointer;
  text-decoration: underline;
}

.linklike:hover,
.linklike:focus-visible {
  color: var(--ink, #101418);
}


/* -------------------------------------------------------------------------
   Identifiers spotted inside an uploaded file.
   Deliberately amber, not red: the file was accepted. Red is reserved for
   uploads that were refused, and blurring that line would make the
   contractor re-upload a file that is already in place.
   ------------------------------------------------------------------------- */
.sensitive-block {
  border: 1px solid var(--warn-line, #d7a03a);
  background: var(--warn-bg, #fdf6e6);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
}

.warn-title {
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--warn-ink, #7a5300);
}

ul.sensitive {
  margin: 0;
  padding-left: 1.1rem;
}

li.warn {
  color: var(--warn-ink, #7a5300);
}


/* -------------------------------------------------------------------------
   Footer legal links and the legal pages themselves.
   ------------------------------------------------------------------------- */
.footer-legal {
  margin-left: auto;
  color: var(--muted, #5a6472);
  font-size: 0.9rem;
}

.footer {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.legal {
  max-width: 46rem;
}

.legal h2 {
  margin-top: 1.6rem;
  font-size: 1.05rem;
}

.legal li {
  margin-bottom: 0.35rem;
}

.legal-nav {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line, #e2e6ea);
}


/* -------------------------------------------------------------------------
   What this file costs, shown before the button is pressed.
   Green when nothing is owed, amber when it is. Neither is red: owing money
   is not an error, and red here would read as "something went wrong".
   ------------------------------------------------------------------------- */
.charge-free {
  color: var(--ok-ink, #1d6b3a);
  font-weight: 600;
}

.charge-due {
  color: var(--warn-ink, #7a5300);
  font-weight: 600;
}

/* ===========================================================================
   THE PUBLIC PAGE

   A signed-out visitor lands here; a signed-in customer never sees it. The
   layout has one job: get a sceptical roofer from "what is this" to "I will
   try one file" without a single claim we cannot stand behind.
   =========================================================================== */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 2.5rem;
  align-items: center;
  padding: 1.5rem 0 2.5rem;
}

.hero h1 {
  font-size: clamp(1.7rem, 1.15rem + 2.1vw, 2.6rem);
  line-height: 1.16;
  letter-spacing: -0.028em;
  margin: 0 0 1rem;
  text-wrap: balance;
}

.hero-lede {
  font-size: 1.06rem;
  color: var(--ink-soft);
  max-width: 34rem;
  margin: 0 0 0.9rem;
}

.hero-actions {
  display: flex;
  gap: 1.1rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 1.5rem 0 0.85rem;
}

.hero-actions .primary { font-size: 1.02rem; padding: 0.72rem 1.4rem; }

.hero-fineprint {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
  max-width: 32rem;
}

.hero-art { margin: 0; }
.hero-art svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
}
.hero-art figcaption {
  font-size: 0.86rem;
  margin-top: 0.75rem;
  max-width: 26rem;
}

/* Numbered steps. The number is set in the accent and hung outside the text
   column so the sentences stay in one clean line down the page. */
ol.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
  max-width: var(--measure);
}
ol.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.05rem 2.6rem;
}
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.85rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
ol.steps > li:last-child { padding-bottom: 0; }
ol.steps strong { display: block; margin-bottom: 0.15rem; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.5rem 2.25rem;
}
.feature h3 { margin-top: 0; color: var(--ink); }
.feature p { color: var(--ink-soft); margin: 0; }

/* Price. The figure is large because it is the objection, and answering an
   objection quietly is the same as dodging it. */
.price-row {
  display: flex;
  gap: 2.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.price-tag {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 1rem 1.35rem;
  background: var(--accent-soft);
  border-radius: var(--radius);
  flex: none;
}
.price-figure {
  font-size: 2.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent-ink);
}
.price-unit { color: var(--accent-ink); font-weight: 600; }
.price-points { margin: 0; padding-left: 1.15rem; max-width: 34rem; }
.price-points li { margin-bottom: 0.45rem; }

.faq { margin: 0; max-width: var(--measure); }
.faq dt {
  font-weight: 650;
  margin-top: 1.15rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line-soft);
}
.faq dt:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.faq dd { margin: 0.3rem 0 0; color: var(--ink-soft); }

.closing { background: var(--card-sunk); }
.closing h2 { font-size: 1.3rem; max-width: 32rem; }

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    padding-top: 0.5rem;
  }
  /* The picture goes under the words on a phone. The headline is what a
     visitor arriving from an ad needs first. */
  .hero-art { order: 2; }
  .hero-copy { order: 1; }
  .hero-actions .primary { width: 100%; text-align: center; }
  .price-row { gap: 1.25rem; }
}

@media (max-width: 560px) {
  /* The tagline is dropped, not shrunk: at this width it pushes the sign-out
     control off the bar, and a customer who cannot sign out is a worse
     outcome than a customer who does not read the strapline twice. */
  .tagline { display: none; }
}

/* ===========================================================================
   BLOG

   Long-form reading, which is a different problem from the app: one column,
   a hard measure, and generous line spacing. The one thing that matters most
   here is that a contractor reading this on a phone in a truck can follow it.
   =========================================================================== */

.postlist { list-style: none; padding: 0; margin: 0; }
.postlist > li {
  padding: 1.25rem 0;
  border-top: 1px solid var(--line-soft);
}
.postlist > li:first-child { border-top: 0; padding-top: 0; }
.postlist.compact > li { padding: 0.5rem 0; }

.post-title {
  font-size: 1.12rem;
  font-weight: 650;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
}
.post-title:hover { color: var(--accent-ink); text-decoration: underline; }

.post-desc { color: var(--ink-soft); margin: 0.3rem 0 0.4rem; max-width: var(--measure); }
.post-meta { color: var(--muted); font-size: 0.86rem; margin: 0; }

.prose { max-width: 44rem; }
.prose > p,
.prose > ul,
.prose > ol,
.prose > blockquote { max-width: none; }
.prose p { margin: 0 0 1.05rem; line-height: 1.7; }
.prose h2 {
  font-size: 1.2rem;
  margin: 2rem 0 0.7rem;
}
.prose ul, .prose ol { margin: 0 0 1.05rem; padding-left: 1.3rem; }
.prose li { margin-bottom: 0.5rem; line-height: 1.65; }

/* Pull quotes carry the sentence a contractor would copy into the letter, so
   they are set apart rather than buried in the paragraph that explains them. */
.prose blockquote {
  margin: 1.3rem 0;
  padding: 0.9rem 1.15rem;
  border-left: 3px solid var(--accent);
  background: var(--card-sunk);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink);
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose .muted {
  font-size: 0.9rem;
  border-top: 1px solid var(--line-soft);
  padding-top: 1rem;
  margin-top: 2rem;
}

@media (max-width: 560px) {
  .prose { max-width: none; }
  .prose p, .prose li { line-height: 1.72; }
}

/* -------------------------------------------------------------------------
   Quick Entry block — the approved items in a form that can be typed or
   pasted into an estimating package. This is what stands in for a macro file:
   the structural macro schema is not published anywhere we could verify, and
   inventing it would produce a file that looks generated and does not open.

   Numbers and codes are set in the monospace face because they are measured
   values, not prose — and because a column of figures only reads as a column
   when the digits line up.
   ------------------------------------------------------------------------- */
.quickentry {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

table.qe {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.92rem;
}

table.qe th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 0 0.6rem 0.4rem 0;
  border-bottom: 1px solid var(--line);
}

table.qe td {
  padding: 0.42rem 0.6rem 0.42rem 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: baseline;
}

table.qe .mono {
  font-family: var(--mono);
  font-size: 0.88rem;
  white-space: nowrap;
}

/* A wide table must scroll inside its own box rather than pushing the page
   sideways — this screen gets opened on a phone. */
.quickentry table.qe { display: block; overflow-x: auto; }

.qe-plain {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: var(--card-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  overflow-x: auto;
  white-space: pre;
  margin: 0.6rem 0 0;
}

.quickentry summary {
  cursor: pointer;
  color: var(--accent-ink);
  font-size: 0.9rem;
}

/* -------------------------------------------------------------------------
   Tables inside an article.
   The state-by-state tables are wider than a phone. A wide table must scroll
   inside its own box; if the page body scrolls sideways instead, every
   paragraph on the page drifts off-screen with it and the article becomes
   unreadable one-handed — which is exactly where these get read.
   ------------------------------------------------------------------------- */
.prose table {
  display: block;
  overflow-x: auto;
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.92rem;
}

.prose th {
  text-align: left;
  font-weight: 650;
  padding: 0.5rem 0.9rem 0.5rem 0;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

.prose td {
  padding: 0.5rem 0.9rem 0.5rem 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

.prose tbody tr:last-child td { border-bottom: 0; }
