/*
 * Complete Roofing brand base stylesheet.
 * Tokens sourced live from https://completeroofing.com (2026-07-19); see docs/brand.md.
 * Self-contained, no CDN imports. Drop into a Jinja base.html <head>.
 *
 * Brand fonts:
 *   heading: D-DIN (Complete Roofing Design System, self-hosted below).
 *            Regular + Bold shipped under /static/fonts as .ttf; declared
 *            via @font-face after this comment. Replaces the earlier
 *            "Arial Narrow" fallback, which rendered condensed/tall.
 *   body:    system UI stack (sofia-pro was the paid original; the stack
 *            below approximates it and needs no external kit).
 * No external font CDN is wired here on purpose (never Typekit-load from a browser).
 *
 * Token system: usage-named custom properties, not raw brand-color names, so
 * every later template restyles by intent (--text, --accent, ...) rather than
 * by hue. Light tokens live on :root; dark overrides live on
 * :root[data-theme="dark"]. A manual toggle (#theme-toggle in base.html)
 * writes data-theme + localStorage; @media (prefers-color-scheme: dark) covers
 * users who never touch the toggle. The explicit [data-theme] rules are
 * declared after the media-query block below, so they always win.
 *
 * WCAG 2.2 contrast verified (see task-3-report.md for the full table):
 * every text/background pairing below is >= 4.5:1 in both themes.
 */

/* D-DIN webfont (self-hosted, Complete Roofing Design System). Regular +
   Bold cover every heading weight the app uses; font-display: swap paints
   the fallback immediately then swaps in D-DIN once loaded. */
@font-face {
  font-family: "D-DIN";
  src: url("/static/fonts/D-DIN.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "D-DIN";
  src: url("/static/fonts/D-DIN-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand hues (source of truth; only tokens below should be consumed by rules) */
  --brand-navy: #272D3D;
  --brand-blue: #8DBDDB;
  --brand-red: #AF1F24;

  /* Usage tokens: light (default) */
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --text: #272D3D;          /* navy body text; 13.16:1 on --bg */
  --text-muted: #5A6072;    /* muted navy; 6.0:1 on --bg */
  --accent: #AF1F24;        /* brand red; 6.9:1 as text on --bg */
  --accent-contrast: #FAFAFA; /* brand alabaster; label placed on --accent surfaces, 6.6:1 */
  --accent-hover: #AF1F24;  /* hover TEXT on --bg/--surface; already clears AA in light, so same as --accent */
  --link: #2C5878;          /* darkened brand blue so link text clears 4.5:1 (raw blue is 2.0:1) */
  --border: #D7DBE2;        /* decorative divider; not a text pairing */
  --danger: #AF1F24;        /* only one brand red; reused for error state */
  --focus: #2C5878;         /* focus ring; 7.57:1, well past the 3:1 UI-component floor */

  /* Error / validation component: caution-yellow box, same in both themes
     because the box always carries its own background+text (never relies on
     the surrounding page's light/dark surface). Chad's explicit brand call
     (2026-07-20): CTA buttons stay brand red (--accent); errors are yellow. */
  --danger-surface: #FFD166; /* caution yellow */
  --danger-text: #272D3D;    /* charcoal; ~9.6:1 on --danger-surface, clears WCAG 4.5:1 */
  --danger-border: #A6790A;  /* darker gold left-accent border/inset */

  /* Typography */
  --font-heading: "D-DIN", "DIN Alternate", "Helvetica Neue", Arial, sans-serif; /* self-hosted D-DIN, @font-face above */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif; /* sofia-pro fallback */

  /* Spacing scale (6px base, per hierarchy-layout.md) */
  --space-1: 6px;
  --space-2: 12px;
  --space-3: 18px;
  --space-4: 24px;
  --space-5: 36px;
  --space-6: 48px;

  /* Elevation */
  --shadow-low: 0 1px 3px rgba(39, 45, 61, 0.10);
  --shadow-high: 0 6px 12px rgba(39, 45, 61, 0.08);

  --button-radius: 3px;
}

/* Auto dark mode for users who never touch the toggle. An explicit
   [data-theme] attribute (below) always overrides this because it is
   declared later in the cascade. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1F2A;
    --surface: #242A38;
    --text: #F2F4F7;          /* 14.94:1 on --bg */
    --text-muted: #AEB6C4;    /* 8.06:1 on --bg */
    --accent: #AF1F24;        /* true brand red; alabaster label on it is 6.6:1, clears AA */
    --accent-contrast: #FAFAFA; /* brand alabaster label on the brand-red accent */
    --accent-hover: #FF6B6B;  /* hover TEXT on --surface (#242A38): 5.17:1. Brand red as text here would be 2.1:1, so the hover role gets its own token and the filled --accent stays untouched. */
    --link: #9CC7E0;          /* lightened brand blue; 9.14:1 on --bg */
    --border: #39415A;
    --danger: #AF1F24;
    --focus: #9CC7E0;
  }
}

