/* Мобильный «дневник у стойки»: крупные поля и кнопки под палец, один столбец. */
:root {
  --bg: #F2F4F3; --surface: #FFFFFF; --fg: #161B19; --muted: #5E6B65; --line: #D6DDDA;
  --accent: #1F5FBF; --accent-fg: #FFFFFF; --accent-soft: #E3ECFA;
  --ok: #1E7A4F; --warn: #B4650A; --bad: #B3261E;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #101412; --surface: #181E1B; --fg: #E5EBE8; --muted: #98A6A0; --line: #2B3631;
    --accent: #7FA9F0; --accent-fg: #0E1420; --accent-soft: #1C2A40; --ok: #5CC48F; --warn: #E5A456; --bad: #F2867D;
    color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 16px/1.45 var(--body); padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-text-size-adjust: 100%; }
main { max-width: 640px; margin: 0 auto; padding: 0 12px 48px; }
h1 { font-size: 22px; margin: 0; line-height: 1.2; text-wrap: balance; }
h2 { font-size: 17px; margin: 0; }
p { margin: 0; }
a { color: var(--accent); }
.pad { padding: 16px 4px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--fg); text-decoration: none; }
.top nav { display: flex; gap: 4px; }
.top nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 500; }
.top nav a.on { background: var(--accent-soft); color: var(--accent); }

.primary { background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 10px; padding: 14px 16px; font-weight: 600; min-height: 48px; }
.primary:active { transform: translateY(1px); }
.danger { background: none; border: 1px solid var(--line); color: var(--bad); border-radius: 10px; padding: 12px; }
input[type=password], input[type=date], textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
label { font-size: 13px; color: var(--muted); }

.login { max-width: 360px; margin: 18vh auto 0; display: flex; flex-direction: column; gap: 10px; padding: 0 8px; }

.days { display: grid; gap: 8px; }
.day { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 12px; text-align: left;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.day b { grid-row: span 2; font: 700 26px/1 var(--mono); align-self: center; color: var(--muted); }
.day small { color: var(--muted); font-size: 12px; }
.day[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.day[aria-pressed="true"] b { color: var(--accent); }

.sesshead { display: flex; justify-content: space-between; gap: 12px; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.progress i { display: block; height: 100%; width: 0; background: var(--ok); }

.ex { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 8px; }
.ex.done { border-color: var(--ok); }
.ex header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.target { font: 500 13px var(--mono); color: var(--accent); white-space: nowrap; }
.note { font-size: 13px; color: var(--muted); }
.prev { font-size: 14px; }
.goal { font-size: 14px; font-weight: 600; }
.sets { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 2px; font-variant-numeric: tabular-nums; }
.sets li { padding: 2px 0; }
.sets li > * { vertical-align: middle; }
.setbtn { background: none; border: 0; padding: 4px 0; text-align: left; font-family: var(--mono); font-size: 14px;
  text-decoration: underline dotted var(--line); text-underline-offset: 4px; }
.sets li.editing .setbtn { color: var(--accent); font-weight: 600; text-decoration-color: var(--accent); }
.cancel { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 48px; }
.del { float: right; background: none; border: 0; color: var(--muted); font-size: 18px; padding: 0 6px; min-width: 32px; }
.del.armed { color: var(--bad); font-size: 13px; }
.feel { font-style: normal; font-family: var(--body); font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--bg); }
.f1 { color: var(--ok); } .f2 { color: var(--accent); } .f3 { color: var(--warn); } .f4 { color: var(--bad); }

.entry { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stepper { display: grid; grid-template-columns: 44px 1fr 44px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.stepper button { border: 0; background: none; font-size: 22px; min-height: 48px; color: var(--accent); }
.stepper input { border: 0; background: var(--surface); text-align: center; font: 600 18px var(--mono); width: 100%; min-width: 0; padding: 0; }
.feels { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 12px; font-size: 14px; min-height: 40px; }
.chip[aria-pressed="true"] { border-color: currentColor; background: var(--bg); font-weight: 600; }
.row { display: flex; gap: 12px; align-items: center; }
.row .primary { flex: 1; }
.hist { font-size: 14px; white-space: nowrap; }

.finish { border-top: 1px solid var(--line); margin-top: 8px; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.list a { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: baseline; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--fg); }
.list small { color: var(--muted); }
.ex-list a { grid-template-columns: 1fr auto; }
.back { text-decoration: none; font-size: 14px; }

.tbl { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
td:first-child { white-space: nowrap; }
td { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 10; max-width: 90vw; }
.toast.bad { background: var(--bad); color: #fff; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
