/* ДоОплаты — пульт мастера. Токены в одном месте, остальное на них.
   Цвета, веса и статусы сверены с кабинетом ЮKassa; отличия — ради контраста AA и касаний пальцем. */
:root {
  --do-bg: #FFFFFF;
  --do-subtle: #F7FAFC;
  --do-code-bg: rgb(0 112 240 / 7%);
  --do-hover: rgb(10 37 64 / 4%);
  --do-track: #E4E9F1;
  --do-text: #0A2540;
  --do-text-2: #546679;
  --do-line: #E7E9EC;
  --do-field: #7A8CA4;
  --do-accent: #0070F0;
  --do-accent-hover: #0066DB;
  --do-accent-press: #0062D1;
  --do-sec: #E4E9F1;
  --do-sec-hover: #D4DBE8;
  --do-ok: #007A5C;
  --do-ok-bg: #DEF4E7;
  --do-warn: #8A4B00;
  --do-warn-bg: #FFF3E0;
  --do-err: #B32020;
  --do-err-bg: #FDECEC;
  --do-err-icon: #D21C1C;
  /* статус платежа: круг с фоном и знаком, текст статуса обычный */
  --do-st-ok-bg: #E0F2EE; --do-st-ok: #009973;
  --do-st-back-bg: #FDECEC; --do-st-back: #D21C1C;
  --do-st-new-bg: #EEF1F5; --do-st-new: #607590;

  --do-fw-btn: 500;
  --do-fw-head: 700;

  --do-r-tag: 4px;
  --do-r: 8px;
  --do-r-card: 12px;
  --do-h: 44px;
  --do-h-touch: 48px;
  --do-pad: 32px;

  --do-shadow-card: 0 0 2px rgb(0 8 50 / 4%), 0 2px 4px rgb(0 8 50 / 4%), 0 3px 12px 1px rgb(0 8 50 / 8%);
  --do-shadow-menu: 0 8px 24px rgb(0 8 50 / 12%), 0 0 0 1px rgb(10 37 64 / 8%);

  --do-font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--do-bg);
  color: var(--do-text);
  font: 400 15px/22px var(--do-font);
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--do-accent); }
a:hover { color: var(--do-accent-hover); }
:focus-visible { outline: 2px solid var(--do-accent); outline-offset: 2px; }
h1, h2, h3, p, dl, dd { margin: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { padding: 32px; color: var(--do-text-2); }
.sub { display: block; font-size: 13px; line-height: 18px; color: var(--do-text-2); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.muted { color: var(--do-text-2); font-weight: 400; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 var(--do-pad); }

/* Шапка */
.top { position: sticky; top: 0; z-index: 5; background: var(--do-bg); border-bottom: 1px solid var(--do-line); }
.bar { display: flex; align-items: center; gap: 16px; min-height: 56px; }
.brand { font-size: 16px; font-weight: 700; }
.vsep { width: 1px; height: 20px; background: var(--do-line); }
.agent-now { margin-left: auto; max-width: 280px; font-size: 13px; line-height: 18px; color: var(--do-text-2); text-align: right; }
.biz { position: relative; }
.biz-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--do-h);
  padding: 0 8px; margin-left: -8px; border: 0; border-radius: var(--do-r); background: none; font-weight: 600;
}
.biz-btn:hover { background: var(--do-hover); }
.menu {
  position: absolute; top: calc(100% + 4px); left: -8px; z-index: 10; min-width: 260px; padding: 4px;
  background: var(--do-bg); border-radius: var(--do-r-card); box-shadow: var(--do-shadow-menu);
}
.menu-item {
  width: 100%; display: flex; justify-content: space-between; align-items: center; min-height: var(--do-h);
  padding: 0 12px; border: 0; border-radius: var(--do-r); background: none; text-align: left; text-decoration: none; color: var(--do-text);
}
.menu-item:hover { background: var(--do-hover); color: var(--do-text); }
.menu-item[aria-current="true"] { font-weight: 600; }
.menu-item.link { color: var(--do-accent); font-weight: 600; }
.menu-sep { height: 1px; background: var(--do-line); margin: 4px 8px; }

