/* ============================================================================
   CSJDM Resident Web Portal — stylesheet
   ============================================================================

   ONE file, no build step. Deploys as a static asset next to the HTML.

   The token names below deliberately MIRROR admin-web/src/styles.css so the
   resident portal and the staff console read as one product: same orange ramp,
   same navy-slate neutrals, same status families, same radii and shadows. If
   you change a shared token here, change it there too.

   ── THE CONTRAST RULE THAT SHAPES EVERYTHING ──────────────────────────────
   --brand-400 (#ff922b) is only ~2.1:1 against white. It is a SURFACE colour,
   never a text colour, and NEVER carries white text.
     • filled brand button = --brand-ink (#1a1a2e) ON orange  → 7.65:1  ✓
     • brand-coloured TEXT on a light surface = --brand-900 (#8a3d0a) → 7.7:1 ✓
     • orange on orange, or white on orange                   → forbidden
   Every rule that paints orange below states which of these it is.

   CONTENTS
     1. Tokens
     2. Dark mode
     3. Reset + base
     4. Layout shell (header, nav, main, footer)
     5. Buttons
     6. Forms
     7. Cards + panels
     8. Status pills
     9. Lists + data rows
    10. Skeletons, empty states, error states
    11. Wizard (stepper + steps)
    12. Toast, modal, banner
    13. Landing + sign-in
    14. Utilities
    15. Responsive + reduced motion + print
   ========================================================================= */

/* ------------------------------------------------------------- 1. TOKENS */

:root {
  /* Brand ramp — orange. 400 is app_config.dart's primaryColor. */
  --brand-50: #fff7ef;
  --brand-100: #ffecd9;
  --brand-200: #ffd6ae;
  --brand-300: #ffb673;
  --brand-400: #ff922b;  /* primaryColor  — SURFACE ONLY */
  --brand-500: #f5851c;
  --brand-600: #ec6b1f;  /* accentColor   — SURFACE ONLY */
  --brand-700: #dd6616;  /* secondaryColor */
  --brand-800: #b85410;  /* AA fill under white text (4.8:1) */
  --brand-900: #8a3d0a;  /* AA brand TEXT on light (7.7:1) */
  --brand-ink: #1a1a2e;  /* the only text colour allowed on orange */

  /* Neutral ramp — navy-slate, tinted toward --brand-ink. Never pure grey. */
  --neutral-0: #ffffff;
  --neutral-25: #fafbfd;
  --neutral-50: #f4f6fa;
  --neutral-100: #eaeef5;
  --neutral-200: #d9e0ec;
  --neutral-300: #bcc5d8;
  --neutral-400: #93a0b9;
  --neutral-500: #5f6e8a;
  --neutral-600: #4e5c75;
  --neutral-700: #39455c;
  --neutral-800: #252f42;
  --neutral-900: #1a1a2e;
  --neutral-950: #111120;

  /* Semantic status families: a surface, a border, a solid and an AA text. */
  --success-surface: #e8f6ee;
  --success-border: #a6dcbc;
  --success-solid: #1b8a4b;
  --success-text: #0e6134;

  --warning-surface: #fff4e0;
  --warning-border: #f5cf8f;
  --warning-solid: #d98600;
  --warning-text: #8a4b00;

  --danger-surface: #fdecec;
  --danger-border: #f2b8b8;
  --danger-solid: #d32f2f;
  --danger-text: #9f1d1d;

  --info-surface: #e9f1fc;
  --info-border: #b3cdf0;
  --info-solid: #1c63b8;
  --info-text: #14498c;

  /* Surfaces */
  --surface-page: var(--neutral-50);
  --surface-card: var(--neutral-0);
  --surface-raised: var(--neutral-0);
  --surface-sunken: var(--neutral-100);
  --surface-hover: var(--brand-50);
  --surface-inset: var(--neutral-25);
  --surface-header: linear-gradient(135deg, #232338 0%, var(--brand-ink) 60%, #16162a 100%);

  /* Borders */
  --border-subtle: var(--neutral-100);
  --border-default: var(--neutral-200);
  --border-strong: var(--neutral-300);
  --border-brand: var(--brand-300);

  /* Text */
  --text-primary: var(--neutral-800);
  --text-secondary: var(--neutral-600);
  --text-muted: var(--neutral-500);
  --text-inverse: #f2f4f9;
  --text-on-brand: var(--brand-ink);
  --text-brand: var(--brand-900);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --text-xs: 0.6875rem;   /* 11px — eyebrow / micro-caps */
  --text-sm: 0.8125rem;   /* 13px — captions, meta */
  --text-base: 0.9375rem; /* 15px — body */
  --text-lg: 1.0625rem;   /* 17px — panel titles */
  --text-xl: 1.375rem;    /* 22px — page titles */
  --text-2xl: 1.875rem;   /* 30px — display numbers */
  --text-3xl: 2.5rem;     /* 40px — landing hero */

  --leading-tight: 1.25;
  --leading-snug: 1.4;
  --leading-normal: 1.6;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  --tracking-caps: 0.07em;

  /* Spacing — 8px base with 4px halves */
  --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;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(26, 26, 46, 0.06);
  --shadow-sm: 0 1px 3px rgba(26, 26, 46, 0.08), 0 1px 2px rgba(26, 26, 46, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 26, 46, 0.08), 0 1px 3px rgba(26, 26, 46, 0.06);
  --shadow-lg: 0 12px 32px rgba(26, 26, 46, 0.12), 0 2px 8px rgba(26, 26, 46, 0.06);
  --shadow-brand: 0 6px 18px rgba(236, 107, 31, 0.28);
  --ring-brand: 0 0 0 3px rgba(255, 146, 43, 0.4);
  --ring-danger: 0 0 0 3px rgba(211, 47, 47, 0.28);

  /* Layout. --gutter is the 16px side margin the brief asks for; it widens on
     larger screens but never goes below 16px. */
  --gutter: 1rem;
  --content-max: 1080px;
  --header-height: 60px;
  /* 48px — the minimum tap target. Every interactive control inherits it. */
  --tap: 48px;
  --control-height: 48px;

  /* Motion */
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);

  color-scheme: light dark;
}

