/* ==========================================================================
   Раздел СТАТИСТИКА. Опирается на токены и кнопки из ../styles.css.

   Телефон — одна колонка: фильтры со сводкой, динамика, выработка и разбивки.
   Широкий экран — фильтры со сводкой и динамика слева, справа карточки;
   от 75em разбивки встают в два столбца.

   Цвета состояний — ступени оттенков по всему сайту (выполнено зелёный,
   отказ фиолетовый, недозвон ×3 голубой, недозвон ×1/×2 жёлтый, в работе
   красный).
   ========================================================================== */

:root{
  --st-done: #27a55e;
  --st-rejected: #9b6ae6;
  --st-nodial: #2fa3c4;
  --st-miss: #eab308;
  --st-open: #e5564f;
  --st-hm-all: #94a3b8;
  --st-muted: rgba(255, 255, 255, .20);
  --st-grid: rgba(255, 255, 255, .08);
}
[data-theme="light"]{
  --st-done: #1f9d55;
  --st-rejected: #7c3aed;
  --st-nodial: #0e8fb0;
  --st-miss: #ca8a04;
  --st-open: #dc4a43;
  --st-hm-all: #64748b;
  --st-muted: rgba(17, 20, 24, .18);
  --st-grid: rgba(17, 20, 24, .09);
}

/* ------------------------------- каркас ---------------------------------- */

.st-main{ max-width:96rem; }
.st-layout{ display:flex; flex-direction:column; gap:0.875rem; transition:opacity 200ms ease; }
/* Обновление в фоне: прежние цифры остаются на месте, чуть приглушены. */
.st-layout.is-refreshing{ opacity:.6; }
.st-side, .st-content{ display:flex; flex-direction:column; gap:0.875rem; min-width:0; }

.st-loading{ margin-top:3rem; text-align:center; font-size:0.8125rem; color:var(--text-2); line-height:1.6; }
.st-loading .btn{ margin-top:0.75rem; }

.st-updated{ flex:none; font-size:0.625rem; color:var(--text-3); white-space:nowrap; text-transform:none; }
.st-hdr-btn{ padding:0 0.5rem; font-size:0.625rem; }
#st-refresh.is-busy svg{ animation:st-spin 0.9s linear infinite; }
@keyframes st-spin{ to{ transform:rotate(360deg); } }
@media (max-width: 34em){
  .st-updated{ display:none; }
  .st-hdr-btn{ padding:0 0.4375rem; font-size:0.5625rem; }
}

