/* PayStat — доборы к дизайн-системе студии (app.css): графики, KPI, конверсия, настройки. */

:root {
  --paid: #2DD4BF;
  --paid-line: #F5B833;
  --paid-soft: rgba(45, 212, 191, 0.14);
}
html[data-theme="light"] {
  --paid: #10B981;
  --paid-line: #E08A00;
  --paid-soft: rgba(16, 185, 129, 0.12);
}

/* ─── карточки с кнопкой в шапке ─── */
.card-head { align-items: center; }
.card-head .btn { margin-left: auto; align-self: center; }
.card-icon.paid { background: var(--paid-soft); color: var(--paid); }

/* ─── фильтры ─── */
.filter-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.presets { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.presets button { padding: 6px 11px; border-radius: 7px; color: var(--text-3); font-size: 12px; font-weight: 600; transition: color .15s, background .15s; }
.presets button:hover { color: var(--text-1); }
.presets button.active { background: var(--accent); color: #fff; box-shadow: 0 4px 12px var(--accent-glow); }
.date-group { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12px; }
.date-input { width: auto; padding: 8px 10px; }
.filter-spacer { flex: 1 1 12px; }

/* ─── KPI ─── */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; }
.kpi { position: relative; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; }
.kpi::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: 0; }
.kpi--accent::after { opacity: 1; background: var(--accent); }
.kpi--paid::after { opacity: 1; background: var(--paid); }
.kpi__label { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.kdot { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; }
.kdot--accent { background: var(--accent); }
.kdot--paid { background: var(--paid); }
.kpi__value { display: block; font-family: var(--font-display); font-size: 22px; line-height: 1.1; color: var(--text-1); font-variant-numeric: tabular-nums; }
.kpi__value small { font-size: 13px; color: var(--text-3); font-weight: 500; margin-left: 2px; }
.kpi__sub { display: block; margin-top: 7px; font-size: 11px; color: var(--text-4); }

/* ─── легенда графика ─── */
.legend--chart { display: flex; gap: 18px; flex-wrap: wrap; margin: 2px 0 10px; font-size: 12px; color: var(--text-2); }
.legend--chart span { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.swatch--paid { background: var(--paid); }
.swatch--line { width: 16px; height: 3px; border-radius: 2px; background: var(--paid-line); }

/* ─── графики ─── */
.chart-scroll { overflow-x: auto; margin: 0 -6px; }
.chart { width: 100%; min-width: 640px; display: block; }
.axis-text { fill: var(--text-3); font-size: 10px; font-family: var(--font-body); }
.axis-dim { fill: var(--text-4); }
.val-text { fill: var(--text-2); font-size: 10px; font-weight: 600; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.bar { transition: opacity .12s; }
.bar:hover { opacity: .82; }

/* ─── тултип ─── */
.tip { position: fixed; z-index: 50; pointer-events: none; opacity: 0; transform: translateY(-4px);
  background: var(--bg-3); border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 11px;
  box-shadow: var(--shadow-2); font-size: 12px; min-width: 160px; transition: opacity .1s; }
.tip.on { opacity: 1; }
.tip__d { font-weight: 700; color: var(--text-1); margin-bottom: 6px; font-family: var(--font-display); font-size: 12px; }
.tip__row { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--text-2); margin-top: 3px; }
.tip__row b { color: var(--text-1); font-variant-numeric: tabular-nums; }
.tip__row .k { display: inline-flex; align-items: center; gap: 6px; }
.tdot { width: 8px; height: 8px; border-radius: 3px; }

/* ─── таблицы отчёта ─── */
.table-scroll { overflow-x: auto; }
#day-table .table, #mgr-table .table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
#day-table .table th, #mgr-table .table th { text-align: right; padding: 10px 12px; font-size: 11px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
#day-table .table td, #mgr-table .table td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line);
  color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
#day-table .table th:first-child, #day-table .table td:first-child,
#mgr-table .table th:first-child, #mgr-table .table td:first-child { text-align: left; }
#day-table .table th.right, #mgr-table .table th.right,
#day-table .table td.right, #mgr-table .table td.right { text-align: right; }
#day-table .table tbody tr:hover, #mgr-table .table tbody tr:hover { background: var(--bg-2); }
#day-table .table td.strong, #mgr-table .table td.strong { color: var(--text-1); font-weight: 600; }
#day-table .table .wd { color: var(--text-4); font-size: 11px; margin-left: 6px; }
#day-table .table tfoot td { padding: 12px; border-top: 1px solid var(--line-strong); color: var(--text-1);
  font-weight: 700; font-family: var(--font-display); font-size: 13px; border-bottom: 0; }
#mgr-table .table td:first-child { display: flex; align-items: center; gap: 10px; }
.ava { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; }
.conv { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.conv__bar { width: 46px; height: 6px; border-radius: 999px; background: var(--bg-3); overflow: hidden; flex-shrink: 0; }
.conv__bar i { display: block; height: 100%; background: var(--paid); border-radius: 999px; }

/* ─── прогресс-бар синка ─── */
.progress-bar.indet { animation: indet 1.1s ease-in-out infinite alternate; }
@keyframes indet { from { opacity: .5; } to { opacity: 1; } }

/* ─── настройки: стадии/направления ─── */
.stage-list { display: flex; flex-direction: column; gap: 6px; }
.stage-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg-2); cursor: pointer; transition: border-color .15s, background .15s; }
.stage-item:hover { border-color: var(--line-strong); }
.stage-item.is-success { border-color: rgba(45, 212, 191, .35); }
.stage-item input { width: 16px; height: 16px; accent-color: var(--accent); }
.stage-name { flex: 1; color: var(--text-1); }
.stage-sem { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.sem-S { color: var(--paid); background: var(--paid-soft); }
.sem-F { color: var(--danger); background: var(--danger-soft); }
.sem-P { color: var(--text-3); background: var(--bg-3); }

/* ─── база знаний ─── */
.kb-item { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-2); margin-bottom: 8px; color: var(--text-1); font-weight: 500; }
.kb-item:hover { border-color: var(--accent); }

@media (max-width: 560px) {
  .filter-spacer { display: none; }
  .date-group { width: 100%; }
}
