/* =======================================================================
   Админ-панель «ЩЩ» — единая система оформления.

   Принципы:
   • тёмная тема по умолчанию, светлая — по кнопке (html[data-theme="light"]);
   • все цвета, радиусы, отступы и тени — только через переменные;
   • hairline-разделители (1px var(--border)) вместо тяжёлых рамок и теней;
   • фиксированные высоты строк таблиц и скелетонов — вёрстка не «дёргается»;
   • без внешних шрифтов, картинок и сборки: файл отдаётся статикой.

   Разметку экранов собирают js/views/*.js; классы .btn/.chip/.field и т.п.
   используются повторно, поэтому переименовывать их нельзя без правки JS.
   ======================================================================= */

/* === Токены темы ======================================================= */

:root {
  color-scheme: dark;

  --bg: #0a0c10;
  --bg-soft: #0d1015;
  --sidebar-bg: #0b0e13;
  --surface: #11151b;
  --surface-2: #171c24;
  --surface-3: #1e242e;
  --surface-4: #27303c;
  --topbar-bg: rgba(10, 12, 16, 0.86);
  --overlay: rgba(4, 6, 9, 0.66);

  --text: #e9eef5;
  --text-muted: #99a4b4;
  --text-dim: #6b7686;

  --border: #212832;
  --border-strong: #303947;
  --border-soft: #1a2028;

  --accent: #7fa7ff;
  --accent-strong: #4d7dff;
  --accent-ink: #07101f;
  --accent-soft: rgba(127, 167, 255, 0.14);
  --accent-soft-2: rgba(127, 167, 255, 0.24);

  --danger: #ff8080;
  --danger-soft: rgba(255, 128, 128, 0.12);
  --success: #52d3a3;
  --success-soft: rgba(82, 211, 163, 0.12);
  --warning: #f5b562;
  --warning-soft: rgba(245, 181, 98, 0.12);
  --info: #79c9ff;
  --info-soft: rgba(121, 201, 255, 0.12);

  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius: 12px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.22);
  --shadow-pop: 0 24px 60px rgba(0, 0, 0, 0.55);

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
    Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

  --sidebar-w: 264px;
  --topbar-h: 60px;
  --page-max: 1440px;
  --transition: 140ms ease;
}

html[data-theme='light'] {
  color-scheme: light;

  --bg: #f5f6f8;
  --bg-soft: #eef0f4;
  --sidebar-bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f5f8;
  --surface-3: #e9edf2;
  --surface-4: #dde3eb;
  --topbar-bg: rgba(245, 246, 248, 0.88);
  --overlay: rgba(15, 20, 28, 0.4);

  --text: #121822;
  --text-muted: #5c6878;
  --text-dim: #8b96a6;

  --border: #e2e7ee;
  --border-strong: #cbd3de;
  --border-soft: #edf0f5;

  --accent: #2f6fed;
  --accent-strong: #2f6fed;
  --accent-ink: #ffffff;
  --accent-soft: rgba(47, 111, 237, 0.09);
  --accent-soft-2: rgba(47, 111, 237, 0.16);

  --danger: #d33f3f;
  --danger-soft: rgba(211, 63, 63, 0.08);
  --success: #17794a;
  --success-soft: rgba(23, 121, 74, 0.09);
  --warning: #9a6208;
  --warning-soft: rgba(154, 98, 8, 0.1);
  --info: #1c6fa8;
  --info-soft: rgba(28, 111, 168, 0.09);

  --shadow-sm: 0 1px 2px rgba(16, 20, 24, 0.06);
  --shadow: 0 1px 2px rgba(16, 20, 24, 0.05), 0 12px 28px rgba(16, 20, 24, 0.06);
  --shadow-pop: 0 24px 60px rgba(16, 20, 24, 0.18);
}

