:root {
  --bg: #eef0e8;
  --bg-2: #e4e9dc;
  --surface: rgba(250, 251, 246, 0.92);
  --surface-solid: #fbfcf8;
  --border: rgba(31, 42, 34, 0.12);
  --text: #1f2a22;
  --muted: #56635a;
  --accent: #2f5a43;
  --accent-soft: rgba(47, 90, 67, 0.11);
  --gold: #9a6a2f;
  --danger: #a3402c;
  --radiant: #b8862c;
  --steady: #3f7a5a;
  --gentle: #5b7f9e;
  --recovery: #8b6d9c;
  --shadow: 0 10px 30px -20px rgba(31, 42, 34, 0.35);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141a16;
    --bg-2: #1b241e;
    --surface: rgba(30, 39, 33, 0.9);
    --surface-solid: #1e2721;
    --border: rgba(220, 230, 215, 0.12);
    --text: #e9eee4;
    --muted: #a6b3a8;
    --accent: #9cc7a8;
    --accent-soft: rgba(156, 199, 168, 0.14);
    --gold: #d9b07a;
    --danger: #f0a08e;
    --radiant: #e3bd6a;
    --steady: #8fcaa4;
    --gentle: #9dbbd6;
    --recovery: #c4a8d4;
    --shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #141a16;
  --bg-2: #1b241e;
  --surface: rgba(30, 39, 33, 0.9);
  --surface-solid: #1e2721;
  --border: rgba(220, 230, 215, 0.12);
  --text: #e9eee4;
  --muted: #a6b3a8;
  --accent: #9cc7a8;
  --accent-soft: rgba(156, 199, 168, 0.14);
  --gold: #d9b07a;
  --danger: #f0a08e;
  --radiant: #e3bd6a;
  --steady: #8fcaa4;
  --gentle: #9dbbd6;
  --recovery: #c4a8d4;
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1, h2 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-size: clamp(2.5rem, 6vw, 3.5rem); line-height: 1.02; letter-spacing: -0.015em; }
h2 { font-size: 1.6rem; line-height: 1.1; }
p { margin: 0 0 0.75rem; }
a { color: var(--accent); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.6rem;
  font-weight: 400;
}
.brand svg { color: var(--accent); }
nav { display: flex; gap: 0.25rem; }
nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-weight: 500;
}
nav a:hover { color: var(--text); }
nav a[aria-current="page"] { color: var(--text); background: var(--accent-soft); }

main { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 0 16px 3rem; outline: none; }

.intro { margin: 1.5rem 0 1.75rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem; font-weight: 600; color: var(--gold); margin-bottom: 0.4rem; }
.lede { color: var(--muted); font-size: 1.08rem; max-width: 40rem; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-weight: 400; font-size: 0.9rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  }

/* ---------- form ---------- */
fieldset { border: 0; padding: 0; margin: 0 0 1.75rem; min-width: 0; }
legend { font-family: "Instrument Serif", Georgia, serif; font-size: 1.55rem; font-weight: 400; margin-bottom: 0.9rem; padding: 0; }

.scale { padding: 0.9rem 0; border-top: 1px solid var(--border); }
.scale:first-child { border-top: 0; padding-top: 0; }
.scale-q { font-weight: 500; margin-bottom: 0.6rem; }
.scale.missing .scale-q { color: var(--danger); }
.scale.missing .scale-q::after { content: " (please choose)"; font-weight: 400; font-size: 0.9rem; }
.scale-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; max-width: 26rem; }
.scale-options input, .chips input, .struggling input { position: absolute; opacity: 0; pointer-events: none; }
.scale-options label {
  display: grid;
  place-items: center;
  height: 2.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.scale-options label:hover { border-color: var(--accent); }
.scale-options input:checked + label { background: var(--accent); border-color: var(--accent); color: var(--surface-solid); transform: translateY(-1px); }
.scale-options input:focus-visible + label, .chips input:focus-visible + label, .struggling input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.scale-ends { display: flex; justify-content: space-between; max-width: 26rem; font-size: 0.82rem; color: var(--muted); margin-top: 0.35rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips label {
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  cursor: pointer;
  font-size: 0.94rem;
  transition: background 0.15s, border-color 0.15s;
}
.chips label:hover { border-color: var(--accent); }
.chips input:checked + label { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 500; }

textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  resize: vertical;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.struggling { display: inline-flex; align-items: center; gap: 0.6rem; margin-bottom: 1.5rem; cursor: pointer; position: relative; }
.struggling span::before {
  content: "";
  display: inline-block;
  width: 1.15rem;
  height: 1.15rem;
  margin-right: 0.6rem;
  vertical-align: -0.2rem;
  border-radius: 6px;
  border: 1.5px solid var(--muted);
}
.struggling input:checked + span::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface-solid); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 600;
  padding: 0.75rem 1.4rem;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--accent-soft); }
