* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: #222; background: #fafafa; }
.topbar { background: #fff; border-bottom: 1px solid #e5e7eb; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.logo { color: #111; font-weight: 600; text-decoration: none;
        display: inline-flex; align-items: center; gap: 8px; }
.logo-img { height: 30px; width: 30px; object-fit: contain; display: block; }
.logo-text { font-size: 14px; letter-spacing: -0.01em; }
.main-nav { display: flex; gap: 4px; flex: 1; }
.main-nav a { color: #4b5563; text-decoration: none; font-size: 13px;
              padding: 6px 12px; border-radius: 5px; font-weight: 500; }
.main-nav a:hover { background: #f3f4f6; color: #111; }
.user-info { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #555; }
.user-info .user-login { font-weight: 500; }
/* Backwards-compat — старые шаблоны могут ещё использовать .admin-nav */
.admin-nav { display: flex; gap: 12px; padding-right: 8px; border-right: 1px solid #e5e7eb; }
.admin-nav a { color: #4b5563; text-decoration: none; font-size: 12px; padding: 4px 8px; border-radius: 4px; }
.admin-nav a:hover { background: #f3f4f6; color: #111; }

/* Filter form, встроенный в dash-filters на /calls */
.filter-form-inline { display: flex; gap: 16px; align-items: center; }
.status-filter { display: flex; gap: 6px; align-items: center; }
.dash-filters .reset { color: #6b7280; text-decoration: none; font-size: 12px;
                       padding: 4px 8px; border-radius: 4px; }
.dash-filters .reset:hover { background: #f3f4f6; color: #b91c1c; }

/* CRM-прогресс на карточке звонка */
.crm-progress { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px;
                background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 6px;
                font-size: 12px; }
.crm-progress-row { display: flex; align-items: center; gap: 6px; }
.crm-progress .crm-stage { font-weight: 500; color: #111; }
.crm-badge { display: inline-block; padding: 2px 8px; border-radius: 10px;
             font-size: 11px; font-weight: 500; }
.crm-badge-won        { background: #d1fae5; color: #047857; }
.crm-badge-progressed { background: #dbeafe; color: #1d4ed8; }
.crm-badge-stagnant   { background: #fef3c7; color: #92400e; }
.crm-badge-lost       { background: #fee2e2; color: #b91c1c; }
.crm-badge-unknown    { background: #f3f4f6; color: #6b7280; }
.crm-ambiguous { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa;
                 border-radius: 4px; padding: 6px 8px; font-size: 11px; line-height: 1.35; }

/* Dashboard */
.dashboard-kpi { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0 18px; }
.kpi { flex: 1 1 140px; background: #fff; border: 1px solid #e5e7eb;
       border-radius: 8px; padding: 12px 14px; }
.kpi-label { color: #6b7280; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { color: #111; font-size: 26px; font-weight: 600; line-height: 1.2; }
.kpi-sub { color: #6b7280; font-size: 11px; margin-top: 2px; }
.kpi-highlight { background: linear-gradient(135deg, #ecfeff 0%, #f0fdf4 100%);
                 border-color: #a7f3d0; }
.kpi-alert { background: linear-gradient(135deg, #fff7ed 0%, #fef2f2 100%);
             border-color: #fecaca; }

/* Dashboard layout */
/* Фильтры дашборда */
.dash-filters { display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
                margin: 0 0 14px; padding: 8px 12px; background: #fff;
                border: 1px solid #e5e7eb; border-radius: 8px;
                font-size: 12px; }
.dash-filters .filter-label { color: #6b7280; font-weight: 500; }
.period-filter, .manager-filter { display: flex; gap: 6px; align-items: center; }
.period-btn { padding: 4px 10px; border-radius: 5px; text-decoration: none;
              color: #4b5563; cursor: pointer; border: 1px solid transparent; }
.period-btn:hover { background: #f3f4f6; color: #111; }
.period-btn.active { background: #4f46e5; color: #fff; border-color: #4338ca; }
.period-btn.active:hover { background: #4338ca; color: #fff; }
.manager-select { padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 5px;
                  background: #fff; font-size: 12px; min-width: 200px; }

/* CSS-bars для распределения по риск-зонам */
.risk-bars { display: flex; flex-direction: column; gap: 8px; }
.risk-bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.risk-bar-label { width: 160px; color: #111; flex-shrink: 0; }
.risk-bar-stack { flex: 1; display: flex; height: 22px; border-radius: 4px;
                  overflow: hidden; background: #f9fafb;
                  border: 1px solid #e5e7eb; }
.risk-bar-segment { display: flex; align-items: center; justify-content: center;
                    color: #fff; font-weight: 600; font-size: 11px;
                    min-width: 0; transition: width 0.2s ease; }
.risk-bar-segment.band-high   { background: #ef4444; }
.risk-bar-segment.band-medium { background: #f59e0b; }
.risk-bar-segment.band-low    { background: #10b981; }
.risk-bar-segment.band-na     { background: #9ca3af; }
.risk-bar-legend { display: flex; gap: 14px; margin-top: 6px; font-size: 11px;
                   color: #6b7280; }
.risk-bar-legend span { display: flex; align-items: center; gap: 4px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px;
                 display: inline-block; }
.legend-swatch.band-high   { background: #ef4444; }
.legend-swatch.band-medium { background: #f59e0b; }
.legend-swatch.band-low    { background: #10b981; }
.legend-swatch.band-na     { background: #9ca3af; }

/* CSS-bars для time-to-outcome */
.tto-bars { display: flex; flex-direction: column; gap: 8px; }
.tto-bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.tto-label { width: 90px; color: #111; flex-shrink: 0; }
.tto-bar-track { flex: 1; background: #f9fafb; border: 1px solid #e5e7eb;
                 border-radius: 4px; height: 22px; overflow: hidden; }
.tto-bar-fill { background: #93c5fd; height: 100%; display: flex;
                align-items: center; justify-content: flex-end; padding: 0 8px;
                color: #1e40af; font-weight: 600; font-size: 11px;
                min-width: fit-content; transition: width 0.2s ease; }

.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
               margin-bottom: 14px; }
@media (max-width: 1100px) { .dash-grid-2 { grid-template-columns: 1fr; } }
.dash-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
             padding: 14px 16px; margin-bottom: 14px; }
.dash-card h3 { margin: 0 0 6px; font-size: 14px; color: #111; }
.dash-card p.muted { font-size: 12px; margin: 0 0 10px; }

/* Heatmap (manager × category) */
.heatmap { display: grid; gap: 2px; font-size: 11px; }
.heatmap-corner { background: transparent; }
.heatmap-col-header { background: #f9fafb; padding: 8px 6px; text-align: center;
                      font-weight: 500; color: #111; border-radius: 3px;
                      font-size: 12px; line-height: 1.25;
                      display: flex; align-items: center;
                      justify-content: center; }
.heatmap-row-header { background: #f9fafb; padding: 8px 12px; font-weight: 500;
                      color: #111; border-radius: 3px; font-size: 12px;
                      line-height: 1.3; display: flex; align-items: center; }
.heatmap-cell { padding: 12px 4px; text-align: center; border-radius: 3px;
                font-weight: 600; color: #111; font-size: 13px;
                display: flex; align-items: center; justify-content: center;
                min-height: 36px; }

/* Risk × Outcome — stacked bars per band */
.ro-bars { display: flex; flex-direction: column; gap: 8px;
           margin-bottom: 12px; }
.ro-bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.ro-bar-label { width: 160px; flex-shrink: 0; padding: 6px 10px;
                border-radius: 4px; color: #fff; font-weight: 600;
                display: flex; justify-content: space-between; gap: 8px; }
.ro-bar-label.band-high   { background: #ef4444; }
.ro-bar-label.band-medium { background: #f59e0b; }
.ro-bar-label.band-low    { background: #10b981; }
.ro-bar-label.band-n_a    { background: #9ca3af; }
.ro-bar-count { font-weight: 700; }
.ro-bar-track { flex: 1; display: flex; height: 28px; border-radius: 4px;
                overflow: hidden; background: #f9fafb;
                border: 1px solid #e5e7eb; }
.ro-segment { display: flex; align-items: center; justify-content: center;
              color: #fff; font-weight: 600; font-size: 11px; min-width: 0;
              padding: 0 4px; transition: width 0.2s ease; }
.ro-segment.ro-empty { color: #9ca3af; background: transparent;
                       width: 100%; font-weight: 400; }
.outcome-won           { background: #16a34a; }
.outcome-in_progress   { background: #3b82f6; }
.outcome-lost_quality  { background: #dc2626; }
.outcome-lost_external { background: #f97316; }
.outcome-retained      { background: #eab308; }
.outcome-ambiguous     { background: #6b7280; }
.outcome-unknown       { background: #d1d5db; color: #4b5563; }

/* Progression-палитра: положительное — зелёные оттенки, негативное —
   красно-оранжевые, без движения — жёлто-серый. */
.prog-won           { background: #15803d; }
.prog-progressed    { background: #4ade80; color: #14532d; }
.prog-stagnant      { background: #fde68a; color: #78350f; }
.prog-lost_quality  { background: #dc2626; }
.prog-lost_external { background: #fb923c; color: #7c2d12; }
.prog-unknown       { background: #d1d5db; color: #4b5563; }
.legend-swatch.prog-won           { background: #15803d; }
.legend-swatch.prog-progressed    { background: #4ade80; }
.legend-swatch.prog-stagnant      { background: #fde68a; }
.legend-swatch.prog-lost_quality  { background: #dc2626; }
.legend-swatch.prog-lost_external { background: #fb923c; }
.legend-swatch.prog-unknown       { background: #d1d5db; }
.ro-bar-conv { font-weight: 600; opacity: 0.85; }
.ro-hint { margin-top: 8px; font-size: 11px; }
.ro-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px;
             color: #4b5563; margin-top: 4px; }
.ro-legend span { display: flex; align-items: center; gap: 4px;
                  white-space: nowrap; }
.legend-swatch.outcome-won           { background: #16a34a; }
.legend-swatch.outcome-in_progress   { background: #3b82f6; }
.legend-swatch.outcome-lost_quality  { background: #dc2626; }
.legend-swatch.outcome-lost_external { background: #f97316; }
.legend-swatch.outcome-retained      { background: #eab308; }
.legend-swatch.outcome-ambiguous     { background: #6b7280; }
.legend-swatch.outcome-unknown       { background: #d1d5db; }

.tto-stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px;
             margin-bottom: 10px; padding: 8px 10px; background: #f9fafb;
             border-radius: 4px; }

/* Metrics breakdown table */
.metrics-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.metrics-table th { padding: 8px 10px; background: #f9fafb; text-align: left;
                    font-weight: 500; color: #4b5563;
                    border-bottom: 1px solid #e5e7eb; }
.metrics-table td { padding: 8px 10px; border-bottom: 1px solid #f3f4f6;
                    vertical-align: top; }
.metrics-table th.num, .metrics-table td.num { text-align: right; }
.metrics-row { cursor: pointer; }
.metrics-row:hover { background: #f9fafb; }
.metrics-row code { background: #f3f4f6; padding: 1px 5px; border-radius: 3px;
                    font-size: 11px; color: #374151; }
.category-pill { display: inline-block; background: #eef2ff; color: #4338ca;
                 padding: 1px 8px; border-radius: 10px; font-size: 11px; }
.pass-rate-cell { display: inline-block; padding: 2px 8px; border-radius: 4px;
                  font-weight: 600; color: #1f2937; min-width: 40px;
                  text-align: center; }

.rule-list { margin: 4px 0; padding-left: 18px; font-size: 12px;
             line-height: 1.45; }
.rule-list li { margin-bottom: 4px; }

.example-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.example-table th { padding: 6px 8px; background: #f9fafb; text-align: left;
                    font-weight: 500; color: #4b5563;
                    border-bottom: 1px solid #e5e7eb; }
.example-table td { padding: 8px 8px; border-bottom: 1px solid #f3f4f6;
                    vertical-align: top; }
.example-quote { font-style: italic; color: #374151; max-width: 360px; }

/* Top weakest list */
.weakest-list { margin: 0; padding-left: 18px; line-height: 1.7; }
.weakest-list li { font-size: 13px; }

/* Leaderboard */
.leaderboard { width: 100%; border-collapse: collapse; font-size: 13px; }
.leaderboard th { padding: 8px 10px; background: #f9fafb; text-align: left;
                  font-weight: 500; color: #4b5563; border-bottom: 1px solid #e5e7eb; }
.leaderboard td { padding: 8px 10px; border-bottom: 1px solid #f3f4f6; }
.leaderboard th.num, .leaderboard td.num { text-align: right; }
.leaderboard-row { cursor: pointer; }
.leaderboard-row:hover { background: #f9fafb; }
.leaderboard-hint { font-size: 11px; margin: 8px 0 0; }

/* Manager drilldown */
.drilldown-card { background: #fff; border: 1px solid #c7d2fe; border-radius: 8px;
                  padding: 14px 16px; margin: 16px 0 24px;
                  box-shadow: 0 4px 8px -4px rgba(99, 102, 241, 0.15); }
.drilldown-header { display: flex; justify-content: space-between;
                    align-items: center; border-bottom: 1px solid #e5e7eb;
                    padding-bottom: 8px; margin-bottom: 12px; }
.drilldown-header h2 { margin: 0; font-size: 18px; }
.drilldown-close { background: transparent; border: none; font-size: 22px;
                   cursor: pointer; color: #6b7280; padding: 0 8px; line-height: 1; }
.drilldown-close:hover { color: #111; }

.weak-vs-team { width: 100%; border-collapse: collapse; font-size: 12px; }
.weak-vs-team th { padding: 6px; background: #f9fafb; text-align: left;
                   font-weight: 500; color: #4b5563; }
.weak-vs-team td { padding: 6px; border-bottom: 1px solid #f3f4f6; }
.weak-vs-team .num { text-align: right; }
.weak-vs-team .delta-neg { color: #b91c1c; font-weight: 600; }
.weak-vs-team .delta-pos { color: #047857; font-weight: 600; }

.recent-meetings { width: 100%; border-collapse: collapse; font-size: 12px; }
.recent-meetings th { padding: 6px; background: #f9fafb; text-align: left;
                      font-weight: 500; color: #4b5563; }
.recent-meetings td { padding: 6px; border-bottom: 1px solid #f3f4f6; }
.recent-meetings td.num { text-align: right; }

.band-pill { display: inline-block; padding: 1px 8px; border-radius: 10px;
             font-size: 11px; font-weight: 500; }
.band-pill.band-high   { background: #fee2e2; color: #b91c1c; }
.band-pill.band-medium { background: #fef3c7; color: #92400e; }
.band-pill.band-low    { background: #d1fae5; color: #047857; }
.band-pill.band-n_a    { background: #f3f4f6; color: #6b7280; }
.dashboard-table { width: 100%; border-collapse: collapse; margin-bottom: 24px;
                   font-size: 13px; }
.dashboard-table th, .dashboard-table td { padding: 6px 10px;
                                            border-bottom: 1px solid #e5e7eb;
                                            text-align: left; }
.dashboard-table th { background: #f9fafb; color: #4b5563; font-weight: 500; }
.btn-logout { padding: 4px 10px; background: white; color: #555; border: 1px solid #d1d5db; border-radius: 12px; font-size: 11px; cursor: pointer; }
.btn-logout:hover { background: #f3f4f6; }
.eval-col { text-align: right; min-width: 80px; }
.eval-score { padding: 1px 6px; border-radius: 3px; font-weight: 500; font-size: 11px; }
.eval-good { background: #d1fae5; color: #047857; }
.eval-mid { background: #fef3c7; color: #92400e; }
.eval-poor { background: #fee2e2; color: #b91c1c; }
.eval-none { color: #aaa; font-size: 11px; }
.sort-link { color: #555; text-decoration: none; padding: 0 2px; }
.sort-link:hover { color: #111; }
.sort-link.active { color: #111; font-weight: 600; }

.eval-block { background: white; border: 1px solid #e5e7eb; border-radius: 6px; padding: 14px 16px; margin-bottom: 10px; }
.eval-header { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid #f1f5f9; margin-bottom: 10px; }
.eval-title { font-weight: 600; font-size: 13px; }
.eval-score-big { padding: 2px 10px; border-radius: 4px; font-size: 14px; font-weight: 600; }
.eval-counts { color: #666; font-size: 11px; }
.eval-summary { font-size: 12px; color: #333; line-height: 1.5; padding: 8px 10px; background: #f8fafc; border-radius: 4px; margin-bottom: 12px; }
.eval-section { margin-bottom: 10px; }
.eval-metric { padding: 4px 0; font-size: 12px; }
.metric-mark { display: inline-block; width: 16px; font-weight: 600; }
.metric-pass .metric-mark { color: #047857; }
.metric-fail .metric-mark { color: #b91c1c; }
.metric-skip .metric-mark { color: #888; }
.metric-title { font-size: 12px; }
.metric-quote { color: #555; font-style: italic; font-size: 11px; padding-left: 18px; margin-top: 2px; }
.metric-violation { color: #b91c1c; font-size: 11px; padding-left: 18px; margin-top: 2px; }
.metric-skip-reason { color: #888; font-size: 11px; }
.eval-footer { padding-top: 8px; border-top: 1px solid #f1f5f9; font-size: 11px; }
.eval-pending { padding: 10px; color: #92400e; background: #fef3c7; border-radius: 4px; font-size: 12px; }
.eval-error { color: #b91c1c; }
.eval-actions { margin-top: 10px; padding-top: 10px; border-top: 1px solid #f1f5f9; display: flex; gap: 8px; align-items: center; }
.btn-accept { padding: 6px 14px; background: #047857; color: white; border: none; border-radius: 4px; font-size: 12px; cursor: pointer; }
.btn-accept:hover { background: #065f46; }
.eval-accepted { display: inline-block; padding: 6px 12px; background: #d1fae5; color: #047857; border-radius: 4px; font-size: 12px; font-weight: 500; }
.btn-review { padding: 6px 14px; background: white; color: #2563eb; border: 1px solid #2563eb; border-radius: 4px; font-size: 12px; text-decoration: none; }
.btn-review:hover { background: #eff6ff; }

.review-form { max-width: 800px; background: white; padding: 20px; border: 1px solid #e5e7eb; border-radius: 6px; }
.review-form h2 { margin: 0 0 16px 0; font-size: 16px; }
.review-metric { border: 1px solid #e5e7eb; border-radius: 4px; padding: 10px 14px; margin-bottom: 10px; }
.review-metric legend { font-weight: 600; padding: 0 6px; font-size: 12px; }
.ai-result { color: #555; font-size: 12px; padding: 6px 0; font-style: italic; }
.review-options { display: flex; gap: 14px; padding: 6px 0; font-size: 12px; }
.review-options label { cursor: pointer; }
.verdict-options { display: flex; gap: 14px; padding: 4px 0 4px 18px;
                   font-size: 11px; border-left: 2px solid #d1d5db; }
.verdict-options label { cursor: pointer; }
.verdict-pass { color: #047857; font-weight: 500; }
.verdict-fail { color: #b91c1c; font-weight: 500; }
.review-form textarea { width: 100%; padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 4px; font: 12px system-ui; resize: vertical; }
.checkbox-row { display: block; margin-top: 6px; font-size: 11px; color: #555; cursor: pointer; }
.review-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn-save-review { padding: 8px 18px; background: #2563eb; color: white; border: none; border-radius: 4px; font-size: 13px; cursor: pointer; }
.btn-save-review:hover { background: #1d4ed8; }
.btn-cancel { padding: 8px 18px; background: white; color: #555; border: 1px solid #d1d5db; border-radius: 4px; font-size: 13px; text-decoration: none; }
.btn-recompute { padding: 6px 14px; background: white; color: #b91c1c; border: 1px solid #fecaca; border-radius: 4px; font-size: 12px; cursor: pointer; }
.btn-recompute:hover { background: #fef2f2; }

.quality-totals { display: flex; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.quality-totals .stat { flex: 1; min-width: 160px; background: white; padding: 14px; border: 1px solid #e5e7eb; border-radius: 6px; }
.stat-label { font-size: 11px; color: #666; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 600; color: #111; }
.quality-table { width: 100%; background: white; border-collapse: collapse; margin-bottom: 24px; font-size: 12px; }
.quality-table th { text-align: left; padding: 8px 10px; background: #f5f5f5; color: #666; font-weight: 500; font-size: 11px; }
.quality-table td { padding: 6px 10px; border-bottom: 1px solid #f1f5f9; }
.rate { padding: 1px 6px; border-radius: 3px; font-weight: 500; }
.rate-good { background: #d1fae5; color: #047857; }
.rate-mid { background: #fef3c7; color: #92400e; }
.rate-poor { background: #fee2e2; color: #b91c1c; }
.rate-none { color: #aaa; }
main { padding: 16px 20px; max-width: 1200px; margin: 0 auto; }
.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.filter-bar select, .filter-bar button, .filter-bar input[type="date"] { padding: 5px 10px; border: 1px solid #ccc; border-radius: 14px; background: white; font-size: 12px; }
.filter-bar button { background: #111; color: white; cursor: pointer; }
.filter-bar .reset { font-size: 11px; color: #666; }
.recordings { width: 100%; border-collapse: collapse; background: white; font-size: 12px; }
.recordings th { text-align: left; background: #f5f5f5; color: #666; padding: 7px 10px; border-bottom: 1px solid #ddd; font-weight: 500; font-size: 11px; }
.recordings td { padding: 7px 10px; border-bottom: 1px solid #f0f0f0; }
.recordings tr:hover { background: #fafbff; cursor: pointer; }
.manager { font-weight: 500; }
.filename { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; color: #555; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { padding: 1px 6px; border-radius: 3px; font-size: 10px; }
.status-ready { background: #d1fae5; color: #047857; }
.status-transcribing, .status-diarizing { background: #fef3c7; color: #92400e; }
.status-transcribe_failed, .status-diarize_failed, .status-quality_poor { background: #fee2e2; color: #b91c1c; }
.status-skipped { background: #f3f4f6; color: #6b7280; }
.status-ingested, .status-transcribed { background: #e0f2fe; color: #075985; }
.quality { font-size: 14px; }
.quality-good { color: #047857; }
.quality-partial { color: #f59e0b; }
.quality-poor { color: #b91c1c; }
.quality-none { color: #aaa; font-size: 11px; }
.pagination { margin-top: 12px; font-size: 12px; color: #666; text-align: right; }
.pagination a { color: #111; padding: 0 6px; text-decoration: none; }
.detail-header { background: white; padding: 10px 14px; border: 1px solid #e5e7eb; border-radius: 6px; margin-bottom: 10px; }
.detail-header .title { font-weight: 600; font-size: 14px; }
.detail-header .meta { color: #666; font-size: 11px; margin-top: 2px; }
.audio-bar { background: white; padding: 10px 14px; border: 1px solid #e5e7eb; border-radius: 6px; margin-bottom: 10px; position: sticky; top: 0; z-index: 10; }
.audio-bar audio { width: 100%; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 10px; }
.metadata { background: white; border: 1px solid #e5e7eb; border-radius: 6px; padding: 10px; font-size: 11px; }
.transcript { background: white; border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px; font-size: 12px; line-height: 1.55; }
.label { color: #888; text-transform: uppercase; font-size: 9px; margin: 8px 0 3px 0; }
.label:first-child { margin-top: 0; }
.segment { padding: 5px 6px; margin-bottom: 4px; border-radius: 4px; }
.pill.speaker-pill { padding: 1px 6px; border-radius: 8px; font-size: 9px; font-weight: 600; color: white; margin-right: 4px; }
.speaker-pill[data-speaker="M"] { background: #2563eb; }  /* manager */
.speaker-pill[data-speaker="C"] { background: #ea580c; }  /* client */
.speaker-pill[data-speaker="?"] { background: #888; }     /* unclear */
.phone { color: #888; }
.muted { color: #aaa; }
.empty { color: #aaa; font-style: italic; padding: 20px 0; text-align: center; }
.actions { margin-top: 8px; display: flex; gap: 8px; }
.btn-retry, .btn-retry-force { padding: 5px 12px; border: 1px solid #ccc; border-radius: 14px; background: white; font-size: 12px; cursor: pointer; }
.btn-retry { background: #2563eb; color: white; border-color: #2563eb; }
.btn-retry:hover { background: #1d4ed8; }
.btn-retry-force { color: #b91c1c; border-color: #fecaca; }
.btn-retry-force:hover { background: #fee2e2; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 10px; font-size: 13px; }
.flash-ok { background: #d1fae5; color: #047857; border: 1px solid #6ee7b7; }
.flash-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.flash-warn { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.flash-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

/* Bitrix linkage block */
.bitrix-block { font-size: 11px; }
.bitrix-meeting { padding: 6px 0; border-bottom: 1px solid #f1f5f9; }
.bitrix-meeting:last-child { border-bottom: none; }
.bitrix-subject { font-weight: 600; margin-bottom: 2px; }
.bitrix-when { color: #888; font-size: 10px; margin-bottom: 4px; }
.bitrix-row { padding: 3px 0; }
.bitrix-tag { display: inline-block; padding: 0 5px; border-radius: 8px; font-size: 9px; font-weight: 600; color: white; margin-right: 4px; vertical-align: middle; }
.tag-deal { background: #16a34a; }
.tag-contact { background: #2563eb; }
.tag-company { background: #7c3aed; }
.tag-lead { background: #d97706; }
.bitrix-row a { color: #2563eb; text-decoration: none; }
.bitrix-row a:hover { text-decoration: underline; }
.bitrix-meta { margin-left: 4px; padding-left: 4px; border-left: 1px solid #e5e7eb; color: #444; font-size: 10px; line-height: 1.3; }

/* Auth pages — login. Hide the topbar, full-screen centered card. */
body.auth-page { background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 60%, #ffffff 100%); min-height: 100vh; }
body.auth-page .topbar { display: none; }
body.auth-page main { padding: 0; max-width: none; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrap { width: 100%; padding: 24px; }
.login-card { max-width: 380px; margin: 0 auto; background: white; padding: 36px 36px 32px; border-radius: 14px; box-shadow: 0 1px 3px rgba(15,23,42,0.04), 0 16px 40px rgba(15,23,42,0.10); border: 1px solid rgba(15,23,42,0.04); }
.login-header { text-align: center; margin-bottom: 28px; }
.login-logo { width: 64px; height: 64px; object-fit: contain; display: block;
              margin: 0 auto 14px; }
.login-brand { font-size: 20px; font-weight: 600; color: #0f172a; letter-spacing: -0.01em; margin-bottom: 6px; }
.login-tagline { font-size: 12px; color: #64748b; }
.login-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; line-height: 1.4; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 12px; font-weight: 500; color: #334155; }
.form-field input { padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; color: #0f172a; transition: border-color 0.15s, box-shadow 0.15s; background: white; }
.form-field input:hover { border-color: #94a3b8; }
.form-field input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.login-btn { margin-top: 8px; padding: 11px 16px; background: #0f172a; color: white; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color 0.15s, transform 0.05s; }
.login-btn:hover { background: #1e293b; }
.login-btn:active { transform: scale(0.99); }

.whoami { max-width: 720px; margin: 24px auto; background: white; padding: 20px; border: 1px solid #e5e7eb; border-radius: 8px; }
.userinfo { list-style: none; padding: 0; margin: 0 0 20px 0; font-size: 13px; }
.userinfo li { padding: 4px 0; }
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; color: white; }
.role-badge.role-admin { background: #b91c1c; }
.role-badge.role-rop { background: #2563eb; }
.role-badge.role-manager { background: #6b7280; }
.role-block { padding: 12px 16px; margin: 12px 0; border-radius: 6px; border-left: 4px solid; }
.role-block h3 { margin: 0 0 6px 0; font-size: 13px; }
.role-block p { margin: 0; font-size: 12px; color: #555; }
.role-block.role-everyone { background: #f3f4f6; border-color: #6b7280; }
.role-block.role-rop { background: #dbeafe; border-color: #2563eb; }
.role-block.role-admin { background: #fee2e2; border-color: #b91c1c; }
.whoami button { padding: 6px 14px; background: #111; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; }

/* Phase 5e — v2 evaluation block */

.eval-block-v2 .eval-header { gap: 10px; flex-wrap: wrap; }
.eval-block-v2.eval-block { border-left-width: 4px; }

.risk-band-low { border-left-color: #10b981; }
.risk-band-medium { border-left-color: #f59e0b; }
.risk-band-high { border-left-color: #dc2626; }
.risk-band-n_a { border-left-color: #94a3b8; }

.risk-band-label { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.risk-band-label.risk-band-low { background: #d1fae5; color: #047857; }
.risk-band-label.risk-band-medium { background: #fef3c7; color: #92400e; }
.risk-band-label.risk-band-high { background: #fee2e2; color: #b91c1c; }
.risk-band-label.risk-band-n_a { background: #f3f4f6; color: #6b7280; }

.client-type-pill { font-size: 10px; padding: 1px 7px; border-radius: 8px; background: #e0e7ff; color: #3730a3; font-weight: 500; }

.eval-risk-context { margin: 10px 0; padding: 10px 12px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 4px; }
.eval-risk-context .label { color: #92400e; margin-bottom: 4px; }
.risk-context-text { font-size: 12px; line-height: 1.5; color: #333; }

.cat-breakdown { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.cat-breakdown td { padding: 4px 8px; border-bottom: 1px solid #f1f5f9; }
.cat-row-critical .cat-name { font-weight: 600; color: #b91c1c; }
.cat-row-warn .cat-name { font-weight: 500; color: #92400e; }
.cat-row-ok .cat-name { color: #047857; }
.cat-row-na .cat-name { color: #6b7280; }
.cat-name { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; min-width: 130px; }
.cat-bar-cell { width: 30%; min-width: 100px; }
.cat-bar { background: #f1f5f9; height: 8px; border-radius: 4px; overflow: hidden; }
.cat-bar-fill { background: #94a3b8; height: 100%; transition: width 0.2s; }
.cat-row-ok .cat-bar-fill { background: #10b981; }
.cat-row-warn .cat-bar-fill { background: #f59e0b; }
.cat-row-critical .cat-bar-fill { background: #dc2626; }
.cat-rate { width: 50px; text-align: right; font-variant-numeric: tabular-nums; }
.cat-counts { width: 50px; text-align: right; color: #6b7280; font-size: 11px; font-variant-numeric: tabular-nums; }
.cat-warn { width: 80px; font-size: 11px; }

.cat-section { margin-top: 14px; padding-top: 10px; border-top: 1px solid #f1f5f9; }
.cat-section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.cat-section-title { font-weight: 600; font-size: 13px; color: #111; }
.cat-section-counts { font-size: 11px; color: #6b7280; }
.cat-section-desc { font-size: 11px; color: #6b7280; line-height: 1.4; margin: 4px 0 10px 0; padding-left: 0; font-style: italic; }

.cat-info-icon { display: inline-block; margin-left: 4px; color: #94a3b8; font-size: 11px; cursor: help; }
.cat-info-icon:hover { color: #2563eb; }
.cat-name { cursor: help; }

.rop-help { margin: 8px 0 12px 0; }
.rop-help summary { cursor: pointer; font-size: 11px; color: #2563eb; padding: 4px 0; user-select: none; }
.rop-help summary:hover { text-decoration: underline; }
.rop-help[open] summary { color: #1d4ed8; font-weight: 500; }
.rop-help-body { font-size: 11px; color: #475569; padding: 8px 12px; background: #eff6ff; border-radius: 4px; border-left: 3px solid #3b82f6; line-height: 1.5; margin-top: 4px; }
.rop-help-body strong { color: #1e40af; }

.metric-card { padding: 8px 10px; margin-bottom: 6px; border-radius: 4px; border-left: 3px solid #e5e7eb; background: #f8fafc; }
.metric-card-pass { border-left-color: #10b981; }
.metric-card-fail { border-left-color: #dc2626; background: #fef2f2; }
.metric-card-skip { border-left-color: #94a3b8; background: #f3f4f6; opacity: 0.85; }
.metric-card-head { display: flex; gap: 8px; align-items: baseline; }
.metric-card-head .metric-mark { font-weight: 600; }
.metric-card-pass .metric-mark { color: #047857; }
.metric-card-fail .metric-mark { color: #b91c1c; }
.metric-card-skip .metric-mark { color: #6b7280; }
.metric-id { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 10px; color: #6b7280; }
.metric-card .metric-title { font-size: 12px; font-weight: 500; flex: 1; }
.metric-card .metric-quote { color: #555; font-style: italic; font-size: 11px; padding-left: 24px; margin-top: 4px; }
.metric-segref { color: #94a3b8; font-style: normal; font-size: 10px; }
.metric-card .metric-violation { color: #b91c1c; font-size: 11px; padding-left: 24px; margin-top: 4px; }
.metric-context-comment { color: #334155; font-size: 12px; padding-left: 24px; margin-top: 6px; line-height: 1.5; border-left: 2px solid #e5e7eb; padding-bottom: 2px; }

.eval-warnings { color: #92400e; }
.eval-needs-review { color: #b91c1c; }

.eval-skipped-banner { background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 6px; padding: 14px 16px; margin-bottom: 10px; }
.eval-skipped-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: #374151; }
.eval-skipped-reason { font-size: 12px; margin-bottom: 4px; }
.eval-skipped-reason code { background: #e5e7eb; padding: 1px 6px; border-radius: 3px; font-size: 11px; }
.eval-skipped-help { font-size: 11px; }

.status-eval_skipped { background: #f3f4f6; color: #6b7280; }

/* Library — РОП editing UI (Phase 5c) */
.metrics-table th.center, .metrics-table td.center { text-align: center; }
.row-inactive { opacity: 0.55; }
.row-override { background: #fffbeb; }
.row-override:hover { background: #fef3c7 !important; }
.active-yes { color: #047857; font-weight: 700; font-size: 14px; }
.active-no { color: #b91c1c; font-weight: 700; font-size: 14px; }
.core-for-cell { max-width: 240px; line-height: 1.8; }
.ct-chip { display: inline-block; background: #f0f9ff; color: #075985;
           padding: 1px 6px; border-radius: 8px; font-size: 10px;
           margin-right: 3px; margin-bottom: 2px;
           font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.override-badge { display: inline-block; background: #f59e0b; color: #fff;
                  padding: 1px 8px; border-radius: 10px; font-size: 10px;
                  font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.default-badge { display: inline-block; background: #e5e7eb; color: #4b5563;
                 padding: 1px 8px; border-radius: 10px; font-size: 10px;
                 letter-spacing: 0.05em; }

.edit-card { border-color: #fcd34d; background: #fffbeb; }
.metric-edit-form { display: flex; flex-direction: column; gap: 12px;
                    margin-top: 8px; }
.edit-row { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.edit-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.weight-input { width: 90px; padding: 6px 8px; font-size: 14px;
                border: 1px solid #d1d5db; border-radius: 4px; }
.ct-checkboxes { display: grid; grid-template-columns: repeat(2, 1fr);
                 gap: 4px 16px; margin-top: 4px; }
.ct-checkbox { display: flex; align-items: center; gap: 6px; font-size: 12px;
               cursor: pointer; line-height: 1.4; }
.ct-checkbox code { font-size: 10px; }

.edit-actions { flex-direction: row; gap: 10px; margin-top: 6px; }
.btn-save { background: #047857; color: #fff; border: none; padding: 8px 18px;
            border-radius: 4px; font-size: 13px; font-weight: 500;
            cursor: pointer; }
.btn-save:hover { background: #065f46; }
.btn-reset { background: #fff; color: #b91c1c; border: 1px solid #fca5a5;
             padding: 8px 14px; border-radius: 4px; font-size: 13px;
             cursor: pointer; }
.btn-reset:hover { background: #fef2f2; }

.audit-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.audit-table th { padding: 6px 8px; background: #f9fafb; text-align: left;
                  font-weight: 500; color: #4b5563;
                  border-bottom: 1px solid #e5e7eb; }
.audit-table td { padding: 6px 8px; border-bottom: 1px solid #f3f4f6;
                  vertical-align: top; }
.audit-old { color: #6b7280; }
.audit-new { color: #111; font-weight: 500; }
.audit-bool-true { color: #047857; font-weight: 600; }
.audit-bool-false { color: #b91c1c; font-weight: 600; }

/* Overlay от ручного ревью на карточке метрики */
.review-badge { display: inline-block; padding: 1px 8px; border-radius: 10px;
                font-size: 10px; font-weight: 500; margin-left: 6px;
                letter-spacing: 0.02em; }
.review-agree { background: #d1fae5; color: #047857; }
.review-disagree { background: #fee2e2; color: #b91c1c; }
.review-irrelevant { background: #e5e7eb; color: #4b5563; }
.review-correction { font-size: 11px; color: #b91c1c; padding-left: 24px;
                     margin-top: 4px; line-height: 1.45;
                     border-left: 2px solid #fca5a5; padding: 4px 10px;
                     background: #fef2f2; border-radius: 0 4px 4px 0; }
.eval-score-after { display: inline-block; margin-left: 10px; padding: 2px 10px;
                    background: #fef3c7; color: #92400e; border-radius: 12px;
                    font-size: 12px; font-weight: 500; }
.eval-score-after strong { color: #78350f; font-weight: 600; }

.page-actions { display: flex; justify-content: flex-end; margin: 0 0 10px; }
.btn-download { display: inline-flex; align-items: center; gap: 6px;
                padding: 6px 14px; background: #4f46e5; color: #fff;
                border-radius: 6px; text-decoration: none; font-size: 13px;
                font-weight: 500; transition: background 0.15s; }
.btn-download::before { content: "⬇"; font-size: 14px; }
.btn-download:hover { background: #4338ca; }

/* Info-callout внутри edit-card (Core_for объяснение) */
.info-callout { background: #eff6ff; border-left: 3px solid #3b82f6;
                color: #1e3a8a; padding: 8px 10px 8px 12px; margin: 6px 0;
                border-radius: 0 4px 4px 0; font-size: 12px; line-height: 1.5; }
.info-callout strong { color: #1e40af; }
.info-callout code { background: #dbeafe; padding: 0 4px; border-radius: 3px;
                     font-size: 11px; }
.info-callout li { margin-bottom: 3px; }

/* Полный промпт для прозрачности РОПа */
.prompt-card { background: #fafafa; }
.prompt-card summary { cursor: pointer; padding: 4px 0; font-size: 13px; }
.prompt-card summary:hover { color: #4338ca; }
.prompt-pre { background: #1f2937; color: #e5e7eb; padding: 12px;
              border-radius: 4px; font-size: 11px; line-height: 1.5;
              overflow-x: auto; max-height: 380px;
              font-family: ui-monospace, "SF Mono", Menlo, monospace;
              white-space: pre-wrap; word-break: break-word; }

/* Back-link на странице /admin/metrics/{id} */
.back-link { display: inline-block; color: #4338ca; text-decoration: none;
             font-size: 13px; margin-bottom: 8px; }
.back-link:hover { text-decoration: underline; }