/* === База ============================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app {
  min-height: 100vh;
}

::selection {
  background: var(--accent-soft-2);
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  letter-spacing: -0.01em;
}

.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0;
}

.icon {
  flex: none;
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  border-radius: var(--radius-xs);
}

/* === Каркас: меню + рабочая область ==================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.app-shell[data-collapsed='true'] {
  --sidebar-w: 76px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  transition: width var(--transition), transform 180ms ease;
}

.sidebar__brand {
  flex: none;
  display: flex;
  align-items: center;
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand__mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), var(--accent-strong));
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.brand__name {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand__sub {
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

.sidebar__nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
}

.sidebar__hint {
  margin: 8px 10px;
  font-size: 12px;
  color: var(--text-dim);
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group__label {
  padding: 0 10px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-link.is-active {
  background: var(--accent-soft);
  color: var(--text);
}

.nav-link.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.nav-link__icon {
  display: inline-flex;
  flex: none;
  color: var(--text-dim);
  transition: color var(--transition);
}

.nav-link:hover .nav-link__icon,
.nav-link.is-active .nav-link__icon {
  color: var(--accent);
}

.nav-link__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link__badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--warning);
  color: #1c1204;
  font-size: 10.5px;
  font-weight: 800;
}

.sidebar__foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.sidebar__version {
  color: var(--text-dim);
  font-size: 10.5px;
}

.sidebar__collapse {
  flex: none;
}

.app-shell[data-collapsed='true'] .brand__text,
.app-shell[data-collapsed='true'] .nav-group__label,
.app-shell[data-collapsed='true'] .nav-link__label,
.app-shell[data-collapsed='true'] .nav-link__badge,
.app-shell[data-collapsed='true'] .sidebar__version {
  display: none;
}

.app-shell[data-collapsed='true'] .sidebar__brand {
  justify-content: center;
  padding: 0;
}

.app-shell[data-collapsed='true'] .nav-link {
  justify-content: center;
  padding: 8px 0;
}

.app-shell[data-collapsed='true'] .sidebar__foot {
  justify-content: center;
}

.app-shell[data-collapsed='true'] .nav-group {
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}

.app-shell[data-collapsed='true'] .nav-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.shell-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: var(--overlay);
  border: 0;
}

.workspace {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

/* === Липкая шапка раздела ============================================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--topbar-h);
  padding: 9px 22px;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

/* Скрыт на десктопе: сворачивание меню живёт в подвале сайдбара.
   Селектор с .btn перебивает базовый display у кнопки. */
.topbar__menu.btn {
  display: none;
  flex: none;
}

.topbar__heading {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 300px;
}

.topbar__eyebrow {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}

.topbar__tools > .toolbar {
  margin: 0;
  flex: 1;
  justify-content: flex-end;
}

.topbar__tools > .toolbar .search,
.topbar__tools > .toolbar .toolbar__search {
  flex: 1 1 190px;
  max-width: 300px;
}

.topbar__tools > .toolbar .toolbar__select {
  min-width: 118px;
}

.topbar__side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.topbar__role {
  display: flex;
  align-items: center;
}

.topbar__email {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--text-muted);
}

.topbar__logout .btn__label {
  font-size: 12.5px;
}

.role-chip {
  height: 26px;
  gap: 6px;
  padding: 0 9px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.role-chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.role-chip--unknown {
  border-style: dashed;
  border-color: var(--warning);
}

.role-chip__flag {
  display: inline-grid;
  place-items: center;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: currentColor;
  color: var(--surface);
  font-size: 9px;
  font-weight: 900;
}

.content {
  flex: 1;
  min-width: 0;
}

.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 22px 22px 72px;
}

.page--form {
  max-width: 960px;
}

