/*
 * The citizen portal (server/providers/civic/publicPortal.js), in the
 * landing page's look (site/site.css): a navy header and hero, a white and
 * sand body, amber buttons, Public Sans, 10 px corners. Phone width first.
 * The application form's parts are drawn by src/civic/permitFormView.js
 * with `pf-` classes, styled at the end.
 */
@font-face {
  font-family: 'Public Sans';
  src: url('/portal/fonts/public-sans.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --navy: #1f2a33;
  --navy-deep: #16202a;
  --navy-line: #33424f;
  --ink: #1a242c;
  --muted: #4f5d68;
  --paper: #ffffff;
  --sand: #f6f4ef;
  --line: #dde2e6;
  --line-strong: #b9c1c7;
  --amber: #f08c2a;
  --amber-hover: #f5a34f;
  --amber-ink: #9c4f08;
  --amber-soft: #fdf0e2;
  --on-dark: #ffffff;
  --on-dark-muted: #c8ced3;
  --focus: #2b7fd8;
  --radius: 10px;
  --card-radius: 14px;
  --ok: #1f7a4d;
  --ok-bg: #e6f4ec;
  --info: #1d5fa8;
  --info-bg: #e7f0fb;
  --bad: #b3261e;
  --bad-bg: #fdecea;
  --off: #4f5d68;
  --off-bg: #eceff1;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1160px;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--sand);
  color: var(--ink);
  font-family:
    'Public Sans',
    system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a {
  color: var(--info);
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.wrap {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
  width: 100%;
}
.skip {
  position: absolute;
  left: 16px;
  top: -80px;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  z-index: 20;
  font-weight: 700;
}
.skip:focus {
  top: 12px;
}

/* ── Header ─────────────────────────────────────────────────────────── */
/* The header stays in view on every page. */
header.top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--navy);
  color: var(--on-dark);
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--navy-line);
}
/* A link to a spot on the page lands below the header. */
html {
  scroll-padding-top: calc(var(--head-h, 68px) + 12px);
}
.bar {
  display: flex;
  align-items: center;
  gap: 16px 24px;
  min-height: 68px;
  flex-wrap: wrap;
  padding-top: 10px;
  padding-bottom: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: var(--on-dark);
  text-decoration: none;
  min-width: 0;
  line-height: 1.25;
}
.brand small {
  display: block;
  font-weight: 500;
  color: var(--on-dark-muted);
  font-size: 0.8rem;
}
.seal {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: #2c3a46;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--amber);
  overflow: hidden;
}
.seal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.nav {
  display: flex;
  gap: 4px 6px;
  margin-left: auto;
  font-weight: 600;
  font-size: 0.95rem;
  flex-wrap: wrap;
  align-items: center;
}
.nav a {
  text-decoration: none;
  color: var(--on-dark-muted);
  padding: 8px 10px;
  border-radius: 8px;
}
.nav a:hover {
  color: var(--on-dark);
  background: rgba(255, 255, 255, 0.06);
}
.nav a[aria-current='page'] {
  color: var(--on-dark);
  box-shadow: inset 0 -3px 0 var(--amber);
  border-radius: 8px 8px 0 0;
}
.head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.btn.menu-button {
  display: none;
}
.account {
  position: relative;
}
.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(20, 30, 40, 0.18);
  min-width: 230px;
  padding: 6px;
  z-index: 10;
}
.account-menu p {
  margin: 6px 10px 8px;
  font-size: 0.85rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.account-menu a,
.account-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
  cursor: pointer;
}
.account-menu a:hover,
.account-menu button:hover {
  background: var(--sand);
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  padding: 10px 16px;
  min-height: 44px;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--muted);
}
.btn.primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1a1a;
}
.btn.primary:hover {
  background: var(--amber-hover);
  border-color: var(--amber-hover);
}
.btn.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--info);
  padding-left: 8px;
  padding-right: 8px;
}
.btn.danger {
  color: var(--bad);
}
.btn.on-dark {
  background: transparent;
  color: var(--on-dark);
  border-color: var(--navy-line);
}
.btn.on-dark:hover {
  border-color: var(--on-dark-muted);
}
.btn[aria-disabled='true'],
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn.small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.88rem;
}
.link-button {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--info);
  text-decoration: underline;
  cursor: pointer;
}

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero {
  background: var(--navy);
  color: var(--on-dark);
  padding: 28px 0 64px;
}
.hero.short {
  padding-bottom: 56px;
}
.hero h1 {
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  line-height: 1.15;
  margin: 0 0 10px;
  letter-spacing: -0.015em;
}
.hero.short h1 {
  font-size: clamp(1.6rem, 3.6vw, 2.3rem);
}
.hero p.lead {
  color: var(--on-dark-muted);
  margin: 0 0 22px;
  max-width: 660px;
}
.hero .crumb {
  color: var(--on-dark-muted);
  margin: 0 0 8px;
  font-size: 0.92rem;
}
.hero .crumb a {
  color: var(--on-dark);
}
.search {
  display: flex;
  gap: 10px;
  max-width: 720px;
}
.search input,
.search select {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 13px 16px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  color: var(--ink);
  background: var(--paper);
}
.search input:focus-visible {
  outline-color: var(--amber);
}
.search .btn {
  padding: 0 22px;
}
.search-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--on-dark);
}
.filter-row {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--on-dark);
}
.filter-row select {
  font: inherit;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 0;
}
.quick {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.quick a {
  border: 1px solid var(--navy-line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.9rem;
  color: var(--on-dark);
  text-decoration: none;
}
.quick a:hover {
  border-color: var(--on-dark-muted);
}

/* ── Main ───────────────────────────────────────────────────────────── */
main {
  flex: 1;
  margin-top: -36px;
  padding-bottom: 64px;
}
main:focus,
#page-title:focus {
  /* Moved to on each new page for screen readers; not a control. */
  outline: none;
}
main h2 {
  font-size: 1.45rem;
  margin: 40px 0 6px;
  line-height: 1.25;
}
main h2:first-child {
  margin-top: 8px;
}
.section-title {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin: 44px 0 12px;
}
p.lead {
  color: var(--muted);
  margin: 0 0 18px;
  max-width: 70ch;
}
.status {
  min-height: 0;
  margin: 0;
}
.status:not(:empty) {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 0 0 16px;
}
.status.error {
  border-color: #f0b8b3;
  background: var(--bad-bg);
  color: var(--bad);
}
.status.ok {
  border-color: #b8dfc9;
  background: var(--ok-bg);
  color: var(--ok);
}
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 2px rgba(20, 30, 40, 0.04);
  position: relative;
  min-width: 0;
}
.card.link:hover {
  border-color: #c7cdd2;
  box-shadow: 0 6px 18px rgba(20, 30, 40, 0.08);
}
.card h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
}
.card h3 a {
  color: inherit;
  text-decoration: none;
}
/* The whole card opens its link. */
.card.link h3 a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--card-radius);
}
.card.link:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.card.link h3 a:focus-visible {
  outline: none;
}
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.ico {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--amber-soft);
  display: grid;
  place-items: center;
  color: var(--amber-ink);
  flex: none;
}
.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
  padding: 0;
  list-style: none;
}
.meta li,
.meta span {
  background: var(--sand);
  border-radius: 12px;
  padding: 3px 10px;
}
.count {
  margin-top: auto;
  font-weight: 650;
  color: var(--amber-ink);
  font-size: 0.92rem;
}
.row {
  display: flex;
  gap: 10px;
  margin-top: auto;
  flex-wrap: wrap;
  align-items: center;
}
.checklist {
  margin: 0;
  padding: 0 0 0 20px;
  font-size: 0.92rem;
  color: var(--ink);
}
.checklist li {
  margin: 2px 0;
}
.checklist small {
  color: var(--muted);
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  padding: 20px;
}
.panel + .panel {
  margin-top: 16px;
}
.two-col > .panel + .panel,
.apply > .panel + .panel {
  margin-top: 0;
}
.panel h2,
.panel h3 {
  margin-top: 0;
}
.panel h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.empty {
  color: var(--muted);
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: var(--card-radius);
  padding: 20px;
  margin: 0;
}
.pill {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.4;
}
.pill.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.pill.info {
  background: var(--info-bg);
  color: var(--info);
}
.pill.warn {
  background: var(--amber-soft);
  color: var(--amber-ink);
}
.pill.off {
  background: var(--off-bg);
  color: var(--off);
}
.pill.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

