/* ==========================================================================
   Munitown styles. One file, no build step. Light theme only.
   Sections: tokens, base, layout (resident), layout (admin), components,
   resident pages, admin pages, utilities, motion, print.
   Contrast notes (WCAG): ratios are against the background they sit on.
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Neutrals (slate) */
  --page: #f7f7f5;          /* warm off-white page */
  --surface: #ffffff;       /* cards */
  --surface-sunken: #f1f5f9;
  --text: #0f172a;          /* 16.6:1 on --page */
  --text-muted: #475569;    /* 7.1:1 on --page, 7.6:1 on white */
  --border: #e2e8f0;        /* decorative card edges */
  --border-strong: #64748b; /* form controls: 4.8:1 on white (>=3:1 UI) */

  /* Brand. A city's brand colour overrides these five from an inline <style> (src/brand.ts brandTheme),
     which keeps primary >=4.5:1 on white, --page and --primary-soft, and hover >=4.5:1 on soft and tint.
     Use the tokens for anything brand-coloured; never hard-code a blue. */
  --primary: #1d4ed8;       /* 6.7:1 on white; white text on it 6.7:1 */
  --primary-hover: #1e40af; /* 8.7:1 on white */
  --primary-soft: #eff6ff;
  --primary-tint: #dbeafe;
  --on-primary: #ffffff;

  /* Feedback: text colour / tinted background pairs */
  --success: #166534;  --success-bg: #f0fdf4;  --success-border: #86efac; /* 6.8:1 on bg */
  --warning: #92400e;  --warning-bg: #fffbeb;  --warning-border: #fcd34d; /* 6.8:1 on bg */
  --danger: #b91c1c;   --danger-bg: #fef2f2;   --danger-border: #fca5a5;  /* 5.9:1 on bg */
  --info: #1e40af;     --info-bg: #eff6ff;     --info-border: #93c5fd;    /* 8.0:1 on bg */

  /* Focus: a solid 3px --primary outline, 2px out, from the one global :focus-visible rule; form controls also take a --primary border */

  /* Shape and depth */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06);
  --shadow-md: 0 1px 2px rgb(15 23 42 / 0.06), 0 4px 12px rgb(15 23 42 / 0.06);
  --shadow-lg: 0 2px 4px rgb(15 23 42 / 0.06), 0 12px 32px rgb(15 23 42 / 0.10);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --tap: 48px;
}

/* --- Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background: var(--page);
  font-family: var(--font);
  font-size: 1.25rem; /* 20px resident base */
  line-height: 1.5;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
body.admin { font-size: 1.0625rem; display: block; }

main { width: 100%; max-width: 46rem; margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-7); flex: 1; }
main:focus { outline: none; }

h1, h2, h3 { color: var(--text); letter-spacing: -0.01em; }
h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 var(--space-4); font-weight: 750; }
h2 { font-size: 1.5rem; line-height: 1.25; margin: var(--space-6) 0 var(--space-3); font-weight: 700; }
h3 { font-size: 1.25rem; line-height: 1.3; margin: var(--space-5) 0 var(--space-2); }
p { margin: 0 0 var(--space-4); }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
/* Links inside a sentence need more than color to stand out from the text around them (WCAG 1.4.1),
   so they keep a faint underline that darkens on hover. The footer, back links, buttons and controls have none. */
:is(p, .checkbox, .legal, .form-legal, .notice, .muted, .hint, .address-credit):not(.site-footer *) a:not(.button, .eyebrow) {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}
:is(p, .checkbox, .legal, .form-legal, .notice, .muted, .hint, .address-credit):not(.site-footer *) a:not(.button, .eyebrow):hover { text-decoration-color: currentColor; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.skip-link {
  position: absolute; left: var(--space-2); top: -10rem; z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--text); color: #fff; border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--space-2); }

/* Only on the public demo (src/demo.ts), above every page. */
.demo-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-1) var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--surface-sunken); border-bottom: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.9375rem; text-align: center;
}
.demo-bar p { margin: 0; }
.demo-bar-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-1) var(--space-4); font-weight: 600; }

.svg-icon { width: 1.25em; height: 1.25em; flex: none; display: block; }

/* --- Layout: resident ----------------------------------------------------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.site-header-inner { max-width: 46rem; margin: 0 auto; padding: var(--space-3) var(--space-4); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.header-link { font-size: 1rem; font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap; }
.header-link:hover { color: var(--primary); }
.header-nav { display: flex; align-items: center; gap: var(--space-5); }
.header-nav .button { white-space: nowrap; }
/* A long web address goes on its own line and may break anywhere rather than run past the card. */
.web-address { display: block; overflow-wrap: break-word; }
.no-wrap, a[href^="tel:"]:not(.contact-card) { white-space: nowrap; }
@media (max-width: 46rem) { .header-nav .header-link { display: none; } }
@media (max-width: 40rem) {
  /* Both buttons fit beside the name on a 360px phone: Sign in loses its outline and the gaps shrink. */
  .header-nav, body.marketing .site-header-inner { gap: var(--space-2); }
  .header-nav .button { padding-inline: 0.75rem; }
  .header-nav .button-secondary { border-color: transparent; padding-inline: 0.5rem; }
}
/* Narrower still, Sign in stays in the footer only. */
@media (max-width: 22rem) { .header-nav .button-secondary { display: none; } }
.brand {
  display: inline-flex; align-items: center; gap: var(--space-3);
  min-height: var(--tap);
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.375rem;
}
.brand:hover { color: var(--text); }

.monogram {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2.5rem; height: 2.5rem;
  border-radius: var(--radius-sm);
  background: var(--primary); color: var(--on-primary);
  font-weight: 800; font-size: 1.25rem; line-height: 1;
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.15);
}
.monogram .svg-icon { width: 1.4rem; height: 1.4rem; }
.monogram-sm { width: 2rem; height: 2rem; font-size: 1rem; border-radius: 7px; }
.monogram-lg { width: 3.5rem; height: 3.5rem; font-size: 1.75rem; border-radius: var(--radius-md); }
/* Proportions of public/favicon.svg: the drawing fills 24 of its 32 units, with corners of 7. */
.brand-mark { border-radius: 22%; box-shadow: none; }
.brand-mark svg { width: 75%; height: 75%; }

/* An uploaded logo takes the monogram's place. Height is fixed, width follows the logo up to a cap. */
.logo { display: block; flex: none; height: 2.5rem; width: auto; max-width: 10rem; object-fit: contain; object-position: left center; }
.logo-sm { height: 2rem; max-width: 7rem; }
.logo-lg { height: 3.5rem; max-width: 7rem; }
.tile > .logo { grid-row: span 2; }

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1rem;
  text-align: center;
  padding: var(--space-5) var(--space-4);
}
.site-footer p { margin: 0 0 var(--space-1); }
.site-footer strong { color: var(--text); }

/* --- Layout: admin app shell ---------------------------------------------- */
.app-shell { min-height: 100vh; }
.sidebar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-4) 0;
}
.sidebar-brand {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 44px; margin-bottom: var(--space-2);
  color: var(--text); text-decoration: none; font-weight: 700;
}
.sidebar-brand:hover { color: var(--text); }
.sidebar-brand small { display: block; font-weight: 500; font-size: 0.8125rem; color: var(--text-muted); }
.side-nav ul {
  list-style: none; margin: 0; padding: 0 0 var(--space-2);
  display: flex; gap: var(--space-1);
  overflow-x: auto; scrollbar-width: thin;
}
.side-nav a {
  display: flex; align-items: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none; font-weight: 600; white-space: nowrap;
}
.side-nav a:hover { background: var(--surface-sunken); color: var(--text); }
.side-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-hover); }
.side-nav .nav-sep { display: none; }
.app-body { min-width: 0; }
/* Who is signed in, and Sign out: the foot of the sidebar on wide screens, the foot of the Menu panel on phones. */
.account { display: grid; gap: var(--space-2); font-size: 0.875rem; color: var(--text-muted); }
.account-row { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.account-avatar {
  flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-hover); font-weight: 700;
}
.account-who { margin: 0; flex: 1; min-width: 0; line-height: 1.3; }
.who-email { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 600; }
.account-role { display: block; font-size: 0.8125rem; }
.account .sign-out { margin: 0; }
.account-sign-out {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-muted); cursor: pointer;
}
.account-sign-out:hover { background: var(--surface-sunken); color: var(--text); }
.dev-badge { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
.legal h2 { font-size: 1.25rem; margin: var(--space-5) 0 var(--space-2); }
.legal ul { padding-left: 1.25rem; }
.legal li { margin-bottom: var(--space-2); }
.form-legal { margin: var(--space-3) 0 0; color: var(--text-muted); font-size: 1rem; }
.sign-in-card form + .form-legal, .sign-in-card form + form .form-legal { margin-top: var(--space-4); }
/* A form's submit button that reads as a link inside a sentence, with the same faint underline as links there. */
.link-button {
  display: inline; padding: 0; border: 0; background: none; font: inherit; color: var(--primary); cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}
.link-button:hover { color: var(--primary-hover); text-decoration-color: currentColor; }
.card.sign-in-card { max-width: 32rem; margin: var(--space-6) auto; }
.sign-in-account {
  display: flex; flex-direction: column; gap: 0.125rem; margin: 0 0 var(--space-5); padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-sunken); overflow-wrap: anywhere;
}
.sign-in-account-label { color: var(--text-muted); font-size: 0.875rem; }
body.admin main { max-width: 76rem; padding: var(--space-5) var(--space-4) var(--space-7); }

@media (min-width: 64rem) {
  .app-shell { display: grid; grid-template-columns: 16rem minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    border-bottom: 0; border-right: 1px solid var(--border);
    padding: var(--space-4) var(--space-3) 0;
  }
  .sidebar-brand { margin: 0 var(--space-2) var(--space-5); }
  .side-nav ul { flex-direction: column; overflow: visible; padding: 0; }
  .side-nav .nav-sep { display: block; height: 1px; background: var(--border); margin: var(--space-3) var(--space-2); }
  .sidebar { display: flex; flex-direction: column; }
  .nav-menu, .nav-panel { display: flex; flex-direction: column; flex: 1; }
  /* Stays at the foot when the menu is taller than the window, so Sign out is always in reach. The sidebar's bottom padding is here, so nothing shows under it. */
  .account {
    margin-top: auto; padding: var(--space-3) var(--space-2) var(--space-4); border-top: 1px solid var(--border);
    position: sticky; bottom: 0; background: var(--surface);
  }
  .side-nav { margin-bottom: var(--space-3); }
  body.admin main { padding: var(--space-6); margin: 0; }
}