.page__lead {
  margin: 0 0 18px;
  max-width: 980px;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.page__title {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.page--auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 100vh;
  max-width: none;
  padding: 32px 20px;
}

/* === Кнопки =========================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
    color var(--transition), opacity var(--transition);
}

.btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--surface-4);
}

.btn:active:not(:disabled) {
  background: var(--surface-3);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--text);
}

.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn--danger:hover:not(:disabled) {
  filter: brightness(1.06);
  background: var(--danger);
}

.btn--icon {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
}

.btn--block {
  width: 100%;
}

.btn.is-busy {
  cursor: progress;
}

/* === Бейджи и чипы ==================================================== */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.chip--on {
  background: var(--success-soft);
  color: var(--success);
}

.chip--off {
  background: var(--danger-soft);
  color: var(--danger);
}

.chip--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.chip--warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.chip--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.chip--info {
  background: var(--info-soft);
  color: var(--info);
}

.chip--neutral {
  background: var(--surface-2);
  color: var(--text-muted);
}

.chip--filter {
  height: 26px;
  padding: 0 10px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 550;
  cursor: pointer;
}

.chip--filter:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip--filter.is-active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.row-tag {
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* === Поиск, фильтры, поля ============================================= */

.search,
.toolbar__search {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  flex: 1 1 220px;
  min-width: 160px;
  max-width: 360px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-dim);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search:focus-within,
.toolbar__search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search__input,
.toolbar__search-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  outline: none;
}

.search__input::placeholder,
.toolbar__search-input::placeholder {
  color: var(--text-dim);
}

.search__input::-webkit-search-cancel-button {
  filter: grayscale(1);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}

.toolbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: none;
}

/* Селект в шапке: уже базового `.field__input { width: 100% }` по специфичности. */
.field__input.toolbar__select {
  width: auto;
  min-width: 140px;
  max-width: 220px;
  min-height: 34px;
  font-size: 12.5px;
}

.toolbar__check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.toolbar__check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.field__input {
  width: 100%;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field__input--area {
  min-height: 92px;
  line-height: 1.5;
  resize: vertical;
}

.field__input--select {
  min-height: 36px;
  padding-right: 30px;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23818c9b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}

html[data-theme='light'] .field__input--select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235c6878' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.field__hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.45;
}

.field__error {
  font-size: 11.5px;
  color: var(--danger);
}

.field__error:empty {
  display: none;
}

.field--invalid .field__input {
  border-color: var(--danger);
}

