:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --sel: #dbeafe;
  --warn-bg: #fef3c7;
  --warn-ink: #92400e;
  --danger: #b91c1c;
  --ok: #047857;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 16px; background: #0f172a; color: #fff;
}
.brand { font-weight: 700; font-size: 15px; }
.langs { display: flex; gap: 4px; }
.langs button {
  min-width: 44px; min-height: 36px; border: 1px solid #334155; border-radius: 8px;
  background: transparent; color: #cbd5e1; font-weight: 600; cursor: pointer;
}
.langs button[aria-pressed="true"] { background: #fff; color: #0f172a; border-color: #fff; }

.wrap { max-width: 520px; margin: 0 auto; padding: 16px; padding-bottom: 48px; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 24px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

label.f { display: block; font-weight: 600; margin: 14px 0 6px; }
label.f .opt { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type=text], input[type=password], input[type=number], input[type=date], textarea, select {
  width: 100%; min-height: 46px; padding: 10px 12px; font: inherit;
  border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { min-height: 70px; resize: vertical; }
input:focus, textarea:focus, button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 1px; }
.invalid { border-color: var(--danger) !important; }
/* у шкал, кнопок выбора и сетки RPE нет своей рамки — отметка ставится на кнопки внутри */
.scale-wrap.invalid .scale button, .chips.invalid button, .rpe-grid.invalid button { border-color: var(--danger) !important; }
.field-err { margin-top: 4px; min-height: 0; }

.btn {
  display: block; width: 100%; min-height: 50px; margin-top: 18px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; cursor: pointer;
}
.btn.secondary { background: #e5e7eb; color: var(--ink); }
.btn.link { background: none; color: var(--accent); font-weight: 600; min-height: 44px; margin-top: 8px; }
.btn:disabled { opacity: .55; cursor: default; }

.big { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 4px; }
.big button {
  min-height: 108px; border-radius: 16px; border: 0; font: inherit; font-size: 18px; font-weight: 700;
  background: var(--accent); color: #fff; cursor: pointer; padding: 10px;
}
.big button.done { background: #e0e7ff; color: #1e3a8a; }
.big small { display: block; font-weight: 500; font-size: 13px; margin-top: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button, .scale button {
  min-height: 44px; min-width: 44px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: 10px;
  background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.chips button[aria-pressed="true"], .scale button[aria-pressed="true"] {
  background: var(--sel); border-color: var(--accent); color: #1e3a8a;
}
.scale { display: flex; gap: 6px; }
.scale button { flex: 1; padding: 0; min-width: 0; }
.scale-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; gap: 8px; }
.scale-ends span:last-child { text-align: right; }

.rpe-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.rpe-grid button { min-height: 46px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.rpe-grid button[aria-pressed="true"] { background: var(--sel); border-color: var(--accent); color: #1e3a8a; }
.rpe-now { margin-top: 10px; font-weight: 600; min-height: 22px; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 10px; min-height: 44px; }
.check input { width: 22px; height: 22px; }

.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; }
.err { color: var(--danger); font-size: 14px; margin-top: 8px; min-height: 18px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #dcfce7; color: var(--ok); }

.pick button {
  display: block; width: 100%; text-align: left; min-height: 50px; padding: 0 14px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; cursor: pointer;
}
.pick button[aria-pressed="true"] { border-color: var(--accent); background: var(--sel); }

.day { margin-top: 14px; }
.day h3 { font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.day h3::first-letter { text-transform: uppercase; }
.day { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.part + .part { margin-top: 10px; }
.part h4 { font-size: 13px; margin: 0 0 4px; }
.rt { width: 100%; border-collapse: collapse; font-size: 14px; }
.rt th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 2px 4px; white-space: nowrap; }
.rt td { padding: 6px 4px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.rt th:last-child, .rt td.act { width: 1%; white-space: nowrap; text-align: right; }
.rt tr.note-row td { border-top: 0; padding-top: 0; color: var(--muted); font-size: 13px; }
.rt button.del { min-height: 40px; min-width: 44px; border: 0; background: none; color: var(--danger); font: inherit; font-size: 13px; cursor: pointer; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #111827; color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 10; max-width: calc(100% - 32px);
}

/* шаг 5: подсказки под кнопками главного, «Мои цифры» */
.big-item { display: flex; flex-direction: column; }
.big-item button { flex: 1; }
.big-item .hint { margin-top: 6px; }
.big-item.wide { grid-column: 1 / -1; }
.big-item.wide button { min-height: 64px; background: #e0e7ff; color: #1e3a8a; }
.big-num { font-size: 32px; font-weight: 700; margin: 4px 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.btn.small { width: auto; min-height: 44px; padding: 0 16px; font-size: 15px; }
.chart-box { position: relative; height: 240px; }
.anchor h3 { margin: 0 0 4px; font-size: 16px; }
.tbl-scroll { overflow-x: auto; margin-bottom: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.tests-t th, .tests-t td { white-space: normal; }
.tests-t tbody th { font-weight: 500; color: var(--ink); font-size: 13px; text-align: left; padding: 6px 4px; border-top: 1px solid var(--line); }
.rt td.nd { color: var(--muted); font-size: 13px; }
.calc-out { font-size: 20px; font-weight: 700; margin: 10px 0 0; min-height: 28px; }
.calc-out.muted, .calc-out.err { font-size: 15px; font-weight: 500; }
/* таблица процентов в «Моих цифрах»: колонка значения не должна сжиматься до 1% (правило колонки удаления .rt) */
.pct-t th:last-child { width: auto; }
.pct-t td:last-child { white-space: nowrap; text-align: right; font-weight: 600; }
