/* PsyAI app-specific styles on top of shared-ui (loaded after /shared/style.css) */

/* ── Токены расширения дизайн-системы (shared-ui канон не меняем) ── */
:root {
  /* Шкала шрифта (2026-10-24: пропорциональное масштабирование ×7/6, рабочий мелкий 12→14; синхронно с shared-ui) */
  --text-3xs: 13px;
  --text-2xs: 14px;
  --text-xs: 15px;
  --text-sm: 16px;
  --text-md: 19px;
  --text-base: 18px;
  --text-lg: 20px;
  --text-xl: 21px;
  --text-2xl: 26px;
  --text-invert: #fff;
  /* Radius-роли: sharp — контейнеры/кнопки/таблицы; chip — чипы и мелочь;
     media — только живые видео-плитки; pill/FAB — пилюли */
  --radius-sharp: 0;
  --radius-chip: 2px;
  --radius-media: 8px;
  --radius-pill: 999px;
  --radius-circle: 50%;
  /* Шкала иконок */
  --icon-xs: 14px;
  --icon-sm: 16px;
  --icon-base: 18px;
  --icon-lg: 22px;
  --icon-xl: 24px;
  /* Тёмная сцена видео (LiveKit-контейнер, полноэкранная модалка,
     гостевая комната — guest.css объявляет те же значения) */
  --stage-bg: #141414;
  --stage-surface: #1c1c1c;
  --stage-control: #222222;
  --stage-control-hover: #2e2e2e;
  --stage-border: var(--stage-border);
  --stage-border-strong: var(--stage-border-strong);
  --stage-border-hover: var(--stage-border-hover);
  --stage-text: #e5e5e5;
  --stage-text-faint: #9a9a9a;
  --stage-overlay: rgba(0, 0, 0, 0.5);
  --stage-overlay-strong: rgba(20, 20, 20, 0.92);
  --stage-overlay-solid: rgba(20, 20, 20, 0.95);
  --stage-unlock-bg: rgba(0, 0, 0, 0.7);
  --stage-banner-danger: rgba(169, 50, 38, 0.94);
  --stage-danger-border: var(--stage-danger-border);
  --stage-danger-text: #e8b4ad;
  --stage-glass: rgba(255, 255, 255, 0.15);
  --stage-glass-hover: rgba(255, 255, 255, 0.25);
  --stage-thumb-outline: rgba(255, 255, 255, 0.15);
  --stage-thumb-outline-hover: rgba(255, 255, 255, 0.45);
}

/* ── Page header ─────────────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-base);
  flex-wrap: wrap;
  margin-bottom: var(--space-xl);
}
.page-head .page-title { margin-bottom: 0; }
.page-head .page-subtitle {
  margin: var(--space-xs) 0 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ── Links that behave as blocks ────────────────────────────── */
a.stat-card {
  color: inherit;
  text-decoration: none;
  display: block;
}
a.stat-card:hover { text-decoration: none; }
.stat-sub { margin-top: var(--space-xs); font-size: var(--text-sm); color: var(--text-secondary); }

/* ── Sidebar icons ──────────────────────────────────────────── */
/* Ширина сайдбара: подписи меню («Мастер-классы», «Пользователи»)
   не должны выходить за границы — расширяем shared-ui 140px до 200px
   (на ≤768px сайдбар скрыт, меню живёт в #headerMenu) */
@media (min-width: 769px) {
  .sidebar { width: 200px; }
  .sidebar-main { margin-left: 200px; }
}
.sidebar-link svg {
  width: var(--icon-sm);
  height: var(--icon-sm);
  flex-shrink: 0;
  margin-right: var(--space-md);
  stroke-width: 1.5;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-footer { padding: var(--space-sm); }
#admin-nav-item { flex: none; }

/* ── Sidebar: вложенные пункты админки ───────────────────── */
.sidebar-link--sub {
  font-size: 0.9em;
  color: var(--text-secondary);
  padding-left: calc(var(--space-lg) + var(--space-md));
}
.sidebar-link--sub:hover { color: var(--text-primary); }
.sidebar-link--sub.active { color: var(--accent); }
.sidebar-link--sub svg {
  width: var(--icon-xs, 14px);
  height: var(--icon-xs, 14px);
}

/* ── Panels ─────────────────────────────────────────────────── */
.section-title {
  font-size: var(--text-md);
  letter-spacing: 0.08em;
}
.panel--flush { padding: 0; }
.panel--flush .panel-head { margin: 0 18px; }
#clientDetails p { overflow-wrap: anywhere; margin-top: var(--space-md); }
.panel--client-events .panel-head { padding-top: var(--space-md); margin-bottom: var(--space-base); }
.panel-body code { overflow-wrap: anywhere; word-break: break-word; }
.admin-users-panel .panel-head { margin: var(--space-2xl) 18px var(--space-xl); }
.panel-body { padding: 0; }

.file-cell {
  display: grid;
}
.file-card {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: var(--space-xl);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  transition: border-color var(--transition-fast);
}
.file-card:hover { border-color: var(--border-strong); }
.file-card p { margin: 0; font-size: var(--text-sm); color: var(--text); }
.icon-lg {
  width: var(--icon-xl);
  height: var(--icon-xl);
  stroke: var(--text-faint);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.center-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-base);
}
.flex-inline { display: flex; align-items: center; }
.session-rec-btn-wrap {
  display: flex;
  justify-content: center;
  margin-top: var(--space-md);
}

/* ── Inline helpers (bootstrap replacements) ────────────────── */
/* spread-вариант: shared-ui .row-inline = flex-start без wrap */
.row-inline--spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}
.btn-group-wrap { gap: var(--space-sm); }
.mb-4 { margin-bottom: var(--space-xl); }
.text-faint-12 { font-size: var(--text-xs); }
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 var(--space-md);
}
@media (max-width: 768px) {
  .form-grid-3 { grid-template-columns: 1fr; }
}
.form-text {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-faint);
  margin-top: var(--space-xs);
}
.icon-sm {
  width: var(--icon-sm);
  height: var(--icon-sm);
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vertical-align: -3px;
}
.layout-content svg:not([width]) {
  width: var(--icon-base);
  height: var(--icon-base);
  flex: none;
}
.layout-content svg.icon-lg:not([width]) { width: var(--icon-xl); height: var(--icon-xl); }
.empty-icon svg:not([width]) { width: 44px; height: 44px; color: var(--text-faint); }
.icon-file {
  width: var(--icon-sm);
  height: var(--icon-sm);
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vertical-align: -3px;
  margin-right: var(--space-xs);
  flex: none;
}
.icon-inline {
  width: var(--icon-xs);
  height: var(--icon-xs);
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  margin-right: var(--space-xs);
  vertical-align: -2px;
}