/* --- Components: buttons -------------------------------------------------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap); min-width: var(--tap);
  padding: 0.5rem 1.25rem;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary); color: var(--on-primary);
  font: inherit; font-weight: 700; line-height: 1.2;
  text-align: center; text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.button:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); text-decoration: none; }
.button:focus-visible { background: var(--primary-hover); color: var(--on-primary); }
.button-secondary { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.button-secondary:hover, .button-secondary:focus-visible { background: var(--primary-soft); color: var(--primary-hover); }
.button-danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.button-danger:hover, .button-danger:focus-visible { background: var(--danger); color: #fff; border-color: var(--danger); }
.button-ghost { background: transparent; color: var(--primary); border-color: transparent; box-shadow: none; }
.button-ghost:hover, .button-ghost:focus-visible { background: var(--primary-soft); color: var(--primary-hover); border-color: transparent; }
.button-large { width: 100%; min-height: 72px; font-size: 1.375rem; border-radius: var(--radius-md); }
.button-block { width: 100%; }
.button-small { padding: 0.35rem 1rem; font-size: 1rem; box-shadow: none; }
.button-danger-solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.button-danger-solid:hover, .button-danger-solid:focus-visible { background: #991b1b; border-color: #991b1b; color: #fff; }
.button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.button-danger-solid:disabled:hover { background: var(--danger); border-color: var(--danger); }
body.admin .button { min-height: 44px; padding: 0.4rem 1rem; font-size: 0.9375rem; }
.button-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
ul.button-row { list-style: none; margin: 0; padding: 0; }
.center-row { justify-content: center; }

/* --- Components: cards ---------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-5);
  margin: 0 0 var(--space-5);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card-title { font-size: 1.25rem; margin: 0 0 var(--space-3); }
body.admin .card { padding: var(--space-5); border-radius: var(--radius-md); }
body.admin .card-title { font-size: 1.125rem; }
.card-footer { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.card-footer-form { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }
input.input-days { max-width: 8rem; }

.icon-tile {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 3.25rem; height: 3.25rem;
  border-radius: var(--radius-md);
  background: var(--primary-tint); color: var(--primary-hover);
}
.icon-tile .svg-icon { width: 1.75rem; height: 1.75rem; }
.icon-tile-sm { width: 2.25rem; height: 2.25rem; border-radius: var(--radius-sm); }
.icon-tile-sm .svg-icon { width: 1.25rem; height: 1.25rem; }

/* Icon picker: radio buttons shown as labeled icon tiles. The radio stays in the page for keyboards and screen readers. */
.icon-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: var(--space-2); }
.icon-option {
  position: relative; display: flex; align-items: center; gap: var(--space-2); margin: 0;
  padding: var(--space-2); border: 2px solid var(--border); border-radius: var(--radius-md);
  font-weight: 500; cursor: pointer; min-height: var(--tap);
}
.icon-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.icon-option:hover { border-color: var(--primary); }
.icon-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.icon-option:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }

/* --- Components: callouts and flash messages ------------------------------ */
.callout {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-4);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-md);
  background: var(--info-bg); color: var(--text);
  margin: 0 0 var(--space-5);
}
.callout > .svg-icon { width: 1.75rem; height: 1.75rem; margin-top: 0.1rem; color: var(--info); }
.callout p { margin: 0; }
.callout-title { display: block; }
.callout-danger { border-color: var(--danger-border); background: var(--danger-bg); }
.callout-danger > .svg-icon { color: var(--danger); }
.callout-warning, .notice { border-color: var(--warning-border); background: var(--warning-bg); }
.callout-warning > .svg-icon { color: var(--warning); }
.notice { border: 1px solid var(--warning-border); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); }

.flash {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid;
  box-shadow: var(--shadow-md);
  font-weight: 600;
}
.flash .svg-icon { width: 1.5rem; height: 1.5rem; }
.flash-ok { border-color: var(--success-border); background: var(--success-bg); color: var(--success); }
.flash-error { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger); }

/* --- Components: forms ---------------------------------------------------- */
label, legend { display: block; font-weight: 700; margin: 0 0 var(--space-1); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }
.field { margin-bottom: var(--space-5); }
.field:last-child { margin-bottom: 0; }
.hint { color: var(--text-muted); margin: 0 0 var(--space-2); }
.plan-bands { padding-left: var(--space-5); }
.req { font-weight: 500; color: var(--text-muted); }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="search"], input[type="date"], input[type="time"], input:not([type]), textarea, select {
  display: block; width: 100%;
  min-height: var(--tap);
  padding: 0.6rem 0.85rem;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff; color: var(--text);
  font: inherit;
  transition: border-color 0.15s;
}
input:hover, textarea:hover, select:hover { border-color: var(--text); }
/* The ring is the site-wide :focus-visible one: --primary is at least 4.5:1 on white and --page, past the 3:1 a focus
   indicator needs (#139). A faint 30% ring was about 1.6:1. Browsers show it when a text box is clicked too, but not
   when a checkbox, radio or select is clicked, so a mouse user gets only the border. */
:is(input, textarea, select):focus { border-color: var(--primary); }
textarea { min-height: 8rem; resize: vertical; }
/* iOS Safari sizes a native date or time box to its text and ignores width, so a time like 20:58 wrapped onto two
   lines. Without the native look it takes the width it is given; the value stays left-aligned like the other boxes. */
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; min-width: 0; text-align: left; }
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
select { appearance: none; padding-right: 2.5rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1.1rem; }
body.admin input[type="text"], body.admin input[type="email"], body.admin input[type="tel"], body.admin input[type="number"], body.admin input[type="search"],
body.admin input[type="date"], body.admin input[type="time"],
body.admin input:not([type]), body.admin textarea, body.admin select { min-height: 44px; padding: 0.45rem 0.75rem; }
body.admin select { padding-right: 2.25rem; }
body.admin label { font-size: 0.9375rem; }

.checkbox { display: flex; align-items: center; gap: var(--space-3); font-weight: 500; min-height: var(--tap); cursor: pointer; }
.checkbox input { width: 24px; height: 24px; flex: none; margin: 0; accent-color: var(--primary); }
/* A hint sits under its checkbox's text, lined up with it (#145). No overlap with the label, so a label that wraps stays
   readable and the whole tap target still toggles the box. */
.checkbox:has(+ .hint) { margin-bottom: 0; }
.checkbox + .hint { padding-left: calc(24px + var(--space-3)); }
.field input + .checkbox { margin-top: var(--space-2); }

.field-error { color: var(--danger); font-weight: 700; margin: 0 0 var(--space-2); }
[aria-invalid="true"] { border-color: var(--danger) !important; border-width: 3px; }

.error-summary {
  border: 4px solid var(--danger);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: var(--space-4) var(--space-5);
  margin: 0 0 var(--space-5);
}
/* app.js focuses the summary on load so screen readers announce it; it can't be tabbed to, and its border already marks it. */
.error-summary:focus { outline: none; }
.error-summary h2 { margin: 0 0 var(--space-2); font-size: 1.375rem; }
.error-summary ul { margin: 0; padding-left: 1.25rem; }
.error-summary a { color: var(--danger); font-weight: 700; text-decoration: underline; text-underline-offset: 0.15em; }

.form-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); margin-bottom: var(--space-4); }
.form-grid > div { min-width: 0; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-grid .name-field input { max-width: 24rem; }
.form-grid input + .hint { margin: var(--space-1) 0 0; }

/* A start or end: radios, then a date and an optional time side by side. Errors and the hint take a full row, so an error never pushes one box below the other. */
/* Indented under "On a date" with a rule, so the boxes read as part of that choice. */
.when-fields { display: flex; gap: var(--space-2) var(--space-3); flex-wrap: wrap; margin: var(--space-1) 0 0 10px; padding-left: calc(var(--space-4) + 4px); border-left: 4px solid var(--border); }
.when-fields > .field-error, .when-fields > .hint { flex: 1 0 100%; margin: 0; }
.when-pair { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr)); }
.when-date { flex: 1 1 11rem; max-width: 16rem; }
.when-time { flex: 1 1 9rem; max-width: 12rem; }
.when:has(input[value="now"]:checked) .when-fields, .when:has(input[value="removed"]:checked) .when-fields { display: none; }

/* Sign-in code: app.js draws boxes under the one real input, which stays on top, invisible, to take taps, paste and autofill. */
.code-boxes { position: relative; }
.code-boxes.is-enhanced input {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; min-height: 0;
  opacity: 0; font-size: 16px; cursor: text;
}
.code-box-row { display: flex; gap: var(--space-2); }
.code-box {
  display: flex; align-items: center; justify-content: center;
  flex: 1; min-width: 0; max-width: 3.5rem; aspect-ratio: 7 / 8;
  border: 2px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text);
  font-size: clamp(1.25rem, 6vw, 1.75rem); font-weight: 700; font-variant-numeric: tabular-nums;
  transition: border-color 0.15s;
}
.code-box:nth-child(3) { margin-right: var(--space-2); }
.code-boxes:hover .code-box { border-color: var(--text); }
.code-boxes .code-box.is-active {
  border-color: var(--primary);
  outline: 3px solid var(--primary); outline-offset: 2px;
}
.code-box.is-active:not(.is-filled)::after {
  content: ""; width: 2px; height: 1em; background: var(--text);
  animation: code-caret 1s step-end infinite;
}
@keyframes code-caret { 50% { opacity: 0; } }
.code-boxes + .hint { margin: var(--space-2) 0 0; font-size: 0.9375rem; }
.code-boxes:has([aria-invalid="true"]) .code-box { border-color: var(--danger) !important; border-width: 3px; }

.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.cf-turnstile { margin: var(--space-5) 0; }