/* ---------------------------------------------------------- 2. DARK MODE */
/* Guarded with :root:not([data-theme="light"]) so an explicit light choice
   wins over the OS preference, and repeated under [data-theme="dark"] so an
   explicit dark choice works on a light OS. */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --surface-page: #121120;
    --surface-card: #1c1c2b;
    --surface-raised: #232334;
    --surface-sunken: #191927;
    --surface-hover: rgba(255, 146, 43, 0.1);
    --surface-inset: #161623;
    --surface-header: linear-gradient(135deg, #24243a 0%, #1c1c2e 60%, #181828 100%);

    --border-subtle: #2a2a3d;
    --border-default: #353549;
    --border-strong: #454560;
    --border-brand: rgba(255, 146, 43, 0.45);

    --text-primary: #eceef5;
    --text-secondary: #b3bbd0;
    --text-muted: #8e98b2;
    --text-inverse: #16162a;
    --text-on-brand: var(--brand-ink);
    /* On a dark surface the AA-on-light brand text is far too dark; step up the
       ramp instead of keeping --brand-900. */
    --text-brand: var(--brand-300);

    --success-surface: rgba(27, 138, 75, 0.18);
    --success-border: rgba(103, 208, 148, 0.42);
    --success-solid: #4cc98a;
    --success-text: #7fe0ad;

    --warning-surface: rgba(217, 134, 0, 0.18);
    --warning-border: rgba(255, 183, 77, 0.42);
    --warning-solid: #ffa726;
    --warning-text: #ffcb80;

    --danger-surface: rgba(211, 47, 47, 0.2);
    --danger-border: rgba(239, 130, 130, 0.42);
    --danger-solid: #ef6a6a;
    --danger-text: #ffaaaa;

    --info-surface: rgba(28, 99, 184, 0.2);
    --info-border: rgba(130, 176, 240, 0.42);
    --info-solid: #6ba6ef;
    --info-text: #a9cbf6;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme='dark'] {
  --surface-page: #121120;
  --surface-card: #1c1c2b;
  --surface-raised: #232334;
  --surface-sunken: #191927;
  --surface-hover: rgba(255, 146, 43, 0.1);
  --surface-inset: #161623;
  --surface-header: linear-gradient(135deg, #24243a 0%, #1c1c2e 60%, #181828 100%);
  --border-subtle: #2a2a3d;
  --border-default: #353549;
  --border-strong: #454560;
  --border-brand: rgba(255, 146, 43, 0.45);
  --text-primary: #eceef5;
  --text-secondary: #b3bbd0;
  --text-muted: #8e98b2;
  --text-inverse: #16162a;
  --text-brand: var(--brand-300);
  --success-surface: rgba(27, 138, 75, 0.18);
  --success-border: rgba(103, 208, 148, 0.42);
  --success-solid: #4cc98a;
  --success-text: #7fe0ad;
  --warning-surface: rgba(217, 134, 0, 0.18);
  --warning-border: rgba(255, 183, 77, 0.42);
  --warning-solid: #ffa726;
  --warning-text: #ffcb80;
  --danger-surface: rgba(211, 47, 47, 0.2);
  --danger-border: rgba(239, 130, 130, 0.42);
  --danger-solid: #ef6a6a;
  --danger-text: #ffaaaa;
  --info-surface: rgba(28, 99, 184, 0.2);
  --info-border: rgba(130, 176, 240, 0.42);
  --info-solid: #6ba6ef;
  --info-text: #a9cbf6;
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
}

/* ------------------------------------------------------- 3. RESET + BASE */

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  /* An explicit background — without it a dark-mode page shows white gaps
     wherever a container does not paint. */
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  /* No horizontal scroll at any width, per the 375px requirement. */
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: var(--leading-tight);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  /* Long business names must wrap, not widen the page. */
  overflow-wrap: break-word;
}
h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-base); }

