/* ==========================================================================
   Callboard — операционная панель ресторана
   Тёплая нейтральная база, терракота, засечки в заголовках, плотные таблицы.
   ========================================================================== */

:root {
  --bg: #f6f2ea;
  --surface: #fbf8f2;
  --surface-2: #f2ece0;
  --surface-3: #ece3d2;

  --ink: #201d18;
  --ink-2: #4b4438;
  --muted: #7b7263;
  --faint: #988e7e;

  --line: #e2d9c9;
  --line-2: #d2c6b2;

  --accent: #c4552d;
  --accent-dark: #a5431f;
  --accent-soft: rgba(196, 85, 45, 0.09);

  --delivery: #c4552d;
  --booking: #2f6b4f;
  --hostess: #2f5d8a;
  --other: #6b6459;

  --ok: #2f6b4f;
  --warn: #8a6218;
  --danger: #9c3b25;

  --r: 4px;
  --r-sm: 2px;

  --font-display: Georgia, "Times New Roman", "PT Serif", serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body.is-locked {
  overflow: hidden;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

button {
  font: inherit;
}

a {
  color: inherit;
}

svg {
  display: block;
}

pre {
  margin: 0;
}

[hidden] {
  display: none !important;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection {
  background: rgba(196, 85, 45, 0.22);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 9px 14px;
  background: var(--ink);
  color: #fbf8f2;
  border-radius: 3px;
  font-size: 13px;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* --------------------------------------------------------------------------
   Каркас
   -------------------------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

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

/* --- Сайдбар ------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 22px 14px 18px;
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 0;
}

.brand__mark {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fbf8f2;
  border-radius: 3px;
}

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

.brand__name {
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.brand__sub {
  font-size: 9.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

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

.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 3px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav__item .icon {
  color: var(--muted);
  transition: color 0.12s ease;
}

.nav__item:hover {
  background: rgba(32, 29, 24, 0.045);
  color: var(--ink);
}

.nav__item:hover .icon {
  color: var(--ink-2);
}

.nav__item[aria-current="page"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}

.nav__item[aria-current="page"] .icon {
  color: var(--accent);
}

.nav__count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.sidebar__foot {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid var(--line);
}

.pipeline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.pipeline__arrow {
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0;
}

.version {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* --- Верхняя панель ------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.topbar__ctx {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.topbar__label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.topbar__date {
  font-size: 13px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.connection {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.connection__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.12);
}

.connection[data-state="offline"] {
  color: var(--danger);
}

.connection[data-state="offline"] .connection__dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(156, 59, 37, 0.12);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

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

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

.btn:disabled:hover {
  background: transparent;
  border-color: var(--line-2);
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff7f1;
}

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

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

.btn--ghost {
  border-color: transparent;
  color: var(--ink-2);
}

.btn--ghost:hover {
  background: rgba(32, 29, 24, 0.05);
  border-color: transparent;
}

.btn--sm {
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.btn__spinner {
  width: 13px;
  height: 13px;
  border: 1.5px solid rgba(255, 247, 241, 0.4);
  border-top-color: #fff7f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.icon {
  flex: none;
}

.icon--sync {
  transition: transform 0.5s ease;
}

/* --- Полоса синхронизации ------------------------------------------------ */

.sync-bar {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 9px 32px 10px;
}

.sync-bar__row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.sync-bar__spinner {
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
  flex: none;
}

.sync-bar__text {
  font-size: 12.5px;
  color: var(--ink-2);
}

.sync-bar__track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  overflow: hidden;
}

.sync-bar__track > span {
  display: block;
  width: 32%;
  height: 100%;
  background: var(--accent);
  animation: sweep 1.6s ease-in-out infinite;
}

@keyframes sweep {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(330%);
  }
}

/* --- Рабочая область ----------------------------------------------------- */

.view {
  flex: 1;
  width: 100%;
  max-width: 1380px;
  padding: 28px 32px 76px;
  outline: none;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 7px;
}

.page-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 3.2vw, 42px);
  line-height: 1.03;
  letter-spacing: -0.018em;
}

.view-lead {
  margin-top: 9px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.view-head__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* --- Сегментированный переключатель -------------------------------------- */

.segmented {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface);
}

.segmented__btn {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 13px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}

.segmented__btn:last-child {
  border-right: 0;
}

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

.segmented__btn[aria-pressed="true"] {
  background: var(--ink);
  color: #fbf8f2;
}

.segmented__btn[aria-pressed="true"]:hover {
  background: var(--ink);
}

