/* ==========================================================
   HAIM SENSE
   Оформление по брендбуку IT-отдела HAIM GLOBAL
   ========================================================== */

/* 1. Переменные дизайн-системы */

:root {
  color-scheme: light;

  --brand-black: #11110f;
  --brand-gold: #d7b95f;
  --brand-gold-main: #b99a45;
  --brand-gold-light: #e3c66b;
  --brand-cream: #f7f5ef;
  --brand-white: #fffefa;
  --brand-sand: #e5dcc5;
  --brand-text: #242210;
  --brand-muted: #777166;
  --brand-red: #b33b36;
  --brand-green: #397354;
  --brand-warning: #faedcf;
  --brand-critical: #f8e1e1;

  --background: var(--brand-cream);
  --surface: var(--brand-white);
  --sidebar: var(--brand-black);
  --text: var(--brand-text);
  --muted: var(--brand-muted);
  --border: var(--brand-sand);
  --control-border: var(--brand-muted);

  --gold: var(--brand-gold-main);
  --gold-dark: var(--brand-text);
  --gold-light: var(--brand-warning);

  --success-background: var(--brand-cream);
  --success-text: var(--brand-green);
  --danger-background: var(--brand-critical);
  --danger-text: var(--brand-red);

  --font-interface: "Inter", Arial, sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;

  --radius: 12px;
  --radius-control: 8px;
  --radius-pill: 999px;

  --sidebar-width: 224px;
  --content-max-width: 1680px;
  --transition-duration: 160ms;
}

/* 2. Базовые стили */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-interface);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  max-width: 100%;
}

button {
  cursor: pointer;
}

button,
a,
input,
select,
textarea {
  transition:
    background-color var(--transition-duration) ease,
    border-color var(--transition-duration) ease,
    color var(--transition-duration) ease;
}

a {
  color: inherit;
  text-underline-offset: 4px;
}

img,
svg {
  max-width: 100%;
  vertical-align: middle;
}

img {
  height: auto;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  overflow-wrap: anywhere;
}

h1 {
  margin-bottom: var(--space-2);
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

h2 {
  margin-bottom: var(--space-2);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
}

h3 {
  margin-bottom: var(--space-2);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

h4 {
  margin-bottom: var(--space-2);
  font-size: 16px;
  font-weight: 600;
}

p {
  margin-bottom: var(--space-3);
}

small {
  font-size: 12px;
  line-height: 1.5;
}

strong {
  font-weight: 600;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}

.sidebar :focus-visible {
  outline-color: var(--brand-gold-light);
}

::selection {
  background: var(--brand-gold-light);
  color: var(--brand-black);
}

.muted,
.text-muted {
  color: var(--muted);
}

.text-success {
  color: var(--success-text);
}

.text-danger {
  color: var(--danger-text);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 3. Боковая навигация */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  padding: var(--space-5) var(--space-3);
  overflow-y: auto;
  background: var(--sidebar);
  color: var(--brand-white);
  border-right: 1px solid var(--brand-sand);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  color: var(--brand-gold);
  text-decoration: none;
}

/* Текстовая подпись бренда, не имитация графического знака. */

.brand strong {
  color: var(--brand-gold);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.14em;
}

.brand span {
  color: var(--brand-gold);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.24em;
}

/* Применяется, если оригинальный логотип добавлен в HTML.
   Не изменяет цвет, градиент или пропорции изображения. */



.product-name {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  color: var(--brand-sand);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.navigation {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.navigation-button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 48px;
  padding: 12px var(--space-3);
  background: transparent;
  color: var(--brand-sand);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-weight: 500;
  text-align: left;
}

.navigation-button:hover {
  color: var(--brand-gold-light);
  border-color: var(--brand-gold-main);
}

.navigation-button.active,
.navigation-button[aria-current="page"] {
  background: var(--brand-gold-main);
  color: var(--brand-black);
  border-color: var(--brand-gold-main);
  font-weight: 600;
}

.navigation-button svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-4) var(--space-3) 0;
  color: var(--brand-sand);
  font-size: 12px;
}

.sidebar-footer small {
  display: block;
  margin-top: var(--space-2);
  color: var(--brand-sand);
}

.connection-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: var(--space-2);
  background: var(--brand-gold);
  border-radius: 50%;
}

/* 4. Рабочая область и верхняя панель */

.workspace {
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 72px;
  padding: var(--space-3) var(--space-5);
  background: var(--surface);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.topbar > * {
  min-width: 0;
}

.account,
.account-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.account-avatar {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--brand-cream);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
}

main {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--space-5);
}

.page-heading,
.section-heading,
.filter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.page-heading {
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.page-heading > *,
.section-heading > * {
  min-width: 0;
}

.page-heading p,
.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.eyebrow {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.page-actions,
.button-group,
.filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* 5. Кнопки */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 10px var(--space-3);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-control);
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
}

