/* Желток — Mini App. Токены в одном месте; тёмная тема — отдельные контрастные значения. */
:root {
  --bg: #F7F5EF;
  --surface: #FFFFFF;
  --text: #24251F;
  --muted: #64665D;
  --yellow: #F4C542;
  --yellow-soft: #FFF3C4;
  --line: #E3E1D8;
  --ok: #26734D;
  --err: #B33832;
  --on-yellow: #24251F;
  --focus: #24251F;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --gutter: 20px;
  --r-field: 12px; --r-card: 16px;
  --font: "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --t: 180ms;
}
:root[data-theme="dark"] {
  --bg: #171814;
  --surface: #212220;
  --text: #F2F0E8;
  --muted: #A9AA9F;
  --yellow: #F4C542;
  --yellow-soft: #3A3219;
  --line: #34352F;
  --ok: #6BC794;
  --err: #F08A83;
  --on-yellow: #24251F;
  --focus: #F4C542;
}
@media (prefers-reduced-motion: reduce) { :root { --t: 0ms; } }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
img { display: block; }

.shell { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column;
  padding: 0 var(--gutter); padding-bottom: calc(var(--s6) + env(safe-area-inset-bottom)); }
body.has-cta .shell { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }

/* ---------- верхняя панель */
.topbar { display: flex; align-items: center; gap: var(--s2); min-height: 56px; padding-top: env(safe-area-inset-top); }
.wordmark { height: 20px; width: auto; }
.back { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -12px;
  border: 0; background: transparent; border-radius: var(--r-field); cursor: pointer; color: var(--text); }
.back[hidden] { display: none; }

/* ---------- экран */
.screen { flex: 1; padding-top: var(--s3); animation: enter var(--t) ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
h1 { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 var(--s3); }
h2 { font-size: 20px; line-height: 1.3; font-weight: 600; margin: 0 0 var(--s3); }
h3 { font-size: 16px; line-height: 1.4; font-weight: 600; margin: 0 0 var(--s3); }
p { margin: 0 0 var(--s4); }
.lead { color: var(--muted); font-size: 17px; margin-bottom: var(--s6); }
.muted { color: var(--muted); }
.small { font-size: 14px; line-height: 1.45; }
.eyebrow { font-size: 13px; line-height: 1.4; color: var(--muted); margin: 0 0 var(--s2); font-weight: 500; }
.stack > * + * { margin-top: var(--s3); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.section-head .section-title { margin-bottom: var(--s3); }
.section-head .btn-link { margin: 0; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: var(--s6) 0 var(--s3); scroll-margin-top: var(--s4); }
.chips { display: flex; gap: var(--s2); overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) var(--s1);
  scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; padding: 0 var(--s3); border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: border-color var(--t); }
.chip:hover { border-color: var(--muted); }
.chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- карточки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s4); }
.card + .card { margin-top: var(--s3); }
.card-soft { background: var(--yellow-soft); border-color: transparent; }
.card-err { border-color: var(--err); }
.card-err h2 { color: var(--err); }

.choice-card { display: flex; align-items: center; gap: var(--s3); width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s4);
  min-height: 72px; transition: border-color var(--t), background var(--t); }
.choice-card + .choice-card { margin-top: var(--s3); }
.choice-card:hover { border-color: var(--muted); }
.choice-card .title { font-weight: 600; font-size: 17px; line-height: 1.35; display: block; }
.choice-card .desc { color: var(--muted); font-size: 14px; line-height: 1.45; display: block; margin-top: var(--s1); }
.choice-card .meta { color: var(--muted); font-size: 13px; display: block; margin-top: var(--s2); }
.choice-card .body { flex: 1; min-width: 0; }
.chev { flex: none; color: var(--muted); }

/* ---------- прогресс по разделам */
.progress { display: flex; gap: var(--s1); margin: 0 0 var(--s4); }
.progress span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); transition: background var(--t); }
.progress span.done { background: var(--text); }
.progress span.now { background: var(--yellow); }

/* ---------- поля */
.field-label { display: block; font-size: 20px; line-height: 1.3; font-weight: 600; margin: 0 0 var(--s3); }
.hint { font-size: 14px; color: var(--muted); margin: var(--s2) 0 0; }
.why { font-size: 14px; color: var(--muted); margin: 0 0 var(--s3); }
.input { width: 100%; min-height: 52px; padding: 13px var(--s4); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-field); outline: none; transition: border-color var(--t), box-shadow var(--t); font-size: 17px; }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px var(--yellow-soft); }
.input[aria-invalid="true"] { border-color: var(--err); }
.error { color: var(--err); font-size: 14px; margin: var(--s2) 0 0; min-height: 0; }
.error:empty { display: none; }