/* --------------------------------------------------------------------------
   Метрики
   -------------------------------------------------------------------------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  margin-bottom: 22px;
  overflow: hidden;
}

.metric {
  position: relative;
  padding: 17px 20px 15px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric__label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  letter-spacing: 0.085em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.metric__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}

.metric__dot--delivery {
  background: var(--delivery);
}
.metric__dot--booking {
  background: var(--booking);
}
.metric__dot--hostess {
  background: var(--hostess);
}

.metric__value {
  margin-top: 7px;
  font-size: 36px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

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

.metric__unit {
  font-size: 15px;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 3px;
}

.metric__sub {
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Панели и раскладка
   -------------------------------------------------------------------------- */

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

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

.panel__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.panel__meta {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.panel__link {
  font-size: 12px;
  color: var(--accent-dark);
  text-decoration: none;
  border-bottom: 1px solid rgba(196, 85, 45, 0.35);
  padding-bottom: 1px;
  white-space: nowrap;
}

.panel__link:hover {
  border-bottom-color: var(--accent-dark);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* --------------------------------------------------------------------------
   Распределение по категориям
   -------------------------------------------------------------------------- */

.distribution {
  padding: 16px 20px 18px;
  margin-bottom: 22px;
}

.distribution__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.distribution__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.distribution__meta {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.distribution__bar {
  display: flex;
  gap: 2px;
  height: 10px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--surface-3);
}

.distribution__seg {
  height: 100%;
  min-width: 2px;
}

.distribution__legend {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 20px;
  margin-top: 15px;
}

.legend__item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 8px;
}

.legend__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  align-self: center;
}

