/* components.css — базовые компоненты дизайн-системы gidstroy.pro, версия «iOS-стиль»
   (макет-эталон gidstroy-redesign.html, 14.10.2026). Имена классов сохранены — разметка и
   скрипты разделов не меняются, меняется только вид. Цвета — только var(--…) из tokens.css. */

/* ------------------------------- Button -------------------------------
   Высота 36, радиус 12. Обычная — поверхность с тенью, primary — акцент с белым текстом.
   hover — тень глубже, нажатие — scale(.96) по --spring. */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-md);
  line-height: 1;
  padding: 0 14px;
  height: var(--h-md);
  min-height: var(--h-md);
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition: transform .25s var(--spring), box-shadow .25s var(--ease), background .2s var(--ease), color .2s var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { box-shadow: var(--shadow-lift); }
.btn:active:not(:disabled) { transform: scale(.96); transition-duration: 80ms; }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn--sm { height: var(--h-sm); min-height: var(--h-sm); padding: 0 12px; border-radius: 10px; font-size: var(--fs-row); gap: 5px; }
.btn--lg { height: var(--h-lg); padding: 0 var(--sp-6); font-size: var(--fs-lg); }
.btn--icon { padding: 0; width: var(--h-sm); height: var(--h-sm); min-width: var(--h-sm); min-height: var(--h-sm); border-radius: 10px; }
.btn--icon.btn--sm { width: var(--h-sm); }
.btn--block { width: 100%; }

.btn--primary, .btn--ai { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover:not(:disabled), .btn--ai:hover:not(:disabled) { background: var(--accent-hover); }
.btn--primary:disabled, .btn--ai:disabled { background: var(--surface-2); color: var(--fg-4); box-shadow: none; }
.btn--secondary { background: var(--surface); color: var(--fg); }
.btn--secondary:disabled { color: var(--fg-4); background: var(--surface-2); box-shadow: none; }
.btn--tertiary { background: var(--accent-soft); color: var(--accent-ink); box-shadow: none; }
.btn--tertiary:hover:not(:disabled) { box-shadow: none; background: color-mix(in srgb, var(--accent) 20%, transparent); }
.btn--tertiary:disabled { background: var(--surface-2); color: var(--fg-4); }
.btn--ghost, .btn--text { background: transparent; color: var(--fg); box-shadow: none; }
.btn--ghost:hover:not(:disabled), .btn--text:hover:not(:disabled) { background: var(--surface-2); box-shadow: none; }
.btn--ghost:disabled, .btn--text:disabled { color: var(--fg-4); }
.btn--link { background: transparent; color: var(--accent-ink); padding: 0 var(--sp-1); box-shadow: none; }
.btn--link:hover:not(:disabled) { color: var(--accent-hover); box-shadow: none; }
.btn--link:disabled { color: var(--fg-4); }
.btn--dashed { background: transparent; box-shadow: none; border: 1.5px dashed var(--sep-strong); color: var(--fg-2); }
.btn--dashed:hover:not(:disabled) { border-color: var(--fg-3); box-shadow: none; }
.btn--dashed:disabled { color: var(--fg-4); }
.btn--danger { background: var(--bad); color: var(--on-accent); }
.btn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--bad) 85%, var(--fg)); }
.btn--good { background: var(--good); color: var(--on-accent); }

/* Loading-состояние: текст гаснет, по центру спиннер */
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { opacity: 0; }
.btn.is-loading::before {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid var(--on-accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: ez-spin .6s linear infinite;
}
.btn--secondary.is-loading::before, .btn--ghost.is-loading::before, .btn--dashed.is-loading::before, .btn--text.is-loading::before,
.btn:not(.btn--primary):not(.btn--ai):not(.btn--danger):not(.btn--good).is-loading::before { border-color: var(--accent); border-top-color: transparent; }

/* круглая кнопка-крестик закрытия (макет .x) */
.x, .modal__x {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); color: var(--fg-2);
  display: grid; place-items: center;
  border: 0; cursor: pointer; padding: 0; font: inherit;
  transition: transform .25s var(--spring), background .2s;
}
.x:hover, .modal__x:hover { transform: scale(1.08); background: var(--accent-soft); color: var(--accent-ink); }

