/* [stages] Время на этапах: «на этапе с …» в карточке сделки, дни на карточке доски,
   история этапов в окне и вкладка «Время на этапах» в «Аналитике». Переменные — app.css. */

/* карточка сделки: «на этапе с 15.10 · 3 дн.» */
.stg-since { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-bright); background: var(--bg-card);
  color: var(--ink-dim); font-family: var(--body); font-size: 12.5px; font-weight: 600; border-radius: 999px; padding: 2px 10px;
  cursor: pointer; white-space: nowrap; }
.stg-since:hover { color: var(--accent); border-color: var(--accent); }

/* карточка доски: дней на этапе */
.stg-days { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); white-space: nowrap; }
.stg-days.long { color: var(--amber-deep); font-weight: 700; }

/* окно «История этапов» */
.stg-hist { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.stg-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 72px; gap: 10px; align-items: center; padding: 8px 4px;
  border-bottom: 1px solid var(--line); font-size: 13.5px; }
.stg-row:last-child { border-bottom: none; }
.stg-row .dot { width: 10px; height: 10px; border-radius: 50%; }
.stg-row .nm { font-weight: 600; min-width: 0; }
.stg-row .nm small { display: block; font-weight: 500; font-size: 11.5px; color: var(--ink-faint); }
.stg-row .when { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); white-space: nowrap; }
.stg-row b { font-family: var(--mono); text-align: right; white-space: nowrap; }
.stg-row.cur { background: var(--bg-raise); border-radius: 8px; }
.stg-note { font-size: 12.5px; color: var(--ink-faint); line-height: 1.5; margin-top: 10px; }

/* вкладка «Время на этапах» */
.stg-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.stg-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-faint); min-width: 0; }
.stg-filters select, .stg-filters input { min-height: 38px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-bright);
  background: var(--bg-card); color: var(--ink); font-family: var(--body); font-size: 14px; font-weight: 500; letter-spacing: 0;
  text-transform: none; outline: none; max-width: 240px; min-width: 0; }
.stg-filters input { width: 110px; }
.stg-filters select:focus, .stg-filters input:focus { border-color: var(--accent); }

.stg-table { display: flex; flex-direction: column; }
.stg-tr { display: grid; grid-template-columns: minmax(160px, 1.6fr) 90px minmax(140px, 1.2fr) 100px minmax(150px, 1.2fr); gap: 12px;
  align-items: center; padding: 9px 4px; border-top: 1px solid var(--line); font-size: 13.5px; }
.stg-tr.head { border-top: none; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.stg-tr .nm { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.stg-tr .nm i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.stg-tr .nm em { font-style: normal; }
.stg-tr .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; display: flex; flex-direction: column; gap: 4px; }
.stg-tr small { color: var(--ink-faint); font-weight: 500; }
.stg-tr .bar { display: block; height: 6px; border-radius: 4px; background: var(--surface-sunken); overflow: hidden; }
.stg-tr .bar i { display: block; height: 100%; border-radius: 4px; opacity: .85; }

.stg-stuck { display: flex; flex-direction: column; }
.stg-srow { display: grid; grid-template-columns: minmax(0, 1fr) auto 150px; gap: 12px; align-items: center; padding: 10px 4px;
  border-top: 1px solid var(--line); color: var(--ink); font-size: 13.5px; }
.stg-srow:first-child { border-top: none; }
.stg-srow:hover { background: var(--bg-raise); }
.stg-srow .t { min-width: 0; }
.stg-srow .t small { display: block; color: var(--ink-faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stg-srow .d { font-family: var(--mono); font-weight: 700; text-align: right; color: var(--amber-deep); display: flex; flex-direction: column; }
.stg-srow .d small { font-family: var(--body); font-weight: 500; color: var(--ink-faint); font-size: 11.5px; }

@media (max-width: 1100px), (pointer: coarse) {
  .stg-since { min-height: 34px; padding: 4px 12px; }
}
@media (max-width: 760px) {
  .stg-tr.head { display: none; }
  .stg-tr { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; padding: 10px 4px; }
  .stg-tr .nm { grid-column: 1 / -1; }
  .stg-tr > span[data-l]::before { content: attr(data-l); display: block; font-family: var(--body); font-size: 10.5px; font-weight: 700;
    letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); }
  .stg-srow { grid-template-columns: minmax(0, 1fr) auto; }
  .stg-srow .crm-st { grid-row: 2; justify-self: start; }
  .stg-srow .d { grid-row: 1 / span 2; grid-column: 2; }
  .stg-filters label { flex: 1 1 calc(50% - 5px); }
  .stg-filters select, .stg-filters input { max-width: none; width: 100%; }
}
