﻿/* TimeLine Studio — UI kit (SoT)
   Host: /assets/tls-ui.css. Components are .tls-* only (no bare button/input).
   The page baseline is body: plugin iframes do not load the shell stylesheet.
   Visual language: winDesk «Заказы». Link after tls-tokens.css. */

body {
  margin: 0;
  font-family: var(--font-family-sans);
  line-height: var(--line-height-body);
  color: var(--text);
  background: var(--bg);
  --tls-check-mark-muted: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.2 6.3 11.3 12.8 4.6' fill='none' stroke='%231a1d42' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --tls-check-idle-border: color-mix(in srgb, var(--muted) 42%, var(--border));
  --tls-check-idle-bg: color-mix(in srgb, var(--muted) 36%, var(--surface));
  --tls-check-idle-on: color-mix(in srgb, var(--muted) 62%, var(--surface));
}

/* ——— Buttons ——— */
.tls-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--inset-btn);
  min-height: var(--control-height);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-md);
  font-family: inherit;
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-tight);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.tls-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.tls-btn--block {
  width: 100%;
}

.tls-btn--primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: var(--font-weight-semibold);
  box-shadow: 0 1px 2px rgba(26, 29, 66, 0.12);
}

.tls-btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.tls-btn--primary:focus-visible {
  outline: 2px solid var(--primary-ring);
  outline-offset: 2px;
}

.tls-btn--secondary {
  background: var(--surface);
  color: var(--link);
  border-color: var(--primary-light);
  font-weight: var(--font-weight-medium);
}

.tls-btn--secondary:hover {
  background: var(--primary-subtle);
  border-color: var(--primary);
  color: var(--primary-hover);
}

.tls-btn--secondary.tls-btn--danger,
.tls-btn--secondary.btn-danger {
  color: var(--danger);
  border-color: rgba(212, 59, 59, 0.45);
}

.tls-btn--secondary.tls-btn--danger:hover,
.tls-btn--secondary.btn-danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: #b82e2e;
}

.tls-btn--ghost {
  background: transparent;
  color: var(--link);
  border: none;
  padding: var(--space-1) var(--space-2);
  font-weight: var(--font-weight-medium);
}

.tls-btn--ghost:hover {
  background: var(--primary-subtle);
  color: var(--primary-hover);
}

.tls-btn--danger {
  color: var(--danger);
}

.tls-btn--ghost.tls-btn--danger:hover {
  background: var(--danger-bg);
  color: #b82e2e;
}

/* Не для кнопок управления формой: «Сохранить», «Отмена», «Закрыть», «Удалить» — обычный размер. */
.tls-btn--sm {
  padding: var(--inset-btn-sm);
  min-height: 1.75rem;
  font-size: var(--font-size-sm);
}

.tls-btn--icon {
  width: var(--control-height);
  min-width: var(--control-height);
  padding: 0;
  gap: 0;
}

.tls-btn--icon.tls-btn--sm {
  width: 1.75rem;
  min-width: 1.75rem;
  min-height: 1.75rem;
}

/* Кнопка улучшения текста: яркая, но не главное действие формы. Поэтому она
   не .tls-btn--primary, а своя маленькая заливка акцентом рядом с полем.
   Стили общие: потребитель может переопределить отступы своим классом. */
.tls-improve {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 1.75rem;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    opacity var(--transition-fast);
}

.tls-improve[hidden] {
  display: none;
}

.tls-improve:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.tls-improve:focus-visible {
  outline: 2px solid var(--primary-ring);
  outline-offset: 2px;
}

.tls-improve:disabled {
  opacity: 0.65;
  cursor: progress;
}

.tls-improve__icon {
  display: inline-flex;
  flex: none;
  width: 14px;
  height: 14px;
}

.tls-improve__icon svg {
  display: block;
  width: 14px;
  height: 14px;
}

.tls-improve.is-busy .tls-improve__icon {
  animation: tls-improve-pulse 1s ease-in-out infinite;
}

@keyframes tls-improve-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1); }
}

.tls-btn--icon svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  pointer-events: none;
}

/* Единственный крестик формы. Ширину, высоту и вид локально не перебивать. */
.tls-btn-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.tls-btn-modal-close:hover {
  background: var(--primary-subtle);
  color: var(--text);
}

/* ——— Fields ——— */
.tls-field {
  margin-bottom: var(--gap-form);
}

.tls-field label {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--muted);
  margin-bottom: var(--space-1);
}

.tls-input,
.tls-select,
.tls-textarea,
.tls-field input,
.tls-field select,
.tls-field textarea {
  width: 100%;
  padding: var(--inset-input);
  min-height: var(--control-height);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-md);
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  box-sizing: border-box;
}

.tls-textarea,
.tls-field textarea {
  min-height: 5rem;
  resize: vertical;
}

.tls-input:focus,
.tls-select:focus,
.tls-textarea:focus,
.tls-field input:focus,
.tls-field select:focus,
.tls-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.tls-input:disabled,
.tls-select:disabled,
.tls-textarea:disabled,
.tls-field input:disabled,
.tls-field select:disabled,
.tls-field textarea:disabled,
.tls-input[readonly],
.tls-textarea[readonly],
.tls-field input[readonly],
.tls-field textarea[readonly] {
  background: var(--bg);
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
  border-color: var(--border);
  opacity: 1;
  box-shadow: none;
  cursor: default;
}

.tls-input--revealed[readonly] {
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  background: var(--surface);
  cursor: text;
}

.tls-input:disabled,
.tls-select:disabled,
.tls-textarea:disabled,
.tls-field input:disabled,
.tls-field select:disabled,
.tls-field textarea:disabled {
  cursor: not-allowed;
}

.tls-input:disabled:focus,
.tls-select:disabled:focus,
.tls-textarea:disabled:focus,
.tls-field input:disabled:focus,
.tls-field select:disabled:focus,
.tls-field textarea:disabled:focus,
.tls-input[readonly]:focus,
.tls-textarea[readonly]:focus,
.tls-field input[readonly]:focus,
.tls-field textarea[readonly]:focus {
  border-color: var(--border);
  box-shadow: none;
  outline: none;
}

.tls-field input[type="checkbox"]:disabled,
.tls-field input[type="radio"]:disabled,
.tls-field input[type="file"]:disabled {
  background: transparent;
  color: inherit;
  -webkit-text-fill-color: currentcolor;
  border-color: transparent;
  box-shadow: none;
  opacity: 0.55;
}

.tls-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-form);
}

.tls-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-sm);
  align-items: center;
  margin-top: var(--gap-md);
}

/* ——— Toolbar ——— */
.tls-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap-md);
  margin-bottom: var(--space-4);
  background: var(--surface);
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.tls-toolbar--filters {
  flex-direction: column;
  justify-content: stretch;
  align-items: stretch;
  gap: 0.625rem;
}

.tls-toolbar--actions {
  justify-content: flex-end;
}

/* List screens: toolbar sits above a growing table, no extra bottom gap */
.tls-toolbar--flush {
  margin-bottom: 0;
  flex: 0 0 auto;
  width: 100%;
}