/* -------------------------------- Card --------------------------------
   Без рамки: фон поверхности, радиус 18, мягкая тень. Кликабельная (.card--hover / .tap):
   приподнимается на 3px, при нажатии чуть сжимается. */
.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--r);
  box-shadow: var(--shadow);
  min-width: 0;
  container-type: inline-size;
  transition: transform .3s var(--spring), box-shadow .3s var(--ease);
}
.card--hover, .card.tap { cursor: pointer; }
.card--hover:hover, .card.tap:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card--hover:active, .card.tap:active { transform: scale(.985); }
.card__header {
  padding: var(--sp-4) var(--sp-5) 0;
  border-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.card__title { font-size: clamp(12px, 4.4cqw, var(--fs-md)); font-weight: var(--fw-semibold); letter-spacing: -.01em; line-height: 1.3; }
.card__body { padding: var(--sp-3) var(--sp-5) var(--sp-5); }
.card__header + .card__body { padding-top: var(--sp-3); }
.card__footer {
  padding: var(--sp-3) var(--sp-5) var(--sp-4);
  border-top: 1px solid var(--sep);
  background: transparent;
  border-radius: 0 0 var(--r) var(--r);
  font-size: var(--fs-sm);
  color: var(--fg-3);
}

/* подпись-кикер, большое число, подсказка, строки с разделителями (макет .kicker/.big/.hint/.rows) */
.kicker { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--fg-3); text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: 8px; }
.kicker .dot, .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 var(--good-soft); animation: pulse 2s infinite; flex: none; position: relative; }
.live-dot::after { content: none; }
.live-dot--danger { background: var(--bad); box-shadow: 0 0 0 0 var(--bad-soft); }
.live-dot--warning { background: var(--warn); box-shadow: 0 0 0 0 var(--warn-soft); }
.big { font-size: var(--fs-3xl); font-weight: var(--fw-bold); letter-spacing: -.03em; margin-top: 6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.big.neg { color: var(--bad); } .big.pos { color: var(--good); }
.hint { color: var(--fg-3); font-size: var(--fs-sm); margin-top: 4px; }
.rows { display: flex; flex-direction: column; margin-top: 10px; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--sep); font-size: var(--fs-row); }
.row:first-child { border-top: 0; }
.row > span:first-child { color: var(--fg-2); }
.row b { font-weight: var(--fw-semibold); }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* --------------------------- Stat / KPI card --------------------------- */
.stat {
  background: var(--surface);
  border: 0;
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  container-type: inline-size;
  min-width: 0;
  transition: transform .3s var(--spring), box-shadow .3s var(--ease);
}
.stat__label {
  font-size: var(--fs-sm);
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: var(--fw-semibold);
  line-height: 1.3;
}
.stat__value {
  font-size: clamp(20px, 9cqw, var(--fs-3xl));
  font-weight: var(--fw-bold);
  letter-spacing: -.03em;
  line-height: 1.1;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.stat__delta { font-size: var(--fs-sm); margin-top: 4px; color: var(--fg-3); }
.stat__delta--up { color: var(--good); }
.stat__delta--down { color: var(--bad); }
@media (max-width: 640px) {
  .stat { padding: 14px; }
  .stat__value, .big { font-size: 22px; }
  .card__body { padding-left: 14px; padding-right: 14px; }
  .card__header { padding-left: 14px; padding-right: 14px; }
}

/* метрика с выравниванием по ряду (label до 2 строк → значения на одной линии) */
.mi-metric { display: flex; flex-direction: column; height: 100%; }
.mi-metric__body { display: flex; flex-direction: column; height: 100%; }
.mi-metric__label { min-height: 2.5em; display: flex; align-items: flex-start; margin: 0; }
.mi-metric .stat__value { margin-top: var(--sp-1); }
.mi-metric__sub { margin-top: auto; padding-top: var(--sp-3); }
.mi-metric__sub .tag { max-width: 100%; white-space: normal; }

/* --------------------------- Badge = chip ---------------------------
   Таблетка 12px/600: нейтральная — вторая поверхность, статусные — мягкая заливка + цвет статуса. */
.badge, .chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  padding: 3px 9px;
  border-radius: var(--r-full);
  line-height: 1.4;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--fg-2);
  max-width: 100%;
}
.badge__dot { width: 6px; height: 6px; border-radius: var(--r-full); background: currentColor; flex: none; }
.badge--neutral { background: var(--surface-2); color: var(--fg-2); }
.badge--success, .chip.good { background: var(--good-soft); color: var(--good); }
.badge--warning, .chip.warn { background: var(--warn-soft); color: var(--warn); }
.badge--danger, .chip.bad { background: var(--bad-soft); color: var(--bad); }
.badge--info, .badge--accent, .chip.acc { background: var(--accent-soft); color: var(--accent-ink); }
.badge--status { color: var(--on-accent); }   /* цвет фона задаётся данными (inline) */