/* ── Grids (bootstrap row/col replacement) ──────────────────── */
.grid-sidebar {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-base);
  align-items: start;
}
.grid-sidebar > * { min-width: 0; }
.grid-sidebar > .full { grid-column: 1 / -1; }
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-base);
}
.grid-12 > .col-4 { grid-column: span 4; }
.grid-12 > .col-8 { grid-column: span 8; }
.grid-12 > .col-12 { grid-column: span 12; }
.file-cell { grid-column: span 3; }
@media (max-width: 900px) {
  .file-cell { grid-column: span 6; }
}
@media (max-width: 900px) {
  .grid-sidebar { grid-template-columns: 1fr; }
  .grid-12 > .col-4,
  .grid-12 > .col-8 { grid-column: span 12; }
}

/* ── Modal sizing variants ──────────────────────────────────── */
.modal-box--form {
  width: min(560px, 94vw);
  height: auto;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box--wide {
  width: min(880px, 94vw);
  height: auto;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box--narrow {
  width: min(440px, 94vw);
  height: auto;
  max-height: 90vh;
  overflow-y: auto;
}
@media (max-width: 768px) {
  .modal-box--form { width: min(560px, 98vw); }
  .modal-box--wide { width: min(880px, 98vw); }
  .modal-box--narrow { width: min(440px, 98vw); }
}
.modal-box .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}
.modal-box .modal-actions .btn-danger:first-child { margin-right: auto; }

/* OnlyOffice editor modal */
.modal-box--office {
  width: 98vw;
  max-width: 98vw;
  height: 98vh;
  max-height: 98vh;
  padding: 0;
  overflow: hidden;
}
.modal:has(.modal-box--office) { padding: 1vh 1vw; }
.office-modal-top {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.office-modal-title {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.office-modal-status {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  padding-inline: var(--space-sm);
}
.office-editor-host {
  flex: 1 1 auto;
  min-height: 0;
}
.office-editor-host iframe { width: 100% !important; height: 100% !important; border: 0; display: block; }
/* DocsAPI moves the editor iframe into modal-box after the header with a fixed pixel
   height (overflow in Firefox) — force it to fill remaining flex space instead. */
.modal-box--office > iframe {
  flex: 1 1 auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0;
  border: 0;
  display: block;
}
@media (max-width: 768px) {
  .modal:has(.modal-box--office) { padding: 1vh 1vw; }
  .modal-box--office { width: 98vw; max-width: 98vw; height: 98vh; max-height: 98dvh; }
}

/* ── Clients in event form / picker ─────────────────────────── */
.client-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}
.client-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  background: var(--bg-elevated);
}
.client-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-chip);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  flex: none;
}
.client-remove-btn .icon-inline { margin-right: 0; }
.client-remove-btn:hover {
  color: var(--danger);
  background: var(--danger-soft);
}
.client-picker-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  max-height: 50vh;
  overflow-y: auto;
}
.client-multi__item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  cursor: pointer;
}
.client-multi__item:hover { border-color: var(--accent); }

/* ── Guest invite dropdown menu ─────────────────────────────── */
.guest-invite-menu {
  position: fixed;
  z-index: 2100;
  min-width: 240px;
  max-width: min(360px, calc(100vw - 16px));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  box-shadow: 0 6px 20px rgba(23, 31, 43, 0.18);
  padding: var(--space-xs);
}
.guest-invite-menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-xs) var(--space-sm);
  border: none;
  border-radius: var(--radius-chip);
  background: transparent;
  color: var(--text);
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
}
.guest-invite-menu__item:hover { background: var(--accent-soft); }
.guest-invite-menu__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.guest-invite-menu__icon { display: inline-flex; flex: none; color: var(--text-secondary); }
.guest-invite-menu__icon .icon-inline { margin-right: 0; }
.guest-invite-menu__item.is-copied { color: var(--accent); }
.guest-invite-menu__item.is-copied .guest-invite-menu__icon { color: var(--accent); }
.guest-invite-menu__item--all { color: var(--text-secondary); font-size: var(--text-sm); }
.guest-invite-menu__sep { height: 1px; background: var(--border); margin: var(--space-xs) 0; }
.guest-invite-menu__hint {
  padding: var(--space-xs) var(--space-sm) 2px;
  font-size: var(--text-2xs);
  color: var(--text-faint);
}

/* ── Error pages ─────────────────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}
.error-code {
  font-family: var(--font-display);
  font-size: 84px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

/* ── Reveal animations ──────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.05s; }
.reveal-delay-2 { transition-delay: 0.12s; }
.reveal-delay-3 { transition-delay: 0.19s; }

/* ── Transcript / markdown ───────────────────────────────────── */
.transcript-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text-secondary);
  max-height: 420px;
  overflow-y: auto;
  padding: var(--space-lg);
  background: var(--bg);
  border: 1px solid var(--border);
}

#fileViewerModal .transcript-text {
  max-height: none;
  min-height: 100%;
  box-sizing: border-box;
  margin: 0;
}

/* ── FullCalendar overrides ─────────────────────────────────── */
.fc {
  --fc-border-color: var(--border);
  --fc-page-bg-color: var(--panel);
  --fc-today-bg-color: color-mix(in srgb, var(--accent-soft) 40%, transparent);
  --fc-event-border-color: var(--accent);
  --fc-neutral-bg-color: var(--bg-elevated);
  font-size: var(--text-sm);
}
.fc a { color: var(--text); text-decoration: none; }
.fc a:hover { text-decoration: none; }
.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number {
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 6px 8px;
}
.fc .fc-toolbar-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text);
  text-transform: capitalize;
}
.fc .fc-button {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sharp);
  box-shadow: none;
  font-size: var(--text-xs);
  padding: 5px 12px;
}
.fc .fc-button:hover {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-strong);
}
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-invert);
}
.fc .fc-button:focus,
.fc .fc-button:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 1px;
  box-shadow: none;
}
.fc .fc-event {
  border-radius: var(--radius-sharp);
  font-size: var(--text-2xs);
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}
.fc .fc-event:hover {
  background: var(--accent);
  color: var(--text-invert);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent);
}
.fc .fc-v-event .fc-event-main { color: var(--accent); }
.fc .fc-event:hover .fc-event-main { color: var(--text-invert); }
.fc .fc-timegrid-event .fc-event-time { font-size: var(--text-2xs); }

