:root {
  --ink: #1b1412;
  --muted: #6d5e59;
  --paper: #fff8f4;
  --panel: #ffffff;
  --line: #ead8cf;
  --red: #a62724;
  --red-dark: #651614;
  --brown: #714533;
  --brown-dark: #2b1914;
  --copper: #b66a45;
  --soft-red: #fff0ed;
  --black: #111111;
  --shadow: 0 18px 45px rgba(43, 25, 20, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(166, 39, 36, 0.16), transparent 34rem),
    linear-gradient(135deg, #ffffff 0%, var(--paper) 46%, #f3e1d8 100%);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 17px;
  letter-spacing: 0;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: linear-gradient(180deg, #2b1914 0%, #15100f 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--red-dark);
  font-weight: 800;
}

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

.brand span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
  margin-top: 3px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item,
.nav-link {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  text-decoration: none;
}

.nav-item:hover,
.nav-item.active,
.nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.16);
}

.side-panel {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
}

.label,
.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.side-panel .label {
  color: rgba(255, 255, 255, 0.62);
}

.call-link,
.danger-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 14px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.call-link {
  background: #ffffff;
  color: var(--red-dark);
}

.admin-link {
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  padding-top: 10px;
}

.main-content {
  padding: 24px;
  min-width: 0;
}

.topbar,
.section-heading,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.04;
}

h2 {
  font-size: 1.4rem;
  line-height: 1.2;
}

h3 {
  font-size: 1.08rem;
}

.top-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  font-weight: 800;
}

.danger-button {
  background: #111111;
  color: #ffffff;
}

.primary-button {
  background: var(--red);
  color: #ffffff;
}

.secondary-button {
  background: #ffffff;
  color: var(--red-dark);
  border-color: var(--line);
}

.hero-strip {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  min-height: 300px;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  background: #2b1914;
}

.hero-strip img {
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
  filter: saturate(1.05) contrast(1.02) brightness(1.12);
}

.hero-strip::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(20, 13, 11, 0.34) 0%, rgba(43, 25, 20, 0.13) 52%, rgba(43, 25, 20, 0.02) 100%),
    linear-gradient(0deg, rgba(101, 22, 20, 0.08), transparent 58%);
}

.hero-copy {
  position: absolute;
  inset: auto 24px 24px 24px;
  max-width: 760px;
  color: #ffffff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.65);
  z-index: 1;
}

.hero-copy span,
.hero-copy strong {
  display: block;
}

.hero-copy span {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.hero-copy strong {
  font-size: clamp(1.15rem, 3vw, 2rem);
  line-height: 1.18;
}

.welcome-tagline {
  margin-top: 6px;
  color: var(--brown);
  font-size: 1.08rem;
  font-weight: 700;
}

.companion-banner {
  margin: 0 0 18px;
  padding: 15px 18px;
  border: 1px solid #e4c6bc;
  border-left: 5px solid var(--copper);
  border-radius: 8px;
  background: linear-gradient(90deg, #fffdf8 0%, #fff0ed 100%);
  color: var(--brown-dark);
  font-weight: 800;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(43, 25, 20, 0.08);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-heading {
  margin: 22px 0 16px;
}

.section-heading p,
.muted {
  color: var(--muted);
  line-height: 1.45;
}

.privacy-notice {
  display: grid;
  gap: 5px;
  margin: -4px 0 16px;
  padding: 13px 15px;
  border: 1px solid #dfb5a9;
  border-left: 4px solid var(--red);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--brown-dark);
  line-height: 1.42;
}

.privacy-notice strong {
  color: var(--red-dark);
}

.privacy-notice span {
  color: var(--muted);
}

.emergency-notice {
  margin-top: -4px;
  margin-bottom: 18px;
  border-color: rgba(17, 17, 17, 0.12);
  background: #fff7f5;
}

.checkin-help {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: #fffdf8;
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.45;
}

.learn-more-safety {
  color: var(--red-dark);
  font-weight: 800;
  text-decoration: none;
}

.learn-more-safety:hover {
  text-decoration: underline;
}

.okay-action {
  background: #2e6f49;
  color: #ffffff;
}

.notify-action {
  background: #ffffff;
  color: var(--brown-dark);
  border-color: #d4b09e;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric,
.panel,
.directory-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric {
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fff4f1 100%);
}

.metric span,
.panel-title span,
.message-preview span,
.timeline span,
.directory-card span {
  color: var(--muted);
  display: block;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.15rem;
}

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

.content-grid.two-column {
  grid-template-columns: 360px minmax(0, 1fr);
}

.panel {
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.visit-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: center;
}

.visit-card img {
  width: 92px;
  height: 92px;
  border-radius: 8px;
  object-fit: cover;
}

.visit-card span,
.visit-card p {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

.stacked-form {
  display: grid;
  gap: 10px;
}

label {
  color: var(--ink);
  font-weight: 700;
  font-size: 0.92rem;
}

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

textarea {
  resize: vertical;
}

.history-list,
.task-list {
  display: grid;
  gap: 10px;
}

.history-item,
.task-item {
  padding: 12px;
  border-radius: 8px;
  background: var(--soft-red);
  display: grid;
  gap: 4px;
}

.task-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.task-item.done {
  opacity: 0.66;
}

.task-item small {
  color: var(--muted);
  grid-column: 1 / -1;
  line-height: 1.35;
}

.gentle-reminder {
  border: 1px solid rgba(166, 39, 36, 0.28);
  animation: gentleGlow 2.8s infinite ease-in-out;
}

@keyframes gentleGlow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(166, 39, 36, 0);
    background: #fff6f3;
  }
  50% {
    box-shadow: 0 0 0 5px rgba(166, 39, 36, 0.1);
    background: #fff0ed;
  }
}

.quote {
  font-size: 1.15rem;
  line-height: 1.55;
  color: #2d403a;
}

.breathing-box {
  min-height: 150px;
  border: 1px solid #e0bdb3;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--red-dark);
  background: linear-gradient(145deg, #ffffff, #fff0ed);
  font-weight: 800;
  font-size: 1.4rem;
}

.breathing-box.active {
  animation: breathe 8s infinite ease-in-out;
}

.sensory-panel {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--muted);
  line-height: 1.4;
}

.sensory-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--copper);
  animation: softPulse 3s infinite ease-in-out;
}