/* ------------------------------- Tabs ------------------------------- */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--sep); margin-bottom: var(--sp-5); }
.tab {
  appearance: none; background: none; border: none;
  padding: var(--sp-2) var(--sp-3);
  min-height: var(--h-md);
  display: inline-flex; align-items: center;
  font-size: var(--fs-md); font-weight: var(--fw-medium);
  color: var(--fg-3); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--fg); }
.tab.is-active { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* ----------------- Segmented control (макет .seg с бегунком) -----------------
   .seg: кнопки лежат поверх бегунка .thumb, который плавно едет за выбранной (JS: window.__gsSeg). */
.seg, .segmented {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  background: var(--surface-2);
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
  height: auto;
}
.seg button, .segmented__item {
  appearance: none; border: 0; background: none;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 5px 12px;
  border-radius: 9px;
  font-family: var(--font); font-size: var(--fs-row); font-weight: var(--fw-semibold);
  color: var(--fg-2); cursor: pointer;
  position: relative; z-index: 1; white-space: nowrap;
  transition: color .2s var(--ease);
}
.seg button.on, .segmented__item.is-active { color: var(--fg); }
.segmented__item.is-active { background: var(--surface); box-shadow: var(--shadow-thumb); }
.seg .thumb { position: absolute; top: 3px; bottom: 3px; border-radius: 9px; background: var(--surface); box-shadow: var(--shadow-thumb); transition: left .35s var(--spring), width .35s var(--spring); z-index: 0; }

/* ---------------------------- Form controls ---------------------------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field__label { font-size: var(--fs-row); font-weight: var(--fw-medium); color: var(--fg-2); }
.field__hint { font-size: var(--fs-sm); color: var(--fg-3); }

/* Поле: вторая поверхность без рамки, радиус 12, высота 36; фокус — кольцо акцента */
.input, .select, .textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 0 14px;
  height: var(--h-md);
  min-height: var(--h-md);
  font-family: var(--font);
  font-size: var(--fs-md);
  color: var(--fg);
  transition: box-shadow var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.textarea { height: auto; min-height: 96px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--fg-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--sep); }
.input:focus, .select:focus, .textarea:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* select: своя стрелка-шеврон из двух градиентов — цвет берётся из токена, не из data-URI */
.select, select.input {
  appearance: none; -webkit-appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-3) 50%), linear-gradient(135deg, var(--fg-3) 50%, transparent 50%);
  background-position: right 18px center, right 13px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.input--with-icon { padding-left: 34px; }
.input-wrap { position: relative; }
.input-wrap__icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; }

/* Switch 38×22: серый трек, включён — зелёный, кнопка белая с тенью */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track { position: absolute; inset: 0; background: var(--fg-4); border-radius: var(--r-full); transition: background .25s var(--ease); }
.switch__track::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px;
  background: var(--on-accent); border-radius: var(--r-full);
  transition: transform .3s var(--spring); box-shadow: var(--shadow-thumb);
}
.switch input:checked + .switch__track { background: var(--good); }
.switch input:checked + .switch__track::before { transform: translateX(16px); }

.checkbox { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--sep-strong); display: grid; place-items: center; cursor: pointer; color: var(--on-accent); flex-shrink: 0; }
.checkbox.is-checked { background: var(--accent); border-color: var(--accent); }

