/* ─────────────────────────────────────────────────────────────────────
   Экраны продукта поверх «Маршрута» (design/components.css).
   Только токены из design/tokens.css — своих цветов и размеров нет.
   ───────────────────────────────────────────────────────────────────── */

.skip { position: absolute; left: -999px; top: 8px; z-index: 50; padding: 8px 16px; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent); }
.skip:focus { left: 8px; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.stack { display: flex; flex-direction: column; gap: var(--space-6); }
.lead { margin: 0; font-size: 17px; color: var(--text-secondary); }
.is-good { color: var(--status-good-text); }
.is-warning { color: var(--status-warning-text); }
.is-critical { color: var(--status-critical-text); }
.is-now { color: var(--now); font-weight: 700; }
.plain { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* Сайдбар: пользователь внизу */
.sidebar__user { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0 6px; }
.sidebar__name { font-size: var(--fs-small); font-weight: 600; color: var(--text-secondary); }
.sidebar__user .btn--text { padding: 0; min-height: 32px; }
@media (max-width: 1279px) { .sidebar__name { display: none; } .sidebar__user { align-items: center; } }

/* Шапка страницы */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-4) var(--space-6); }
.page-head__title { display: flex; flex-direction: column; gap: 6px; margin-right: auto; min-width: 0; }
.page-head__search { width: min(360px, 100%); }
.page-head--call .h1 { overflow-wrap: anywhere; }
.back { font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tag--link { color: var(--accent); }
.tag--link:hover { text-decoration: none; background: var(--accent-wash); }
.tag--sm { min-height: 24px; padding: 0 9px; font-size: 12.5px; }

/* Сегменты-ссылки ведут себя как кнопки из design */
.segmented a {
    display: inline-flex; align-items: center; min-height: var(--control-h-sm); padding: 0 16px;
    border: 1.5px solid var(--route-idle); border-radius: var(--radius-pill);
    color: var(--text); font: 500 15px var(--font);
}
.segmented a:hover { text-decoration: none; background: var(--surface-hover); }
.segmented a[aria-pressed="true"] { border-color: var(--text); background: var(--text); color: var(--on-accent); font-weight: 700; }

.section { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.section__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-3); }
.section__head .h2, .section__head .h3 { margin-right: 4px; }
.section__head > a { margin-left: auto; font-size: 15px; }
.section__sub { margin-top: var(--space-4); }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-12); align-items: start; }
.split--wide { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); }

/* Главное число и показатели */
.hero { display: grid; grid-template-columns: minmax(260px, 4fr) minmax(0, 8fr); gap: var(--space-12); align-items: end; }
.hero .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric--hero .hero-num { display: block; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--space-6); }
.metrics--wide { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
a.metric__delta { font-weight: 700; }

/* Маршрут: подписи станций и варианты */
.route__name { font-size: 14px; font-weight: 600; line-height: 1.25; padding: 0 4px; }
.route__value { font-size: var(--fs-micro); font-weight: 600; color: var(--text-muted); }
.route__value.is-weak { color: var(--status-warning-text); }
.route__value.is-failed { color: var(--status-critical-text); }
a.route__stop { color: var(--text); font-weight: 400; }
a.route__stop:hover { text-decoration: none; }
a.route__stop:hover .route__name { color: var(--accent); }
.route--blocks .route__value { font-size: 15px; font-weight: 700; color: var(--text); }
.route--compact { --station: 16px; min-width: 190px; }
.route--compact::before { height: 4px; top: 6px; left: 8px; right: 8px; }
.route--compact .station { border-width: 3px; font-size: 9px; }
.route--compact .station--current { border-width: 4px; }
.route--compact .route__value { font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.route--compact .route__stop { gap: 2px; }
.route--compact .station--failed { font-size: 0; }
.route--main { --station: 38px; }
.route--main::before { height: 10px; top: 14px; }
.route--main .route__value { font-size: var(--fs-num); font-weight: 800; color: var(--text); letter-spacing: -0.5px; line-height: 1; }
.route--steps .route__stop { gap: 6px; }
.route--steps .meta { max-width: 240px; }
.route--dark::before { background: linear-gradient(to right, var(--on-accent) 0 var(--done, 0%), rgba(255, 255, 255, 0.35) var(--done, 0%)); }
.route--dark .station { background: var(--accent); border-color: rgba(255, 255, 255, 0.45); }
.route--dark .station--done { background: var(--on-accent); border-color: var(--on-accent); }
.route--dark .station--current { border-color: var(--on-accent); }
.station--idle { width: 24px; height: 24px; border-width: 5px; }
.station--xs { display: inline-block; width: 14px; height: 14px; border-width: 3px; vertical-align: -2px; font-size: 0; }
.station--xs.station--current { border-width: 4px; }
.funnel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-8); align-items: start; }
.funnel__lost { display: flex; align-items: center; gap: var(--space-3); padding: 8px 20px 8px 8px; border-radius: var(--radius-pill); background: var(--surface-sunken); color: var(--text-secondary); }

