:root {
  color-scheme: light;
  --bg: #f5f2ea;
  --rail: #ece9de;
  --paper: #fdfbf5;
  --ink: #242922;
  --muted: #565f53;
  --line: #d9dacf;
  --accent: #365c42;
  --accent-ink: #fffdf4;
  --tint: #dfe8d9;
  --focus: #216e50;
  --danger: #9b3c31;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #202520;
  --rail: #1b211c;
  --paper: #2a312a;
  --ink: #f1eee4;
  --muted: #c3c9ba;
  --line: #465047;
  --accent: #bddbb8;
  --accent-ink: #203226;
  --tint: #35473a;
  --focus: #d0e6aa;
  --danger: #ffb2a4;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font: 1rem/1.52 var(--sans); color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .54; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
main:focus { outline: none; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; }
h1 { font-size: clamp(2.6rem, 6vw, 5rem); line-height: .99; letter-spacing: -.05em; }
h2 { font-size: clamp(1.45rem, 2.4vw, 1.95rem); line-height: 1.12; letter-spacing: -.035em; }
small, .fine { font-size: .875rem; color: var(--muted); }
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 32px 20px 24px;
  align-self: start; background: var(--rail); border-right: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; width: fit-content; margin: 5px 0 42px 10px; color: var(--ink);
  text-decoration: none; font-size: .88rem; font-weight: 780; letter-spacing: .18em; }
.brand-icon { display: grid; grid-template-columns: repeat(2, 9px); gap: 1px; rotate: -13deg; }
.brand-icon i { height: 9px; border-radius: 65% 12%; background: var(--accent); }
.brand-icon i:nth-child(2n) { border-radius: 12% 65%; }
.rail nav { display: grid; gap: 7px; }
.nav-button, .rail-button { display: flex; align-items: center; gap: 12px; min-height: 46px; width: 100%; border: 0;
  border-radius: 9px; padding: 9px 12px; background: transparent; color: var(--muted); font-size: .94rem; text-align: left; }