/* Manual toggle always wins over the media query, in both directions. */
:root[data-theme="dark"] {
  --bg: #1B1F2A;
  --surface: #242A38;
  --text: #F2F4F7;
  --text-muted: #AEB6C4;
  --accent: #AF1F24;
  --accent-contrast: #FAFAFA;
  --accent-hover: #FF6B6B;  /* hover TEXT on --surface (#242A38): 5.17:1 */
  --link: #9CC7E0;
  --border: #39415A;
  --danger: #AF1F24;
  --focus: #9CC7E0;
}

:root[data-theme="light"] {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --text: #272D3D;
  --text-muted: #5A6072;
  --accent: #AF1F24;
  --accent-contrast: #FAFAFA;
  --accent-hover: #AF1F24;  /* light mode unaffected; same as --accent */
  --link: #2C5878;
  --border: #D7DBE2;
  --danger: #AF1F24;
  --focus: #2C5878;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 var(--space-1) 0;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header. Global nav lives here; account/logout is kept spatially separate
   (nav-sidebars.md: don't mix global account actions with page-level nav). */
header.site-header {
  background-color: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
}

header.site-header .site-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

header.site-header img.logo {
  display: block;
  height: 44px;
  width: auto;
}

header.site-header nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

header.site-header nav a {
  color: var(--text);
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.02em;
}

header.site-header nav a:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

.nav-home {
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
}

.nav-back {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1);
  color: var(--text);
}
.nav-back svg, .icon-back { width: 28px; height: 28px; }

.site-header__account {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-left: var(--space-3);
  border-left: 1px solid var(--border);
}

.site-header__account .user-email {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Theme toggle */
#theme-toggle {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  padding: 0.4em 0.7em;
  font-size: 0.9rem;
  cursor: pointer;
}

#theme-toggle:hover {
  border-color: var(--accent-hover);
  color: var(--accent-hover);
}

/* Theme toggle icon: show the affordance for the OTHER theme. */
#theme-toggle .icon-sun { display: none; }
#theme-toggle .icon-moon { display: inline-block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-toggle .icon-sun { display: inline-block; }
  :root:not([data-theme="light"]) #theme-toggle .icon-moon { display: none; }
}

:root[data-theme="dark"] #theme-toggle .icon-sun { display: inline-block; }
:root[data-theme="dark"] #theme-toggle .icon-moon { display: none; }

:root[data-theme="light"] #theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] #theme-toggle .icon-moon { display: inline-block; }

/* Hamburger account menu */
.account-menu { position: relative; }
.account-menu__trigger {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  color: var(--text);
  padding: var(--space-1);
  cursor: pointer;
  line-height: 0;
}
.account-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-1));
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  box-shadow: var(--shadow-high);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 20;
}
.account-menu__panel[hidden] { display: none; }
.account-menu__panel .user-email { color: var(--text-muted); }