/* Mode switcher (План/Архив, Канбан/Список) */
.tls-segmented {
  display: inline-flex;
  align-items: stretch;
  padding: var(--space-1);
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.tls-segmented__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: var(--control-height);
  padding: var(--space-1) var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.tls-segmented__btn:hover:not(:disabled) {
  color: var(--text);
}

.tls-segmented__btn:focus-visible {
  outline: 2px solid var(--primary-ring);
  outline-offset: 2px;
}

.tls-segmented__btn.is-active,
.tls-segmented__btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow);
}

.tls-segmented__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* In-card horizontal tabs (order/entity cards). Not tls-segmented (view-mode switcher). */
.tls-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2) var(--space-3);
  flex: 0 0 auto;
  padding: var(--space-2) var(--space-4) 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.tls-tabs__list {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--space-1);
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 0 -1px;
  padding: 0;
}

.tls-tabs__tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height-touch);
  min-width: var(--control-height-touch);
  margin: 0;
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  cursor: pointer;
  box-sizing: border-box;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

.tls-tabs__tab:hover {
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.tls-tabs__tab:focus-visible {
  outline: 2px solid var(--primary-ring);
  outline-offset: -2px;
}

.tls-tabs__tab.is-active,
.tls-tabs__tab[aria-selected="true"] {
  color: var(--primary);
  background: var(--surface);
  border-color: var(--border);
  box-shadow: inset 0 -3px 0 var(--primary);
}

.tls-tabs__extra {
  flex: 0 0 auto;
  align-self: center;
  margin-bottom: var(--space-2);
}

/* Вкладки по содержимому: кнопка рядом с последней, а не у дальнего края. */
.tls-tabs--hug .tls-tabs__list {
  flex: 0 1 auto;
}

/* Плюс в ряду вкладок. Размер — как у вкладки, без подписи. */
.tls-tabs__add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-height-touch);
  min-width: var(--control-height-touch);
  min-height: var(--control-height-touch);
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  box-sizing: border-box;
}

.tls-tabs__add:hover {
  background: var(--primary-subtle);
  color: var(--primary);
}

.tls-tabs__add:focus-visible {
  outline: 2px solid var(--primary-ring);
  outline-offset: 2px;
}

.tls-tabs__add svg {
  width: 1.25rem;
  height: 1.25rem;
  pointer-events: none;
}

/* Открытая вкладка и панель под ней — одна поверхность. */
.tls-tabs--sheet {
  background: transparent;
  border-bottom: none;
  padding: 0;
  gap: var(--space-1);
}

.tls-tabs--sheet .tls-tabs__extra {
  align-self: flex-end;
  margin-bottom: 0;
}

.tls-tabs--sheet .tls-tabs__tab.is-active,
.tls-tabs--sheet .tls-tabs__tab[aria-selected="true"] {
  border-bottom: 1px solid var(--surface);
  box-shadow: none;
  z-index: 1;
}

.tls-tabs--sheet + .tls-tabs__panel {
  display: grid;
  gap: var(--gap-form);
  padding: var(--inset-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.tls-tabs--sheet + .tls-tabs__panel.is-closed {
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
}

.tls-tabs__panel {
  min-width: 0;
}

.tls-tabs__panel[hidden],
.tls-tabs__panel.hidden {
  display: none;
}

/* Side rail: sections of one card, labels top to bottom, panel scrolls alone. */
.tls-record-tabs--side {
  display: flex;
  flex: 1 1 auto;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.tls-tabs--side {
  flex: 0 0 9.5rem;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  width: 9.5rem;
  margin: 0;
  padding: var(--space-2) 0 var(--space-2) var(--space-2);
  border-bottom: none;
  border-right: none;
  background: var(--bg);
  box-shadow: inset -1px 0 0 var(--border);
  overflow: auto;
}

.tls-tabs--side .tls-tabs__list {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  margin: 0;
  gap: var(--space-1);
}

.tls-tabs--side .tls-tabs__tab {
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: var(--radius) 0 0 var(--radius);
  text-align: left;
  white-space: normal;
}

/* Открытая вкладка и панель справа — одна поверхность, без шва между ними. */
.tls-tabs--side .tls-tabs__tab.is-active,
.tls-tabs--side .tls-tabs__tab[aria-selected="true"] {
  color: var(--primary);
  background: var(--surface);
  border-color: var(--border);
  border-right-color: var(--surface);
  box-shadow: none;
}

.tls-record-tabs--side > .tls-record-tabs__panels {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: var(--inset-modal-body);
  background: var(--surface);
}

@media (max-width: 30rem) {
  .tls-record-tabs--side {
    flex-direction: column;
  }

  .tls-tabs--side {
    flex: 0 0 auto;
    flex-direction: row;
    width: auto;
    padding: var(--space-2) var(--space-2) 0;
    border-right: none;
    border-bottom: none;
    box-shadow: inset 0 -1px 0 var(--border);
  }

  .tls-tabs--side .tls-tabs__list {
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .tls-tabs--side .tls-tabs__tab {
    width: auto;
    flex: 0 0 auto;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .tls-tabs--side .tls-tabs__tab.is-active,
  .tls-tabs--side .tls-tabs__tab[aria-selected="true"] {
    border-right-color: var(--border);
    border-bottom-color: var(--surface);
  }
}

/* Transient popup (TLSToast). Tone = outcome: error refused/failed, info notice, success done, warning caution. */
.tls-toast {
  position: absolute;
  top: var(--space-2);
  left: 50%;
  transform: translateX(-50%);
  z-index: 75;
  margin: 0;
  max-width: min(36rem, calc(100% - var(--space-6)));
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-tight);
  text-align: center;
  box-shadow: var(--shadow-elevated);
}

.tls-toast.is-hidden,
.tls-toast[hidden] {
  display: none;
}

.tls-toast--error {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-bg);
}

.tls-toast--warning {
  color: var(--warn);
  border-color: var(--warn);
  background: var(--warn-bg);
}

.tls-toast--success {
  color: var(--ok);
  border-color: var(--ok);
  background: var(--ok-bg);
}

.tls-toast--info {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-subtle);
}

/* ——— Table / card ——— */
.tls-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* Сводные плашки: каждая величина — своя карточка, не строка текста. */
.tls-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--space-2);
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.tls-facts__item {
  display: flex;
  flex-direction: column;
  flex: 1 1 11rem;
  min-width: min(100%, 11rem);
  max-width: 100%;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-sizing: border-box;
}

.tls-facts__item dt {
  margin: 0;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: var(--line-height-tight);
}

.tls-facts__item dd {
  margin: var(--space-1) 0 0;
  min-width: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: var(--line-height-tight);
  overflow-wrap: anywhere;
}

.tls-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tls-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-family-sans);
  font-size: var(--table-font-size);
  color: var(--text);
  background: var(--surface);
}

.tls-table th,
.tls-table td {
  box-sizing: border-box;
  height: var(--table-row-height);
  padding: 0 var(--inset-cell-x);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  line-height: var(--table-cell-line-height);
}

