:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #151816;
  color: #f3f5ef;
  --accent: #d4fa79;
  --muted: #b0b9ae;
  --surface: #202620;
  --line: #3a4438;
}
* { box-sizing: border-box; }
body { margin: 0; }
.shell { width: min(100% - 2rem, 60rem); margin-inline: auto; }
header { border-bottom: 1px solid var(--line); }
.masthead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 4.5rem; color: var(--muted); }
.brand { font-size: 1.65rem; font-weight: 850; letter-spacing: -.07em; color: inherit; text-decoration: none; }
.brand span, h1 span { color: var(--accent); }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 1.2rem; margin-block: clamp(2rem, 7vw, 5rem) 1.5rem; }
.week { color: var(--accent); font-size: .875rem; margin: 0 0 .5rem; }
h1 { margin: 0; font-size: clamp(2.6rem, 8vw, 5.5rem); line-height: .95; letter-spacing: -.08em; }
h2 { margin: 0 0 1rem; letter-spacing: -.04em; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); border-radius: .6rem; padding: .65rem .9rem; background: var(--surface); color: inherit; }
button:hover { border-color: var(--accent); }
.primary { border-color: transparent; background: var(--accent); color: #172008; font-weight: 750; }
.primary:hover { background: #e4ffa7; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.overview { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; padding: clamp(1rem, 3vw, 2rem); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1.75rem; gap: .5rem; }
.stats div { display: grid; justify-items: start; }
.stats strong { color: var(--accent); font-size: clamp(1.65rem, 5vw, 3rem); line-height: 1.2; }
.stats span, .chart, .storage, #empty, .meta { color: var(--muted); font-size: .875rem; }
.chart { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(.25rem, 2vw, 1rem); }
.day { display: grid; gap: .45rem; text-align: center; min-width: 0; }
.rail { height: 5.5rem; display: flex; align-items: end; background: #30392e; border-radius: .45rem; overflow: hidden; }
.bar { background: var(--accent); width: 100%; }
.history { margin-block: 2rem 3rem; }
#history { display: grid; list-style: none; gap: .6rem; padding: 0; }
#history li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .85rem; border: 1px solid var(--line); border-radius: .75rem; }
#history strong, .notes { overflow-wrap: anywhere; }
.notes { white-space: pre-wrap; margin: .3rem 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.storage { margin-top: 1.4rem; }
.backup summary { cursor: pointer; }
.backup p { color: var(--muted); }
.login { max-width: 28rem; margin: 3rem auto; }
.login h1 { font-size: clamp(2.4rem, 9vw, 4rem); margin-bottom: 1.5rem; }
.login a { color: var(--accent); }
.login button { justify-self: start; }
dialog { width: min(100% - 2rem, 30rem); padding: 1.25rem; background: var(--surface); color: inherit; border: 1px solid var(--line); border-radius: 1rem; }
dialog::backdrop { background: #080a08bf; }
form, label { display: grid; gap: .5rem; }
form { gap: 1rem; }
form h2 { margin: 0; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .75rem; }
input, textarea { width: 100%; min-width: 0; background: #151816; color: inherit; border: 1px solid var(--line); border-radius: .5rem; padding: .6rem; font: inherit; }
form .actions { justify-content: end; }
#form-error { color: #ffb6a4; margin: 0; }
@media (max-width: 37rem) { .hero { flex-direction: column; align-items: start; } }