p { margin: 0 0 var(--space-3); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--text-brand);
  text-decoration: none;
  font-weight: var(--weight-medium);
}
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; height: auto; display: block; }

hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-5) 0;
}

code, .mono { font-family: var(--font-mono); font-size: 0.9em; }

/* One visible focus treatment for everything, so keyboard users are never lost.
   :focus-visible only, so a mouse click does not leave a ring behind. */
:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Screen-reader-only, but focusable (used by the skip link). */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; top: -100px; left: var(--space-3);
  z-index: 100;
  background: var(--surface-card);
  color: var(--text-brand);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}
.skip-link:focus { top: var(--space-3); }

/* ------------------------------------------------- 4. LAYOUT SHELL */

.app-header {
  background: var(--surface-header);
  color: var(--text-inverse);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-md);
}

.app-header__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: #fff;
  font-weight: var(--weight-bold);
  text-decoration: none;
  /* Keeps the wordmark from being squeezed out by the nav on a narrow phone. */
  min-width: 0;
}
.brand:hover { text-decoration: none; }

/* The seal/monogram. Orange surface, INK glyph — never white on orange. */
.brand__mark {
  width: 36px; height: 36px;
  flex: 0 0 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
  color: var(--brand-ink);
  display: grid; place-items: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-brand);
}

.brand__text { min-width: 0; }
.brand__name {
  display: block;
  font-size: var(--text-base);
  line-height: 1.15;
  white-space: nowrap;
}
.brand__sub {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header__spacer { flex: 1 1 auto; }

/* Primary navigation. On a phone it becomes a horizontally scrollable strip
   BELOW the header bar rather than a hamburger — one tap instead of two, and
   residents can see every service without discovering a menu. */
.app-nav {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: var(--header-height);
  z-index: 30;
}
.app-nav__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.app-nav__inner::-webkit-scrollbar { display: none; }

.app-nav a {
  flex: 0 0 auto;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.app-nav a:hover {
  color: var(--text-brand);
  background: var(--surface-hover);
  text-decoration: none;
}
/* The active tab is marked by an orange RULE plus a colour change — never by
   colour alone, so it survives a monochrome or high-contrast rendering. */
.app-nav a[aria-current='page'] {
  color: var(--text-brand);
  border-bottom-color: var(--brand-600);
  font-weight: var(--weight-semibold);
}

.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-5) var(--gutter) var(--space-7);
}

.page__head { margin-bottom: var(--space-5); }
.page__eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.page__title { font-size: var(--text-xl); }
.page__lead {
  margin-top: var(--space-2);
  color: var(--text-secondary);
  max-width: 62ch;
}

.app-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.app-footer__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-5) var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  align-items: center;
  justify-content: space-between;
}

/* ------------------------------------------------------------ 5. BUTTONS */

.btn {
  /* 48px min height AND min width, so an icon-only button is still a legal
     tap target. */
  min-height: var(--tap);
  min-width: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-5);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  /* A button label never wraps. "Sign out" breaking into "Sign / out" inside a
     60px header is how a cramped phone header actually fails. */
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
  /* Stops iOS Safari from tinting our carefully chosen colours. */
  -webkit-appearance: none;
  appearance: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* PRIMARY — orange surface, INK label. 7.65:1. This is the only correct way to
   paint a filled brand button; white-on-orange would be ~2:1 and illegible. */