/* ------------------------------- Table ------------------------------- */
.table-wrap { background: var(--surface); border: 0; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-row); }
.table thead th {
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: var(--sp-3) var(--sp-4);
  background: transparent;
  border-bottom: 1px solid var(--sep);
  white-space: nowrap;
}
.table tbody td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--sep); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table--compact tbody td, .table--compact thead th { padding: var(--sp-2) var(--sp-3); }

/* таблица с регулируемой шириной столбцов (canon/table.js) */
.table-wrap--resizable { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table--resizable thead th { position: relative; overflow: hidden; text-overflow: ellipsis; }
.col-resize { position: absolute; top: 0; right: 0; width: 12px; height: 100%; cursor: col-resize; touch-action: none; user-select: none; -webkit-user-select: none; z-index: 2; }
.col-resize::after { content: ''; position: absolute; top: 18%; right: 5px; width: 1px; height: 64%; border-radius: 1px; background: var(--sep-strong); opacity: 0; transition: opacity var(--t-fast); }
.table--resizable thead th:hover .col-resize::after { opacity: .6; }
.col-resize.is-active::after { opacity: .95; }
.table.is-col-editing thead th, .table.is-col-editing tbody td { box-shadow: inset 1px 0 0 var(--sep-strong); }
.table.is-col-editing thead th:first-child, .table.is-col-editing tbody td:first-child { box-shadow: none; }
.table.is-col-editing .col-resize::after { opacity: .5; }
.table.is-col-editing .col-resize:hover::after { opacity: .95; }
.col-label { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.table.is-col-editing .col-label { cursor: text; border-bottom: 1px dashed var(--sep-strong); }
.col-label-input { width: calc(100% - 14px); font: inherit; font-weight: inherit; color: inherit; background: var(--surface); border: 1px solid var(--accent); border-radius: 6px; padding: 1px 4px; }
.table-tools { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); }
.table-mode { display: inline-flex; align-items: center; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2); border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-sm); color: var(--fg-3); user-select: none; }
.table-mode:hover { background: var(--surface-2); color: var(--fg); }
@media (max-width: 900px) { .table-mode { display: none; } }
.table--tight { font-size: 12px; }
.table--tight tbody td .input { font-size: 12px; }
.table--tight .num, .table--tight tbody td.num .input { font-size: 13px; }

/* ------------------------------- Modal -------------------------------
   Скрим с размытием, окно появляется scale(.92)→1 по --spring, радиус 26, крестик — .x */
.overlay {
  position: fixed; inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: var(--sp-6);
  z-index: var(--z-modal);
  animation: ez-overlay-in .3s var(--ease) both;
}
.modal {
  background: var(--surface);
  border: 0;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lift);
  width: 100%; max-width: 520px; max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: modalIn .45s var(--spring) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.92); } to { opacity: 1; transform: none; } }
.modal__header { padding: var(--sp-5) var(--sp-6) var(--sp-3); border-bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.modal__title { font-size: var(--fs-h4); font-weight: var(--fw-bold); letter-spacing: -.02em; }
.modal--lg { max-width: 760px; }
.modal--xl { max-width: 1040px; }
.modal--tall { height: min(86vh, 820px); }
.modal--tall .modal__body { flex: 1 1 auto; }
.modal__body { padding: var(--sp-2) var(--sp-6) var(--sp-5); overflow-y: auto; min-height: 0; }
.modal__footer { padding: var(--sp-3) var(--sp-6) var(--sp-4); border-top: 1px solid var(--sep); display: flex; justify-content: flex-end; gap: var(--sp-2); flex-wrap: wrap; }

/* Drawer */
.drawer-overlay { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: var(--z-modal); animation: ez-overlay-in .3s var(--ease) both; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(460px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--sep);
  box-shadow: var(--shadow-lift);
  z-index: var(--z-modal);
  display: flex; flex-direction: column;
  animation: ez-drawer-slide .4s var(--ease) both;
}
.drawer__header { padding: var(--sp-5); border-bottom: 1px solid var(--sep); display: flex; align-items: center; justify-content: space-between; }
.drawer__body { padding: var(--sp-5); overflow-y: auto; flex: 1 1 auto; }

/* ------------------------------- Toast -------------------------------
   Таблетка снизу по центру (цвет текста как фон, фон как текст), появление по --spring */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--fg); color: var(--bg);
  padding: 10px 16px; border-radius: var(--r-full);
  font-size: var(--fs-row); font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-lift);
  transition: transform .4s var(--spring), opacity .25s var(--ease);
  z-index: var(--z-toast); pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.toast.on, .toast.is-on { transform: translate(-50%, 0); opacity: 1; }
