:root {
  --ink: #20201e;
  --muted: #77756e;
  --paper: #f7f7f3;
  --surface: #ffffff;
  --line: #e8e8e1;
  --mint: #cfe9dc;
  --mint-strong: #1f7a59;
  --blue: #dce8fa;
  --blue-strong: #476ca9;
  --peach: #f6dfd0;
  --peach-strong: #a96643;
  --yellow: #f7e9ad;
  --yellow-strong: #947526;
  --shadow: 0 18px 50px rgba(43, 43, 32, 0.06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.app-shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 92px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.brand-mark { color: var(--mint-strong); font-size: 1.35rem; line-height: 1; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.save-status { color: var(--muted); font-size: 0.76rem; letter-spacing: 0.01em; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #6ab58a; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: var(--surface); font-size: 1.15rem; transition: color .2s, border-color .2s, transform .2s; }
.icon-button:hover { color: var(--ink); border-color: #bcbcb3; transform: rotate(-20deg); }

main { padding: 66px 0 42px; }
.welcome-section { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 42px; }
.eyebrow { margin: 0 0 12px; color: var(--muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.17em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-family: "Space Grotesk", sans-serif; font-size: clamp(2.7rem, 7vw, 5.8rem); font-weight: 600; letter-spacing: -0.085em; line-height: .92; }
.accent { color: var(--mint-strong); }
.intro { max-width: 430px; margin-bottom: 0; color: var(--muted); font-size: 1rem; line-height: 1.55; }
.date-chip { padding: 10px 15px; border-radius: 999px; color: var(--mint-strong); background: var(--mint); font-size: .75rem; font-weight: 700; white-space: nowrap; }

.stats-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 14px; margin-bottom: 58px; }
.stat-card { position: relative; min-height: 170px; padding: 24px 25px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.stat-card-primary { background: var(--mint); border-color: transparent; }
.stat-label { margin-bottom: 12px; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.stat-card-primary .stat-label { color: var(--mint-strong); }
.stat-value { font-family: "Space Grotesk", sans-serif; font-size: 3.35rem; font-weight: 600; letter-spacing: -.08em; line-height: .9; }
.stat-caption { margin-top: 10px; color: var(--muted); font-size: .78rem; }
.stat-card-primary .stat-caption { color: #4f7665; }
.stat-icon { position: absolute; right: 22px; bottom: 17px; color: var(--blue-strong); font-family: "Space Grotesk", sans-serif; font-size: 2.2rem; transform: rotate(-14deg); }
.stat-icon.flame { color: var(--peach-strong); }
.week-dots { position: absolute; right: 24px; bottom: 25px; display: flex; gap: 7px; }
.week-dot { width: 9px; height: 9px; border: 1px solid #8fbaa3; border-radius: 50%; }
.week-dot.active { border-color: var(--mint-strong); background: var(--mint-strong); }

.content-grid { display: grid; grid-template-columns: minmax(320px, .88fr) minmax(420px, 1.12fr); gap: 48px; align-items: start; }
.panel { border-top: 1px solid var(--ink); }
.panel-heading { display: flex; justify-content: space-between; align-items: start; padding: 25px 0 26px; }
.panel-heading .eyebrow { margin-bottom: 10px; }
h2 { margin-bottom: 0; font-family: "Space Grotesk", sans-serif; font-size: 1.75rem; font-weight: 600; letter-spacing: -.06em; }
.panel-number { color: var(--muted); font-family: "Space Grotesk", sans-serif; font-size: .78rem; }
.entry-count { margin-top: 8px; color: var(--muted); font-size: .75rem; }

.field-group { min-width: 0; }
.field-group label { display: block; margin-bottom: 8px; color: var(--muted); font-size: .74rem; font-weight: 700; }
.field-group label span { color: #a9a9a1; font-weight: 400; }
.field-group input, .field-group select, .field-group textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--ink); background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.field-group input, .field-group select { height: 47px; padding: 0 13px; }
.field-group textarea { display: block; min-height: 84px; padding: 13px; resize: vertical; }
.field-group input::placeholder, .field-group textarea::placeholder { color: #b6b6ae; }
.field-group input:focus, .field-group select:focus, .field-group textarea:focus { border-color: var(--mint-strong); box-shadow: 0 0 0 3px rgba(31, 122, 89, .1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 17px; }
.three-columns { grid-template-columns: repeat(3, 1fr); }
.field-wide { margin-top: 17px; }
.primary-button { display: flex; justify-content: space-between; align-items: center; width: 100%; height: 52px; margin-top: 24px; padding: 0 17px 0 19px; border: 0; border-radius: 9px; color: #fff; background: var(--ink); font-size: .84rem; font-weight: 700; transition: background .2s, transform .2s; }
.primary-button:hover { background: var(--mint-strong); transform: translateY(-2px); }
.primary-button span:last-child { font-size: 1.25rem; font-weight: 400; }
.form-feedback { min-height: 18px; margin: 12px 0 0; color: var(--mint-strong); font-size: .75rem; }

.activity-list { display: flex; flex-direction: column; gap: 1px; }
.day-group { padding-bottom: 19px; }
.day-group + .day-group { padding-top: 18px; border-top: 1px solid var(--line); }
.day-heading { display: flex; justify-content: space-between; align-items: end; padding: 0 0 3px; }
.day-label { font-family: "Space Grotesk", sans-serif; font-size: .95rem; font-weight: 600; letter-spacing: -.03em; }
.day-date { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.day-total { color: var(--mint-strong); font-size: .7rem; font-weight: 700; }
.activity-item { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); animation: slide-in .3s ease both; }
.activity-marker { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 12px; color: var(--blue-strong); background: var(--blue); font-size: 1.15rem; }
.activity-marker.cardio { color: var(--peach-strong); background: var(--peach); }
.activity-marker.mobility, .activity-marker.recovery { color: var(--yellow-strong); background: var(--yellow); }
.activity-name { margin-bottom: 4px; font-weight: 700; font-size: .9rem; }
.activity-meta { color: var(--muted); font-size: .74rem; }
.activity-note { max-width: 270px; margin: 6px 0 0; overflow: hidden; color: var(--muted); font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.activity-total { color: var(--ink); font-size: .78rem; font-weight: 700; text-align: right; white-space: nowrap; }
.delete-entry { display: block; margin: 6px 0 0 auto; padding: 0; border: 0; color: #aaa9a1; background: none; font-size: .68rem; opacity: 0; transition: color .2s, opacity .2s; }
.activity-item:hover .delete-entry, .delete-entry:focus { opacity: 1; }
.delete-entry:hover { color: #b95c52; }
.empty-state { padding: 54px 26px; border: 1px dashed #d9d9d1; border-radius: 13px; color: var(--muted); text-align: center; }
.empty-icon { display: block; margin-bottom: 15px; color: var(--mint-strong); font-size: 1.6rem; }
.empty-state strong { display: block; margin-bottom: 7px; color: var(--ink); font-family: "Space Grotesk", sans-serif; font-size: 1rem; }
.empty-state p { max-width: 250px; margin: 0 auto; font-size: .78rem; line-height: 1.5; }
.progress-panel { margin-top: 58px; }
.progress-heading { padding-bottom: 22px; }
.progress-toolbar { display: grid; grid-template-columns: minmax(210px, .45fr) 1fr; gap: 28px; align-items: end; margin-bottom: 30px; }
.progress-select-group { margin-top: 0; }
.progress-summary { display: flex; justify-content: flex-end; align-items: end; gap: 24px; min-height: 47px; text-align: right; }
.progress-stat { color: var(--muted); font-size: .7rem; line-height: 1.35; text-transform: uppercase; letter-spacing: .07em; }
.progress-stat strong { display: block; margin-top: 4px; color: var(--ink); font-family: "Space Grotesk", sans-serif; font-size: 1.25rem; letter-spacing: -.05em; text-transform: none; }
.progress-stat.change strong { color: var(--mint-strong); }
.progress-stat.change.down strong { color: var(--peach-strong); }
.progress-chart-wrap { padding: 20px 22px 16px; border-radius: 13px; background: #f1f3ee; }
.chart-labels { display: flex; justify-content: space-between; margin-bottom: 22px; color: #92968e; font-size: .64rem; font-weight: 700; letter-spacing: .11em; }
.progress-chart { display: flex; align-items: end; gap: 12px; height: 150px; padding: 0 5px; border-bottom: 1px solid #d8ded7; }
.progress-bar-item { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: end; min-width: 28px; height: 100%; }
.progress-bar-value { min-height: 15px; margin-bottom: 5px; color: var(--mint-strong); font-size: .68rem; font-weight: 700; }
.progress-bar-track { display: flex; align-items: end; width: min(32px, 80%); height: 100px; }
.progress-bar { display: block; width: 100%; min-height: 5px; border-radius: 6px 6px 0 0; background: var(--mint-strong); opacity: .78; transition: height .3s ease; }
.progress-bar-item:last-child .progress-bar { background: var(--ink); opacity: 1; }
.progress-bar-date { margin-top: 8px; color: #92968e; font-size: .64rem; }
.progress-table { margin-top: 23px; }
.progress-table-header, .progress-table-row { display: grid; grid-template-columns: 1fr .6fr .6fr .6fr; gap: 10px; align-items: center; padding: 12px 0; }
.progress-table-header { color: var(--muted); border-bottom: 1px solid var(--ink); font-size: .65rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.progress-table-row { border-bottom: 1px solid var(--line); font-size: .78rem; }
.progress-table-row span:not(:first-child), .progress-table-header span:not(:first-child) { text-align: right; }
.progress-table-row .positive { color: var(--mint-strong); font-weight: 700; }
.progress-table-row .negative { color: var(--peach-strong); font-weight: 700; }
.progress-empty { padding: 34px 26px; border: 1px dashed #d9d9d1; border-radius: 13px; color: var(--muted); text-align: center; }
.progress-empty .empty-icon { display: block; margin-bottom: 10px; color: var(--mint-strong); font-size: 1.5rem; }
.progress-empty strong { display: block; margin-bottom: 7px; color: var(--ink); font-family: "Space Grotesk", sans-serif; font-size: 1rem; }
.progress-empty p { max-width: 290px; margin: 0 auto; font-size: .78rem; line-height: 1.5; }
.footer-note { margin-top: 54px; color: #aaa9a1; font-size: .75rem; text-align: center; }
.footer-spark { margin-right: 5px; color: var(--mint-strong); }

@keyframes slide-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 32px, 560px); }
  .topbar { height: 74px; }
  main { padding-top: 44px; }
  .welcome-section { display: block; margin-bottom: 32px; }
  .date-chip { display: inline-block; margin-top: 24px; }
  .stats-grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 44px; }
  .stat-card { min-height: 142px; }
  .content-grid { display: block; }
  .activity-panel { margin-top: 55px; }
  .progress-panel { margin-top: 48px; }
  .progress-toolbar { display: block; }
  .progress-summary { justify-content: space-between; margin-top: 20px; text-align: left; }
  .progress-chart { gap: 7px; }
  .activity-note { max-width: 175px; }
}

@media (max-width: 420px) {
  .save-status { display: none; }
  h1 { font-size: 3.2rem; }
  .form-row.three-columns { gap: 8px; }
  .field-group input, .field-group select { padding-left: 10px; padding-right: 10px; }
  .activity-item { grid-template-columns: 38px 1fr auto; gap: 10px; }
  .activity-marker { width: 38px; height: 38px; border-radius: 10px; }
  .progress-table-header, .progress-table-row { grid-template-columns: 1fr .65fr .65fr; }
  .progress-table-header span:nth-child(3), .progress-table-row span:nth-child(3) { display: none; }
}
