/* «Опора для мамы» — Mini App. Палитра и ритм взяты из design reference. */

:root {
  --bg: #F6F1E8;
  --card: #FFFFFF;
  --line: #E8E1D5;
  --line-strong: #D9D1C3;
  --text: #2E2B27;
  --muted: #7C766C;
  --green: #6F8F6B;
  --green-dark: #5E7D5B;
  --green-soft: #EEF2E6;
  --green-line: #A9BBA3;
  --yellow: #F4D36B;
  --yellow-soft: #FBF1D3;
  --pink-soft: #F8E1E1;
  --peach-soft: #F8E7D6;
  --blue-soft: #E4ECF1;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(60, 50, 30, .04), 0 6px 18px rgba(60, 50, 30, .05);
  --font-serif: "Lora", Georgia, "Times New Roman", serif;
  --font-sans: "Manrope", -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font-family: inherit; font-size: inherit; color: inherit; }
input, textarea { font-family: inherit; font-size: 15px; color: inherit; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- экран ---------- */
.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 12px 16px 0;
  animation: fade .22s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.screen-body { flex: 1; padding-bottom: 120px; }
.screen-body.centered { display: flex; flex-direction: column; justify-content: center; }

h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 23px;
  line-height: 1.25;
  margin: 10px 0 6px;
  letter-spacing: -.01em;
}
h1.big { font-size: 27px; }
h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 18px;
  margin: 18px 0 8px;
}
.hint { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.lead { color: var(--muted); font-size: 14.5px; margin: 0 0 18px; }
p { margin: 0 0 10px; }

/* ---------- шапка вопроса ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 32px;
}
.icon-btn {
  width: 32px; height: 32px;
  border: 0; background: transparent; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; cursor: pointer; color: var(--text);
}
.icon-btn:active { background: rgba(0,0,0,.05); }
.icon-btn svg { width: 22px; height: 22px; }
.progress { flex: 1; height: 5px; background: var(--line); border-radius: 5px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--green); border-radius: 5px; transition: width .3s ease; }
.progress-label { color: var(--muted); font-size: 12px; min-width: 44px; text-align: right; }

/* ---------- варианты ответа ---------- */
.options { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.opt:active { transform: scale(.995); }
.opt.selected { background: var(--green-soft); border-color: var(--green-line); }
.opt .label { flex: 1; font-size: 14.5px; font-weight: 500; }
.opt .ico {
  flex: 0 0 34px; width: 34px; height: 34px;
  border-radius: 9px; background: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text);
}
.opt.selected .ico { background: #E2E9DA; }
.opt .ico svg { width: 19px; height: 19px; }

.radio, .check {
  flex: 0 0 20px; width: 20px; height: 20px;
  border: 1.5px solid var(--line-strong);
  background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.radio { border-radius: 50%; }
.check { border-radius: 6px; }
.opt.selected .radio { border-color: var(--green); }
.opt.selected .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.opt.selected .check { border-color: var(--green); background: var(--green); color: #fff; }
.opt .check svg { width: 12px; height: 12px; display: none; }
.opt.selected .check svg { display: block; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 10px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; text-align: center;
}
.tile.selected { background: var(--green-soft); border-color: var(--green-line); }
.tile .face { width: 46px; height: 46px; }
.tile .label { font-size: 13.5px; font-weight: 500; }

.other-field { margin-top: 10px; }
.input {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
}
.input:focus { border-color: var(--green-line); }
.input::placeholder { color: #B2ACA1; }

/* дети */
.child-row {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}
.child-row .child-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.child-row .child-head b { font-weight: 600; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1.5px solid var(--line);
  background: var(--bg);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.chip.selected { background: var(--green-soft); border-color: var(--green-line); color: var(--green-dark); }
.add-row {
  width: 100%;
  background: transparent;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.add-row svg { width: 16px; height: 16px; }

/* ---------- кнопки ---------- */
.actions {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 10px 16px calc(14px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 75%, rgba(246,241,232,0));
  pointer-events: none;
}
.actions > * { pointer-events: auto; }
.actions .inner { max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
  transition: background .15s, opacity .15s, transform .05s;
}
.btn:active { transform: scale(.99); }
.btn.primary { background: var(--green); color: #fff; box-shadow: 0 6px 14px rgba(111,143,107,.25); }
.btn.primary:active { background: var(--green-dark); }
.btn.primary:disabled { opacity: .45; box-shadow: none; cursor: default; }
.btn.secondary { background: var(--card); border: 1.5px solid var(--line); color: var(--text); }
.btn.ghost { background: transparent; color: var(--muted); font-weight: 500; padding: 8px; }
.btn svg { width: 16px; height: 16px; }

/* ---------- карточки ---------- */
.card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.card.soft-green { background: var(--green-soft); border-color: #DCE5D3; }
.card.soft-yellow { background: var(--yellow-soft); border-color: #F0E3B8; }
.card.soft-pink { background: var(--pink-soft); border-color: #F0D0D0; }
.card.soft-peach { background: var(--peach-soft); border-color: #F0DCC6; }
.card.soft-blue { background: var(--blue-soft); border-color: #D3DFE7; }
.card .card-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.card .card-title .dot { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.7); }
.card .card-title .dot svg { width: 13px; height: 13px; }
.card ul { margin: 0; padding-left: 18px; color: #4B463F; font-size: 14px; }
.card li { margin: 3px 0; }
.card p.small { font-size: 14px; color: #4B463F; margin: 0; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
}
.row .ico { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 9px; background: var(--bg); display: inline-flex; align-items: center; justify-content: center; }
.row .ico svg { width: 18px; height: 18px; }
.row .num { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.row .body { flex: 1; min-width: 0; }
.row .body b { display: block; font-weight: 600; font-size: 14px; }
.row .body span { display: block; color: var(--muted); font-size: 13px; }
.row .body .t { font-size: 14px; }
.row.disabled { opacity: .55; }
.row .tag { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 3px 8px; }
.row .tag.ok { color: var(--green-dark); background: var(--green-soft); }

.head-row { display: flex; align-items: center; justify-content: space-between; }
.pill-btn {
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
}
.pill-btn svg { width: 13px; height: 13px; }

.reco-kicker { display: inline-flex; align-items: center; gap: 6px; background: var(--green-soft); color: var(--green-dark); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; margin-bottom: 10px; }
.reco-kicker svg { width: 13px; height: 13px; }

/* ---------- иллюстрации ---------- */
.illo { display: flex; justify-content: center; margin: 12px 0 14px; }
.illo svg { width: 190px; height: 170px; }
.illo.small svg { width: 150px; height: 130px; }

/* ---------- главный экран ---------- */
.hero {
  background: var(--peach-soft);
  border-radius: var(--radius);
  padding: 16px;
  margin: 8px 0 14px;
  position: relative;
  overflow: hidden;
}
.hero .q { font-family: var(--font-serif); font-size: 17px; font-weight: 600; line-height: 1.35; max-width: 80%; }
.hero .heart { position: absolute; right: 14px; bottom: 12px; width: 26px; height: 26px; color: #E8A0A0; }
.tabs { display: flex; gap: 6px; margin: 4px 0 6px; }
.tab { border: 0; background: transparent; color: var(--muted); border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600; }
.tab.active { background: var(--green); color: #fff; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qtile {
  border: 0; text-align: left;
  border-radius: var(--radius);
  padding: 14px 12px;
  min-height: 86px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  cursor: pointer;
  position: relative;
}
.qtile .ico { width: 28px; height: 28px; color: var(--text); }
.qtile .ico svg { width: 24px; height: 24px; }
.qtile b { font-weight: 600; font-size: 13.5px; }
.qtile .soon { position: absolute; top: 10px; right: 10px; font-size: 10.5px; font-weight: 700; color: var(--muted); background: rgba(255,255,255,.75); border-radius: 999px; padding: 2px 7px; }
.qtile .done { position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.qtile .done svg { width: 10px; height: 10px; }
.qtile.g { background: var(--green-soft); }
.qtile.p { background: var(--peach-soft); }
.qtile.y { background: var(--yellow-soft); }
.qtile.b { background: var(--blue-soft); }
.qtile.k { background: var(--pink-soft); }

.navbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + var(--safe-bottom));
}
.navbar .inner { max-width: 480px; margin: 0 auto; display: flex; justify-content: space-around; }
.nav-item { border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600; padding: 4px 8px; cursor: pointer; }
.nav-item svg { width: 21px; height: 21px; }
.nav-item.active { color: var(--green-dark); }
.with-nav .screen-body { padding-bottom: 90px; }

/* ---------- загрузка ---------- */
.loader { height: 6px; width: 60%; margin: 20px auto 0; background: var(--line); border-radius: 6px; overflow: hidden; }
.loader > i { display: block; height: 100%; width: 35%; background: var(--green); border-radius: 6px; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.center { text-align: center; }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- тост ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom));
  transform: translateX(-50%) translateY(10px);
  background: #3A3732; color: #fff;
  padding: 10px 14px; border-radius: 12px;
  font-size: 13.5px; max-width: 86%;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