/* --- Components: status pills (one map, keyed by Status) ------------------ */
.status {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.15em 0.7em 0.15em 0.55em;
  border: 1px solid var(--pill-border);
  border-radius: var(--radius-pill);
  background: var(--pill-bg); color: var(--pill-fg);
  font-weight: 700; font-size: 0.875em; line-height: 1.4; white-space: nowrap; vertical-align: middle;
}
.status-dot { width: 0.55em; height: 0.55em; border-radius: 50%; background: currentColor; flex: none; }
/* Text on pill background: submitted 7.4:1, acknowledged 7.2:1, in_progress 6.4:1, resolved 6.5:1, closed 8.4:1 */
.status-submitted    { --pill-fg: #6b21a8; --pill-bg: #f3e8ff; --pill-border: #d8b4fe; }
.status-acknowledged { --pill-fg: #1e40af; --pill-bg: #dbeafe; --pill-border: #93c5fd; }
.status-in_progress  { --pill-fg: #92400e; --pill-bg: #fef3c7; --pill-border: #fcd34d; }
.status-resolved     { --pill-fg: #166534; --pill-bg: #dcfce7; --pill-border: #86efac; }
.status-closed       { --pill-fg: #334155; --pill-bg: #e2e8f0; --pill-border: #cbd5e1; }
.status-closed .status-dot { border-radius: 2px; }

/* --- Admin inbox map view (#82) --- */
/* List vs. map toggle, next to the result count in the toolbar. */
/* Each end rounds itself, not overflow on the group, which would clip the focus outline (WCAG 2.4.7). */
.view-toggle { display: inline-flex; border: 1px solid var(--border, #cbd5e1); border-radius: 999px; }
.view-toggle a:first-child { border-radius: 999px 0 0 999px; }
.view-toggle a:last-child { border-radius: 0 999px 999px 0; }
.view-toggle a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; font-size: 0.9375rem; text-decoration: none; color: var(--text); }
.view-toggle a[aria-current] { background: var(--primary, #1d4ed8); color: var(--on-primary, #fff); font-weight: 600; }
body.admin .card.map-card { padding: 0; overflow: hidden; }
.admin-map { height: min(70vh, 640px); z-index: 0; }
/* Clusters drawn like the pins, dark with a white ring, instead of the plugin's pale greens and yellows, which
   nearly vanish on the map (WCAG 1.4.11). */
.admin-map :is(.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large) { background: rgb(255 255 255 / 0.85); }
.admin-map :is(.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large) div { background: #334155; color: #fff; font-weight: 700; }
.map-fallback { padding: 1rem; margin: 0; }
/* Settings' pages. Links, not ARIA tabs: each is its own page, and aria-current marks the one shown. */
.tabs { margin: 0 0 var(--space-5); }
.tabs ul { display: flex; flex-wrap: wrap; gap: 0 var(--space-1); margin: 0; padding: 0; list-style: none; box-shadow: inset 0 -1px 0 var(--border); }
.tabs a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-4); white-space: nowrap;
  color: var(--text-muted); font-weight: 600; text-decoration: none; border-bottom: 3px solid transparent;
}
.tabs a:hover { color: var(--text); border-bottom-color: var(--border-strong); }
.tabs a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:focus-visible { outline-offset: -3px; }
/* A list of links that sits behind a button on a phone and is always shown on wide screens: the Settings tabs and the
   Dashboard's date range. The button names the one chosen. It works without JavaScript. */
.section-menu-nav { position: relative; }
.section-menu > summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  min-height: 44px; padding: 0 var(--space-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-weight: 600; cursor: pointer; list-style: none;
}
.section-menu > summary::-webkit-details-marker { display: none; }
.section-menu > summary svg { flex-shrink: 0; color: var(--text-muted); transform: rotate(90deg); }
.section-menu[open] > summary { background: var(--surface-sunken); }
.section-menu[open] > summary svg { transform: rotate(-90deg); }
/* Phones: a wrapped row took two lines and left the mark on the one chosen floating; a scrolling one could hide it off screen. */
@media (max-width: 47.99rem) {
  .section-menu > .section-menu-list {
    position: absolute; top: calc(100% + var(--space-1)); left: 0; right: 0; z-index: 10;
    display: flex; flex-direction: column; flex-wrap: nowrap; gap: 0; padding: var(--space-2);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgb(15 23 42 / 0.12);
  }
  .section-menu > .section-menu-list a {
    display: flex; align-items: center; min-height: 44px; padding: 0 var(--space-2);
    border: 0; border-radius: var(--radius-sm); box-shadow: none; color: var(--text-muted); font-weight: 600; text-decoration: none;
  }
  .section-menu > .section-menu-list a:hover { background: var(--surface-sunken); color: var(--text); }
  .section-menu > .section-menu-list a[aria-current] { background: var(--primary-soft); color: var(--primary-hover); }
  .dash-toolbar > .section-menu-nav { flex-basis: 100%; }
}
/* Wide screens: the list is always shown. A browser without ::details-content keeps the button. */
@media (min-width: 48rem) {
  @supports selector(::details-content) {
    .section-menu > summary { display: none; }
    .section-menu::details-content { content-visibility: visible; display: contents; }
  }
}
.area-map { height: min(60vh, 420px); z-index: 0; margin: var(--space-3) 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.area-edges { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border); }
.area-edges h3 { font-size: 1rem; margin-top: 0; }
.location-edit > summary { font-weight: 600; color: var(--primary); cursor: pointer; padding: var(--space-2) 0; width: fit-content; }
.location-edit[open] > summary { margin-bottom: var(--space-2); }
/* Four edges: one row, or two rows of two. Never three and one. */
.form-grid.area-edge-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .form-grid.area-edge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Room for one line, so the fields below don't jump when the first message shows. */
.area-edges .location-status, .area-edges .location-status:empty { display: block; min-height: 1.5em; margin: 0 0 var(--space-3); }
.area-edge-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.area-edge-fields > legend { padding: 0; font-weight: 700; }
.area-map:has(> .map-fallback) { height: auto; }
.area-map.location-map:not(:has(> .map-fallback)) { height: 16rem; }
.location-form .location-status:not(:empty) { margin: 0 0 var(--space-3); }
/* Latitude and longitude stay side by side, down to a phone. */
.form-grid.location-place-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.location-form .checkbox { margin-bottom: var(--space-3); }
.location-form .field .button-row { margin-top: var(--space-2); }
.area-handle { background: #fff; border: 3px solid var(--primary); border-radius: 50%; box-shadow: 0 1px 4px rgb(0 0 0 / 0.4); cursor: grab; }
.area-handle:active { cursor: grabbing; }
.map-missing { padding: 0.75rem 1rem; margin: 0; font-size: 0.875rem; border-bottom: 1px solid var(--border); }
.admin-map + .map-missing { border-bottom: 0; border-top: 1px solid var(--border); }
.map-missing:only-child { border-bottom: 0; }
/* One pin per report; the fill matches the status badge's colors (same hexes as .status-* above). */
.map-pin { width: 18px !important; height: 18px !important; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 0 2px rgba(0, 0, 0, 0.5); }
.map-pin-submitted    { background: #6b21a8; }
.map-pin-acknowledged { background: #1e40af; }
.map-pin-in_progress  { background: #92400e; }
.map-pin-resolved     { background: #166534; }
.map-pin-closed       { background: #334155; }
/* Scoped to the map so these win over leaflet.css, which app.js injects after this file. */
.admin-map .leaflet-popup-content { font: inherit; font-size: 0.875rem; line-height: 1.4; }
.admin-map .leaflet-popup-content p { margin: 0.2rem 0; }
.map-popup-code a { font-weight: 700; }

/* --- Components: timeline ------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline > li { position: relative; padding: 0 0 var(--space-5) 2.25rem; }
.timeline > li::before { /* rail */
  content: ""; position: absolute; left: 0.6rem; top: 1.4rem; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li:last-child::before { display: none; }
.timeline > li::after { /* node */
  content: ""; position: absolute; left: 0.2rem; top: 0.45rem;
  width: 0.9rem; height: 0.9rem; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--primary);
}
.event-date { display: block; color: var(--text-muted); font-size: 0.875em; font-weight: 600; }
.event-message {
  margin: var(--space-2) 0 0; white-space: pre-wrap;
  background: var(--surface-sunken); border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
}

/* --- Components: definition list ----------------------------------------- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-3) var(--space-5); margin: 0; }
.facts dt { font-weight: 700; color: var(--text-muted); }
.facts dd { margin: 0; min-width: 0; }
.pre { white-space: pre-wrap; }
@media (max-width: 30rem) {
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: var(--space-3); }
}

/* --- Resident: home ------------------------------------------------------- */
.hero { padding: var(--space-6) var(--space-5); }
.hero h1 { font-size: clamp(1.875rem, 6vw, 2.5rem); }
.hero-lead { font-size: 1.375rem; color: var(--text-muted); }
.action-list { list-style: none; padding: 0; margin: var(--space-5) 0 0; display: grid; gap: var(--space-3); }
.action-list .svg-icon { width: 1.6rem; height: 1.6rem; }

.contact-card {
  display: flex; align-items: center; gap: var(--space-4);
  min-height: 72px; padding: var(--space-4) var(--space-5);
  color: var(--text); text-decoration: none;
}
.contact-card:hover { color: var(--text); border-color: var(--primary); }
.contact-card .icon-round { color: var(--primary-hover); background: var(--primary-tint); }
.contact-label { display: block; color: var(--text-muted); }
/* A number too wide for a phone wraps between its parts, like (616), 555-0123 and ext. 12, and only splits a part that alone is too wide. */
.contact-number { display: block; font-size: 1.5rem; font-weight: 750; color: var(--primary); overflow-wrap: anywhere; }
.contact-number > span { display: inline-block; }
.icon-round {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 3rem; height: 3rem; border-radius: 50%;
}
.icon-round .svg-icon { width: 1.5rem; height: 1.5rem; }

.how-it-works { list-style: none; padding: 0; margin: var(--space-4) 0 var(--space-5); display: grid; gap: var(--space-3); }
.how-it-works li {
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}
.how-num {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); font-weight: 800;
}
@media (min-width: 40rem) {
  .how-it-works { grid-template-columns: repeat(3, 1fr); }
  .how-it-works li { flex-direction: column; text-align: center; padding: var(--space-4); }
}
.section-label { font-size: 1.25rem; margin: var(--space-6) 0 0; }

/* --- Marketing landing page ----------------------------------------------- */
body.marketing main, body.marketing .site-header-inner { max-width: 68rem; }
/* The hero's tinted band runs edge to edge while its content stays in the page column. */
.mkt-hero {
  display: grid; gap: var(--space-6); align-items: center;
  margin: calc(-1 * var(--space-5)) 0 var(--space-6); padding: var(--space-7) 0;
  background: var(--primary-soft); box-shadow: 0 0 0 100vmax var(--primary-soft); clip-path: inset(0 -100vmax);
}
.mkt-hero h1 { font-size: clamp(2.25rem, 5.5vw, 3.25rem); line-height: 1.08; letter-spacing: -0.02em; }
.mkt-hero .hero-lead { color: var(--text); max-width: 34rem; }
.mkt-hero-note { margin: var(--space-4) 0 0; color: var(--text-muted); font-weight: 600; }
.mkt-preview { box-shadow: var(--shadow-lg); border-radius: var(--radius-lg); }
.mkt-preview-city { display: flex; align-items: center; gap: var(--space-2); font-weight: 700; padding-bottom: var(--space-3); margin: 0 0 var(--space-3); border-bottom: 1px solid var(--border); }
.mkt-preview-title { font-weight: 700; }
.mkt-section-lead { color: var(--text-muted); font-size: 1.1875rem; margin-top: 0; }
.mkt-pricing { margin: var(--space-7) 0; scroll-margin-top: var(--space-5); }
#how { scroll-margin-top: var(--space-5); }
.mkt-pricing-grid { display: grid; gap: var(--space-4); align-items: stretch; }
.price-card { margin: 0; padding: var(--space-6); display: flex; flex-direction: column; }
.price-card .button { margin-top: auto; }
.price-card h3 { margin: 0 0 var(--space-3); font-size: 1.25rem; }
.price { margin: 0; color: var(--text-muted); font-weight: 600; }
.price-amount { font-size: 3rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.price-alt { margin: 0 0 var(--space-2); color: var(--text-muted); }
.price-card .price { margin-bottom: var(--space-5); }
.price-included { margin: var(--space-4) 0 0; padding: var(--space-5) var(--space-6); }
.price-included h3 { margin: 0 0 var(--space-3); font-size: 1.125rem; }
.price-included .check-list { margin: 0; }
.mkt-compare-note { margin: var(--space-5) 0 0; color: var(--text-muted); }
.price-card-quiet { background: var(--surface-sunken); box-shadow: none; }
.price-card-quiet p { color: var(--text-muted); }
.check-list { list-style: none; padding: 0; margin: 0 0 var(--space-5); display: grid; gap: var(--space-2); }
.check-list li { display: flex; align-items: flex-start; gap: var(--space-2); }
.check-list .svg-icon { color: var(--success); margin-top: 0.2em; }
/* Phones: a shorter hero, so how it works and pricing are closer to the top. */
@media (max-width: 40rem) {
  .mkt-hero .hero-lead { font-size: 1.1875rem; }
  .mkt-hero .button-row .button { width: 100%; }
}
.mkt-preview-scroll {
  height: 17rem; overflow: hidden;
  mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent);
}
/* Phones: about three rows, so the hero stays short. */
@media (max-width: 40rem) { .mkt-preview-scroll { height: 12rem; } }
.mkt-preview-track { animation: mkt-preview-scroll 40s linear infinite; }
.mkt-preview:hover .mkt-preview-track { animation-play-state: paused; }
@keyframes mkt-preview-scroll { to { transform: translateY(-50%); } }
/* Each copy ends with one gap's padding, so sliding up by half the track lands exactly on the second copy. */
.mkt-preview ul { list-style: none; padding: 0 0 var(--space-2); margin: 0; display: grid; gap: var(--space-2); }
.mkt-preview-note { margin: var(--space-3) 0 0; color: var(--text-muted); font-size: 0.9375rem; }
.mkt-preview li {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.mkt-features { list-style: none; padding: 0; margin: var(--space-4) 0 var(--space-6); display: grid; gap: var(--space-4); }
.mkt-features .card { margin: 0; }
.mkt-features h3 { margin: var(--space-3) 0 var(--space-2); }
.mkt-features p { color: var(--text-muted); font-size: 1.0625rem; }
.mkt-features .icon-round { color: var(--primary-hover); background: var(--primary-tint); }
.mkt-cta .button-row { justify-content: center; }
.mkt-cta { text-align: center; background: var(--primary-soft); border-color: var(--primary-tint); }
.mkt-eyebrow { margin: 0 0 var(--space-3); color: var(--primary-hover); font-size: 0.9375rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.mkt-faq { margin: var(--space-7) 0; }
.mkt-faq .card { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.mkt-faq details + details { border-top: 1px solid var(--border); }
.mkt-faq summary { padding: var(--space-4) 0; font-size: 1.125rem; font-weight: 700; cursor: pointer; }
.mkt-faq details p { margin: 0 0 var(--space-4); color: var(--text-muted); font-size: 1.0625rem; max-width: 46rem; }
.card.start-card { max-width: 36rem; margin: var(--space-6) auto; }
.request-list { list-style: none; padding: 0; margin: var(--space-4) 0 var(--space-6); display: grid; gap: var(--space-4); }
.request-list .card { margin: 0; }
.request-card { display: grid; gap: var(--space-5); }
@media (min-width: 52rem) { .request-card { grid-template-columns: minmax(14rem, 18rem) minmax(0, 34rem); gap: var(--space-6); } }
.request-who h3 { margin: 0 0 var(--space-2); font-size: 1.125rem; }
.request-who p { margin: 0 0 var(--space-1); overflow-wrap: anywhere; }
.request-card .field { margin-bottom: var(--space-4); }
/* Health panel on the cities page: compact, so the cities stay near the top. */
.health-card { margin-bottom: var(--space-5); }
.health-jobs { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
.health-alerts { border-top: 1px solid var(--border); }
.health-alerts .item-row > div { flex: 1 1 20rem; min-width: 0; }
.health-alerts h3 { font-size: 1rem; margin: 0 0 var(--space-1); }
.health-alerts p { margin: 0 0 var(--space-1); overflow-wrap: anywhere; }
.tag.tag-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.tag.tag-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.feedback-list .item-row { align-items: flex-start; }
.feedback-list .item-row > div { flex: 1 1 20rem; min-width: 0; }
.feedback-list p { margin: 0 0 var(--space-1); overflow-wrap: anywhere; }
.feedback-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); }
.feedback-list .feedback-message { margin: var(--space-2) 0; white-space: pre-wrap; }
.feedback-browser { font-size: 0.8125rem; }
/* A message box as wide as the page is hard to read and write in. */
.feedback-form, .card.feedback-sent { max-width: 48rem; }
.input-suffix { display: flex; }
.input-suffix input { min-width: 0; flex: 1; }
.input-suffix input:has(+ span) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-suffix span { display: flex; align-items: center; padding: 0 var(--space-3); border: 2px solid var(--border-strong); border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-sunken); color: var(--text-muted); white-space: nowrap; }
.input-suffix [aria-invalid="true"] + span { border-color: var(--danger); border-width: 3px; border-left: 0; }
/* On a phone the domain would take a third of the row, so it goes under the box. After the rule above, which it changes. */
@media (max-width: 30rem) {
  .input-suffix { flex-direction: column; }
  .input-suffix input:has(+ span) { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
  .input-suffix span { padding: var(--space-1) var(--space-3); border: 2px solid var(--border-strong); border-top: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
  .input-suffix [aria-invalid="true"] + span { border-width: 3px; border-top: 0; }
}
/* Saved replies: the picker sits above the message box it fills. */
.saved-reply-picker { margin-bottom: var(--space-4); }
/* The Use button drops below a select too narrow to show its chosen reply's name (WCAG 1.4.10). */
.saved-reply-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.saved-reply-row select { min-width: 0; max-width: 100%; flex: 1 0 14rem; }
/* Comparison pages: our column beside another vendor's. On a phone each topic stacks, with the product named above its cell.
   The table's roles are written in the markup, since display: block would otherwise hide that it is a table from screen readers. */
.compare-card { padding: 0; overflow: hidden; }
.compare-table th, .compare-table td { vertical-align: top; white-space: normal; }
.compare-table thead th { position: static; }
.compare-table tbody tr:last-child th { border-bottom: 0; }
/* Nothing in a row can be clicked, so it does not light up like the admin's tables. */
.compare-table tbody tr:hover td { background: transparent; }
.compare-table th[scope="row"] { width: 22%; }
.compare-table thead th:not(:first-child) { width: 39%; }
.compare-sources { color: var(--text-muted); font-size: 0.9375rem; overflow-wrap: anywhere; }
.compare-source { display: block; margin-top: var(--space-1); color: var(--text-muted); font-size: 0.875rem; overflow-wrap: anywhere; }
@media (max-width: 40rem) {
  .compare-table, .compare-table tbody, .compare-table tr, .compare-table th[scope="row"], .compare-table td { display: block; width: auto; }
  .compare-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .compare-table tr { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
  .compare-table tr:last-child { border-bottom: 0; }
  .compare-table th[scope="row"], .compare-table td { border: 0; padding-block: var(--space-1); }
  .compare-table th[scope="row"] { font-size: 1.0625rem; }
  .compare-table td::before { content: attr(data-label); display: block; font-weight: 700; font-size: 0.875rem; color: var(--text-muted); }
}
/* Screenshots under How it works. The map is cropped to the top of its page, and the phone shot is taken at its frame's
   size (resident-form-top in src/help-shots.ts). The column widths keep the two frames the same height. */
.mkt-shots { display: grid; gap: var(--space-5); margin: 0 0 var(--space-6); align-items: start; }
.mkt-shot { margin: 0; }
.mkt-shot-frame {
  overflow: hidden; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.mkt-shot-frame img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.mkt-shot-phone { max-width: 18rem; margin-inline: auto; }
.mkt-shot-phone .mkt-shot-frame { aspect-ratio: 430 / 800; border-radius: 1.75rem; border-width: 6px; border-color: var(--text); }
.mkt-shot-desktop .mkt-shot-frame { aspect-ratio: 1280 / 880; border-radius: var(--radius-lg); }
.mkt-shot figcaption { margin-top: var(--space-3); color: var(--text-muted); font-size: 1.0625rem; text-align: center; }
@media (min-width: 52rem) {
  .mkt-shots { grid-template-columns: minmax(0, 1fr) minmax(0, 2.71fr); }
  .mkt-shot-phone { max-width: none; }
}
.mkt-resident-note { text-align: center; color: var(--text-muted); font-size: 1.0625rem; }
@media (min-width: 52rem) {
  .mkt-hero { grid-template-columns: 1.4fr 1fr; }
  .mkt-pricing-grid { grid-template-columns: repeat(2, 1fr); }
  .price-included .check-list { grid-template-columns: repeat(2, 1fr); }
  .mkt-features { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* --- Help (/help) ----------------------------------------------------------- */
.help { max-width: 48rem; margin: 0 auto; }
.help h2 { font-size: 1.375rem; margin: var(--space-6) 0 var(--space-3); }
.help :is(ul, ol):not(.help-index) { padding-left: 1.25rem; }
.help li { margin-bottom: var(--space-2); }
.help-group h2 { margin-top: var(--space-6); }
.help-index { list-style: none; padding: 0; display: grid; gap: var(--space-3); }
.help-index li { margin: 0; display: grid; }
.help-index a {
  display: grid; align-content: start; gap: var(--space-1); padding: var(--space-4); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--text);
}
.help-index a:hover { border-color: var(--primary); }
.help-index strong { color: var(--primary); font-size: 1.125rem; }
.help-index span { color: var(--text-muted); }
.help-shot { margin: var(--space-4) 0 var(--space-5); }
.help-shot img {
  display: block; max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
}
.help-shot figcaption { margin-top: var(--space-2); color: var(--text-muted); font-size: 0.9375rem; }
.help-shot-phone { max-width: 18rem; }
.help-home { max-width: 68rem; }
.help-index li:only-child { grid-column: 1 / -1; }
@media (min-width: 48rem) { .help-index { grid-template-columns: 1fr 1fr; } }
.help-shots-row { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); align-items: start; }
.help-shots-row .help-shot { margin: var(--space-4) 0 0; max-width: none; }
.help-table { width: 100%; border-collapse: collapse; margin: var(--space-3) 0 var(--space-4); font-size: 1rem; }
.help-table :is(th, td) { text-align: left; vertical-align: top; padding: var(--space-3); border-bottom: 1px solid var(--border); }
.help-table th { color: var(--text-muted); font-weight: 600; }
/* Admin table headings stay on one line and stick to the top. Here they wrap, or three columns are wider than a phone. */
.help-table thead th { white-space: normal; position: static; }
@media (max-width: 40rem) { .help-table :is(th, td) { padding: var(--space-2); } }
/* The smallest phones: the status pill can't wrap, so the whole table is a little smaller. */
@media (max-width: 22rem) { .help-table { font-size: 0.875rem; } }
.help-pager { display: flex; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--border); }
.help-pager a { display: grid; gap: var(--space-1); font-weight: 600; text-decoration: none; }
.help-pager span { color: var(--text-muted); font-size: 0.875rem; font-weight: 400; }
.help-pager-next { text-align: right; margin-left: auto; }

/* --- One-page overview (/overview) ---------------------------------------- */
/* Sized in inches and points so the screen shows the same letter page that prints. Phones get it in one column. */
.sheet-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin: 0 0 var(--space-5); }
.sheet {
  box-sizing: border-box; width: 8.5in; max-width: 100%; margin: 0 auto var(--space-6); padding: 0.4in 0.55in;
  background: #fff; color: var(--text); box-shadow: var(--shadow-lg); font-size: 9pt; line-height: 1.34;
}
.sheet :where(h1, h2, h3, p, ul, ol) { margin: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12pt; padding-bottom: 8pt; border-bottom: 2pt solid var(--primary); }
.sheet-brand { display: flex; align-items: center; gap: 6pt; font-size: 15pt; font-weight: 800; }
.sheet-tagline { color: var(--text-muted); font-weight: 600; }
.sheet h1 { margin-top: 12pt; font-size: 19pt; line-height: 1.12; letter-spacing: -0.01em; }
.sheet-lead { margin-top: 5pt; font-size: 10pt; }
.sheet-steps { list-style: none; padding: 0; margin-top: 10pt; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8pt; }
.sheet-steps li { display: flex; align-items: center; gap: 6pt; padding: 4pt 7pt; line-height: 1.25; background: var(--primary-soft); border-radius: 6pt; font-weight: 600; }
.sheet-steps .how-num { width: 18pt; height: 18pt; font-size: 9pt; }
.sheet-group { margin-top: 9pt; }
.sheet h2 { font-size: 10pt; text-transform: uppercase; letter-spacing: 0.06em; color: var(--primary-hover); padding-bottom: 3pt; border-bottom: 0.75pt solid var(--border); }
.sheet-features { list-style: none; padding: 0; margin-top: 6pt; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6pt 14pt; }
.sheet-features h3 { display: flex; align-items: center; gap: 4pt; font-size: 9.5pt; }
.sheet-features h3 .svg-icon { width: 11pt; height: 11pt; color: var(--primary); flex: none; }
.sheet-features p { margin-top: 1pt; color: var(--text-muted); }
.sheet-pricing { margin-top: 9pt; }
.sheet-pricing > p { margin-top: 5pt; }
.sheet-pricing-grid { display: grid; gap: 7pt; margin-top: 6pt; }
.sheet-foot p { display: grid; }
.sheet-foot span { color: var(--text-muted); font-size: 8pt; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.sheet-plans { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8pt; }
.sheet-plans li { display: grid; padding: 6pt 8pt; border: 0.75pt solid var(--border); border-radius: 6pt; }
.sheet-plans span:not(.sheet-price) { color: var(--text-muted); }
.sheet-foot a { font-weight: 700; color: var(--text); }
.sheet-price { margin-top: 2pt; font-size: 13pt; font-weight: 800; font-variant-numeric: tabular-nums; }
.sheet .check-list { grid-template-columns: repeat(3, auto); justify-content: space-between; gap: 3pt 12pt; margin: 0; }
.sheet .check-list .svg-icon { width: 10pt; height: 10pt; }
.sheet-foot { display: flex; justify-content: space-between; gap: 14pt; margin-top: 9pt; padding-top: 7pt; border-top: 2pt solid var(--primary); font-size: 9.5pt; }
@media screen and (max-width: 52rem) {
  .sheet { width: auto; padding: var(--space-5); font-size: 1rem; box-shadow: none; border: 1px solid var(--border); border-radius: var(--radius-md); }
  .sheet-head, .sheet-foot { flex-direction: column; align-items: flex-start; }
  .sheet h1 { font-size: 1.625rem; }
  .sheet :is(.sheet-lead, .sheet-features h3, .sheet-price) { font-size: 1.0625rem; }
  .sheet h2 { font-size: 0.9375rem; }
  .sheet-steps, .sheet-features, .sheet-plans, .sheet .check-list { grid-template-columns: 1fr; }
}
@media print {
  @page sheet { size: letter; }
  body:has(.sheet) main > :not(.sheet) { display: none !important; }
  body:has(.sheet) main { max-width: none; padding: 0; margin: 0; }
  .sheet { page: sheet; margin: 0; box-shadow: none; border: 0; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* --- Resident: city picker and category grid ------------------------------ */
.card-grid { list-style: none; padding: 0; margin: var(--space-5) 0; display: grid; gap: var(--space-3); }
@media (min-width: 40rem) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); } }
.card-grid > li { display: flex; }

.tile {
  flex: 1;
  display: grid; grid-template-columns: auto 1fr auto; column-gap: var(--space-4); align-items: center;
  min-height: 88px; padding: var(--space-4);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--text); text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.tile:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); color: var(--text); transform: translateY(-1px); }
.tile:focus-visible { border-color: var(--primary); background: var(--surface); color: var(--text); border-radius: var(--radius-lg); }
.tile > .icon-tile, .tile > .monogram { grid-row: span 2; }
.tile-text { grid-row: span 2; min-width: 0; }
.tile-name { display: block; font-weight: 700; font-size: 1.25rem; line-height: 1.3; color: var(--primary); }
.tile-description { display: block; color: var(--text-muted); line-height: 1.4; margin-top: 0.15rem; }
.tile-chevron { grid-row: span 2; color: var(--text-muted); }
.tile:hover .tile-chevron { color: var(--primary); }

/* --- Resident: report form ------------------------------------------------ */
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: 0 0 var(--space-4); }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-2);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--shadow-sm);
  font-weight: 700;
}
.chip .icon-tile { border-radius: 50%; }
.chip-row a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--space-2); font-weight: 600; }

.form-card { padding: var(--space-5); }
/* A long form reads best in one narrow column, not stretched across the admin page. */
body.admin .form-card { max-width: 46rem; }
@media (min-width: 40rem) { .form-card { padding: var(--space-6); } }
.form-section { padding: var(--space-5) 0; border-top: 1px solid var(--border); }
.form-section:not(.form-section ~ .form-section) { border-top: 0; padding-top: 0; }
/* A legend sits on its fieldset's top border and breaks the line. Floated, it goes inside like any heading. */
fieldset.form-section > legend { float: left; width: 100%; }
fieldset.form-section > legend + * { clear: both; }
.section-heading { display: flex; align-items: center; gap: var(--space-3); font-size: 1.375rem; margin: 0 0 var(--space-2); }
.section-heading label { margin: 0; font-size: inherit; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--primary); color: var(--on-primary);
  font-size: 1.125rem; font-weight: 800;
}
.form-section .button-secondary { margin-top: var(--space-3); }
.location-status:empty { display: none; }
.location-status { color: var(--text-muted); margin: var(--space-3) 0 0; }
.location-added { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-height: var(--tap); margin: var(--space-2) 0 0; font-weight: 600; }
.location-added > .svg-icon { color: var(--success); }
.located-line { flex: 1 1 0; min-width: 0; }
/* Its padding would make each wrapped line of the sentence tall; the line itself keeps the full tap height. */
.located-line .text-button { padding-top: 0; padding-bottom: 0; }
/* A button that reads as a link: it sits in a line of text, so it keeps the in-sentence underline. */
.text-button {
  appearance: none; background: none; border: 0; padding: var(--space-2) var(--space-1); margin: 0;
  font: inherit; color: var(--primary); cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}
.text-button:hover { color: var(--primary-hover); text-decoration-color: currentColor; }
.address-credit { flex-basis: 100%; font-size: 0.875rem; font-weight: 400; color: var(--text-muted); }
p.address-credit { margin: var(--space-3) 0 0; }
/* Shown only to a visitor whose link names it, with app.js off. */
.moved-note:not(:target) { display: none; }
/* A link to one part of a help page lands with the heading clear of the top of the window. */
.help h2[id] { scroll-margin-top: var(--space-5); }

.dropzone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
  border: 3px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
  transition: border-color 0.15s, background-color 0.15s;
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone:focus-within { border-color: var(--primary); border-style: solid; outline: 3px solid var(--primary); outline-offset: 2px; }
.dropzone.has-file { border-style: solid; border-color: var(--success); background: var(--success-bg); }
.dropzone-icon { color: var(--primary); }
.dropzone-icon .svg-icon { width: 2.5rem; height: 2.5rem; }
.dropzone-label { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--primary); cursor: pointer; }
/* Make the whole drop zone a click target for the label. */
.dropzone-label::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.dropzone input[type="file"] { position: relative; z-index: 1; max-width: 100%; font: inherit; font-size: 1.125rem; }
.dropzone input[type="file"]:focus { outline: none; }
.dropzone input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700; min-height: var(--tap); padding: 0.5rem 1.25rem; margin-right: var(--space-3);
  border: 2px solid var(--primary); border-radius: var(--radius-sm); background: var(--surface); color: var(--primary); cursor: pointer;
}
/* With app.js showing the chosen file below, hide the browser's own "No file chosen" text, which gets cut off on phones. */
.dropzone.is-enhanced input[type="file"] { font-size: 0; }
.dropzone.is-enhanced input[type="file"]::file-selector-button { font-size: 1.125rem; margin-right: 0; }
.file-name { margin: 0; font-weight: 700; color: var(--success); display: flex; align-items: center; gap: var(--space-2); }
/* The admin Update report form is a narrow column with the field's label above, so its drop zone is just the button. */
.dropzone-compact { padding: var(--space-3); border-width: 2px; margin-bottom: var(--space-3); }
.dropzone-compact input[type="file"], .dropzone-compact.is-enhanced input[type="file"]::file-selector-button { font-size: 1rem; }
.dropzone-compact.is-enhanced input[type="file"] { font-size: 0; }
.dropzone-compact .file-name { overflow-wrap: anywhere; }

/* --- Resident: thanks and tracking ---------------------------------------- */
.success-mark {
  display: flex; align-items: center; justify-content: center;
  width: 4.5rem; height: 4.5rem; margin: 0 auto var(--space-4);
  border-radius: 50%; background: var(--success-bg); color: var(--success);
  border: 3px solid var(--success-border);
}
.success-mark .svg-icon { width: 2.5rem; height: 2.5rem; stroke-width: 2.5; }
.center { text-align: center; }

.ticket {
  position: relative;
  margin: var(--space-4) 0 var(--space-5);
  padding: var(--space-4) var(--space-4) var(--space-3);
  border: 3px dashed var(--text);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
}
.ticket-label { margin: 0; color: var(--text-muted); font-weight: 600; }
.tracking-code {
  font-family: var(--mono);
  font-size: clamp(2.5rem, 14vw, 4.5rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.15;
  margin: var(--space-2) 0;
  color: var(--text);
}

.status-card h2 { margin-top: 0; }
.answer-yes { padding-bottom: var(--space-5); margin-bottom: var(--space-5); border-bottom: 1px solid var(--border); }
.code-inline { font-family: var(--mono); letter-spacing: 0.05em; }
.status-text { font-size: 1.375rem; margin: var(--space-4) 0 0; }

.stepper { list-style: none; margin: var(--space-5) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.step { position: relative; display: flex; align-items: center; gap: var(--space-3); min-height: 3rem; color: var(--text-muted); }
.step-marker {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 2px solid var(--border-strong); background: var(--surface);
  font-weight: 800; color: var(--text-muted);
}
.step-marker .svg-icon { width: 1.4rem; height: 1.4rem; stroke-width: 2.5; }
.step-done { color: var(--text); }
.step-done .step-marker { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.step-current { color: var(--text); font-weight: 700; }
.step-current .step-marker { background: var(--surface); border: 3px solid var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-tint); }
.step-closed.step-current .step-marker { border-color: #334155; color: #334155; box-shadow: 0 0 0 4px #e2e8f0; }
.step-now {
  margin-left: auto; padding: 0.05rem 0.6rem; border-radius: var(--radius-pill);
  background: var(--primary); color: var(--on-primary); font-size: 0.875rem; font-weight: 700;
}
@media (min-width: 40rem) {
  .stepper { grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; }
  .step { flex-direction: column; text-align: center; gap: var(--space-2); padding: 0 var(--space-1); }
  .step::before { /* connector to the previous step */
    content: ""; position: absolute; top: 1.25rem; right: 50%; width: 100%; height: 3px;
    background: var(--border); z-index: 0;
  }
  .step:first-child::before { display: none; }
  .step-done::before, .step-current::before { background: var(--primary); }
  .step-marker { position: relative; z-index: 1; }
  .step-label { font-size: 1.125rem; line-height: 1.3; }
  .step-now { margin-left: 0; }
}

/* --- Message page --------------------------------------------------------- */
.message-card { text-align: center; padding: var(--space-6) var(--space-5); }
body.marketing .message-card { max-width: 36rem; margin: var(--space-6) auto; }
.message-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 3.5rem; height: 3.5rem; border-radius: 50%;
  background: var(--primary-tint); color: var(--primary-hover); margin-bottom: var(--space-4);
}
.message-icon .svg-icon { width: 1.75rem; height: 1.75rem; }
/* --- Archiving ------------------------------------------------------------ */
.archived-banner, .billing-banner { margin-bottom: var(--space-5); }
.archived-banner form { margin-top: var(--space-3); }
fieldset.read-only { border: 0; margin: 0; padding: 0; min-width: 0; }
.danger-zone { border-color: var(--danger-border); }
.archive-effects { padding-left: 1.25rem; margin: 0 0 var(--space-4); }
.archive-effects li { margin-bottom: var(--space-1); }
.archive-form > input { margin-bottom: var(--space-4); }
.archive-form .checkbox { margin-bottom: var(--space-4); }
.dialog {
  width: min(32rem, calc(100vw - 2rem)); padding: var(--space-5);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  color: var(--text); background: var(--surface);
}
.dialog-wide { width: min(40rem, calc(100vw - 2rem)); }
.dialog::backdrop { background: rgb(15 23 42 / 0.5); }
.dialog h2 { margin-top: 0; }

.message-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 var(--space-5); margin: var(--space-2) 0 0; }
.message-links a { display: inline-flex; align-items: center; min-height: 44px; }

/* --- Admin: page header and stats ---------------------------------------- */
body.admin h1 { font-size: 1.75rem; margin: 0; }
body.admin h2 { font-size: 1.25rem; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-4); margin: 0 0 var(--space-5); }
.page-header > div:first-child { flex: 1 1 20rem; min-width: 0; }
.page-header p { margin: var(--space-1) 0 0; color: var(--text-muted); }
.page-header .eyebrow { margin: 0 0 var(--space-1); }
.eyebrow { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 0.9375rem; font-weight: 600; }
.back-link { margin: 0 0 var(--space-3); }
.back-link a { min-height: 44px; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

.stats { list-style: none; padding: 0; margin: 0 0 var(--space-5); display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); }
.stats-overview { grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
/* The inbox has five tiles. Open takes the first row and the four statuses sit under it, until all five fit in one row. */
.inbox-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inbox-stats > li:first-child { grid-column: 1 / -1; }
.inbox-stats .stat { padding-inline: var(--space-3); }
.inbox-stats .stat-label { font-size: 0.875rem; white-space: nowrap; }
/* On the narrowest phones "Being worked on" is wider than its tile. */
@media (max-width: 22rem) { .inbox-stats .stat-label { white-space: normal; } }
@media (min-width: 48rem) { .inbox-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 75rem) {
  .inbox-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .inbox-stats > li:first-child { grid-column: auto; }
}
.stat {
  display: block; height: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); padding: var(--space-4);
  color: var(--text); text-decoration: none;
}
a.stat:hover { border-color: var(--primary); color: var(--text); box-shadow: var(--shadow-md); }
.stat-label { display: flex; align-items: center; gap: var(--space-2); color: var(--text-muted); font-size: 0.9375rem; font-weight: 600; }
.stat-value { display: block; font-size: 2rem; font-weight: 750; line-height: 1.15; margin-top: var(--space-1); font-variant-numeric: tabular-nums; }
.stat .status-dot { color: var(--pill-fg); width: 0.6rem; height: 0.6rem; }
/* The tile for the current filter is the filled one; on-primary is the pair that follows the brand colour. */
.stat[aria-current] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.stat[aria-current] :is(.stat-label, .status-dot) { color: var(--on-primary); }
a.stat[aria-current]:hover { color: var(--on-primary); background: var(--primary-hover); }
.stat-note { display: block; color: var(--text-muted); font-size: 0.875rem; margin-top: var(--space-1); }

/* --- Admin: reports dashboard --------------------------------------------- */
/* Fixed chart colours, not the city's brand, so a brand colour can never match the second series.
   Validated together on white (dataviz validator): CVD ΔE 29.5, both at least 3:1. */
.dash-toolbar, .trend, .dash-breakdowns { --chart-received: #1d4ed8; --chart-resolved: #d95926; --chart-grid: #e2e8f0; }
.dash-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-4); }
.dash-range { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-md); }
.dash-range a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--space-3); border-radius: calc(var(--radius-md) - 3px);
  color: var(--text); font-weight: 600; text-decoration: none;
}
.dash-range a:hover { background: var(--surface); }
.dash-range a[aria-current] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.dash-dates { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; color: var(--text-muted); font-weight: 600; }
.dash-stats .stat-value { font-variant-numeric: normal; }
.dash-change.is-up, .dash-change.is-down { font-size: 0.75em; }