.tabs { display: flex; gap: 24px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--do-h); padding: 0;
  border: 0; background: none; color: var(--do-text-2);
}
.tab[aria-current="page"] { color: var(--do-text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--do-accent); }
.tab svg { display: none; }
.count {
  min-width: 20px; height: 20px; padding: 0 4px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--do-warn-bg); color: var(--do-warn); font-size: 13px; line-height: 20px; font-weight: 600;
}

/* Страница */
.page { max-width: 760px; margin: 0 auto; padding: 32px var(--do-pad) 48px; display: flex; flex-direction: column; gap: 32px; }
.section { display: flex; flex-direction: column; gap: 12px; }
.sec-h { font-size: 18px; line-height: 24px; font-weight: var(--do-fw-head); }
.banner { border-radius: var(--do-r); padding: 12px 16px; background: var(--do-warn-bg); color: var(--do-warn); }
.banner.err { background: var(--do-err-bg); color: var(--do-err); }
.banner.ok { background: var(--do-ok-bg); color: var(--do-ok); }
.empty { color: var(--do-text-2); }

.figures { display: flex; flex-wrap: wrap; gap: 16px 48px; }
.fig-v { font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.01em; }
.fig-v .sub { display: inline; margin-left: 8px; letter-spacing: 0; font-weight: 400; }