.btn--primary {
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  color: var(--text-on-brand);
  box-shadow: var(--shadow-brand);
}
.btn--primary:hover {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
}

.btn--secondary {
  background: var(--surface-card);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.btn--secondary:hover {
  border-color: var(--border-brand);
  background: var(--surface-hover);
  color: var(--text-brand);
}

.btn--ghost {
  background: transparent;
  color: var(--text-brand);
  padding: 0 var(--space-3);
}
.btn--ghost:hover { background: var(--surface-hover); }

.btn--danger {
  background: var(--danger-solid);
  /* White on #d32f2f is 4.6:1 — this one is fine, unlike orange. */
  color: #fff;
}
.btn--danger:hover { filter: brightness(0.93); }

/* A compact button for dense rows. 40px on a desktop, where a mouse is precise;
   raised to the full 48px on a touch screen by the (pointer: coarse) block in
   section 15, because a 36px target under a thumb is a mis-tap waiting to
   happen and this portal is opened on a phone far more often than not. */
.btn--sm { min-height: 40px; padding: 0 var(--space-3); font-size: var(--text-sm); }
.btn--block { width: 100%; }

/* A spinner inside a button, for in-flight submits. */
.btn.is-loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
  /* Inherit from the button's ORIGINAL colour, which we just made transparent,
     so re-state it per variant below. */
  border-color: var(--text-primary);
  border-top-color: transparent;
}
.btn--primary.is-loading::after { border-color: var(--brand-ink); border-top-color: transparent; }
.btn--danger.is-loading::after { border-color: #fff; border-top-color: transparent; }

@keyframes spin { to { transform: rotate(360deg); } }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.btn-row--end { justify-content: flex-end; }
.btn-row--between { justify-content: space-between; }

/* -------------------------------------------------------------- 6. FORMS */

.field { margin-bottom: var(--space-4); }

.label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.label .req { color: var(--danger-text); margin-left: 2px; }
.label .opt {
  color: var(--text-muted);
  font-weight: var(--weight-regular);
  margin-left: var(--space-2);
}

.input, .select, .textarea {
  width: 100%;
  min-height: var(--control-height);
  padding: var(--space-3);
  font-family: inherit;
  /* 16px, NOT 15px. iOS Safari zooms the whole page when a focused input is
     below 16px, which on a phone looks like the layout breaking. */
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
}
.textarea { min-height: 112px; resize: vertical; line-height: var(--leading-snug); }

.select {
  /* Room for the chevron, which is a background image so it needs no markup. */
  padding-right: var(--space-6);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235f6e8a' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: var(--ring-brand);
}

.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--surface-sunken);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Invalid state is a red border AND a message below — never colour alone. */
.input.is-invalid, .select.is-invalid, .textarea.is-invalid {
  border-color: var(--danger-solid);
}
.input.is-invalid:focus, .select.is-invalid:focus, .textarea.is-invalid:focus {
  box-shadow: var(--ring-danger);
}

/* ONE hint pattern, used by every form field on every page.
 *
 * The markup is always the same three lines, in this order:
 *
 *   <label class="label" for="f_x">…</label>
 *   <input class="input" id="f_x" aria-describedby="f_x_hint f_x_err">
 *   <p class="hint" id="f_x_hint">what to actually type here</p>
 *   <p class="error-text" id="f_x_err"></p>
 *
 * The aria-describedby is not optional. A hint that only sighted users receive
 * is half a hint, and the wizard renders its hints from js/permit-fields.js
 * precisely so this cannot drift per field.
 *
 * It sits BELOW the control, not above it: read the label, act, then read the
 * guidance if the control did not make it obvious. Muted, and never the only
 * carrier of a requirement — anything mandatory is also marked on the label. */
.hint {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  line-height: var(--leading-snug, 1.45);
  color: var(--text-muted);
  /* Long hints are prose. Cap the measure so a wide screen does not stretch one
     sentence across the whole card, and let the browser avoid orphans. */
  max-width: 64ch;
  text-wrap: pretty;
}
/* Hints filled in by script (the barangay source note) start empty. Without
   this they still claim their top margin and push the layout around when they
   later resolve to nothing. */