/* Требует внимания */
.attention { display: flex; flex-direction: column; }
.attention__item { display: grid; grid-template-columns: minmax(64px, auto) minmax(0, 1fr); align-items: baseline; gap: var(--space-3); padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--text); font-weight: 500; }
.attention__item:hover { text-decoration: none; background: var(--surface-hover); }
.attention__item .num { font-size: var(--fs-num); font-weight: 800; letter-spacing: -0.5px; line-height: 1; }
.attention__item--critical .num { color: var(--status-critical-text); }
.attention__item--warning .num { color: var(--status-warning-text); }

.timeline__item:hover { text-decoration: none; background: var(--surface-hover); border-radius: var(--radius-field); }
.timeline__item.is-current { background: var(--accent-wash); border-radius: var(--radius-field); }

/* Таблицы: строка целиком ведёт в карточку */
tr[data-href] { cursor: pointer; }
.table--compact td { height: 48px; }
.table--compact th, .table--compact td { padding: 0 10px; }
.table .cell-route { min-width: 200px; }
.table .cell-focus { max-width: 320px; font-size: var(--fs-small); color: var(--text-secondary); line-height: 1.4; }
.th-sort { color: inherit; font-weight: inherit; }
.row-snippet td { height: auto; padding-top: 0; padding-bottom: 14px; }
.row-snippet td a { margin-left: var(--space-3); font-size: var(--fs-small); }
tr:has(+ .row-snippet) td { border-bottom: 0; }
.snippet { font-size: var(--fs-small); color: var(--text-secondary); }
mark { background: var(--status-warning-wash); color: var(--text); font-weight: 700; border-radius: 4px; padding: 0 2px; }
.pager .btn[aria-disabled="true"] { border-color: var(--line); color: var(--text-muted); pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); align-items: center; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }

/* Панель фильтров */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-6); }
.toolbar--stack { flex-direction: column; align-items: stretch; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.chip__remove { display: inline-grid; place-items: center; text-decoration: none; }
a.chip__remove:hover { color: var(--on-accent); text-decoration: none; }
.filters { position: relative; }
.filters > summary { list-style: none; cursor: pointer; }
.filters > summary::-webkit-details-marker { display: none; }
.filters__panel {
    position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; width: min(420px, calc(100vw - 32px));
    display: grid; gap: var(--space-4); padding: var(--space-6);
    border-radius: var(--radius-area); background: var(--surface); box-shadow: var(--shadow-float);
}
.filters-inline { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.select--sm { width: auto; min-height: var(--control-h-sm); padding: 0 12px; }
.input--sm { min-height: var(--control-h-sm); }
.tabs a[role="tab"] { display: inline-flex; align-items: center; gap: 6px; min-height: var(--control-h); border-bottom: 3px solid transparent; color: var(--text-secondary); font-weight: 500; }
.tabs a[role="tab"]:hover { text-decoration: none; color: var(--text); }
.tabs a[role="tab"][aria-selected="true"] { border-bottom-color: var(--accent); color: var(--text); font-weight: 700; }
.tabs { overflow-x: auto; }

/* Пустые состояния */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); padding: var(--space-12) 0; }
.empty--inline { padding: var(--space-6) 0; }