/* Кнопки */
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--do-h);
  padding: 0 16px; border: 0; border-radius: var(--do-r); font-weight: var(--do-fw-btn); text-decoration: none;
}
.btn-pri { background: var(--do-accent); color: #FFFFFF; }
.btn-pri:hover { background: var(--do-accent-hover); color: #FFFFFF; }
.btn-pri:active { background: var(--do-accent-press); }
.btn-sec { background: var(--do-sec); color: var(--do-text); }
.btn-sec:hover { background: var(--do-sec-hover); color: var(--do-text); }
.btn-ghost { background: none; color: var(--do-accent); padding: 0 12px; }
.btn-ghost:hover { background: rgb(0 112 240 / 6%); }
.btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.spin { width: 16px; height: 16px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Карточка решения */
.card {
  border: 1px solid var(--do-line); border-radius: var(--do-r-card); padding: 20px; box-shadow: var(--do-shadow-card);
  display: flex; flex-direction: column; gap: 12px;
}
.card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-time { margin-left: auto; font-size: 13px; color: var(--do-text-2); }
.tag {
  height: 22px; padding: 0 6px; border-radius: var(--do-r-tag); background: var(--do-warn-bg); color: var(--do-warn);
  font-size: 13px; line-height: 22px; font-weight: 500; white-space: nowrap;
}
.q { font-size: 24px; line-height: 30px; font-weight: var(--do-fw-head); letter-spacing: -0.01em; }
.quote { color: var(--do-text-2); }
.calc { background: var(--do-subtle); border-radius: var(--do-r); padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.calc-row { display: flex; justify-content: space-between; gap: 16px; }
.calc-total { border-top: 1px solid var(--do-line); margin-top: 2px; padding-top: 8px; font-weight: 600; }
.calc-note { font-size: 13px; line-height: 18px; color: var(--do-text-2); }
.caption { font-size: 13px; line-height: 18px; color: var(--do-text-2); }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; line-height: 18px; color: var(--do-text-2); }
.field-row { display: flex; align-items: center; gap: 8px; }
.input, .textarea {
  height: var(--do-h); padding: 0 12px; border: 1px solid var(--do-field); border-radius: var(--do-r); background: var(--do-bg);
}
.textarea { width: 100%; height: auto; padding: 12px; resize: vertical; }
.input:focus, .textarea:focus { outline: 2px solid var(--do-accent); outline-offset: 0; border-color: var(--do-accent); }
.input[aria-invalid="true"] { border-color: var(--do-err); }
.input[aria-invalid="true"]:focus { outline-color: var(--do-err); border-color: var(--do-err); }
.input.amount { width: 160px; }
.hint { font-size: 13px; line-height: 18px; color: var(--do-text-2); }
.hint.err { color: var(--do-err); }

/* Списки */
.list-head, .row-btn {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(96px, 152px) minmax(84px, 112px) 20px; column-gap: 16px;
}
.list-head { padding: 0 16px 8px; font-size: 13px; line-height: 18px; color: var(--do-text-2); border-bottom: 1px solid var(--do-line); }
.list-head .r, .c-sum { text-align: right; }
.row { border-bottom: 1px solid var(--do-line); }
.row-btn {
  width: 100%; min-height: 64px; padding: 12px 16px; align-items: start; border: 0; background: none; text-align: left;
}
.row-btn:hover { background: rgb(10 37 64 / 4%); }
.c-client { min-width: 0; }
.c-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.chev { width: 20px; height: 20px; color: var(--do-text-2); transition: transform .15s; }
.row-btn > .chev { margin-top: 1px; } /* строка 22px, стрелка 20px: на одной линии с именем */
[aria-expanded="true"] > .chev { transform: rotate(180deg); }
.detail { background: var(--do-subtle); padding: 12px 16px 16px; display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 16px; }
.detail dt { color: var(--do-text-2); }

.issue { border-top: 1px solid var(--do-line); border-bottom: 1px solid var(--do-line); padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.issue + .issue { border-top: 0; }
.issue-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: start; }
.issue-head > :last-child { text-align: right; }
.done-text { font-weight: 600; color: var(--do-ok); }
.ready { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 4px 8px; }
.ready > * { grid-column: 1 / -1; }
.ready > .ready-main { grid-column: 1; }
.ready > .ready-alt { grid-column: 2; grid-row: 1; justify-self: start; }

.radio-list { border: 1px solid var(--do-line); border-radius: var(--do-r); overflow: hidden; }
.radio {
  width: 100%; display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border: 0; background: var(--do-bg); text-align: left;
}
.radio + .radio { border-top: 1px solid var(--do-line); }
.radio[aria-checked="true"] { background: var(--do-subtle); }
.radio[aria-disabled="true"] { cursor: not-allowed; color: var(--do-text-2); }
.radio[aria-disabled="true"] .dot { opacity: .45; }
.dot { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--do-field); background: var(--do-bg); }
.radio[aria-checked="true"] .dot { border: 6px solid var(--do-accent); }

.qr-card {
  align-self: flex-start; border-radius: var(--do-r-card); padding: 20px; box-shadow: var(--do-shadow-menu);
  display: flex; flex-wrap: wrap; gap: 20px; align-items: center;
}
.qr-card img { width: 200px; height: 200px; image-rendering: pixelated; }
.big { font-size: 32px; line-height: 38px; font-weight: 600; letter-spacing: -0.02em; }

.closed-toggle {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: var(--do-h); padding: 0;
  border: 0; background: none; font-size: 18px; line-height: 24px; font-weight: var(--do-fw-head);
}
.closed-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--do-line); }
.closed-row > :last-child { text-align: right; }

/* Журнал */
.counters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.counters > div + div { border-left: 1px solid var(--do-line); padding-left: 16px; }
.seg { display: inline-flex; padding: 2px; border-radius: var(--do-r); background: var(--do-track); }
.seg button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; }
.seg button[aria-pressed="true"] { background: var(--do-bg); box-shadow: 0 1px 2px rgb(0 8 50 / 12%); }
.j-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.jlist .list-head, .jlist .row-btn { grid-template-columns: 48px minmax(0, 1fr) minmax(96px, 150px) 20px; }
.chain { margin: 0 16px 16px 80px; display: grid; grid-template-columns: 88px minmax(0, 1fr); border-top: 1px solid var(--do-line); }
.chain > * { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--do-line); }
.chain > :nth-last-child(-n+2) { border-bottom: 0; } /* под «Итог» линию даёт сама строка журнала */
.chain .k { color: var(--do-text-2); }
/* Шаг кода на подложке. Подложка выходит на 8px за края, текст стоит на одной вертикали с другими шагами */
.chain .code { background: var(--do-code-bg); }
.chain .k.code { box-shadow: -8px 0 0 var(--do-code-bg); }
.chain .code:not(.k) { box-shadow: 8px 0 0 var(--do-code-bg); }
.jlist .empty { padding: 16px; }

