:root {
  color-scheme: light;
  --ink: #20241f;
  --muted: #687366;
  --paper: #f7f5ec;
  --panel: #fffdf7;
  --line: #d7ddcf;
  --moss: #3f6f45;
  --moss-2: #6f8f54;
  --lake: #2f7478;
  --clay: #b66149;
  --gold: #d9aa42;
  --danger: #a54646;
  --shadow: 0 18px 48px rgba(31, 38, 30, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(247, 245, 236, 0.94), rgba(247, 245, 236, 0.98)),
    radial-gradient(circle at 16% 12%, rgba(217, 170, 66, 0.24), transparent 28%),
    radial-gradient(circle at 84% 8%, rgba(47, 116, 120, 0.2), transparent 32%),
    linear-gradient(135deg, #edf3e6, #f8f0dd);
}

.site-body {
  background: #eef3e7;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(215, 221, 207, 0.72);
  background: rgba(247, 245, 236, 0.92);
  backdrop-filter: blur(16px);
}

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

.site-brand-copy {
  display: grid;
  gap: 4px;
}

.site-brand-copy strong {
  font-size: 18px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--ink);
  font-weight: 800;
}

.site-main {
  display: grid;
}

.site-hero {
  position: relative;
  min-height: calc(100vh - 82px);
  overflow: hidden;
  border-bottom: 1px solid rgba(215, 221, 207, 0.72);
  background: #dfe9d6;
}

.site-hero-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  transform: scale(1.02);
  transform-origin: center;
  filter: saturate(0.94) contrast(0.92) brightness(0.78);
}

.site-hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(22, 28, 24, 0.76) 0%, rgba(22, 28, 24, 0.38) 42%, rgba(22, 28, 24, 0.16) 68%, rgba(22, 28, 24, 0.18) 100%);
}

.site-hero-copy {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 82px);
  display: grid;
  align-content: end;
  gap: 18px;
  width: min(760px, calc(100% - 44px));
  padding: 40px 0 64px 22px;
  color: #fff;
}

.site-hero-copy .eyebrow {
  color: #f4c86f;
}

.site-hero-copy h1,
.site-band-head h2,
.site-capability-grid h3,
.site-stat-grid strong,
.site-runtime-grid h3 {
  margin: 0;
}

.site-hero-copy h1 {
  font-size: clamp(42px, 6vw, 78px);
  line-height: 0.95;
  max-width: 12ch;
}

.site-hero-copy p {
  margin: 0;
  max-width: 62ch;
  font-size: 18px;
  line-height: 1.55;
}

.site-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.site-band {
  padding: 56px 22px;
}

.site-band-contrast {
  background: rgba(255, 253, 247, 0.72);
  border-top: 1px solid rgba(215, 221, 207, 0.72);
  border-bottom: 1px solid rgba(215, 221, 207, 0.72);
}

.site-band-head {
  display: grid;
  gap: 12px;
  max-width: 860px;
  margin-bottom: 28px;
}

.site-band-head h2 {
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.02;
}

.site-band-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.site-capability-grid,
.site-stat-grid,
.site-runtime-grid {
  display: grid;
  gap: 16px;
}

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

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

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

.site-capability-grid article,
.site-stat-grid article,
.site-runtime-grid article {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.86);
  box-shadow: var(--shadow);
}

.site-capability-grid p,
.site-stat-grid span,
.site-runtime-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.site-stat-grid strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(247, 245, 236, 0.94), rgba(247, 245, 236, 0.99)),
    radial-gradient(circle at 20% 10%, rgba(217, 170, 66, 0.22), transparent 28%);
}

.auth-gate[hidden] {
  display: none;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-card h1,
.auth-card p {
  margin: 0;
}

.error-line {
  min-height: 20px;
  color: var(--danger);
  font-weight: 850;
}

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

button,
a.button {
  text-decoration: none;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.86);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--moss);
  color: #fff;
  font-weight: 900;
}

.brand h1,
.topbar h2,
.hero-band h3,
.panel h3,
.record-card h4,
.person-card h4,
.dialog-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 24px;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--clay);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.nav-item,
.button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdf7;
  color: var(--ink);
  padding: 10px 13px;
  font-weight: 850;
  cursor: pointer;
}

.nav-item {
  text-align: left;
}

.nav-item.active,
.button.primary {
  border-color: var(--moss);
  background: var(--moss);
  color: #fff;
}

.button.ghost {
  background: #fffdf7;
}

.button.danger {
  border-color: rgba(165, 70, 70, 0.28);
  color: var(--danger);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.sidebar-card {
  margin-top: auto;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 245, 236, 0.82);
  padding: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #c8d0c0;
  border-radius: 7px;
  background: #fffefa;
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.topbar h2 {
  font-size: clamp(30px, 4vw, 54px);
  line-height: 0.98;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 22px;
  bottom: 22px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  font-weight: 850;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-band,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.9);
  box-shadow: var(--shadow);
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 24px;
}

.hero-band h3 {
  max-width: 880px;
  font-size: clamp(26px, 3.4vw, 48px);
  line-height: 1.02;
}

.muted,
.record-card p,
.person-card p,
.activity-card p {
  color: var(--muted);
  line-height: 1.45;
}