/* Время + название в одну строку с переносом текста (eventContent: fc-event-oneline) */
.fc .fc-event-oneline { white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
.fc .fc-event-oneline .fc-event-time { display: inline; font-weight: 600; }
.fc .fc-event-oneline .fc-event-title { display: inline; white-space: normal; overflow: visible; text-overflow: clip; }
.fc .fc-daygrid-dot-event { white-space: normal; }
.fc .fc-daygrid-dot-event .fc-event-title { white-space: normal; overflow: visible; text-overflow: clip; }

/* Клиенты в плитке события — второстепенная строка */
.fc .fc-event-clients {
  font-size: var(--text-3xs);
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Статусные плитки: активное — success, завершённое — neutral, отменённое — danger */
.fc .fc-event--active {
  background: var(--success-soft);
  border-color: var(--success-soft);
  color: var(--success);
}
.fc .fc-v-event.fc-event--active { border-left: 3px solid var(--success); }
.fc .fc-event--active:hover { background: var(--success); color: var(--text-invert); }
.fc .fc-v-event.fc-event--active .fc-event-main { color: var(--success); }
.fc .fc-event--completed {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
.fc .fc-event--completed:hover {
  background: var(--bg-elevated);
  color: var(--text);
  transform: none;
  box-shadow: none;
}
.fc .fc-v-event.fc-event--completed .fc-event-main { color: var(--text-secondary); }
.fc .fc-event--completed:hover .fc-event-main { color: var(--text); }
.fc .fc-event--cancelled {
  background: var(--danger-soft);
  border-color: var(--danger-soft);
  color: var(--danger);
}
.fc .fc-event--cancelled .fc-event-title { text-decoration: line-through; }
.fc .fc-event--cancelled:hover { background: var(--danger); color: var(--text-invert); }
.fc .fc-v-event.fc-event--cancelled .fc-event-main { color: var(--danger); }
.fc .fc-event--cancelled:hover .fc-event-main { color: var(--text-invert); }

/* «+N ещё» в month-виде (dayMaxEvents) */
.fc .fc-daygrid-more {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: var(--text-2xs);
  font-weight: 600;
  cursor: pointer;
  padding: 1px 4px;
}
.fc .fc-daygrid-more:hover { color: var(--accent-hover); text-decoration: underline; }

.fc .fc-daygrid-day.fc-day-today { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
  color: var(--accent);
  font-weight: 700;
}
.fc .fc-timegrid-now-indicator { border-color: var(--danger); }
.fc .fc-timegrid-now-indicator-arrow { border-top-color: var(--danger); border-bottom-color: var(--danger); }
.fc .fc-popover,
.fc .fc-more-popover .fc-popover-body {
  background: var(--panel);
  border: 1px solid var(--border);
}
.fc .fc-more-cell { padding: 0 2px; }
.calendar-body { padding: var(--space-base); }

/* ── Mobile calendar (≤768px) ───────────────────────────────── */
.cal-fab { display: none; }

@media (max-width: 768px) {
  /* Основное действие в шапке заменяет FAB */
  .page-head #new-event-btn { display: none; }

  /* Плавающая кнопка «Новое событие» */
  .cal-fab {
    position: fixed;
    right: 16px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: var(--text-invert);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 38%, transparent);
    cursor: pointer;
    z-index: 90;
  }
  .cal-fab svg { width: var(--icon-xl); height: var(--icon-xl); }
  .cal-fab:active { transform: scale(0.94); }

  /* Календарь на всю ширину — снимаем двойные отступы */
  .calendar-body { padding: 0; }

  /* Тулбар: три аккуратные строки по центру — заголовок, навигация, переключатель вида */
  .fc .fc-header-toolbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    margin: 0;
  }
  .fc .fc-toolbar-chunk { display: flex; justify-content: center; width: 100%; }
  /* Порядок строк тулбара: заголовок → навигация → переключатель вида */
  .fc .fc-toolbar-chunk:nth-child(2) { order: -1; }
  .fc .fc-toolbar-title { font-size: var(--text-lg); text-align: center; }

  /* Touch-targets ≥44px */
  .fc .fc-button { min-height: 44px; min-width: 44px; padding: 8px 12px; }
  .fc .fc-button-group .fc-button { padding: 8px 10px; }
  .fc .fc-col-header-cell-cushion,
  .fc .fc-daygrid-day-number { padding: 6px; font-size: var(--text-xs); }

  /* Плотность month-вида: событие — одна строка, время и клиенты скрыты */
  .fc .fc-daygrid-day-frame { min-height: 40px; }
  .fc .fc-daygrid-day-events { font-size: var(--text-3xs); }
  .fc .fc-event { padding: 1px 4px; font-size: var(--text-3xs); }
  .fc .fc-event-time { display: none; }
  .fc .fc-daygrid-event .fc-event-clients { display: none; }

  /* timeGridDay: читаемые слоты во всю ширину */
  .fc .fc-timegrid-slot { height: 2.4em; }
  .fc .fc-timegrid-now-indicator-arrow { display: none; }

  /* Поп-овер «+N ещё» не выходит за границы вьюпорта */
  .fc .fc-popover,
  .fc .fc-more-popover { max-width: calc(100vw - 16px); box-sizing: border-box; }
}

/* ── LiveKit video ──────────────────────────────────────────── */
.livekit-video-container {
  background: var(--stage-bg);
  border: 1px solid var(--border);
  min-height: var(--video-height, 480px);
  display: flex;
  flex-direction: column;
}
.livekit-video-stage {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2px;
  padding: var(--space-md);
  min-height: 360px;
}
.livekit-video-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000; /* letterbox живого видео — эталонный чёрный, вне палитры */
}
.lk-stage-wrapper {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 360px;
  background: var(--video-bg);
  overflow: hidden;
}
.lk-main-tile { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
/* Авто-сетка: 2 участника — split, 3+ — spotlight + полоса миниатюр */
.lk-stage-split {
  position: absolute; inset: 0; padding: 8px;
  display: grid; grid-template-rows: 1fr 1fr; gap: 8px;
}
@media (orientation: landscape) {
  .lk-stage-split { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
}
.lk-split-tile { position: relative; inset: auto; overflow: hidden; border-radius: var(--radius-media); }
.lk-stage-spot {
  position: absolute; inset: 0; padding: 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.lk-spot-tile { position: relative; inset: auto; flex: 1 1 auto; min-height: 0; overflow: hidden; border-radius: var(--radius-media); }
.lk-thumb-strip {
  flex: none; display: flex; gap: 8px; height: 110px; overflow-x: auto;
  scrollbar-width: thin;
}
.lk-thumb-tile {
  position: relative; flex: 0 0 150px; height: 100%; overflow: hidden;
  border-radius: var(--radius-media); cursor: pointer; outline: 1px solid var(--stage-thumb-outline);
}
.lk-thumb-tile:hover { outline-color: var(--stage-thumb-outline-hover); }
.lk-thumb-tile--static { cursor: default; }
.lk-thumb-tile--static:hover { outline-color: var(--stage-thumb-outline); }
@media (max-width: 576px) {
  .lk-thumb-strip { height: 84px; }
  .lk-thumb-tile { flex-basis: 112px; }
}
.lk-tile-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  color: currentColor;
}
.lk-tile-placeholder svg { stroke-opacity: 0.2; }
.lk-tile-label {
  position: absolute;
  bottom: 12px;
  left: 12px;
  color: var(--text-invert);
  font-size: var(--text-base);
  background: var(--stage-overlay);
  padding: 4px 12px;
  border-radius: var(--radius-chip);
  z-index: 10;
}
.lk-pip-tile {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: clamp(96px, 30vw, 200px);
  /* Пропорции окна = пропорции видео (--lk-ar ставится из метаданных трека) */
  aspect-ratio: var(--lk-ar, 4 / 3);
  overflow: hidden;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  border: 2px solid var(--stage-thumb-outline);
  background: var(--bg-elevated);
}
.lk-pip-tile video { transform: scaleX(-1); }
.lk-pip-tile .lk-tile-placeholder svg { width: 40px; height: 40px; stroke-opacity: 0.3; }
@media (orientation: portrait) and (pointer: coarse) {
  .lk-pip-tile { aspect-ratio: 9 / 16; }
}
.lk-pip-label {
  position: absolute;
  bottom: 4px;
  left: 4px;
  color: var(--text-invert);
  font-size: var(--text-2xs);
  background: var(--stage-overlay);
  padding: 1px 6px;
  border-radius: var(--radius-chip);
  z-index: 10;
}
.lk-pip-btn {
  position: absolute;
  top: 4px;
  width: 26px;
  height: 26px;
  font-size: var(--text-xs);
  background: var(--stage-overlay);
  color: var(--text-invert);
  border: none;
  border-radius: var(--radius-circle);
  cursor: pointer;
  z-index: 10;
  line-height: 1;
  padding: 0;
}
.lk-pip-btn--mic { right: 4px; }
.lk-pip-btn--cam { right: 32px; }
@media (max-width: 768px), (pointer: coarse) {
  .lk-pip-btn { width: 36px; height: 36px; font-size: var(--text-md); }
  .lk-pip-btn--cam { right: 44px; }
}
@media (max-width: 576px) {
  .lk-stage-wrapper { min-height: 240px; }
}

/* ── Mobile fullscreen video modal ─────────────────────────── */
.modal--fullscreen { padding: 0; }
.modal-box--video {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sharp);
  background: var(--stage-bg);
  color: var(--text-invert);
  overflow: hidden;
}
.lk-modal-top {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
  padding: calc(var(--space-sm) + env(safe-area-inset-top, 0px)) var(--space-md) var(--space-sm);
  background: var(--stage-overlay-strong);
  border-bottom: 1px solid var(--stage-border);
}
.lk-modal-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--text-invert);
}
.lk-modal-top-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}
/* Иконки без текста в верхней панели модалки */
.lk-modal-top-actions .btn {
  font-size: 0;
  gap: 0;
  padding: 8px 12px;
  min-height: 44px;
  min-width: 44px;
  color: var(--stage-text);
  background: transparent;
  border-color: transparent;
}
.lk-modal-top-actions .btn .icon-sm { width: var(--icon-lg); height: var(--icon-lg); }
.lk-modal-top-actions .btn.is-active { color: var(--accent); }
.lk-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  color: var(--stage-text);
  cursor: pointer;
}
.lk-modal-close:active { color: var(--text-invert); }
.lk-modal-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
.lk-modal-stage .livekit-video-container {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  border: none;
}
.lk-modal-controls {
  display: flex;
  align-items: stretch;
  gap: var(--space-sm);
  flex-shrink: 0;
  padding: var(--space-sm) var(--space-md)
    calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
  background: var(--stage-overlay-solid);
  border-top: 1px solid var(--stage-border);
}
.lk-modal-controls .btn {
  flex: 1 1 0;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.livekit-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  color: var(--stage-text-faint);
  font-size: var(--text-sm);
  background: var(--stage-surface);
  min-height: 240px;
  border: 1px dashed var(--stage-border-strong);
}
.lk-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-top: 1px solid var(--stage-border);
}
.lk-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  height: 38px;
  padding: 0 var(--space-lg);
  border: 1px solid var(--stage-border-strong);
  background: var(--stage-control);
  color: var(--stage-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.lk-control-btn:hover { background: var(--stage-control-hover); border-color: var(--stage-border-hover); }
.lk-control-btn svg {
  width: var(--icon-sm);
  height: var(--icon-sm);
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.lk-control-btn--danger { border-color: var(--stage-danger-border); color: var(--stage-danger-text); }
.lk-control-btn--danger:hover { background: var(--danger); color: var(--text-invert); border-color: var(--danger); }
.lk-control-btn--active { background: var(--accent); border-color: var(--accent); color: var(--text-invert); }
.lk-control-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Бренд в хедере: «AI» акцентным цветом ─────────────────── */
.layout-header .auth-word em { color: var(--accent); }

/* ── Touch: мгновенные тапы без задержки/зума по двойному тапу ── */
.menu-toggle,
#headerMenu .sidebar-link,
#headerMenu .logout-link {
  touch-action: manipulation;
}

/* ── Global media safety ────────────────────────────────────── */
img, video, iframe, embed, object { max-width: 100%; }

/* ── Mobile: сайдбар в бургер-меню (≤768px) ───────────────── */
@media (max-width: 768px) {
  body { overflow-x: clip; }
  .panel--flush .panel-head { margin: 0 var(--space-md); }
  /* panel--flush не имеет padding — negative margins full-bleed не нужны */
  .panel--flush .table-wrap { margin-left: 0; margin-right: 0; }

  /* Элементы занимают 98% ширины окна */
  .layout-content {
    width: 98%;
    max-width: 98%;
    padding-left: 0;
    padding-right: 0;
  }
  .layout-header { padding-left: 1vw; padding-right: 1vw; }

  .sidebar { display: none; }

  .layout-header #headerMenu {
    width: 260px;
    max-height: calc(100vh - 48px - var(--safe-top));
    max-height: calc(100dvh - 48px - var(--safe-top));
    overflow-y: auto;
    padding: var(--space-sm) 0 0;
  }
  #headerMenu .sidebar-nav {
    flex-direction: column;
    padding: var(--space-xs) 0;
    gap: 0;
    width: 100%;
  }
  #headerMenu .sidebar-nav + .sidebar-nav {
    border-top: 1px solid var(--border);
  }
  #headerMenu .sidebar-link {
    display: flex;
    width: 100%;
    min-height: 44px;
    padding: 10px var(--space-lg);
    white-space: normal;
    border-left: 2px solid transparent;
    border-bottom: none;
    font-size: var(--text-sm);
  }
  #headerMenu .sidebar-link.active {
    border-left-color: var(--accent);
    border-bottom-color: transparent;
  }
  /* В мобильном меню подменю админки скрыто — навигация через «Админка» */
  #headerMenu .sidebar-link--sub {
    display: none;
  }
  #headerMenu .logout-link {
    width: 100%;
    min-height: 44px;
    justify-content: flex-start;
    padding: 10px var(--space-lg);
    background: none;
    border: none;
    border-left: 2px solid transparent;
    border-radius: var(--radius-sharp);
    box-shadow: none;
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 400;
    text-align: left;
    color: var(--text-secondary);
  }
  #headerMenu .logout-link:hover {
    color: var(--text);
    background: var(--bg-elevated);
  }
  #headerMenu .theme-toggle {
    width: 100%;
    min-height: 44px;
    justify-content: flex-start;
    padding: 10px var(--space-lg);
    background: none;
    border: none;
    border-left: 2px solid transparent;
    border-radius: var(--radius-sharp);
    box-shadow: none;
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 400;
    text-align: left;
    color: var(--text-secondary);
  }
  #headerMenu .theme-toggle:hover {
    color: var(--text);
    background: var(--bg-elevated);
  }
  #headerMenu .theme-toggle .theme-icon {
    width: var(--icon-sm);
    height: var(--icon-sm);
    flex-shrink: 0;
    margin-right: var(--space-md);
  }
  #headerMenu .theme-toggle-label { display: inline; }
  #headerMenu .sidebar-footer {
    border-top: 1px solid var(--border);
    border-left: none;
    padding: var(--space-sm) var(--space-lg);
    display: block;
  }
  #headerMenu .topbar-email {
    order: 40;
    width: 100%;
  }
  #headerMenu .topbar-plan-badge {
    order: 41;
    align-self: flex-start;
    margin: 0 var(--space-md) var(--space-sm);
  }
  #headerMenu .sidebar-footer {
    order: 42;
  }
}