.toast.is-bad { background: var(--bad); color: var(--on-accent); }

/* ------------------------------- Alert ------------------------------- */
.alert { display: flex; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm); border: 0; font-size: var(--fs-row); background: var(--surface-2); }
.alert__icon { flex-shrink: 0; margin-top: 1px; }
.alert--info { background: var(--accent-soft); color: var(--accent-ink); }
.alert--success { background: var(--good-soft); color: var(--good); }
.alert--warning { background: var(--warn-soft); color: var(--warn); }
.alert--danger { background: var(--bad-soft); color: var(--bad); }
.alert__title { font-weight: var(--fw-semibold); }
.alert__body { color: var(--fg); }

/* ------------------------- Skeleton / Empty ------------------------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--sep) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: skeleton 1.4s ease infinite; border-radius: var(--r-sm); }
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); padding: 28px 14px; color: var(--fg-3); font-size: var(--fs-row); border: 1.5px dashed var(--sep-strong); border-radius: var(--r-sm); }
.empty__icon { width: 48px; height: 48px; border-radius: var(--r); display: grid; place-items: center; background: var(--surface-2); color: var(--fg-3); }

/* ----------------------------- ЗАГЛУШКА бейдж ----------------------------- */
.stub-flag {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: .04em;
  color: var(--warn);
  background: repeating-linear-gradient(45deg, var(--warn-soft), var(--warn-soft) 6px, transparent 6px, transparent 12px);
  border: 1px dashed var(--warn); border-radius: 8px; padding: 1px 7px;
}

/* ------------------------------- Misc ------------------------------- */
.divider { height: 1px; background: var(--sep); margin: var(--sp-5) 0; }
.kbd { font-family: var(--mono); font-size: var(--fs-xs); background: var(--surface-2); border: 1px solid var(--sep); border-bottom-width: 2px; border-radius: 6px; padding: 1px 5px; color: var(--fg-3); }
.swatch { height: 56px; border-radius: var(--r-sm); border: 1px solid var(--sep); }
.token-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--sep); font-size: var(--fs-base); }
.token-row:last-child { border-bottom: none; }
.meta-grid { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-md); }
.meta-grid dt { color: var(--fg-3); }
.meta-grid dd { color: var(--fg); }

