:root {
  --bg: #f4eee4;
  --bg-deep: #e5d4bd;
  --surface: rgba(255, 251, 245, 0.78);
  --surface-strong: rgba(255, 248, 240, 0.95);
  --line: rgba(107, 77, 55, 0.18);
  --text: #35261c;
  --muted: #6e5645;
  --accent: #a14f39;
  --accent-soft: #edd4c9;
  --sage: #60755a;
  --gold: #b8892d;
  --danger: #8a3c3c;
  --shadow: 0 18px 50px rgba(61, 35, 15, 0.12);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua",
    Palatino, Georgia, serif;
  --font-body: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 32%),
    radial-gradient(circle at bottom right, rgba(163, 102, 70, 0.22), transparent 24%),
    linear-gradient(160deg, var(--bg), #efe1d1 52%, #ead8c1);
  color: var(--text);
  font-family: var(--font-body);
}

[hidden] {
  display: none !important;
}

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

.page-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 24px auto 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.45fr 0.9fr;
  gap: 20px;
  margin-bottom: 20px;
}

.hero__copy,
.hero__card,
.panel {
  background: var(--surface);
  backdrop-filter: blur(24px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero__copy {
  border-radius: 34px;
  padding: 40px;
  position: relative;
  overflow: hidden;
}

.hero__copy::after {
  content: "";
  position: absolute;
  inset: auto -80px -90px auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(161, 79, 57, 0.18), transparent 68%);
}

.eyebrow,
.section-kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.73rem;
  color: var(--muted);
  margin: 0 0 10px;
}

.hero h1,
.section-heading h2,
.metric__value,
.profile-card__name,
.playbook-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 4vw, 4.4rem);
  line-height: 0.95;
  max-width: 12ch;
}