/* ─── Разбор звонка ───────────────────────────────────────────────── */

.verdict { display: flex; flex-direction: column; gap: var(--space-8); }
.verdict--plain { display: block; }
.verdict__score { display: flex; align-items: center; gap: 20px; }
.verdict__text { display: flex; flex-direction: column; gap: 4px; font-size: 15px; line-height: 1.45; }
.verdict__text strong { font-size: var(--fs-h3); }
.score--lg { flex-direction: column; gap: 2px; line-height: 1; }
.score__of { font-size: var(--fs-micro); font-weight: 500; color: var(--text-muted); }
.area--status { display: flex; flex-direction: column; gap: 6px; }
.area--status p { margin: 0; }

.call-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-12); align-items: start; }
.call-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.call-side { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow: auto; padding-bottom: 8px; }

.player {
    display: flex; align-items: center; gap: 14px; padding: 8px 16px 8px 8px;
    border-radius: var(--radius-pill); background: var(--surface-sunken);
}
.player__play { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); cursor: pointer; }
.player__play:hover { background: var(--accent-hover); }
.player__play .i-pause, .player.is-playing .player__play .i-play { display: none; }
.player.is-playing .player__play .i-pause { display: block; }
.player__time { font-size: var(--fs-small); font-weight: 600; min-width: 42px; }
.player__track { position: relative; flex: 1; height: 6px; border-radius: var(--radius-pill); background: var(--route-idle); cursor: pointer; }
.player__track::after { content: ""; position: absolute; inset: -12px 0; }
.player__fill { width: 0; height: 100%; border-radius: var(--radius-pill); background: var(--accent); pointer-events: none; }
.player__marker {
    position: absolute; z-index: 1; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; padding: 0;
    border: 4px solid var(--surface-sunken); border-radius: 50%; background: var(--status-warning); cursor: pointer;
}
.player__marker--critical { width: 22px; height: 22px; margin: -11px 0 0 -11px; background: var(--status-critical); }
.player__marker--serious { background: var(--status-serious); }
.player__marker--objection { background: var(--surface); border-color: var(--status-warning); border-width: 3px; }
.player__marker--price { background: var(--surface); border-color: var(--accent); border-width: 3px; }
.player__speed { min-width: 44px; min-height: 32px; border: 1.5px solid var(--route-idle); border-radius: var(--radius-pill); background: var(--surface); color: var(--text); font: 700 13px var(--font); cursor: pointer; }
.player__hint { margin: -8px 0 0 12px; font-size: var(--fs-micro); }