/* воронка (макет .funnel): подпись, полоска, число справа */
.funnel { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.funnel .f { display: grid; grid-template-columns: 90px 1fr 44px; align-items: center; gap: 12px; font-size: var(--fs-row); color: var(--fg-2); }
.funnel .bar { height: 28px; border-radius: 9px; background: var(--accent); opacity: .9; transform-origin: left; animation: grow 1s var(--ease) both; min-width: 3px; }
.funnel b { text-align: right; font-weight: var(--fw-semibold); color: var(--fg); }
/* тонкая полоска в карточке доски (макет .prog) */
.prog { height: 6px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.prog i { display: block; height: 100%; background: var(--accent); border-radius: var(--r-full); transform-origin: left; animation: grow 1.1s var(--ease) both; }

/* полоска прогресса и «метр» (доля) */
.progress { height: 6px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.progress__bar { height: 100%; background: var(--accent); border-radius: var(--r-full); transition: width var(--t-base); transform-origin: left; animation: grow 1.1s var(--ease) both; }
.meter { height: 10px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; display: flex; margin-top: 14px; }
.meter i { display: block; height: 100%; transform-origin: left; animation: grow 1s var(--ease) both; }

/* ------------------- Steps ------------------- */
.steps { display: flex; align-items: flex-start; }
.step { display: flex; flex-direction: column; align-items: center; flex: 1 1 0; position: relative; }
.step__dot { width: 28px; height: 28px; border-radius: var(--r-full); display: grid; place-items: center; font-size: var(--fs-sm); font-weight: var(--fw-semibold); background: var(--surface); border: 1.5px solid var(--sep-strong); color: var(--fg-3); z-index: 1; }
.step__label { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--fg-3); text-align: center; }
.step__line { position: absolute; top: 14px; left: 50%; right: -50%; height: 2px; background: var(--sep); z-index: 0; }
.step:last-child .step__line { display: none; }
.step.is-done .step__dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.step.is-done .step__line { background: var(--accent); }
.step.is-active .step__dot { border-color: var(--accent); color: var(--accent-ink); }
.step.is-active .step__label, .step.is-done .step__label { color: var(--fg); }

/* ---------------- Status Tag — как чип ---------------- */
.tag { display: inline-flex; align-items: center; gap: var(--sp-1); height: 24px; padding: 0 9px; border-radius: var(--r-full); font-size: var(--fs-sm); font-weight: var(--fw-semibold); border: 0; white-space: nowrap; background: var(--surface-2); color: var(--fg-2); }
.tag--draft { color: var(--fg-3); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--sep); }
.tag--neutral { background: var(--surface-2); color: var(--fg-2); }
.tag--info { background: var(--accent-soft); color: var(--accent-ink); }
.tag--warning { background: var(--warn-soft); color: var(--warn); }
.tag--success { background: var(--good-soft); color: var(--good); }
.tag--danger { background: var(--bad-soft); color: var(--bad); }

/* ============================================================================
   АНИМАЦИИ компонентов (общие keyframes — canon/animations.css)
   ============================================================================ */
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--good-soft); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes ez-spin { to { transform: rotate(360deg); } }
@keyframes ez-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes ez-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes ez-pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes ez-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes ez-bounce { 0%,100% { transform: translateY(0); } 30% { transform: translateY(-3px); } 60% { transform: translateY(-1px); } }
@keyframes ez-fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ez-bar-grow { from { transform: scaleY(.05); } }
@keyframes ez-ring { 0% { box-shadow: 0 0 0 0 var(--accent-glow); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ------------------------------- Spinner ------------------------------- */
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--sep); border-top-color: var(--accent); border-radius: 50%; animation: ez-spin .6s linear infinite; display: inline-block; flex-shrink: 0; }
.spinner--sm { width: 14px; height: 14px; border-width: 2px; }
.spinner--lg { width: 28px; height: 28px; border-width: 3px; }
.spinner--ai { border-top-color: var(--violet); }
.spinner--white { border-color: color-mix(in srgb, var(--on-accent) 35%, transparent); border-top-color: var(--on-accent); }

/* точки «думает/печатает» */
.dots { display: inline-flex; gap: 4px; align-items: center; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: ez-pulse 1s ease-in-out infinite; }
.dots span:nth-child(2) { animation-delay: .16s; }
.dots span:nth-child(3) { animation-delay: .32s; }

/* indeterminate bar */
.loadbar { height: 3px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; position: relative; }
.loadbar::before { content: ""; position: absolute; inset: 0; width: 40%; background: var(--accent); border-radius: var(--r-full); animation: ez-loadbar 1.1s ease-in-out infinite; }
@keyframes ez-loadbar { 0% { left: -40%; } 100% { left: 100%; } }

.anim-spin { animation: ez-spin 1s linear infinite; }
.anim-spin-slow { animation: ez-spin 3s linear infinite; }
.anim-pulse { animation: ez-pulse 1.6s ease-in-out infinite; }
.anim-breathe { animation: ez-breathe 2.4s ease-in-out infinite; }
.anim-float { animation: ez-float 3s ease-in-out infinite; }
.anim-bounce { animation: ez-bounce 1.4s ease infinite; }
.anim-pop { animation: ez-pop var(--t-spring) both; }
.hover-spin:hover svg { animation: ez-spin .7s ease; }