/* ── Mobile overrides for shared-ui ─────────────────────────── */
#toast-container,
.toast-container { max-width: calc(100vw - 16px); }

@media (max-width: 640px) {
  .stat-card { padding: 14px; }
  .stat-value { font-size: 30px; }
}

/* AI analysis block on session page */
.ai-analysis-body p, .ai-analysis-body ul, .ai-analysis-body ol, .ai-analysis-body li { font-size: var(--text-sm); line-height: 1.5; }

/* Prompt results on session page */
.prompt-result-output { font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.5; white-space: pre-wrap; word-break: break-word; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sharp); padding: 10px 12px; margin: 4px 0 var(--space-sm); max-height: 420px; overflow: auto; }
.prompt-result-output--md { font-family: inherit; font-size: var(--text-sm); white-space: normal; word-break: normal; }
.prompt-result-output--md > :first-child { margin-top: 0; }
.prompt-result-output--md > :last-child { margin-bottom: 0; }
.prompt-result-output--md p { margin: 0 0 .6em; font-size: inherit; line-height: inherit; }
.prompt-result-output--md h1, .prompt-result-output--md h2, .prompt-result-output--md h3, .prompt-result-output--md h4, .prompt-result-output--md h5, .prompt-result-output--md h6 { margin: 1em 0 .4em; font-size: 1em; line-height: 1.3; }
.prompt-result-output--md h1 { font-size: 1.15em; }
.prompt-result-output--md h2 { font-size: 1.08em; }
.prompt-result-output--md ul, .prompt-result-output--md ol { margin: 0; padding-left: 2em; }
.prompt-result-output--md li { margin: .15em 0; }
.prompt-result-output--md code { font-family: var(--font-mono); font-size: .85em; background: var(--fill); border-radius: var(--radius-chip); padding: .1em .35em; }
.prompt-result-output--md pre { background: var(--fill); border-radius: var(--radius-chip); padding: 8px 10px; overflow: auto; margin: 0 0 .6em; }
.prompt-result-output--md pre code { background: none; padding: 0; }
.prompt-result-output--md blockquote { margin: 0 0 .6em; padding: .2em 0 .2em .9em; border-left: 3px solid var(--border); color: var(--text-secondary, inherit); }
.prompt-result-output--md table { border-collapse: collapse; margin: 0 0 .6em; font-size: .85em; }
.prompt-result-output--md th, .prompt-result-output--md td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
.prompt-result-output--md hr { border: 0; border-top: 1px solid var(--border); margin: .8em 0; }
.prompt-result-output--md a { color: var(--accent); }
.prompt-result-badge { font-size: var(--text-2xs); padding: 1px 8px; border-radius: var(--radius-pill); margin-left: 6px; text-transform: none; letter-spacing: 0; }
.prompt-result-actions { display: flex; gap: 8px; justify-content: flex-end; margin: 12px 0 var(--space-sm); }
.prompt-result-badge--ok { background: var(--success-soft); color: var(--success); }
.prompt-result-badge--fail { background: var(--danger-soft); color: var(--danger); }