.follow { margin-left: auto; font-size: var(--fs-small); color: var(--text-secondary); min-height: 32px; }
.follow input { width: 18px; height: 18px; }
.dialogue { margin: 0; padding: 0; list-style: none; }
.dialogue.timeline::before { left: 67px; }
.reply { position: relative; display: grid; grid-template-columns: 52px 32px minmax(0, 1fr); align-items: start; padding: 6px 0; border-radius: var(--radius-field); scroll-margin: 120px; transition: background var(--dur-state) var(--ease); }
.reply__time { font-size: 15px; font-weight: 700; padding-top: 1px; }
.reply__role { margin-right: 4px; font-size: var(--fs-micro); font-weight: 700; color: var(--text-muted); }
.reply__text { margin: 0; padding: 0 12px 0 10px; font-size: 16px; line-height: 1.55; max-width: 700px; }
.reply--client .reply__text { color: var(--text-secondary); }
.reply--employee .reply__role { color: var(--accent); }
.reply--employee .timeline__dot { background: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.reply .timeline__dot--warning { background: var(--status-warning); box-shadow: 0 0 0 2px var(--status-warning); }
.reply .timeline__dot--critical { background: var(--status-critical); box-shadow: 0 0 0 2px var(--status-critical); }
.reply--critical { background: var(--status-critical-wash); }
.reply--serious, .reply--medium { background: var(--status-warning-wash); }
.reply.is-now { background: var(--accent-wash); }
.reply.is-now .timeline__dot { background: var(--now); box-shadow: 0 0 0 2px var(--now); }
.reply.is-now .reply__time { color: var(--now); }

.violation { display: flex; flex-direction: column; gap: 12px; }
.violation--critical { background: var(--status-critical-wash); }
.violation--serious { background: var(--status-serious-wash); }
.violation--medium { background: var(--status-warning-wash); }
.violation__type { font-size: 15px; font-weight: 700; color: var(--status-warning-text); }
.violation--critical .violation__type { color: var(--status-critical-text); }
.violation--serious .violation__type { color: var(--status-serious-text); }
.violation--minor .violation__type { color: var(--text-secondary); }
.violation__comment, .violation__instead { margin: 0; font-size: 15px; line-height: 1.5; color: var(--text-secondary); }
.violation .quote { font-size: 22px; }
.violation.is-cancelled { background: var(--surface-sunken); }
.violation.is-cancelled .quote { color: var(--text-muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.review { display: flex; flex-direction: column; gap: var(--space-2); }
.review--done { flex-direction: row; flex-wrap: wrap; align-items: center; }
.recs { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text-secondary); }
.facts { display: flex; flex-direction: column; gap: var(--space-2); }
.facts p { margin: 0; color: var(--text-secondary); }
.dl { display: grid; grid-template-columns: minmax(110px, auto) minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.dl dt { color: var(--text-muted); font-size: var(--fs-small); font-weight: 600; padding-top: 2px; }
.dl dd { margin: 0; }
.dl--compact { font-size: var(--fs-small); }

/* Блоки оценки и отметки */
.blocks { display: flex; flex-direction: column; }
.block { border-bottom: 1px solid var(--line); }
.block > summary { display: grid; grid-template-columns: minmax(160px, 260px) minmax(0, 1fr) 90px; align-items: center; gap: var(--space-6); min-height: 60px; cursor: pointer; list-style: none; }
.block > summary::-webkit-details-marker { display: none; }
.block > summary:hover .block__name { color: var(--accent); }
.block__name { font-weight: 700; }
.block__value { text-align: right; font-weight: 700; }
.block[open] > summary { border-bottom: 1px dashed var(--line); }
.block > :not(summary) { margin: 12px 0 20px; }
.bar { height: 8px; border-radius: var(--radius-pill); background: var(--line); overflow: hidden; }
.bar__fill { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--route-idle); }
.bar__fill--good { background: var(--status-good); }
.bar__fill--warning { background: var(--status-warning); }
.bar__fill--critical { background: var(--status-critical); }

.marks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.mark { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: var(--space-3); align-items: start; padding: 8px 0; line-height: 1.45; }
.mark__meta { font-size: var(--fs-small); white-space: nowrap; }
.mark__icon { width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 3px solid var(--route-idle); display: grid; place-items: center; font-size: 12px; font-weight: 800; line-height: 1; }
.mark--done .mark__icon { background: var(--accent); border-color: var(--accent); }
.mark--done .mark__icon::after { content: "✓"; color: var(--on-accent); }
.mark--partial .mark__icon { border-color: var(--status-warning); background: linear-gradient(90deg, var(--status-warning) 50%, var(--surface) 50%); }
.mark--missed .mark__icon { background: var(--status-critical); border-color: var(--status-critical); }
.mark--missed .mark__icon::after { content: "✕"; color: var(--on-accent); font-size: 10px; }
.mark--na .mark__icon, .mark--checklist .mark__icon { border-style: dashed; }
.mark--na > span:nth-child(2) { color: var(--text-muted); }
.objection { padding: 8px 0 12px; border-bottom: 1px dashed var(--line); }
.objection:last-child { border-bottom: 0; }
.objection__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-3); }
.script { columns: 2; column-gap: var(--space-12); }
.script__section { display: flex; flex-direction: column; gap: 6px; break-inside: avoid; margin-bottom: var(--space-8); }
.details > summary { cursor: pointer; list-style: none; }
.details > summary::-webkit-details-marker { display: none; }
.details > summary .h3 { display: inline; }
.details > summary::before { content: "▸ "; color: var(--accent); }
.details[open] > summary::before { content: "▾ "; }
.tech { margin-top: calc(-1 * var(--space-6)); }