.hint:empty { display: none; }
/* A hint explaining why a control is shut belongs with the control it explains,
   so it is not muted into invisibility next to a greyed-out field. */
.input:disabled ~ .hint,
.select:disabled ~ .hint,
.textarea:disabled ~ .hint { color: var(--text-secondary, var(--text-muted)); }
.error-text {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--danger-text);
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}
.error-text::before { content: '⚠'; flex: 0 0 auto; }
.error-text:empty { display: none; }

/* A responsive two-column field grid that collapses on a phone. */
.grid-2, .grid-3 { display: grid; gap: var(--space-4); }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* A single PIN/OTP box set. Wide, centred, monospaced digits. */
.pin-input {
  letter-spacing: 0.5em;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  padding-left: 0.5em; /* offsets the trailing letter-space so it looks centred */
}

/* Checkbox / radio rows, sized so the whole row is the tap target. */
.check {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  min-height: var(--tap);
  padding: var(--space-2) 0;
  cursor: pointer;
  font-size: var(--text-base);
}
.check input {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  margin: 1px 0 0;
  accent-color: var(--brand-600);
  cursor: pointer;
}
.check span { color: var(--text-primary); }

/* A bordered, selectable option card (used for closure reasons, payment
   choices). Selected = brand border + tinted surface + a check, never colour
   on its own. */
.option-card {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
  min-height: var(--tap);
}
.option-card:hover { border-color: var(--border-brand); background: var(--surface-hover); }
.option-card input { flex: 0 0 auto; width: 22px; height: 22px; margin-top: 1px; accent-color: var(--brand-600); }
/* Selected. --surface-hover is used rather than --brand-50 because it is
   theme-aware: a cream tint on light, a translucent orange wash on dark.
   --brand-50 is a fixed near-white and would glare on a dark card. */
.option-card:has(input:checked) {
  border-color: var(--brand-600);
  background: var(--surface-hover);
  box-shadow: inset 0 0 0 1px var(--brand-600);
}
.option-card__title { font-weight: var(--weight-semibold); }
.option-card__desc { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; }

/* File upload slot. */
.upload {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--surface-inset);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}
.upload:hover, .upload.is-drag {
  border-color: var(--brand-600);
  background: var(--surface-hover);
}
.upload.is-filled {
  border-style: solid;
  border-color: var(--success-border);
  background: var(--success-surface);
  text-align: left;
}
.upload__label { font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.upload__meta { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; word-break: break-all; }
.upload input[type='file'] { display: none; }

/* --------------------------------------------------- 7. CARDS + PANELS */

.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}
.card + .card { margin-top: var(--space-4); }
.card--flush { padding: 0; overflow: hidden; }

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.card__title { font-size: var(--text-lg); }
.card__sub { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; }

/* A card that is itself a link (a business, a permit). */
.tile {
  display: block;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: var(--space-4);
  color: inherit;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
}
.tile:hover {
  text-decoration: none;
  border-color: var(--border-brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Quick-action tiles on the dashboard. */
.actions {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.action {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  min-height: 96px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  color: inherit;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
}
.action:hover {
  text-decoration: none;
  border-color: var(--border-brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
/* Orange surface, ink glyph. */
.action__icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-200), var(--brand-400));
  color: var(--brand-ink);
  font-size: var(--text-lg);
}
.action__title { font-weight: var(--weight-semibold); font-size: var(--text-base); }
.action__desc { font-size: var(--text-sm); color: var(--text-secondary); }

/* Stat / count cards. */
.stats {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.stat {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-xs);
}
.stat__value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: 1.1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.stat__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* A definition list for detail views. */
.dl { display: grid; gap: var(--space-3); }
@media (min-width: 640px) { .dl { grid-template-columns: repeat(2, 1fr); } }
.dl__item { min-width: 0; }
.dl__key {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}
.dl__val {
  font-size: var(--text-base);
  color: var(--text-primary);
  overflow-wrap: break-word;
  margin-top: 2px;
}

/* --------------------------------------------------------- 8. STATUS PILLS */
/* Driven by [data-tone] so one markup shape covers every status the API
   returns. The pill always carries TEXT, so the tone is a reinforcement of the
   label and never the only signal. */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid var(--border-default);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  white-space: nowrap;
}
.pill[data-tone='success'] {
  background: var(--success-surface); border-color: var(--success-border); color: var(--success-text);
}
.pill[data-tone='warning'] {
  background: var(--warning-surface); border-color: var(--warning-border); color: var(--warning-text);
}
.pill[data-tone='danger'] {
  background: var(--danger-surface); border-color: var(--danger-border); color: var(--danger-text);
}
.pill[data-tone='info'] {
  background: var(--info-surface); border-color: var(--info-border); color: var(--info-text);
}
.pill[data-tone='brand'] {
  background: var(--brand-100); border-color: var(--brand-300); color: var(--brand-900);
}

/* ------------------------------------------------------ 9. LISTS + ROWS */

.list { display: grid; gap: var(--space-3); }

.row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: inherit;
  min-height: var(--tap);
}
a.row:hover {
  text-decoration: none;
  border-color: var(--border-brand);
  background: var(--surface-hover);
}
.row__main { flex: 1 1 auto; min-width: 0; }
.row__title {
  font-weight: var(--weight-semibold);
  /* Truncate rather than widen — a long trade name must not create a
     horizontal scrollbar on a 375px screen. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row__meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row__aside { flex: 0 0 auto; display: flex; align-items: center; gap: var(--space-2); }
.row__chev { color: var(--text-muted); font-size: var(--text-lg); }

/* -------------------------- 10. SKELETONS, EMPTY + ERROR STATES */

/* A real skeleton: a grey block the shape of the thing that is coming, so the
   layout does not jump when it arrives. */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface-sunken) 25%, var(--border-subtle) 37%, var(--surface-sunken) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