@keyframes softPulse {
  0%,
  100% {
    transform: scale(0.85);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
  }
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.98);
  }
  50% {
    transform: scale(1.02);
  }
}

.tracker-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: center;
}

.step-progress {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.step-progress-label {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: space-between;
  color: var(--brown-dark);
  font-weight: 800;
}

.progress-track {
  width: 100%;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #f1ded6;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--copper), var(--red));
  transition: width 180ms ease;
}

.resource-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.faith-media-links {
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.faith-media-links a {
  color: var(--red-dark);
  font-weight: 800;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline div {
  padding-left: 14px;
  border-left: 3px solid var(--copper);
  display: grid;
  gap: 4px;
}

.timeline time {
  color: var(--red);
  font-weight: 800;
  font-size: 0.86rem;
}

.info-vault {
  display: grid;
  gap: 10px;
}

.info-vault span {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--soft-red);
}

.text-link {
  color: var(--red-dark);
  font-weight: 800;
}

.directory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.resource-finder {
  margin-bottom: 16px;
}

.zip-search-form {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr auto;
  gap: 10px;
  align-items: end;
}

.zip-search-form label {
  font-weight: 800;
  color: var(--brown-dark);
}

.zip-search-form input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
}

.directory-card {
  display: grid;
  gap: 8px;
  min-height: 130px;
  padding: 18px;
  color: var(--ink);
  text-decoration: none;
}

.directory-card:hover {
  border-color: var(--red);
  box-shadow: 0 8px 24px rgba(43, 25, 20, 0.09);
}

.urgent-resource {
  border-color: rgba(138, 28, 23, 0.35);
  background: #fff6f3;
}

.local-resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.local-resource-link {
  display: grid;
  min-height: 54px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-red);
  color: var(--brown-dark);
  font-weight: 800;
  text-decoration: none;
}

.local-resource-link:hover {
  border-color: var(--red);
  color: var(--red-dark);
  background: #ffffff;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill-list span {
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--soft-red);
  color: var(--brown-dark);
}

.message-preview {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 8px;
  background: var(--soft-red);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #111111;
  color: #ffffff;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.legal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  justify-content: center;
  padding: 22px 0 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.legal-footer a {
  color: var(--red-dark);
  font-weight: 800;
  text-decoration: none;
}

.legal-footer a:hover {
  text-decoration: underline;
}

.copyright-notice {
  flex-basis: 100%;
  text-align: center;
  color: var(--black);
  font-size: 0.86rem;
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .side-panel {
    margin-top: 0;
  }

  .metric-grid,
  .directory-grid,
  .local-resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .main-content,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .section-heading,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-list,
  .metric-grid,
  .content-grid,
  .content-grid.two-column,
  .directory-grid,
  .zip-search-form,
  .local-resource-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    inset: auto 16px 16px 16px;
  }

  .tracker-row,
  .visit-card {
    grid-template-columns: 1fr;
  }

  .visit-card img {
    width: 100%;
    height: 180px;
  }

  .top-actions,
  .button-row {
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    flex: 1 1 170px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .breathing-box.active,
  .gentle-reminder,
  .sensory-dot {
    animation: none;
  }
}