/* ── My applications ────────────────────────────────────────────────── */
.apps {
  list-style: none;
  margin: 0;
  padding: 6px 20px;
}
.app {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 2fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.app:last-child {
  border-bottom: 0;
}
.app b {
  display: block;
}
.app small {
  color: var(--muted);
  display: block;
}
.app .row {
  margin: 0;
  justify-content: flex-end;
}
.steps {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}
.steps i {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
}
.steps i.done {
  background: var(--amber);
}

/* ── One application ────────────────────────────────────────────────── */
.timeline {
  list-style: none;
  margin: 12px 0 4px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.timeline li {
  font-size: 0.85rem;
  color: var(--muted);
  padding-top: 12px;
  border-top: 6px solid var(--line);
  border-radius: 3px 3px 0 0;
}
.timeline li.done {
  border-top-color: var(--amber);
  color: var(--ink);
  font-weight: 600;
}
.timeline li.current {
  border-top-color: var(--amber-hover);
  border-top-style: dashed;
  color: var(--ink);
}
.two-col {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  align-items: start;
}
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 0.95rem;
}
.facts dt {
  color: var(--muted);
}
.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.request {
  border: 1px solid #f3dcbb;
  background: #fff8ec;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}
.request.answered {
  border-color: var(--line);
  background: var(--sand);
}
.request h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}
.request p {
  margin: 0 0 10px;
  white-space: pre-wrap;
}
.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.message {
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--sand);
  max-width: 90%;
}
.message.mine {
  align-self: flex-end;
  background: var(--info-bg);
}
.message small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}
.message p {
  margin: 2px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.lines th,
.lines td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.lines th {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lines td.amount,
.lines th.amount {
  text-align: right;
  white-space: nowrap;
}
.lines tfoot td {
  font-weight: 700;
  border-bottom: 0;
}
.files {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
}
.files li {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.files li span {
  overflow-wrap: anywhere;
}
.files small {
  color: var(--muted);
}
textarea.box,
input.box,
select.box {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
textarea.box {
  min-height: 96px;
  resize: vertical;
}
label.field {
  display: block;
  font-weight: 600;
  margin: 12px 0 6px;
}
.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 4px 0 0;
}
details.answers summary {
  cursor: pointer;
  font-weight: 700;
  padding: 4px 0;
}
.answer-section h4 {
  margin: 16px 0 6px;
  font-size: 1rem;
}

/* ── Applying ───────────────────────────────────────────────────────── */
.apply {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.progress {
  position: sticky;
  top: 16px;
}
.progress ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}
.progress li {
  counter-increment: step;
}
.progress a,
.progress span.step {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
}
.progress a:hover {
  background: var(--sand);
}
.progress a::before,
.progress span.step::before {
  content: counter(step);
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}
.progress .done a::before {
  content: '✓';
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1a1a;
}
.progress a[aria-current='step'] {
  background: var(--amber-soft);
  font-weight: 700;
}
.progress a[aria-current='step']::before {
  border-color: var(--amber-ink);
  color: var(--amber-ink);
}
.fee-box {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.fee-box h3 {
  font-size: 0.95rem;
  margin: 0 0 6px;
}
.fee-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
}
.fee-box li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
}
.fee-box .total {
  font-weight: 700;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 6px;
}
.saved {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.3em;
  margin: 8px 0 0;
}
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.form-actions .row {
  margin: 0;
}
.review-section {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.review-section:last-of-type {
  border-bottom: 0;
}
.review-section header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.review-section h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.attest {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 16px 0 0;
  padding: 14px;
  background: var(--sand);
  border-radius: var(--radius);
}
.attest input {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex: none;
}
.done-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ok-bg);
  color: var(--ok);
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 12px;
}
.big-number {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  margin: 4px 0 12px;
}

/* ── Sign in ────────────────────────────────────────────────────────── */
.signin {
  max-width: 560px;
}
.signin .choice {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.signin .or {
  text-align: center;
  color: var(--muted);
  margin: 16px 0;
  font-size: 0.9rem;
}
.google-mark {
  width: 20px;
  height: 20px;
  flex: none;
}
.dev-note {
  background: #fff8ec;
  border: 1px solid #f3dcbb;
  color: var(--amber-ink);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.9rem;
  margin: 12px 0 0;
}

/* ── Records (documents, graves, projects) ─────────────────────────── */
.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.place {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  padding: 16px 20px;
  cursor: pointer;
}
.place:hover {
  border-color: #c7cdd2;
  box-shadow: 0 6px 18px rgba(20, 30, 40, 0.08);
}
.place span {
  color: var(--muted);
  font-size: 0.92rem;
}
.doc {
  display: flex;
  gap: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  padding: 16px 20px;
}
.doc h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}
.doc .meta-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.doc .figures {
  margin: 6px 0 0;
  font-weight: 650;
}
.doc .description {
  margin: 8px 0 0;
}
.doc .row {
  margin-top: 12px;
}
.thumb {
  width: 72px;
  height: 92px;
  flex: none;
  border-radius: 8px;
  background: var(--sand);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  object-fit: cover;
}
.number {
  font-weight: 700;
  color: var(--muted);
}
.back {
  margin: 0 0 12px;
}

/* ── The issued permit and its check page ──────────────────────────── */
.permit-doc {
  background: var(--paper);
  border: 2px solid var(--navy);
  border-radius: var(--card-radius);
  padding: 28px;
  max-width: 820px;
}
.permit-doc header {
  display: flex;
  gap: 14px;
  align-items: center;
  border-bottom: 2px solid var(--navy);
  padding-bottom: 14px;
  margin-bottom: 16px;
}
.permit-doc header .seal {
  background: var(--navy);
}
.permit-doc h1 {
  font-size: 1.6rem;
  margin: 0;
  line-height: 1.2;
}
.permit-doc .kind {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}
.permit-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 20px;
  align-items: start;
}
.qr {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}
.qr svg {
  width: 168px;
  height: 168px;
  display: block;
  margin: 0 auto 6px;
}
.qr p {
  margin: 0;
  overflow-wrap: anywhere;
}
.check-card {
  max-width: 640px;
}
.check-status {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}
.check-status .done-mark {
  margin: 0;
}
.check-status.off .done-mark {
  background: var(--off-bg);
  color: var(--off);
}