.skeleton--text { height: 0.85em; margin: 0.32em 0; }
.skeleton--title { height: 1.1em; width: 60%; margin-bottom: var(--space-3); }
.skeleton--pill { height: 20px; width: 84px; border-radius: var(--radius-pill); }
.skeleton--row { height: 76px; border-radius: var(--radius-md); }
.skeleton--card { height: 132px; border-radius: var(--radius-lg); }
.skeleton--stat { height: 88px; border-radius: var(--radius-lg); }

/* Empty state: says what is missing, why, and what to do next. */
.empty {
  text-align: center;
  padding: var(--space-7) var(--space-4);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-inset);
}
.empty__icon {
  width: 56px; height: 56px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-lg);
  display: grid; place-items: center;
  background: var(--brand-100);
  color: var(--brand-900);
  font-size: 1.5rem;
}
.empty__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-2);
}
.empty__text {
  color: var(--text-secondary);
  max-width: 46ch;
  margin: 0 auto var(--space-5);
}
.empty__text:last-child { margin-bottom: 0; }

/* Error state: distinct from empty, and always offers a retry. */
.error-state {
  padding: var(--space-5);
  border: 1px solid var(--danger-border);
  border-left: 4px solid var(--danger-solid);
  border-radius: var(--radius-md);
  background: var(--danger-surface);
}
.error-state__title {
  font-weight: var(--weight-semibold);
  color: var(--danger-text);
  margin-bottom: var(--space-2);
}
.error-state__text { color: var(--text-secondary); margin-bottom: var(--space-4); }
.error-state__text:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------ 11. WIZARD */

/* The progress indicator. A numbered rail that scrolls sideways on a phone and
   spreads out on a desktop; the CURRENT step is always scrolled into view by
   js/wizard.js so the resident can see where they are. */
.stepper {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
}
.stepper::-webkit-scrollbar { display: none; }

.step {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  background: var(--surface-sunken);
  border: 1px solid transparent;
  min-height: 40px;
  white-space: nowrap;
}
.step__num {
  width: 22px; height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  background: var(--border-default);
  color: var(--text-secondary);
}
/* Current step: orange surface, INK number and label. */
.step[aria-current='step'] {
  background: var(--brand-100);
  border-color: var(--brand-400);
  color: var(--brand-900);
  font-weight: var(--weight-semibold);
}
.step[aria-current='step'] .step__num {
  background: var(--brand-400);
  color: var(--brand-ink);
}
/* Done steps carry a tick as well as a colour. */
.step.is-done { color: var(--success-text); background: var(--success-surface); }
.step.is-done .step__num { background: var(--success-solid); color: #fff; }
.step.is-done .step__num::after { content: '✓'; }
.step.is-done .step__num span { display: none; }

/* The thin bar under the rail — a second, purely visual read on progress. */
.progress {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  overflow: hidden;
  margin-bottom: var(--space-5);
}
.progress__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--brand-400), var(--brand-700));
  transition: width var(--duration-base) var(--ease-out);
}