.button:hover {
  background: var(--background);
  border-color: var(--text);
}

.button:active {
  background: var(--brand-sand);
}

.button-primary {
  background: var(--brand-black);
  color: var(--brand-gold-light);
  border-color: var(--brand-black);
}

.button-primary:hover {
  background: var(--brand-text);
  color: var(--brand-gold-light);
  border-color: var(--brand-text);
}

.button-primary:active {
  background: var(--brand-black);
  border-color: var(--brand-gold-main);
}

.button-danger {
  background: var(--brand-red);
  color: var(--brand-white);
  border-color: var(--brand-red);
}

.button-danger:hover {
  background: var(--brand-critical);
  color: var(--brand-red);
  border-color: var(--brand-red);
}

.button-small {
  min-height: 36px;
  padding: var(--space-2) 12px;
  font-size: 12px;
}

button:disabled,
.button[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

button[aria-busy="true"],
.button[aria-busy="true"] {
  cursor: progress;
}

/* 6. Формы и фильтры */

label {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-control);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

textarea {
  min-height: 144px;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--brand-black);
}

input[type="file"] {
  padding: var(--space-2);
}

input[type="file"]::file-selector-button {
  margin-right: var(--space-2);
  padding: var(--space-2) 12px;
  background: var(--brand-black);
  color: var(--brand-gold-light);
  border: 1px solid var(--brand-black);
  border-radius: var(--radius-control);
  font: inherit;
  cursor: pointer;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--background);
  color: var(--muted);
  cursor: not-allowed;
}

[aria-invalid="true"] {
  border-color: var(--brand-red);
}

.field-hint,
.field-error {
  margin: var(--space-2) 0 0;
  font-size: 12px;
}

.field-hint {
  color: var(--muted);
}

.field-error {
  color: var(--brand-red);
}

.filter-panel,
.card,
.statistic {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-panel {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-3);
}

.filter-footer {
  flex-wrap: wrap;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.filter-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

/* 7. Основная статистика */

.statistics-grid,
.stats-grid,
#mainStatistics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.statistic {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--space-4);
}

.statistic-label {
  margin-bottom: var(--space-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.statistic-value {
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 2.4vw, 36px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.statistic-description {
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: 12px;
}

.statistic-description:empty {
  display: none;
}

/* 8. Карточки и исходы звонков */

.card {
  margin-bottom: var(--space-4);
  overflow: hidden;
}

.section-heading {
  flex-wrap: wrap;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.section-heading h2,
.section-heading h3 {
  margin-bottom: 0;
}

.section-heading p {
  margin-top: var(--space-1);
  font-size: 12px;
}

.card-body {
  padding: var(--space-4);
}

.outcome-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: var(--space-4) 0;
}

.outcome-item {
  min-width: 0;
  padding: 0 var(--space-4);
}

.outcome-item + .outcome-item {
  border-left: 1px solid var(--border);
}

.outcome-item strong,
.outcome-value {
  display: block;
  margin: var(--space-2) 0;
  color: var(--text);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.outcome-label,
.outcome-item > span:first-child {
  color: var(--muted);
  font-size: 13px;
}

.outcome-item small {
  color: var(--muted);
}

.progress-track {
  height: 6px;
  margin-top: var(--space-3);
  overflow: hidden;
  background: var(--brand-sand);
  border-radius: var(--radius-pill);
}

.progress-fill {
  height: 100%;
  max-width: 100%;
  background: var(--brand-gold-main);
  border-radius: inherit;
}

.secondary-grid,
#additionalStatistics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.secondary-grid .statistic-value,
#additionalStatistics .statistic-value {
  font-size: 28px;
}

/* 9. Аналитика сотрудников */

.table-wrapper,
.table-wrap,
.table-container {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

table {
  width: 100%;
  border-spacing: 0;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

td {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--background);
}

th.numeric,
td.numeric,
th[data-type="number"],
td[data-type="number"] {
  text-align: right;
}

/* В таблице сотрудников первый столбец содержит имя,
   остальные — сопоставимые числовые показатели. */

#employeesTable th:not(:first-child),
#employeesTable td:not(:first-child),
#employeeTable th:not(:first-child),
#employeeTable td:not(:first-child),
#employeeTableBody td:not(:first-child),
#employeesTableBody td:not(:first-child) {
  text-align: right;
}

.employee-button {
  min-height: 36px;
  padding: var(--space-1) 0;
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: var(--radius-control);
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--brand-gold-main);
  text-underline-offset: 5px;
}

.employee-button:hover {
  text-decoration-color: var(--text);
}

.employee-name {
  display: block;
  font-weight: 600;
}

.employee-caption {
  display: block;
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: 12px;
}

/* 10. Список звонков */

.calls-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: start;
  gap: var(--space-4);
}

.calls-layout > * {
  min-width: 0;
}

.call-list,
.calls-list,
#callList {
  min-width: 0;
}

