/* Дневник тренировок — оформление.
   Принципы: крупные элементы под палец, тёмная тема (в зале часто свет слепит),
   минимум отвлекающего, никаких внешних шрифтов (в России CDN отваливаются). */
:root {
  --bg: #0f1115;
  --card: #171a21;
  --card2: #1e222b;
  --line: #2a2f3a;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #4c8dff;
  --ok: #3ecf8e;
  --warn: #f0b429;
  --err: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px; line-height: 1.4;
  padding-bottom: env(safe-area-inset-bottom);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--err); min-height: 22px; }

.screen { max-width: 640px; margin: 0 auto; padding: 12px; }

/* --- вход --- */
.login-box { margin-top: 18vh; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-box h1 { font-size: 26px; margin: 0 0 4px; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local] {
  width: 100%; padding: 14px; font-size: 17px; color: var(--text);
  background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  font: inherit; color: var(--text); background: var(--card2);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer;
}
button:active { transform: translateY(1px); }
.big { padding: 16px; font-size: 18px; font-weight: 600; }
.primary { background: var(--accent); border-color: var(--accent); color: #06101f; }
.primary.save { background: var(--ok); border-color: var(--ok); color: #04220f; }
.ghost { background: transparent; }
.wide { width: 100%; }

/* --- верхняя панель --- */
.topbar { display: flex; align-items: center; gap: 8px; padding: 4px 0 10px; }
.brand { font-weight: 700; font-size: 18px; }
.status { margin-left: auto; font-size: 14px; color: var(--muted); }
.status.online { color: var(--ok); }
.status.offline { color: var(--warn); }
.status.pending { color: var(--warn); }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab { flex: 1; padding: 12px 8px; font-weight: 600; background: var(--card); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #06101f; }

.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.row { display: flex; gap: 8px; margin: 10px 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { padding: 8px 10px; font-size: 15px; background: var(--card); }

/* --- ввод подхода --- */
.set-inputs { display: flex; gap: 10px; margin: 12px 0; }
.stepper { flex: 1; }
.stepper-label { font-size: 14px; color: var(--muted); display: block; margin-bottom: 6px; }
.stepper-row { display: flex; align-items: center; gap: 6px; }
.stepper-row input { text-align: center; font-size: 20px; font-weight: 700; padding: 10px 4px; }
.step { min-width: 58px; padding: 12px 6px; font-size: 15px; }

.setlist { list-style: none; padding: 0; margin: 12px 0; }
.setlist li {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 8px;
}
.setlist .num { color: var(--muted); min-width: 26px; }
.setlist .val { font-weight: 600; flex: 1; }
.setlist .x { background: transparent; border: none; color: var(--err); font-size: 20px; padding: 4px 10px; }

/* --- самочувствие --- */
.feel { display: flex; gap: 8px; }
.feel button { flex: 1; font-size: 26px; padding: 10px 0; background: var(--card); }
.feel button.sel { background: var(--accent); border-color: var(--accent); }

/* --- история --- */
.history { list-style: none; padding: 0; margin: 0; }
.history li {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
}
.history .h-head { display: flex; align-items: baseline; gap: 10px; }
.history .h-date { font-weight: 700; }
.history .h-meta { color: var(--muted); font-size: 14px; margin-left: auto; }
.history .h-sets { color: var(--muted); font-size: 15px; margin-top: 6px; }
.history .h-del { background: transparent; border: none; color: var(--err); padding: 4px 8px; }

/* --- анализ --- */
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.totals div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.totals b { display: block; font-size: 22px; margin-top: 4px; }
h2 { font-size: 17px; margin: 20px 0 8px; color: var(--muted); font-weight: 600; }
.chart { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; overflow-x: auto; }
.chart svg { display: block; width: 100%; height: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; margin-top: 10px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }


/* ---------------------------------------------------------- таймер отдыха */
.rest {
  margin: 10px 0 14px; padding: 10px 12px;
  border: 1px solid #262b36; border-radius: 12px; background: #171a21;
}
.rest-top { display: flex; align-items: center; gap: 8px; }
.rest-label { color: #9aa0a6; font-size: 13px; }
.rest-time {
  margin-left: auto; font-size: 30px; font-weight: 700; letter-spacing: 1px;
  font-variant-numeric: tabular-nums; color: #e8eaed;
}
.rest.running .rest-time { color: #3ecf8e; }
.rest-start .rest-time { font-size: 26px; }
.rest .chips { margin-top: 8px; }
.rest .rest-top button { min-width: 46px; min-height: 40px; }

/* выбранный пресет отдыха и выбранное самочувствие — явно заметны */
.chip.active { border-color: #4c8dff; color: #fff; background: #1d2634; }

/* две кнопки в один ряд (на узком экране — друг под другом) */
.row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 360px) { .row.two { grid-template-columns: 1fr; } }
