/* Екрани Body Coach. Лише змінні з tokens.css; світла тема, без градієнтів. */
*, *::before, *::after { box-sizing: border-box; }

.page { max-width: 480px; margin: 0 auto; padding: 16px 16px 40px; }
a { color: inherit; }
p { margin: 0; }

/* ---- шапка дня ---- */
.day-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.day-top b { color: var(--text); font-size: 15px; }
.day-nav { display: flex; align-items: center; gap: 2px; }
.nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; margin-left: -12px; margin-right: -4px;
  font-size: 22px; color: var(--muted); text-decoration: none;
}
.day-nav b + .nav-btn { margin-left: 0; }

.lbl, .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sec { margin: 16px 0 2px; }
.of { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.track { height: 6px; border-radius: 3px; background: var(--surface); margin: 10px 0 13px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--accent); }
.mac { display: flex; justify-content: space-between; margin-bottom: 12px; }
.mac small { display: block; color: var(--muted); font-size: 11px; }
.mac b { font-size: 16px; font-variant-numeric: tabular-nums; }
.note { font-size: 13px; color: var(--muted); margin: 0 0 8px; }

details.why { margin-bottom: 14px; }
details.why summary { font-weight: 600; cursor: pointer; min-height: 24px; list-style: none; }
details.why summary::-webkit-details-marker { display: none; }
details.why summary::after { content: " ›"; color: var(--muted); }
details.why[open] summary::after { content: " ‹"; }
details.why p { margin-top: 4px; }

/* ---- кнопки й поля ---- */
.btn, .btn-secondary, .btn-quiet {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; width: 100%; padding: 12px 14px; border-radius: var(--radius);
  font: inherit; font-weight: 600; text-align: center; cursor: pointer;
}
.btn { background: var(--accent); color: var(--on-accent); border: 0; }
.btn-secondary { background: var(--bg); color: var(--accent); border: 1px solid var(--line); }
.btn-quiet { background: var(--surface); color: var(--muted); border: 0; font-weight: 500; }
.field {
  display: block; width: 100%; min-height: 44px; margin-top: 4px; padding: 10px 12px;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.photo-form { display: grid; gap: 8px; margin-bottom: 14px; }
.photo-form .btn { position: relative; }
.photo-form:has(input[type=file]:valid) .btn { background: var(--surface); color: var(--accent); }
.photo-form:has(input[type=file]:valid) .send { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.send .busy { display: none; }
.photo-form.htmx-request .send .idle { display: none; }
.photo-form.htmx-request .send .busy { display: inline; }

/* ---- повідомлення ---- */
.alert { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin-bottom: 10px; }
.alert form { margin-top: 8px; }
.alert .btn-secondary { background: var(--bg); }
.notice { background: var(--surface); color: var(--muted); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.grams-form { display: flex; align-items: flex-end; gap: 8px; }
.grams-form label { flex: 1; }
.grams-form input { display: block; width: 100%; min-height: 44px; margin-top: 4px; padding: 10px 12px; font: inherit; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
.grams-form .btn-secondary { width: auto; min-width: 64px; }

.result { margin-bottom: 8px; }
.reply { white-space: pre-line; background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; margin: 4px 0 6px; }
.result .note { display: inline-flex; align-items: center; min-height: 44px; }

/* ---- стрічка ---- */
.entry-pinned { margin-bottom: 8px; }
.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.row .name { text-decoration: none; display: inline-block; min-height: 24px; }
.d { color: var(--muted); font-size: 12px; }
.k { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-waiting .k { color: var(--muted); }
.doubt { font-size: 12px; color: var(--muted); padding: 0 0 8px; }
.planned .ghost { opacity: .55; }
.planned form { margin-top: 6px; }
.planned .btn-secondary { width: auto; display: inline-flex; font-weight: 500; }
.empty { color: var(--muted); font-size: 14px; margin-top: 16px; }

/* ---- сторінка запису ---- */
details.edit { border-top: 1px solid var(--line); }
details.edit summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.edit-form { display: grid; gap: 10px; padding: 4px 0 14px; font-size: 13px; color: var(--muted); }
.edit-form .field { color: var(--text); }
.edit-form fieldset { border: 0; padding: 0; margin: 0; }
.edit-form legend { padding: 0; margin-bottom: 4px; }
.per100 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.danger { margin-top: 24px; }

/* ---- нижня навігація ---- */
.page.with-nav { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; background: var(--bg); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; max-width: 96px; min-height: 52px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--muted); text-decoration: none; text-align: center;
}
.tabbar a[aria-current="page"] { color: var(--text); font-weight: 600; }

/* ---- заголовки екранів, форми ---- */
.screen-title { font-size: 22px; font-weight: 700; margin: 4px 0 14px; }
.stack { display: grid; gap: 10px; }
.stack label, .weight-form label { font-size: 13px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.weight-form { display: flex; align-items: flex-end; gap: 8px; margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); }
.weight-form label { flex: 1; }
.weight-form .btn-secondary { width: auto; }
textarea.field { min-height: 96px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); }

/* ---- списки (бібліотека, історія) ---- */
details.item { border-top: 1px solid var(--line); }
details.item > summary {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 52px; padding: 6px 0; cursor: pointer; list-style: none;
}
details.item > summary::-webkit-details-marker { display: none; }
details.item > .stack { padding: 4px 0 14px; }
.inline-form { display: flex; align-items: flex-end; gap: 8px; }
.inline-form > * { flex: 1; }
.inline-form .btn-secondary { flex: 0 0 auto; width: auto; }
.ing { border-top: 1px solid var(--line); padding-top: 10px; }
.total-row { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); font-weight: 600; font-variant-numeric: tabular-nums; }
.total-row span { color: var(--muted); font-weight: 400; }

/* ---- історія ---- */
.cat { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface); color: var(--muted); white-space: nowrap; }
.cat-manual::after { content: " · вручну"; }

/* ---- налаштування ---- */
.budget { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.budget-warn .state, .budget-over .state { background: var(--warn-bg); color: var(--warn); }
.state { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface); color: var(--muted); margin-top: 6px; }
.right { text-align: right; }
.mt { margin-top: 8px; }
.mt-lg { margin-top: 16px; }
.link-btn { margin-top: 8px; text-decoration: none; }
.plan-why { margin: 8px 0 12px; }
fieldset.ing { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 10px 0 0; min-width: 0; }
details.item .name { text-decoration: none; }