.trend { margin: 0; }
.trend-legend { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-4); padding: 0; margin: 0 0 var(--space-3); color: var(--text-muted); font-size: 0.9375rem; }
.trend-legend li { display: inline-flex; align-items: center; gap: var(--space-2); }
.trend-key { display: inline-block; flex: none; width: 0.875rem; height: 0.875rem; border-radius: 3px; background: var(--chart-received); }
.trend-key-resolved { height: 2px; border-radius: 1px; background: var(--chart-resolved); }
/* The y-axis labels sit in the left gutter; columns, line and gridlines share the area right of it. */
.trend-plot { position: relative; height: 14rem; margin: var(--space-6) 0 0 2.5rem; border-bottom: 1px solid var(--border-strong); }
.trend-gridline { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--chart-grid); }
.trend-tick { position: absolute; right: calc(100% + var(--space-2)); top: -0.6em; color: var(--text-muted); font-size: 0.8125rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.trend-columns { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.trend-col { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; padding: 0 1px; }
/* A count of 1 on a tall axis still shows as a sliver; an empty day or week draws no column at all. */
.trend-bar { display: block; width: 100%; max-width: 24px; min-height: 2px; background: color-mix(in srgb, var(--chart-received) 85%, white); border-radius: 4px 4px 0 0; }
.trend-col:hover .trend-bar { background: var(--chart-received); }
.trend-col:hover { background: rgb(15 23 42 / 0.04); }
.trend-peak { position: absolute; margin-bottom: 2px; left: 50%; transform: translateX(-50%); color: var(--text); font-size: 0.8125rem; font-weight: 700; white-space: nowrap; }
.trend-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.trend-line polyline { fill: none; stroke: var(--chart-resolved); stroke-width: 2.5px; stroke-linejoin: round; stroke-linecap: round; }
/* A halo under the line keeps it apart from the columns it crosses (WCAG 1.4.11). */
.trend-line polyline.trend-line-halo { stroke: var(--surface, #fff); stroke-width: 6px; }
.trend-tip {
  display: none; position: absolute; z-index: 2; bottom: calc(100% + var(--space-2)); left: 0;
  min-width: 11rem; padding: var(--space-2) var(--space-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); color: var(--text); font-size: 0.875rem; white-space: nowrap;
}
.trend-tip span { display: flex; align-items: center; gap: var(--space-2); }
.trend-col:hover .trend-tip { display: grid; gap: 2px; }
/* Each tip opens toward the middle of the chart, so it never runs off the card on a phone's narrow columns. */
.trend-col.is-right .trend-tip { left: auto; right: 0; }
.trend-axis { position: relative; height: 2.75rem; margin-left: 2.5rem; color: var(--text-muted); font-size: 0.8125rem; line-height: 1.25; }
.trend-axis span { position: absolute; top: var(--space-1); transform: translateX(-50%); white-space: nowrap; text-align: center; }
.trend-axis small { display: block; font-size: 0.75rem; }
.trend-table { margin-top: var(--space-3); }
.trend-table summary { cursor: pointer; color: var(--primary); font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.trend-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.trend-table :is(th, td) { padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--border); text-align: right; }
.trend-table :is(th:first-child) { text-align: left; font-weight: 400; }
.trend-table thead th { font-weight: 600; color: var(--text-muted); }
@media (max-width: 40rem) { .trend-table :is(th, td) { padding-inline: var(--space-1); } }

.dash-breakdowns { display: grid; gap: var(--space-4); align-items: start; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.dash-bars { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); }
.dash-bar { display: grid; grid-template-columns: minmax(6rem, 12rem) 1fr 4.5rem; align-items: center; gap: var(--space-3); }
/* A long name wraps rather than being cut off, so a phone shows all of it (WCAG 1.4.10). */
.dash-bar-name { overflow-wrap: anywhere; }
.dash-bar-track { height: 0.625rem; background: var(--surface-sunken); border-radius: 999px; overflow: hidden; }
.dash-bar-fill { display: block; height: 100%; min-width: 4px; background: var(--chart-received); border-radius: 999px; }
.dash-bar-count { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.dash-bar-share { color: var(--text-muted); font-weight: 400; font-size: 0.875rem; }
@media (max-width: 40rem) {
  .dash-bar { grid-template-columns: 1fr 4.5rem; grid-template-areas: "name count" "track track"; row-gap: var(--space-1); }
  .dash-bar-name { grid-area: name; }
  .dash-bar-track { grid-area: track; }
  .dash-bar-count { grid-area: count; }
  .trend-plot { height: 11rem; margin-left: 2rem; }
  .dash-stats { grid-template-columns: 1fr; }
  .trend-axis .is-minor { display: none; }
  .trend-axis { margin-left: 2rem; }
}

/* --- Admin: toolbar and table -------------------------------------------- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-4); box-shadow: var(--shadow-sm);
}
.toolbar-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.toolbar-form > div { min-width: 11rem; flex: 1 1 11rem; max-width: 18rem; }
.toolbar-form[role="search"] { flex-wrap: nowrap; }
.toolbar-form > .toolbar-search { flex: 1 1 11rem; max-width: 15rem; }
.toolbar label { margin-bottom: var(--space-1); }
/* As tall as the 44px admin inputs and flush with their bottom edge, so each box and its text center on them. */
.toolbar .checkbox { margin-bottom: 0; min-height: 44px; gap: var(--space-2); }
/* Phones: Status and Department each take a full row, and the checkboxes go under them, so the filters stack evenly (#144). */
@media (max-width: 40rem) {
  .toolbar-form:not([role="search"]) > div { flex-basis: 100%; max-width: none; }
}
/* Its own row under the filters at every width: the count on the left, the List/Map toggle on the right. */
.toolbar-summary { flex: 1 0 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.toolbar .result-count { margin: 0; color: var(--text-muted); font-size: 0.9375rem; }
/* Clear sits with the count it changes, so it never wraps onto a row of its own (#170). */
.result-line { display: flex; align-items: center; gap: var(--space-2); }

/* Newer, the page number and Older keep their columns when one of the links is missing on the first or last page. */
.pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }
.pager-newer { grid-column: 1; justify-self: start; }
.pager-status { grid-column: 2; margin: 0; color: var(--text-muted); font-size: 0.9375rem; white-space: nowrap; }
.pager-older { grid-column: 3; justify-self: end; }
@media (max-width: 30rem) {
  .pager { grid-template-columns: 1fr 1fr; }
  .pager-status { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
  .pager-older { grid-column: 2; }
}

/* clip, not hidden: it rounds the table's corners without becoming a scroll container, so the headings still stick to the window. */
body.admin .table-card { padding: 0; overflow: clip; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }
/* From 68rem every column fits beside the sidebar, even a row with both tags and an age like "47 hours ago". Narrower, the table scrolls. */
@media (min-width: 68rem) { .table-wrap { overflow: visible; } }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.9375rem; }
th, td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-sunken); color: var(--text-muted);
  font-size: 0.875rem; font-weight: 700; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8fafc; }
.code-link { font-family: var(--mono); font-weight: 700; letter-spacing: 0.03em; white-space: nowrap; }
.cell-muted { color: var(--text-muted); white-space: nowrap; }
.cell-location { max-width: 22rem; }
/* An empty block as wide as a two-word department keeps that name on one line. A longer name wraps, since the table cannot scroll sideways at this width. */
@media (min-width: 68rem) { .report-table .cell-dept::after { content: ""; display: block; width: 6.5rem; } }
/* Phones: each report is a stacked card (code and status, problem, location, department and age) instead of a scrolling row. */
@media (max-width: 40rem) {
  .report-table, .report-table tbody { display: block; }
  .report-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .report-table tr {
    display: grid; grid-template-columns: minmax(min-content, 1fr) auto; gap: var(--space-1) var(--space-3); align-items: center;
    grid-template-areas: "code status" "problem problem" "location location" "dept age";
    padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border);
  }
  .report-table tbody tr:last-child { border-bottom: 0; }
  .report-table td { display: block; padding: 0; border: 0; }
  .report-table tbody tr:hover, .report-table tbody tr:hover td { background: none; }
  .report-table .cell-code { grid-area: code; }
  /* Two or three badges wrap onto more lines rather than covering the tracking code. */
  .report-table .cell-status { grid-area: status; justify-self: end; }
  .report-table .cell-status .status-line { justify-content: flex-end; }
  /* A pasted link has no place to break, and would widen the code column past the screen. */
  .report-table :is(.cell-problem, .cell-location) { overflow-wrap: anywhere; }
  .report-table .cell-problem { grid-area: problem; }
  .report-table .cell-location { grid-area: location; max-width: none; color: var(--text-muted); }
  .report-table .cell-dept { grid-area: dept; color: var(--text-muted); }
  .report-table .cell-age { grid-area: age; justify-self: end; }
}
/* Search, role and department share one form, so it wraps on a phone instead of keeping the search row on one line. */
.toolbar-form.users-filter { flex-wrap: wrap; }
@media (max-width: 40rem) {
  .toolbar-form.users-filter > div, .toolbar-form.users-filter > .toolbar-search { flex-basis: 100%; max-width: none; }
}
.user-table .cell-email { overflow-wrap: anywhere; }
/* Phones: each user is a stacked card (name and role, email, department). */
@media (max-width: 40rem) {
  .user-table, .user-table tbody { display: block; }
  .user-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .user-table tr {
    display: grid; grid-template-columns: minmax(min-content, 1fr) auto; gap: var(--space-1) var(--space-3); align-items: center;
    grid-template-areas: "name role" "email email" "dept dept";
    padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border);
  }
  .user-table tbody tr:last-child { border-bottom: 0; }
  .user-table td { display: block; padding: 0; border: 0; }
  .user-table td:empty { display: none; }
  .user-table tbody tr:hover, .user-table tbody tr:hover td { background: none; }
  .user-table .cell-name { grid-area: name; overflow-wrap: anywhere; }
  .user-table .cell-role { grid-area: role; justify-self: end; color: var(--text-muted); }
  .user-table .cell-email { grid-area: email; color: var(--text-muted); }
  .user-table .cell-dept { grid-area: dept; color: var(--text-muted); }
}
.city-table .city-link { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 700; }
.city-table .cell-host { font-family: var(--mono); font-size: 0.875rem; overflow-wrap: anywhere; }
.city-table .standing-date { color: var(--text-muted); white-space: nowrap; }
.city-table .cell-open { font-variant-numeric: tabular-nums; }
@media (min-width: 40.0625rem) { .city-table :is(.cell-name, .cell-host, .cell-plan) { white-space: nowrap; } }
/* The column heading says it on wide screens; phones hide the headings. */
.city-table .open-label { display: none; }
.city-table tbody tr { position: relative; cursor: pointer; }
.city-table .city-link::after { content: ""; position: absolute; inset: 0; }
/* Phones: each city is a stacked card (name and open reports, address, plan and billing). */
@media (max-width: 40rem) {
  .city-table, .city-table tbody { display: block; }
  .city-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  /* Flex, not grid: a long billing date would size a grid column and squeeze the city's name. It wraps below instead. */
  .city-table tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3);
    padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border);
  }
  .city-table tbody tr:last-child { border-bottom: 0; }
  .city-table td { display: block; padding: 0; border: 0; }
  .city-table tbody tr:hover, .city-table tbody tr:hover td { background: none; }
  .city-table .cell-name { order: 1; flex: 1 1 0; min-width: 0; overflow-wrap: break-word; }
  .city-table .cell-open { order: 2; color: var(--text-muted); white-space: nowrap; }
  .city-table .open-label { display: inline; }
  .city-table .cell-host { order: 3; flex-basis: 100%; color: var(--text-muted); overflow-wrap: anywhere; }
  .city-table .cell-plan { order: 4; color: var(--text-muted); }
  .city-table .cell-standing { order: 5; margin-left: auto; text-align: right; }
}
.needs-list p { margin: 0; }