.btn.primary { background: var(--accent); color: var(--surface-solid); width: 100%; padding: 0.95rem; font-size: 1.05rem; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: var(--border); color: var(--text); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: transparent; filter: brightness(1.15); }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.actions { text-align: center; margin-top: 1.5rem; }

/* ---------- results ---------- */
.result-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1.25rem; }
.result-grid .card { margin-bottom: 0; }
.result-grid + * { margin-top: 1.25rem; }

.readiness { text-align: center; }
.ring { position: relative; width: 170px; height: 170px; margin: 0 auto 1rem; --level: var(--accent); }
.ring[data-level="radiant"] { --level: var(--radiant); }
.ring[data-level="steady"] { --level: var(--steady); }
.ring[data-level="gentle"] { --level: var(--gentle); }
.ring[data-level="recovery"] { --level: var(--recovery); }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--border); stroke-width: 9; }
.ring-value { fill: none; stroke: var(--level); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 0.9s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; }
.ring-label strong { font-family: "Instrument Serif", Georgia, serif; font-size: 3.4rem; line-height: 1; }
.ring-label span { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 0.3rem; }
.level-message { color: var(--muted); margin-bottom: 1.25rem; }

.dims { display: grid; grid-template-columns: auto 1fr; gap: 0.45rem 0.9rem; margin: 0; text-align: left; align-items: center; }
.dims dt { font-size: 0.9rem; color: var(--muted); }
.dims dd { margin: 0; display: flex; align-items: center; gap: 0.6rem; }
.bar { flex: 1; height: 8px; border-radius: 99px; background: var(--border); position: relative; overflow: hidden; }
.bar::after { content: ""; position: absolute; inset: 0; width: calc(var(--v) * 100%); min-width: 8px; border-radius: inherit; background: var(--accent); }
.val { font-variant-numeric: tabular-nums; font-size: 0.85rem; width: 1.8rem; text-align: right; }

.insights, .tips, .plan, .themes, .steps { margin: 0; padding: 0; list-style: none; }
.insights li { padding: 0.7rem 0 0.7rem 1.6rem; position: relative; border-top: 1px solid var(--border); }
.insights li:first-child { border-top: 0; padding-top: 0.2rem; }
.insights li::before { content: "✦"; position: absolute; left: 0; color: var(--gold); }
.insights li:first-child::before { top: 0.2rem; }

.tips { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.9rem; }
.tip { padding: 1rem 1.1rem; border-radius: 14px; background: var(--accent-soft); }
.tip.influence { background: color-mix(in srgb, var(--gold) 14%, transparent); }
.tip p { margin: 0; }
.tip-label { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--muted); margin-bottom: 0.35rem; }

.plan li { display: flex; gap: 0.85rem; align-items: flex-start; padding: 0.85rem 0; border-top: 1px solid var(--border); }
.plan li:first-child { border-top: 0; }
.plan input { width: 1.25rem; height: 1.25rem; margin-top: 0.2rem; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.plan label { cursor: pointer; display: flex; flex-direction: column; }
.plan input:checked + label span:last-child { text-decoration: line-through; color: var(--muted); }
.pillar { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--muted); }
.plan li.focus .pillar { color: var(--accent); }