.wizard-step { display: none; }
.wizard-step.is-active { display: block; }

.wizard-nav {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
}
.wizard-nav .btn { flex: 1 1 auto; }
@media (min-width: 640px) {
  .wizard-nav { justify-content: space-between; }
  .wizard-nav .btn { flex: 0 0 auto; }
}

/* The autosave tell. Residents need to know their typing is safe. */
.autosave {
  font-size: var(--text-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 24px;
}
.autosave[data-state='saving'] { color: var(--text-secondary); }
.autosave[data-state='saved'] { color: var(--success-text); }
.autosave[data-state='error'] { color: var(--danger-text); }

/* ----------------------------------------------- 12. TOAST, MODAL, BANNER */

.toast-host {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: var(--space-4);
  z-index: 90;
  display: grid;
  gap: var(--space-2);
  pointer-events: none;
}
@media (min-width: 640px) {
  .toast-host { left: auto; width: 380px; }
}
.toast {
  pointer-events: auto;
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--text-muted);
  box-shadow: var(--shadow-lg);
  animation: toast-in var(--duration-base) var(--ease-out);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.toast[data-tone='success'] { border-left-color: var(--success-solid); }
.toast[data-tone='danger'] { border-left-color: var(--danger-solid); }
.toast[data-tone='warning'] { border-left-color: var(--warning-solid); }
.toast[data-tone='info'] { border-left-color: var(--info-solid); }
.toast__body { flex: 1 1 auto; font-size: var(--text-sm); }
.toast__title { font-weight: var(--weight-semibold); margin-bottom: 2px; }
.toast__close {
  flex: 0 0 auto;
  background: none; border: 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-lg);
  line-height: 1;
  padding: var(--space-1);
}

.banner {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--surface-inset);
  margin-bottom: var(--space-5);
  font-size: var(--text-sm);
}
.banner[data-tone='warning'] {
  background: var(--warning-surface); border-color: var(--warning-border); color: var(--warning-text);
}
.banner[data-tone='info'] {
  background: var(--info-surface); border-color: var(--info-border); color: var(--info-text);
}
.banner[data-tone='danger'] {
  background: var(--danger-surface); border-color: var(--danger-border); color: var(--danger-text);
}
.banner[data-tone='success'] {
  background: var(--success-surface); border-color: var(--success-border); color: var(--success-text);
}
.banner__icon { flex: 0 0 auto; font-size: var(--text-lg); line-height: 1.2; }
.banner__body { flex: 1 1 auto; min-width: 0; }
.banner__title { font-weight: var(--weight-semibold); margin-bottom: 2px; }
.banner a { color: inherit; text-decoration: underline; }

dialog.modal {
  border: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  max-width: min(520px, calc(100vw - 2 * var(--gutter)));
  width: 100%;
}
dialog.modal::backdrop { background: rgba(17, 17, 32, 0.6); }
.modal__head {
  padding: var(--space-5) var(--space-5) 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}
.modal__body { padding: var(--space-4) var(--space-5); color: var(--text-secondary); }
.modal__foot {
  padding: 0 var(--space-5) var(--space-5);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ------------------------------------------------- 13. LANDING + SIGN-IN */

.hero {
  background: var(--surface-header);
  color: var(--text-inverse);
  position: relative;
  overflow: hidden;
}
/* A soft orange bloom behind the copy — decorative, so it is aria-hidden in the
   markup and carries no information. */
.hero::before {
  content: '';
  position: absolute;
  top: -30%; right: -12%;
  width: 460px; height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 146, 43, 0.4), transparent 68%);
  pointer-events: none;
}
.hero__inner {
  position: relative;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-7) var(--gutter);
  display: grid;
  gap: var(--space-6);
}
@media (min-width: 900px) {
  .hero__inner { grid-template-columns: 1.05fr 0.95fr; align-items: center; gap: var(--space-7); }
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  /* Orange surface, ink text. */
  background: var(--brand-300);
  color: var(--brand-ink);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  margin-bottom: var(--space-4);
}
.hero__title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: var(--space-4);
}
.hero__title em {
  font-style: normal;
  /* Light orange as TEXT on the near-black hero — high contrast, unlike orange
     on white. */
  color: var(--brand-300);
}
.hero__lead {
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.82);
  max-width: 48ch;
  margin-bottom: var(--space-5);
}
.hero__points { display: grid; gap: var(--space-3); margin: 0 0 var(--space-5); padding: 0; list-style: none; }
.hero__points li {
  display: flex; gap: var(--space-3); align-items: flex-start;
  color: rgba(255, 255, 255, 0.88);
  font-size: var(--text-base);
}
.hero__points li::before {
  content: '✓';
  flex: 0 0 22px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--brand-400);
  color: var(--brand-ink);
  display: grid; place-items: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}