@media (min-width: 64em){
  html{ font-size:112.5%; }   /* как и раньше: на большом экране всё на 12,5% крупнее */
  .main.st-main{ padding-top:1.25rem; }
  .st-layout{ display:grid; grid-template-columns:22rem minmax(0, 1fr); gap:1.25rem; align-items:start; }
  .st-content{ display:grid; grid-template-columns:minmax(0, 1fr); gap:1.25rem; }
}
@media (min-width: 75em){
  .st-content{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .st-wide{ grid-column:1 / -1; }
}

/* ------------------------------- карточки -------------------------------- */

.stat-card{
  background:var(--surface);
  border:1px solid var(--hairline);
  border-radius:var(--radius-lg);
  padding:1rem;
  min-width:0;
}
@media (min-width: 40em){ .stat-card{ padding:1.25rem; } }

.stat-card__head{
  display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap;
  gap:0.5rem 0.75rem; margin-bottom:0.75rem;
}
.stat-card__title{
  margin:0; min-width:0;
  font-size:0.6875rem; font-weight:700; letter-spacing:.04em; color:var(--text-2);
}
.st-card-sub{ margin:-0.25rem 0 0.75rem; font-size:0.6875rem; line-height:1.45; color:var(--text-3); }
.st-sub{ margin:0 0 0.625rem; font-size:0.625rem; font-weight:700; letter-spacing:.05em; color:var(--text-3); }
.st-empty{ margin:0.25rem 0; font-size:0.75rem; color:var(--text-3); }
.st-note{ margin:0.625rem 0 0; font-size:0.6875rem; line-height:1.45; color:var(--text-3); }

/* ------------------------------- фильтры --------------------------------- */

.st-filters{ display:flex; flex-direction:column; gap:0; }
.st-filter-body{ display:flex; flex-direction:column; gap:0.75rem; }
.st-field{ display:flex; flex-direction:column; gap:0.4375rem; min-width:0; }
.st-label{ font-size:0.5625rem; font-weight:700; letter-spacing:.06em; color:var(--text-3); }
.st-seg{ gap:0.3125rem; }
.st-seg .seg-btn{ padding:0.4375rem 0.6875rem; }
/* Кнопки дат постановки — в одну компактную строку без переноса. */
.st-periods{
  display:flex; flex-wrap:nowrap; gap:0.1875rem; align-items:center;
  overflow-x:auto; scrollbar-width:none; -ms-overflow-style:none;
}
.st-periods::-webkit-scrollbar{ display:none; }
.st-periods .seg-btn{
  flex:1 1 auto; min-width:0;
  padding:0.3125rem 0.25rem;
  font-size:0.5625rem; letter-spacing:0; text-align:center;
}
/* Ряд филиалов: на телефоне листается вбок, на десктопе переносится в колонке. */
.st-scroll{
  flex-wrap:nowrap; overflow-x:auto;
  scrollbar-width:none; -ms-overflow-style:none;
  margin:0 -1rem; padding:0 1rem;
  scroll-padding:0 1rem;
}
.st-scroll::-webkit-scrollbar{ display:none; }
.st-scroll .btn{ flex:none; }
@media (min-width: 40em){ .st-scroll{ margin:0 -1.25rem; padding:0 1.25rem; } }
@media (min-width: 64em){
  .st-scroll{ flex-wrap:wrap; overflow:visible; margin:0; padding:0; }
}
.st-filters .filter-select{ flex:none; }

.st-range{ display:grid; grid-template-columns:1fr 1fr; gap:0.375rem; }
.st-date{ display:flex; align-items:center; gap:0.375rem; padding:0.375rem 0.5rem; }
.st-date span{ font-size:0.5625rem; font-weight:700; color:var(--text-3); }
.st-date input{ border:none; outline:none; width:100%; min-width:0; font-size:0.75rem; color-scheme:dark; }
[data-theme="light"] .st-date input{ color-scheme:light; }

.st-scope{ margin:0; font-size:0.6875rem; line-height:1.45; color:var(--text-2); }

/* ------------------------------- сводка под фильтрами -------------------- */

.st-side-stats{
  display:flex; flex-direction:column; gap:0.5rem;
  margin-top:0.75rem; padding-top:0.75rem; border-top:1px solid var(--hairline);
}
.st-sbox{
  display:flex; flex-direction:column; gap:0.375rem;
  padding:0.625rem 0.75rem;
  background:var(--surface-2); border:1px solid var(--hairline); border-radius:var(--radius-md);
}
.st-sbox--today{ border-color:color-mix(in srgb, var(--st-done) 38%, var(--hairline)); }
.st-sbox__head{ display:flex; align-items:baseline; justify-content:space-between; flex-wrap:wrap; gap:0.25rem 0.5rem; }
.st-sbox__title{ font-size:0.5625rem; font-weight:700; letter-spacing:.05em; color:var(--text-3); }
.st-sbox__meta{ font-size:0.625rem; color:var(--text-3); text-transform:none; white-space:nowrap; }
.st-sbox__meta b{ color:var(--text); font-weight:700; }
.st-sbox__main{ display:flex; align-items:baseline; flex-wrap:wrap; gap:0.25rem 0.4375rem; }
.st-sbox__val{ font-size:1.375rem; font-weight:700; line-height:1.05; letter-spacing:-.02em; font-variant-numeric:tabular-nums; }
.st-sbox__unit{ font-size:0.6875rem; color:var(--text-2); text-transform:none; }
.st-sbox .st-bar{ margin-top:0.125rem; }
.st-sbox .st-split{ margin-top:0.125rem; }

.st-cleg{ list-style:none; margin:0.125rem 0 0; padding:0; display:grid; gap:0.2rem; }
.st-cleg li{
  display:grid; grid-template-columns:0.5625rem 1fr auto auto; align-items:center; gap:0.4375rem;
  font-size:0.6875rem; line-height:1.3; text-transform:none;
}
.st-cleg .st-key{ width:0.5625rem; height:0.5625rem; }
.st-cleg__name{ color:var(--text-2); min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.st-cleg__val{ font-weight:700; font-variant-numeric:tabular-nums; text-align:right; }
.st-cleg__pct{ min-width:2.25rem; color:var(--text-3); font-size:0.625rem; font-variant-numeric:tabular-nums; text-align:right; }

/* Полоса состояний: выполнено → отказ → недозвон ×3 → недозвон ×1/×2 → в работе. */
.st-bar{
  display:flex; gap:2px;
  height:0.375rem; margin-top:0.5rem;
  border-radius:var(--radius-sm); overflow:hidden;
}
.st-bar--lg{ height:0.625rem; }
.st-bar--sm{ height:0.25rem; margin-top:0.375rem; }
.st-bar__seg{ flex-basis:0; min-width:2px; }
.st-bar__seg--done{ background:var(--st-done); }
.st-bar__seg--rejected{ background:var(--st-rejected); }
.st-bar__seg--nodial{ background:var(--st-nodial); }
.st-bar__seg--miss1, .st-bar__seg--miss2{ background:var(--st-miss); }
.st-bar__seg--open{ background:var(--st-open); }
.st-bar__seg--empty{ background:var(--st-muted); }

.st-key{ width:0.625rem; height:0.625rem; border-radius:2px; flex:none; display:inline-block; }
.st-key--done{ background:var(--st-done); }
.st-key--rejected{ background:var(--st-rejected); }
.st-key--nodial{ background:var(--st-nodial); }
.st-key--miss1, .st-key--miss2, .st-key--miss{ background:var(--st-miss); }
.st-key--open{ background:var(--st-open); }

/* Легенда строкой над графиком динамики. */
.st-legend{ list-style:none; margin:0 0 0.5rem; padding:0; }
.st-legend--row{ display:flex; flex-wrap:wrap; gap:0.25rem 0.625rem; }
.st-legend--row li{ display:flex; align-items:center; gap:0.3125rem; font-size:0.625rem; text-transform:none; color:var(--text-2); }

.st-tiles{ display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:0.375rem; }
.st-tile{
  display:flex; flex-direction:column; gap:0.25rem; min-width:0;
  padding:0.625rem 0.5625rem;
  background:var(--surface-2); border:1px solid var(--hairline); border-radius:var(--radius-md);
  color:var(--text); font:inherit; text-align:left;
}
.st-tile__label{ font-size:0.5625rem; line-height:1.25; font-weight:700; letter-spacing:.03em; color:var(--text-2); overflow-wrap:anywhere; }
.st-tile__val{ font-size:1.125rem; font-weight:700; line-height:1.1; text-transform:none; white-space:nowrap; }
.st-tile__hint{ font-size:0.5625rem; color:var(--text-3); text-transform:none; overflow-wrap:anywhere; }

.st-split{ display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:0.3125rem; }
.st-split__item{
  display:flex; flex-direction:column; gap:0.125rem; min-width:0;
  padding:0.375rem 0.4375rem;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md);
  color:var(--text); font:inherit; text-align:left; cursor:pointer;
  transition:background var(--dur), color var(--dur);
}
.st-split__label{ font-size:0.5rem; font-weight:700; letter-spacing:.03em; }
.st-split__val{ font-size:0.875rem; font-weight:700; font-variant-numeric:tabular-nums; }
.st-split__item--tasks{ border-color:var(--danger); }
.st-split__item--tasks .st-split__label{ color:var(--danger); }
.st-split__item--tmc{ border-color:var(--ok); }
.st-split__item--tmc .st-split__label{ color:var(--ok); }
.st-split__item--rx{ border-color:var(--blue); }
.st-split__item--rx .st-split__label{ color:var(--blue); }
.st-split__item:hover{ background:var(--surface-2); }

.st-chips{ gap:0.25rem; align-items:center; flex-wrap:wrap; }
.st-chips .seg-btn{ min-width:2rem; padding:0.375rem 0.4375rem; text-align:center; }
.st-chips__unit{ margin-left:0.125rem; font-size:0.625rem; font-weight:700; color:var(--text-3); }

.st-tag{
  padding:0 0.3125rem; border:1px solid currentColor; border-radius:var(--radius-sm);
  font-size:0.5rem; font-weight:700; letter-spacing:.03em; text-transform:uppercase; line-height:1.5;
}
.st-tag--tasks{ color:var(--danger); }
.st-tag--tmc{ color:var(--ok); }
.st-tag--rx{ color:var(--blue); }

/* ------------------------------- динамика -------------------------------- */

.st-chart{ position:relative; width:100%; min-height:185px; }
.st-svg{ display:block; width:100%; height:auto; overflow:visible; }
.st-grid{ stroke:var(--st-grid); stroke-width:1; }
.st-base{ stroke:var(--border); stroke-width:1; }
.st-axis{ fill:var(--text-3); font-family:var(--font-ui); font-size:10px; font-variant-numeric:tabular-nums; }
.st-fill--done{ fill:var(--st-done); }
.st-fill--rejected{ fill:var(--st-rejected); }
.st-fill--nodial{ fill:var(--st-nodial); }
.st-fill--miss1, .st-fill--miss2{ fill:var(--st-miss); }
.st-fill--open{ fill:var(--st-open); }
.st-col{ transition:opacity var(--dur); }
.st-col.is-dim{ opacity:.35; }
.st-hit{ fill:transparent; cursor:pointer; outline:none; }
.st-hit:focus-visible{ stroke:var(--blue); stroke-width:1.5; }

.st-tip{
  position:fixed; z-index:60; pointer-events:none;
  min-width:9rem; max-width:18rem;
  padding:0.5rem 0.625rem;
  background:var(--surface-2); color:var(--text);
  border:1px solid var(--border); border-radius:var(--radius-md);
  box-shadow:0 0.5rem 1.5rem rgba(0, 0, 0, .25);
  font-size:0.6875rem; text-transform:none;
}
.st-tip[hidden]{ display:none; }
.st-tip__title{ margin-bottom:0.3125rem; color:var(--text-2); }
.st-tip__row{ display:flex; align-items:center; gap:0.4375rem; line-height:1.6; }
.st-tip__row b{ min-width:2.25rem; text-align:right; font-variant-numeric:tabular-nums; }
.st-tip__row span:last-child{ color:var(--text-2); white-space:nowrap; }
.st-tip__key{ width:0.75rem; height:2px; border-radius:1px; flex:none; }
.st-tip__total{ margin-top:0.25rem; padding-top:0.25rem; border-top:1px solid var(--hairline); color:var(--text-2); }

.st-table-wrap{ overflow-x:auto; max-height:22rem; overflow-y:auto; }
.st-table-wrap--data{ max-height:none; overflow-y:visible; }
.st-table{ width:100%; border-collapse:collapse; font-size:0.6875rem; }
.st-table th, .st-table td{ padding:0.375rem 0.5rem; border-bottom:1px solid var(--hairline); text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
.st-table th:first-child{ text-align:left; }
.st-table thead th{ position:sticky; top:0; z-index:3; background:var(--surface); color:var(--text-2); font-weight:700; }
.st-table tbody th{ font-weight:400; color:var(--text-2); }

.st-dyn-table{ font-size:0.625rem; }
.st-dyn-table th, .st-dyn-table td{ padding:0.25rem 0.21875rem; }
.st-dyn-table th:first-child{ padding-left:0; }
.st-dyn-table th:last-child, .st-dyn-table td:last-child{ padding-right:0; }

/* ------------------------ выработка врачей по дням ----------------------- */

.st-switch{
  position:relative; display:inline-grid; grid-template-columns:1fr 1fr; align-items:center;
  height:2rem; min-width:5.25rem; padding:0.1875rem;
  border:1px solid var(--border); border-radius:var(--radius-pill);
  background:var(--surface-2); color:var(--text-2);
  font-size:0.625rem; font-weight:700; cursor:pointer;
  transition:border-color var(--dur), background var(--dur);
}
.st-switch:hover{ border-color:var(--fill); }
.st-switch__thumb{
  position:absolute; top:0.1875rem; left:0.1875rem;
  width:calc(50% - 0.1875rem); height:calc(100% - 0.375rem);
  border-radius:var(--radius-pill);
  background:var(--surface); border:1px solid var(--border);
  box-shadow:0 1px 2px rgba(0, 0, 0, .2);
  transition:transform var(--dur) ease, background var(--dur), border-color var(--dur);
}
.st-switch.is-done .st-switch__thumb{
  transform:translateX(100%);
  background:color-mix(in srgb, var(--st-done) 22%, var(--surface));
  border-color:var(--st-done);
}
.st-switch__opt{
  position:relative; z-index:1; text-align:center; padding:0 0.375rem;
  line-height:1; white-space:nowrap; transition:color var(--dur), opacity var(--dur);
}
.st-switch__opt--all{ color:var(--text); }
.st-switch.is-done .st-switch__opt--all{ color:var(--text-3); }
.st-switch__opt--done{ color:var(--st-done); font-size:0.875rem; opacity:.55; }
.st-switch.is-done .st-switch__opt--done{ opacity:1; }

.st-daily-toolbar{ display:grid; grid-template-columns:1fr; gap:0.5rem; margin-bottom:0.75rem; }
@media (min-width: 44em){
  .st-daily-toolbar{ grid-template-columns:minmax(14rem, 1.3fr) minmax(12rem, 1fr); align-items:center; }
}
.st-daily-toolbar .st-daily-select,
.st-daily-toolbar .st-daily-search{
  min-width:0; height:2.25rem; margin:0; padding-top:0; padding-bottom:0;
  border-radius:var(--radius-sm);
}

.st-daily-table th, .st-daily-table td{ padding:0.3125rem 0.3125rem; }
.st-daily-table th:first-child{
  width:1%; min-width:6.75rem; max-width:8.75rem;
  padding-right:0.3125rem;
  white-space:normal; word-break:break-word;
}
@media (min-width: 48em){
  .st-daily-table th:first-child{ min-width:8.75rem; max-width:12.5rem; }
}
.st-daily-table th:nth-child(2),
.st-daily-table td:nth-child(2){
  width:3.25rem; padding-left:0.3125rem; padding-right:0.3125rem;
  text-align:center;
}
.st-th-sub{
  display:block; font-size:0.5rem; font-weight:400; line-height:1.1;
  color:var(--text-3); text-transform:lowercase; margin-top:1px;
}
.st-hm-th{ text-align:center !important; line-height:1.15; min-width:2.35rem; }
.st-hm-th small{ font-weight:400; font-size:0.5625rem; color:var(--text-3); }
.st-hm-th.is-wknd{ color:var(--text-3); }
.st-hm-th.is-today{ color:var(--st-done); }
.st-daily-sum th, .st-daily-sum td{ background:var(--surface-2) !important; font-weight:700; color:var(--text) !important; }
.st-hm-doc{
  display:flex; align-items:flex-start; gap:0.375rem; width:100%; padding:0; border:none;
  background:transparent; color:var(--text); font:inherit; text-align:left; cursor:pointer;
}
.st-hm-doc:hover{ opacity:.8; }
.st-hm-doc__txt{ display:flex; flex-direction:column; min-width:0; }
.st-hm-cell{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:2.1rem; height:1.65rem; padding:0 0.35rem;
  border-radius:var(--radius-sm);
  color:var(--text); font:inherit; font-weight:700; cursor:pointer;
  transition:border-color var(--dur), box-shadow var(--dur);
}
.st-hm-cell--done{
  border:1px solid color-mix(in srgb, var(--st-done) 38%, transparent);
  background:color-mix(in srgb, var(--st-done) calc(var(--hm, 0.16) * 100%), transparent);
  box-shadow:0 0 calc(var(--hm, 0.16) * 9px) color-mix(in srgb, var(--st-done) calc(var(--hm, 0.16) * 45%), transparent);
}
.st-hm-cell--all{
  border:1px solid color-mix(in srgb, var(--st-hm-all) 42%, transparent);
  background:color-mix(in srgb, var(--st-hm-all) calc(var(--hm, 0.16) * 100%), transparent);
  box-shadow:0 0 calc(var(--hm, 0.16) * 9px) color-mix(in srgb, var(--st-hm-all) calc(var(--hm, 0.16) * 42%), transparent);
}
.st-hm-cell:hover, .st-hm-cell.is-active{
  border-color:var(--blue); outline:1px solid var(--blue);
}
.st-hm-zero{ color:var(--text-3); opacity:.45; }
.st-hm-detail td{ padding:0 !important; text-align:left !important; white-space:normal !important; background:var(--surface-2); }
.st-hm-detail__box{
  max-width:46rem; padding:0.625rem 0.875rem;
  border-left:3px solid var(--st-done);
}
.st-hm-detail__box.is-all{ border-left-color:var(--st-hm-all); }
.st-hm-detail__head{
  display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:0.5rem;
  margin-bottom:0.5rem; font-size:0.75rem; color:var(--text-2);
}
.st-hm-detail__meta{ display:flex; align-items:center; flex-wrap:wrap; gap:0.375rem 0.625rem; }
.st-hm-detail__head b{ color:var(--text); }
.st-hm-all-btn{ height:1.75rem; padding:0 0.5rem; font-size:0.625rem; }
.st-task-bd{ list-style:none; margin:0; padding:0; display:grid; gap:0.3125rem; }
.st-task-bd__item{
  display:flex; flex-direction:column; gap:0.25rem;
  padding:0.3125rem 0; border-bottom:1px solid var(--hairline); font-size:0.6875rem;
}
.st-task-bd__item:last-child{ border-bottom:none; }
.st-task-bd__top{
  display:flex; align-items:baseline; flex-wrap:wrap; gap:0.375rem 0.5rem;
}
.st-task-bd__name{ min-width:0; overflow-wrap:anywhere; }
.st-task-bd__val{
  font-weight:700; font-variant-numeric:tabular-nums;
  padding:0.0625rem 0.375rem; border-radius:var(--radius-sm);
  background:var(--surface); border:1px solid var(--hairline); color:var(--text);
}
.st-task-bd__stat{
  display:flex; align-items:center; flex-wrap:wrap; gap:0.375rem 0.625rem;
}
.st-task-bd__bar{
  width:5rem; height:0.3125rem; display:inline-flex; gap:1px;
  border-radius:2px; overflow:hidden; flex:none;
}
.st-task-bd__stat .st-ms{ font-size:0.625rem; color:var(--text-2); }

/* ----------------------------- строки-разбивки --------------------------- */

.st-head-actions{ display:flex; align-items:center; flex-wrap:wrap; gap:0.375rem; }
.st-sort-bar{
  display:flex; align-items:center; flex-wrap:wrap; gap:0.3125rem 0.5rem;
  margin-bottom:0.625rem;
}
.st-sort-bar__lbl{
  font-size:0.5625rem; font-weight:700; letter-spacing:.05em; color:var(--text-3);
  white-space:nowrap;
}
.st-sort-seg{
  flex:1 1 auto; display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:2px;
  padding:2px; border-radius:var(--radius-md);
  background:var(--surface-2); border:1px solid var(--hairline);
}
.st-sort-seg__btn{
  padding:0.34375rem 0.25rem; border:1px solid transparent; border-radius:calc(var(--radius-md) - 2px);
  background:transparent; color:var(--text-2);
  font-family:inherit; font-size:0.5625rem; font-weight:700; line-height:1.15;
  text-align:center; text-transform:none; white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis; cursor:pointer;
  transition:background var(--dur), color var(--dur), border-color var(--dur);
}
.st-sort-seg__btn:hover{ color:var(--text); }
.st-sort-seg__btn.active{
  background:var(--fill); color:var(--bg); border-color:var(--fill);
}
.st-search{ display:flex; align-items:center; gap:0.375rem; margin-bottom:0.25rem; padding:0.4375rem 0.625rem; }
.st-search__ico{ color:var(--text-3); font-size:0.875rem; line-height:1; }
.st-search input{ font-size:0.75rem; }
.st-search input::-webkit-search-cancel-button{ filter:grayscale(1); }

.st-rows{ min-width:0; }
.st-row{ padding:0.75rem 0; border-bottom:1px solid var(--hairline); min-width:0; }
.st-row:last-child{ border-bottom:none; }
.st-rows > .st-more{ margin-top:0.75rem; }

.st-row__head{
  display:flex; align-items:center; gap:0.5rem;
  width:100%; padding:0; border:none; background:transparent;
  color:var(--text); font:inherit; text-align:left; cursor:pointer;
}
.st-row__head:hover .st-row__name{ opacity:.75; }
.st-row__name{
  flex:1 1 auto; min-width:0;
  font-size:0.8125rem; font-weight:700; text-transform:none;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  transition:opacity var(--dur);
}
.st-row__right{ display:inline-flex; align-items:center; gap:0.4375rem; flex:none; }
.st-row__num{ flex:none; font-size:0.75rem; font-weight:700; color:var(--text-2); font-variant-numeric:tabular-nums; }
.st-row__meta{ margin-top:0.1875rem; padding-left:1.125rem; font-size:0.625rem; line-height:1.4; color:var(--text-3); overflow-wrap:anywhere; }
.st-row > .st-bar{ margin-left:1.125rem; margin-top:0.4375rem; }
.st-row > .st-metrics{ margin-left:1.125rem; }

.st-pct{
  display:inline-block; padding:0.125rem 0.4375rem; border-radius:var(--radius-sm);
  font-size:0.6875rem; font-weight:700; font-variant-numeric:tabular-nums;
  background:var(--surface-2); color:var(--text); border:1px solid var(--hairline);
}
.st-pct--sm{ padding:0.0625rem 0.3125rem; font-size:0.625rem; }
.st-pct--good{ color:var(--st-done); border-color:color-mix(in srgb, var(--st-done) 45%, transparent); background:color-mix(in srgb, var(--st-done) 12%, transparent); }
.st-pct--mid{ color:var(--warn); border-color:color-mix(in srgb, var(--warn) 45%, transparent); background:color-mix(in srgb, var(--warn) 12%, transparent); }
.st-pct--low{ color:var(--st-open); border-color:color-mix(in srgb, var(--st-open) 45%, transparent); background:color-mix(in srgb, var(--st-open) 12%, transparent); }

.st-metrics{ display:flex; flex-wrap:wrap; gap:0.3125rem; margin-top:0.4375rem; }
.st-pill{
  display:inline-flex; align-items:center; gap:0.3125rem;
  padding:0.1875rem 0.4375rem;
  background:var(--surface-2); border:1px solid var(--hairline); border-radius:var(--radius-sm);
  font-size:0.6875rem; line-height:1.3; color:var(--text-2);
  font-variant-numeric:tabular-nums;
}
.st-pill i{ width:0.4375rem; height:0.4375rem; border-radius:2px; flex:none; display:inline-block; }
.st-pill b{ color:var(--text); font-weight:700; }
.st-pill small{ font-size:0.625rem; color:var(--text-3); }
.st-pill--done i{ background:var(--st-done); }
.st-pill--rejected i{ background:var(--st-rejected); }
.st-pill--nodial i{ background:var(--st-nodial); }
.st-pill--miss i{ background:var(--st-miss); }
.st-pill--open i{ background:var(--st-open); }

.st-table-wrap--data{ max-height:none; overflow-y:visible; }
.st-data-table th:first-child{ min-width:10rem; max-width:18rem; white-space:normal; word-break:break-word; }
.st-data-table th:first-child, .st-daily-table th:first-child{
  position:sticky; left:0; z-index:2; background:var(--surface);
  box-shadow:1px 0 0 var(--hairline);
}
.st-data-table thead th:first-child, .st-daily-table thead th:first-child{ z-index:5; }
.st-data-table tfoot th, .st-data-table tfoot td{
  position:sticky; bottom:0; z-index:2; background:var(--surface-2);
  font-weight:700; color:var(--text); border-top:1.5px solid var(--border); border-bottom:none;
}
.st-data-table tfoot th:first-child{ z-index:4; }
.st-data-table th.is-left, .st-daily-table th.is-left{ text-align:left; }
.st-th-btn{
  padding:0; border:none; background:transparent; color:inherit; font:inherit;
  font-weight:700; cursor:pointer; white-space:nowrap;
}
.st-th-btn:hover{ color:var(--text); }
.st-th-btn.is-active{ color:var(--blue); }
.st-table-meta{ font-size:0.5625rem; font-weight:400; color:var(--text-3); margin-top:0.125rem; }

.chev{ font-size:0.625rem; color:var(--text-3); width:0.625rem; display:inline-block; flex:none; transition:transform var(--dur); }
.st-row.is-open .chev{ transform:rotate(90deg); }

/* Раскрытая строка — ветви дерева: вертикаль и короткие веточки к пунктам. */
.st-row__detail{
  margin:0.75rem 0 0 0.3125rem; padding-left:1.25rem;
  border-left:1.5px solid var(--border);
}
.st-row__detail[hidden]{ display:none; }
.st-row__detail > .st-more{ margin-top:0.625rem; }
.st-tree + .st-tree{ margin-top:0.875rem; }
.st-tree__title{ margin:0 0 0.375rem; font-size:0.5625rem; font-weight:700; letter-spacing:.05em; color:var(--text-3); }
.st-mini{ position:relative; padding:0.4375rem 0; }
.st-mini::before{
  content:''; position:absolute; left:-1.25rem; top:0.9375rem;
  width:0.875rem; height:1.5px; background:var(--border);
}
.st-mini__head{ display:flex; align-items:center; gap:0.5rem; font-size:0.6875rem; }
.st-mini__name{ flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.st-mini__num{ flex:none; font-weight:700; color:var(--text-2); font-variant-numeric:tabular-nums; }
.st-mini > .st-metrics{ margin-top:0.3125rem; }
.st-mini__stats{
  display:flex; flex-wrap:wrap; gap:0.25rem 0.625rem; margin-top:0.3125rem;
  font-size:0.625rem; color:var(--text-2); font-variant-numeric:tabular-nums;
}
.st-ms{ display:inline-flex; align-items:center; gap:0.25rem; white-space:nowrap; }
.st-ms i{ width:0.375rem; height:0.375rem; border-radius:1px; display:inline-block; }
.st-ms--done i{ background:var(--st-done); }
.st-ms--rejected i{ background:var(--st-rejected); }
.st-ms--nodial i{ background:var(--st-nodial); }
.st-ms--miss i{ background:var(--st-miss); }
.st-ms--open i{ background:var(--st-open); }

.st-more{ width:100%; height:2.25rem; }

/* -------------------------------- рецепты -------------------------------- */

.st-rx-grid{ display:grid; gap:1.25rem; }
@media (min-width: 48em){ .st-rx-grid{ grid-template-columns:minmax(0, 1fr) minmax(0, 1.4fr); gap:1.75rem; } }
.st-hbar{ display:grid; grid-template-columns:3.25rem minmax(0, 1fr) 3rem; align-items:center; gap:0.5rem; padding:0.25rem 0; }
.st-hbar__label{ font-size:0.6875rem; color:var(--text-2); text-transform:none; }
.st-hbar__track{ height:0.625rem; }
.st-hbar__fill{ display:block; height:100%; min-width:2px; border-radius:0 4px 4px 0; background:var(--blue); }
.st-hbar__val{ font-size:0.75rem; font-weight:700; text-align:right; font-variant-numeric:tabular-nums; }

@media (max-width: 22.5em){
  .st-tiles, .st-split{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
}

/* ------------------------------- печать А4 ------------------------------- */

.st-print-report{ display:none; }

@media print{
  @page{ size:A4 portrait; margin:12mm; }
  html, body{
    height:auto !important;
    background:#ffffff !important;
    color:#111418 !important;
    font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif !important;
    font-size:9.5pt !important;
    text-transform:none !important;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }
  .app-header, .st-main, #st-tip, #gp180-stale{ display:none !important; }
  .st-print-report{ display:block !important; color:#111418; }
  .st-pr-head{
    display:flex; justify-content:space-between; align-items:flex-start; gap:12pt;
    border-bottom:1.5pt solid #111418; padding-bottom:8pt; margin-bottom:10pt;
  }
  .st-pr-head h1{ margin:0; font-size:14pt; font-weight:700; }
  .st-pr-sub{ margin:3pt 0 0; font-size:8.5pt; color:#4b5563; line-height:1.35; }
  .st-pr-date{ font-size:8.5pt; color:#4b5563; white-space:nowrap; }
  .st-pr-kpis{
    display:grid; grid-template-columns:repeat(4, 1fr); gap:6pt; margin-bottom:12pt;
  }
  .st-pr-kpi{
    border:1pt solid #cbd5e1; border-radius:4pt; padding:6pt 8pt; background:#f8fafc;
  }
  .st-pr-kpi span{ display:block; font-size:7.5pt; color:#4b5563; margin-bottom:2pt; }
  .st-pr-kpi b{ font-size:11pt; font-variant-numeric:tabular-nums; }
  .st-pr-kpi small{ display:block; font-size:7pt; color:#4b5563; margin-top:1.5pt; line-height:1.25; }
  .st-pr-sec{ margin-bottom:14pt; }
  .st-pr-sec h2{
    margin:0 0 5pt; font-size:10.5pt; font-weight:700; color:#111418;
    border-bottom:0.75pt solid #cbd5e1; padding-bottom:2pt;
    break-after:avoid; page-break-after:avoid;
  }
  .st-pr-leg{
    display:flex; flex-wrap:wrap; gap:4pt 12pt; margin-bottom:5pt;
    font-size:7.5pt; color:#334155;
  }
  .st-pr-leg span{ display:inline-flex; align-items:center; gap:3pt; }
  .st-pr-leg i{ display:inline-block; width:7pt; height:7pt; border-radius:1.5pt; }
  .st-pr-table{ width:100%; border-collapse:collapse; font-size:8.5pt; font-variant-numeric:tabular-nums; }
  .st-pr-table thead{ display:table-header-group; }
  .st-pr-table tr{ break-inside:avoid; page-break-inside:avoid; }
  .st-pr-table th, .st-pr-table td{
    border:0.5pt solid #cbd5e1; padding:3.5pt 5pt; text-align:left; vertical-align:top;
  }
  .st-pr-table thead th{ background:#e8ecf2; font-weight:700; }
  .st-pr-table .r{ text-align:right; white-space:nowrap; }
  .st-pr-meta{ font-size:7.5pt; color:#4b5563; margin-top:1pt; }
  .st-pr-subrow td{ background:#fafbfc; font-size:7.5pt; color:#334155; }
  .st-pr-subcell{ padding-left:12pt !important; }
  .st-pr-subhead td{ font-size:7pt; font-weight:700; color:#475569; letter-spacing:.03em; background:#f1f5f9; }
  .st-pr-total td{ font-weight:700; background:#f1f5f9; border-top:1.25pt solid #64748b; }
  .st-pr-table--d14{ font-size:7pt; }
  .st-pr-table--d14 th, .st-pr-table--d14 td{ padding:2.5pt 2pt; }
  .st-pr-table--d14 th small{ font-size:5.5pt; font-weight:400; color:#64748b; }
  .st-pr-table--d30{ table-layout:fixed; font-size:5.8pt; }
  .st-pr-table--d30 th, .st-pr-table--d30 td{ padding:2pt 1pt; }
  .st-pr-table--d30 th:first-child, .st-pr-table--d30 td:first-child{ width:16%; overflow-wrap:anywhere; }
  .st-pr-table--d30 th:nth-child(2), .st-pr-table--d30 td:nth-child(2){ width:5.5%; }
  .st-pr-table--d30 .r{ white-space:nowrap; }
  .st-pr-table--d30 small{ font-size:5pt; font-weight:400; color:#64748b; }
}