/* появление страницы каскадом */
.page__inner > * { animation: cardIn .55s var(--ease) both; }
.page__inner > *:nth-child(2) { animation-delay: .05s; }
.page__inner > *:nth-child(3) { animation-delay: .1s; }
.page__inner > *:nth-child(4) { animation-delay: .15s; }
.page__inner > *:nth-child(5) { animation-delay: .2s; }
.page__inner > *:nth-child(n+6) { animation-delay: .25s; }

/* мини-бар-чарт (sparkbars) */
.sparkbars { display: flex; align-items: flex-end; gap: 3px; height: 36px; }
.sparkbars span { flex: 1; background: var(--accent-soft); border-radius: 3px 3px 0 0; transform-origin: bottom; animation: ez-bar-grow .5s var(--t-spring) both; }
.sparkbars span.is-peak { background: var(--accent); }

/* стрик-полоска */
.beam { height: 3px; border-radius: var(--r-full); overflow: hidden; background: linear-gradient(90deg, var(--accent), var(--violet), var(--accent)); background-size: 200% 100%; animation: ez-beam 4s linear infinite; }
@keyframes ez-beam { to { background-position: 200% 0; } }

/* ============ Единый Select (кастомный popover) ============ */
.select-ctl {
  display: inline-flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  width: 100%; height: var(--h-md); min-height: var(--h-md); padding: 0 var(--sp-3) 0 14px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-sm);
  font-family: var(--font); font-size: var(--fs-md); color: var(--fg);
  cursor: pointer; text-align: left;
  transition: box-shadow var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.select-ctl--sm { height: var(--h-sm); min-height: var(--h-sm); font-size: var(--fs-row); }