.tls-table th {
  height: var(--table-header-height);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.tls-table thead th {
  font-size: var(--table-header-font-size);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--table-header-letter-spacing);
  color: var(--table-header-fg);
  background: var(--table-header-bg);
  border-bottom: 1px solid var(--table-header-border);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.tls-table thead th:hover {
  color: var(--text);
  background: var(--table-header-bg-hover);
}

.tls-table thead th[aria-sort="ascending"],
.tls-table thead th[aria-sort="descending"] {
  color: var(--text);
  font-weight: var(--font-weight-semibold);
  background: var(--table-header-bg-sorted);
}

.tls-table thead th[aria-sort="ascending"]:hover,
.tls-table thead th[aria-sort="descending"]:hover {
  background: var(--table-header-bg-sorted);
}

.tls-table thead th .tls-table__sort {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  cursor: pointer;
  user-select: none;
}

/* Значок стоит с внутренней стороны, чтобы край подписи совпал с текстом ячеек. */
.tls-table thead th.num .tls-table__sort,
.tls-table thead th.tls-num .tls-table__sort {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

.tls-table thead th .tls-table__sort:hover,
.tls-table thead th .tls-table__sort:focus-visible {
  color: var(--text);
}

.tls-table thead th .tls-table__sort:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

.tls-table__sort-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tls-table thead th.num .tls-table__sort-label,
.tls-table thead th.tls-num .tls-table__sort-label {
  text-align: right;
}

.tls-table__sort-mark {
  position: relative;
  flex: 0 0 0.625rem;
  width: 0.625rem;
  height: 0.8rem;
  color: var(--muted);
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.tls-table__sort-mark::before,
.tls-table__sort-mark::after {
  content: "";
  position: absolute;
  left: 0.1rem;
  width: 0.32rem;
  height: 0.32rem;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  border-radius: 0.5px;
}

.tls-table__sort-mark::before {
  top: 0;
  transform: rotate(-45deg);
}

.tls-table__sort-mark::after {
  bottom: 0;
  transform: rotate(135deg);
}

.tls-table thead th[aria-sort="none"]:hover .tls-table__sort-mark,
.tls-table thead th[aria-sort="none"]:focus-within .tls-table__sort-mark {
  opacity: 0.55;
}

.tls-table thead th[aria-sort="ascending"] .tls-table__sort-mark,
.tls-table thead th[aria-sort="descending"] .tls-table__sort-mark {
  color: var(--primary);
  opacity: 1;
}

.tls-table thead th[aria-sort="ascending"] .tls-table__sort-mark::after,
.tls-table thead th[aria-sort="descending"] .tls-table__sort-mark::before {
  opacity: 0.28;
}

.tls-table tbody tr:last-child td {
  border-bottom: none;
}

.tls-table tbody tr:hover {
  background: var(--row-hover);
}

.tls-table .tls-clip {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 22rem;
}

.tls-table[data-text-lines="2"] .tls-clip,
.tls-table[data-text-lines="3"] .tls-clip {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
  max-width: none;
  line-height: var(--table-cell-line-height);
}

.tls-table[data-text-lines="2"] .tls-clip {
  -webkit-line-clamp: 2;
}

.tls-table[data-text-lines="3"] .tls-clip {
  -webkit-line-clamp: 3;
}

/* fit: дата, деньги, количество, номер. Одна строка, ширина по значению. */
.tls-table th.tls-col-fit,
.tls-table td.tls-col-fit {
  width: 1%;
  white-space: nowrap;
}

.tls-table td.tls-col-fit .tls-clip {
  display: block;
  width: auto;
  max-width: none;
  white-space: nowrap;
  text-overflow: ellipsis;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
  overflow-wrap: normal;
}

/* flag: Да/Нет. Узкая колонка, шапка переносится, значение остаётся в одну строку. */
.tls-table th.tls-col-flag,
.tls-table td.tls-col-flag {
  width: 1%;
  max-width: 7.5rem;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  text-align: center;
  white-space: nowrap;
}

.tls-table thead th.tls-col-flag {
  height: auto;
  min-height: var(--table-header-height);
  white-space: normal;
  vertical-align: middle;
  line-height: 1.2;
}

.tls-table thead th.tls-col-flag .tls-table__sort {
  display: grid;
  grid-template-columns: 0.625rem auto 0.625rem;
  align-items: center;
  justify-items: center;
  column-gap: 0.15rem;
  height: auto;
  min-height: var(--table-header-height);
}

.tls-table thead th.tls-col-flag .tls-table__sort-label {
  grid-column: 2;
  grid-row: 1;
  min-width: auto;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.2;
  text-align: center;
}

.tls-table thead th.tls-col-flag .tls-table__sort-mark {
  grid-column: 3;
  grid-row: 1;
}

.tls-table td.tls-col-flag .tls-flag,
.tls-table td.tls-col-flag .tls-yesno {
  white-space: nowrap;
}

/* A user width beats the fit/flag cap. Inline width is the size. */
.tls-table th.is-sized,
.tls-table td.is-sized {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tls-table.tls-table--sized {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

.tls-table tbody tr.tls-table__row--danger td {
  background: var(--danger-bg);
}

.tls-table tbody tr.tls-table__row--danger:hover td {
  background: color-mix(in srgb, var(--danger-bg) 65%, var(--row-hover));
}

.tls-table tbody tr.is-selected,
.tls-table tbody tr[aria-selected="true"] {
  background: var(--row-selected);
}

/* Scale on a cell. The track is absolute, so the row keeps --table-row-height.
   Unknown ids use --as-attention / --as-alarm until .tls-scale--<id> exists below.
   A new shade is added here, not in a plugin. Success green is not a scale color. */
.tls-scale {
  position: relative;
  color: var(--text);
}

.tls-scale--attention,
.tls-scale--as-attention {
  background: var(--warn-bg);
  color: var(--text);
}

.tls-scale--alarm,
.tls-scale--as-alarm {
  background: var(--danger-bg);
  color: var(--text);
}

.tls-scale__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.875rem;
  height: 0.875rem;
  margin-right: 0.35rem;
  vertical-align: -0.15em;
  color: color-mix(in srgb, var(--accent) 45%, var(--muted));
  pointer-events: none;
}

.tls-scale__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.tls-scale--attention > .tls-scale__icon,
.tls-scale--as-attention > .tls-scale__icon {
  color: var(--warn);
}

.tls-scale--alarm > .tls-scale__icon,
.tls-scale--as-alarm > .tls-scale__icon {
  color: var(--danger);
}

.tls-scale__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--space-1);
  pointer-events: none;
}

.tls-scale__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--warn);
}

.tls-scale--normal > .tls-scale__bar > .tls-scale__fill {
  background: color-mix(in srgb, var(--accent) 45%, var(--muted));
}

.tls-scale--attention > .tls-scale__bar > .tls-scale__fill,
.tls-scale--as-attention > .tls-scale__bar > .tls-scale__fill {
  background: var(--warn);
}

.tls-scale--alarm > .tls-scale__bar > .tls-scale__fill,
.tls-scale--as-alarm > .tls-scale__bar > .tls-scale__fill {
  background: var(--danger);
}

.tls-scale__tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--text);
  transform: translateX(-50%);
}

.tls-table tbody tr:hover > td.tls-scale.tls-scale--attention,
.tls-table tbody tr:hover > td.tls-scale.tls-scale--as-attention,
.tls-table tbody tr.is-selected > td.tls-scale.tls-scale--attention,
.tls-table tbody tr.is-selected > td.tls-scale.tls-scale--as-attention,
.tls-table tbody tr[aria-selected="true"] > td.tls-scale.tls-scale--attention,
.tls-table tbody tr[aria-selected="true"] > td.tls-scale.tls-scale--as-attention,
.tls-table tbody tr.tls-table__row--danger:hover > td.tls-scale.tls-scale--attention,
.tls-table tbody tr.tls-table__row--danger:hover > td.tls-scale.tls-scale--as-attention {
  background: var(--warn-bg);
  color: var(--text);
}

