/* FILE: app/ui/static/css/app.css
   ZakROI Next — базовые стили платформы (STAGE_01 Т-1.14, база Д25).
   Без внешних зависимостей (CSP-safe), system font stack, light theme. */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e3e8ef;
  --text: #1f2933;
  --muted: #647387;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff4ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --info: #0891b2;
  --info-soft: #ecfeff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Топбар ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 58px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); display: inline-block; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
}
.nav a:hover { background: var(--accent-soft); color: var(--accent); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }

.user-menu { display: flex; align-items: center; gap: 12px; }
.nav-bell { font-size: 17px; text-decoration: none; line-height: 1; padding: 4px 6px;
  border-radius: 8px; opacity: .8; transition: background .15s, opacity .15s; }
.nav-bell:hover, .nav-bell.active { opacity: 1; background: var(--accent-soft); }
.user-badge {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--muted);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.role-tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}

/* ── Контент ── */
.container { max-width: 1180px; margin: 0 auto; padding: 28px 24px; }
.container-narrow { max-width: 460px; margin: 0 auto; padding: 28px 24px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-head h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ── Карточки ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card h2 { font-size: 16px; margin: 0 0 14px; font-weight: 620; }

/* ── Кнопки ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 550; cursor: pointer; line-height: 1;
  background: var(--accent); color: #fff; transition: background .15s;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13px; }

/* ── Формы ── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 550; margin-bottom: 6px; color: var(--text); }
.field input[type=text], .field input[type=email], .field input[type=password],
.field select, .field input[type=number] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; background: var(--surface); color: var(--text);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.checkbox input { width: 16px; height: 16px; }

/* ── Таблицы ── */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .03em;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }

.badge { font-size: 12px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.badge-on { background: var(--success-soft); color: var(--success); }
.badge-off { background: var(--danger-soft); color: var(--danger); }
.badge-role { background: var(--accent-soft); color: var(--accent); }

/* ── Flash ── */
.flash-wrap { margin-bottom: 18px; }
.flash {
  padding: 12px 16px; border-radius: 9px; margin-bottom: 10px; font-size: 14px;
  border: 1px solid transparent; display: flex; align-items: center; gap: 9px;
}
.flash-success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.flash-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: #fecaca; }
.flash-warning { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.flash-info    { background: var(--info-soft);    color: var(--info);    border-color: #a5f3fc; }

/* ── Логин ── */
.auth-shell { min-height: 100vh; display: grid; place-items: center; background: var(--bg); }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 32px;
}
.auth-card .brand { justify-content: center; margin-bottom: 6px; font-size: 20px; }
.auth-card .subtitle { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 22px; }

.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } .nav { display: none; } }