.empty-state { text-align: center; padding: var(--space-7) var(--space-5); }
.empty-state .icon-round { width: 4rem; height: 4rem; background: var(--surface-sunken); color: var(--text-muted); margin-bottom: var(--space-3); }
.empty-state .icon-round .svg-icon { width: 2rem; height: 2rem; }
.empty-state h2 { margin: 0 0 var(--space-2); }
.empty-state p { color: var(--text-muted); }

/* --- Admin: report detail ------------------------------------------------- */
.detail-grid { display: grid; gap: var(--space-5); }
.detail-grid > .card { margin: 0; }
.detail-nearby .item-list > li { padding: var(--space-3) 0; }
.detail-nearby .item-list > li:last-child { padding-bottom: 0; }
.detail-nearby .item-list p, .detail-nearby .item-note { margin: 0 0 var(--space-2); padding: 0; border: 0; }
.detail-nearby .item-list form { margin: var(--space-3) 0 0; }
/* On a phone the page reads in order: what the report is, the Update report form, then its history. Wide, the form
   sits beside the details and timeline, with Nearby reports under it. It is not sticky: it is taller than many laptop screens. */
@media (min-width: 64rem) {
  .detail-grid { grid-template-columns: minmax(0, 1fr) 22rem; grid-template-rows: auto auto 1fr; align-items: start; }
  .detail-facts { grid-column: 1; grid-row: 1; }
  .detail-timeline { grid-column: 1; grid-row: 2 / span 2; }
  .detail-update { grid-column: 2; grid-row: 1 / span 2; }
  .detail-nearby { grid-column: 2; grid-row: 3; }
}
.problem-line { display: flex; align-items: center; gap: var(--space-2); }
.photo { display: inline-block; }
.event-photo { margin: var(--space-3) 0 0; }
.event-photo figcaption { margin-bottom: var(--space-2); font-weight: 600; }
.resident-photo { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); }
.resident-photo form { margin: 0; }
.photo img { display: block; max-width: 100%; max-height: 20rem; width: auto; height: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
.visibility {
  display: inline-flex; align-items: center; padding: 0 0.5rem; margin-left: var(--space-1);
  font-size: 0.8125rem; font-weight: 700; border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong); color: #334155; background: var(--surface-sunken);
}
.visibility.is-public { border-color: var(--success-border); color: var(--success); background: var(--success-bg); }
.actor { font-weight: 600; }