.tls-table tbody tr:hover > td.tls-scale.tls-scale--alarm,
.tls-table tbody tr:hover > td.tls-scale.tls-scale--as-alarm,
.tls-table tbody tr.is-selected > td.tls-scale.tls-scale--alarm,
.tls-table tbody tr.is-selected > td.tls-scale.tls-scale--as-alarm,
.tls-table tbody tr[aria-selected="true"] > td.tls-scale.tls-scale--alarm,
.tls-table tbody tr[aria-selected="true"] > td.tls-scale.tls-scale--as-alarm,
.tls-table tbody tr.tls-table__row--danger:hover > td.tls-scale.tls-scale--alarm,
.tls-table tbody tr.tls-table__row--danger:hover > td.tls-scale.tls-scale--as-alarm {
  background: var(--danger-bg);
  color: var(--text);
}

/* Interactive record row: click / Enter / Space opens the card. No per-row Edit button. */
.tls-table tbody tr[data-id] {
  cursor: pointer;
}

.tls-table tbody tr[data-id]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.tls-table .num,
.tls-table .tls-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tls-table a,
.tls-table .tls-link {
  color: var(--link);
  text-decoration: none;
}

.tls-table a:hover,
.tls-table .tls-link:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.tls-table td.empty,
.tls-table td.tls-empty-cell {
  text-align: center;
  color: var(--muted);
  padding: var(--space-6) var(--inset-cell-x);
  height: auto;
  cursor: default;
}

/* Dense rows (settings lists, secondary grids) */
.tls-table--compact th,
.tls-table--compact td {
  height: var(--table-row-height-compact);
  padding: 0 var(--inset-cell-compact-x);
}

.tls-table--compact th {
  height: var(--table-row-height-compact);
}

/* Sticky header inside .tls-table-wrap / scroll parent */
.tls-table--sticky-header thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-clip: padding-box;
  box-shadow: 0 1px 0 var(--table-header-border), 0 10px 14px -12px rgba(26, 29, 66, 0.45);
}

/*
 * Grouped detail table (BOM, labor stages, similar):
 * group header → rows → subtotal (number only) → … → grand total.
 * Do not put "Итого: {group}" text — the group header already names the block.
 */
.tls-table tbody tr.tls-table__group:hover,
.tls-table tbody tr.tls-table__subtotal:hover,
.tls-table tbody tr.tls-table__total:hover,
.tls-table tbody tr.tls-table__empty:hover {
  background: inherit;
}

.tls-table tr.tls-table__group th {
  height: auto;
  min-height: var(--table-row-height-compact);
  padding: var(--space-2) var(--inset-cell-x);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  color: var(--text);
  background: color-mix(in srgb, var(--bg) 70%, var(--surface));
  border-bottom: 1px solid var(--border);
}

.tls-table tr.tls-table__group--danger th {
  color: var(--danger);
  background: var(--danger-bg);
}

.tls-table tbody > tr.tls-table__group:not(:first-child) th {
  border-top: 2px solid var(--border);
}

.tls-table tr.tls-table__empty td {
  color: var(--muted);
  font-size: var(--font-size-sm);
  height: auto;
  padding: var(--space-2) var(--inset-cell-x);
}

.tls-table tr.tls-table__subtotal td {
  font-weight: var(--font-weight-semibold);
  background: color-mix(in srgb, var(--bg) 35%, var(--surface));
  border-top: 1px solid var(--border);
}

.tls-table tr.tls-table__total td {
  font-weight: var(--font-weight-semibold);
  border-top: 2px solid color-mix(in srgb, var(--primary) 45%, var(--border));
  background: var(--primary-subtle);
}

.tls-table tr.tls-table__total:hover td {
  background: color-mix(in srgb, var(--primary-subtle) 80%, var(--surface));
}

.tls-table--compact tr.tls-table__group th,
.tls-table--compact tr.tls-table__empty td,
.tls-table--compact tr.tls-table__subtotal td,
.tls-table--compact tr.tls-table__total td {
  padding-left: var(--inset-cell-compact-x);
  padding-right: var(--inset-cell-compact-x);
}

/* Mobile stack mirroring grouped table (optional companion to desktop table) */
.tls-table-groups {
  display: grid;
  gap: var(--gap-md);
}

.tls-table-group {
  display: grid;
  gap: var(--gap-sm);
}

.tls-table-group__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap-sm);
}

.tls-table-group__head h3,
.tls-table-group__title {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text);
}

