:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --panel: #ffffff;
  --text: #1e2423;
  --muted: #59625f;
  --line: #dce2dc;
  --accent: #116a70;
  --accent-strong: #0b464a;
  --good: #23714d;
  --good-soft: #eaf6ef;
  --warm: #b5652d;
  --shadow: 0 14px 34px rgba(30, 36, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #edf4f1 0, var(--bg) 320px),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  justify-content: space-between;
  padding: 14px 24px;
}

.brand {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.logout-form { margin: 0; }
.logout-form button { background: transparent; color: var(--accent-strong); padding: 4px 0; }
.account-link { color: var(--accent-strong); font-size: .9rem; font-weight: 700; margin-left: auto; text-decoration: none; }

.login-shell { display: grid; min-height: 100vh; padding: 20px; place-items: center; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); max-width: 390px; padding: 24px; width: 100%; }
.login-card h1 { font-size: 1.8rem; margin: 0; }
.login-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.4; margin: 8px 0 20px; }
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; font-size: .9rem; font-weight: 700; gap: 5px; }
.login-form input { border: 1px solid #bcc8bf; border-radius: 5px; font: inherit; padding: 9px; }
.error-state { background: #fdecea; border: 1px solid #e6aaa3; border-radius: 5px; color: #98362d; padding: 9px; }
.secondary-button { background: #edf4f1; border: 1px solid var(--line); color: var(--accent-strong); }
.passkey-state { color: var(--muted); font-size: .9rem; margin: 0; min-height: 1.3em; }
.passkey-list { border-top: 1px solid var(--line); color: var(--muted); margin: 18px 0 0; padding: 12px 0 0 18px; }

.page {
  margin: 0 auto;
  max-width: 1040px;
  padding: 32px 24px;
}

.intro {
  margin-bottom: 28px;
}

.intro h1 {
  font-size: 2.25rem;
  line-height: 1.1;
  margin: 0 0 8px;
}

.intro p {
  color: var(--muted);
  margin: 0;
}

.tool-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.tool-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-content: space-between;
  min-height: 170px;
  padding: 18px;
}

.tool-card h2 {
  font-size: 1rem;
  margin: 0 0 8px;
}

.tool-card p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.tool-card span {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tool-link {
  align-self: flex-start;
  background: var(--accent);
  border-radius: 6px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 9px 12px;
  text-decoration: none;
  text-transform: uppercase;
}

.plan-shell {
  margin: 0 auto;
  max-width: 860px;
}

.plan-header {
  align-items: flex-start;
  background:
    linear-gradient(135deg, rgba(17, 106, 112, 0.11), rgba(181, 101, 45, 0.1)),
    var(--panel);
  border: 1px solid rgba(17, 106, 112, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 18px;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.plan-header h1,
.day-heading h2 {
  line-height: 1.1;
  margin: 0;
}

.plan-header h1 {
  font-size: 2.1rem;
}

.plan-header p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.45;
  margin: 8px 0 0;
}

.progress-summary {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(17, 106, 112, 0.2);
  border-radius: 8px;
  min-width: 96px;
  padding: 12px;
  text-align: center;
}

.progress-summary strong {
  display: block;
  font-size: 1.35rem;
}

.progress-summary span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.day-strip {
  background: rgba(244, 246, 243, 0.92);
  backdrop-filter: blur(10px);
  display: flex;
  gap: 8px;
  margin: 0 -24px 20px;
  overflow-x: auto;
  padding: 10px 24px 12px;
  scroll-padding-left: 24px;
  position: sticky;
  top: 0;
  z-index: 4;
  -webkit-overflow-scrolling: touch;
}

.day-chip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  flex: 0 0 122px;
  padding: 11px 12px;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.day-chip.is-today {
  border-color: rgba(181, 101, 45, 0.55);
}

.day-chip.is-active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 10px 24px rgba(11, 70, 74, 0.22);
  color: #fff;
  transform: translateY(-1px);
}

.day-chip span,
.day-chip small {
  color: var(--muted);
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.day-chip.is-active span,
.day-chip.is-active small {
  color: rgba(255, 255, 255, 0.72);
}

.day-chip strong {
  display: block;
  font-size: 0.95rem;
  margin: 3px 0;
}

.mobility-days {
  display: grid;
  gap: 22px;
}

.mobility-day {
  scroll-margin-top: 96px;
}

.has-js .mobility-day {
  display: none;
}

.has-js .mobility-day.is-active {
  display: block;
}

.day-heading {
  align-items: flex-start;
  background: transparent;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 2px;
}

.day-heading h2 {
  font-size: 1.6rem;
}

.day-heading > span {
  color: var(--accent);
  font-weight: 800;
  padding-top: 4px;
}

.exercise-list {
  display: grid;
  gap: 12px;
}

.exercise-card {
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(30, 36, 35, 0.06);
  display: grid;
  gap: 12px;
  grid-template-columns: 52px 1fr;
  padding: 14px;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.exercise-card.is-complete {
  background: var(--good-soft);
  border-color: #9ac9ad;
  box-shadow: 0 8px 24px rgba(35, 113, 77, 0.12);
}

.exercise-card form {
  margin: 0;
}

.check-button {
  align-items: center;
  appearance: none;
  background: #fff;
  border: 2px solid #bcc8bf;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 1.4rem;
  font-weight: 900;
  height: 52px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 52px;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.check-button:active {
  transform: scale(0.96);
}

.check-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.is-complete .check-button {
  background: var(--good);
  border-color: var(--good);
}

.exercise-title-row {
  align-items: flex-start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.exercise-title-row h3 {
  font-size: 1.06rem;
  line-height: 1.25;
  margin: 0;
}

.exercise-title-row span {
  background: #f2f5f3;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-strong);
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.25;
  padding: 5px 8px;
  text-align: right;
}

.exercise-copy p {
  color: var(--muted);
  line-height: 1.45;
  margin: 7px 0 0;
}

.budget-shell {
  margin: 0 auto;
  max-width: 980px;
}

.budget-header,
.collection-header {
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 20px;
}

.budget-header h1,
.collection-header h1 {
  font-size: 2rem;
  line-height: 1.1;
  margin: 0;
}

.budget-header p:not(.eyebrow) {
  color: var(--muted);
  margin: 8px 0 0;
}

.budget-actions,
.month-nav,
.record-actions,
.form-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.budget-actions a,
.month-nav a,
.record-actions a,
.form-actions a,
.back-link {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.budget-actions a {
  background: #edf4f1;
  border-radius: 6px;
  padding: 9px 10px;
}

.month-nav {
  justify-content: space-between;
  margin: 20px 2px 14px;
}

.month-nav a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.cashflow-list {
  display: grid;
  gap: 14px;
}

.cashflow-month {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.cashflow-month > header {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
}

.cashflow-month h2 {
  font-size: 1.5rem;
  margin: 0;
}

.available-cash {
  color: var(--good);
  text-align: right;
}

.available-cash.is-negative { color: #b33d31; }
.available-cash span { color: var(--muted); display: block; font-size: .8rem; font-weight: 700; text-transform: uppercase; }
.available-cash strong { font-size: 1.12rem; }

.cashflow-summary {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin: 16px 0;
}

.cashflow-summary div { background: #f5f7f5; border-radius: 6px; padding: 10px; }
.cashflow-summary dt { color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; }
.cashflow-summary dd { font-weight: 800; margin: 4px 0 0; }

.account-grid,
.management-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.account-card { border: 1px solid var(--line); border-radius: 7px; padding: 13px; }
.account-card h3 { margin: 0 0 5px; }
.account-card > strong { font-size: 1.25rem; }
.account-card > p:not(.eyebrow) { color: var(--muted); margin: 5px 0 8px; }
.account-card ul { border-top: 1px solid var(--line); list-style: none; margin: 10px 0 0; padding: 8px 0 0; }
.account-card li { display: flex; font-size: .88rem; justify-content: space-between; padding: 3px 0; }
.month-notes { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; margin-top: 14px; padding-top: 8px; }
.month-notes p { margin: 5px 0; }
.muted { color: var(--muted); }

.collection-shell { max-width: 920px; }
.back-link { display: inline-block; margin: 0 0 14px; }
.collection-header { display: block; margin-bottom: 14px; }
.management-grid { align-items: start; }
.entry-form,
.record-list { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.entry-form h2,
.record-list h2 { font-size: 1.1rem; margin: 0 0 14px; }
.entry-form form p { margin: 0 0 12px; }
.entry-form label { display: block; font-size: .86rem; font-weight: 700; margin-bottom: 4px; }
.entry-form input,
.entry-form select { background: #fff; border: 1px solid #bcc8bf; border-radius: 5px; font: inherit; padding: 8px; width: 100%; }
.entry-form input[type=checkbox] { width: auto; }
.entry-form .helptext { color: var(--muted); display: block; font-size: .78rem; margin-top: 3px; }
.entry-form .errorlist { color: #b33d31; font-size: .85rem; margin: 4px 0; padding-left: 18px; }
button { background: var(--accent); border: 0; border-radius: 6px; color: #fff; cursor: pointer; font: inherit; font-weight: 700; padding: 9px 12px; }
.record-list article { align-items: center; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: space-between; padding: 12px 0; }
.record-list article:first-of-type { border-top: 0; }
.record-list p { color: var(--muted); font-size: .87rem; margin: 3px 0 0; }
.record-actions form { display: inline; }
.link-button { background: transparent; color: #a13f35; padding: 0; }
.narrow-shell { max-width: 560px; }

@media (max-width: 640px) {
  .topbar {
    padding: 12px 16px;
  }

  .page {
    padding: 18px 14px 28px;
  }

  .plan-header {
    display: grid;
    padding: 16px;
  }

  .plan-header h1 {
    font-size: 1.7rem;
  }

  .progress-summary {
    align-items: baseline;
    display: flex;
    gap: 6px;
    justify-content: center;
    width: 100%;
  }

  .day-strip {
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
    padding-right: 14px;
    scroll-padding-left: 14px;
  }

  .day-chip {
    flex-basis: 116px;
  }

  .day-heading h2 {
    font-size: 1.35rem;
  }

  .exercise-card {
    grid-template-columns: 48px 1fr;
    padding: 12px;
  }

  .check-button {
    height: 48px;
    width: 48px;
  }

  .exercise-title-row {
    display: grid;
    gap: 4px;
  }

  .exercise-title-row span {
    text-align: left;
  }

  .budget-header,
  .cashflow-month > header { display: grid; }

  .budget-header h1,
  .collection-header h1 { font-size: 1.7rem; }
  .cashflow-summary,
  .account-grid,
  .management-grid { grid-template-columns: 1fr; }
  .available-cash { text-align: left; }
}