/* --- Admin: lists, cities, settings -------------------------------------- */
.city-grid { list-style: none; padding: 0; margin: 0 0 var(--space-5); display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.city-grid > li { display: flex; }
.city-grid .tile { min-height: 84px; border-width: 1px; border-radius: var(--radius-md); }
.city-grid .tile-name { font-size: 1.125rem; }
.city-grid .tile-description { font-size: 0.9375rem; font-family: var(--mono); }
.count-badge {
  display: inline-flex; align-items: center; gap: var(--space-1); margin-top: var(--space-1);
  font-size: 0.8125rem; font-weight: 700; color: var(--text-muted);
}

.item-list { list-style: none; margin: 0; padding: 0; }
.item-list > li { border-bottom: 1px solid var(--border); }
.item-list > li:last-child { border-bottom: 0; }
.category-row { display: flex; align-items: flex-start; gap: var(--space-2); }
.category-row { scroll-margin-top: 30vh; }
/* After a move the page lands on #row-<id>; flash that row so it is easy to spot, then let it fade.
   A plain :target background would stay until the URL changes. */
.category-row:target { border-radius: var(--radius-sm); animation: row-moved 1.5s ease-out; }
@keyframes row-moved { from { background: var(--primary-soft); } to { background: transparent; } }
.category-row > details { flex: 1; min-width: 0; }
.move-buttons { display: flex; gap: var(--space-1); padding-top: var(--space-2); }
.button-icon { min-width: 48px; padding-inline: 0; }
.button-icon:disabled { opacity: 0.35; cursor: default; background: transparent; }
.item-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--surface-sunken); color: #334155; font-weight: 700; text-transform: uppercase;
}