.legend__name {
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend__num {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.legend__pct {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  text-align: right;
}

.distribution__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.stat-inline {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding-right: 22px;
  margin-right: 22px;
  border-right: 1px solid var(--line);
}

.stat-inline:last-child {
  border-right: 0;
  margin-right: 0;
  padding-right: 0;
}

.stat-inline__k {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.stat-inline__v {
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

.data thead th {
  padding: 9px 14px;
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--line-2);
  background: var(--surface);
}

.data thead th.th--right,
.data td.td--right {
  text-align: right;
}

.data tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.45;
}

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

.data tbody tr[data-call] {
  cursor: pointer;
  transition: background 0.1s ease;
}

.data tbody tr[data-call]:hover {
  background: rgba(32, 29, 24, 0.03);
}

.data tbody tr[data-call]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.num {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

.nowrap {
  white-space: nowrap;
}

.cell-summary {
  color: var(--ink-2);
  max-width: 340px;
}

.cell-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cell-strong {
  font-weight: 500;
}

.cell-dim {
  color: var(--muted);
  font-size: 12px;
}

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

.table-foot__count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Бейджи и статусы
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 7px 2px 6px;
  border-radius: 2px;
  border: 1px solid transparent;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

.badge__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.badge--delivery {
  color: #a5431f;
  background: rgba(196, 85, 45, 0.08);
  border-color: rgba(196, 85, 45, 0.22);
}

.badge--booking {
  color: #245640;
  background: rgba(47, 107, 79, 0.08);
  border-color: rgba(47, 107, 79, 0.22);
}

.badge--hostess {
  color: #254c73;
  background: rgba(47, 93, 138, 0.08);
  border-color: rgba(47, 93, 138, 0.22);
}

.badge--other {
  color: #554f45;
  background: rgba(107, 100, 89, 0.09);
  border-color: rgba(107, 100, 89, 0.24);
}

.badge--none {
  color: var(--muted);
  background: rgba(32, 29, 24, 0.04);
  border-color: var(--line-2);
}

.badge--flag {
  color: #8a6218;
  background: rgba(138, 98, 24, 0.09);
  border-color: rgba(138, 98, 24, 0.24);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
}

.status__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}

.status--answered .status__dot {
  background: var(--ok);
}

.status--missed .status__dot {
  background: var(--accent);
}

.status--error .status__dot {
  background: var(--danger);
}

.status--new .status__dot {
  background: var(--hostess);
}

.status--answered {
  color: #245640;
}

.status--missed {
  color: #a5431f;
}

.status--error {
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   Требует внимания
   -------------------------------------------------------------------------- */

.attention {
  display: flex;
  flex-direction: column;
}

.attention__item {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  padding: 12px 16px 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: background 0.1s ease;
}

.attention__item:last-child {
  border-bottom: 0;
}

.attention__item:hover {
  background: rgba(32, 29, 24, 0.03);
}

.attention__bar {
  width: 3px;
  border-radius: 1px;
  background: var(--other);
  flex: none;
}

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

.attention__text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}

.attention__meta {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.attention__chev {
  align-self: center;
  color: var(--faint);
  flex: none;
}

/* --------------------------------------------------------------------------
   Пустые состояния, ошибки, скелетоны
   -------------------------------------------------------------------------- */

.empty {
  padding: 30px 22px 32px;
  max-width: 54ch;
}

.empty--tight {
  padding: 20px 16px;
}

.empty__title {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 400;
  margin-bottom: 6px;
}

.empty__text {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

.empty__actions {
  margin-top: 13px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.error-box {
  border: 1px solid rgba(156, 59, 37, 0.28);
  background: rgba(156, 59, 37, 0.04);
  border-radius: var(--r);
  padding: 22px 22px 20px;
  max-width: 62ch;
}

.error-box__label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--danger);
  font-weight: 600;
  margin-bottom: 6px;
}

.error-box__title {
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 6px;
}

.error-box__text {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}

.error-box__actions {
  margin-top: 14px;
}

.skeleton {
  background: var(--surface-3);
  border-radius: 2px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.85;
  }
  50% {
    opacity: 0.45;
  }
}

.skel-line {
  height: 10px;
  margin-bottom: 9px;
}

.skel-line:last-child {
  margin-bottom: 0;
}

.skel-rows {
  padding: 6px 18px 12px;
}

.skel-row {
  display: grid;
  grid-template-columns: 52px 110px 90px 1fr 70px;
  gap: 16px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

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

.skel-metric {
  height: 30px;
  width: 58%;
}

/* --------------------------------------------------------------------------
   Фильтры
   -------------------------------------------------------------------------- */

.filters {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  margin-bottom: 14px;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
}

.field--search {
  flex: 1 1 250px;
  min-width: 180px;
}

.field--search input {
  width: 100%;
  padding-left: 31px;
}

.field__icon {
  position: absolute;
  left: 9px;
  color: var(--muted);
  pointer-events: none;
  display: flex;
}

.field input,
.field select {
  height: 34px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 0 10px;
  border-radius: 3px;
  transition: border-color 0.12s ease;
}

.field input::placeholder {
  color: var(--faint);
}

.field input:hover,
.field select:hover {
  border-color: var(--ink-2);
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
}

.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  cursor: pointer;
  min-width: 138px;
}

.select-wrap__chev {
  position: absolute;
  right: 9px;
  color: var(--muted);
  pointer-events: none;
}

.filters__reset {
  margin-left: auto;
}

.filters__state {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Drawer
   -------------------------------------------------------------------------- */

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(32, 29, 24, 0.26);
  animation: fade 0.16s ease-out;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  width: min(500px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line-2);
  animation: slide 0.2s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes slide {
  from {
    transform: translateX(26px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.drawer__loading {
  padding: 40px 22px;
  color: var(--muted);
  font-size: 13px;
}

.drawer__head {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px 15px 22px;
  border-bottom: 1px solid var(--line);
}

.drawer__head-main {
  min-width: 0;
  flex: 1;
}

.drawer__title {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.drawer__sub {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.drawer__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 22px;
}

.drawer__section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.drawer__section:last-child {
  border-bottom: 0;
  padding-bottom: 26px;
}

.section-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 9px;
}

.meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px 18px;
}

.meta__k {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.meta__v {
  margin-top: 3px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.audio-wrap audio {
  width: 100%;
  height: 38px;
  display: block;
}

.audio-note {
  margin-top: 7px;
  font-size: 11px;
  color: var(--muted);
}

.analysis-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.confidence {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.confidence__track {
  width: 52px;
  height: 3px;
  border-radius: 2px;
  background: var(--line-2);
  overflow: hidden;
}

.confidence__fill {
  display: block;
  height: 100%;
  background: var(--ink-2);
}

.summary {
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--ink);
}

.plan {
  margin-top: 16px;
  padding: 13px 15px 12px;
  border-left: 2px solid var(--accent);
  background: rgba(196, 85, 45, 0.045);
  border-radius: 0 3px 3px 0;
}

.plan--booking {
  border-left-color: var(--booking);
  background: rgba(47, 107, 79, 0.045);
}

.plan--hostess {
  border-left-color: var(--hostess);
  background: rgba(47, 93, 138, 0.045);
}

.plan--other {
  border-left-color: var(--other);
  background: rgba(107, 100, 89, 0.05);
}

.plan__title {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.plan__row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 5px 0;
  border-top: 1px solid rgba(32, 29, 24, 0.07);
}

.plan__row:first-of-type {
  border-top: 0;
}

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

.plan__v {
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.tasks {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-2);
}

.task {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.45;
}

.task:last-child {
  border-bottom: 0;
}

.task__mark {
  flex: none;
  width: 13px;
  height: 13px;
  margin-top: 2px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--surface);
}

.task__body {
  display: block;
  min-width: 0;
}

.task__meta {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.task__tag {
  display: inline-block;
  margin-right: 6px;
  font-size: 9.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  margin-top: 18px;
}

.tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 10px 0 9px;
  margin-bottom: -1px;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

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

.tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.tab-panel {
  padding-top: 15px;
}

.detail-list {
  display: flex;
  flex-direction: column;
}

.detail-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(32, 29, 24, 0.06);
  font-size: 12.5px;
}

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

.detail-k {
  color: var(--muted);
  font-size: 12px;
}

.detail-v {
  word-break: break-word;
  line-height: 1.45;
}

.detail-v code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--surface-2);
  padding: 1px 4px;
  border-radius: 2px;
}

.dialog {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding-bottom: 8px;
}

.dialog__turn {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
}

.dialog__who {
  font-size: 9.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  padding-top: 3px;
}

.dialog__turn--client .dialog__who {
  color: var(--accent-dark);
}

.dialog__turn--operator .dialog__who {
  color: var(--hostess);
}

.dialog__text {
  font-size: 13px;
  line-height: 1.58;
}

.raw-transcript {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 13px 14px;
  max-height: 430px;
  overflow: auto;
}

.drawer__foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.drawer__hint {
  font-size: 10.5px;
  color: var(--faint);
  max-width: 20ch;
  line-height: 1.35;
}

/* --------------------------------------------------------------------------
   Сводный план
   -------------------------------------------------------------------------- */

.print-head {
  display: none;
}

.report-metrics {
  margin-bottom: 8px;
}

.report-section {
  margin-top: 30px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 0;
}

.section-head__title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 400;
  letter-spacing: -0.012em;
}

.tick {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.section-head__meta {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.section-panel {
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--r) var(--r);
  background: var(--surface);
  overflow: hidden;
}

.qa {
  display: flex;
  flex-direction: column;
}

.qa__item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.qa__item:last-child {
  border-bottom: 0;
}

.qa__top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}

.qa__topic {
  color: var(--ink-2);
  font-weight: 500;
  font-size: 12px;
}

.qa__q {
  font-size: 13.5px;
  line-height: 1.5;
}

.qa__a {
  margin-top: 5px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

.qa__flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 2px 7px;
  border: 1px solid rgba(138, 98, 24, 0.28);
  background: rgba(138, 98, 24, 0.07);
  color: #7a5514;
  border-radius: 2px;
  font-size: 10.5px;
  font-weight: 500;
}

.report-note {
  margin-top: 26px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--faint);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Тосты
   -------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 11px 14px;
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--ink-2);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(32, 29, 24, 0.08);
  animation: toast-in 0.18s ease-out;
}

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

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

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

/* --------------------------------------------------------------------------
   Утилиты
   -------------------------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.stack-16 > * + * {
  margin-top: 16px;
}

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

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

  .distribution__legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 24px;
  }
}

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

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 9px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }

  .brand {
    padding: 0;
  }

  .brand__mark {
    width: 28px;
    height: 28px;
  }

  .brand__sub {
    display: none;
  }

  .nav {
    flex-direction: row;
    gap: 2px;
    margin-left: auto;
  }

  .nav__item {
    padding: 7px 10px;
    white-space: nowrap;
  }

  .nav__item[aria-current="page"] {
    box-shadow: inset 0 -2px 0 var(--accent);
  }

  .nav__count {
    display: none;
  }

  .sidebar__foot {
    display: none;
  }

  .topbar {
    position: static;
    padding: 11px 16px;
  }

  .view {
    padding: 22px 16px 60px;
  }

  .sync-bar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .metric {
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(2n) {
    border-right: 0;
  }

  .metric:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 13.5px;
  }

  .sidebar {
    gap: 8px;
    padding: 8px 10px;
  }

  .brand__text {
    display: none;
  }

  .brand__mark {
    width: 26px;
    height: 26px;
  }

  .nav {
    gap: 0;
  }

  .nav__item {
    gap: 6px;
    padding: 7px 7px;
    font-size: 12.5px;
  }

  .nav__item .icon {
    width: 14px;
    height: 14px;
  }

  .distribution__head {
    flex-wrap: wrap;
    gap: 2px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .topbar__ctx {
    flex-direction: column;
    gap: 1px;
  }

  .topbar__actions {
    width: 100%;
    justify-content: space-between;
  }

  .metric {
    padding: 14px 15px 13px;
  }

  .metric__value {
    font-size: 30px;
  }

  .view-head {
    align-items: flex-start;
  }

  .view-head__actions {
    width: 100%;
  }

  .segmented {
    width: 100%;
  }

  .segmented__btn {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
  }

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

  .distribution__stats {
    gap: 10px 0;
  }

  .stat-inline {
    padding-right: 14px;
    margin-right: 14px;
  }

  .filters {
    gap: 8px;
  }

  .field--search {
    flex: 1 1 100%;
  }

  .select-wrap {
    flex: 1 1 44%;
  }

  .select-wrap select {
    width: 100%;
  }

  .filters__reset {
    margin-left: 0;
  }

  .filters__state {
    margin-left: 0;
  }

  /* Таблицы превращаются в карточки */
  .data thead {
    display: none;
  }

  .data,
  .data tbody,
  .data tr,
  .data td {
    display: block;
    width: 100%;
  }

  .data tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    padding: 13px 15px;
    border-bottom: 1px solid var(--line);
  }

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

  .data tbody td {
    padding: 0;
    border: 0;
  }

  .data tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 9.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 3px;
  }

  .data tbody td[data-label=""]::before {
    display: none;
  }

  .data tbody td.cell--full {
    grid-column: 1 / -1;
  }

  .cell-summary {
    max-width: none;
  }

  .table-foot {
    padding: 12px 15px;
  }

  .drawer {
    width: 100%;
    border-left: 0;
  }

  .drawer__head {
    padding: 15px 16px 13px;
  }

  .drawer__body {
    padding: 0 16px;
  }

  .drawer__foot {
    padding: 10px 16px;
  }

  .drawer__foot .drawer__hint {
    display: none;
  }

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

  .detail-row {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .section-head {
    flex-wrap: wrap;
    gap: 4px;
  }

  .report-section {
    margin-top: 24px;
  }

  .toasts {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
}

/* --------------------------------------------------------------------------
   Печать
   -------------------------------------------------------------------------- */

@media print {
  @page {
    margin: 14mm 12mm;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 10.5px;
  }

  .sidebar,
  .topbar,
  .sync-bar,
  .filters,
  .drawer,
  .drawer-overlay,
  .toasts,
  .skip-link,
  .no-print,
  .view-head__actions {
    display: none !important;
  }

  .app {
    display: block;
  }

  .main {
    display: block;
  }

  .view {
    padding: 0;
    max-width: none;
  }

  .print-head {
    display: block;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #000;
  }

  .print-head__title {
    font-family: var(--font-display);
    font-size: 20px;
  }

  .print-head__meta {
    margin-top: 3px;
    font-size: 10px;
    color: #333;
  }

  .view-head {
    border-bottom: 1px solid #999;
    padding-bottom: 8px;
    margin-bottom: 12px;
  }

  .page-title {
    font-size: 24px;
  }

  .metrics {
    border-color: #999;
    background: #fff;
    break-inside: avoid;
    margin-bottom: 10px;
  }

  .metric {
    padding: 8px 10px;
  }

  .metric__value {
    font-size: 20px;
  }

  .metric__sub,
  .view-lead,
  .panel__meta,
  .section-head__meta,
  .qa__top,
  .qa__a,
  .table-foot__count {
    color: #333;
  }

  .panel,
  .section-panel {
    border-color: #999;
    background: #fff;
  }

  .section-panel {
    overflow: visible;
  }

  .panel__head,
  .data thead th,
  .qa__item,
  .data tbody td {
    border-color: #bbb;
  }

  .data thead th {
    background: #fff;
    color: #000;
  }

  .data tbody tr {
    break-inside: avoid;
  }

  .table-wrap {
    overflow: visible !important;
  }

  table.data {
    font-size: 9.5px;
  }

  .data thead th,
  .data tbody td {
    padding: 4px 6px;
  }

  .report-section {
    margin-top: 16px;
    break-inside: auto;
  }

  .section-head {
    border-bottom-color: #000;
  }

  .section-head__title {
    font-size: 15px;
  }

  .badge,
  .status,
  .qa__flag {
    border-color: #999 !important;
    background: #fff !important;
    color: #000 !important;
  }

  .badge__dot,
  .status__dot,
  .tick {
    background: #000 !important;
  }

  .report-note {
    border-top-color: #999;
    color: #333;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  .empty {
    padding: 10px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