.tls-table-group__sum {
  margin: 0;
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.tls-table-groups__total {
  margin: 0;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--primary-subtle);
  font-size: var(--font-size-md);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* ——— Badge / typography / empty ——— */
.tls-badge {
  display: inline-block;
  padding: var(--inset-badge);
  border-radius: 4px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.tls-badge--muted {
  background: var(--bg);
  color: var(--muted);
}

.tls-badge--ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.tls-badge--warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.tls-badge--danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.tls-badge--info {
  background: var(--primary-subtle);
  color: var(--primary);
}

.tls-badge--violet {
  background: var(--violet-bg);
  color: var(--violet);
}

/* ——— Feature flags (признаки) — единый вид во всех плагинах ——— */
.tls-flags,
.im-bom-flags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.tls-flag,
.im-flag,
.mp-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  min-height: 1.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 0.3rem;
  border: 1px solid transparent;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  background: var(--bg, #e6eaf4);
  color: var(--text, #1a1d42);
  box-sizing: border-box;
}

.tls-flag__code,
.im-flag__code,
.mp-flag__code {
  font-family: var(--font-family-mono, Consolas, monospace);
  font-weight: 500;
  opacity: 0.75;
  font-size: 0.95em;
}

.tls-flag--temper,
.im-flag--temper,
.mp-flag--temper {
  background: rgba(196, 90, 30, 0.12);
  border-color: rgba(196, 90, 30, 0.28);
  color: #9a4518;
}

.tls-flag--temper-fz,
.im-flag--temper-fz,
.mp-flag--temper-fz {
  background: rgba(180, 45, 45, 0.1);
  border-color: rgba(180, 45, 45, 0.28);
  color: #a32d2d;
}

.tls-flag--thermo,
.im-flag--thermo,
.mp-flag--thermo {
  background: rgba(47, 85, 200, 0.1);
  border-color: rgba(47, 85, 200, 0.25);
  color: #2f55c8;
}

.tls-flag--ral,
.im-flag--ral,
.mp-flag--ral {
  background: rgba(78, 85, 117, 0.1);
  border-color: rgba(78, 85, 117, 0.22);
  color: #3d4460;
}

.tls-flag--film,
.im-flag--film,
.mp-flag--film {
  background: rgba(59, 168, 232, 0.12);
  border-color: rgba(59, 168, 232, 0.28);
  color: #1f6f9a;
}

.tls-flag--fire,
.im-flag--fire,
.mp-flag--fire {
  background: rgba(180, 45, 45, 0.1);
  border-color: rgba(180, 45, 45, 0.25);
  color: #a32d2d;
}

.tls-flag--shape,
.im-flag--shape,
.mp-flag--shape,
.tls-flag--assembly,
.mp-flag--assembly {
  background: rgba(31, 155, 98, 0.1);
  border-color: rgba(31, 155, 98, 0.25);
  color: #1f9b62;
  font-weight: 500;
}

.tls-flag--glass,
.mp-flag--glass {
  background: rgba(47, 85, 200, 0.1);
  border-color: rgba(47, 85, 200, 0.25);
  color: #2f55c8;
}

.tls-flag--grind,
.mp-flag--grind {
  background: rgba(120, 90, 40, 0.1);
  border-color: rgba(120, 90, 40, 0.28);
  color: #6b4e1e;
}

.tls-flag--spacer,
.mp-flag--spacer {
  background: rgba(78, 85, 117, 0.1);
  border-color: rgba(78, 85, 117, 0.22);
  color: #3d4460;
}

.tls-flag--user,
.mp-flag--user {
  background: rgba(126, 58, 168, 0.1);
  border-color: rgba(126, 58, 168, 0.28);
  color: #6b2f8a;
}

.tls-flag--default,
.mp-flag--default {
  background: var(--bg, #e6eaf4);
  border-color: var(--border, #c8cee0);
}

.tls-flag--off {
  opacity: 0.48;
  border-style: dashed;
  font-weight: 500;
}

.tls-page-title {
  margin: 0;
  font-size: var(--font-h1);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--text);
}

.tls-muted {
  color: var(--muted);
}

.tls-empty {
  text-align: center;
  color: var(--muted);
  padding: var(--space-6);
}

/* ——— Modal chrome ——— */
.tls-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(26, 29, 66, 0.45);
  box-sizing: border-box;
  overscroll-behavior: none;
}

/* display:flex above would otherwise override [hidden] / .hidden */
.tls-modal-overlay.hidden,
.tls-modal-overlay[hidden],
dialog.tls-modal-overlay:not([open]) {
  display: none;
}

.tls-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  max-width: min(640px, 100%);
  max-height: min(90dvh, 100%);
  overflow: auto;
  overscroll-behavior: contain;
  width: 100%;
}

/*
 * While a form/card overlay is open, page (and marked list panes) must not scroll.
 * Plugins may also toggle body.tls-overlay-open / body.modal-open.
 */
body.tls-overlay-open,
body.modal-open,
body:has(.tls-modal-overlay:not(.hidden):not(dialog)),
body:has(dialog.tls-modal-overlay[open]),
body:has(dialog[open]) {
  overflow: hidden;
}

body.tls-overlay-open [data-tls-scroll-main],
body.modal-open [data-tls-scroll-main],
body:has(.tls-modal-overlay:not(.hidden):not(dialog)) [data-tls-scroll-main],
body:has(dialog.tls-modal-overlay[open]) [data-tls-scroll-main],
body:has(dialog[open]) [data-tls-scroll-main] {
  overflow: hidden !important;
}

/* «Удалить» (danger) — первый ребёнок, слева. «Отмена» и «Сохранить» — в __main, справа. */
.tls-modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-sm);
  justify-content: flex-end;
  padding: var(--inset-modal-footer);
  border-top: 1px solid var(--border);
}

.tls-modal-actions:has(.tls-btn--danger) {
  justify-content: space-between;
}

.tls-modal-actions__main {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-sm);
  margin-left: auto;
}

/* Blocking progress overlay (mass replan, order recalc, bulk jobs). Not dismissible. */
.tls-progress-overlay {
  z-index: 1200;
}

.tls-progress-dialog.tls-modal {
  width: min(100%, 22rem);
  max-width: 22rem;
  padding: var(--space-5);
  overflow: hidden;
}

.tls-progress-dialog h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
}

.tls-progress-dialog__label {
  margin: 0 0 var(--space-4);
  color: var(--muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-tight);
  overflow-wrap: anywhere;
}

.tls-progress-dialog__bar {
  height: 0.75rem;
  border-radius: 999px;
  background: var(--primary-subtle);
  overflow: hidden;
}

.tls-progress-dialog__fill {
  display: block;
  height: 100%;
  width: var(--tls-progress-pct, 0%);
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.2s ease;
}

.tls-progress-dialog.is-indeterminate .tls-progress-dialog__fill {
  width: 36%;
  transition: none;
  animation: tls-progress-indet 1.15s ease-in-out infinite;
}

.tls-progress-dialog__count {
  margin: var(--space-4) 0 0;
  text-align: center;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
  line-height: var(--line-height-tight);
  color: var(--text);
}

.tls-progress-dialog__elapsed {
  margin: var(--space-1) 0 0;
  text-align: center;
  color: var(--muted);
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
}

.tls-progress-dialog__hint {
  margin: var(--space-3) 0 0;
  color: var(--muted);
  font-size: var(--font-size-sm);
  text-align: center;
  line-height: 1.35;
}

@keyframes tls-progress-indet {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}

@media (prefers-reduced-motion: reduce) {
  .tls-progress-dialog__fill {
    transition: none;
  }

  .tls-progress-dialog.is-indeterminate .tls-progress-dialog__fill {
    animation: none;
    width: var(--tls-progress-pct, 36%);
  }
}

/* Touch: taller controls without changing desktop Orders look */
@media (max-width: 767px) {
  .tls-btn:not(.tls-btn--sm):not(.tls-btn--ghost) {
    min-height: var(--control-height-touch);
  }

  .tls-btn--icon:not(.tls-btn--sm) {
    width: var(--control-height-touch);
    min-width: var(--control-height-touch);
  }

  .tls-segmented {
    max-width: 100%;
  }

  .tls-segmented__btn {
    min-height: var(--control-height-touch);
  }

  .tls-input,
  .tls-select,
  .tls-field input,
  .tls-field select,
  .tls-combo__option {
    min-height: var(--control-height-touch);
  }

  .tls-field:has(> .tls-switch),
  .tls-field:has(> .tls-yesno),
  .tls-switch {
    min-height: var(--control-height-touch);
  }
}

@media (hover: none) and (pointer: coarse) {
  .tls-btn:not(.tls-btn--sm):not(.tls-btn--ghost) {
    min-height: var(--control-height-touch);
  }

  .tls-btn--icon:not(.tls-btn--sm) {
    width: var(--control-height-touch);
    min-width: var(--control-height-touch);
  }

  .tls-reorder__handle,
  .tls-org__handle {
    min-width: var(--control-height-touch);
    min-height: var(--control-height-touch);
  }
}

/* ——— Shells: record form, list, fields. Button metrics stay on tls-btn. ——— */
.tls-record-form__panel {
  display: flex;
  flex-direction: column;
  width: min(100%, 40rem);
  max-height: min(90dvh, 100%);
  overflow: hidden;
}

.tls-record-form__panel:has(.tls-record-tabs--side) {
  height: 100%;
  max-height: 100%;
}

.tls-record-form__panel > .tls-modal-actions {
  flex: 0 0 auto;
}

.tls-record-form__panel--wide {
  width: min(100%, 64rem);
  max-width: min(100%, 64rem);
}

.tls-personnel-grid {
  display: grid;
  gap: 1rem;
  align-items: start;
}