.nav-button span { color: var(--accent); font-size: 1.1rem; min-width: 20px; }
.nav-button[aria-current], .nav-button:hover, .rail-button:hover { color: var(--ink); background: var(--tint); }
.nav-button[aria-current] { font-weight: 660; }
.rail-bottom { display: grid; margin-top: auto; gap: 4px; }
.rail-bottom small { margin: 6px 0 0 12px; }
.rail-note { display: flex; align-items: center; gap: 7px; padding: 8px 8px 8px 12px; font-size: .84rem; color: var(--muted); }
.signal { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.wrap { width: min(100%, 1290px); padding: 33px clamp(20px, 4vw, 65px) 55px; margin: 0 auto; }
.eyebrow { display: inline-block; font-size: .73rem; font-weight: 730; letter-spacing: .12em; text-transform: uppercase; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; color: var(--muted); font-size: .86rem; }
.top-slash { padding: 0 9px; color: var(--accent); }
.life-hero, .start-intro { position: relative; isolation: isolate; overflow: hidden; border-radius: 20px; min-height: 258px; color: #fff9eb;
  background: #3a5547 url('./media/landscape.webp') 50% 55% / cover no-repeat; }
.life-hero::after, .start-intro::after { content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, #182d24ed 0%, #23382ba6 50%, #263e3112 100%), linear-gradient(0deg, #192c2680, transparent 42%); }
.life-hero { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 34px 36px; }
.hero-copy { display: grid; gap: 9px; }
.hero-copy h1 { overflow-wrap: anywhere; }
.hero-copy p:last-child { color: #f0ead9; }
.hero-location { white-space: nowrap; padding-bottom: 3px; font-size: .82rem; color: #fff9eb; }
.hero-location span { display: inline-block; width: 7px; height: 7px; border: 1px solid currentColor; border-radius: 50%; margin-right: 4px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 15px;
  background: var(--paper); margin: 17px 0; overflow: hidden; }
.metric { display: grid; gap: 3px; padding: 18px 20px; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric > span, .metric small { color: var(--muted); }
.metric > span { font-size: .87rem; }
.metric strong { font-family: var(--serif); font-size: clamp(1.32rem, 3vw, 2rem); font-weight: 500; overflow-wrap: anywhere; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 17px; align-items: start; }
.panel { border: 1px solid var(--line); background: var(--paper); border-radius: 16px; padding: clamp(17px, 3vw, 27px); }
.panel p:not(.eyebrow) { color: var(--muted); }
.section-heading { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 9px; margin-bottom: 13px; }
.chip { padding: 3px 8px; border-radius: 6px; background: var(--tint); color: var(--ink); font-size: .8rem; white-space: nowrap; }
.period-stats, .budget-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; border-block: 1px solid var(--line);
  margin: 16px 0; padding: 14px 0; }
.period-stats div, .budget-strip div { display: grid; gap: 3px; }
.period-stats strong, .budget-strip strong { font-size: 1.1rem; }
.period-stats span, .budget-strip span { font-size: .83rem; color: var(--muted); }
.budget-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.intention select { width: 100%; }
progress { width: 100%; height: 8px; appearance: none; border: 0; background: var(--line); border-radius: 10px; overflow: hidden; margin: 12px 0 3px; }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.recent { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 15px; display: grid; gap: 6px; }
.recent p { font-size: .89rem; }
.recent .button { justify-self: start; }
.actions { margin-top: 15px; display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.button { min-height: 44px; border: 1px solid var(--line); padding: 8px 14px; border-radius: 8px; background: var(--paper); color: var(--ink);
  font-weight: 650; font-size: .9rem; }
.button:hover:not(:disabled) { background: var(--tint); }
.button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.button.primary:hover:not(:disabled) { filter: brightness(1.13); background: var(--accent); }
.button.plain { border-color: transparent; background: transparent; color: var(--accent); }
.event { margin-bottom: 17px; background: var(--tint); }
.event h2 { margin: 6px 0; }
.event-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 13px; }
.choice { display: grid; gap: 4px; min-height: 62px; padding: 12px; text-align: left; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 9px; }
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice span { font-size: .83rem; color: var(--muted); }
.page-heading { display: grid; gap: 12px; margin: 7px 0 25px; max-width: 850px; }
.page-heading p { color: var(--muted); }
.wide-panel { max-width: 830px; }
.start { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 21px; padding-top: clamp(31px, 7vh, 90px); }
.start-intro { display: grid; align-items: end; min-height: 570px; background-position: 56% center; }
.start-intro::after { background: linear-gradient(0deg, #182d25f7, #213e31ae 46%, #213c3000 85%); }
.intro-copy { max-width: 620px; padding: clamp(23px, 4vw, 48px); display: grid; gap: 15px; }
.intro-copy > p { max-width: 40ch; color: #faf1d9; }
.create-panel { align-self: end; }
.create-panel form { display: grid; gap: 13px; }
.create-panel .fine { margin-top: 13px; }
label { display: grid; gap: 4px; font-size: .9rem; font-weight: 620; }
input, select { min-height: 44px; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--paper); font-size: 1rem; }
.form-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.plan-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); padding: 12px 0; }
.plan-row label span { font-weight: 400; color: var(--muted); }
.plan-row input { width: 76px; }
.mode { margin-top: 17px; width: fit-content; max-width: 100%; }
.error, .panel p.error { color: var(--danger); }
.timeline, .saves-list { list-style: none; padding: 0; margin: 15px 0 0; }
.timeline li { position: relative; border-left: 1px solid var(--line); padding: 0 0 22px 20px; margin-left: 5px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 6px; width: 9px; height: 9px; background: var(--accent); border-radius: 50%; }
.timeline li.routine::before { background: var(--muted); }
.timeline li span { color: var(--muted); font-size: .81rem; }
.timeline li strong { display: block; }
.saves-list li { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; gap: 10px; border-top: 1px solid var(--line); }
.saves-list strong { overflow-wrap: anywhere; }
.saves-list .actions { margin: 0; }
.saves-list p { font-size: .86rem; }
#notice { position: fixed; z-index: 4; inset: auto 18px 17px auto; max-width: min(420px, calc(100vw - 36px)); padding: 12px 15px;
  border-radius: 8px; background: var(--ink); color: var(--bg); box-shadow: 0 4px 19px #0003; }
#notice:empty { display: none; }
#notice[data-error="true"] { background: var(--paper); color: var(--danger); border: 1px solid var(--danger); }
.visually-hidden, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip-path: inset(50%); overflow: hidden; }
.skip:focus { position: fixed; z-index: 8; top: 8px; left: 8px; background: var(--paper); padding: 8px; }
.lab-grid { display: grid; gap: 15px; max-width: 900px; }
.lab-grid form { display: grid; gap: 10px; }
.lab-grid pre { overflow: auto; background: var(--bg); padding: 14px; border-radius: 8px; font-size: .83rem; max-height: 400px; }
.lab-grid table { width: 100%; text-align: left; border-collapse: collapse; font-size: .88rem; margin-top: 10px; }
.lab-grid th, .lab-grid td { padding: 5px; border-bottom: 1px solid var(--line); }
.lab-grid summary { min-height: 44px; padding: 9px 0; cursor: pointer; color: var(--accent); }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 180px minmax(0, 1fr); }
  .rail { padding-inline: 12px; }
  .wrap { padding-inline: 24px; }
  .start { gap: 14px; }
}
@media (max-width: 850px) {
  .shell { display: block; }
  .rail { position: static; height: auto; gap: 9px; padding: max(12px, env(safe-area-inset-top)) 14px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin: 2px 0 1px 4px; }
  .rail nav { display: flex; gap: 5px; overflow-x: auto; padding: 3px; margin-inline: -3px; }
  .nav-button { width: auto; flex: 0 0 auto; padding-inline: 9px; gap: 5px; font-size: .87rem; }
  .nav-button span { min-width: auto; }
  .rail-bottom { position: absolute; top: 4px; right: 12px; margin: 0; display: flex; align-items: center; }
  .rail-bottom .rail-note, .rail-bottom small, .rail-button span { display: none; }
  .rail-button { justify-content: center; width: 44px; }
  .wrap { padding: 18px 14px 37px; }
  .topline .eyebrow, .top-slash { display: none; }
  .start { grid-template-columns: 1fr; }
  .start-intro { min-height: 270px; }
  .intro-copy { padding: 25px; }
  .life-hero { padding: 24px 21px; min-height: 211px; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 13px; }
}
@media (max-width: 430px) {
  .metrics { grid-template-columns: 1fr; margin-block: 12px; }
  .metric { grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 9px 14px; }
  .metric + .metric { border-left: 0; border-top: 1px solid var(--line); }
  .metric strong { grid-area: 1 / 2 / 3 / 3; max-width: 124px; font-size: 1.22rem; }
  .metric small { font-size: .79rem; }
  .hero-location { display: none; }
  .event-options { grid-template-columns: 1fr; }
  .saves-list li { flex-wrap: wrap; }
  .period-stats { gap: 7px; }
}