/* Category editors are <details> rows; the summary is the clickable row. */
.category-item > summary {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) 0; cursor: pointer; list-style: none; border-radius: var(--radius-sm);
}
.category-item > summary::-webkit-details-marker { display: none; }
.category-item > summary:hover .summary-name { color: var(--primary-hover); }
.summary-text { flex: 1; min-width: 0; }
.summary-name { display: block; font-weight: 700; color: var(--primary); }
/* A deleted type's name opens nothing, so it is not the link color. */
.deleted-category .summary-name { color: var(--text); }
.summary-meta { display: block; color: var(--text-muted); font-size: 0.875rem; }
/* An email address or phone number moves to the next line whole. On a phone each part gets its own line. */
.summary-meta span:not(.meta-sep) { display: inline-block; }
@media (max-width: 40rem) {
  .summary-meta span:not(.meta-sep) { display: block; }
  .meta-sep { display: none; }
}
.summary-chevron { color: var(--text-muted); transition: transform 0.15s; }
.category-item[open] > summary .summary-chevron { transform: rotate(90deg); }
.category-item > form { padding: 0 0 var(--space-4); }
.announcement-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-3) 0; }
.announcement-row .summary-text { overflow-wrap: anywhere; }
/* Phones: Post again goes under the text, lined up with the title, so the dates keep their width. */
@media (max-width: 40rem) {
  .announcement-row { grid-template-columns: auto minmax(0, 1fr); }
  .announcement-row > .button { grid-column: 2; justify-self: start; }
}
.category-item.inactive .icon-tile { background: var(--surface-sunken); color: var(--text-muted); }
/* An email address fits well short of the card's full width. */
.user-email input { max-width: 32rem; }
/* Two columns at most, so names pair up and role sits beside department instead of alone on a row. */
.user-fields { max-width: 40rem; }
.tag { display: inline-flex; padding: 0 0.5rem; border-radius: var(--radius-pill); background: var(--surface-sunken); color: #334155; font-size: 0.8125rem; font-weight: 700; border: 1px solid #cbd5e1; }
.status-line { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }

/* Branding card on Settings */
.brand-preview { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin: 0 0 var(--space-5); background: var(--page); }
.brand-preview-header { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface); border-bottom: 1px solid var(--border); font-weight: 700; }
.brand-preview-body { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); padding: var(--space-4); }
.brand-preview-link { color: var(--primary); font-weight: 600; }
.color-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-4); margin-bottom: var(--space-4); }
.color-row > div { min-width: 0; }
input[type="color"] { display: block; width: 5rem; height: 44px; padding: 2px; border: 2px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }
.hex-input { max-width: 10rem; font-family: var(--mono); }
.current-logo { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); margin: 0 0 var(--space-4); }
.current-logo img { display: block; max-height: 4rem; max-width: 14rem; object-fit: contain; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-2); }
.branding-actions, .billing-actions { margin-top: var(--space-4); }
.billing-actions + .hint { margin-top: var(--space-2); }
.billing-choices { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border); }
.billing-choices h3 { margin: 0 0 var(--space-2); font-size: 1.125rem; }
.billing-choice-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); margin-top: var(--space-4); }
.billing-choice { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); min-width: 0; }
.billing-choice h4 { margin: 0; font-size: 1rem; }
.billing-choice .hint { flex: 1; margin: 0; }
.billing-choices + :is(form, fieldset), .billing-actions + .hint + :is(form, fieldset) { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border); }
.branding-section h3 { font-size: 1rem; margin-top: 0; }
.branding-section + .branding-section { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border); }