@media (min-width: 768px) {
  .tls-personnel-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.tls-record-form__body:has(.tls-models) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tls-models {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.tls-models-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(12rem, 1fr);
  flex: 1 1 auto;
  gap: var(--space-4);
  align-items: start;
  min-width: 0;
  min-height: 0;
}

.tls-models-tree {
  position: relative;
  min-width: 0;
  min-height: 12rem;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.tls-models-tree.is-panning,
.tls-models-tree.is-panning * {
  cursor: grabbing;
}

.tls-models-stage {
  transform-origin: 0 0;
  width: max-content;
  min-width: min(100%, 22rem);
}

.tls-models-unassigned {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  order: -1;
  gap: var(--space-1);
  width: auto;
  max-height: min(40dvh, 16rem);
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.tls-models-unassigned .tls-btn {
  justify-content: flex-start;
  width: 100%;
}

@media (min-width: 768px) {
  .tls-models-layout {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
  }

  .tls-models-tree {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
  }

  .tls-models-unassigned {
    order: 0;
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    width: 100%;
    max-height: min(70dvh, 100%);
  }
}

.tls-modal-overlay:has(> .tls-record-form__panel--expanded) {
  align-items: stretch;
}

.tls-record-form__panel--expanded {
  flex: 1 1 auto;
  width: auto;
  max-width: none;
  min-width: 0;
  min-height: 0;
  max-height: none;
}

.tls-record-form__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-md);
  flex: 0 0 auto;
  padding: var(--inset-modal-header);
  border-bottom: 1px solid var(--border);
}

.tls-record-form__header h2 {
  margin: 0;
  font-size: var(--font-h2);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
}

.tls-record-form__body {
  flex: 1 1 auto;
  overflow: auto;
  padding: var(--inset-modal-body);
  min-height: 0;
}

.tls-record-form__body:has(> .tls-record-tabs--side) {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.tls-record-form__error {
  margin: 0;
  padding: var(--space-3) var(--inset-modal-body) 0;
  color: var(--danger);
  font-size: var(--font-size-sm);
}

.tls-confirm__message {
  margin: 0;
}

.tls-field__label {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--muted);
  margin-bottom: var(--space-1);
}

.tls-field__hint {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--muted);
  font-size: var(--font-size-sm);
}

.tls-field__error {
  margin: var(--space-1) 0 0;
  color: var(--danger);
  font-size: var(--font-size-sm);
}

.tls-section {
  display: grid;
  gap: var(--gap-form);
  margin-bottom: var(--space-4);
}

.tls-section__title {
  margin: 0;
  font-size: var(--font-h3);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
}

.tls-password {
  position: relative;
  display: block;
}

.tls-password .tls-input {
  padding-right: calc(var(--control-height) + var(--space-2));
}

.tls-password__toggle {
  position: absolute;
  top: 50%;
  right: var(--space-1);
  transform: translateY(-50%);
}

/* Да/нет: квадрат с галкой слева от подписи, всегда одна строка.
   Включено — залитый квадрат. Выключено — пустой квадрат. */
.tls-field:has(> .tls-switch),
.tls-field:has(> .tls-yesno) {
  --tls-check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.2 6.3 11.3 12.8 4.6' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  justify-content: start;
  column-gap: var(--space-2);
  row-gap: var(--space-1);
  min-height: var(--control-height);
}

.tls-field:has(> .tls-switch) > .tls-field__label,
.tls-field:has(> .tls-yesno) > .tls-field__label {
  display: block;
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  margin-bottom: 0;
  overflow: hidden;
  color: var(--text);
  font-size: var(--font-size-md);
  line-height: var(--line-height-body);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tls-field:has(> .tls-switch:not(:disabled)) > .tls-field__label {
  cursor: pointer;
}

.tls-field:has(> .tls-switch:disabled) {
  cursor: not-allowed;
}

.tls-field:has(> .tls-switch:disabled) > .tls-field__label,
.tls-field:has(> .tls-yesno) > .tls-field__label {
  color: var(--muted);
}

.tls-field:has(> .tls-switch) > .tls-switch,
.tls-field:has(> .tls-yesno) > .tls-yesno {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.tls-field:has(> .tls-switch):not(:has(> .tls-field__label)) > .tls-switch {
  grid-column: 1 / -1;
  min-width: 0;
}

.tls-field:has(> .tls-switch) > :not(.tls-switch):not(.tls-field__label),
.tls-field:has(> .tls-yesno) > :not(.tls-yesno):not(.tls-field__label) {
  grid-column: 1 / -1;
  margin: 0;
}

.tls-switch {
  --tls-check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.2 6.3 11.3 12.8 4.6' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  max-width: 100%;
  min-height: var(--control-height);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font-family: inherit;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-body);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
}

.tls-switch::before,
.tls-yesno {
  flex: 0 0 auto;
  width: 1.125rem;
  height: 1.125rem;
  border: 1.5px solid color-mix(in srgb, var(--text) 42%, var(--border));
  border-radius: 0.25rem;
  background-color: var(--surface);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.8rem 0.8rem;
  box-sizing: border-box;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.tls-yesno {
  --tls-check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.2 6.3 11.3 12.8 4.6' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  color: transparent;
  font-size: 0;
  line-height: 0;
  white-space: nowrap;
  cursor: default;
  vertical-align: middle;
}

.tls-switch::before {
  content: "";
}

.tls-switch.is-on::before,
.tls-switch[aria-checked="true"]::before {
  border-color: var(--primary);
  background-color: var(--primary);
  background-image: var(--tls-check-mark);
}

.tls-switch:hover:not(:disabled)::before {
  border-color: var(--primary);
}

.tls-switch:hover:not(:disabled).is-on::before,
.tls-switch:hover:not(:disabled)[aria-checked="true"]::before {
  border-color: var(--primary-hover);
  background-color: var(--primary-hover);
}

.tls-switch:focus {
  outline: none;
}

.tls-switch:focus-visible::before {
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.tls-switch:disabled {
  opacity: 1;
  color: var(--muted);
  cursor: not-allowed;
}

/* Read-only and disabled stay gray: an editable switch is white or primary. */
.tls-yesno,
.tls-switch:disabled::before,
.tls-checks__item input:disabled {
  border-color: var(--tls-check-idle-border);
  background-color: var(--tls-check-idle-bg);
  background-image: none;
}

.tls-yesno--on,
.tls-switch:disabled.is-on::before,
.tls-switch:disabled[aria-checked="true"]::before,
.tls-checks__item input:disabled:checked {
  border-color: var(--tls-check-idle-on);
  background-color: var(--tls-check-idle-on);
  background-image: var(--tls-check-mark-muted);
}

.tls-switch__track {
  display: none;
}

.tls-list-header {
  flex: 0 0 auto;
  width: 100%;
}

.tls-list-header__search {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 24rem;
}

.tls-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--gap-sm);
  flex: 0 0 auto;
  width: min(100%, 42rem);
  margin-bottom: var(--space-3);
}

.tls-filters__field {
  flex: 1 1 10rem;
  min-width: 0;
  margin-bottom: 0;
}

.tls-checks {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  width: 100%;
  flex: 0 0 auto;
}

.tls-checks__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
}

.tls-checks__item {
  --tls-check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.2 6.3 11.3 12.8 4.6' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--space-2);
  max-width: 100%;
  margin: 0;
  min-height: var(--control-height);
  color: var(--text);
  font-size: var(--font-size-md);
  line-height: var(--line-height-body);
  white-space: nowrap;
  cursor: pointer;
}