.atman { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.atman-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.atman-head h2 { margin: 0; }
.badge { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; padding: 0.15rem 0.5rem; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.reflection { font-size: 1.08rem; }
.focus-line { color: var(--muted); }
.focus-line strong { color: var(--text); }
.steps { counter-reset: s; margin-bottom: 1rem; }
.steps li { counter-increment: s; padding: 0.4rem 0 0.4rem 2.1rem; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0.4rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 0.8rem; font-weight: 600; }
.affirmation { font-family: "Instrument Serif", Georgia, serif; font-style: italic; font-size: 1.45rem; color: var(--gold); margin: 0; }
.thinking { color: var(--muted); animation: pulse 1.6s ease-in-out infinite; }
.error { color: var(--danger); }
@keyframes pulse { 50% { opacity: 0.45; } }

.support { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 9%, var(--surface)); }
.support p { margin: 0; }

/* ---------- journey ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stat { display: flex; flex-direction: column; text-align: center; padding: 1.2rem 0.75rem; }
.stat-value { font-family: "Instrument Serif", Georgia, serif; font-size: 2.8rem; font-weight: 400; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 0.85rem; }

.chart { display: grid; grid-template-columns: repeat(14, 1fr); gap: 0.35rem; height: 190px; align-items: end; padding-top: 0.5rem; }
.col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 0.3rem; min-width: 0; }
.col-value { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-bar { width: 100%; max-width: 28px; height: calc(var(--h) * 1.3); border-radius: 8px 8px 4px 4px; background: var(--accent); }
.col-bar.empty { background: var(--border); }
.col-day { font-size: 0.75rem; color: var(--muted); }

.themes li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-top: 1px solid var(--border); }
.themes li:first-child { border-top: 0; }

.prose h2 { margin-top: 1.5rem; }
.prose h2:first-child { margin-top: 0; }

.site-footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 1.5rem 16px 2rem; }
.site-footer p { margin: 0; }

@media (max-width: 680px) {
  .result-grid { grid-template-columns: 1fr; }
  .card { padding: 1.2rem; border-radius: 16px; }
  .stats { gap: 0.6rem; }
  .stat-value { font-size: 1.7rem; }
  .site-header { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Laravel app additions ---------- */
.site-header .user-nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.nav-badge { display: inline-grid; place-items: center; min-width: 1.25rem; height: 1.25rem; padding: 0 0.3rem; margin-left: 0.3rem; border-radius: 99px; background: var(--danger); color: var(--surface-solid); font-size: 0.72rem; font-weight: 700; }
.linklike { background: none; border: 0; font: inherit; color: var(--muted); cursor: pointer; padding: 0.4rem 0.8rem; border-radius: 999px; font-weight: 500; }
.linklike:hover { color: var(--text); }
.flash { padding: 0.9rem 1.2rem; border-radius: 14px; background: var(--accent-soft); margin: 1rem 0; }
.flash.error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.1rem; }
.field label { font-weight: 500; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel], .field input[type=number] { font: inherit; color: var(--text); background: var(--surface-solid); border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem 0.9rem; }
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field .error-text, .error-text { color: var(--danger); font-size: 0.9rem; margin: 0.25rem 0 0; }
.check { display: flex; gap: 0.7rem; align-items: flex-start; margin-bottom: 1rem; }
.check input { width: 1.15rem; height: 1.15rem; margin-top: 0.2rem; accent-color: var(--accent); flex-shrink: 0; }
.auth-card { max-width: 30rem; margin: 2rem auto; }
.consent { padding: 1rem 1.1rem; border-radius: 14px; background: var(--accent-soft); }
.consent p { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.92rem; }
.care-card { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.messages { list-style: none; margin: 0; padding: 0; }
.messages li { padding: 1rem 0; border-top: 1px solid var(--border); }
.messages li:first-child { border-top: 0; }
.messages .meta { color: var(--muted); font-size: 0.88rem; margin-bottom: 0.3rem; }
.messages li.unread .meta::before { content: "● "; color: var(--accent); }
.scale.missing .scale-q::after { content: " (please choose)"; font-weight: 400; font-size: 0.9rem; }

/* Language switcher */
.lang-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; border: 1px solid rgba(31, 42, 34, .18); }
.lang-switch a { min-width: 34px; min-height: 30px; display: inline-grid; place-items: center; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-decoration: none; color: inherit; opacity: .7; box-shadow: none !important; }
.lang-switch a:hover { opacity: 1; }
.lang-switch a[aria-current="true"] { background: #2f5a43; color: #f6f7f1; opacity: 1; }

.range-tabs { display: flex; gap: 4px; }
.range-tabs a { padding: 0.35rem 0.8rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: 0.92rem; }
.range-tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1.25rem; }
.plan-card { display: flex; flex-direction: column; gap: 0.75rem; margin: 0; }
.plan-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-card .price { font-family: "Instrument Serif", Georgia, serif; font-size: 2.6rem; line-height: 1; }
.plan-card ul { margin: 0; padding-left: 1.2rem; color: var(--muted); }
.plan-card li + li { margin-top: 0.35rem; }
.plan-card form, .plan-card .btn { margin-top: auto; }
.pill-tag { align-self: flex-start; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* Body numbers on the check-in */
.vitals { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
.vitals .field { margin-bottom: 0; }

/* My days */
.days-filter { margin: -0.5rem 0 1.25rem; flex-wrap: wrap; }
.day { display: flex; flex-direction: column; gap: 0.9rem; }
.day-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.day-head h2 { margin: 0; font-size: 1.45rem; }
.day-head p { margin: 0.15rem 0 0; }
.day-score { --level: var(--accent); flex-shrink: 0; min-width: 3.2rem; text-align: center; font-family: "Instrument Serif", Georgia, serif; font-size: 1.9rem; line-height: 1; padding: 0.45rem 0.6rem; border-radius: 14px; border: 2px solid var(--level); color: var(--text); }
.day-score[data-level="radiant"] { --level: var(--radiant); }
.day-score[data-level="steady"] { --level: var(--steady); }
.day-score[data-level="gentle"] { --level: var(--gentle); }
.day-score[data-level="recovery"] { --level: var(--recovery); }
.day-flag { margin: 0; font-weight: 600; color: var(--danger); }
.day-note { margin: 0; padding: 0.2rem 0 0.2rem 1rem; border-left: 3px solid var(--accent); white-space: pre-line; font-size: 1.05rem; line-height: 1.6; }
.day-empty { margin: 0; }
.day-ratings { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0.5rem; margin: 0; }
.day-ratings div { background: var(--accent-soft); border-radius: 12px; padding: 0.45rem 0.7rem; }
.day-ratings dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.day-ratings dd { margin: 0; font-weight: 600; font-size: 1.05rem; }
.day-themes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.day-themes li { border: 1px solid var(--border); border-radius: 999px; padding: 0.2rem 0.75rem; font-size: 0.9rem; }
.day-meta { margin: 0; font-size: 0.92rem; }
.day-reflection summary { cursor: pointer; font-weight: 600; }
.day-reflection p, .day-reflection ul { margin: 0.6rem 0 0; }
.day-pages { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1rem 0 2rem; }

/* Conversation with Atman */
.atman-talk { margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.atman-talk h3 { margin: 0 0 0.8rem; font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 1.3rem; }
.atman-chat { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.atman-chat li { max-width: 88%; padding: 0.6rem 0.85rem; border-radius: 16px; }
.atman-chat li p { margin: 0.15rem 0 0; white-space: pre-line; }
.atman-chat .who { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.atman-chat .from-member { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 5px; }
.atman-chat .from-atman { align-self: flex-start; background: var(--surface-solid); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.atman-ask textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface-solid); border: 1px solid var(--border); border-radius: 12px; padding: 0.7rem 0.85rem; resize: vertical; box-sizing: border-box; }
.atman-ask textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.atman-ask-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-top: 0.5rem; font-size: 0.88rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