/* Менеджер: график и зоны роста */
.chart { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.chart svg { width: 100%; height: auto; max-width: 900px; overflow: visible; }
.chart__grid { stroke: var(--line); stroke-width: 1; }
.chart__grid--std { stroke: var(--border-strong); stroke-dasharray: 6 6; }
.chart__axis { fill: var(--text-muted); font: 500 12px var(--font); }
.chart__line { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.chart__dot { fill: var(--surface); stroke-width: 4; }
.chart__dot--good { stroke: var(--status-good); }
.chart__dot--warning { stroke: var(--status-warning); }
.chart__dot--critical { stroke: var(--status-critical); }
.table--trend { max-width: 900px; }
.gaps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.gap { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--space-3); padding: 12px 0; border-bottom: 1px solid var(--line); }
.gap__rate { font-size: var(--fs-num); font-weight: 800; letter-spacing: -0.5px; line-height: 1; }
.vt { margin: 0; padding: 0; list-style: none; }
.vt li { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* Вход */
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 520px); min-height: 100vh; }
.login__art { display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-12); padding: 56px; background: var(--accent); color: var(--on-accent); }
.login__lockup { width: 280px; height: auto; }
.login__route .route__stop { color: var(--on-accent); }
.login__claim { margin: 0; max-width: 520px; font-size: var(--fs-h2); font-weight: 700; line-height: 1.3; }
.login__form { display: flex; align-items: center; justify-content: center; padding: 40px 56px; }
.login__form form { width: 100%; max-width: 400px; gap: var(--space-4); }
.login__mark { display: none; }

/* Уведомления */
.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; }
.toast { animation: toast-in var(--dur-panel) var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* ─── Ширины ──────────────────────────────────────────────────────── */

@media (max-width: 1279px) {
    .hero, .verdict { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); }
    .call-grid { grid-template-columns: minmax(0, 1fr); }
    .call-side { position: static; max-height: none; overflow: visible; }
    .split, .split--wide { grid-template-columns: minmax(0, 1fr); }
    .script { columns: 1; }
    .hero .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 759px) {
    .bottom-nav a { gap: 2px; }
    .bottom-nav .nav__icon { width: 18px; height: 18px; }
    .page-head { align-items: stretch; flex-direction: column; }
    .page-head__search { width: 100%; }
    .route--blocks, .route--main { overflow-x: auto; grid-auto-columns: minmax(112px, 1fr); padding-bottom: 6px; }
    .route--blocks .route__name { font-size: var(--fs-micro); }
    .route--main .route__value { font-size: var(--fs-h3); }
    .funnel { grid-template-columns: minmax(0, 1fr); }
    .block > summary { grid-template-columns: minmax(0, 1fr) 80px; }
    .block > summary .bar { grid-column: 1 / -1; grid-row: 2; margin-bottom: 12px; }
    .reply { grid-template-columns: 48px 24px minmax(0, 1fr); }
    .dialogue.timeline::before { left: 58px; }
    .reply__text { font-size: 16px; }
    /* Плеер закреплён внизу вместо меню */
    body:has(.player) .bottom-nav { display: none; }
    .player { position: fixed; left: 12px; right: 12px; bottom: 16px; z-index: 30; background: var(--surface); box-shadow: var(--shadow-bar); }
    .player__hint { display: none; }
    .player__speed { display: none; }
    .login { grid-template-columns: minmax(0, 1fr); }
    .login__art { display: none; }
    .login__mark { display: block; }
    .login__form { padding: 32px 16px; align-items: flex-start; }
    .vt li { grid-template-columns: minmax(0, 1fr) auto; }
    .vt li .tag { grid-column: 1 / -1; justify-self: start; }
}
