/* =========================================================================
   Аудит Яндекс Директа (K04): блоки страницы
   Общие токены и компоненты — в site.css. Здесь только то, чего там нет.
   ========================================================================= */

/* ---------- первый экран: рентген кабинета */
.xr-stage { min-height: 0; display: grid; align-content: center; }
.xr { position: relative; display: grid; gap: 14px; padding: clamp(14px, 2vw, 22px); border-radius: var(--radius-lg); background: var(--night-2); border: 1px solid var(--night-line); color: #eef2fb; box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.6); }
.xr-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--fog); font-size: 0.88rem; }
.xr-title { display: inline-flex; align-items: center; gap: 10px; color: #eef2fb; font-weight: 600; }
.xr-title i { width: 10px; height: 10px; border-radius: 50%; background: var(--leak); box-shadow: 0 0 0 4px rgba(255, 107, 91, 0.2); animation: xr-blink 1.6s ease-in-out infinite; }
@keyframes xr-blink { 50% { opacity: 0.3; } }
.xr-count b { color: var(--signal); font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.xr-tree { width: 100%; height: auto; border-radius: 14px; background: var(--night); }
.xr-links path { fill: none; stroke: #2c3f6b; stroke-width: 1.5; }
.xr-links .xr-click { stroke-dasharray: 3 4; }
.xr-links .xr-arrow { stroke: var(--fog-dim); stroke-width: 2; }
.xr-cap { font-family: var(--font-text); font-size: 10px; fill: var(--fog-dim); letter-spacing: 0.04em; }
.xr-node rect { fill: var(--night-2); stroke: #2c3f6b; stroke-width: 1.5; transition: fill 0.4s, stroke 0.4s, stroke-width 0.3s; }
.xr-node text { font-family: var(--font-text); font-size: 12px; font-weight: 600; fill: #cdd6ea; text-anchor: middle; }
.xr-node.is-ok rect { stroke: rgba(47, 191, 138, 0.7); }
.xr-node.is-bad rect { fill: rgba(255, 107, 91, 0.16); stroke: var(--leak); }
.xr-node.is-bad text { fill: #fff; }
.xr-node.is-focus rect { stroke-width: 3; }
.xr-badge { opacity: 0; transition: opacity 0.3s; }
.xr-node.is-bad .xr-badge { opacity: 1; }
.xr-badge circle { fill: var(--leak); }
.xr-badge text { font-size: 11px; font-weight: 800; fill: #fff; }
.xr-node.is-bad .xr-badge circle { animation: xr-ping 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes xr-ping { 0% { stroke: rgba(255, 107, 91, 0.7); stroke-width: 0; } 70% { stroke: rgba(255, 107, 91, 0); stroke-width: 12; } 100% { stroke-width: 0; } }
.xr-beam { opacity: 0; visibility: hidden; }
.xr-beam line { stroke: var(--flow-light); stroke-width: 1.5; }
.xr-findings { list-style: none; display: grid; gap: 8px; }
.xr-findings li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--night); border: 1px solid var(--night-line); font-size: 0.9rem; line-height: 1.3; }
.xr-findings b { font-weight: 600; }
.xr-loss { color: var(--fog); font-size: 0.8rem; white-space: nowrap; }
.xr-prio { display: inline-flex; justify-self: start; padding: 2px 9px; border-radius: 999px; font-style: normal; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.xr-prio.is-high { background: rgba(255, 107, 91, 0.16); color: #ff9a8f; }
.xr-prio.is-mid { background: rgba(255, 176, 32, 0.16); color: #ffc456; }
.xr-prio.is-low { background: rgba(170, 181, 207, 0.16); color: var(--fog); }
.zone-paper .xr-prio.is-high { background: rgba(255, 107, 91, 0.14); color: #b8311f; }
.zone-paper .xr-prio.is-mid { background: rgba(255, 176, 32, 0.2); color: #8a5200; }
.zone-paper .xr-prio.is-low { background: var(--surface-2); color: var(--ink-soft); }
.xr-note { margin: 0; color: var(--fog-dim); font-size: 0.8rem; }

/* ---------- самопроверка */
.au-quiz { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: clamp(24px, 4vw, 64px); align-items: start; }
.au-q { list-style: none; counter-reset: q; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.au-q li { counter-increment: q; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 14px; padding: 14px 16px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); }
.au-q li::before { content: counter(q); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 0.85rem; font-weight: 700; }
.au-q .chips { gap: 6px 8px; }
.au-q .chips legend { margin-bottom: 10px; color: var(--fg); font-size: 1rem; font-weight: 600; line-height: 1.35; }
.au-q .chips label { padding: 7px 14px; font-size: 0.9rem; }
.au-q .chips label:has(input[value="yes"]:checked) { border-color: var(--ok); background: rgba(47, 191, 138, 0.14); }
.au-q .chips label:has(input[value="no"]:checked) { border-color: var(--leak); background: rgba(255, 107, 91, 0.14); }
.au-meter { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 14px; justify-items: start; padding: clamp(20px, 3vw, 32px); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.au-meter svg { width: 100%; max-width: 320px; height: auto; overflow: visible; }
.au-meter .seg { fill: none; stroke-width: 16; }
.au-meter .seg.ok { stroke: var(--ok); }
.au-meter .seg.mid { stroke: var(--signal); }
.au-meter .seg.bad { stroke: var(--leak); }
.au-needle path { stroke: #eef2fb; stroke-width: 4; stroke-linecap: round; }
.au-needle circle { fill: #eef2fb; }
.au-meter text { font-family: var(--font-text); font-size: 11px; fill: var(--fog-dim); }
.au-meter-out { display: flex; align-items: baseline; gap: 14px; }
.au-meter-out .num { font-size: clamp(2.6rem, 2rem + 2vw, 3.6rem); color: var(--fg); transition: color 0.3s; }
.au-meter-out > span:last-child { color: var(--fg-soft); }
.au-meter-out small { display: block; color: var(--fg-dim); font-size: 0.85rem; }
.au-meter[data-level="ok"] .au-meter-out .num { color: var(--ok); }
.au-meter[data-level="mid"] .au-meter-out .num { color: var(--signal); }
.au-meter[data-level="bad"] .au-meter-out .num { color: var(--leak); }
.au-meter-text { margin: 0; min-height: 3em; color: var(--fg); font-size: var(--step-1); line-height: 1.45; }

/* ---------- 24 проверки */
.au-checks-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 32px; align-items: end; margin-bottom: 28px; }
.au-progress { display: grid; gap: 6px; justify-items: end; }
.au-progress .num { font-size: var(--step-3); }
.au-progress .num b { color: var(--flow-ink); font-weight: 600; }
.au-progress small { color: var(--fg-dim); }
.au-progress i { display: block; width: 220px; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.au-progress i b { display: block; height: 100%; background: linear-gradient(90deg, var(--flow), var(--ok)); transform-origin: left center; }
.au-zones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.au-zone { padding: 20px 22px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); transition: border-color 0.3s; }
.au-zone h3 { margin-bottom: 10px; font-size: var(--step-1); font-weight: 650; }
.au-zone ul { list-style: none; display: grid; gap: 2px; }
.au-zone li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; margin: 0 -8px; padding: 7px 8px; border-radius: 10px; font-size: 0.97rem; line-height: 1.4; transition: background-color 0.3s, opacity 0.3s, color 0.3s; }
.au-zone li svg { width: 20px; height: 20px; margin-top: 1px; fill: none; stroke: var(--ok); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.au-zone li.is-wait { color: var(--fg-dim); }
.au-checks.is-filtering .au-zone li { opacity: 0.38; }
.au-checks.is-filtering .au-zone li.is-hot { opacity: 1; background: rgba(255, 176, 32, 0.16); }
.au-checks.is-filtering .au-zone.has-hot { border-color: var(--signal); }

/* ---------- путь заявки и yclid */
.au-yc { position: relative; display: grid; gap: 28px; }
.au-yc > .toggle { justify-self: start; }
.au-yc-line { list-style: none; position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.au-yc-line::before { content: ""; position: absolute; left: 34px; right: calc((100% - 56px) / 5 - 34px); top: 33px; height: 2px; background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 12px); }
.au-yc-st { position: relative; z-index: 1; display: grid; gap: 8px; align-content: start; justify-items: start; transition: opacity 0.3s; }
.au-yc-ico { width: 68px; height: 68px; border-radius: 20px; display: grid; place-items: center; background: var(--surface); border: 1.5px solid var(--line); transition: border-color 0.3s, box-shadow 0.3s; }
.au-yc-ico svg { width: 30px; height: 30px; fill: none; stroke: var(--fg); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.au-yc-st b { font-weight: 600; line-height: 1.3; }
.au-yc-st code { max-width: 100%; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); color: var(--fog); font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.78rem; overflow-wrap: anywhere; }
.au-yc-st em { display: inline-flex; align-items: baseline; gap: 8px; font-style: normal; font-weight: 600; font-size: 0.9rem; line-height: 1.35; }
.au-yc-st em::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--fg-dim); }
.au-yc-st.is-ok em { color: #86e3bf; }
.au-yc-st.is-ok em::before { background: var(--ok); }
.au-yc-st.is-ok .au-yc-ico { border-color: rgba(47, 191, 138, 0.7); }
.au-yc-st.is-bad em { color: #ff9a8f; }
.au-yc-st.is-bad em::before { background: var(--leak); }
.au-yc-st.is-bad .au-yc-ico { border-color: var(--leak); box-shadow: 0 0 0 6px rgba(255, 107, 91, 0.14); }
.au-yc-st.is-wait { opacity: 0.5; }
.au-yc-st.is-wait em { color: var(--fg-dim); }
.au-yc-st.is-wait em::before { background: var(--fg-dim); }
.au-yc-token { position: absolute; left: 0; top: 0; z-index: 3; padding: 5px 10px; border-radius: 999px; background: var(--signal); color: var(--ink); font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.78rem; font-weight: 700; box-shadow: 0 0 0 6px rgba(255, 176, 32, 0.2), 0 10px 24px -8px rgba(255, 176, 32, 0.6); visibility: hidden; opacity: 0; pointer-events: none; transition: background-color 0.3s, color 0.3s, box-shadow 0.3s; }
.au-yc-token.is-lost { background: var(--night); color: var(--leak); box-shadow: 0 0 0 2px var(--leak); text-decoration: line-through; }
.au-yc-cap { margin: 0; max-width: 62ch; color: var(--fg-soft); font-size: var(--step-1); }

/* ---------- куда уходят деньги */
.au-sankey { padding: clamp(16px, 2.4vw, 28px); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.au-sankey svg { display: block; width: 100%; max-width: 980px; height: auto; margin-inline: auto; overflow: visible; }
.sk-src { fill: rgba(122, 137, 170, 0.28); }
.sk-good { fill: rgba(76, 125, 255, 0.34); }
.sk-loss { fill: rgba(255, 107, 91, 0.34); }
.sk-stream path { fill: none; stroke: rgba(255, 255, 255, 0.85); stroke-width: 1.6; stroke-dasharray: 2 12; stroke-linecap: round; }
.n-src { fill: var(--ink); }
.n-mid { fill: var(--flow-ink); }
.n-good { fill: var(--flow); }
.n-loss { fill: var(--leak); }
.sk-txt text { font-family: var(--font-text); font-size: 13px; fill: var(--ink-soft); }
.sk-txt .k { font-weight: 650; fill: var(--ink); }
.sk-txt text.loss, .sk-txt text.loss .k { fill: #b8311f; }
.au-sk-legend { list-style: none; display: grid; gap: 8px; margin-top: 16px; color: var(--fg-soft); font-size: 0.95rem; }
.au-sk-legend li { display: flex; align-items: baseline; gap: 10px; }
.au-sk-legend i { flex: none; width: 12px; height: 12px; border-radius: 3px; }
.au-sk-legend i.src { background: var(--ink); }
.au-sk-legend i.good { background: var(--flow); }
.au-sk-legend i.loss { background: var(--leak); }
.au-sk-sum { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 28px; align-items: center; margin-top: 28px; }
.au-sk-sum p { margin: 0; }
.au-sk-sum .num { font-size: clamp(2.4rem, 1.8rem + 2.4vw, 3.8rem); color: #b8311f; white-space: nowrap; }
.au-sk-sum p:last-child { max-width: 54ch; color: var(--fg-soft); font-size: var(--step-1); }
@media (min-width: 641px) {
  .au-sk-legend { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- пример отчёта */
.au-report { display: grid; grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr); gap: clamp(20px, 3vw, 40px); align-items: start; }
.au-doc { display: grid; gap: 14px; padding: 24px 22px; border-radius: 8px; background: #fff; color: var(--ink); box-shadow: 0 30px 60px -36px rgba(18, 26, 43, 0.45), 0 0 0 1px var(--paper-line); }
.au-doc-top { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--paper-line); color: var(--ink-soft); font-size: 0.82rem; }
.au-doc-kpi { display: grid; gap: 6px; padding: 16px; border-radius: 12px; background: #fff1ef; }
.au-doc-kpi .num { font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.4rem); color: #b8311f; white-space: nowrap; }
.au-doc small { color: var(--ink-soft); font-size: 0.88rem; line-height: 1.35; }
.au-doc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.au-doc-row > div { display: grid; gap: 4px; padding: 14px; border-radius: 12px; background: var(--paper); }
.au-doc-row .num { font-size: 1.8rem; }
.au-doc-h { font-weight: 650; }
.au-doc-list { display: grid; gap: 6px; margin: 0; padding-left: 20px; color: var(--ink-soft); }
.au-doc-note { margin: 0; color: #5d6783; font-size: 0.8rem; }
.au-ft .filters { margin-bottom: 16px; }
.au-ft-table { border-top: 1px solid var(--line); }
.au-ft-row { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 0.7fr) minmax(0, 0.85fr) 96px minmax(0, 0.9fr); gap: 14px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); background: var(--bg); color: var(--fg-soft); font-size: 0.93rem; line-height: 1.4; }
.au-ft-head { padding-block: 10px; color: var(--fg-dim); font-size: var(--step--1); font-weight: 600; }
.au-ft-row .what { color: var(--fg); font-weight: 600; }
.au-ft-row .loss { color: var(--fg); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; transition: color 0.3s; }
.au-ft[data-sorted="loss"] .loss { color: #b8311f; }
.au-note { margin: 12px 0 0; color: var(--fg-dim); font-size: var(--step--1); }

/* ---------- как проходит: замок */
.au-lock { display: flex; align-items: center; gap: 16px; margin-top: 30px; color: var(--fg-soft); }
.au-lock svg { width: 72px; height: 72px; flex: none; overflow: visible; }
.au-lock .body { fill: var(--surface); stroke: var(--signal); stroke-width: 3; }
.au-lock .shackle { fill: none; stroke: var(--signal); stroke-width: 5; stroke-linecap: round; }
.au-lock .hole { fill: var(--signal); stroke: var(--signal); stroke-width: 4; stroke-linecap: round; }

/* ---------- платный против бесплатного */
.au-vs { overflow: hidden; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.au-vs-row { display: grid; grid-template-columns: 128px minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; padding: 16px 20px; border-top: 1px solid var(--line); color: var(--fg-soft); font-size: 0.95rem; line-height: 1.45; }
.au-vs-head { border-top: 0; background: var(--surface-2); color: var(--fg); font-weight: 650; }
.au-vs-head > span:last-child { color: var(--flow-ink); }
.au-vs-row [role="rowheader"] { color: var(--fg); font-weight: 600; }
.au-vs-row > span:last-child { color: var(--fg); font-weight: 550; }
.au-receipt .au-credit .sum { color: #1d7d59; }
.au-receipt .receipt-total { align-items: baseline; }
.au-receipt .receipt-total .num { font-size: 1.7rem; color: var(--flow-ink); white-space: nowrap; }

@media (max-width: 1240px) {
  .au-q { grid-template-columns: 1fr; }
}
@media (max-width: 1080px) {
  .au-quiz, .au-report { grid-template-columns: 1fr; }
  .au-meter { position: static; }
  .au-zones { grid-template-columns: 1fr 1fr; }
  .au-yc-line { grid-template-columns: 1fr; gap: 18px; }
  .au-yc-line::before { left: 33px; right: auto; top: 34px; bottom: 34px; width: 2px; height: auto; background: repeating-linear-gradient(180deg, var(--line) 0 6px, transparent 6px 12px); }
  .au-yc-st { grid-template-columns: 68px minmax(0, 1fr); column-gap: 16px; row-gap: 4px; }
  .au-yc-ico { grid-row: span 3; }
}
@media (max-width: 900px) {
  .au-ft-head { display: none; }
  .au-ft-row { grid-template-columns: 1fr 1fr; gap: 8px 16px; padding: 16px 0; }
  .au-ft-row .what { grid-column: 1 / -1; }
  .au-ft-row > [data-l]::before { content: attr(data-l); display: block; color: var(--fg-dim); font-size: 0.78rem; font-weight: 600; }
}
@media (max-width: 640px) {
  .xr { padding: 10px; }
  .xr-node text { font-size: 12.5px; }
  .xr-findings li { grid-template-columns: auto minmax(0, 1fr); }
  .xr-loss { grid-column: 2; }
  .au-checks-top { grid-template-columns: 1fr; }
  .au-progress { justify-items: start; }
  .au-zones { grid-template-columns: 1fr; }
  .sk-txt { display: none; }
  .au-sk-sum { grid-template-columns: 1fr; }
  .au-vs-row { grid-template-columns: 1fr 1fr; gap: 6px 14px; padding: 14px 16px; }
  .au-vs-row [role="rowheader"] { grid-column: 1 / -1; }
  .au-vs-head > span:first-child { display: none; }
  .au-doc-row { grid-template-columns: 1fr 1fr; }
}