/* The sign-in card floats on the hero. */
.auth-card {
  background: var(--surface-card);
  color: var(--text-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-5);
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
}
.auth-card__title { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.auth-card__sub { color: var(--text-secondary); font-size: var(--text-sm); margin-bottom: var(--space-5); }
.auth-alt {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: center;
}

.auth-step { display: none; }
.auth-step.is-active { display: block; }

/* Feature strip on the landing page. */
.features {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* ---------------------------------------------------------- 14. UTILITIES */

.stack > * + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-2); }
.stack-lg > * + * { margin-top: var(--space-5); }

.cluster { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.between { display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; }

.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.small { font-size: var(--text-sm); }
.tiny { font-size: var(--text-xs); }
.bold { font-weight: var(--weight-semibold); }
.center { text-align: center; }
.nums { font-variant-numeric: tabular-nums; }
.brandtext { color: var(--text-brand); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break { overflow-wrap: break-word; word-break: break-word; }

.hidden { display: none !important; }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: var(--space-4); }

/* ------------------------ 15. RESPONSIVE + REDUCED MOTION + PRINT */

/* The gutter grows on bigger screens; it never shrinks below the 16px the brief
   requires, because 1rem is the base value in :root. */
@media (min-width: 640px) { :root { --gutter: 1.5rem; } }
@media (min-width: 1024px) { :root { --gutter: 2rem; } }

/* Very narrow phones (320–360px). Tap targets and the gutter stay put; only
   type scales back, so nothing overflows. */
/* The header runs out of room before anything else does: brand lock-up, theme
   toggle, the resident's name and Sign out all compete inside 60px. The NAME is
   what goes first — the dashboard greets them by name anyway, so it is the only
   genuinely redundant item there. Dropped below 560px, where the squeeze starts. */
@media (max-width: 560px) {
  .app-header__inner > span.small { display: none; }
}

@media (max-width: 380px) {
  :root { --text-3xl: 2rem; --text-2xl: 1.6rem; --text-xl: 1.25rem; }
  .card, .auth-card { padding: var(--space-4); }
  .btn { padding: 0 var(--space-4); }
  /* At this width the LGU name under the wordmark is an ellipsis and nothing
     more, so it earns no space. */
  .brand__sub { display: none; }
}

/* TOUCH TARGETS. Everything interactive gets the full 48px, whatever its visual
   size on a roomier screen.
   ⚠️ Keyed on BOTH the viewport width AND the pointer type, deliberately.
   `(pointer: coarse)` is the semantically right test, but it is not reliable on
   its own: device emulation in DevTools and several in-app webviews report
   `fine` while running on a touchscreen, so the rule silently never applies and
   the buttons stay at their desktop size — which is exactly what happened when
   this was audited. The width query is the one that always fires on a phone; the
   pointer query then also catches a large tablet. */
@media (max-width: 640px), (pointer: coarse) {
  .btn--sm { min-height: var(--tap); }
  /* The brand lock-up and the header actions are the chrome a resident reaches
     for most; the header is 60px tall, so a 48px control fits inside it. */
  .brand, .app-header .btn { min-height: var(--tap); }
  .toast__close { min-width: 44px; min-height: 44px; }
  /* An inline link inside a paragraph is exempt from the target-size rule
     (WCAG 2.5.8) and padding it out would break the line box, so prose links
     are deliberately left alone. Standalone links are not: these are the ones
     that look and behave like buttons. */
  .auth-alt a, .app-footer a, .center > a { display: inline-block; padding: var(--space-2) 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* The skeleton shimmer is decorative; a flat block still communicates
     "loading" without moving. */
  .skeleton { animation: none; background: var(--surface-sunken); }
  .tile:hover, .action:hover { transform: none; }
}

/* A resident printing a permit summary should get the content, not the chrome. */
@media print {
  .app-header, .app-nav, .app-footer, .toast-host, .btn, .wizard-nav { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #999; break-inside: avoid; }
  .page { max-width: none; padding: 0; }
}
