/*!
 * smit-metric-card — крупная карточка метрики. Пара с smit-metric-card.js.
 * Три облика: plain (светлая), filled (залитая цветом), chart (с графиком).
 */

.smit-mcs {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.smit-mcs .smit-mc-chart { grid-column: 1 / -1; }   /* график шире плиток */
/* build 3291: карточки ряда — одной высоты, даже когда подпись в одной
   переносится на вторую строку, а другая карточка — ссылка-обёртка */
.smit-mcs > .smit-mc, .smit-mcs > .smit-mc-link, .smit-mc-link > .smit-mc { height: 100%; }

.smit-mc {
  position: relative; overflow: hidden; min-width: 0;
  padding: 14px 16px 13px;
  border: 1px solid var(--border-subtle, #dbe2ea);
  border-radius: var(--radius-sm);
  background: var(--surface-card, #fff);
}

/* шапка */
.smit-mc-head { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.smit-mc-title {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--sc-fz-sm, .82rem); font-weight: 600; color: var(--text-muted, #64748b);
}
.smit-mc-title i { opacity: .75; margin-right: 2px; }
.smit-mc-menu { flex: 0 0 auto; margin-right: -6px; display: inline-flex; }
.smit-mc-periodsel { flex: 0 0 auto; display: inline-flex; }

/* Кнопка периода: подпись + стрелка, а не кебаб — она показывает состояние */
.smit-mc-period-btn {
  border: 1px solid var(--border-subtle, #dbe2ea) !important;
  border-radius: var(--radius-pill) !important;
  padding: 2px 10px !important; width: auto !important;
  color: var(--text-muted, #64748b) !important;
  font-size: var(--sc-fz-xs, .76rem) !important;
  flex-direction: row-reverse;          /* подпись слева, стрелка справа */
  gap: 6px;
}
.smit-mc-period-btn:hover { border-color: var(--brand-primary, #43b77a) !important; }
.smit-mc-period-btn .smit-actions-btn-text { white-space: nowrap; }
/* на залитой карточке меню светлое, иначе тонет в цвете */
.smit-mc-filled .smit-mc-menu .smit-actions-btn { color: rgba(255, 255, 255, .85); }
.smit-mc-filled .smit-mc-menu .smit-actions-btn:hover { color: #fff; background: rgba(255, 255, 255, .16); }

/* значение и изменение */
.smit-mc-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.smit-mc-value {
  font-size: 1.7rem; font-weight: 650; line-height: 1.1; letter-spacing: -.02em;
  color: var(--text-primary, #1f2937); font-variant-numeric: tabular-nums;
}
.smit-mc-value.big { font-size: 2.9rem; margin: 6px 0 2px; }
.smit-mc-delta {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px;
  border-radius: var(--radius-pill); font-size: var(--sc-fz-xs, .76rem); font-weight: 600;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.smit-mc-delta.up { background: rgba(67, 183, 122, .14); color: #1f7a52; }
.smit-mc-delta.down { background: rgba(198, 47, 54, .12); color: #c62f36; }
.smit-mc-delta i { font-size: .68em; }

/* строка сравнения */
.smit-mc-compare {
  margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--border-subtle, #dbe2ea);
  font-size: var(--sc-fz-xs, .76rem); color: var(--text-muted, #64748b);
}
.smit-mc-compare b { color: var(--text-primary, #1f2937); font-weight: 600; }

/* ── залитый облик ────────────────────────────────────────────────── */
.smit-mc-filled { border-color: transparent; color: #fff; }
.smit-mc-filled .smit-mc-title { color: rgba(255, 255, 255, .88); }
.smit-mc-filled .smit-mc-value { color: #fff; }
.smit-mc-filled .smit-mc-compare { color: rgba(255, 255, 255, .8); border-top-color: rgba(255, 255, 255, .22); }
.smit-mc-filled .smit-mc-compare b { color: #fff; }
/* На заливке светлая пилюля читается лучше цветной: цвет уже занят фоном */
.smit-mc-filled .smit-mc-delta { background: rgba(255, 255, 255, .2); color: #fff; }
.smit-mc-filled .smit-mc-head, .smit-mc-filled .smit-mc-row,
.smit-mc-filled .smit-mc-compare { position: relative; z-index: 1; }
.smit-mc-blobs { position: absolute; right: 0; top: 0; width: 62%; height: 100%; z-index: 0; }

.smit-mc-filled.tone-green { background: linear-gradient(135deg, #3f9d73, #2f8a63); }
.smit-mc-filled.tone-teal { background: linear-gradient(135deg, #43b7a8, #2f8f86); }
.smit-mc-filled.tone-orange { background: linear-gradient(135deg, #d98b34, #bd6f22); }
.smit-mc-filled.tone-red { background: linear-gradient(135deg, #cf4b52, #a8323a); }
.smit-mc-filled.tone-gray { background: linear-gradient(135deg, #6b7684, #4d5561); }
.smit-mc-filled.tone-dark { background: linear-gradient(135deg, #262b33, #14171c); }

/* ── облик с графиком ─────────────────────────────────────────────── */
.smit-mc-chart { padding-bottom: 0; }
.smit-mc-head-right { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.smit-mc-period { font-size: var(--sc-fz-xs, .76rem); color: var(--text-muted, #64748b); }
.smit-mc-modes { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-sm); background: var(--surface-muted, #f1f4f8); }
.smit-mc-mode {
  border: 0; background: transparent; cursor: pointer; border-radius: var(--radius-sm);
  padding: 3px 8px; color: var(--text-muted, #64748b); font-size: .78rem; line-height: 1;
}
.smit-mc-mode.is-on { background: var(--surface-card, #fff); color: var(--text-primary, #1f2937); box-shadow: var(--shadow-sm); }
.smit-mc-mode:focus-visible { outline: 2px solid var(--focus-outline); outline-offset: 1px; }

.smit-mc-plot { position: relative; height: 190px; margin: 6px -16px 0; }
.smit-mc-svg { display: block; width: 100%; height: 100%; }
.smit-mc-line { fill: none; stroke: var(--brand-primary, #43b77a); stroke-width: 2; stroke-linejoin: round; }
.smit-mc-bar { fill: var(--brand-primary, #43b77a); opacity: .85; }
.smit-mc-g0 { stop-color: var(--brand-primary, #43b77a); stop-opacity: .28; }
.smit-mc-g1 { stop-color: var(--brand-primary, #43b77a); stop-opacity: 0; }
.smit-mc-guide { stroke: var(--border-subtle, #dbe2ea); stroke-width: 1; stroke-dasharray: 3 3; }
.smit-mc-dot { fill: var(--brand-primary, #43b77a); stroke: var(--surface-card, #fff); stroke-width: 2; }

.smit-mc-tip {
  position: absolute; z-index: 2; pointer-events: none;
  display: flex; flex-direction: column; gap: 1px; padding: 5px 9px;
  border-radius: var(--radius-sm); background: var(--text-primary, #1f2937); color: #fff;
  font-size: var(--sc-fz-xs, .76rem); box-shadow: var(--shadow-md);
}
.smit-mc-tip b { font-variant-numeric: tabular-nums; }
.smit-mc-tip span { opacity: .75; }

.smit-mc-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: 0 -16px; padding: 10px 16px;
  border-top: 1px solid var(--border-subtle, #dbe2ea); background: var(--surface-muted, #fbfcfe);
  font-size: var(--sc-fz-xs, .76rem); color: var(--text-muted, #64748b);
}
.smit-mc-note { color: var(--brand-primary, #43b77a); font-weight: 600; }
.smit-mc-agg b { color: var(--text-primary, #1f2937); font-variant-numeric: tabular-nums; }

/* ── тёмная тема ──────────────────────────────────────────────────── */
[data-bs-theme="dark"] .smit-mc, .dark-theme .smit-mc { background: var(--surface-card); border-color: var(--border-subtle); }
[data-bs-theme="dark"] .smit-mc-value, .dark-theme .smit-mc-value,
[data-bs-theme="dark"] .smit-mc-compare b, .dark-theme .smit-mc-compare b,
[data-bs-theme="dark"] .smit-mc-agg b, .dark-theme .smit-mc-agg b { color: var(--text-primary); }
[data-bs-theme="dark"] .smit-mc-title, .dark-theme .smit-mc-title,
[data-bs-theme="dark"] .smit-mc-compare, .dark-theme .smit-mc-compare,
[data-bs-theme="dark"] .smit-mc-period, .dark-theme .smit-mc-period,
[data-bs-theme="dark"] .smit-mc-foot, .dark-theme .smit-mc-foot { color: var(--text-muted); }
[data-bs-theme="dark"] .smit-mc-compare, .dark-theme .smit-mc-compare,
[data-bs-theme="dark"] .smit-mc-foot, .dark-theme .smit-mc-foot { border-top-color: var(--border-subtle); }
[data-bs-theme="dark"] .smit-mc-foot, .dark-theme .smit-mc-foot { background: var(--surface-muted); }
/* Залитая карточка остаётся залитой и в тёмной теме: правила выше красят
   подписи в приглушённый серый, а на цветном фоне это серое по зелёному. */
[data-bs-theme="dark"] .smit-mc.smit-mc-filled .smit-mc-title,
.dark-theme .smit-mc.smit-mc-filled .smit-mc-title { color: rgba(255, 255, 255, .88); }
[data-bs-theme="dark"] .smit-mc.smit-mc-filled .smit-mc-value,
.dark-theme .smit-mc.smit-mc-filled .smit-mc-value,
[data-bs-theme="dark"] .smit-mc.smit-mc-filled .smit-mc-compare b,
.dark-theme .smit-mc.smit-mc-filled .smit-mc-compare b { color: #fff; }
[data-bs-theme="dark"] .smit-mc.smit-mc-filled .smit-mc-compare,
.dark-theme .smit-mc.smit-mc-filled .smit-mc-compare {
  color: rgba(255, 255, 255, .8); border-top-color: rgba(255, 255, 255, .22);
}
[data-bs-theme="dark"] .smit-mc-modes, .dark-theme .smit-mc-modes { background: var(--surface-card); }
[data-bs-theme="dark"] .smit-mc-period-btn, .dark-theme .smit-mc-period-btn {
  border-color: var(--border-subtle) !important; color: var(--text-muted) !important;
}
[data-bs-theme="dark"] .smit-mc-mode.is-on, .dark-theme .smit-mc-mode.is-on { background: var(--surface-muted); color: var(--text-primary); }
[data-bs-theme="dark"] .smit-mc-delta.up, .dark-theme .smit-mc-delta.up { background: rgba(67, 183, 122, .2); color: #7fd6a8; }
[data-bs-theme="dark"] .smit-mc-delta.down, .dark-theme .smit-mc-delta.down { background: rgba(198, 47, 54, .22); color: #ef8a90; }
[data-bs-theme="dark"] .smit-mc-guide, .dark-theme .smit-mc-guide { stroke: var(--border-subtle); }
[data-bs-theme="dark"] .smit-mc-dot, .dark-theme .smit-mc-dot { stroke: var(--surface-card); }
[data-bs-theme="dark"] .smit-mc-tip, .dark-theme .smit-mc-tip { background: var(--surface-muted); }

/* ── телефон ──────────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .smit-mcs { grid-template-columns: 1fr; gap: 12px; }
  .smit-mc-value { font-size: 1.5rem; }
  .smit-mc-value.big { font-size: 2.2rem; }
  .smit-mc-plot { height: 150px; }
  .smit-mc-head { flex-wrap: wrap; }
  .smit-mc-head-right { width: 100%; justify-content: space-between; }
}

/* ── build 3001: значок фоном, тон светлой карточки, подъём ─────────────
   Значок — оформление: крупный, бледный, в правом нижнем углу, под текстом
   (isolation держит его над фоном карточки, но под содержимым). Тон красит
   значение и значок: так в ряду показателей видно, какие из них «хорошие». */
.smit-mc { isolation: isolate; }
.smit-mc-bgico {
  position: absolute; right: -4px; bottom: -12px; z-index: -1;
  font-size: 4.4rem; line-height: 1; pointer-events: none;
  color: var(--smit-mc-tone, #64748b); opacity: .1; transform: rotate(-10deg);
}
.smit-mc-plain.tone-green  { --smit-mc-tone: #16a34a; }
.smit-mc-plain.tone-teal   { --smit-mc-tone: #0f9488; }
.smit-mc-plain.tone-orange { --smit-mc-tone: #d97706; }
.smit-mc-plain.tone-red    { --smit-mc-tone: #c62f36; }
.smit-mc-plain.tone-gray   { --smit-mc-tone: #64748b; }
.smit-mc-plain.tone-dark   { --smit-mc-tone: #334155; }
.smit-mc-plain.tone-green .smit-mc-value  { color: #15803d; }
.smit-mc-plain.tone-teal .smit-mc-value   { color: #0f766e; }
.smit-mc-plain.tone-orange .smit-mc-value { color: #b45309; }
.smit-mc-plain.tone-red .smit-mc-value    { color: #b91c1c; }
[data-bs-theme="dark"] .smit-mc-bgico, .dark-theme .smit-mc-bgico { opacity: .16; }
[data-bs-theme="dark"] .smit-mc-plain.tone-green .smit-mc-value,
.dark-theme .smit-mc-plain.tone-green .smit-mc-value  { color: #6ee7b7; }
[data-bs-theme="dark"] .smit-mc-plain.tone-teal .smit-mc-value,
.dark-theme .smit-mc-plain.tone-teal .smit-mc-value   { color: #5eead4; }
[data-bs-theme="dark"] .smit-mc-plain.tone-orange .smit-mc-value,
.dark-theme .smit-mc-plain.tone-orange .smit-mc-value { color: #fbbf24; }
[data-bs-theme="dark"] .smit-mc-plain.tone-red .smit-mc-value,
.dark-theme .smit-mc-plain.tone-red .smit-mc-value    { color: #fca5a5; }
/* Подъём при наведении — тот же, что у показателей в обзоре клиента */
.smit-mc-lift { transition: transform .18s ease, box-shadow .18s ease; }
.smit-mc-lift:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(15, 23, 42, .10); }
[data-bs-theme="dark"] .smit-mc-lift:hover, .dark-theme .smit-mc-lift:hover { box-shadow: 0 10px 22px rgba(0, 0, 0, .45); }
@media (prefers-reduced-motion: reduce) {
  .smit-mc-lift { transition: none; }
  .smit-mc-lift:hover { transform: none; }
}

/* build 3253: карточка-ссылка — число на сводке ведёт в список, из которого
   оно посчитано. */
.smit-mc-link { display: block; text-decoration: none; color: inherit; }
.smit-mc-link:hover { text-decoration: none; color: inherit; }

/* build 3284: подпись под значением светлой карточки */
.smit-mc .smit-mc-note.smit-mc-note-plain { display: block; margin-top: 6px; font-weight: 400; font-size: var(--sc-fz-sm, .85rem);
  color: var(--text-muted, #64748b); line-height: 1.35; }

/* Заголовок группы показателей — «Сейчас» и «За период» (правило 4 свода
   «Дашборды: правила компоновки»). Смена периода меняет только вторую группу,
   и человек должен видеть, где проходит граница. */
.smit-mc-group { display: flex; align-items: baseline; gap: 10px; margin: 20px 0 10px; }
.smit-mc-group .g-t {
  font-size: var(--sc-fz-md, 1rem); font-weight: 700; margin: 0;
  color: var(--text-primary, #1f2937);
}
.smit-mc-group .g-h { font-size: var(--sc-fz-xs, .78rem); color: var(--text-muted, #6c757d); }
.smit-mc-group:first-child { margin-top: 0; }
@media (max-width: 575.98px) {
  .smit-mc-group { margin: 14px 0 8px; flex-wrap: wrap; gap: 2px 8px; }
}

/* build 3316: карточки показателей — без теней, только рамка и подъём */
.smit-mc { box-shadow: none; }
/* тень появляется только вместе с подъёмом — и когда курсор на всей
   карточке-ссылке, а не только на самой плитке */
.smit-mc-lift:hover, .smit-mc-link:hover > .smit-mc-lift {
  box-shadow: 0 10px 22px rgba(15, 23, 42, .10);
  transform: translateY(-3px);
}
[data-bs-theme="dark"] .smit-mc-lift:hover,
[data-bs-theme="dark"] .smit-mc-link:hover > .smit-mc-lift,
.dark-theme .smit-mc-lift:hover,
.dark-theme .smit-mc-link:hover > .smit-mc-lift {
  box-shadow: 0 10px 22px rgba(0, 0, 0, .45);
}
@media (prefers-reduced-motion: reduce) {
  .smit-mc-lift:hover, .smit-mc-link:hover > .smit-mc-lift { transform: none; }
}

/* build 3324: все карточки рядов показателей поднимаются при наведении с тенью,
   не только карточки-ссылки */
.smit-mcs > .smit-mc, .smit-mcs > .smit-mc-link > .smit-mc {
  transition: transform .2s ease, box-shadow .2s ease;
}
.smit-mcs > .smit-mc:hover, .smit-mcs > .smit-mc-link:hover > .smit-mc {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, .10);
}
[data-bs-theme="dark"] .smit-mcs > .smit-mc:hover,
[data-bs-theme="dark"] .smit-mcs > .smit-mc-link:hover > .smit-mc,
.dark-theme .smit-mcs > .smit-mc:hover,
.dark-theme .smit-mcs > .smit-mc-link:hover > .smit-mc { box-shadow: 0 10px 22px rgba(0, 0, 0, .45); }
@media (prefers-reduced-motion: reduce) {
  .smit-mcs > .smit-mc, .smit-mcs > .smit-mc-link > .smit-mc { transition: none; }
  .smit-mcs > .smit-mc:hover, .smit-mcs > .smit-mc-link:hover > .smit-mc { transform: none; }
}