/* ── Каталог интеграций ── */
.cat { margin-bottom: 26px; }
.cat-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 0 0 12px; }
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.conn-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
}
.conn-card .ct-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conn-card .ct-name { font-weight: 600; font-size: 15px; }
.conn-card .ct-desc { color: var(--muted); font-size: 13px; flex: 1; line-height: 1.45; }
.conn-card .ct-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.badge-count { background: var(--success-soft); color: var(--success); font-size: 11px;
  padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.badge-wh { background: var(--info-soft); color: var(--info); font-size: 10px; padding: 1px 7px;
  border-radius: 999px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-ok { background: var(--success); } .status-error { background: var(--danger); }
.status-idle { background: #cbd5e1; }
.wh-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px;
  word-break: break-all; color: var(--muted); }

/* ── Карточки проектов (Т-1.3 B) ── */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.proj-card { display: flex; flex-direction: column; gap: 10px; margin-bottom: 0; }
.proj-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.proj-name { font-weight: 600; font-size: 15px; color: var(--text); }
.proj-meta { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 13px; flex: 1; }
.proj-archived { opacity: .7; }
.badge-hidden { background: var(--warning-soft); color: var(--warning); font-size: 11px;
  padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.archive-block { margin-top: 22px; }
.archive-toggle { border: none; background: transparent; cursor: pointer; color: var(--muted);
  font-size: 14px; font-weight: 600; padding: 6px 0; margin-bottom: 10px; display: inline-flex;
  align-items: center; gap: 6px; }
.archive-toggle:hover { color: var(--text); }

/* ── Модалка ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 440px; padding: 24px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .modal-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.modal-result { font-size: 13px; margin-top: 12px; padding: 10px 12px; border-radius: 8px; display: none; }
.modal-result.ok { background: var(--success-soft); color: var(--success); display: block; }
.modal-result.err { background: var(--danger-soft); color: var(--danger); display: block; }
.instruction { white-space: pre-line; font-size: 12px; color: var(--muted); background: var(--bg);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; line-height: 1.5; }

/* ── Бюджеты (Т-1.15) ── */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat-card.success { border-left-color: var(--success); }
.stat-card.danger  { border-left-color: var(--danger); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.stat-card .val { font-size: 26px; font-weight: 700; margin-top: 4px; }
@media (max-width: 760px) { .stat-cards { grid-template-columns: repeat(2, 1fr); } }

.progress { background: var(--bg); border-radius: 999px; overflow: hidden; height: 7px; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.progress-bar.ok { background: var(--success); }
.progress-bar.warn { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }
.progress-bar.info { background: var(--info); }

.bud-toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.bud-toolbar .field { margin-bottom: 0; min-width: 150px; }
.bud-toolbar input[type=date], .bud-toolbar input[type=text], .bud-toolbar input[type=number] {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  background: var(--surface); color: var(--text); }

.seg { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.seg .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.badge-warn { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft);    color: var(--info); }
.badge-muted{ background: var(--bg); color: var(--muted); }

.proj-card { padding: 0; overflow: hidden; }
.proj-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; cursor: pointer; }
.proj-bar:hover { background: var(--bg); }
.proj-bar .left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.proj-bar .chev { color: var(--muted); transition: transform .15s; display: inline-block; width: 12px; }
.proj-bar.open .chev { transform: rotate(90deg); }
.proj-body { display: none; border-top: 1px solid var(--border); }
.proj-body.show { display: block; }

.editable-limit { cursor: pointer; border-bottom: 1px dashed var(--muted); }
.editable-limit:hover { color: var(--accent); border-color: var(--accent); }

.tbl-sm th, .tbl-sm td { padding: 8px 10px; font-size: 13px; }
.text-end { text-align: right; }
.nowrap { white-space: nowrap; }
.spin { width: 16px; height: 16px; border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.refill-total { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff; border-radius: var(--radius); padding: 16px 22px; display: flex; align-items: center;
  justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.refill-total .big { font-size: 26px; font-weight: 700; }
.refill-total .chip { background: rgba(255,255,255,.16); border-radius: 8px; padding: 8px 14px; text-align: center; }
.refill-total .chip .small { font-size: 12px; opacity: .85; }
.amount-input { width: 130px; text-align: right; padding: 7px 9px; border: 2px solid var(--border);
  border-radius: 7px; font-size: 14px; font-weight: 600; }
.amount-input:focus { outline: none; border-color: var(--accent); }
.amount-input.modified { border-color: var(--warning); background: var(--warning-soft); }
.proj-head-row td { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.error-row td { background: var(--danger-soft); }

/* ── Экран обзора (STAGE_03 Т-3.2) ── */
.ov-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ov-toolbar .seg-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.seg-links { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 3px; }
.seg-links a { padding: 5px 11px; border-radius: 7px; font-size: 13px; font-weight: 550; color: var(--muted); }
.seg-links a:hover { background: var(--bg); color: var(--text); }
.seg-links a.active { background: var(--accent); color: #fff; }

.ov-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.ov-stat { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 13px 15px; }
.ov-stat.critical { border-left-color: var(--danger); }
.ov-stat.warning  { border-left-color: var(--warning); }
.ov-stat.ok       { border-left-color: var(--success); }
.ov-stat.no_data  { border-left-color: #cbd5e1; }
.ov-stat .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.ov-stat .val { font-size: 26px; font-weight: 700; margin-top: 3px; line-height: 1.1; }
.ov-stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
@media (max-width: 760px) { .ov-summary { grid-template-columns: repeat(2, 1fr); } }

.ov-money { display: flex; gap: 22px; flex-wrap: wrap; margin: 0 0 22px; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.ov-money .m { display: flex; flex-direction: column; }
.ov-money .m .ml { font-size: 12px; color: var(--muted); font-weight: 600; }
.ov-money .m .mv { font-size: 19px; font-weight: 700; }
.ov-money .m .mv.green { color: var(--success); }

/* Блок «Нужны действия» */
.needs { margin-bottom: 24px; }
.needs h2 { font-size: 16px; margin: 0 0 12px; font-weight: 620; }
.needs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.need-card { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--warning);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.need-card.critical { border-left-color: var(--danger); }
.need-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.need-title { font-weight: 600; font-size: 14px; }
.need-count { font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 999px;
  background: var(--warning-soft); color: var(--warning); }
.need-card.critical .need-count { background: var(--danger-soft); color: var(--danger); }
.need-projects { display: flex; flex-direction: column; gap: 5px; }
.need-proj { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.need-proj .np-note { color: var(--muted); font-size: 12px; }
.need-cta { font-size: 12px; font-weight: 600; white-space: nowrap; }

/* Группы urgency + карточки проектов */
.ov-group { margin-bottom: 22px; }
.ov-group-head { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; font-size: 15px; font-weight: 650; }
.ov-group-head .gc { font-size: 13px; color: var(--muted); font-weight: 600; }
.ov-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 13px; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 15px 16px; display: flex; flex-direction: column; gap: 10px;
  border-left: 4px solid var(--border); position: relative; }
.pcard.critical { border-left-color: var(--danger); }
.pcard.warning  { border-left-color: var(--warning); }
.pcard.ok       { border-left-color: var(--success); }
.pcard.no_data  { border-left-color: #cbd5e1; }
.pcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pcard-name { font-weight: 650; font-size: 15px; color: var(--text); line-height: 1.25; }
.pcard-name a { color: var(--text); }
.pcard-name a:hover { color: var(--accent); }
.pcard-dom { font-size: 12px; color: var(--muted); margin-top: 1px; }
.urg { display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-weight: 700; font-size: 14px; }
.urg .us { font-size: 11px; font-weight: 600; opacity: .8; }
.urg.critical { background: var(--danger-soft); color: var(--danger); }
.urg.warning  { background: var(--warning-soft); color: var(--warning); }
.urg.ok       { background: var(--success-soft); color: var(--success); }
.urg.no_data  { background: var(--bg); color: var(--muted); }
.pcard-alert { font-size: 13px; color: var(--text); background: var(--bg); border-radius: 8px;
  padding: 8px 10px; line-height: 1.4; }
.pcard-alert.none { color: var(--muted); }
.pcard-action { font-size: 13px; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.pcard-action .pa-money { font-weight: 700; color: var(--success); white-space: nowrap; }
.pcard-action .pa-text { color: var(--muted); }
.pcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 9px; }
.pcard-bal { display: flex; gap: 12px; flex-wrap: wrap; }
.pcard-bal .bl { font-weight: 600; color: var(--text); }
.pcard-bal .bl.low { color: var(--danger); }
.pcard-bal .runway.warn { color: var(--warning); font-weight: 600; }

/* Дельты vs вчера */
.delta { font-size: 12px; font-weight: 600; white-space: nowrap; }
.delta.up-bad { color: var(--danger); }
.delta.down-good { color: var(--success); }
.delta.flat { color: var(--muted); }
.delta.new { background: var(--accent-soft); color: var(--accent); padding: 1px 7px; border-radius: 999px; }
.pcard-deltas { display: flex; gap: 10px; flex-wrap: wrap; }

/* Ручной порядок (drag + стрелки) */
.pcard.manual { cursor: grab; }
.pcard.manual.dragging { opacity: .45; }
.pcard.drop-target { outline: 2px dashed var(--accent); outline-offset: 2px; }
.reorder { display: inline-flex; gap: 3px; }
.reorder button { border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 6px; width: 24px; height: 22px; cursor: pointer; font-size: 12px; line-height: 1; padding: 0; }
.reorder button:hover { background: var(--bg); color: var(--text); }
.reorder button:disabled { opacity: .4; cursor: default; }
.order-saved { font-size: 12px; color: var(--success); font-weight: 600; }

/* ── Экран проекта (STAGE_03 Т-3.1) ── */
.dhealth { border: 1px solid var(--border); border-left: 3px solid var(--success); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 16px; }
.dhealth.has-issues { border-left-color: var(--danger); background: var(--danger-soft); }
.dhealth .dh-head { font-weight: 620; font-size: 14px; margin-bottom: 8px; }
.dh-sources { display: flex; gap: 8px; flex-wrap: wrap; }
.dh-src { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.dh-src b { font-weight: 700; }
.dh-ok { background: var(--success-soft); color: var(--success); }
.dh-stale, .dh-missing { background: var(--warning-soft); color: var(--warning); }
.dh-expired, .dh-failed { background: var(--danger-soft); color: var(--danger); }

.mcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.mcard { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface);
  cursor: help; }
.mcard .mc-lbl { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.mcard .mc-val { font-size: 23px; font-weight: 700; margin: 4px 0; line-height: 1.1; }
.mcard .mc-foot { display: flex; align-items: center; gap: 6px; }
.mc-meta { font-size: 11px; color: var(--muted); }
.tz { font-size: 9px; } .tz-yellow { color: var(--warning); } .tz-red { color: var(--danger); }

.funnel { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; }
.fstage { flex: 1; min-width: 110px; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; text-align: center; background: var(--surface); cursor: help; }
.fstage .fs-lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.fstage .fs-val { font-size: 22px; font-weight: 700; margin: 3px 0; }
.farrow { display: flex; align-items: center; color: var(--muted); font-size: 18px; }

.sub-h { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: .03em; margin: 12px 0 6px; }
.sub-h:first-child { margin-top: 0; }

.sem-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.w-empty { border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px; background: var(--bg); }
.w-empty.disabled { border-color: #cbd5e1; }
.w-empty.err { border-color: #fecaca; background: var(--danger-soft); }
.w-empty .we-t { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.w-empty .we-d { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .funnel { flex-direction: column; } .farrow { transform: rotate(90deg); justify-content: center; } }

/* ── Экран кампаний (STAGE_03 Т-3.3) ── */
.camp-totals { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  font-size: 13px; color: var(--muted); padding: 0 2px 12px; }
.camp-totals b { color: var(--text); font-weight: 700; }
.table-wrap { overflow-x: auto; }
.tbl-camp { width: 100%; font-size: 13px; }
.tbl-camp th { white-space: nowrap; }
.tbl-camp .sort-h { color: var(--muted); text-decoration: none; font-weight: 600; }
.tbl-camp .sort-h:hover { color: var(--text); }
.tbl-camp .sort-h.active { color: var(--accent); }
.tbl-camp .caret { font-size: 10px; }
.camp-name { font-weight: 600; }
.cbadge { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--border); margin-left: 4px; }
.cbadge-mut { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.stars-on { color: var(--warning); letter-spacing: 1px; }
.stars-off { color: var(--border); letter-spacing: 1px; }
.tbl-camp .camp-delta td { font-size: 11px; border-top: none; padding-top: 0; padding-bottom: 2px; }
.tbl-camp .camp-hint td { font-size: 12px; border-top: none; padding-top: 0; padding-bottom: 10px; }
.hint-bad { color: var(--danger); } .hint-good { color: var(--success); }
.warn-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.warn-list li { margin: 2px 0; }
.card-link { font-size: 12px; font-weight: 500; color: var(--accent); text-decoration: none; }
.card-link:hover { text-decoration: underline; }

/* ── Экран «Опыт по проектам» /insights (STAGE_03 Т-3.4) ── */
.niche-groups { display: flex; flex-direction: column; gap: 8px; }
.ngroup { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.cbadge-acc { background: var(--accent-soft, #eef2ff); color: var(--accent); border-color: transparent; font-weight: 600; }
.winners-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.winner-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); }
.winner-box .wb-head { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.winner-box .wb-head a { text-decoration: none; }
.wb-list { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.wb-list li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.wb-mask { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ov-empty { text-align: center; padding: 48px 24px; }
.ov-empty .ico { font-size: 34px; }
.ov-empty .t { font-size: 17px; font-weight: 650; margin: 10px 0 4px; }
.ov-empty .d { color: var(--muted); font-size: 14px; max-width: 460px; margin: 0 auto 16px; }
@media (max-width: 640px) { .ov-cards, .needs-grid { grid-template-columns: 1fr; } }