.tls-checks__item input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  border: 1.5px solid color-mix(in srgb, var(--text) 42%, var(--border));
  border-radius: 0.25rem;
  background-color: var(--surface);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.8rem 0.8rem;
  box-sizing: border-box;
  cursor: pointer;
}

.tls-checks__item input:checked {
  border-color: var(--primary);
  background-color: var(--primary);
  background-image: var(--tls-check-mark);
}

.tls-checks__item input:hover:not(:disabled) {
  border-color: var(--primary);
}

.tls-checks__item input:hover:not(:disabled):checked {
  border-color: var(--primary-hover);
  background-color: var(--primary-hover);
}

.tls-checks__item input:focus {
  outline: none;
}

.tls-checks__item input:focus-visible {
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.tls-checks__item input:disabled,
.tls-checks__item input:disabled:checked {
  opacity: 1;
  cursor: not-allowed;
}

.tls-checks__item:has(input:disabled) {
  color: var(--muted);
  cursor: not-allowed;
}

.tls-screen-state {
  display: grid;
  justify-items: start;
  gap: var(--space-3);
  flex: 0 0 auto;
  padding: var(--space-4) 0;
}

.tls-screen-state__text {
  margin: 0;
}

.tls-record-table__menu-cell {
  width: 1%;
  white-space: nowrap;
}

.tls-record-table__columns-cell {
  position: sticky;
  right: 0;
  z-index: 1;
  width: 1%;
  padding: 0 var(--space-1);
  text-align: center;
  white-space: nowrap;
  background: var(--surface);
  box-shadow: -8px 0 8px -8px rgba(26, 29, 66, 0.28);
}

/* Titles and the columns icon share one top edge. A lone sticky icon otherwise stays after the header scrolls away. */
.tls-record-table .tls-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-clip: padding-box;
}

.tls-record-table .tls-table thead th.tls-record-table__columns-cell {
  top: 0;
  right: 0;
  z-index: 3;
  background: var(--table-header-bg);
}

.tls-table tbody tr:hover > td.tls-record-table__columns-cell {
  background: var(--row-hover);
}

.tls-table tbody tr.is-selected > td.tls-record-table__columns-cell,
.tls-table tbody tr[aria-selected="true"] > td.tls-record-table__columns-cell {
  background: var(--row-selected);
}

.tls-table tbody tr.tls-table__row--danger > td.tls-record-table__columns-cell {
  background: var(--danger-bg);
}

.tls-table tbody tr.tls-table__row--danger:hover > td.tls-record-table__columns-cell {
  background: color-mix(in srgb, var(--danger-bg) 65%, var(--row-hover));
}

.tls-table thead th.tls-record-table__head {
  position: sticky;
}

.tls-record-table__resize {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 0.75rem;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
}

.tls-record-table__resize::before {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 1px;
  background: transparent;
}

.tls-record-table__resize:hover::before,
.tls-record-table__resize:focus-visible::before,
.tls-record-table__resize.is-active::before {
  background: var(--primary);
}

.tls-record-table__resize:focus {
  outline: none;
}

.tls-record-table__resize:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

body.tls-table-resize-active,
body.tls-table-resize-active * {
  cursor: col-resize !important;
  user-select: none !important;
}

.tls-record-table__panel {
  position: fixed;
  z-index: 1400;
  display: grid;
  align-content: start;
  gap: var(--space-2);
  width: min(22rem, calc(100vw - 1rem));
  max-height: min(70vh, 32rem);
  overflow: auto;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}

.tls-record-table__panel > .tls-btn {
  justify-self: start;
}

@media (hover: none) and (pointer: coarse) {
  .tls-record-table__resize {
    width: 1.25rem;
  }
}

.tls-record-tabs:not(.tls-record-tabs--side) > .tls-record-tabs__panels {
  padding-top: var(--space-3);
}

.tls-combo {
  position: relative;
  display: block;
  width: 100%;
}

.tls-combo__control {
  position: relative;
  min-width: 0;
}

.tls-combo__actions {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  z-index: 1;
  display: flex;
  align-items: stretch;
}

.tls-combo__toggle,
.tls-combo__browse {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: var(--control-height);
  min-width: var(--control-height);
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.tls-combo__actions > :last-child {
  border-top-right-radius: calc(var(--radius-sm) - 1px);
  border-bottom-right-radius: calc(var(--radius-sm) - 1px);
}

.tls-combo--browse .tls-combo__toggle,
.tls-combo--browse .tls-combo__browse {
  border-left: 1px solid var(--border);
}

.tls-combo__browse[hidden] {
  display: none;
}

.tls-picker-browse__hint {
  margin: 0 0 var(--space-3);
  color: var(--muted);
  font-size: var(--font-size-sm);
}

.tls-picker-browse__list {
  min-width: 0;
}

.tls-combo__input {
  width: 100%;
  padding-right: calc(var(--control-height) + var(--space-2));
}

.tls-combo--browse .tls-combo__input {
  padding-right: calc(var(--control-height) * 2 + var(--space-2));
}

.tls-combo__toggle:hover:not(:disabled),
.tls-combo__browse:hover:not(:disabled) {
  color: var(--text);
  background: var(--primary-subtle);
}

.tls-combo__browse:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.tls-combo__toggle:disabled,
.tls-combo__browse:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: transparent;
}

@media (max-width: 767px) {
  .tls-combo__toggle,
  .tls-combo__browse {
    width: var(--control-height-touch);
    min-width: var(--control-height-touch);
  }

  .tls-combo__input {
    padding-right: calc(var(--control-height-touch) + var(--space-2));
  }

  .tls-combo--browse .tls-combo__input {
    padding-right: calc(var(--control-height-touch) * 2 + var(--space-2));
  }
}

.tls-combo__native,
.tls-field select.tls-combo__native,
.tls-field select.tls-combo__native:disabled {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  border-color: transparent;
  box-shadow: none;
  pointer-events: none;
}

.tls-combo__list {
  position: absolute;
  z-index: 4000;
  left: 0;
  right: 0;
  margin: var(--space-1) 0 0;
  padding: var(--space-1);
  box-sizing: border-box;
  max-height: min(16rem, 50dvh);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-elevated);
}

.tls-combo__list[hidden] {
  display: none;
}

.tls-combo__option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  min-height: var(--control-height);
  padding: var(--space-1) var(--space-2);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tls-combo__option:hover,
.tls-combo__option.is-active {
  background: var(--primary-subtle);
}

