/* ============================================================
   Стоп Приказ — Flow (прогрессивное раскрытие)
   Использует токены из styles.css (--lime, --ink, --paper …)
   ============================================================ */

.flow-body {
  background: var(--paper);
  min-height: 100vh;
}

/* ---------- top bar ---------- */
.flow-top {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.flow-top__inner { width: min(820px, 100% - 40px); margin-inline: auto; height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.flow-back { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; color: var(--muted); }
.flow-back:hover { color: var(--ink); }
.flow-back svg { width: 18px; height: 18px; }
.flow-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.flow-brand__mark { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--lime); display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; }
.flow-secure { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.flow-secure svg { width: 15px; height: 15px; }
@media (max-width: 560px) { .flow-secure { display: none; } }

/* ---------- progress rail ---------- */
.prail { width: min(820px, 100% - 40px); margin: 28px auto 8px; display: flex; align-items: center; gap: 0; }
.prail__step { display: flex; align-items: center; gap: 10px; flex: none; }
.prail__dot {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: var(--white); border: 2px solid var(--line); color: var(--muted);
  transition: background .3s, border-color .3s, color .3s;
}
.prail__label { font-weight: 700; font-size: 14px; color: var(--muted); transition: color .3s; white-space: nowrap; }
.prail__line { flex: 1; height: 2px; background: var(--line); margin: 0 12px; border-radius: 2px; position: relative; overflow: hidden; min-width: 16px; }
.prail__line::after { content: ""; position: absolute; inset: 0; width: 0; background: var(--ink); transition: width .4s ease; }
.prail__step[data-on="done"] .prail__dot { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.prail__step[data-on="active"] .prail__dot { background: var(--ink); border-color: var(--ink); color: var(--lime); }
.prail__step[data-on="active"] .prail__label,
.prail__step[data-on="done"] .prail__label { color: var(--ink); }
.prail__line[data-fill="1"]::after { width: 100%; }
@media (max-width: 560px) { .prail__label { display: none; } .prail { gap: 0; } }

/* ---------- steps column ---------- */
.flow-col { width: min(820px, 100% - 40px); margin: 8px auto 80px; display: grid; gap: 16px; }

.pstep {
  background: var(--white); border: 1.5px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: border-color .3s, box-shadow .3s, opacity .3s;
}
.pstep[data-state="active"] { border-color: var(--ink); box-shadow: 0 24px 60px -28px rgba(20,22,11,0.28); }
.pstep[data-state="locked"] { opacity: 0.55; }

.pstep__head {
  display: flex; align-items: center; gap: 16px; padding: 22px 26px;
  cursor: default;
}
.pstep[data-state="done"] .pstep__head { cursor: pointer; }
.pstep__idx {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; font-size: 15px;
  background: var(--paper); color: var(--muted); border: 1.5px solid var(--line);
  transition: background .3s, color .3s, border-color .3s;
}
.pstep[data-state="active"] .pstep__idx { background: var(--ink); color: var(--lime); border-color: var(--ink); }
.pstep[data-state="done"] .pstep__idx { background: var(--lime); color: var(--ink); border-color: var(--lime); }
.pstep__idx .check { display: none; }
.pstep[data-state="done"] .pstep__idx .num { display: none; }
.pstep[data-state="done"] .pstep__idx .check { display: block; }
.pstep__titles { flex: 1; min-width: 0; }
.pstep__title { font-family: var(--font-head); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.pstep__summary { font-size: 14px; color: var(--muted); margin-top: 3px; display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pstep[data-state="done"] .pstep__summary { display: block; }
.pstep__edit {
  flex: none; background: none; border: 1.5px solid var(--line); border-radius: var(--radius-pill);
  padding: 9px 18px; font-family: var(--font-body); font-weight: 700; font-size: 13px; color: var(--ink); cursor: pointer;
  display: none; transition: background .15s, color .15s;
}
.pstep__edit:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.pstep[data-state="done"] .pstep__edit { display: inline-flex; }

.pstep__body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s ease; }
.pstep[data-state="active"] .pstep__body { grid-template-rows: 1fr; }
.pstep__bodyinner { overflow: hidden; }
.pstep__pad { padding: 0 26px 28px; }

/* ---------- step 1 : upload ---------- */
.consent {
  display: grid; grid-template-columns: 22px 1fr; gap: 13px; align-items: start;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 18px; cursor: pointer; color: #46513a; font-size: 14px; line-height: 1.5;
}
.consent input { width: 19px; height: 19px; margin: 1px 0 0; accent-color: var(--ink); cursor: pointer; }
.consent strong { color: var(--ink); }
.consent a { text-decoration: underline; text-underline-offset: 3px; font-weight: 700; }
.uploads { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.uchoice {
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--white);
  padding: 24px 18px; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer; font-family: var(--font-head); font-weight: 800; font-size: 17px; text-align: center; color: var(--ink);
  transition: transform .16s, box-shadow .16s, border-color .16s, background .16s;
}
.uchoice:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -18px rgba(20,22,11,0.3); border-color: var(--ink); }
.uchoice.primary { background: var(--lime); border-color: var(--lime); }
.uchoice .uicon { width: 50px; height: 50px; border-radius: 15px; background: var(--paper); display: grid; place-items: center; }
.uchoice.primary .uicon { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.uchoice .uicon svg { width: 26px; height: 26px; stroke: var(--ink); }
.uchoice small { font-family: var(--font-body); font-weight: 600; font-size: 12.5px; color: var(--muted); line-height: 1.4; max-width: 22ch; }
.uchoice.primary small { color: color-mix(in srgb, var(--ink) 62%, transparent); }
.uchoice[aria-disabled="true"] { opacity: 0.45; pointer-events: none; filter: grayscale(0.2); }
.utips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.utip { font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 7px 13px; display: inline-flex; gap: 7px; align-items: center; }
.utip svg { width: 13px; height: 13px; stroke: var(--ink); }
.uhint { margin-top: 14px; font-size: 13px; font-weight: 600; color: #8a6d2e; }
.uchoice.primary.is-disabled, .uchoice.is-disabled { opacity: 0.45; pointer-events: none; }

/* recognizing state */
.recog { display: none; flex-direction: column; align-items: center; gap: 18px; padding: 30px 0 8px; text-align: center; }
.recog.show { display: flex; }
.recog__spin { width: 46px; height: 46px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--ink); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.recog__t { font-family: var(--font-head); font-weight: 800; font-size: 19px; }
.recog__d { font-size: 14px; color: var(--muted); }

/* ---------- step 2 : review fields ---------- */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); }
.field input, .field select {
  font-family: var(--font-body); font-size: 15px; font-weight: 500; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 13px; padding: 13px 15px; width: 100%;
  transition: border-color .15s, background .15s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--ink); background: var(--white); }
.field__hint { font-size: 12px; color: var(--muted); }
@media (max-width: 560px) { .fields { grid-template-columns: 1fr; } }

.recv { margin-top: 22px; }
.recv__q { font-family: var(--font-head); font-weight: 800; font-size: 17px; margin-bottom: 12px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.seg button {
  font-family: var(--font-body); font-weight: 700; font-size: 14px; color: var(--ink);
  background: var(--white); border: 1.5px solid var(--line); border-radius: 13px; padding: 14px 10px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.seg button:hover { border-color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--lime); border-color: var(--ink); }
@media (max-width: 560px) { .seg { grid-template-columns: 1fr 1fr; } }
.recv__date { margin-top: 10px; display: none; }
.recv__date.show { display: grid; max-width: 240px; }

/* deadline result banner */
.dl { margin-top: 18px; border-radius: var(--radius); padding: 18px 20px; display: none; gap: 14px; align-items: flex-start; }
.dl.show { display: flex; }
.dl__ic { width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center; }
.dl__ic svg { width: 21px; height: 21px; }
.dl__t { font-family: var(--font-head); font-weight: 800; font-size: 17px; letter-spacing: -0.01em; }
.dl__d { font-size: 14px; line-height: 1.5; margin-top: 4px; }
.dl.ok { background: #eaf7ed; border: 1.5px solid #c4e6cf; }
.dl.ok .dl__ic { background: #1f8a4c; color: #fff; }
.dl.ok .dl__t { color: #1a5e36; }
.dl.ok .dl__d { color: #2f6b48; }
.dl.warn { background: #fff5e6; border: 1.5px solid #f0d49f; }
.dl.warn .dl__ic { background: #c47d16; color: #fff; }
.dl.warn .dl__t { color: #7a4f12; }
.dl.warn .dl__d { color: #8a6526; }

/* reasons (restore-deadline cause picker) */
.reasons { margin-top: 20px; display: none; }
.reasons.show { display: block; animation: reasonsIn .35s ease; }
@keyframes reasonsIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.reasons__q { font-family: var(--font-head); font-weight: 800; font-size: 17px; letter-spacing: -0.01em; margin-bottom: 14px; max-width: 44ch; }
.reasons__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reason {
  text-align: left; background: var(--white); border: 1.5px solid var(--line); border-radius: 15px;
  padding: 15px 16px; cursor: pointer; display: grid; gap: 4px;
  transition: border-color .15s, background .15s, transform .15s; font-family: var(--font-body);
}
.reason:hover { border-color: var(--ink); transform: translateY(-2px); }
.reason__t { font-weight: 700; font-size: 15px; color: var(--ink); }
.reason__d { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.reason[aria-pressed="true"] { border-color: var(--ink); border-width: 2px; background: var(--lime); }
.reason[aria-pressed="true"] .reason__d { color: color-mix(in srgb, var(--ink) 64%, transparent); }
@media (max-width: 560px) { .reasons__grid { grid-template-columns: 1fr; } }
.reasons__other { display: none; gap: 6px; margin-top: 12px; }
.reasons__other.show { display: grid; }
.reasons__other label { font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); }
.reasons__other textarea {
  font-family: var(--font-body); font-size: 15px; color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--line); border-radius: 13px; padding: 12px 15px; width: 100%; resize: vertical;
  transition: border-color .15s, background .15s;
}
.reasons__other textarea:focus { outline: none; border-color: var(--ink); background: var(--white); }
.reasons__note { margin-top: 12px; font-size: 12.5px; line-height: 1.5; color: var(--muted); display: flex; gap: 8px; }

/* ---------- step 3 : tariffs ---------- */
.ptariffs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ptar {
  position: relative; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 24px; cursor: pointer;
  background: var(--white); transition: border-color .18s, box-shadow .18s, transform .18s;
  display: flex; flex-direction: column;
}
.ptar:hover { border-color: var(--ink); transform: translateY(-2px); }
.ptar[aria-pressed="true"] { border-color: var(--ink); border-width: 2px; box-shadow: 0 20px 46px -24px rgba(20,22,11,0.34); }
.ptar[aria-pressed="true"]::after { content: ""; position: absolute; top: 16px; right: 16px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C6F92B' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 13px no-repeat; }
.ptar__rec { position: absolute; top: -11px; left: 20px; background: var(--lime); color: var(--ink); font-weight: 800; font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; padding: 5px 12px; border-radius: var(--radius-pill); display: none; }
.ptar[data-rec="1"] .ptar__rec { display: inline-block; }
.ptar__name { font-family: var(--font-head); font-weight: 800; font-size: 21px; letter-spacing: -0.02em; }
.ptar__scn { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.4; min-height: 36px; }
.ptar__price { font-family: var(--font-head); font-weight: 800; font-size: 38px; letter-spacing: -0.03em; margin: 12px 0 14px; }
.ptar__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.ptar__list li { display: flex; gap: 9px; font-size: 13.5px; line-height: 1.4; color: #4f5842; }
.ptar__list li::before { content: ""; flex: none; width: 17px; height: 17px; border-radius: 50%; margin-top: 1px; background: var(--lime) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314160B' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 11px no-repeat; }
@media (max-width: 560px) { .ptariffs { grid-template-columns: 1fr; } }

/* ---------- step 4 : payment ---------- */
.pay { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 22px; align-items: start; }
@media (max-width: 640px) { .pay { grid-template-columns: 1fr; } }
.pay__summary { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 22px; }
.pay__row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.pay__row:last-of-type { border-bottom: none; }
.pay__row span { color: var(--muted); }
.pay__row b { color: var(--ink); font-weight: 700; text-align: right; }
.pay__total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--ink); }
.pay__total span { font-weight: 700; }
.pay__total b { font-family: var(--font-head); font-weight: 800; font-size: 30px; letter-spacing: -0.03em; }
.pay__doc { position: relative; border-radius: var(--radius); overflow: hidden; border: 1.5px solid var(--line); min-height: 260px; background: var(--white); }
.pay__paper { padding: 22px; filter: blur(4px); user-select: none; pointer-events: none; }
.pay__paper h4 { font-family: var(--font-head); font-size: 15px; text-align: center; margin-bottom: 14px; }
.pay__paper .pl { height: 8px; background: var(--line); border-radius: 999px; margin: 8px 0; }
.pay__paper .pl.s { width: 50%; } .pay__paper .pl.m { width: 78%; }
.pay__lock { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--white) 30%, transparent); }
.pay__lockcard { background: var(--ink); color: #fff; border-radius: 14px; padding: 14px 20px; display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 14px; box-shadow: 0 18px 40px -16px rgba(0,0,0,0.5); }
.pay__lockcard svg { width: 18px; height: 18px; stroke: var(--lime); }
.paynote { margin-top: 16px; background: #fff5e6; border: 1.5px solid #f0d49f; border-radius: 14px; padding: 14px 16px; font-size: 13px; line-height: 1.5; color: #7a5417; }

/* generating / done */
.gen { display: none; flex-direction: column; align-items: center; text-align: center; gap: 16px; padding: 24px 0; }
.gen.show { display: flex; }
.gen__t { font-family: var(--font-head); font-weight: 800; font-size: 22px; }
.gen__d { font-size: 14px; color: var(--muted); max-width: 40ch; }
.done { display: none; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 16px 0; }
.done.show { display: flex; }
.done__badge { width: 64px; height: 64px; border-radius: 50%; background: var(--lime); display: grid; place-items: center; }
.done__badge svg { width: 32px; height: 32px; stroke: var(--ink); }
.done__t { font-family: var(--font-head); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; }
.done__d { font-size: 15px; color: var(--muted); max-width: 44ch; line-height: 1.5; }
.done__steps { display: grid; gap: 8px; margin: 8px 0 4px; text-align: left; width: min(440px, 100%); }
.done__steps div { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: 13.5px; font-weight: 600; display: flex; gap: 10px; }
.done__steps div b { color: var(--ink); }

.pact { margin-top: 22px; display: flex; gap: 12px; flex-wrap: wrap; }
.foot-legal { width: min(820px, 100% - 40px); margin: 0 auto 50px; font-size: 12.5px; color: var(--muted); line-height: 1.5; text-align: center; }

/* --- Интеграция: строка ошибки шага --- */
.flow-err { display:none; margin:14px 0 0; padding:12px 14px; border-radius:14px;
  background:#fbeae6; border:1.5px solid #b0432f; color:#8f3325; font-size:14px; font-weight:600; line-height:1.4; }
.flow-err.show { display:block; }
