/* Мой путь. Сначала телефон; с 900px — боковое меню, как во вайрфреймах.
   Пока без дизайна: серые тона, системный шрифт. Шрифты и скрипты не грузим с чужих сайтов (ограничения РФ). */

:root {
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --line: #8c8c8c;
  --soft-line: #cfcfcf;
  --fill: #f2f2f2;
  --bg: #ffffff;
  --error: #a01818;
  --nav-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 18px; margin: 8px 0 0; }
p { margin: 0; }
a { color: var(--ink); }

.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--error); }
.row { display: flex; gap: 8px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 4px; margin-top: 6px; }
.narrow { max-width: 560px; width: 100%; }

/* Шапка и разделы */
.app-header {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg);
  border-bottom: 1.5px solid var(--line);
  padding: 10px 16px 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.brand { font-weight: 700; font-size: 18px; text-decoration: none; }
.sections { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.sections::-webkit-scrollbar { display: none; }

/* Нижнее меню на телефоне */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex;
  background: var(--bg);
  border-top: 1.5px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  min-height: var(--nav-h);
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 0 2px;
}
.tab.on { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }

.page { padding: 16px; max-width: 1100px; width: 100%; }

/* Элементы */
.card {
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 6px;
  color: inherit;
}
.card.alt { background: var(--fill); }
.card.link { text-decoration: none; }
.card.link:hover, .card.link:focus-visible { border-color: var(--ink); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.big { font-size: 30px; font-weight: 700; }
.total { border-top: 1px solid var(--soft-line); padding-top: 6px; }

.bar { height: 14px; border: 1.5px solid var(--ink); border-radius: 7px; overflow: hidden; background: var(--bg); }
.bar.thin { height: 8px; }
.fill { height: 100%; background: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 16px;
  border: 1.5px solid var(--ink); border-radius: 8px;
  background: var(--bg); color: var(--ink);
  font: inherit; text-decoration: none; cursor: pointer;
}
.btn.pri { background: var(--ink); color: var(--bg); }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: 14px; }
.btn.back { align-self: flex-start; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 20px;
  background: var(--bg); color: var(--ink);
  font-size: 14px; white-space: nowrap; text-decoration: none; cursor: pointer;
}
.chip.on, .chip:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.off { color: var(--muted); border-style: dashed; cursor: default; }
.chip input { accent-color: var(--ink); margin: 0; }
.chip:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }

.tag { font-size: 12px; border: 1px solid var(--muted); border-radius: 4px; padding: 1px 6px; color: #333333; }
.note { font-size: 14px; color: #333333; background: var(--fill); border-radius: 8px; padding: 10px 12px; }
details.note summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
details.note[open] { display: flex; flex-direction: column; gap: 8px; }

.list { list-style: none; margin: 0; padding: 0; }
.item { border-bottom: 1px solid var(--soft-line); padding: 10px 0; display: flex; flex-direction: column; gap: 4px; }

.month-nav { display: flex; align-items: center; gap: 12px; }
.month-nav h1 { flex: 1; text-align: center; }

.steps { list-style: none; margin: 0; padding: 0 0 0 1.5px; display: flex; max-width: 560px; }
.step { flex: 1; text-align: center; font-size: 13px; padding: 8px 4px; border: 1.5px solid var(--line); margin-left: -1.5px; }
.step.done { background: var(--ink); color: var(--bg); border-color: var(--ink); }

fieldset.choice { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
fieldset.choice legend { padding: 0; margin-bottom: 6px; width: 100%; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: #333333; }
.field input { min-height: 44px; border: 1.5px solid var(--line); border-radius: 8px; padding: 0 12px; font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); }
.field input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }

/* Вход */
.login { max-width: 360px; margin: 15vh auto 0; padding: 0 16px; display: flex; flex-direction: column; gap: 24px; }

/* Компьютер: меню слева */
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 100px); }
  .tabs {
    position: static;
    flex-direction: column;
    gap: 4px;
    padding: 16px 12px;
    border-top: 0;
    border-right: 1.5px solid var(--line);
  }
  .tab { flex: 0 0 auto; min-height: 44px; justify-content: flex-start; padding: 0 12px; border-radius: 8px; font-size: 15px; text-decoration: none; }
  .tab.on { background: var(--ink); color: var(--bg); text-decoration: none; }
  .page { padding: 24px 28px; }
  .card.wide { grid-column: span 2; }
}