.field--invalid .field__input:focus {
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.field--compact {
  gap: 4px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* === Таблицы ========================================================== */

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  scrollbar-width: thin;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 14px;
  height: 38px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  height: 52px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr {
  transition: background var(--transition);
}

.table tbody tr:hover td {
  background: var(--surface-2);
}

.table__row {
  cursor: pointer;
}

.table__identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.table__identity-text,
.table__stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.table__avatar-wrap {
  flex: none;
  display: inline-flex;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface-3);
}

.table__avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.table__avatar--letter {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.table__title {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table__muted {
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table__small {
  font-size: 10.5px;
}

.table__actions,
.table__actions-head {
  text-align: right;
  white-space: nowrap;
}

.table__actions .btn {
  margin-left: 2px;
}

.table__actions .btn:first-child {
  margin-left: 0;
}

/* Карточка «роль + селект» в таблице сотрудников. */
.role-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.role-select {
  width: auto;
  min-width: 132px;
  max-width: 150px;
  min-height: 28px;
  padding: 3px 26px 3px 8px;
  font-size: 11.5px;
}

/* === Списки и карточки ================================================ */

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list[role='list'] {
  display: flex;
}

.card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color var(--transition), background var(--transition);
}

.card:hover {
  border-color: var(--border-strong);
}

.card--busy {
  opacity: 0.7;
}

.card__main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.card__avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text-muted);
  overflow: hidden;
  border: 1px solid var(--border);
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__emoji {
  font-size: 21px;
  line-height: 1;
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__slug {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__description {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.card__side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.card__actions {
  display: flex;
  gap: 2px;
}

.card--auth {
  display: block;
  width: min(420px, 100%);
  padding: 28px 26px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* === Панели =========================================================== */

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.panel__title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.panel__hint {
  margin: 0;
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.5;
}

.panel__body {
  padding: 16px;
}

.panel__foot {
  display: flex;
  justify-content: flex-end;
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
}

.panel__row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.panel__row--wrap {
  flex-wrap: wrap;
}

.panel__action {
  margin: 12px 16px 16px;
}

.panel__empty {
  margin: 0;
  padding: 4px 16px 16px;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.5;
}

/* === Обзор: метрики =================================================== */

.overview {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.overview__columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 16px;
  align-items: start;
}

.overview__skeleton {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 10px;
}

.metric {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  color: var(--text);
  font: inherit;
  text-align: left;
  min-height: 96px;
  overflow: hidden;
}

.metric--clickable {
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}

.metric--clickable:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.metric--skeleton {
  justify-content: center;
  gap: 8px;
}

.metric__label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.metric__value {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.metric__hint {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.35;
}

.metric--accent .metric__value {
  color: var(--accent);
}

.metric--warning .metric__value {
  color: var(--warning);
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.mini-stat {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.mini-stat__value {
  display: block;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.mini-stat__label {
  font-size: 10.5px;
  color: var(--text-dim);
}

.mini-stat--accent .mini-stat__value {
  color: var(--accent);
}

.mini-stat--warning .mini-stat__value {
  color: var(--warning);
}

.mini-stat--on .mini-stat__value {
  color: var(--success);
}

.mini-stat--off .mini-stat__value {
  color: var(--text-muted);
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-list__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.rank-list__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-list__value {
  flex: none;
  color: var(--text-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.rank-list__track {
  height: 5px;
  margin-top: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.rank-list__bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.inline-error {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 12.5px;
}

.inline-error__text {
  flex: 1 1 200px;
}

/* === Статистика: плитки и графики ==================================== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.stat-grid--roles {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat__label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.stat__value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat__hint {
  font-size: 11px;
  color: var(--text-dim);
}

.stat--accent .stat__value {
  color: var(--accent);
}

.stat--warning .stat__value {
  color: var(--warning);
}

.stat--info .stat__value {
  color: var(--info);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.chart-grid--overview {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  padding: 16px;
}

.chart-card {
  padding: 12px 14px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.chart-grid--overview .chart-card {
  padding: 0;
  border: 0;
  background: transparent;
}

.chart-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.chart-card__title {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
}

.chart-card__hint {
  color: var(--text-dim);
  font-size: 10.5px;
}

.chart {
  width: 100%;
}

.chart__svg {
  display: block;
  width: 100%;
  height: auto;
  color: var(--accent);
}

.chart__svg--success {
  color: var(--success);
}

.chart__svg--danger {
  color: var(--danger);
}

.chart__grid {
  stroke: var(--border);
  stroke-width: 1;
}

.chart__axis-label {
  fill: var(--text-dim);
  font-size: 10px;
  font-family: var(--font-sans);
}

.chart__bar {
  fill: currentColor;
  opacity: 0.85;
}

.chart__bar:hover {
  opacity: 1;
}

.chart__bar--zero {
  opacity: 0.18;
}

.chart__empty {
  margin: 18px 0;
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* === Вкладки и сегменты ============================================== */

.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.tab:hover {
  color: var(--text);
}

.tab--active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tab__count--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.tab--attention .tab__label {
  color: var(--text);
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
}

.segmented__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.segmented__item:hover {
  color: var(--text);
}

.segmented__item.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.segmented__count {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* === Обращения: очередь ============================================== */

.support-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
}

.support-tabs {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.support-tabs__note {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 11.5px;
}

.support-toolbar .segmented {
  margin-bottom: 6px;
}

.support-filters {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 0 2px;
  border-bottom: 1px solid var(--border-soft);
}

.chip-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip-filter__label {
  min-width: 82px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.support-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.support-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 74px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-soft);
  color: inherit;
  text-decoration: none;
  transition: background var(--transition);
}

.support-row:last-child {
  border-bottom: 0;
}

.support-row:hover {
  background: var(--surface-2);
}

.support-row--new {
  box-shadow: inset 2px 0 0 var(--accent);
}

.support-row__avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 700;
}

.support-row__main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.support-row__top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.support-row__user {
  font-size: 13px;
  font-weight: 650;
  margin-right: 2px;
}

.support-row__preview {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.support-row__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-dim);
  font-size: 10.5px;
}

.support-row__side {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 11.5px;
  white-space: nowrap;
}

.support-row__arrow {
  display: inline-flex;
  color: var(--text-dim);
  transition: color var(--transition), transform var(--transition);
}

.support-row:hover .support-row__arrow {
  color: var(--accent);
  transform: translateX(2px);
}

.support-row--skeleton {
  pointer-events: none;
}

.support-row--skeleton .skeleton--avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

/* === Обращения: карточка ============================================= */

.ticket {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ticket-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.ticket-head__main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ticket-head__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
}

.ticket-head__title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.ticket-head__title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.ticket-head__id {
  color: var(--text-dim);
}

.ticket-head__badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.ticket-head__dates {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  color: var(--text-dim);
  font-size: 11px;
  text-align: right;
}

.ticket__columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  gap: 16px;
  align-items: start;
}

.ticket__main,
.ticket__side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.ticket-message__text {
  margin: 0;
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.ticket-message__meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 16px 14px;
  color: var(--text-dim);
  font-size: 11px;
}

.ticket-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 16px 14px;
}

.attachment {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: inherit;
  font: inherit;
  text-decoration: none;
  overflow: hidden;
}

.attachment--image {
  width: 146px;
  padding: 0;
  cursor: zoom-in;
  transition: border-color var(--transition);
}

.attachment--image:hover {
  border-color: var(--accent);
}

.attachment__image {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: cover;
  background: var(--surface-3);
}

.attachment__fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 100px;
  padding: 8px;
  color: var(--text-dim);
  font-size: 10.5px;
  text-align: center;
  overflow: hidden;
}

.attachment__caption {
  display: block;
  padding: 5px 8px;
  font-size: 10.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment--file {
  flex-direction: row;
  align-items: center;
  gap: 9px;
  max-width: 300px;
  padding: 9px 12px;
  transition: border-color var(--transition);
}

.attachment--file:hover {
  border-color: var(--border-strong);
}

.attachment__icon {
  display: inline-flex;
  flex: none;
  color: var(--text-dim);
}

.attachment__file {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.attachment__name {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment__meta {
  font-size: 10.5px;
  color: var(--text-dim);
}

.ticket-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 520px;
  padding: 14px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.thread-message {
  max-width: 92%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.thread-message--support {
  margin-left: auto;
  background: var(--accent-soft);
  border-color: transparent;
}

.thread-message__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
}

.thread-message__author {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.thread-message__date {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

.thread-message__text {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.thread-system {
  align-self: center;
  padding: 3px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 10.5px;
  text-align: center;
}

.ticket-reply {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.ticket-reply .panel__head {
  padding: 0;
  border: 0;
}

.ticket-reply__input {
  min-height: 92px;
}

.ticket-reply__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ticket-reply__counter {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

/* === Живой чат обращения ============================================== */

.chat {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.chat__head-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat__live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chat__live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: chat-live-pulse 2s ease-in-out infinite;
}

.chat__live--offline {
  background: var(--surface-3);
  color: var(--text-dim);
}

.chat__live--offline .chat__live-dot {
  animation: none;
}

@keyframes chat-live-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat__live-dot {
    animation: none;
  }
}

.chat__meta {
  color: var(--text-dim);
  font-size: 11px;
  white-space: nowrap;
}

.chat__body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.chat__scroll {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
  min-height: 260px;
  max-height: 520px;
  padding: 14px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  scroll-behavior: smooth;
}

.chat__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat__day {
  align-self: center;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 10.5px;
}

.chat__system {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 6px;
  max-width: 90%;
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 10.5px;
  text-align: center;
}

.chat__system-time {
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.chat__empty {
  margin: auto;
  max-width: 420px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.bubble {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 86%;
}

.bubble--support {
  flex-direction: row-reverse;
  margin-left: auto;
}

.bubble__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.bubble--support .bubble__avatar {
  background: var(--accent-soft);
  color: var(--accent);
}

.bubble__body {
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.bubble--user .bubble__body {
  border-bottom-left-radius: 4px;
}

.bubble--support .bubble__body {
  border-color: transparent;
  border-bottom-right-radius: 4px;
  background: var(--accent-soft);
}

.bubble--pending .bubble__body {
  opacity: 0.6;
}

.bubble__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.bubble__author {
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
}

.bubble__time {
  color: var(--text-dim);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.bubble__state {
  color: var(--text-dim);
  font-size: 10px;
  font-style: italic;
}

.bubble__text {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat__jump {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgb(0 0 0 / 18%);
}

.chat__jump svg {
  transform: rotate(90deg);
}

.chat__composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.chat__input {
  width: 100%;
  min-height: 42px;
  max-height: 140px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
}

.chat__input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.chat__input:disabled {
  color: var(--text-dim);
  cursor: not-allowed;
}

.chat__send-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat__hint {
  color: var(--text-dim);
  font-size: 10.5px;
}

.chat__counter {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.chat__send {
  flex: none;
}

.chat__readonly {
  margin: 0 16px 16px;
}

/* Точка «новое» в очереди: пользователь писал после открытия карточки. */
.support-row__unread {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* Идентификаторы (чат с ботом, user id) в боковой панели переносятся, а не
   вылезают за карточку: mono-строка ломается по любому символу. */
.defs__value.mono {
  overflow-wrap: anywhere;
}

/* === Состояния, скелетоны, баннеры =================================== */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 320px;
  padding: 40px 24px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.state--inline {
  min-height: 240px;
}

.state__icon {
  display: inline-flex;
  margin-bottom: 4px;
  color: var(--text-dim);
}

.state__title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.state__text {
  margin: 0;
  max-width: 560px;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-line;
}

.state__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

.skeleton {
  display: block;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton--avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.skeleton--title {
  width: 38%;
  height: 13px;
}

.skeleton--line {
  width: 68%;
  height: 9px;
}

.skeleton--short {
  width: 30%;
}

.skeleton--field {
  width: 100%;
  height: 42px;
}

.skeleton-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.card--skeleton {
  align-items: center;
}

.form-skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.table-wrap--skeleton {
  padding: 0;
}

.skeleton-table__head,
.skeleton-table__row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  align-items: center;
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-soft);
}

.skeleton-table__row:last-child {
  border-bottom: 0;
}

.skeleton-table__head {
  height: 38px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.banner--error {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger);
}

.banner--info {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

.banner--warning {
  border-color: transparent;
  background: var(--warning-soft);
  color: var(--warning);
}

.banner__text {
  flex: 1;
  white-space: pre-line;
}

.banner .btn--ghost {
  color: inherit;
}

.section__note {
  margin: 12px 0 0;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.55;
}

.section__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.section__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.section__heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.section__title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.section__subtitle {
  margin: 0;
  max-width: 760px;
  color: var(--text-muted);
  font-size: 12px;
}

/* === Пагинация ======================================================== */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 2px 2px;
}

.pager__info {
  color: var(--text-dim);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.pager__actions {
  display: flex;
  gap: 6px;
}

/* === Формы =========================================================== */

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.form__fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form__section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.form__section-title {
  margin: 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form__progress {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* === Списки «термин — значение» ====================================== */

.defs {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr);
  gap: 7px 16px;
  margin: 0;
}

.defs__term {
  color: var(--text-dim);
  font-size: 11.5px;
}

.defs__value {
  margin: 0;
  font-size: 12.5px;
  word-break: break-word;
}

.defs--compact {
  grid-template-columns: minmax(88px, 104px) minmax(0, 1fr);
  gap: 6px 12px;
}

/* === Ряды действий =================================================== */

.actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.actions-row__group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

/* === Индикаторы ====================================================== */

.dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
}

.dot--on::before {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.dot--off {
  color: var(--text-dim);
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner--sm {
  width: 13px;
  height: 13px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* === Модальные окна ================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 18px 20px 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}

.modal:has(.image-preview) {
  width: min(940px, 96vw);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal__title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.modal__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.modal__text {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-line;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.image-preview__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.image-preview {
  margin: 0;
  display: flex;
  justify-content: center;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.image-preview__img {
  max-width: 100%;
  max-height: 68vh;
  border-radius: var(--radius-xs);
  object-fit: contain;
}

.token {
  display: block;
  max-height: 160px;
  overflow: auto;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  word-break: break-all;
  white-space: pre-wrap;
}

/* === Тосты =========================================================== */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 36px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 13px 11px 14px;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: var(--shadow-pop);
  animation: toast-in 0.18s ease-out;
}

.toast--error {
  border-left-color: var(--danger);
}

.toast--success {
  border-left-color: var(--success);
}

.toast--info {
  border-left-color: var(--accent);
}

.toast__text {
  flex: 1;
  white-space: pre-line;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Вход ============================================================ */

.login {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login__brand {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.login__subtitle {
  margin: -6px 0 4px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.login__roles {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: -4px 0 2px;
}

.login__advanced {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.login__summary {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.login__note {
  margin: 0;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.5;
}

.auth-footer {
  margin: 0;
  color: var(--text-dim);
  font-size: 11px;
  text-align: center;
}

/* === Переключатель =================================================== */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.switch__label {
  font-size: 13px;
  font-weight: 550;
}

.switch__track {
  position: relative;
  display: inline-block;
  flex: none;
  width: 42px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--surface-4);
  transition: background var(--transition);
}

.switch__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: transform var(--transition);
  pointer-events: none;
}

.switch__input:checked + .switch__thumb {
  transform: translateX(18px);
}

.switch:has(.switch__input:checked) .switch__track {
  background: var(--accent);
}

.switch__input:focus-visible + .switch__thumb {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch__input:disabled {
  cursor: default;
}

.switch--compact .switch__track {
  width: 38px;
  height: 22px;
}

.switch--compact .switch__thumb {
  width: 16px;
  height: 16px;
}

.switch--compact .switch__input:checked + .switch__thumb {
  transform: translateX(16px);
}

/* === Загрузка файлов и эмодзи ======================================== */

.upload {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 140px;
  padding: 14px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.upload:hover,
.upload--over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload__preview {
  max-width: 148px;
  max-height: 148px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.upload__placeholder {
  font-size: 12px;
  color: var(--text-muted);
}

.upload__filename {
  font-size: 11px;
  color: var(--text-dim);
  word-break: break-all;
}

.upload__clear {
  position: absolute;
  top: 6px;
  right: 6px;
}

.emoji-field__button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.emoji-field__button:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.emoji-field__symbol {
  font-size: 22px;
  line-height: 1;
}

.emoji-field__hint {
  font-size: 11px;
  color: var(--text-dim);
}

.emoji-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.emoji-picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 5px;
  max-height: 46vh;
  overflow: auto;
  padding-right: 4px;
}

.emoji-picker__item {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.emoji-picker__item:hover {
  border-color: var(--border-strong);
  background: var(--accent-soft);
}

.emoji-picker__item--active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.emoji-picker__empty,
.emoji-picker__more {
  margin: 0;
  color: var(--text-dim);
  font-size: 11px;
}

/* === Стикеры ========================================================= */

/* Шапка каталога стикеров: вкладки «Стикеры»/«Эмодзи» и фильтр анимации. */
.sticker-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border-soft);
}

.sticker-filters .chip-filter {
  margin-left: auto;
}

/* Заголовок группы в списке паков: «С анимацией» / «Без анимации». */
.group-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 6px 0 -2px;
  padding: 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.group-head:first-child {
  margin-top: 0;
}

.group-head__title {
  color: var(--text-muted);
}

.group-head__count {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.group-head__hint {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-dim);
  opacity: 0.8;
}

/* Сводка по анимации в редакторе пака. */
.sticker-rows__summary {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.sticker-rows__summary:empty {
  display: none;
}

/* Чип «анимация: lottie|webp» в строке стикера. */
.sticker-row__anim {
  align-self: center;
  white-space: nowrap;
}

.sticker-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sticker-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.sticker-row__media {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.sticker-row__emoji {
  flex: 0 0 auto;
  width: 96px;
}

.sticker-row__emoji .emoji-field__button {
  width: 100%;
  justify-content: center;
}

.sticker-row__drop {
  position: relative;
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 100px;
  padding: 10px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.sticker-row__drop:hover {
  border-color: var(--accent);
}

.sticker-row__drop--filled {
  border-style: solid;
}

.sticker-row__previews {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sticker-row__thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.sticker-row__thumb img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.sticker-row__thumb-label {
  font-size: 10px;
  color: var(--text-dim);
}

.sticker-row__no-image {
  font-size: 12px;
  color: var(--text-dim);
}

.sticker-row__status {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-dim);
}

.sticker-row__fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sticker-row__author-toggle {
  align-self: flex-start;
}

.sticker-row__author {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

/* === Dev: коды из писем ============================================== */

.code-cell {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-height: 30px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.code-cell .mono {
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--text);
}

.code-cell__hint {
  color: var(--text-dim);
  font-size: 10px;
  opacity: 0;
  transition: opacity var(--transition);
}

.code-cell:hover .code-cell__hint,
.code-cell:focus-visible .code-cell__hint {
  opacity: 1;
}

.gift-emoji {
  font-size: 19px;
  line-height: 1;
}

/* === Журнал действий ================================================= */

.audit-when {
  display: flex;
  flex-direction: column;
  gap: 1px;
  white-space: nowrap;
  font-size: 12px;
}

.audit-action {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.audit-action__label {
  font-size: 12.5px;
  font-weight: 600;
}

.audit-action__code {
  color: var(--text-dim);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.audit-details {
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.load-more {
  display: flex;
  justify-content: center;
  padding: 4px 0;
}

/* === Служебное ======================================================= */

.noscript {
  display: block;
  padding: 24px;
  color: var(--text-muted);
  text-align: center;
}

/* === Адаптив ========================================================= */

@media (max-width: 1280px) {
  .topbar__email {
    display: none;
  }

  .mini-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  /* Планшет: меню по умолчанию свернуто до иконок (см. JS: syncResponsive). */
  .topbar__heading {
    max-width: 220px;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    width: 264px;
    transform: translateX(-100%);
    box-shadow: none;
  }

  .app-shell[data-nav='open'] .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-pop);
  }

  .workspace {
    margin-left: 0;
  }

  .topbar {
    padding: 8px 14px;
    gap: 10px;
  }

  .topbar__menu.btn {
    display: inline-flex;
  }

  .topbar__heading {
    max-width: 34vw;
  }

  .page {
    padding: 16px 14px 56px;
  }

  .ticket__columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .ticket__side {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  .overview__columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
  }

  .topbar__heading {
    max-width: calc(100vw - 150px);
  }

  .topbar__tools {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .topbar__tools > .toolbar {
    justify-content: flex-start;
  }

  /* Узкий экран: поиск сжимается, чтобы фильтры и «Обновить» влезли в строку. */
  .topbar__tools > .toolbar .search,
  .topbar__tools > .toolbar .toolbar__search {
    flex: 1 1 110px;
    min-width: 96px;
  }

  .topbar__tools .btn {
    padding: 6px 9px;
  }

  .topbar__side {
    margin-left: auto;
  }

  .topbar__logout .btn__label {
    display: none;
  }

  .metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .metric__value {
    font-size: 23px;
  }

  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .support-row {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
  }

  .support-row__side {
    grid-column: 2;
    justify-content: space-between;
  }

  .support-row__arrow {
    display: none;
  }

  .support-tabs__note {
    margin-left: 0;
    width: 100%;
  }

  .chip-filter__label {
    min-width: 100%;
  }

  .defs {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .defs__term {
    margin-top: 8px;
  }

  .defs--compact {
    grid-template-columns: minmax(0, 1fr);
  }

  .card {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .card__side {
    justify-content: space-between;
  }

  .form__head {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .page__title {
    font-size: 19px;
  }

  .table th,
  .table td {
    padding: 8px 10px;
  }

  .topbar__title {
    font-size: 14px;
  }

  .ticket-head__dates {
    align-items: flex-start;
    text-align: left;
  }

  .ticket__side {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Чат на узком экране: лента ниже, подсказка про Enter не нужна. */
  .chat__scroll {
    min-height: 220px;
    max-height: 58vh;
  }

  .chat__hint {
    display: none;
  }

  .bubble {
    max-width: 94%;
  }

  .chat__meta {
    white-space: normal;
    text-align: right;
  }

  .chart-grid,
  .chart-grid--overview {
    grid-template-columns: minmax(0, 1fr);
  }

  .mini-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .metric-grid,
  .stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .mini-stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar__heading {
    max-width: calc(100vw - 120px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }

  .spinner {
    animation-duration: 2.4s;
  }

  .toast,
  .sidebar,
  .workspace,
  .metric--clickable {
    transition: none;
    animation: none;
  }
}