/* Buttons / CTAs. .btn--primary (red) is the single primary emphasis per
   view; every other actionable control is .btn--secondary (neutral). */
.btn,
button,
input[type="submit"] {
  display: inline-block;
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  padding: 0.6em 1.4em;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.btn--primary {
  background-color: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
  text-transform: uppercase;
}

.btn--primary:hover {
  filter: brightness(0.92);
}

.btn--secondary {
  background-color: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn--secondary:hover {
  border-color: var(--text);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--surface);
}

table caption {
  font-family: var(--font-heading);
  color: var(--text);
  background: transparent;
  text-align: left;
  padding: var(--space-1) var(--space-2) 4px;
}

table th {
  font-family: var(--font-heading);
  color: var(--text-muted);
  background: transparent;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: var(--space-1) var(--space-2);
  border-bottom: 2px solid var(--accent);
}

table td {
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--border);
}

table tr:nth-child(even) td {
  background-color: var(--bg);
}

/* Alerts / flagged items */
.alert {
  border-left: 4px solid var(--accent);
  background-color: var(--surface);
  color: var(--text);
  padding: var(--space-2) var(--space-3);
}

/* Layout container */
main {
  max-width: 1100px;
  margin: var(--space-4) auto;
  padding: 0 var(--space-3);
}

/* Error / validation component. Caution-yellow box: the box always carries
   its own background+text so it reads on any backdrop, light or dark theme.
   .reject is the existing class already used in intake_form.html,
   job_detail.html, version_view.html, version_diff.html for validation/error
   text; it adopts this look so nothing that already renders .reject
   regresses. .alert--error is the same component under a clearer name for
   new call sites. The "!" marker keeps this non-color-alone per
   validation-and-error-messages.md (pair every error with a distinct icon,
   not color alone). */
.reject,
.alert--error {
  display: block;
  background-color: var(--danger-surface);
  color: var(--danger-text);
  border-left: 4px solid var(--danger-border);
  border-radius: var(--button-radius);
  padding: var(--space-2) var(--space-3);
  font-weight: 600;
  margin: var(--space-2) 0;
}
.reject::before,
.alert--error::before {
  content: "! ";
  font-weight: 700;
}
/* Icon variant: the form-level error summary (intake_form.html) gets an
   inline caution-triangle svg instead of the plain "!" text marker.
   Suppresses the shared ::before so the glyph doesn't double up with it. */
.reject--icon {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}
.reject--icon::before {
  content: none;
}
.reject--icon svg.error-icon {
  flex: 0 0 auto;
  width: 1.2em;
  height: 1.2em;
  margin-top: 0.15em;
  color: var(--danger-border);
}
.reject--icon .reject-body {
  flex: 1 1 auto;
}

.reject ul,
.alert--error ul { margin: var(--space-1) 0 0 var(--space-4); }

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, [type="checkbox"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Forms: intake form (job_intake / edit_job -> intake_form.html). Adds
   bottom padding so the sticky Generate bar never overlaps the last
   fieldset (form-simplification-and-redesign.md: consistent vertical
   rhythm; the bar's own height is reserved for, not just floated over). */
.intake-form { padding-bottom: var(--space-6); }
.intake-form fieldset {
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  margin: var(--space-3) 0;
  padding: var(--space-3) var(--space-4);
}
.intake-form legend { font-family: var(--font-heading); font-weight: 700; padding: 0 var(--space-1); }
.field { display: block; margin: var(--space-2) 0; }
.field-label { display: inline-flex; align-items: center; gap: var(--space-1); }
.field input, .field select {
  display: block; margin-top: var(--space-1); padding: 0.4rem 0.5rem;
  min-width: 14rem; max-width: 22rem;
  border: 1px solid var(--border); border-radius: var(--button-radius);
  background: var(--surface); color: var(--text);
}
.gated {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, max-content);
  gap: 0 var(--space-2);
  align-items: start;
}
.gate-value[hidden] { display: none; }

/* Penetrations + Ventilation: two Yes/No gated pairs per desktop row (screenshot
   review wanted 4 columns total -- question, answer, question, answer -- and
   narrower answer boxes so they sit beside their select). Each .gated cell is
   itself a 2-col select|value pair; the outer grid stacks two per row. */
.gated-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2) var(--space-5); align-items: start; }
.gated-grid .field input, .gated-grid .field select { min-width: 0; max-width: 100%; }
.gated-grid .gate-value input { max-width: 9rem; }

