:root {
  --ink: #17322f;
  --muted: #61706d;
  --paper: #f6f3eb;
  --card: #fffdf8;
  --green: #1e6258;
  --green-dark: #173f3a;
  --sage: #dbe7dc;
  --amber: #edb85b;
  --amber-soft: #fff1d2;
  --red: #9f3d35;
  --red-soft: #f9e4df;
  --line: #d9ddd7;
  --shadow: 0 18px 48px rgba(26, 54, 50, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 8%, rgba(237, 184, 91, .16), transparent 24rem),
    linear-gradient(180deg, #eef4ee 0, var(--paper) 34rem);
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  min-height: 100vh;
}

button, input { font: inherit; }
button { color: inherit; }

.page-shell { width: min(100% - 32px, 1020px); margin: 0 auto; }

.site-header {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  font-size: 18px;
  padding: 0;
  cursor: pointer;
}

.brand-logo-frame {
  display: block;
  width: 210px;
  height: 70px;
  overflow: hidden;
  border-radius: 10px;
  background: white;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 58%;
  transform: scale(1.1);
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px 13px 13px 4px;
  color: white;
  background: var(--green-dark);
  font-family: "Newsreader", serif;
  font-size: 24px;
}

.brand small {
  margin-left: 7px;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--amber-soft);
  color: #6b501e;
  font-size: 9px;
  letter-spacing: .08em;
  vertical-align: 2px;
}

