:root {
    font-family: system-ui, -apple-system, sans-serif;
    color: #223349;
    background: #f4f7fa;
    line-height: 1.55;
    --navy: #173b5a;
    --ink: #142c43;
    --muted: #506175;
    --border: #d6e0e8;
    --accent: #09654e;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--municipal-link, #085b78); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid #a84b00; outline-offset: 3px; }
.skip { position: absolute; z-index: 2; padding: .65rem 1rem; background: white; transform: translateY(-150%); }
.skip:focus { transform: translateY(0); }

.frame { width: min(100% - 2rem, 66rem); margin: 0 auto; }
.site-header { background: #fff; border-bottom: 1px solid var(--border); }
.header-inner, nav, nav form, .brand { display: flex; align-items: center; }
.header-inner { min-height: 4.5rem; justify-content: space-between; gap: 1rem; padding: .75rem 0; flex-wrap: wrap; }
.brand { color: var(--navy); font-size: 1rem; font-weight: 800; letter-spacing: .035em; gap: .6rem; text-decoration: none; }
.brand span { display: grid; place-items: center; width: 2.15rem; height: 2.15rem; color: #fff; background: var(--navy); border-radius: .45rem; }
.brand img { object-fit: contain; object-position: center; }
nav { gap: .75rem 1.25rem; flex-wrap: wrap; font-size: .94rem; }
nav a, .text-button { color: var(--navy); font-weight: 650; }
.text-button { background: transparent; text-decoration: underline; text-underline-offset: 3px; border: 0; padding: 0; }
.text-button:hover { background: transparent; color: var(--accent); }
.main { padding: clamp(2rem, 5vw, 4rem) 0; }
.intro { margin-bottom: 1.6rem; }
h1, h2 { color: var(--ink); line-height: 1.15; margin: 0 0 .55rem; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 4.6vw, 3.25rem); font-weight: 760; letter-spacing: -.035em; }
h2 { font-size: clamp(1.15rem, 2.6vw, 1.5rem); letter-spacing: -.015em; }
p { margin: .5rem 0 1rem; }
.intro p, .tile > p { color: var(--muted); }
.demo-label { display: inline-block; margin: 0 0 1rem; border-radius: 2rem; padding: .3rem .7rem; color: #23466c; background: #e3edf7; font-size: .85rem; font-weight: 650; }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 1rem; align-items: start; }
.tile { padding: clamp(1rem, 3vw, 1.6rem); border-radius: .8rem; border: 1px solid var(--border); background: #fff; min-width: 0; }
.tile + .tile:not(.town-link) { margin-top: 1rem; }
.tile-grid .tile + .tile:not(.town-link) { margin-top: 0; }
.town-link { display: flex; justify-content: space-between; align-items: center; gap: 1rem; text-decoration: none; color: var(--ink); font-weight: 750; font-size: 1.4rem; }
.town-link:hover { border-color: var(--accent); color: var(--accent); }
.town-link span:last-child { color: var(--accent); }
form { margin: 0; }
.stack { display: grid; gap: .35rem; }
.stack label:not(:first-child) { margin-top: .35rem; }
label { font-weight: 650; font-size: .9rem; }
input:not([type=hidden]), select, textarea { width: 100%; min-width: 0; background: #fff; border: 1px solid #8b9bad; border-radius: .35rem; padding: .55rem .65rem; color: inherit; }
input[type=file] { max-width: 25rem; }
button, .button { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-height: 2.65rem; padding: .55rem .9rem; color: #fff; background: var(--navy); border: 1px solid transparent; border-radius: .45rem; font-weight: 675; text-decoration: none; text-align: center; }
button:hover, .button:hover { background: #225579; }
.text-button { min-height: 0; }
.stack button { justify-self: start; margin-top: .35rem; }
.secondary { background: #fff; border-color: #8b9bad; color: var(--navy); }
.secondary:hover { background: #edf3f8; }
details { margin-top: 1rem; color: var(--muted); font-size: .9rem; }
summary { cursor: pointer; }
code { overflow-wrap: anywhere; }
.back { display: inline-block; margin: .7rem 0; font-weight: 600; }
.error, .notice { padding: .65rem .8rem; border-radius: .35rem; }
.error { color: #842027; background: #fce9e9; }
.notice { color: #1a505d; background: #e1f3f4; }
.status { display: inline-flex; margin-bottom: .5rem; border-radius: 2rem; padding: .2rem .65rem; font-size: .85rem; font-weight: 700; }
.paid { background: #dbf3e8; color: #125140; }
.unpaid { background: #fdf0d7; color: #6e4507; }
.fee { display: flex; gap: 1rem; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.fee p { margin-bottom: 0; }
.fee-actions { display: grid; gap: .55rem; justify-items: end; }
.amount { font-weight: 750; font-variant-numeric: tabular-nums; font-size: 1.35rem; }
.pay-details { display: flex; flex-wrap: wrap; gap: 1rem 2rem; }
dl { display: grid; grid-template-columns: max-content 1fr; align-items: baseline; gap: .65rem 1rem; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 675; }
figure { text-align: center; margin: 0; }
figure img { max-width: 100%; height: auto; }
.import-form, .section-title, .pager { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: .75rem; }
.section-title { align-items: center; margin-bottom: .55rem; }
h2 span { color: var(--muted); font-size: .9em; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: .6rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: .9rem; }
td small { display: block; color: var(--muted); }
.pager { margin-top: .7rem; justify-content: start; }
.block-section { margin-block: 1rem; }
.narrow { max-width: 36rem; }
.community-map { height: clamp(16rem, 52vh, 32rem); margin: .8rem 0; border: 1px solid var(--line); border-radius: .5rem; isolation: isolate; }
.map-edit-actions[hidden] { display: none; }
.community-csv-header { overflow-wrap: anywhere; }
.meter-preview { display: block; max-width: 100%; max-height: 65vh; margin: .6rem 0; touch-action: none; cursor: crosshair; border-radius: .4rem; }
.trial-status { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; border-left: .3rem solid var(--navy); }
.trial-status p { margin-bottom: 0; }
.trial-agenda { display: flex; flex-direction: column; }
.trial-agenda form { margin-top: auto; }
.trial-agenda-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: .6rem; border: 0; padding: 0; }
.trial-choice { display: flex; align-items: flex-start; gap: .55rem; border: 1px solid var(--border); border-radius: .45rem; padding: .6rem; }
.trial-choice input { flex: none; margin-top: .18rem; }
.trial-choice small { display: block; margin-top: .15rem; }
.fleet-label { display: grid; width: fit-content; justify-items: center; gap: .4rem; padding: 1rem; background: #fff; color: #000; }
.fleet-label img { width: min(336px, 68vw); height: auto; }
@media print {
    .fleet-label-page .site-header, .fleet-label-page .intro, .fleet-label-page .demo-label, .fleet-label-actions { display: none; }
    .fleet-label-page .main { padding: 0; margin: 0; max-width: none; }
    .fleet-label { width: 75mm; padding: 4mm; border: 1px dashed #000; box-shadow: none; break-inside: avoid; }
    .fleet-label img { width: 46mm; }
}
@media print {
    .section-nav, .community-map, .skip { display: none; }
    .bulletin-print { border: 0; box-shadow: none; }
    .bulletin-print > section { break-inside: avoid-page; }
}
.muted, .stack small, .content-list small { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .8rem; }
.validation-errors { padding-inline-start: 1.85rem; }
.content-list { padding: 0; margin: 0; list-style: none; }
.content-list li { padding: .65rem 0; }
.content-list li + li { border-top: 1px solid var(--border); }
.content-list small { display: block; margin-top: .15rem; }
.article-text { white-space: pre-wrap; overflow-wrap: anywhere; }
textarea { resize: vertical; }

@media (max-width: 32rem) {
    .fee-actions { justify-items: start; }
    h1 { font-size: 2rem; }
    dl { gap: .5rem .75rem; }
}

.section-nav, .filter-links { gap: .35rem; }
.section-nav { margin: 0 0 1rem; border-bottom: 1px solid var(--border); }
.section-nav a, .filter-links a { padding: .45rem .7rem; text-decoration: none; }
.section-nav a[aria-current], .filter-links a[aria-current] {
    border-radius: .35rem;
    background: #e3edf7;
    color: var(--ink);
    text-decoration: underline;
}
.inline-fields { display: flex; gap: .75rem; align-items: end; flex-wrap: wrap; }
.inline-fields .stack { min-width: min(13rem, 100%); }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; padding: 0; accent-color: var(--navy); }
.check-label { display: flex; align-items: center; gap: .4rem; }

[hidden] { display: none !important; }
audio { max-width: 100%; margin-top: .5rem; }
@media print {
    .site-header, .back, .skip, .demo-label, button { display: none !important; }
    :root { color: #111; background: #fff; }
    .frame { width: 100%; }
    .main { padding: 0; }
    .tile { border: 0; padding: 1rem 0; }
    .content-list li { break-inside: avoid; }
}

.team-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .85rem; margin-bottom: 1rem; }
.team-summary .tile { text-decoration: none; margin: 0; font-weight: 625; }
.team-summary strong { display: block; color: var(--ink); font-size: 1.65rem; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; gap: 1rem; }
.workspace-grid .tile + .tile { margin-top: 0; }
.calendar-items time { display: inline-block; min-width: 3.7rem; color: var(--muted); }
@media (max-width: 47rem) { .workspace-grid { grid-template-columns: 1fr; } }
.public-media { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 1rem; }
.public-media img { width: 100%; height: auto; display: block; border-radius: .35rem; }
.resident-picker { border: 1px solid var(--border); border-radius: .4rem; max-height: 14rem; overflow-y: auto; }
.resident-picker label { padding: .2rem 0; }

.wrap-anywhere { overflow-wrap: anywhere; }
.message-preview { white-space: pre-wrap; overflow-wrap: anywhere; }

.budget-code-field { align-content: start; min-width: 0; }
.budget-code-control { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .4rem; }
.budget-code-control input { width: 100%; min-width: 0; }
.stack .budget-help-trigger { margin: 0; padding: 0; inline-size: 2.7rem; color: var(--navy); background: #fff; border-color: #8b9bad; }
.budget-help-trigger[aria-expanded="true"] { background: #e7eff6; }
.budget-tooltip { position: absolute; z-index: 5; inset-block-start: 100%; inset-inline-end: 0; inline-size: 100%; max-inline-size: 22rem; padding: .75rem .85rem; border-radius: .5rem; background: #1d364d; color: #fff; font-size: .9rem; line-height: 1.45; box-shadow: 0 .35rem 1rem #172c4040; overflow-wrap: anywhere; }

.town-crest { object-fit: contain; }
.person-card { display: flex; flex-wrap: wrap; align-items: start; gap: 1rem; }
.person-card img { object-fit: cover; border-radius: .6rem; }
.person-card h3 { margin: 0; overflow-wrap: anywhere; }
.preserve-lines { white-space: pre-line; }

.library-catalogue { scroll-margin-top: 1rem; }
.library-catalogue .section-title { flex-wrap: wrap; }
.library-catalogue-frame { display: block; width: 100%; min-height: 34rem; height: min(54rem, 80vh); border: 1px solid var(--border); border-radius: .65rem; background: #fff; }
.municipal-social-links { display: flex; flex-wrap: wrap; gap: .65rem; list-style: none; margin: 1rem 0 0; padding: 0; }

.record-plan-breadcrumb { margin-bottom: .85rem; }
.record-plan-breadcrumb ol { display: flex; flex-wrap: wrap; gap: .35rem .5rem; margin: 0; padding: 0; list-style: none; }
.record-plan-breadcrumb li + li::before { content: "/"; padding-inline-end: .5rem; color: var(--muted); }
.record-plan-breadcrumb span { font-weight: 700; overflow-wrap: anywhere; }
.record-plan-actions { margin-bottom: 1rem; }
.record-plan-layout { display: grid; gap: 1rem; align-items: start; }
.record-plan-layout > .tile + .tile:not(.town-link) { margin-top: 0; }
.record-plan-editor { scroll-margin-top: 1rem; }
.record-plan-editor .section-title { align-items: start; flex-wrap: wrap; }
.record-plan-list { list-style: none; margin: .9rem 0 0; padding: 0; }
.record-plan-row { border-top: 1px solid var(--border); padding: .85rem 0; }
.record-plan-name { display: grid; grid-template-columns: minmax(2rem, auto) minmax(0, 1fr) auto; gap: .6rem; align-items: baseline; font-weight: 650; overflow-wrap: anywhere; }
.record-plan-code { font-variant-numeric: tabular-nums; }
.record-plan-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem 1rem; padding-top: .25rem; }
.record-plan-row-meta small { color: var(--muted); }
@media (min-width: 54rem) {
    .record-plan-layout-split { grid-template-columns: minmax(19rem, .85fr) minmax(0, 1.15fr); }
}