/* --- Utilities ------------------------------------------------------------ */
.muted { color: var(--text-muted); }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Motion --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .tile:hover { transform: none; }
}

/* --- Print ---------------------------------------------------------------- */
@media print {
  body { background: #fff; display: block; }
  .site-header, .site-footer, .sidebar, .button, form, .skip-link, .demo-bar { display: none !important; }
  .card { box-shadow: none; border-color: #000; }
  .ticket { border-color: #000; }
  .success-mark { border-color: #000; }
  /* A page with a slip prints only the slip. A zero page margin also drops the browser's date and title lines. */
  @page { margin: 0; }
  body:has(.print-slip) main > :not(.print-slip) { display: none !important; }
  body:has(.print-slip) :is(.app-body, main) { max-width: none; padding: 0; margin: 0; }
  .print-slip { display: block; padding: 0.75in; color: #000; font-size: 11pt; line-height: 1.4; }
  .slip-header { display: flex; align-items: center; gap: 12pt; padding-bottom: 12pt; border-bottom: 2pt solid #000; }
  .slip-header :is(.logo, .monogram) { width: 44pt; height: 44pt; }
  .slip-city { margin: 0; font-size: 18pt; font-weight: 700; }
  .slip-title, .slip-label { margin: 0; font-size: 9pt; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #444; }
  .slip-code { margin: 24pt 0; padding: 14pt 18pt; border: 1pt solid #000; }
  .slip-code-value { margin: 4pt 0 0; font-family: var(--mono); font-size: 30pt; font-weight: 700; letter-spacing: 0.08em; }
  .slip-facts { display: grid; grid-template-columns: 8rem 1fr; margin: 0; border-top: 0.5pt solid #999; }
  .slip-facts :is(dt, dd) { margin: 0; padding: 8pt 0; border-bottom: 0.5pt solid #999; }
  .slip-facts dt { font-weight: 700; color: #444; }
  .slip-facts dd { white-space: pre-wrap; overflow-wrap: anywhere; }
  .slip-footer { margin: 24pt 0 0; font-size: 10pt; }
}
@media screen { .print-slip { display: none; } }

/* Local dev "View as" switch */
.dev-view-as { font-size: 0.875rem; }
.dev-view-as > summary { cursor: pointer; color: var(--text-muted); padding: var(--space-1) var(--space-2); border: 1px dashed var(--border-strong, #64748b); border-radius: var(--radius-sm); }
.dev-view-as-panel { margin-top: var(--space-2); display: grid; gap: var(--space-3); }
.dev-view-as form { display: grid; gap: var(--space-2); }
.dev-view-as form .button { justify-self: start; }
.item-note { margin: 0 0 var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.facts + .item-note { margin-top: var(--space-5); }

/* --- Launch QA fixes: tap targets, long words on narrow screens ----------- */
/* Tall for tapping, but no side padding, so every dot in the footer has the same space on both sides (#152). */
.site-footer a { display: inline-block; padding: 0.625rem 0; }
.send-status:empty { display: none; }
.send-status { margin: var(--space-3) 0 0; color: var(--text-muted); }
.mkt-preview-label { margin: 0 0 var(--space-2); color: var(--text-muted); font-size: 0.875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.tracking-code { white-space: nowrap; font-size: clamp(2rem, 11vw, 4.5rem); }
.city-grid .tile-text { min-width: 0; }
.city-grid .tile-description { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The whole inbox row opens the report; the code stays the one real link for keyboards and screen readers. */
.report-table tbody tr { position: relative; cursor: pointer; }
.report-table .code-link::after { content: ""; position: absolute; inset: 0; }
.user-table tbody tr { position: relative; cursor: pointer; }
.user-table .user-link { font-weight: 700; }
.user-table .user-link::after { content: ""; position: absolute; inset: 0; }
.item-note.user-remove { margin: var(--space-5) 0 0; padding-top: var(--space-4); }
/* Phones and tablets: the admin tabs sit behind a Menu button next to the city name, opening as a panel over the page.
   A scrolling row hid tabs off-screen and a wrapped one took a third of a phone screen (#72). */
@media (max-width: 63.99rem) {
  .sidebar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-bottom: var(--space-2); }
  .sidebar-brand { margin-bottom: 0; min-width: 0; }
  .sidebar-brand > span { min-width: 0; overflow-wrap: break-word; }
  .nav-menu { flex-shrink: 0; }
  .nav-menu > summary {
    display: flex; align-items: center; gap: var(--space-2);
    min-height: 44px; padding: 0 var(--space-3);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-weight: 600; cursor: pointer; list-style: none;
  }
  .nav-menu > summary::-webkit-details-marker { display: none; }
  .nav-menu[open] > summary { background: var(--surface-sunken); }
  .nav-panel {
    position: absolute; top: 100%; left: var(--space-4); right: var(--space-4); z-index: 20;
    max-height: calc(100vh - 5rem); overflow-y: auto; padding: var(--space-2);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgb(15 23 42 / 0.12);
  }
  .nav-panel .side-nav ul { flex-direction: column; overflow: visible; padding: 0; }
  .nav-panel .nav-sep { display: block; height: 1px; background: var(--border); margin: var(--space-1) var(--space-2); }
  .account { margin-top: var(--space-2); padding: var(--space-3) var(--space-3) var(--space-2); border-top: 1px solid var(--border); }
}
/* Wide screens: the list is always shown in the sidebar. A browser without ::details-content keeps the Menu button. */
@media (min-width: 64rem) {
  @supports selector(::details-content) {
    .nav-menu > summary { display: none; }
    .nav-menu::details-content { content-visibility: visible; display: contents; }
  }
}
@media (max-width: 40rem) {
  .move-buttons { flex-direction: column; gap: 0; padding-top: 0; }
}
/* Turnstile's box, once drawn, would otherwise push Send down under a second tap. */
.cf-turnstile { min-height: 65px; }
@media (scripting: none) { .cf-turnstile { display: none; } }
/* Admin forms send once (app.js); this shows the tap was taken. */
form[aria-busy="true"] button[type="submit"] { opacity: 0.6; cursor: progress; }