/* Session report blocks (collapsible) */
.report-block { border: 1px solid var(--border); border-radius: var(--radius-sharp); margin-bottom: var(--space-sm); background: transparent; }
.report-block:last-child { margin-bottom: 0; }
.report-block__head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; list-style: none; user-select: none; }
.report-block__head::-webkit-details-marker { display: none; }
.report-block__head:hover { background: var(--fill); border-radius: var(--radius-sharp); }
.report-block__title { font-weight: 600; font-size: var(--text-base); }
.report-block__head .panel-details__chevron { flex-shrink: 0; color: var(--text-secondary); transition: transform var(--transition-fast); }
.report-block[open] > .report-block__head .panel-details__chevron { transform: rotate(90deg); }
.report-block__body { padding: 0 14px 12px; }
.report-block__body > :first-child { margin-top: 0; }
.report-block .prompt-result-actions { margin: 12px 0 0; }

/* Session processing status panel */
.processing-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.processing-step { display: flex; align-items: flex-start; gap: 9px; color: var(--text-secondary, #6b7280); font-size: var(--text-sm); line-height: 1.35; }
.processing-step-main { display: grid; gap: 2px; min-width: 0; }
.processing-step-label { font-weight: 600; }
.processing-step-detail { color: var(--text-secondary, #6b7280); font-size: var(--text-xs); overflow-wrap: anywhere; }
.processing-step-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: var(--text-2xs); line-height: 1; margin-top: 1px; }
.processing-step-icon--pending { border: 1px solid var(--border, #d1d5db); background: var(--surface, transparent); }
.processing-step--done .processing-step-icon { background: var(--success-soft, rgba(34,197,94,.16)); color: var(--success, #16a34a); }
.processing-step--failed .processing-step-icon { background: var(--danger-soft, rgba(239,68,68,.16)); color: var(--danger, #dc2626); }
.processing-step--neutral .processing-step-icon { background: var(--surface, rgba(127,127,127,.14)); color: var(--text-secondary, #6b7280); }
.processing-step--active .processing-step-icon:empty { border-color: color-mix(in srgb, var(--accent, #0a6366) 35%, transparent); background: color-mix(in srgb, var(--accent, #0a6366) 10%, transparent); }
.processing-step--active .processing-step-label { color: var(--text, inherit); }
.processing-step--file .processing-step-label { font-weight: 500; font-size: var(--text-xs); }
.processing-spinner { border: 2px solid color-mix(in srgb, var(--accent, #0a6366) 22%, transparent); border-top-color: var(--accent, #0a6366); animation: processing-spin .8s linear infinite; }
@keyframes processing-spin { to { transform: rotate(360deg); } }
.processing-error { margin: 12px 0 0; color: var(--danger, #dc2626); font-size: var(--text-xs); overflow-wrap: anywhere; }
.prompt-result-badge--running, .prompt-result-badge--pending { background: color-mix(in srgb, var(--accent, #0a6366) 12%, transparent); color: var(--accent, #0a6366); }
.prompt-result-badge--running { animation: processing-pulse 1.4s ease-in-out infinite; }
@keyframes processing-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .58; } }

/* Topbar user plan badge */
.topbar-plan-badge {
  font-size: var(--text-xs);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  white-space: nowrap;
}

/* Подписи чекбоксов: var(--text-sm) (текст внутри <label>, единый стандарт с .form-check-label) */
.form-check { font-size: var(--text-sm); }

/* Client notification checkboxes: native inputs (accent-color из .form-check-input) */
.notif-checks, .notif-channels {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
@media (min-width: 900px) {
  .notif-checks {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 24px;
  }
  .notif-channels {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 24px;
  }
}
.notif-checks label, .notif-channels label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 4px 0;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.4;
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  user-select: none;
}

/* Блок «Уведомления клиенту»: текст на ступень мельче заголовка (кроме .section-title) */
.panel--notif .notif-channels label,
.panel--notif .notif-checks label,
.panel--notif #clientTelegramLink,
.panel--notif .alert {
  font-size: var(--text-2xs);
}

/* -- Theme toggle (header) ----------------------------------------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
}
.theme-toggle .theme-icon {
  width: var(--icon-base);
  height: var(--icon-base);
  display: none;
}
.theme-toggle-label { display: none; }
/* По умолчанию (без явного выбора) — иконка по системной теме */
.theme-toggle .theme-icon--sun { display: block; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-toggle .theme-icon--sun { display: none; }
  html:not([data-theme="light"]) .theme-toggle .theme-icon--moon { display: block; }
}
html[data-theme="dark"] .theme-toggle .theme-icon--sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon--moon { display: block; }
html[data-theme="light"] .theme-toggle .theme-icon--sun { display: block; }
html[data-theme="light"] .theme-toggle .theme-icon--moon { display: none; }

/* -- Collapsible panels ------------------------------------------- */
.panel-details > summary.panel-head {
  cursor: pointer;
  list-style: none;
  user-select: none;
  margin-bottom: 0;
}
.panel-details[open] > summary.panel-head {
  margin-bottom: var(--space-lg);
}
.panel-details > summary.panel-head::-webkit-details-marker {
  display: none;
}
.panel-details__chevron {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform var(--transition-fast);
}
.panel-details[open] .panel-details__chevron {
  transform: rotate(90deg);
}

/* ── Модалка загрузки файлов (files.html / pages/files.js) ──── */
.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xl) var(--space-base);
  border: 1px dashed var(--border-strong);
  background: var(--bg-elevated);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-base), background var(--transition-base);
}
.upload-dropzone:hover,
.upload-dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.upload-dropzone--over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.upload-dropzone--busy {
  opacity: 0.55;
  pointer-events: none;
}
/* Одиночный файл (модалка сессии) — компактнее очереди на /files */
.upload-dropzone--single {
  padding: var(--space-lg) var(--space-base);
}
.upload-dropzone--single .upload-dropzone-title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-dropzone-icon {
  width: 28px;
  height: 28px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.upload-dropzone-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}
.upload-dropzone-hint {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.upload-queue {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}
.upload-queue:empty { display: none; }

.upload-file-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--border);
  background: var(--panel);
}
.upload-file-item--error { border-color: var(--danger); background: var(--danger-soft); }
.upload-file-item--done { border-color: var(--accent); }
.upload-file-item--canceled { opacity: 0.6; }

.upload-file-icon { display: flex; flex: none; color: var(--text-secondary); }
.upload-file-main { flex: 1; min-width: 0; }
.upload-file-name {
  display: block;
  font-size: var(--text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-file-meta {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-secondary);
  margin-top: 2px;
}
.upload-file-bar {
  height: 4px;
  background: var(--fill);
  margin-top: var(--space-sm);
  overflow: hidden;
}
.upload-file-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width var(--transition-base);
}
.upload-file-item--error .upload-file-fill { background: var(--danger); }
.upload-file-status { flex: none; width: 44px; text-align: right; font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--text-secondary); }
.upload-file-status--done { color: var(--accent); }
.upload-file-status--error { color: var(--danger); }
.upload-file-remove { flex: none; }

.upload-destination {
  margin: var(--space-md) 0 0;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}
.upload-destination:empty { display: none; }
.upload-destination strong { color: var(--text); font-weight: 500; }

/* «Очистить» прижимаем к левому краю, остальные кнопки — справа */
#uploadModal .modal-actions #uploadClearBtn { margin-right: auto; }


/* ── Утилиты отступов (замена inline-стилей) ────────────────── */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-base { margin-top: var(--space-base); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-base { margin-bottom: var(--space-base); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-0 { margin-bottom: 0; }
.min-w-0 { min-width: 0; }
.text-muted { color: var(--text-secondary); }
.flex-gap-xs { display: flex; gap: var(--space-xs); flex-wrap: wrap; }
/* Readonly-инпуты (длительность события, email профиля).
   .form-group input:not([type="checkbox"]) в shared-ui имеет более высокую
   специфичность, чем одиночный класс — дублируем селектор с .form-group,
   чтобы --bg-elevated не перебивался фоном --bg. */
.input-readonly, .form-group input.input-readonly { background: var(--bg-elevated); }
.input-time { max-width: 10rem; }
/* Разделитель внутри панелей */
.hr-divider { border: none; border-top: 1px solid var(--border); margin: var(--space-md) 0; }
/* Сортируемый заголовок таблицы */
.sortable-th { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable-th::after { content: '\2195'; margin-left: 4px; color: var(--text-faint); font-size: var(--text-xs); }
/* Узкая auth-карточка (регистрация) */
.auth-card--narrow { max-width: min(480px, 98vw); }
/* Панель без паддингов с обрезкой контента (редактор) */
.panel--clip { padding: 0; overflow: hidden; }
/* Статус сохранения в page-head */
.page-actions-status { font-size: var(--text-sm); align-self: center; }

/* ── Callout: панель с цветным акцентом слева ───────────────── */
.callout--accent { border-left: 4px solid var(--accent); }
.callout--warning { border-left: 4px solid var(--warning); }
.callout--success { border-left: 4px solid var(--success); }
.callout--danger { border-left: 4px solid var(--danger); }
.callout > p:first-child { margin-top: 0; }
.callout > p:last-child { margin-bottom: 0; }

/* ── Бренд (хедер приложения и навигация лендинга) ──────────── */
.layout-header .auth-glyph,
.nav .auth-brand-top .auth-glyph {
  width: 32px;
  height: 32px;
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.layout-header .auth-glyph svg,
.nav .auth-brand-top .auth-glyph svg { color: var(--accent); }
.layout-header .auth-word,
.nav .auth-brand-top .auth-word { font-size: var(--text-md); color: var(--text); }

/* ── Страница редактора OnlyOffice (editor.html) ────────────── */
#office-editor-wrap { min-height: 78vh; }
#office-editor, #office-editor iframe, #office-editor-wrap iframe {
  width: 100% !important;
  height: 78vh !important;
  border: 0;
  display: block;
}
.office-fallback { padding: var(--space-xl); text-align: center; color: var(--text-secondary); }

/* ── Админка: секции настроек и промтов (были inline <style>) ─ */
.form-section { margin-bottom: var(--space-base); }
.form-section h2 { font-size: var(--text-lg); margin: 0 0 var(--space-sm); }
.settings-table { width: 100%; border-collapse: collapse; }
.settings-table th { text-align: left; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); padding: 6px 10px; border-bottom: 1px solid var(--border); }
.settings-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.settings-table tr:last-child td { border-bottom: none; }
.settings-key { font-family: var(--font-mono); font-size: var(--text-sm); overflow-wrap: anywhere; }
.settings-input-wrap { display: flex; gap: var(--space-xs); align-items: center; flex: 1 1 auto; min-width: 0; }
.settings-default { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-faint); word-break: break-all; }
.settings-input { width: 100%; font-family: var(--font-mono); font-size: var(--text-sm); padding: 6px 8px; border: 1px solid var(--border); background: var(--panel); color: inherit; box-sizing: border-box; }
.settings-input:focus { outline: none; border-color: var(--accent); }
.settings-input--secret { -webkit-text-security: disc; }
.settings-input--secret.revealed { -webkit-text-security: none; }
.secret-toggle { background: none; border: none; cursor: pointer; padding: 4px; color: var(--text-faint); display: inline-flex; vertical-align: middle; }
.secret-toggle:hover { color: inherit; }
.env-badge { font-size: var(--text-2xs); }
.prompt-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-xs); }
.prompt-head h2 { flex: 1 1 auto; margin: 0; min-width: 180px; }
.prompt-head input.prompt-name-input { flex: 1 1 220px; font-size: var(--text-lg); font-weight: 600; padding: 4px 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); min-width: 180px; }
.prompt-key-badge { font-family: var(--font-mono); font-size: var(--text-xs); background: var(--fill); padding: 2px 8px; border-radius: var(--radius-chip); color: var(--text-secondary); }
.prompt-toggle { display: inline-flex; align-items: center; gap: var(--space-xs); font-size: var(--text-sm); white-space: nowrap; }
.prompt-order-input { width: 64px; padding: 3px 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: var(--text-sm); }
.prompt-format-select { padding: 3px 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: var(--text-sm); }
.prompt-format-select:disabled { opacity: .6; cursor: not-allowed; }
.prompt-head .prompt-format-select:hover, .prompt-format-select:hover { border-color: var(--border-strong); }
.prompt-inactive { opacity: .55; }
.prompt-meta { font-size: var(--text-sm); color: var(--text-secondary); margin: 0 0 var(--space-sm); }
.prompt-field-label { display: block; font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); margin: var(--space-sm) 0 6px; }
.prompt-textarea { width: 100%; font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.5; padding: 10px 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); box-sizing: border-box; resize: vertical; transition: border-color var(--transition-base), background var(--transition-base); }
.prompt-textarea:hover, .prompt-name-input:hover, .prompt-order-input:hover { border-color: var(--border-strong); }
.prompt-textarea:focus, .prompt-name-input:focus, .prompt-order-input:focus { border-color: var(--accent); background: var(--panel); outline: none; }
.prompt-textarea::placeholder, .prompt-name-input::placeholder, .prompt-order-input::placeholder { color: var(--text-faint); }
.prompt-textarea--user { min-height: 260px; }
.prompt-textarea--system { min-height: 218px; } /* ~10 строк (13px × 1.5) + padding + border */
.prompt-hint { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 4px; }
.prompt-hint code { font-family: var(--font-mono); background: var(--fill); padding: 1px 5px; border-radius: var(--radius-chip); }
@media (max-width: 768px) {
    .settings-table tbody td:has(.settings-input-wrap) { display: block; text-align: left; }
}
@media (max-width: 640px) {
    /* анти-zoom iOS */
    .settings-input, .prompt-textarea { font-size: var(--text-lg); }
}

/* ── Оверлеи LiveKit-сцены (livekit-core.js) ────────────────── */
.lk-audio-unlock-btn {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--stage-unlock-bg);
  color: var(--text-invert);
  border: 1px solid var(--stage-thumb-outline-hover);
  border-radius: var(--radius-pill);
  padding: 14px 28px;
  font-size: var(--text-xl);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.lk-warn-banner {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 72px;
  z-index: 70;
  background: var(--stage-banner-danger);
  color: var(--text-invert);
  padding: 12px 16px;
  border-radius: var(--radius-media);
  font-size: var(--text-md);
  line-height: 1.4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.lk-warn-banner__btn {
  flex: none;
  background: var(--text-invert);
  color: var(--danger);
  border: 0;
  padding: 8px 14px;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
/* Состояния сцены (ошибка/ожидание/подключение) */
.lk-stage-state { height: 100%; color: var(--stage-text); }
.lk-stage-state__title { color: var(--text-invert); font-weight: 600; margin: 0; }
.lk-stage-state .spinner-border { color: var(--stage-text); }
.lk-empty-text { font-size: var(--text-sm); }

/* ── Просмотрщики файлов (core.js) ───────────────────────────── */
.viewer-pdf { width: 100%; height: 100%; border: 0; background: var(--panel); }
.viewer-image { max-width: 100%; max-height: 85vh; }
.viewer-video { width: 100%; height: 100%; background: #000; object-fit: contain; }
.viewer-audio { width: 100%; }

/* ── Mobile revert (2026-10-24): старые размеры токенов и своих литералов на ≤768px ── */
@media (max-width: 768px) {
  .error-code { font-size: 72px; }
  :root { --text-3xs: 11px; --text-2xs: 12px; --text-xs: 13px; --text-sm: 14px; --text-base: 15px; --text-md: 16px; --text-lg: 17px; --text-xl: 18px; --text-2xl: 22px; }
}
@media (max-width: 640px) {
  .stat-value { font-size: 26px; }
}

/* ── Детали сессии: мобильный редизайн (≤768px) ──────────────
   Мета-грид, карточка клиента, sticky-панель действий
   (#session-actionbar — кнопки перекладывает video.js). */
.session-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: var(--space-md) var(--space-xl);
}
.session-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.session-meta__label {
  font-size: var(--text-3xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.session-meta__value { font-size: var(--text-sm); overflow-wrap: anywhere; }

.session-client-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.session-client-card + .session-client-card { margin-top: var(--space-sm); }
.session-client-card:hover { border-color: var(--accent); text-decoration: none; }
.session-client-card__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.session-client-card__name { font-weight: 600; overflow-wrap: anywhere; }
.session-client-card__contacts { font-size: var(--text-xs); color: var(--text-secondary); overflow-wrap: anywhere; }
.session-client-card__chevron { flex: none; color: var(--text-faint); }

/* Sticky-панель действий — только мобильный ≤768px (JS её заполняет) */
.session-actionbar { display: none; }

@media (max-width: 768px) {
  .session-meta-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm) var(--space-md); }

  /* Первичные действия панели: CTA на всю ширину, вторичные — рядом */
  .session-primary-actions { flex-direction: column; align-items: stretch; gap: var(--space-sm); }
  .session-primary-actions .btn { justify-content: center; min-height: 48px; }
  .session-primary-actions .btn-group { width: 100%; }
  .session-primary-actions .btn-group .btn { flex: 1 1 50%; justify-content: center; min-height: 44px; }
  /* На active-сессии «Завершить» живёт в sticky-баре — дубль в панели убираем */
  .session-primary-actions--active > .btn-danger { display: none; }

  /* Анти-зум iOS + крупные цели тапа */
  #sessionNotes { font-size: 16px; }
  .panel-body label.form-check--spaced { display: flex; align-items: flex-start; flex-wrap: wrap; min-height: 44px; padding: 8px 0; }
  .panel-body label.form-check--spaced .form-check-hint { flex-basis: 100%; padding-left: 22px; }
  .report-block__head { min-height: 48px; }
  .prompt-result-actions { margin-left: 0; }
  .prompt-result-actions .btn { flex: 1 1 auto; min-height: 44px; justify-content: center; }
  .panel-head:has(#session-upload-btn) { flex-wrap: wrap; }
  #session-upload-btn { width: 100%; justify-content: center; }
  .session-rec-btn-wrap .btn { width: 100%; justify-content: center; }

  /* Sticky bottom bar */
  .session-actionbar:not([hidden]) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
    background: var(--panel);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.08);
  }
  .session-actionbar-primary,
  .session-actionbar-secondary { display: flex; gap: var(--space-xs); flex-wrap: wrap; }
  .session-actionbar-primary:empty,
  .session-actionbar-secondary:empty { display: none; }
  .session-actionbar-primary .btn { flex: 1 1 100%; justify-content: center; min-height: 48px; }
  /* Дубликат «Завершить» из шапки: в баре он уже есть первичным под своим id,
     при активном модальном окне сюда не попадает — здесь просто порядок строк */
  .session-actionbar-secondary .btn {
    flex: 1 1 45%;
    min-height: 44px;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
  }
  .session-actionbar-secondary .btn span { overflow: hidden; text-overflow: ellipsis; }
  .session-actionbar-secondary .btn.is-active { color: var(--accent); }
  .session-actionbar .btn[style*="display: none"] { display: none !important; }

  /* Контент не заезжает под бар (высоту бара публикует JS в --session-actionbar-h) */
  .layout-content:has(#session-actionbar) { padding-bottom: calc(var(--session-actionbar-h, 0px) + 24px); }
}

/* Drag-and-drop перемещение файлов (модуль Файлы): перетаскиваемая строка
   и подсветка цели-drop (строка папки / ссылка-крошка). */
tr[draggable="true"] { cursor: grab; }
tr[draggable="true"]:active { cursor: grabbing; }
.file-row--dragging { opacity: .45; }
.file-row--drop > td {
  background: var(--accent-soft, rgba(108, 92, 231, .12));
  box-shadow: inset 0 0 0 1px var(--accent);
}
a.drag-drop-target--over {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