/* Inline per-field error echo (validation-and-error-messages.md: place the
   error directly below its offending field). Tighter than the form-level
   .reject summary box so it reads as a field annotation, not a second
   alert banner; same color/marker so it is still unmistakably an error. */
.field-error { padding: 0.35rem var(--space-2); margin: var(--space-1) 0 0 0; font-size: 0.9rem; max-width: 22rem; }
/* Inside a .gated 2-column row the inline error is a third grid item; span
   the full row so it doesn't collapse into one cell next to empty space. */
.gated .field-error { grid-column: 1 / -1; }

/* Job metadata: address (read-only) + optional claim number, ahead of the
   Shingle/Ventilation/etc. sections (form-simplification-and-redesign.md:
   consistent field grouping before the long form starts). */
.job-meta { margin-bottom: var(--space-3); }
.job-address { margin: 0 0 var(--space-2) 0; }


/* 2-column field grid for short sibling fields on desktop, collapsing to
   one column on narrow screens (text-fields-and-styling.md 2-col grid;
   the 640px breakpoint below handles collapse). */
.field-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, max-content);
  gap: 0 var(--space-2);
  align-items: start;
}

/* Slope checkbox column grid: 5 rows tall, wrap into columns. Checkboxes
   get a larger tap target per selection-controls.md (>=24x24, generous
   clickable padding around box + label, not just the box). */
.slope-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(5, auto); gap: var(--space-1) var(--space-4); }
.slope-grid label { white-space: nowrap; }
.slope-grid input[type="checkbox"] { transform: scale(1.2); margin-right: 0.3em; }

/* Worksheet display container (job_detail.html, version_view.html): the
   raw generated table needs its own surface + border inside the app
   shell, since print_worksheet.html's own <style> block only governs the
   clean letterhead PDF route, not this chrome-laden display
   (hierarchy-layout.md: fill containers with color rather than leaving
   them as bare outlines; wide tables scroll inside their own container). */
.worksheet {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0 var(--space-4) 0;
  overflow-x: auto;
}
.worksheet table { background: transparent; table-layout: fixed; width: 100%; }
.worksheet th, .worksheet td { padding: var(--space-1) var(--space-2); }
/* Shared column grid so the value + unit columns line up from section to
   section (mirrors the PDF): col 1 label, col 2 first value, col 3 second
   value; 2-column tables (Shingle) give their value cell the rest of the row
   but its text still starts at the same column. */
.worksheet th:nth-child(1), .worksheet td:nth-child(1) { width: 46%; }
.worksheet th:nth-child(2), .worksheet td:nth-child(2) { width: 27%; }
.worksheet th:nth-child(3), .worksheet td:nth-child(3) { width: 27%; }
.worksheet th:nth-child(2):last-child,
.worksheet td:nth-child(2):last-child { width: 54%; }
/* Clear vertical separation between worksheet sections (SQS, Roofing,
   Flashing, ...) -- feedback: sections read as cramped/contiguous without
   this; --space-6 (48px) makes "separate section" unambiguous at a glance. */
.worksheet h2 { margin-top: var(--space-6); }
/* Section labels (SQS, Demolition, ...) go brand-blue in DARK mode only --
   #8DBDDB reads well on the dark surface but washes out on the light one.
   Dual selector matches the theme pattern: @media covers auto-dark users,
   [data-theme="dark"] covers the explicit toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .worksheet h2 { color: var(--brand-blue); }
}
:root[data-theme="dark"] .worksheet h2 { color: var(--brand-blue); }

/* Job-detail page title: address is the heading (bold, but smaller than a
   default h1), the claim number rides directly beneath it in a smaller,
   muted line with tight spacing. This is the ONE place address+claim appear
   on the job-detail page; the worksheet body header below hides its own
   copy (see .worksheet--job rule). */