.option { display: flex; align-items: center; gap: var(--s3); width: 100%; text-align: left; cursor: pointer;
  min-height: 56px; padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-field); transition: border-color var(--t), background var(--t); font-size: 16px; line-height: 1.4; }
.option + .option { margin-top: var(--s2); }
.option .mark { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); position: relative; }
.option.multi .mark { border-radius: 6px; }
.option[aria-checked="true"], .option[aria-pressed="true"] { border-color: var(--text); background: var(--yellow-soft); }
.option[aria-checked="true"] .mark, .option[aria-pressed="true"] .mark { border-color: var(--text); background: var(--yellow); }
.option[aria-checked="true"] .mark::after, .option[aria-pressed="true"] .mark::after {
  content: ""; position: absolute; inset: 4px; border-radius: inherit; background: var(--on-yellow); }
.option.multi[aria-pressed="true"] .mark::after { inset: auto; left: 5px; top: 1px; width: 5px; height: 10px; border-radius: 0;
  background: transparent; border: solid var(--on-yellow); border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* ---------- кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 52px; padding: 0 var(--s5);
  border-radius: var(--r-field); border: 1px solid transparent; font-weight: 600; font-size: 17px; cursor: pointer;
  transition: opacity var(--t), background var(--t); width: 100%; }
.btn-primary { background: var(--yellow); color: var(--on-yellow); }
.btn-primary:disabled { opacity: .45; cursor: default; }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-link { background: transparent; border: 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px;
  min-height: 44px; padding: 0; width: auto; font-weight: 500; font-size: 15px; }
.row-actions { display: flex; gap: var(--s3); margin-top: var(--s4); flex-wrap: wrap; }
.row-actions .btn { flex: 1 1 140px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.cta-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--bg);
  border-top: 1px solid var(--line); padding: var(--s3) var(--gutter) calc(var(--s3) + env(safe-area-inset-bottom)); }
.cta-bar .btn { max-width: 520px; margin: 0 auto; display: flex; }
.cta-bar[hidden] { display: none; }

/* ---------- сводка */
.summary-card { padding: 0; }
.summary-card h3 { padding: var(--s4) var(--s4) 0; margin-bottom: var(--s1); }
.srow { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) var(--s4); border-top: 1px solid var(--line); }
.summary-card h3 + .srow { border-top: 0; }
.srow .k { font-size: 13px; color: var(--muted); display: block; }
.srow .v { display: block; overflow-wrap: anywhere; }
.srow .v.missing { color: var(--muted); font-style: italic; }
.srow .body { flex: 1; min-width: 0; }
.srow .edit { flex: none; min-height: 44px; font-size: 14px; }

.check { display: flex; gap: var(--s3); align-items: flex-start; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--text); flex: none; }
details { margin-top: var(--s3); }
summary { cursor: pointer; font-size: 14px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; min-height: 32px; }

.list { margin: 0; padding-left: 20px; }
.list li + li { margin-top: var(--s1); }

/* ---------- подвал с брендом */
.brandline { display: flex; align-items: center; justify-content: center; gap: var(--s2); color: var(--muted);
  font-size: 13px; padding: var(--s6) 0 var(--s4); }
.brandline-mark { height: 11px; width: auto; opacity: .9; }

.center { text-align: center; }
.state { padding-top: var(--s7); text-align: center; }
.state .big-mark { width: 180px; height: auto; margin: 0 auto var(--s5); }

/* ---------- мои дела */
.case-card { min-height: 64px; }
.case-card .meta { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s1); }
.case-card .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.case-card.stage-prepared .dot, .case-card.stage-next .dot { background: var(--yellow); }
.case-card.stage-sent .dot { background: var(--muted); }
.case-card.stage-resolved .dot { background: var(--ok); }
.timeline { list-style: none; margin: var(--s5) 0; padding: 0; }
.timeline li { display: flex; gap: var(--s3); position: relative; padding-bottom: var(--s4); }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--line); }
.tl-mark { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: flex;
  align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--surface); }
.tl-mark.done { background: var(--yellow); border-color: var(--yellow); color: var(--on-yellow); }
.tl-body { display: flex; flex-direction: column; padding-top: 1px; }
.tl-title { font-weight: 600; }
.tl-meta { color: var(--muted); font-size: 14px; }
.stack > .btn { width: 100%; }

[role="list"] + .chips { margin-top: var(--s5); }
.feedback-cta { margin-top: var(--s6); }
.feedback-cta .btn { width: 100%; }
