:root {
  --ink: #17332d;
  --ink-soft: #50655f;
  --paper: #fffdf8;
  --surface: #f6f1e7;
  --sunset: #c84f2c;
  --sunset-dark: #96371e;
  --gold: #f1b24a;
  --sage: #2c6e60;
  --sage-light: #dceae4;
  --border: #d8d0c1;
  --danger: #a51d2d;
  --success: #12623f;
  --shadow: 0 12px 32px rgba(37, 49, 43, .09);
  --radius: 18px;
  --content: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
a { color: var(--sage); text-underline-offset: 3px; }
a:hover { color: var(--sunset-dark); }
[v-cloak] { display: none; }

.boot-status {
  margin: 2rem auto;
  max-width: 46rem;
  padding: 1rem 1.25rem;
  color: #17332d;
  background: #fff4dc;
  border: 2px solid #d69a2d;
  border-radius: .75rem;
  font: 700 1rem/1.5 system-ui, sans-serif;
}

.boot-status-error {
  border-color: #a12828;
  background: #fff0f0;
  color: #651b1b;
}

.sr-only, .live-region {
  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: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 9999;
  padding: .8rem 1rem;
  background: var(--ink);
  color: white;
  border-radius: 8px;
}
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 4px solid #1769aa; outline-offset: 3px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 253, 248, .96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.nav-shell {
  width: min(var(--content), calc(100% - 2rem));
  min-height: 76px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 1.2rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50% 50% 48% 52%;
  background: var(--sunset);
  color: white;
  letter-spacing: -.04em;
}
.nav-links { display: flex; align-items: center; gap: .2rem; margin-left: auto; }
.nav-links a {
  color: var(--ink);
  padding: .65rem .75rem;
  border-radius: 9px;
  text-decoration: none;
}
.nav-links a:hover, .nav-links a.router-link-active { background: var(--sage-light); }
.nav-account { display: flex; align-items: center; gap: .7rem; }
.nav-toggle { display: none; margin-left: auto; background: transparent; border: 0; font-size: 1.5rem; }
.user-chip { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.setup-banner, .offline-banner { padding: .7rem 1rem; text-align: center; }
.setup-banner { background: #fff0c7; color: #5b3a00; border-bottom: 1px solid #d8a640; }
.offline-banner { background: #153f36; color: white; }

main { min-height: calc(100vh - 230px); }
.page, .section { width: min(var(--content), calc(100% - 2rem)); margin: 0 auto; }
.page { padding: 3.5rem 0 4.5rem; }
.page-narrow { max-width: 760px; }
.section { padding: 4.5rem 0; }
.section-tint { background: var(--surface); }
.section-heading { max-width: 690px; margin-bottom: 2rem; }
.eyebrow { color: var(--sunset-dark); font-weight: 700; letter-spacing: .09em; text-transform: uppercase; font-size: .85rem; }
h1, h2, h3 { line-height: 1.12; }
h1, h2 { font-family: "DM Serif Display", Georgia, serif; font-weight: 400; }
h1 { margin: .4rem 0 1rem; font-size: clamp(2.5rem, 6vw, 5.1rem); letter-spacing: -.035em; }
h2 { margin: 0 0 1rem; font-size: clamp(2rem, 4vw, 3.25rem); letter-spacing: -.025em; }
h3 { margin: 0 0 .7rem; font-size: 1.25rem; }
p { margin: 0 0 1rem; }
.lead { font-size: 1.25rem; color: var(--ink-soft); max-width: 690px; }
.muted { color: var(--ink-soft); }
.text-small { font-size: .92rem; }

.hero {
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 18%, rgba(241,178,74,.52), transparent 23rem),
    linear-gradient(145deg, #fff7e8, #eadfd0);
}
.hero-inner {
  width: min(var(--content), calc(100% - 2rem));
  min-height: 620px;
  margin: auto;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  align-items: center;
  gap: 3rem;
  padding: 4.5rem 0;
}
.hero-actions, .button-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.sun-art { position: relative; min-height: 410px; }
.sun-disc {
  position: absolute;
  width: min(34vw, 370px);
  aspect-ratio: 1;
  top: 10px;
  right: 0;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--gold), var(--sunset));
  box-shadow: 0 0 0 35px rgba(241,178,74,.13), 0 0 0 72px rgba(241,178,74,.08);
}
.hero-note {
  position: absolute;
  right: 8%;
  bottom: 8%;
  width: 260px;
  padding: 1.2rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .7rem 1.15rem;
  border: 2px solid var(--sunset);
  border-radius: 999px;
  background: var(--sunset);
  color: white;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--sunset-dark); border-color: var(--sunset-dark); color: white; }
