:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101214;
  color: #f4f4ee;
  --surface: #191d20;
  --line: #333a3e;
  --muted: #b2b9bb;
  --accent: #d8fa72;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, input, select, textarea { min-height: 44px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.brand, main { width: min(100%, 700px); margin-inline: auto; padding-inline: 20px; }
.brand {
  display: flex; align-items: center; gap: 10px; padding-top: calc(20px + env(safe-area-inset-top));
  font-weight: 850; letter-spacing: .13em; font-size: 1.1rem;
}
.brand img { border-radius: 11px; }
main { padding-top: 28px; padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(2.15rem, 9vw, 3.4rem); letter-spacing: -.055em; line-height: 1.02; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1rem; }
p, small { line-height: 1.45; }
.muted, small { color: var(--muted); }
.datebar, .row, .section-title, .dialog-title, .actions { display: flex; align-items: center; gap: 10px; }
.datebar { margin-block: 17px 20px; }
.datebar input { min-width: 0; flex: 1; text-align: center; }
.row, .section-title, .dialog-title { justify-content: space-between; }
.row > :first-child, .section-title > :first-child { min-width: 0; }
.row small { display: block; margin-top: 4px; }
.section-title { margin-bottom: 11px; }
.stack { display: grid; gap: 10px; }
.block { margin-top: 25px; }
.actions { flex-wrap: wrap; }
.grid, .macro, .sets { display: grid; gap: 8px; }
.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid button { min-height: 54px; padding-inline: 8px; }
.macro { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric, .card { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 14px; }
.metric { min-height: 105px; display: grid; align-content: space-between; gap: 10px; }
.metric strong { font-size: clamp(1.35rem, 6vw, 2.25rem); letter-spacing: -.045em; overflow-wrap: anywhere; }
.metric.primary { color: #15190a; background: var(--accent); border-color: var(--accent); }
.metric.primary small { color: #343e1d; }
.macro-summary { display: grid; gap: 8px; }
.macro-summary .macro span { padding: 8px 4px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.entry-text { white-space: pre-wrap; }
button {
  background: #252a2d; color: inherit; border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 13px; font-weight: 650;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #15190a; }
button.subtle { background: transparent; }
button.danger { color: #ffb5ab; }
button.icon { min-width: 44px; padding-inline: 6px; font-size: 1.15rem; }
button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
#navigation {
  position: fixed; inset: auto 0 0; display: flex; justify-content: center; gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); z-index: 1;
  background: #15181af5; border-top: 1px solid var(--line);
}
#navigation button {
  display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 52px;
  width: min(33%, 180px); background: transparent; border: 0; font-size: .79rem;
}
#navigation svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }
#navigation [aria-current="page"] { color: var(--accent); background: #242d1b; }
dialog {
  color: inherit; background: #171a1d; border: 1px solid var(--line); border-radius: 20px;
  padding: 17px; margin: auto; width: min(calc(100% - 24px), 560px);
  max-height: min(86dvh, 780px); overscroll-behavior: contain;
}
dialog::backdrop { background: #000a; }
form, label { display: grid; gap: 7px; }
form { gap: 15px; }
input, select, textarea {
  width: 100%; border-radius: 10px; border: 1px solid var(--line);
  background: #101214; color: inherit; padding: 9px 10px; font-size: max(16px, 1rem);
}
textarea { resize: vertical; min-height: 78px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 0; min-width: 0; padding: 12px; }
.sets { grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); }
.sets .row { align-items: end; }
.sets label { flex: 1; }
.history-group { margin-top: 14px; }
.history-group li { margin-top: 7px; line-height: 1.45; overflow-wrap: anywhere; }
.history-group ul { margin: 8px 0 0; padding-left: 20px; }
#notice:not(:empty) {
  position: fixed; z-index: 2; bottom: calc(82px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); background: #303b28; padding: 10px 16px; border-radius: 12px;
  width: max-content; max-width: calc(100% - 34px);
}
.error { color: #ffb5ab; }
[hidden] { display: none !important; }
#extra-navigation { width: min(100%, 700px); margin: 15px auto 0; padding-inline: 20px; display: flex; flex-wrap: wrap; gap: 6px; }
#extra-navigation button { font-size: .8rem; padding-inline: 9px; }
#extra-navigation [aria-current] { color: var(--accent); border-color: var(--accent); }
#navigation button { width: min(20%, 130px); min-width: 0; padding-inline: 2px; font-size: clamp(.61rem, 2.65vw, .79rem); }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar small { text-align: center; }
.calendar button { position: relative; padding-inline: 1px; min-width: 0; }
.calendar button small { display: block; line-height: 1; font-size: .7rem; color: var(--accent); }
figure.photo { margin: 0; min-width: 0; }
.photo img { width: 100%; aspect-ratio: 4/5; object-fit: contain; background: #111; border-radius: 10px; }
.photo figcaption { display: grid; gap: 6px; }
.trend-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr)); }
.trend { display: grid; gap: 10px; }
.bars { height: 74px; display: flex; align-items: end; gap: 3px; border-bottom: 1px solid var(--line); }
.bars span { height: var(--height); min-width: 0; flex: 1; border-radius: 3px 3px 0 0; background: var(--accent); }
table { width: 100%; border-collapse: collapse; }
td, th { border-bottom: 1px solid var(--line); padding: 8px 4px; text-align: left; }
thead { color: var(--muted); font-size: .82rem; }
tbody th { font-weight: 500; }
button:disabled { opacity: .55; cursor: wait; }