.job-title h1 { font-size: 1.4rem; line-height: 1.15; margin: 0; }
.job-claim { font-size: 0.9rem; color: var(--text-muted); margin: 0.15rem 0 0 0; }

/* On-page worksheet header: mirror the PDF's two-group layout. The emitter
   emits Address/Claim/Structures (list 1) and Eagleview Id/Date (list 2) as
   two <ul> groups; lay them side by side, second right-aligned, no bullets. */
.worksheet > ul:nth-of-type(1),
.worksheet > ul:nth-of-type(2) {
  display: inline-block; vertical-align: top; width: 49%;
  margin: 0 0 var(--space-2) 0; padding: 0; list-style: none;
}
.worksheet > ul:nth-of-type(2) { text-align: right; }
.worksheet > ul:nth-of-type(1) li,
.worksheet > ul:nth-of-type(2) li { margin: 0.1rem 0; }

/* On the job-detail page only, address + claim already show in the page
   title, so hide the body header's repeat of them (list 1 items 1 and 2).
   Tied to the emitter left-group order Address, Claim, Structures pinned by
   test_emit's golden test; version_view keeps its full header (its page
   title is "Version N", not the address). */
.worksheet--job > ul:nth-of-type(1) > li:nth-child(1),
.worksheet--job > ul:nth-of-type(1) > li:nth-child(2) { display: none; }

/* Type-to-confirm delete modal (base.html): a centered dialog over a dimmed
   overlay. The Delete button stays disabled until "delete" is typed. */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  padding: var(--space-4);
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  padding: var(--space-4);
  width: 100%; max-width: 30rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}
.modal h2 { margin: 0 0 var(--space-2) 0; }
.modal p { margin: 0 0 var(--space-3) 0; color: var(--text); }
.modal label { display: block; margin-bottom: var(--space-1); font-size: 0.9rem; }
.modal input[type="text"] { width: 100%; margin-bottom: var(--space-3); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }

/* Job list pager (job_list.html): Previous / Page N / Next, centered. */
.pager {
  display: flex; align-items: center; justify-content: center;
  gap: var(--space-3); margin: var(--space-3) 0;
}
.pager-page { color: var(--text-muted); font-size: 0.9rem; }

/* Action row: paired Print/Edit or Print/Back controls. Exactly one
   .btn--primary per view; the emphasized action sits on the right where a
   left-to-right scan ends (buttons-ctas.md grouped-button placement). */
.action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.version-meta { color: var(--text-muted); margin: 0 0 var(--space-3) 0; }

/* Version diff block (version_diff.html): monospace, high-density text so
   added/removed lines stay scannable (tables.md tabular-number/monospace
   guidance applied to a text diff; tooltips-disclosure.md readable-block
   treatment for a wall of comparison text). */
.diff {
  display: block;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  padding: var(--space-3) var(--space-4);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* Sticky bottom Generate bar: the primary submit stays reachable without
   scrolling back down a long form (form-simplification-and-redesign.md
   long-form guidance; the button is the sole .btn--primary on this page
   per the Task 3 contract). */
.form-actions--sticky {
  position: sticky;
  bottom: 0;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-4);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-high);
  border-radius: var(--button-radius);
}

/* Page header: title + primary action row (job_list.html). Top-left title
   carries priority, primary action sits right where the eye ends its scan
   (hierarchy-layout.md, buttons-ctas.md grouped-button placement). */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.page-header h1 { margin: 0; }

/* Jobs-list H1 only (job_list.html). Scoped to .page-title, NOT global h1
   or .page-header h1 -- those are shared by the job-detail address H1 and
   the new-job H1, which must stay mixed-case. */