.hero__text {
  margin: 18px 0 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero__card {
  border-radius: 34px;
  padding: 28px;
  display: flex;
}

.hero__actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.vault-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-shell {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 30;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(53, 38, 28, 0.34);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(480px, 100%);
  background: rgba(255, 250, 244, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 30px;
  padding: 28px;
}

.modal-card h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: -0.03em;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.vault-card {
  width: min(560px, 100%);
  background: rgba(255, 250, 244, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 34px;
  padding: 34px;
}

.vault-card h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 2.3rem;
  letter-spacing: -0.03em;
}

.vault-card p {
  color: var(--muted);
  line-height: 1.6;
}

.vault-card__note {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(96, 117, 90, 0.1);
  color: var(--sage);
}

.vault-card__error {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(138, 60, 60, 0.1);
  color: var(--danger);
}

.vault-card__choice {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.vault-card__choice input {
  width: auto;
}

.view-switch {
  display: flex;
  gap: 10px;
  margin: 0 0 20px;
  flex-wrap: wrap;
}

.view-switch__button {
  border: 1px solid rgba(107, 77, 55, 0.14);
  background: rgba(255, 248, 240, 0.72);
  color: var(--muted);
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 600;
  cursor: pointer;
}

.view-switch__button.is-active {
  background: var(--accent);
  color: #fff9f5;
  border-color: transparent;
}

.app-grid {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.app-grid--connection {
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
}

.app-grid--connection .panel--main {
  grid-column: 1;
}

.app-grid--connection .panel--rail {
  grid-column: 2;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 10px;
}

.panel--teaching {
  padding: 10px;
}

.teaching-page {
  display: grid;
}

.teaching-page .panel {
  width: 100%;
}

.panel-section {
  background: var(--surface-strong);
  border: 1px solid rgba(107, 77, 55, 0.1);
  border-radius: calc(var(--radius-lg) - 8px);
  padding: 20px;
}

.panel-section + .panel-section {
  margin-top: 10px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading--spread {
  align-items: center;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.65rem;
}

.pill,
.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.84rem;
}

.pill--soft {
  background: rgba(96, 117, 90, 0.12);
  color: var(--sage);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.chip {
  background: rgba(161, 79, 57, 0.12);
  color: var(--accent);
}

.person-list,
.playbook-list,
.timeline,
.connection-tree,
.reminder-list,
.review-list {
  display: grid;
  gap: 12px;
}

.person-button {
  text-align: left;
  width: 100%;
  border: 1px solid transparent;
  background: linear-gradient(135deg, rgba(255, 248, 242, 0.95), rgba(245, 232, 214, 0.92));
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.person-button:hover,
.person-button:focus-visible,
.person-button.is-active {
  transform: translateY(-2px);
  border-color: rgba(161, 79, 57, 0.35);
  box-shadow: 0 14px 24px rgba(61, 35, 15, 0.08);
}

.person-remove {
  border: 1px solid rgba(138, 60, 60, 0.18);
  background: rgba(255, 247, 244, 0.95);
  color: var(--danger);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
}

.person-remove:hover,
.person-remove:focus-visible {
  background: rgba(138, 60, 60, 0.12);
}

.person-button__top,
.card-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.person-button__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.person-button__name,
.metric__value,
.profile-card__name {
  font-weight: 700;
}

.person-button__meta,
.muted,
.brief-card p,
.timeline-card p,
.connection-card p,
.repair-card p,
.review-card p,
.playbook-card p,
.support-plan p {
  color: var(--muted);
  line-height: 1.55;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
}

.button--primary {
  background: var(--accent);
  color: #fff9f5;
}

.button--secondary {
  background: var(--sage);
  color: #f6f2ec;
}

.button--ghost {
  background: rgba(107, 77, 55, 0.08);
  color: var(--text);
}

.stack-form {
  display: grid;
  gap: 12px;
}

.stack-form--split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stack-form label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

.stack-form .full-width {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(107, 77, 55, 0.18);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 251, 246, 0.92);
  color: var(--text);
}

textarea {
  resize: vertical;
}

.checkbox {
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
  gap: 12px;
}

.checkbox input {
  width: auto;
}

.metric-grid,
.overview-grid {
  display: grid;
  gap: 14px;
}

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

.metric,
.profile-card,
.brief-card,
.timeline-card,
.connection-card,
.playbook-card,
.support-plan,
.repair-card,
.review-card,
.reminder-card,
.weekly-card {
  border: 1px solid rgba(107, 77, 55, 0.14);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 252, 248, 0.96), rgba(247, 238, 225, 0.98));
  padding: 16px;
}

.metric {
  display: grid;
  gap: 8px;
}

.metric__label {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric__value {
  font-size: 2rem;
}

.overview-grid {
  grid-template-columns: 1.2fr 0.9fr;
}

.profile-card__name {
  margin: 0;
  font-size: 2rem;
}

.list-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}

.list-inline span {
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(184, 137, 45, 0.13);
  color: #7f5b16;
  font-size: 0.86rem;
}

.timeline-card,
.connection-card,
.playbook-card,
.reminder-card,
.review-card {
  display: grid;
  gap: 10px;
}

.timeline-card__meta,
.connection-card__meta,
.reminder-card__meta,
.review-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  background: rgba(96, 117, 90, 0.12);
  color: var(--sage);
}

.tag--danger {
  background: rgba(138, 60, 60, 0.12);
  color: var(--danger);
}

.tag--accent {
  background: rgba(161, 79, 57, 0.12);
  color: var(--accent);
}

.brief-card ul,
.playbook-card ul,
.support-plan ul,
.repair-card ul,
.weekly-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.empty-state {
  border: 1px dashed rgba(107, 77, 55, 0.24);
  border-radius: var(--radius-md);
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 248, 240, 0.58);
}

.support-plan h3,
.repair-card h3,
.weekly-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.weekly-card {
  width: 100%;
}

.weekly-card p {
  color: var(--muted);
}

.review-card--spotlight {
  border-color: rgba(184, 137, 45, 0.4);
  background: linear-gradient(180deg, rgba(255, 248, 233, 1), rgba(248, 236, 211, 1));
}

.playbook-list--teaching {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.page-intro {
  margin: 0 0 16px;
}

.form-note {
  margin: 12px 0 0;
}

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

  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 18px, 100%);
    margin: 10px auto 28px;
  }

  .hero__copy,
  .hero__card,
  .panel {
    border-radius: 26px;
  }

  .hero__copy {
    padding: 28px;
  }

  .stack-form--split,
  .metric-grid,
  .overview-grid,
  .playbook-list--teaching {
    grid-template-columns: 1fr;
  }
}
