:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --ink: #17201b;
  --muted: #66736d;
  --line: #dbe2dc;
  --brand: #0f5b4f;
  --brand-strong: #0a423a;
  --blue: #2454a6;
  --warn: #8a5b12;
  --danger: #a13b31;
  --soft: #edf4f1;
  --shadow: 0 16px 40px rgba(24, 32, 27, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

.site-header,
.site-footer,
.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 70px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 0 34px;
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.hint,
.legal-note,
small {
  color: var(--muted);
}

.site-footer a,
.consent-row a,
.legal-page a {
  color: var(--brand);
}

.site-footer a {
  color: #dfe9e5;
}

.public-nav,
.admin-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.public-nav a,
.admin-nav a,
.admin-nav button,
.back-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.public-nav a:hover,
.admin-nav a:hover,
.admin-nav a.is-active,
.back-link:hover {
  color: var(--brand);
}

.admin-nav {
  border-bottom: 1px solid var(--line);
  background: #111815;
  padding: 10px 34px;
}

.admin-nav a,
.admin-nav button {
  color: #dfe9e5;
}

main {
  min-height: calc(100vh - 140px);
}

.legal-page {
  padding: 56px 0 72px;
}

.legal-page h1 {
  margin: 0 0 28px;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.03;
}

.legal-page h2 {
  margin: 34px 0 10px;
  font-size: 24px;
}

.legal-page p {
  color: var(--muted);
  line-height: 1.72;
}

.legal-identity {
  display: grid;
  margin: 24px 0 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.legal-identity div {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.legal-identity div:last-child {
  border-bottom: 0;
}

.legal-identity dt {
  color: var(--muted);
  font-weight: 750;
}

.legal-identity dd {
  margin: 0;
  font-weight: 750;
}

.hero,
.section-grid,
.section-band,
.form-shell,
.admin-shell,
.narrow,
.login-box {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 38px;
  align-items: center;
  min-height: calc(100vh - 120px);
  padding: 56px 0;
}

.hero-copy h1 {
  max-width: 860px;
  margin: 0;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 0.98;
}

.hero-copy p {
  max-width: 720px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.6;
}

.hero-actions,
.section-title-row,
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.button.primary {
  background: var(--brand);
  color: #fff;
}

.button.primary:hover {
  background: var(--brand-strong);
}

.button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--brand);
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
}

.hero-panel,
.panel,
.table-panel,
.summary-box,
.login-box,
.form-step,
.alert,
.legal-preview,
.settings-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 28px;
}

.panel-kicker,
.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-panel h2,
.section-grid h2,
.section-band h2,
.form-intro h1,
.admin-shell h1,
.narrow h1,
.login-box h1 {
  margin: 6px 0 12px;
}

.check-list,
.history-list {
  display: grid;
  gap: 10px;
  padding-left: 18px;
}

.section-grid,
.section-band {
  padding: 56px 0;
}

.section-grid {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 28px;
}

.steps,
.warning-grid,
.metrics-grid,
.status-grid {
  display: grid;
  gap: 12px;
}

.steps {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.steps article,
.warning-grid p,
.metrics-grid article,
.status-grid article {
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.steps strong {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--brand);
}

.warning-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.legal-preview {
  margin-top: 16px;
  padding: 16px;
}

.form-shell,
.admin-shell,
.narrow,
.login-box {
  padding: 38px 0 56px;
}

.form-intro {
  max-width: 780px;
}

.form-intro h1 {
  font-size: clamp(30px, 4vw, 48px);
}

.intake-form {
  display: grid;
  gap: 18px;
}

.progress-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.progress-rail span {
  border-radius: 8px;
  background: var(--soft);
  color: var(--brand-strong);
  padding: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.form-step,
.panel,
.table-panel,
.summary-box,
.alert,
.login-box {
  padding: 22px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label,
.stack-form {
  display: grid;
  gap: 7px;
  color: #27332d;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd8d2;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.family-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.family-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
  padding: 16px;
}

.legal-stack {
  display: grid;
  gap: 10px;
}

.legal-stack details,
.settings-card {
  padding: 14px;
}

.consent-row,
.inline-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
}

.consent-row input,
.inline-check input {
  width: auto;
  margin-top: 4px;
}

.submit-button {
  justify-self: start;
}

.alert.error {
  border-color: #f2b8b1;
  background: #fff4f2;
  color: var(--danger);
}

.confirmation .summary-box {
  margin: 22px 0;
}

dl {
  display: grid;
  gap: 10px;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  font-weight: 800;
}

.login-box {
  max-width: 440px;
  margin-top: 60px;
}

.login-box form,
.stack-form {
  display: grid;
  gap: 14px;
}

.admin-shell {
  display: grid;
  gap: 20px;
}

.metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metrics-grid article,
.status-grid article {
  min-height: auto;
}

.metrics-grid span,
.status-grid span {
  display: block;
  color: var(--muted);
}

.metrics-grid strong,
.status-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.status-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.table-panel {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td a {
  color: var(--brand);
  font-weight: 850;
}

.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-strong);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.pill.strong {
  background: #e7eefb;
  color: var(--blue);
}

.case-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.admin-grid {
  display: grid;
  gap: 18px;
}

.admin-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.finding-list {
  display: grid;
  gap: 12px;
}

.finding-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 14px;
}

.site-footer {
  min-height: 70px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 0 34px;
}

@media (max-width: 860px) {
  .site-header,
  .site-footer,
  .case-header {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 14px 20px;
  }

  .public-nav,
  .admin-nav {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .hero,
  .section-grid,
  .admin-grid.two {
    grid-template-columns: 1fr;
  }

  .steps,
  .warning-grid,
  .metrics-grid,
  .status-grid,
  .field-grid,
  .progress-rail {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .legal-identity div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