.tls-combo__label,
.tls-combo__meta {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.tls-combo__meta,
.tls-combo__note {
  color: var(--muted);
  font-size: var(--font-size-sm);
}

.tls-combo__note {
  padding: var(--space-2);
}

.tls-file-field__list {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.tls-file-field__list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.tls-file-field__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tls-file-field__source input {
  display: none;
}

.tls-kanban {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  align-items: flex-start;
}

.tls-kanban__column {
  flex: 0 0 min(100%, 16rem);
  display: grid;
  gap: var(--space-2);
  align-content: start;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.tls-kanban__title {
  margin: 0;
  font-size: var(--font-h3);
  font-weight: var(--font-weight-semibold);
}

.tls-kanban__cards {
  display: grid;
  gap: var(--space-2);
  min-height: 2rem;
}

.tls-kanban__cards.is-drag-over {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.tls-kanban__card {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.tls-kanban__card.is-dragging {
  opacity: 0.45;
}

.tls-kanban__card-title,
.tls-kanban__card-text {
  margin: 0;
}

.tls-kanban__card-text {
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: var(--font-size-sm);
}

.tls-context-menu {
  position: fixed;
  z-index: 1400;
  display: grid;
  min-width: 12rem;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}

.tls-context-menu__item {
  text-align: left;
  min-height: var(--control-height);
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.tls-context-menu__item.is-danger {
  color: var(--danger);
}

.tls-context-menu__item:hover {
  background: var(--primary-subtle);
}

.tls-reorder {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-1);
}

.tls-reorder__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height);
}

.tls-reorder__item.is-dragging {
  opacity: 0.45;
}

.tls-reorder__item.is-drag-over {
  outline: 2px solid var(--primary);
}

.tls-reorder__handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: var(--control-height);
  min-height: var(--control-height);
  cursor: grab;
  color: var(--muted);
  user-select: none;
}

.tls-reorder__handle:active {
  cursor: grabbing;
}

.tls-reorder__content {
  flex: 1 1 auto;
  min-width: 0;
}

.tls-reorder--tree .tls-reorder__item {
  align-items: flex-start;
}

.tls-reorder--tree .tls-reorder__content {
  flex: 1 1 auto;
}

@media (min-width: 768px) {
  .tls-record-table__menu-cell {
    display: none;
  }
}

@media (max-width: 767px) {
  .tls-filters {
    width: 100%;
  }

  .tls-filters__field {
    flex-basis: 100%;
  }
}

/* ——— Org chart. Desktop: cards top-down. Narrow: indented tree. ——— */
.tls-org {
  --tls-org-line: color-mix(in srgb, var(--muted) 42%, var(--border));
  width: max-content;
  min-width: min(100%, 22rem);
  padding: var(--space-1) var(--space-1) var(--space-4);
}

.tls-org__root-drop {
  margin: 0 0 var(--space-3);
  min-height: var(--control-height-touch);
  padding: var(--space-2) var(--space-3);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
  line-height: var(--control-height-touch);
}

.tls-org__root-drop.is-drag-over {
  border-color: var(--primary);
  background: var(--primary-subtle);
  color: var(--text);
}

.tls-org__branches {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.25rem;
}

.tls-org > .tls-org__branches {
  padding-left: 0;
}

.tls-org__node {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  margin: 0;
  padding: 0 0 var(--space-2);
}

.tls-org__node::before {
  content: "";
  position: absolute;
  left: -1.25rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--tls-org-line);
}

.tls-org__node:last-child::before {
  bottom: auto;
  height: calc(1.35rem + 3px);
}

.tls-org > .tls-org__branches > .tls-org__node::before {
  content: none;
}

.tls-org__card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  position: relative;
  width: min(100%, 22rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.tls-org__node > .tls-org__card::before {
  content: "";
  position: absolute;
  left: -1.25rem;
  top: 1.35rem;
  width: 1.25rem;
  border-top: 1px solid var(--tls-org-line);
}

.tls-org > .tls-org__branches > .tls-org__node > .tls-org__card::before {
  content: none;
}

.tls-org__card.is-match {
  border-color: var(--primary);
}

.tls-org__card.is-dragging {
  opacity: 0.45;
}

.tls-org__card.is-drop-child {
  outline: 2px solid var(--primary);
  background: var(--primary-subtle);
}

.tls-org__card.is-drop-before {
  box-shadow: inset 0 3px 0 var(--primary);
}

.tls-org__card.is-drop-after {
  box-shadow: inset 0 -3px 0 var(--primary);
}

.tls-org__handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: start;
  margin-top: var(--space-2);
  min-width: var(--control-height);
  min-height: var(--control-height);
  cursor: grab;
  color: var(--muted);
  touch-action: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

.tls-org__card.tls-org__ghost {
  position: fixed;
  z-index: 500;
  box-sizing: border-box;
  margin: 0;
  pointer-events: none;
  opacity: 1;
  box-shadow: var(--shadow-elevated);
}

body.tls-org-moving,
body.tls-org-moving * {
  cursor: grabbing;
  -webkit-user-select: none;
  user-select: none;
}

.tls-org__handle:active {
  cursor: grabbing;
}

.tls-org__open {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--control-height);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tls-org__name {
  display: block;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  overflow-wrap: break-word;
}

.tls-org__manager {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-tight);
  min-width: 0;
}

.tls-org__manager.is-set {
  color: var(--text);
}

.tls-org__staff {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.tls-org__staff-name {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  color: var(--text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-tight);
}

.tls-org__person-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tls-org .users-avatar {
  width: 1.75rem;
  height: 1.75rem;
  font-size: var(--font-size-xs);
}

.tls-org__card > .tls-btn--icon {
  align-self: start;
  margin: var(--space-2) var(--space-2) var(--space-2) 0;
}

@media (min-width: 1024px) {
  .tls-org__branches {
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    padding: 1.25rem 0 0;
  }

  .tls-org > .tls-org__branches {
    justify-content: flex-start;
    padding-top: 0;
  }

  .tls-org__node {
    align-items: center;
    padding: 1.25rem 0.65rem 0;
    border-left: none;
  }

  .tls-org__node::before,
  .tls-org__node > .tls-org__card::before {
    content: none;
    background: none;
    bottom: auto;
  }

  .tls-org > .tls-org__branches > .tls-org__node {
    padding-top: 0;
  }

  .tls-org__node > .tls-org__branches::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    height: 1.25rem;
    border-left: 1px solid var(--tls-org-line);
  }

  .tls-org__node > .tls-org__branches > .tls-org__node::before,
  .tls-org__node > .tls-org__branches > .tls-org__node::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: auto;
    left: auto;
    width: 50%;
    height: 1.25rem;
    background: none;
    border-top: 1px solid var(--tls-org-line);
  }

  .tls-org__node > .tls-org__branches > .tls-org__node::before {
    right: 50%;
  }

  .tls-org__node > .tls-org__branches > .tls-org__node::after {
    left: 50%;
    border-left: 1px solid var(--tls-org-line);
  }

  .tls-org__node > .tls-org__branches > .tls-org__node:only-child {
    padding-top: 0;
  }

  .tls-org__node > .tls-org__branches > .tls-org__node:only-child::before,
  .tls-org__node > .tls-org__branches > .tls-org__node:only-child::after {
    display: none;
  }

  .tls-org__node > .tls-org__branches > .tls-org__node:first-child::before {
    border: 0;
  }

  .tls-org__node > .tls-org__branches > .tls-org__node:last-child::after {
    border: 0;
  }

  .tls-org__node > .tls-org__branches > .tls-org__node:last-child::before {
    border-right: 1px solid var(--tls-org-line);
    border-radius: 0 0.4rem 0 0;
  }

  .tls-org__node > .tls-org__branches > .tls-org__node:first-child::after {
    border-radius: 0.4rem 0 0 0;
  }

  .tls-org__card {
    width: 17rem;
  }

  .tls-org__card.is-drop-before {
    box-shadow: inset 3px 0 0 var(--primary);
  }

  .tls-org__card.is-drop-after {
    box-shadow: inset -3px 0 0 var(--primary);
  }
}