.text-button, .link-button {
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 700;
  padding: 8px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

main { min-height: 620px; }

.hero, .step-card, .results { animation: rise .35s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.hero {
  margin: 44px auto 96px;
  max-width: 820px;
  text-align: center;
}

.eyebrow {
  color: var(--green);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .13em;
  margin: 0 0 14px;
}

h1, h2, h3 { font-family: "Newsreader", Georgia, serif; line-height: 1.05; margin-top: 0; }
h1 { font-size: clamp(43px, 7vw, 76px); letter-spacing: -.035em; margin-bottom: 22px; }
h2 { font-size: clamp(32px, 5vw, 48px); letter-spacing: -.025em; margin-bottom: 14px; }
h3 { font-size: 25px; margin-bottom: 10px; }

.hero-copy {
  max-width: 650px;
  margin: 0 auto 34px;
  font-size: clamp(18px, 2.5vw, 22px);
  line-height: 1.55;
  color: #425753;
}

.primary-button, .secondary-button {
  min-height: 54px;
  border-radius: 14px;
  padding: 0 22px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
}

.primary-button { border: 1px solid var(--green-dark); background: var(--green-dark); color: white; box-shadow: 0 8px 20px rgba(23,63,58,.18); }
.secondary-button { border: 1px solid #b7c4bf; background: transparent; }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.primary-button:focus-visible, .secondary-button:focus-visible, .choice:focus-visible, .text-button:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.trust-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 18px; margin-top: 30px; color: var(--muted); font-size: 13px; }
.trust-row span::before { content: "✓"; color: var(--green); font-weight: 700; margin-right: 6px; }

.step-layout { max-width: 760px; margin: 22px auto 88px; }
.progress-row { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; color: var(--muted); font-size: 13px; font-weight: 600; }
.progress-track { height: 6px; flex: 1; background: #dce3de; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green); border-radius: inherit; transition: width .3s; }

.step-card {
  background: rgba(255,253,248,.94);
  border: 1px solid rgba(31, 71, 64, .13);
  border-radius: 26px;
  padding: clamp(24px, 5vw, 50px);
  box-shadow: var(--shadow);
}

.question-help { color: var(--muted); font-size: 17px; line-height: 1.55; margin: 0 0 26px; }
.choices { display: grid; gap: 12px; }
.choices.two-col { grid-template-columns: repeat(2, 1fr); }

.choice {
  width: 100%;
  min-height: 72px;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  text-align: left;
  border: 1px solid #cbd4cf;
  border-radius: 15px;
  padding: 17px;
  background: white;
  cursor: pointer;
  transition: border .15s, background .15s, transform .15s;
}
.choice:hover { border-color: var(--green); transform: translateY(-1px); }
.choice.selected { border: 2px solid var(--green); background: #eef6ef; padding: 16px; }
.choice-icon { width: 31px; height: 31px; border-radius: 10px; flex: 0 0 auto; display: grid; place-items: center; background: var(--sage); }
.choice strong { display: block; margin-bottom: 4px; }
.choice small { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; }
.check-dot { margin-left: auto; width: 22px; height: 22px; border: 2px solid #a7b6b0; border-radius: 7px; flex: 0 0 auto; }
.selected .check-dot { background: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 4px #eef6ef; }

.field { display: grid; gap: 8px; margin-top: 22px; }
.field label { font-weight: 700; }
.field input { border: 1px solid #bcc8c3; border-radius: 12px; padding: 15px; background: white; font-size: 18px; text-transform: uppercase; }
.field-note { font-size: 12px; color: var(--muted); }
.field-error, .postcode-confirmed, .postcode-checking { display: block; margin-top: 8px; padding: 10px 12px; border-radius: 10px; font-size: 14px; line-height: 1.4; }
.field-error { color: #862d28; background: var(--red-soft); border: 1px solid #e5bbb6; }
.postcode-confirmed { color: var(--green-dark); background: var(--sage); border: 1px solid #cadace; font-weight: 700; }
.postcode-confirmed strong, .postcode-confirmed small { display: block; }
.postcode-confirmed small { margin-top: 3px; font-size: 13px; font-weight: 500; }
.postcode-checking { color: #4d422c; background: var(--amber-soft); border: 1px solid #e8d39b; }

.button-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; }
.button-row .primary-button { margin-left: auto; }

.safety-box { background: var(--red-soft); border-left: 5px solid var(--red); border-radius: 10px; padding: 18px; margin: 22px 0; line-height: 1.5; }
.safety-box strong { color: #7c2d28; }

.results { max-width: 920px; margin: 22px auto 80px; }
.results-header { padding: 38px; border-radius: 26px; background: var(--green-dark); color: white; box-shadow: var(--shadow); }
.results-header .eyebrow { color: #b9d8c1; }
.results-header p { max-width: 690px; color: #e2eeea; font-size: 18px; line-height: 1.55; }
.area-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.area-summary span { padding: 7px 11px; border-radius: 999px; background: rgba(255,255,255,.13); color: white; font-size: 13px; font-weight: 700; }
.result-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 18px; margin-top: 18px; align-items: start; }
.result-stack { display: grid; gap: 18px; }
.result-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 25px; box-shadow: 0 8px 24px rgba(26,54,50,.05); }
.result-card p, .result-card li { color: #455956; line-height: 1.6; }
.result-card ol, .result-card ul { padding-left: 22px; }
.result-card li + li { margin-top: 8px; }
.numbered-list { list-style: none; padding: 0 !important; counter-reset: next; }
.numbered-list li { counter-increment: next; display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; }
.numbered-list li::before { content: counter(next); width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--sage); color: var(--green-dark); font-weight: 700; }
.tag { display: inline-block; border-radius: 999px; padding: 6px 10px; background: var(--amber-soft); color: #664b17; font-size: 12px; font-weight: 700; }
.explain-link { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-weight: 700; border: 0; background: transparent; padding: 5px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.source-note { font-size: 12px !important; color: #77847f !important; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 18px; }

footer { border-top: 1px solid #d4dbd6; padding: 25px 0 40px; color: var(--muted); font-size: 12px; line-height: 1.55; }
footer p { max-width: 760px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; }
.footer-links a { color: var(--green); font-weight: 700; }
.term-choice { position: relative; }
.term-choice .choice { padding-right: 64px; }
.term-info { position: absolute; z-index: 2; left: 17px; top: 18px; width: 34px; height: 34px; border: 0; border-radius: 11px; background: var(--sage); color: var(--green-dark); font-weight: 800; cursor: pointer; }
.term-choice .choice > .choice-icon { visibility: hidden; }
.know-rights { margin: 18px 0; padding: 18px; border-left: 5px solid var(--amber); border-radius: 8px 14px 14px 8px; background: var(--amber-soft); }
.know-rights h4 { margin: 0 0 8px; font-size: 20px; }
.know-rights p { margin: 6px 0; }
.fit-checklist h4 { margin: 22px 0 8px; }

.dialog { width: min(740px, calc(100% - 24px)); max-height: 88vh; border: 0; border-radius: 24px; padding: 0; color: var(--ink); box-shadow: 0 30px 90px rgba(12, 34, 31, .35); }
.dialog::backdrop { background: rgba(12, 34, 31, .68); backdrop-filter: blur(3px); }
.dialog-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 20px; padding: 26px 30px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 34px; margin-bottom: 0; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: white; font-size: 28px; cursor: pointer; }
.glossary-list { background: var(--card); padding: 8px 30px 34px; }
.term { border-bottom: 1px solid var(--line); padding: 23px 0; scroll-margin-top: 118px; }
.term:last-child { border: 0; }
.term summary { cursor: pointer; font-weight: 700; font-size: 18px; list-style: none; display: flex; justify-content: space-between; gap: 15px; }
.term summary::after { content: "+"; color: var(--green); font-size: 23px; }
.term[open] summary::after { content: "–"; }
.term-body { color: #435653; line-height: 1.65; padding: 10px 2px 0; }
.term-body h4 { margin: 20px 0 5px; color: var(--ink); }
.term-body a { color: var(--green); }
.example-box { margin: 18px 0; padding: 17px 18px; border-left: 4px solid var(--amber); border-radius: 7px 13px 13px 7px; background: var(--amber-soft); color: #4d422c; }
.example-box > strong { display: block; margin-bottom: 7px; color: #694d18; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; }
.example-box p { margin: 0; }
.example-box p + p { margin-top: 10px; }
.call-step { display: grid; grid-template-columns: 38px 1fr; gap: 13px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.call-step:last-of-type { border-bottom: 0; }
.call-step > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--green-dark); color: white; font-weight: 700; }
.call-step strong { font-size: 17px; }
.call-step p { margin: 6px 0 0; }
.call-step blockquote { margin: 10px 0 0; padding: 14px 16px; border-left: 4px solid var(--amber); background: var(--amber-soft); border-radius: 6px 12px 12px 6px; color: #4e432e; font-weight: 500; line-height: 1.55; }
.contact-number { display: inline-block; font-family: "Newsreader", Georgia, serif; font-size: 28px; font-weight: 600; color: var(--green); }
.local-contact-card { border-top: 5px solid var(--green); }
.local-contact-card h3 { margin-top: 12px; }
.local-contact-intro { margin-bottom: 20px; }
.urgent-contact-panel { margin: 0 0 20px; padding: 17px 18px; border-left: 5px solid var(--red); border-radius: 8px 14px 14px 8px; background: var(--red-soft); }
.urgent-contact-panel h4 { margin: 0 0 9px; color: #7c2d28; font-size: 20px; }
.urgent-contact-panel p { margin: 6px 0; color: #563b39; }
.urgent-contact-panel a { color: #7c2d28; font-weight: 800; }
.contact-grid { display: grid; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.contact-row { display: grid; grid-template-columns: minmax(150px, .42fr) 1fr; gap: 16px; padding: 14px 16px; background: #f8faf7; }
.contact-row + .contact-row { border-top: 1px solid var(--line); }
.contact-label { color: var(--ink); font-weight: 700; }
.contact-value { min-width: 0; color: #455956; line-height: 1.5; overflow-wrap: anywhere; }
.contact-value a, .contact-links a { color: var(--green); font-weight: 700; }
.contact-value .contact-number { font-size: 24px; line-height: 1.1; }
.contact-missing { color: #6c7773; font-style: italic; }
.contact-links { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 17px; }
.local-contact-safety { margin-bottom: 0; }
.prompt-list { display: grid; gap: 9px; margin-top: 12px; }
.prompt-list label { display: grid; grid-template-columns: 22px 1fr; gap: 9px; align-items: start; padding: 11px; background: #f4f7f3; border-radius: 10px; line-height: 1.4; cursor: pointer; }
.prompt-list input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--green); }
.finance-bands { display: grid; gap: 8px; margin: 16px 0; }
.finance-bands div { display: grid; grid-template-columns: minmax(145px, .55fr) 1fr; gap: 12px; padding: 12px; border-radius: 10px; background: #eef4ee; }
.finance-bands span { color: #4c5f5b; }
.follow-up-question { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.follow-up-question h3 { font-size: 22px; margin-bottom: 6px; }
.follow-up-question > p { color: var(--muted); margin: 0 0 15px; line-height: 1.5; }
.decision-box { margin: 22px 0; padding: 17px 18px; border-left: 5px solid var(--green); border-radius: 8px 13px 13px 8px; background: #eef6ef; }
.decision-box.warn { border-left-color: var(--amber); background: var(--amber-soft); }
.decision-box.stop { border-left-color: var(--red); background: var(--red-soft); }
.decision-box strong { color: var(--ink); font-size: 17px; }
.decision-box p { margin: 6px 0 0; }
.care-home-path > h3:not(:first-of-type) { margin-top: 28px; }
.tracker-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 20px 0; }
.tracker-toolbar .primary-button { min-height: 46px; }
.tracker-toolbar span { color: var(--muted); font-size: 13px; }
.home-records { display: grid; gap: 12px; }
.empty-records { padding: 22px; border: 1px dashed #aebdb6; border-radius: 14px; background: #f7f9f6; text-align: center; }
.empty-records p { margin: 7px auto 0; max-width: 540px; }
.home-record { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: white; }
.home-record > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 18px; cursor: pointer; list-style: none; }
.home-record > summary::-webkit-details-marker { display: none; }
.home-record > summary strong, .home-record > summary small { display: block; }
.home-record > summary small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.record-status { padding: 5px 9px; border-radius: 999px; background: var(--sage); color: var(--green-dark); font-size: 12px; text-transform: capitalize; }
.home-record-body { padding: 20px; border-top: 1px solid var(--line); }
.record-fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.record-fields label { display: grid; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 700; }
.record-fields input, .record-fields select { width: 100%; border: 1px solid #bcc8c3; border-radius: 10px; padding: 11px 12px; background: white; color: var(--ink); font: inherit; font-size: 15px; }
.home-record-body h4 { margin: 24px 0 10px; }
.saved-checklist { display: grid; gap: 8px; }
.checklist-item { padding: 11px; border-radius: 10px; background: #f4f7f3; }
.saved-checklist label { display: grid; grid-template-columns: 21px 1fr; gap: 9px; align-items: start; color: #405450; line-height: 1.45; cursor: pointer; }
.saved-checklist input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--green); }
.checklist-item textarea { width: calc(100% - 30px); margin: 9px 0 0 30px; border: 1px solid #c4cec9; border-radius: 9px; padding: 10px 11px; background: white; color: var(--ink); font: inherit; font-size: 14px; line-height: 1.45; resize: vertical; }
.checklist-item textarea:focus { outline: 3px solid var(--amber); outline-offset: 2px; border-color: var(--green); }
.record-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.record-address { margin: 0 0 16px; padding: 11px 13px; border-radius: 10px; background: #f4f7f3; font-size: 14px; }
.remove-record { border: 0; background: transparent; color: #8b302c; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.postcode-finder-card { border-left: 5px solid var(--amber); }
.directory-page { max-width: 1020px; }
.directory-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 18px 0; }
.directory-toolbar span { color: var(--muted); font-size: 14px; font-weight: 700; }
.directory-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.directory-card { padding: 21px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 7px 20px rgba(26,54,50,.05); }
.directory-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.directory-card h3 { margin: 6px 0 0; font-size: 23px; }
.scope-label { color: var(--green); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.care-type { max-width: 135px; padding: 5px 8px; border-radius: 8px; background: var(--sage); color: var(--green-dark); font-size: 12px; font-weight: 700; text-align: right; }
.directory-address { min-height: 48px; color: #4c5f5b; line-height: 1.5; }
.directory-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.directory-actions a { color: var(--green); font-weight: 700; }
.directory-actions button { min-height: 42px; padding: 9px 13px; }
.directory-loading { margin-top: 18px; }

@media (max-width: 700px) {
  .page-shell { width: min(100% - 22px, 1020px); }
  .site-header { min-height: 72px; }
  .brand-logo-frame { width: 150px; height: 54px; }
  .brand small { display: none; }
  .text-button { font-size: 13px; }
  .hero { margin-top: 34px; }
  .choices.two-col, .result-grid { grid-template-columns: 1fr; }
  .step-card { border-radius: 20px; }
  .results-header { padding: 28px 23px; }
  .button-row { flex-wrap: wrap; }
  .dialog-head, .glossary-list { padding-left: 20px; padding-right: 20px; }
  .finance-bands div { grid-template-columns: 1fr; gap: 3px; }
  .contact-row { grid-template-columns: 1fr; gap: 5px; }
  .record-fields { grid-template-columns: 1fr; }
  .home-record > summary, .record-actions { align-items: flex-start; flex-direction: column; }
  .directory-grid { grid-template-columns: 1fr; }
  .directory-toolbar, .directory-actions { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