.button-secondary { background: var(--sage); border-color: var(--sage); }
.button-secondary:hover { background: #1f5348; border-color: #1f5348; }
.button-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.button-ghost:hover { background: var(--ink); }
.button-danger { background: var(--danger); border-color: var(--danger); }
.button-small { min-height: 38px; padding: .35rem .8rem; font-size: .92rem; }
.button:disabled { opacity: .55; cursor: not-allowed; }

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.card, .panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 1.5rem; }
.card-icon { font-size: 2rem; margin-bottom: 1rem; }
.card a.stretched { font-weight: 700; }
.panel { padding: clamp(1rem, 3vw, 2rem); }
.feature-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.feature-item { border-top: 3px solid var(--gold); padding: 1rem 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1.5rem 0; }
.stat { padding: 1.25rem; background: var(--surface); border-radius: 14px; }
.stat strong { display: block; font: 400 2.2rem/1 "DM Serif Display", serif; color: var(--sunset-dark); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field-full { grid-column: 1 / -1; }
label, legend { font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: .65rem .75rem;
  border: 2px solid #928a7d;
  border-radius: 9px;
  background: white;
  color: var(--ink);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #1769aa; outline: 3px solid rgba(23,105,170,.25); }
.field-error { color: var(--danger); font-weight: 700; font-size: .92rem; }
.field-help { color: var(--ink-soft); font-size: .9rem; }
.checkbox-row { display: flex; align-items: flex-start; gap: .6rem; }
.checkbox-row input { width: 22px; min-height: 22px; margin-top: .2rem; }
.notice { padding: 1rem; border-left: 5px solid var(--gold); background: #fff7dc; border-radius: 8px; }
.notice-success { border-color: var(--success); background: #e4f5eb; }
.notice-error { border-color: var(--danger); background: #ffe9ea; }

.filter-row { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: .75rem; margin: 1.2rem 0; }
.table-shell { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: .8rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { background: var(--ink); color: white; }
th button { color: white; background: transparent; border: 0; font-weight: 700; cursor: pointer; text-align: left; }
tbody tr:hover { background: #fff8e9; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 999px; background: var(--sage-light); font-size: .85rem; }

.resource-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.resource-card { display: flex; flex-direction: column; }
.resource-card .button { margin-top: auto; align-self: flex-start; }
.saved { color: var(--success); font-weight: 700; }

#support-map { height: 520px; border-radius: var(--radius); border: 2px solid var(--border); z-index: 1; }
.map-layout { display: grid; grid-template-columns: 360px 1fr; gap: 1rem; }
.map-controls { display: flex; flex-direction: column; gap: 1rem; }
.route-summary { padding: 1rem; background: var(--sage-light); border-radius: 10px; }
.leaflet-popup-content { font-family: "Atkinson Hyperlegible", Arial, sans-serif; font-size: 16px; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .35rem; }
.calendar-head { font-weight: 700; text-align: center; }
.calendar-day { min-height: 78px; padding: .4rem; border: 1px solid var(--border); border-radius: 8px; background: white; }
.calendar-day.today { border: 3px solid var(--sunset); }
.calendar-day.has-event { background: #fff3d6; }
.event-dot { display: block; width: 8px; height: 8px; margin-top: .25rem; border-radius: 50%; background: var(--sunset); }
.appointment-list { list-style: none; padding: 0; }
.appointment-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--border); }

.chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.chart-wrap { min-width: 0; min-height: 0; }
.chart-wrap h2 { font-size: clamp(1.6rem, 2.4vw, 2.25rem); }
.chart-canvas { position: relative; width: 100%; height: 280px; max-height: 280px; overflow: hidden; }
.chart-canvas canvas { display: block; width: 100% !important; height: 100% !important; }
.recipient-list { max-height: 270px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: .75rem; }
.recipient-list label { display: flex; gap: .6rem; padding: .45rem; }
.recipient-list input { width: 20px; min-height: 20px; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.5rem max(1rem, calc((100% - var(--content)) / 2));
  background: var(--ink);
  color: white;
}
.site-footer a { color: #f7ca7a; }
.site-footer p { margin: .3rem 0; }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: 70px;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-account .user-chip { display: none; }
  .hero-inner { grid-template-columns: 1fr; min-height: auto; }
  .sun-art { display: none; }
  .card-grid, .resource-grid { grid-template-columns: repeat(2, 1fr); }
  .map-layout { grid-template-columns: 1fr; }
  #support-map { height: 460px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  body { font-size: 17px; }
  .brand span:last-child { display: none; }
  .nav-shell { gap: .5rem; }
  .page { padding-top: 2.2rem; }
  .card-grid, .resource-grid, .feature-list, .chart-grid, .form-grid { grid-template-columns: 1fr; }
  .filter-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .pagination, .appointment-list li, .site-footer { flex-direction: column; }
  .calendar-day { min-height: 58px; font-size: .85rem; }
  .chart-canvas { height: 240px; max-height: 240px; }
  .site-footer { padding: 2rem 1rem; }
}

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

@media (forced-colors: active) {
  .button, .card, .panel, input, select, textarea { border: 2px solid CanvasText; }
}