.call-button {
  display: block;
  width: 100%;
  padding: var(--space-3);
  background: var(--surface);
  color: var(--text);
  border: 0;
  border-bottom: 1px solid var(--border);
  border-left: 4px solid transparent;
  border-radius: 0;
  text-align: left;
}

.call-button:last-child {
  border-bottom: 0;
}

.call-button:hover {
  background: var(--background);
}

.call-button.active,
.call-button[aria-selected="true"] {
  background: var(--brand-warning);
  border-left-color: var(--brand-gold-main);
}

.call-button:focus-visible {
  position: relative;
  z-index: 1;
  outline-offset: -4px;
}

.call-button strong {
  color: var(--text);
  font-weight: 600;
}

.call-button small {
  color: var(--muted);
}

.call-button > div + div {
  margin-top: var(--space-2);
}

.call-row,
.call-top,
.call-bottom,
.call-meta,
.call-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.call-meta {
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: 12px;
}

.call-title {
  font-size: 14px;
  font-weight: 600;
}

.call-time {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* 11. Статусы */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  max-width: 100%;
  padding: var(--space-1) var(--space-2);
  background: var(--brand-warning);
  color: var(--text);
  border: 1px solid var(--brand-gold-main);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.badge-success {
  background: var(--success-background);
  color: var(--success-text);
  border-color: var(--success-text);
}

.badge-danger {
  background: var(--danger-background);
  color: var(--danger-text);
  border-color: var(--danger-text);
}

.badge-neutral {
  background: var(--background);
  color: var(--text);
  border-color: var(--control-border);
}

/* 12. Запись, транскрипт и анализ */

.call-details {
  min-width: 0;
  padding: var(--space-4);
}

.call-details > :last-child {
  margin-bottom: 0;
}

.call-details h2 {
  margin-bottom: var(--space-2);
}

.call-details h3 {
  margin-top: var(--space-4);
}

.call-details p,
.call-details li {
  overflow-wrap: anywhere;
}

.call-details ul,
.call-details ol {
  padding-left: var(--space-4);
}

.call-details li + li {
  margin-top: var(--space-2);
}

audio {
  display: block;
  width: 100%;
  height: 48px;
  margin: var(--space-3) 0;
  color-scheme: light;
}

.recording-panel {
  margin: var(--space-3) 0;
  padding: var(--space-3);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.recording-panel audio {
  margin-bottom: 0;
}

.notice {
  margin: var(--space-3) 0;
  padding: var(--space-3);
  background: var(--brand-warning);
  color: var(--text);
  border: 1px solid var(--brand-gold-main);
  border-radius: var(--radius-control);
  font-size: 13px;
  line-height: 1.5;
}

.notice p:last-child {
  margin-bottom: 0;
}

.notice-error {
  background: var(--brand-critical);
  color: var(--brand-red);
  border-color: var(--brand-red);
}

.notice-success {
  background: var(--background);
  color: var(--brand-green);
  border-color: var(--brand-green);
}

details {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

summary {
  padding: var(--space-2) 0;
  color: var(--text);
  border-radius: var(--radius-control);
  font-weight: 600;
  cursor: pointer;
}

summary::marker {
  color: var(--text);
}

details[open] summary {
  margin-bottom: var(--space-3);
}

.transcript,
.transcript-text {
  max-height: 480px;
  padding: var(--space-3);
  overflow-y: auto;
  background: var(--background);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font-family: var(--font-interface);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.analysis-point {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.analysis-point:first-child {
  padding-top: 0;
}

.analysis-point:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.analysis-point h4,
.analysis-point strong {
  color: var(--text);
}

.analysis-point p {
  margin: var(--space-2) 0 0;
  color: var(--muted);
}

blockquote {
  margin: var(--space-3) 0;
  padding: var(--space-3);
  background: var(--background);
  color: var(--text);
  border-left: 4px solid var(--brand-gold-main);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  font-size: 14px;
  line-height: 1.6;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* 13. Пустые состояния и загрузка */

.empty-state {
  padding: var(--space-6) var(--space-4);
  color: var(--muted);
  text-align: center;
}

.empty-state h3,
.empty-state strong {
  color: var(--text);
}

.empty-state p {
  max-width: 440px;
  margin: var(--space-2) auto var(--space-3);
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 160px;
  padding: var(--space-4);
  color: var(--muted);
}

.loading-spinner {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: loading-rotation 800ms linear infinite;
}

@keyframes loading-rotation {
  to {
    transform: rotate(360deg);
  }
}

footer {
  padding: var(--space-3) 0;
  color: var(--muted);
  font-size: 12px;
}

/* 14. Адаптация: небольшие ноутбуки */

@media (max-width: 1280px) {
  :root {
    --sidebar-width: 200px;
  }

  main {
    padding: var(--space-4);
  }

  .topbar {
    padding-inline: var(--space-4);
  }

  .filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .statistic {
    padding: var(--space-3);
  }

  .outcome-item {
    padding-inline: var(--space-3);
  }

  .calls-layout {
    grid-template-columns: 288px minmax(0, 1fr);
    gap: var(--space-3);
  }
}

/* 15. Адаптация: планшеты */

@media (max-width: 1000px) {
  .statistics-grid,
  .stats-grid,
  #mainStatistics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .secondary-grid,
  #additionalStatistics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .outcome-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4) 0;
  }

  .outcome-item + .outcome-item {
    border-left: 0;
  }

  .outcome-item:nth-child(even) {
    border-left: 1px solid var(--border);
  }

  .calls-layout {
    grid-template-columns: 1fr;
  }

  .calls-layout .call-list,
  .calls-layout .calls-list,
  .calls-layout #callList {
    max-height: 400px;
    overflow-y: auto;
  }
}

/* 16. Адаптация: мобильная навигация */

@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: var(--space-3);
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand {
    align-items: flex-start;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
    padding: 0;
  }

  .brand strong {
    font-size: 24px;
  }

  .brand span {
    font-size: 12px;
  }



  .product-name {
    padding: 0 0 var(--space-2);
  }

  .navigation {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: 0;
  }

  .navigation-button {
    flex: 1 1 140px;
    justify-content: center;
    width: auto;
    min-height: 44px;
    padding: 10px 12px;
    text-align: center;
  }

  .sidebar-footer {
    margin-top: var(--space-3);
    padding: 0;
  }

  .workspace {
    margin-left: 0;
  }

  .topbar {
    min-height: 64px;
    padding: var(--space-3);
  }

  main {
    padding: var(--space-4) var(--space-3);
  }

  .page-heading {
    flex-direction: column;
  }

  .page-actions {
    width: 100%;
  }

  .filter-panel,
  .section-heading,
  .card-body,
  .call-details {
    padding: var(--space-3);
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statistics-grid,
  .stats-grid,
  #mainStatistics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-footer {
    align-items: flex-start;
  }

  th,
  td {
    padding: 12px var(--space-3);
  }

  .table-wrapper table,
  .table-wrap table,
  .table-container table {
    min-width: 640px;
  }
}

/* 17. Адаптация: узкие экраны */

@media (max-width: 480px) {
  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 20px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .filter-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .statistics-grid,
  .stats-grid,
  #mainStatistics,
  .secondary-grid,
  #additionalStatistics {
    gap: var(--space-2);
  }

  .statistic {
    padding: 12px;
  }

  .statistic-value,
  .secondary-grid .statistic-value,
  #additionalStatistics .statistic-value {
    font-size: 26px;
  }

  .statistic-label,
  .statistic-description {
    font-size: 12px;
  }

  .page-actions,
  .filter-actions {
    align-items: stretch;
  }

  .page-actions .button,
  .filter-actions .button {
    flex: 1 1 auto;
  }

  .outcome-item {
    padding-inline: 12px;
  }

  .outcome-item strong,
  .outcome-value {
    font-size: 24px;
  }

  .call-header {
    align-items: flex-start;
  }

  .empty-state {
    padding: var(--space-5) var(--space-3);
  }
}

/* 18. Уменьшение движения */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* 19. Печать отчётов */

@media print {
  .sidebar,
  .topbar,
  .filter-panel,
  .page-actions,
  .filter-actions,
  audio,
  input[type="file"] {
    display: none !important;
  }

  .workspace {
    margin-left: 0;
  }

  main {
    max-width: none;
    padding: 0;
  }

  body {
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
  }

  .card,
  .statistic,
  .analysis-point {
    break-inside: avoid;
  }

  .table-wrapper,
  .table-wrap,
  .table-container {
    overflow: visible;
  }

  .table-wrapper table,
  .table-wrap table,
  .table-container table {
    min-width: 0;
  }

  th,
  td {
    padding: 8px;
  }

  .calls-layout {
    grid-template-columns: 1fr;
  }

  .transcript,
  .transcript-text {
    max-height: none;
    overflow: visible;
  }
}


/* Белые надписи оригинального логотипа требуют тёмного фона. */
.brand { min-width:0; background:var(--sidebar); padding:8px; }
.brand-logo {display:block; width:100%; height:auto; margin:0; object-fit:contain;}
dialog { width:min(440px,calc(100% - 32px)); border:1px solid var(--border); border-radius:12px; padding:24px; background:var(--surface); color:var(--text); }
dialog::backdrop {background:rgb(17 17 15 / 65%);}
#loginForm {display:grid;gap:16px;}
.processing-actions {display:flex;flex-wrap:wrap;gap:8px;margin:16px 0;}