.select-ctl:hover:not(:disabled) { border-color: var(--sep); }
.select-ctl.is-open, .select-ctl:focus-visible { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select-ctl:disabled { opacity: .55; cursor: not-allowed; }
.select-ctl__val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-ctl__val.is-placeholder { color: var(--fg-4); }
.select-ctl__arrow { color: var(--fg-3); flex-shrink: 0; transition: transform var(--t-fast); }
.select-ctl.is-open .select-ctl__arrow { transform: rotate(180deg); }
.ds-select__menu {
  z-index: var(--z-dropdown); min-width: 168px;
  background: var(--surface); border: 0; border-radius: 14px;
  box-shadow: var(--shadow-lift); padding: 4px; max-height: 284px; overflow-y: auto;
  animation: modalIn .3s var(--spring) both;
}
.ds-select__opt {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  width: 100%; padding: 8px 10px; border: none; background: transparent; cursor: pointer;
  font-family: var(--font); font-size: var(--fs-md); color: var(--fg);
  border-radius: 10px; text-align: left;
  transition: background var(--t-fast);
}
.ds-select__opt:hover { background: var(--surface-2); }
.ds-select__opt.is-selected { background: var(--accent-soft); color: var(--accent-ink); font-weight: var(--fw-medium); }
.ds-select__opt svg { color: var(--accent-ink); flex-shrink: 0; }

/* ============ Единый SearchInput ============ */
.search-input { position: relative; display: inline-flex; align-items: center; width: 100%; height: var(--h-md); }
.search-input__icon { position: absolute; left: 12px; color: var(--fg-3); pointer-events: none; }
.search-input__field {
  width: 100%; height: var(--h-md); min-height: var(--h-md); padding: 0 14px 0 34px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-sm);
  font-family: var(--font); font-size: var(--fs-md); color: var(--fg);
  transition: box-shadow var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.search-input__field::placeholder { color: var(--fg-4); }
.search-input__field:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-input--sm .search-input__field { height: var(--h-sm); }

/* компактный pill-вариант Select (composer: режим «Спросить», модель) */
.select-ctl--pill { width: auto; height: 30px; padding: 0 8px 0 11px; border-radius: var(--r-full); border-color: transparent; background: var(--surface-2); font-size: var(--fs-row); gap: 5px; font-weight: var(--fw-medium); }
.select-ctl--pill:hover:not(:disabled) { background: var(--accent-soft); border-color: transparent; }
.select-ctl--pill.is-open { background: var(--accent-soft); box-shadow: none; border-color: transparent; }
.select-ctl--pill .select-ctl__val { display: inline-flex; align-items: center; gap: 5px; }
.select-ctl--pill .select-ctl__arrow { width: 13px; height: 13px; }
.select-ctl--ghost { background: transparent; }
.select-ctl--ghost:hover:not(:disabled) { background: var(--surface-2); }

/* --------------- Подсказка на графике (макет .tip): тёмная таблетка над точкой --------------- */
.chart { position: relative; margin-top: 14px; min-width: 0; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.tip {
  position: absolute; pointer-events: none;
  background: var(--chart-tip-bg); color: var(--chart-tip-fg);
  font-size: var(--fs-sm); padding: 8px 10px; border-radius: 10px;
  box-shadow: var(--shadow-lift); opacity: 0;
  transform: translate(-50%, 6px) scale(.96);
  transition: opacity .18s var(--ease), transform .25s var(--spring);
  white-space: nowrap; z-index: 3; line-height: 1.4;
}
.tip.on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.tip b { display: block; font-weight: var(--fw-semibold); margin-bottom: 2px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--fg-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* --------------- Диаграммы: DonutVolume3DChart / PieVolume3DChart (canon/charts.js) ---------------
   Единый формат круговых диаграмм портала: плоское кольцо (макет), легенда рядом, подсветка по наведению. */
.chart3d { display: flex; flex-direction: column; gap: var(--sp-3); }
.chart3d__title { text-align: center; }
.chart3d__body { display: flex; align-items: center; justify-content: center; gap: var(--sp-5); flex-wrap: wrap; }
.chart3d--pie .chart3d__body { flex-direction: column; }
.chart3d__svgwrap { position: relative; flex: none; width: 168px; }
.chart3d--pie .chart3d__svgwrap { width: 220px; }
.chart3d__svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart3d__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.chart3d__cnum { font-size: 17px; font-weight: var(--fw-bold); fill: var(--fg); letter-spacing: -.02em; }
.chart3d__csub { font-size: 10px; fill: var(--fg-3); }
.chart3d__seg { transition: opacity .2s, transform .3s var(--spring); transform-origin: center; transform-box: view-box; cursor: pointer; }
.chart3d__seg.is-hover { transform: scale(1.04); }
.chart3d.is-dim .chart3d__seg:not(.is-hover) { opacity: .35; }
.chart3d__row.is-active { background: var(--surface-2); }
.chart3d__centerValue { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--fg); line-height: 1.1; }
.chart3d__centerLabel { font-size: var(--fs-xs); color: var(--fg-3); margin-top: 2px; }
.chart3d__legend { display: flex; flex-direction: column; gap: 0; min-width: 0; flex: 1 1 200px; list-style: none; margin: 0; padding: 0; }
.chart3d__row { display: flex; align-items: baseline; gap: var(--sp-2); padding: 6px 6px; border-radius: 8px; cursor: default; outline: none; border-top: 1px solid var(--sep); font-size: var(--fs-row); }
.chart3d__row:first-child { border-top: 0; }
.chart3d__row:hover, .chart3d__row:focus-visible { background: var(--surface-2); }
.chart3d__dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.chart3d__name { flex: 1 1 auto; min-width: 0; font-size: var(--fs-row); color: var(--fg); overflow-wrap: anywhere; }
.chart3d__name small { display: block; color: var(--fg-3); font-size: var(--fs-xs); font-weight: normal; }
.chart3d__val { flex: none; font-size: var(--fs-row); font-weight: var(--fw-semibold); color: var(--fg); text-align: right; font-variant-numeric: tabular-nums; }
.chart3d__val small { display: block; font-weight: normal; color: var(--fg-3); font-size: var(--fs-xs); }
.chart3d__badge { text-align: center; font-size: var(--fs-sm); color: var(--fg-3); }
.chart3d__empty { text-align: center; color: var(--fg-3); font-size: var(--fs-sm); padding: var(--sp-4) 0; }
@media (max-width: 480px) { .chart3d__body { flex-direction: column; } }