/* Подключение */
.progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.progress span { height: 4px; border-radius: 2px; background: var(--do-line); }
.progress span.on { background: var(--do-accent); }
.steps { border-top: 1px solid var(--do-line); }
.step-row { display: flex; align-items: center; gap: 16px; min-height: 56px; border-bottom: 1px solid var(--do-line); }
.step-row.future { color: var(--do-text-2); }
.step-row > span { flex: 1; min-width: 0; }
.step { padding: 24px 0; border-bottom: 1px solid var(--do-line); display: flex; flex-direction: column; gap: 16px; }
.h1 { font-size: 24px; line-height: 30px; font-weight: var(--do-fw-head); letter-spacing: -0.01em; }
.rules { display: grid; grid-template-columns: 128px minmax(0, 1fr); border-top: 1px solid var(--do-line); }
.rules dt, .rules dd { padding: 12px 0; border-bottom: 1px solid var(--do-line); }
.rules dt { padding-right: 16px; color: var(--do-text-2); }
.links { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.link-card { display: flex; gap: 16px; align-items: flex-start; }
.link-card img, .link-card .qr-ph { flex: 0 0 128px; width: 128px; height: 128px; border-radius: var(--do-r); }
.link-card .qr-ph { border: 1px dashed var(--do-field); display: flex; align-items: center; justify-content: center; color: var(--do-text-2); font-size: 13px; }
.url { font-size: 13px; line-height: 18px; color: var(--do-text-2); word-break: break-all; }

@media (max-width: 720px) {
  :root { --do-pad: 20px; }
}

/* Телефон: вкладки внизу, крупные кнопки, списки в две колонки */
@media (max-width: 480px) {
  :root { --do-pad: 16px; --do-h: 48px; }
  .bar { flex-wrap: wrap; gap: 0 12px; padding: 4px 0 8px; }
  .brand, .bar .vsep { display: none; }
  .biz-btn { font-size: 17px; }
  .agent-now { margin: 0; max-width: none; text-align: left; flex-basis: 100%; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; gap: 0; display: grid; grid-template-columns: 1fr 1fr;
    height: calc(56px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--do-bg); border-top: 1px solid var(--do-line);
  }
  .tab { justify-content: center; min-height: 56px; }
  .tab svg { display: block; width: 22px; height: 22px; }
  .tab[aria-current="page"] { color: var(--do-accent); box-shadow: none; }
  .page { padding-top: 16px; padding-bottom: calc(80px + env(safe-area-inset-bottom)); gap: 24px; }
  .figures { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .fig-v { font-size: 15px; line-height: 22px; }
  .fig-v .sub { display: block; margin: 0; }
  .card { padding: 16px; }
  .card .btns { flex-direction: column; } /* все кнопки решения во всю ширину, столбиком */
  .ready { grid-template-columns: minmax(0, 1fr); }
  .ready > .ready-alt { grid-column: 1; grid-row: auto; margin-left: -12px; } /* текст ссылки по краю страницы */
  .list-head { display: none; }
  .row-btn { grid-template-columns: minmax(0, 1fr) auto 20px; grid-template-areas: "client sum chev" "next next ."; row-gap: 4px; padding: 12px 0; }
  .c-client { grid-area: client; } .c-sum { grid-area: sum; } .chev { grid-area: chev; }
  .c-next { grid-area: next; font-size: 13px; line-height: 18px; }
  .c-next .strong, .c-next .sub { display: inline; font-size: 13px; }
  .c-next .sub { margin-left: 4px; }
  .detail { grid-template-columns: 1fr; padding: 12px; }
  .detail dt { margin-top: 6px; }
  .issue, .closed-row { padding-left: 0; padding-right: 0; }
  .qr-card { align-self: stretch; flex-direction: column; text-align: center; }
  .qr-card .sub { margin-inline: auto; }
  .qr-card img { width: 240px; height: 240px; }
  .counters { gap: 12px; }
  .counters > div + div { padding-left: 12px; }
  .counters .big { font-size: 24px; line-height: 30px; letter-spacing: -0.01em; }
  .jlist .empty { padding: 16px 0; }
  .jlist .row-btn { grid-template-columns: 44px minmax(0, 1fr) 20px; grid-template-areas: "time client chev" ". sum ."; }
  .jlist .c-time { grid-area: time; } .jlist .c-client { grid-area: client; } .jlist .c-sum { grid-area: sum; text-align: left; }
  .chain { margin: 0 0 16px; }
  .input, .textarea { font-size: 16px; } /* меньше 16px — iOS и Telegram приближают страницу */
  .rules { grid-template-columns: 1fr; }
  .rules dt { padding-bottom: 0; border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Списки как в кабинете ЮKassa: жирная только сумма */
.row-btn .c-name .strong, .row-btn .c-next .strong, .closed-row .name, .issue-head .strong { font-weight: 400; }
.money { font-weight: var(--do-fw-head); white-space: nowrap; }
.biz-sub { display: block; font-size: 13px; line-height: 18px; color: var(--do-text-2); font-weight: 400; }
.menu-item { min-height: 52px; padding-top: 6px; padding-bottom: 6px; }

/* Статус платежа */
.st { display: inline-flex; align-items: center; gap: 8px; }
.st-ic { flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.st-ic svg { width: 12px; height: 12px; stroke-width: 3; }
.st-ok { background: var(--do-st-ok-bg); color: var(--do-st-ok); }
.st-back { background: var(--do-st-back-bg); color: var(--do-st-back); }
.st-new { background: var(--do-st-new-bg); color: var(--do-st-new); }
.closed-row .receipt { display: block; margin-top: 2px; }
.closed-row .st { white-space: nowrap; justify-content: flex-end; font-size: 13px; line-height: 18px; color: var(--do-text-2); }

/* Раскрытие заказа: платежи и история */
.det { background: var(--do-subtle); padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.det-h { font-size: 13px; line-height: 18px; color: var(--do-text-2); }
.pay { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; column-gap: 8px; align-items: start; padding-right: 36px; }
.pay .st-ic { margin-top: 1px; }
.hist { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; }
.hist .t { color: var(--do-text-2); }

/* Поле суммы со знаком ₽ внутри */
.money-input { position: relative; display: inline-block; align-self: flex-start; max-width: 100%; }
.money-input .input { padding-right: 32px; }
.money-input .cur { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--do-text-2); pointer-events: none; }

/* Итог действия на месте карточки */
.result { display: flex; gap: 16px; align-items: flex-start; padding: 4px 0; }
.result-ic { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; background: var(--do-st-ok-bg); color: var(--do-st-ok); display: flex; align-items: center; justify-content: center; }
.result-ic.wait { background: var(--do-st-new-bg); color: var(--do-st-new); }
.result-t { font-size: 18px; line-height: 24px; font-weight: var(--do-fw-head); }
.result-x { color: var(--do-text-2); }

/* Ошибка денежного действия */
.fail { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--do-r); padding: 12px 16px; background: var(--do-err-bg); color: var(--do-err); }
.fail svg { flex: 0 0 20px; color: var(--do-err-icon); }

/* Телефон: правки к блокам, объявленным выше по файлу после первого медиазапроса */
@media (max-width: 480px) {
  /* Раскрытый заказ: подложка до краёв экрана, текст на вертикали страницы */
  .det { margin: 0 calc(-1 * var(--do-pad)); padding-left: var(--do-pad); padding-right: var(--do-pad); }
  /* «Закрыто»: статус переносится, имя и заказ не сжимаются в столбик */
  .closed-row { grid-template-columns: minmax(0, 1fr) fit-content(50%); }
  .closed-row .st { display: block; white-space: normal; } /* значок в строке: стоит вплотную к первой строке статуса */
  .closed-row .st-ic { vertical-align: top; margin: -1px 8px 0 0; }
}