/* ── Dialog ─────────────────────────────────────────────────────────── */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(22, 32, 42, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}
.dialog {
  background: var(--paper);
  border-radius: var(--card-radius);
  padding: 22px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.dialog h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}
.dialog p {
  margin: 0 0 18px;
  color: var(--muted);
}
.dialog .row {
  justify-content: flex-end;
}

/* ── Footer ─────────────────────────────────────────────────────────── */
footer.foot {
  background: var(--navy-deep);
  color: var(--on-dark-muted);
  padding: 28px 0 calc(28px + env(safe-area-inset-bottom));
  font-size: 0.9rem;
}
footer.foot p {
  margin: 0 0 6px;
}
footer.foot a {
  color: var(--on-dark);
}
footer.foot strong {
  color: var(--on-dark);
}

/* ── The application form (permitFormView.js) ──────────────────────── */
.pf-form {
  display: block;
}
.pf-section {
  border: 0;
  margin: 0;
  padding: 0;
}
.pf-section-title {
  font-size: 1.3rem;
  margin: 0 0 6px;
}
.pf-section-help {
  color: var(--muted);
  margin-bottom: 12px;
}
.pf-section-help p,
.pf-info-text p {
  margin: 0 0 8px;
}
.pf-field {
  margin: 18px 0 0;
}
.pf-label,
.pf-fieldset > legend {
  display: block;
  font-weight: 650;
  margin: 0 0 6px;
  padding: 0;
}
.pf-required {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--amber-ink);
  background: var(--amber-soft);
  border-radius: 999px;
  padding: 1px 8px;
  vertical-align: 2px;
}
.pf-help {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 6px;
}
.pf-input,
.pf-select {
  width: 100%;
  font: inherit;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  min-height: 46px;
}
textarea.pf-input {
  min-height: 110px;
  resize: vertical;
}
.pf-input-date {
  max-width: 220px;
}
.pf-input-line {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
}
.pf-affix {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.pf-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.pf-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pf-choices-inline {
  flex-direction: row;
  flex-wrap: wrap;
}
.pf-choices > legend {
  float: left;
  width: 100%;
}
.pf-choice {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
  min-height: 46px;
}
.pf-choices-inline .pf-choice {
  min-width: 110px;
}
.pf-choice input {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: none;
  accent-color: var(--amber-ink);
}
.pf-choice:has(input:checked) {
  border-color: var(--amber-ink);
  background: var(--amber-soft);
}
.pf-person-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.pf-sub {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pf-sub-label {
  font-size: 0.9rem;
  font-weight: 600;
}
.pf-file .pf-sub {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--sand);
}
.pf-file-input {
  border: 0;
  padding: 6px 0;
  background: none;
  min-height: 0;
  max-width: 100%;
}
/* The browser's own "Choose files" button, in the portal's look. */
.pf-file-input::file-selector-button {
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-right: 12px;
  cursor: pointer;
}
.pf-file-input:focus-visible::file-selector-button {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.pf-file-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}
.pf-file-item {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.pf-file-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.pf-file-size {
  color: var(--muted);
  font-size: 0.85rem;
}
.pf-file-note {
  margin-top: 6px;
}
/* A file that could not be added: in red, so it reads as a problem. */
.pf-file-note.pf-file-error {
  color: var(--bad);
  background: var(--bad-bg);
  border-left: 3px solid var(--bad);
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 600;
}
.pf-file-bad .pf-sub {
  border-color: var(--bad);
}
.pf-link-button {
  border: 0;
  background: none;
  color: var(--info);
  text-decoration: underline;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 0;
  margin-left: auto;
}
.pf-link-button[aria-disabled='true'] {
  color: var(--muted);
  cursor: not-allowed;
  text-decoration: none;
}
.pf-button {
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  padding: 9px 14px;
  min-height: 44px;
  cursor: pointer;
  margin-top: 10px;
}
.pf-button[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
}
.pf-group-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pf-group-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 16px 12px;
  margin: 0;
  background: #fcfbf8;
  display: flex;
  flex-direction: column;
}
.pf-group-item-title {
  font-weight: 700;
  padding: 0 6px;
}
.pf-address-list {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  margin-top: 4px;
  background: var(--paper);
  overflow: hidden;
}
.pf-address-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  font: inherit;
  padding: 10px 12px;
  cursor: pointer;
}
.pf-address-option:hover,
.pf-address-option:focus-visible {
  background: var(--amber-soft);
}
.pf-address-note {
  font-size: 0.85rem;
  color: var(--muted);
}
.pf-address-state {
  margin-top: 6px;
}
.pf-signature .pf-statement {
  background: var(--sand);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.pf-signature .pf-statement p {
  margin: 0 0 6px;
}
.pf-signature .pf-choice {
  margin-bottom: 10px;
  max-width: 200px;
}
.pf-info {
  background: var(--info-bg);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.pf-info-title {
  margin: 0 0 4px;
  font-size: 1rem;
}
.pf-error {
  color: var(--bad);
  font-weight: 600;
  font-size: 0.92rem;
  margin: 6px 0 0;
}
.pf-invalid .pf-input,
.pf-invalid .pf-choice {
  border-color: var(--bad);
}
.pf-problems {
  border: 2px solid var(--bad);
  background: var(--bad-bg);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.pf-problems-title {
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--bad);
}
.pf-problems-list {
  margin: 0;
  padding-left: 20px;
}
.pf-problems-list a {
  color: var(--bad);
}
.pf-empty {
  color: var(--muted);
}

/* ── Applying: the header and the permit's name stay in view ───────── */
body.frozen-head .hero {
  position: sticky;
  top: var(--head-h, 68px);
  z-index: 29;
  padding: 14px 0 16px;
  box-shadow: 0 8px 16px -12px rgba(10, 16, 22, 0.55);
}
body.frozen-head .hero h1 {
  margin-bottom: 2px;
}
body.frozen-head .hero p.lead {
  margin: 0;
}
body.frozen-head main {
  margin-top: 0;
  padding-top: 24px;
}
body.frozen-head .progress {
  top: calc(var(--frozen-h, 200px) + 16px);
}
/* A question jumped to (from a problem's link) lands below the frozen part. */
html:has(body.frozen-head) {
  scroll-padding-top: calc(var(--frozen-h, 200px) + 12px);
}
@media (max-width: 760px) {
  body.frozen-head .hero {
    padding: 10px 0 12px;
  }
  body.frozen-head .hero .crumb {
    display: none;
  }
  body.frozen-head .hero h1 {
    font-size: 1.35rem;
  }
  body.frozen-head .hero p.lead {
    font-size: 0.92rem;
  }
}
/* A short screen (a phone on its side) keeps all its room for the form. */
@media (max-height: 560px) {
  body.frozen-head .hero {
    position: static;
  }
}

/* ── Narrow screens ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .apply,
  .two-col {
    grid-template-columns: 1fr;
  }
  .progress {
    position: static;
  }
  .progress ol {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .progress li:not(.here) a span,
  .progress li:not(.here) span.step span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}
.acct-initial {
  display: none;
}
@media (max-width: 760px) {
  .btn.menu-button {
    display: inline-flex;
  }
  /* One header row on a phone: the account is its initial, the city's
     name gives way first. */
  .acct-name {
    display: none;
  }
  .acct-initial {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
  }
  .brand {
    flex: 1 1 0;
  }
  .brand > span:last-child {
    min-width: 0;
    overflow: hidden;
  }
  #city {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .bar {
    flex-wrap: wrap;
  }
  .head-actions {
    flex: none;
  }
  .nav {
    display: none;
    order: 5;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    margin: 0;
  }
  .nav.open {
    display: flex;
  }
  .nav a {
    padding: 12px;
  }
  .nav a[aria-current='page'] {
    box-shadow: inset 4px 0 0 var(--amber);
    border-radius: 0 8px 8px 0;
  }
  .head-actions {
    margin-left: auto;
    gap: 8px;
  }
  .bar {
    column-gap: 10px;
  }
  .app {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .app .row {
    justify-content: flex-start;
  }
  .search {
    flex-direction: column;
  }
  .search .btn {
    padding: 12px 22px;
  }
  .permit-body {
    grid-template-columns: 1fr;
  }
  .timeline li {
    font-size: 0.72rem;
  }
  .doc {
    flex-direction: column;
  }
  .thumb {
    width: 56px;
    height: 72px;
  }
  .panel,
  .card {
    padding: 16px;
  }
  .apps {
    padding: 4px 16px;
  }
}
@media (max-width: 420px) {
  .brand small {
    display: none;
  }
  .head-actions .btn {
    padding: 8px 12px;
  }
}

/* ── Printing the issued permit ────────────────────────────────────── */
@media print {
  body {
    background: #fff;
    font-size: 11pt;
  }
  header.top,
  .hero,
  footer.foot,
  .no-print,
  .skip {
    display: none !important;
  }
  main {
    margin: 0;
    padding: 0;
  }
  .wrap {
    padding: 0;
    max-width: none;
  }
  .permit-doc {
    border: 2px solid #000;
    max-width: none;
  }
}

/* A list's own title starts below the hero's overlap. */
#view > h2:first-child,
#view > .back:first-child {
  margin-top: 52px;
}
/* Facts in a card stack, so long questions keep their answers readable. */
.card .facts {
  grid-template-columns: 1fr;
  gap: 0;
}
.card .facts dt {
  margin-top: 8px;
  font-size: 0.85rem;
}
.grid.wide {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}
form.panel h2 {
  margin-top: 28px;
}