.page-title { text-transform: uppercase; }

/* Auth panel: centered, focused single-column card (login.html,
   not_authorized.html). Real card treatment per hierarchy-layout.md
   (fill containers with color, don't leave them bare outlines) and
   auth-signup-login-onboarding.md (bigger bold title so users know which
   form they're on; center-aligned per the centered-dialog guidance). */
.auth-panel {
  max-width: 26rem;
  margin: var(--space-6) auto;
  padding: var(--space-5) var(--space-4);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  box-shadow: var(--shadow-low);
  text-align: center;
}
.auth-panel h1 { font-size: 1.4rem; }
.auth-panel p { color: var(--text-muted); margin: var(--space-2) 0 var(--space-3); }

/* Search form: inline accessible search + submit (job_list.html). Search and
   its submit stay merged in one row per tables.md (unify search and filter
   into a single field rather than separate controls). */
.search-form {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.search-form .field { margin: 0; flex: 1 1 auto; max-width: 24rem; }
.search-form input[type="search"] { width: 100%; }

/* Empty state: job-list no-jobs guidance block (job_list.html). Bounded
   surface with a dashed border reads as "nothing here yet", not an error;
   the CTA gives a next step per tables.md empty-filter-result guidance. */
.empty-state {
  display: block;
  background-color: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--button-radius);
  padding: var(--space-4);
  margin: var(--space-4) 0;
  text-align: center;
  color: var(--text-muted);
}
.empty-state .btn { margin-left: var(--space-2); }

/* Upload form: new_job.html file-upload card. */
.upload-form {
  max-width: 32rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  padding: var(--space-4);
}
.upload-form .field { margin: 0 0 var(--space-3) 0; }
.upload-form input[type="file"] {
  display: block;
  width: 100%;
  margin-top: var(--space-1);
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  background: var(--bg);
  color: var(--text);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: var(--space-6); padding: var(--space-3);
  color: var(--text-muted); font-family: var(--font-heading); font-size: 0.9rem;
}

/* Visually-hidden label (kept for screen readers; e.g. the delete column
   header, which is intentionally blank on screen). */
.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;
}

/* Per-row delete: a restrained destructive control at the far right of each
   jobs-list row. Muted by default so it never competes with the address link
   or the New Job CTA; fills brand red only on hover/focus to signal intent
   right before the native confirm() fires (buttons-ctas: destructive actions
   stay quiet until engaged). */
.col-delete { text-align: right; white-space: nowrap; width: 1%; }
.btn-delete {
  appearance: none;
  font: inherit; font-size: 0.85rem;
  padding: var(--space-1) var(--space-2);
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--button-radius);
  cursor: pointer;
}
.btn-delete:hover, .btn-delete:focus-visible {
  color: var(--accent-contrast);
  background: var(--danger); border-color: var(--danger);
}

/* Skip link */
.skip-link { position: absolute; left: -999px; }
.skip-link:focus {
  left: var(--space-2); top: var(--space-2);
  background: var(--surface); color: var(--text);
  padding: 0.5rem 0.75rem; z-index: 10;
  border: 1px solid var(--border);
}

/* htmx busy indicator */
.htmx-indicator { display: none; margin-left: var(--space-2); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

/* Responsive: collapse grids on narrow screens (no horizontal scroll) */
@media (max-width: 640px) {
  header.site-header { flex-wrap: wrap; }
  .gated { grid-template-columns: 1fr; }
  .gated-grid { grid-template-columns: 1fr; }
  .field-grid-2 { grid-template-columns: 1fr; }
  .slope-grid { grid-auto-flow: row; grid-template-rows: none; }
  .form-actions--sticky { flex-wrap: wrap; }
}

/* Print: the standalone print route (Task 2) generates the carrier PDF now,
   so the interactive page no longer fakes a clean print, just avoid a
   confusing chrome dump if a user still hits Cmd+P here. */
@media print {
  header, .site-footer, .skip-link { display: none; }
}