.metric-circle {
  width: 142px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  border: 12px solid #dcead5;
  border-radius: 50%;
  background: #fffefa;
}

.metric-circle.progress {
  margin: 8px auto 18px;
  border-color: #d7e7eb;
}

.metric-circle strong {
  font-size: 34px;
  line-height: 1;
}

.metric-circle span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

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

.content-grid.two,
.today-grid,
.graph-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel.wide {
  min-width: 0;
}

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

.plan-list,
.record-list,
.domain-bars,
.form-grid,
.people-grid,
.stat-grid {
  display: grid;
  gap: 11px;
}

.stat-grid-tight {
  margin-top: 11px;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.activity-card {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr) 120px auto;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--moss);
  border-radius: 8px;
  background: #fffefa;
  padding: 13px;
}

.activity-card:nth-child(2n) {
  border-left-color: var(--lake);
}

.activity-card:nth-child(3n) {
  border-left-color: var(--gold);
}

.activity-card h4,
.activity-card p {
  margin: 0;
}

.rhythm-pill {
  border-radius: 999px;
  background: #e7f0e1;
  color: var(--moss);
  padding: 8px 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.activity-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.domain-row {
  display: grid;
  gap: 6px;
}

.domain-row header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eadf;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--moss), var(--lake));
}

.record-card,
.person-card,
.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  padding: 14px;
}

.record-card {
  display: grid;
  gap: 10px;
}

.record-card h4,
.record-card p,
.person-card h4,
.person-card p {
  margin: 0;
}

.compact-card {
  padding: 11px;
}

.tag-row,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  border-radius: 999px;
  background: #e9efe2;
  color: var(--moss);
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 850;
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.check-row input {
  width: auto;
}

.graph-canvas {
  position: relative;
  min-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(#edf3e9 1px, transparent 1px),
    linear-gradient(90deg, #edf3e9 1px, transparent 1px),
    #fffefa;
  background-size: 32px 32px;
}

.graph-node {
  position: absolute;
  width: 150px;
  min-height: 64px;
  display: grid;
  place-items: center;
  gap: 3px;
  border: 2px solid var(--moss);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(34, 37, 31, 0.1);
  color: var(--ink);
  padding: 8px;
  text-align: center;
  cursor: pointer;
}

.graph-node strong {
  font-size: 12px;
}

.graph-node span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.graph-node.mastered {
  border-color: var(--gold);
  background: #fff8df;
}

.graph-edge {
  position: absolute;
  height: 2px;
  background: #9fb29a;
  transform-origin: 0 0;
}

.graph-edge.soft {
  background: repeating-linear-gradient(90deg, #9fb29a 0 8px, transparent 8px 13px);
}

.people-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  margin-bottom: 14px;
}

.child-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.child-choice-card {
  min-height: 220px;
  display: grid;
  align-content: space-between;
  gap: 16px;
  border: 3px solid var(--moss);
  border-radius: 8px;
  background: #fffefa;
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: left;
  cursor: pointer;
}

.child-choice-card h4 {
  margin: 0;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.02;
}

.child-choice-card p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 850;
}

.child-choice-card.lake {
  border-color: var(--lake);
}

.child-choice-card.gold {
  border-color: var(--gold);
}

.child-choice-card.clay {
  border-color: var(--clay);
}

.report-box {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  color: var(--ink);
  padding: 12px;
  white-space: pre-wrap;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 24px;
  text-align: center;
  font-weight: 850;
}

.ai-output {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  color: var(--ink);
  line-height: 1.5;
  padding: 12px;
  white-space: pre-wrap;
}

dialog {
  width: min(640px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

dialog::backdrop {
  background: rgba(31, 38, 30, 0.42);
}

.dialog-card {
  position: relative;
  display: grid;
  gap: 14px;
  background: var(--paper);
  padding: 22px;
}

.dialog-card p {
  margin: 0;
}

.icon-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fffefa;
  cursor: pointer;
}

@media (max-width: 1120px) {
  .site-capability-grid,
  .site-stat-grid,
  .site-runtime-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .nav-item {
    text-align: center;
    padding-inline: 8px;
  }

  .sidebar-card {
    margin-top: 0;
  }
}

@media (max-width: 900px) {
  .content-grid.two,
  .today-grid,
  .graph-grid,
  .hero-band,
  .activity-card {
    grid-template-columns: 1fr;
  }

  .metric-circle {
    justify-self: start;
  }

  .activity-meta {
    grid-template-columns: repeat(2, max-content);
  }
}

@media (max-width: 680px) {
  .site-header {
    position: static;
    display: grid;
  }

  .site-nav,
  .site-hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .site-hero,
  .site-hero-copy {
    min-height: auto;
  }

  .site-hero-copy {
    width: calc(100% - 32px);
    padding: 32px 0 40px 16px;
  }

  .site-capability-grid,
  .site-stat-grid,
  .site-runtime-grid {
    grid-template-columns: 1fr;
  }

  .site-band {
    padding: 40px 16px;
  }

  .workspace,
  .sidebar {
    padding: 14px;
  }

  .topbar,
  .top-actions,
  .button-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
  }

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

  .inline-fields {
    grid-template-columns: 1fr;
  }

  .button,
  .nav-item,
  a.button {
    width: 100%;
  }
}
