/* Стиль «светлый дружелюбный». Фирменный цвет — одна переменная --accent:
   чтобы перекрасить кабинет под бренд клиента, достаточно поменять её. */
:root {
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, #ffffff);
  --accent-press: color-mix(in srgb, var(--accent) 85%, #000000);

  --bg: #fff8f0;
  --card: #ffffff;
  --text: #2b1d14;
  --hint: #7a6656;
  --soft: #fbf1e6;          /* фон внутренних блоков, полей, кнопок */
  --line: #f1e4d6;

  --ok: #1e7d3a;   --ok-bg: #e6f4ea;
  --bad: #b3261e;  --bad-bg: #fdecea;
  --warn: #a15c00; --warn-bg: #fff3d6;

  --radius: 24px;
  --radius-sm: 14px;
  --shadow: 0 10px 30px rgba(122, 72, 30, 0.08), 0 2px 6px rgba(122, 72, 30, 0.05);
  --font: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* совместимость со старыми названиями */
  --bg2: var(--soft);
  --btn: var(--accent);
  --btn-text: var(--accent-ink);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 500 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-weight: 900; letter-spacing: -0.01em; line-height: 1.2; }
h2 { font-size: 22px; margin: 2px 0 12px; }
h3 { font-size: 17px; font-weight: 800; margin: 18px 0 10px; }
b, strong { font-weight: 800; }
.hint { color: var(--hint); }
.center { text-align: center; padding: 40px 16px; }
.small { font-size: 14px; }
svg { display: block; }

/* ---------- Каркас ---------- */
#app { max-width: 760px; margin: 0 auto; padding: 16px 16px 110px; }

.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.top .title { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 18px; min-width: 0; }
.top .title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-label { font-weight: 700; }
@media (max-width: 600px) { .top .who-label { display: none; } }

.tabs { position: fixed; z-index: 6; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; justify-content: space-around; gap: 2px; padding: 8px; background: var(--card);
  border-radius: 26px; box-shadow: 0 12px 34px rgba(122, 72, 30, 0.16); max-width: 560px; margin: 0 auto; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px;
  color: var(--hint); font-size: 11.5px; font-weight: 800; border-radius: 18px; }
.tabs a .ico { width: 24px; height: 24px; }
.tabs a.on { color: var(--accent); background: var(--accent-soft); }

/* ---------- Карточки и плитки ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; box-shadow: var(--shadow); }
a.card { color: inherit; font-weight: 500; display: block; }
a.card.row { display: flex; flex-wrap: nowrap; }
.i20 { width: 20px; height: 20px; flex: none; display: inline-flex; }
.i20 svg { width: 20px; height: 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.cols .card { margin: 0; }

.tile { width: 42px; height: 42px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  flex: none; background: var(--accent-soft); color: var(--accent); }
.tile svg { width: 22px; height: 22px; }
.tile.sm { width: 36px; height: 36px; border-radius: 12px; }
.tile.sm svg { width: 19px; height: 19px; }
.tile.ok { background: var(--ok-bg); color: var(--ok); }
.tile.bad { background: var(--bad-bg); color: var(--bad); }
.tile.warn { background: var(--warn-bg); color: var(--warn); }
.tile.plain { background: var(--soft); color: var(--hint); }
.tile.round { border-radius: 50%; }
.tile.letter { font-weight: 900; font-size: 20px; background: var(--accent); color: var(--accent-ink); }

/* ---------- Главная ---------- */
.hello { display: flex; align-items: center; gap: 14px; margin: 6px 0 18px; }
.hello .tile { width: 52px; height: 52px; font-size: 24px; }
.hello h1 { font-size: 28px; margin: 0; }
.hello .sub { color: var(--hint); font-weight: 700; }

.hero { background: var(--accent); color: var(--accent-ink); padding: 24px; }
.hero .label { font-weight: 800; opacity: .9; display: flex; align-items: center; gap: 8px; }
.hero .big { font-size: 64px; font-weight: 900; line-height: 1; margin: 12px 0 8px; letter-spacing: -0.03em; }
.hero .say { font-weight: 700; opacity: .95; }
.hero .tile { background: color-mix(in srgb, #ffffff 22%, transparent); color: #fff; }

.mini .label { color: var(--hint); font-weight: 800; font-size: 14px; margin: 12px 0 2px; }
.mini .name { font-weight: 900; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .pct { font-weight: 900; font-size: 30px; line-height: 1.1; }

.notice { display: flex; gap: 14px; align-items: flex-start; }
.card.warn { background: var(--warn-bg); color: var(--warn); box-shadow: none; }
.card.warn .tile { background: #ffffff99; color: var(--warn); }

.sale { display: flex; align-items: center; gap: 12px; padding: 12px 0; color: var(--text); font-weight: 500; }
.sale + .sale { border-top: 1px solid var(--line); }
.sale .time { font-weight: 900; font-size: 17px; width: 48px; font-variant-numeric: tabular-nums; }
.sale .meta { flex: 1; min-width: 0; }
.sale .who { font-weight: 800; }
.sale .res { font-weight: 800; font-size: 14px; }
.res.ok { color: var(--ok); } .res.bad { color: var(--bad); } .res.wait { color: var(--hint); } .res.warn { color: var(--warn); }
.playbtn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.playbtn svg { width: 18px; height: 18px; margin-left: 2px; }

/* ---------- Кнопки и поля ---------- */
.btn { border: 0; border-radius: 999px; padding: 10px 18px; background: var(--soft); color: var(--text); font-weight: 800; }
.btn:hover { filter: brightness(0.98); }
.btn-primary { background: var(--accent) !important; color: var(--accent-ink) !important; }
.btn-primary:active { background: var(--accent-press) !important; }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn.on { background: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: .45; }
.full { width: 100%; }

input[type=text], input[type=number], input[type=date], input[type=time], select, textarea {
  border: 0; border-radius: var(--radius-sm); padding: 11px 14px; background: var(--soft); min-width: 0; font-weight: 600; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); }
textarea { width: 100%; resize: vertical; }
label.f { display: block; margin: 14px 0 6px; font-size: 14px; color: var(--hint); font-weight: 700; }

/* ---------- Список записей ---------- */
.rec { display: flex; gap: 12px; align-items: center; padding: 14px 16px; background: var(--card); border-radius: 20px;
  margin-bottom: 10px; color: var(--text); font-weight: 500; box-shadow: var(--shadow); }
.rec .time { font-size: 18px; font-weight: 900; width: 52px; font-variant-numeric: tabular-nums; }
.rec .meta { flex: 1; min-width: 0; }
.rec .who { font-weight: 800; }
.score { min-width: 54px; text-align: center; font-weight: 900; border-radius: 14px; padding: 8px 6px; background: var(--soft); }
.score.good { color: var(--ok); background: var(--ok-bg); }
.score.mid { color: var(--warn); background: var(--warn-bg); }
.score.bad { color: var(--bad); background: var(--bad-bg); }
.chip { display: inline-block; font-size: 13px; font-weight: 800; padding: 3px 10px; border-radius: 99px; background: var(--soft);
  color: var(--hint); margin: 4px 6px 0 0; }
.chip.ok { color: var(--ok); background: var(--ok-bg); }
.chip.bad { color: var(--bad); background: var(--bad-bg); }
.chip.warn { color: var(--warn); background: var(--warn-bg); }
.chip.wait { color: var(--hint); }

/* ---------- Карточка записи ---------- */
.player { position: sticky; top: 64px; z-index: 4; }
.player .bar { width: 100%; accent-color: var(--accent); }
.play { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.play svg { width: 22px; height: 22px; }
.play:disabled { opacity: .5; box-shadow: none; }
.seg { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 14px; }
.seg:hover { background: var(--soft); }
.seg.on { background: var(--accent-soft); }
.seg .t { color: var(--hint); font-size: 13px; font-variant-numeric: tabular-nums; margin-right: 8px; font-weight: 700; }
.seg .sp { font-weight: 800; margin-right: 4px; }
.item { display: flex; gap: 12px; padding: 12px 0; align-items: flex-start; }
.item + .item { border-top: 1px solid var(--line); }
.mk { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 15px; flex: none; }
.mk.yes { background: var(--ok-bg); color: var(--ok); }
.mk.no { background: var(--bad-bg); color: var(--bad); }
.mk.na { background: var(--soft); color: var(--hint); }
.mark { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--soft); margin-bottom: 8px; color: var(--text); font-weight: 600; }

/* ---------- Статистика ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-top: 12px; }
.stat { background: var(--soft); border-radius: 16px; padding: 10px 12px; }
.stat b { display: block; font-size: 20px; font-weight: 900; }
.stat span { font-size: 13px; color: var(--hint); font-weight: 700; }
.good { color: var(--ok); } .mid { color: var(--warn); } .bad { color: var(--bad); }
.diff-bad { color: var(--bad); font-weight: 800; }
.diff-ok { color: var(--ok); font-weight: 800; }

.code-big { font-size: 34px; font-weight: 900; letter-spacing: 4px; text-align: center; padding: 16px;
  font-family: ui-monospace, "SF Mono", monospace; background: var(--soft); border-radius: var(--radius-sm); margin: 12px 0; }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--text); color: #fff;
  padding: 12px 20px; border-radius: 16px; z-index: 20; max-width: 90vw; text-align: center; font-weight: 700;
  box-shadow: var(--shadow); }
.toast.err { background: var(--bad); }

@media (min-width: 800px) {
  #app { padding-top: 24px; }
  .hero .big { font-size: 76px; }
}

[hidden] { display: none !important; }
