:root {
  color-scheme: light;
  --bg: #f7fbfb;
  --ink: #142129;
  --ink-strong: #0c171d;
  --muted: #66727c;
  --muted-soft: #87929b;
  --line: rgba(29, 47, 55, 0.12);
  --line-strong: rgba(29, 47, 55, 0.18);
  --surface: rgba(255, 255, 255, 0.74);
  --surface-solid: #ffffff;
  --surface-soft: #f3f8f8;
  --surface-strong: #e8f0f1;
  --brand: #0b8f83;
  --brand-dark: #07655f;
  --brand-soft: #e2f7f3;
  --blue: #326dff;
  --blue-soft: #eef3ff;
  --coral: #dc554d;
  --coral-soft: #fff0ee;
  --amber: #b87909;
  --amber-soft: #fff5df;
  --sky: #1280bd;
  --sky-soft: #e9f7ff;
  --shadow: 0 18px 55px rgba(25, 45, 58, 0.1);
  --shadow-soft: 0 10px 30px rgba(25, 45, 58, 0.07);
  --glass-border: rgba(255, 255, 255, 0.76);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, #f9fcfd 0%, #eef8f4 42%, #f7faff 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.3));
  color: var(--ink);
  font-family:
    Manrope, Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont,
    Arial, sans-serif;
  font-size: 13.5px;
  text-rendering: geometricPrecision;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(11, 143, 131, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(50, 109, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 82%);
}

body.auth-locked {
  min-height: 100vh;
  overflow: hidden;
  background: #f1e4d7;
}

body.auth-locked::before {
  display: none;
}

body.auth-locked .app-shell,
body.auth-locked .mobile-tabbar {
  visibility: hidden;
  pointer-events: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0;
  background: #f1e4d7;
  color: var(--ink);
}

.auth-gate::before {
  display: none;
}

.auth-gate.hidden {
  display: none;
}

.auth-shell {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: hidden;
}

.auth-shell::before {
  display: none;
}

.auth-logo {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(135deg, var(--brand), var(--blue));
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(11, 143, 131, 0.22);
}

.auth-card {
  position: relative;
  z-index: 1;
  display: grid;
  align-self: center;
  justify-self: center;
  gap: 18px;
  width: min(430px, calc(100vw - 32px));
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow:
    0 24px 60px rgba(25, 45, 58, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(28px) saturate(145%);
  -webkit-backdrop-filter: blur(28px) saturate(145%);
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

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

.auth-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  font-size: 14px;
}

.auth-card-head span,
.auth-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-card h1 {
  max-width: 280px;
  margin: 8px 0 0;
  color: var(--ink-strong);
  font-size: 34px;
  font-weight: 800;
  line-height: 1.02;
}

.auth-fields {
  display: grid;
  gap: 12px;
}

.auth-card label {
  color: var(--muted);
}

.auth-card input {
  min-height: 42px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.auth-card input::placeholder {
  color: #9aa5ad;
}

.auth-card input:focus {
  border-color: rgba(11, 143, 131, 0.58);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(11, 143, 131, 0.11);
}

.auth-error {
  min-height: 20px;
  margin: -8px 0 0;
  color: var(--coral);
  font-size: 13px;
  font-weight: 800;
}

.auth-submit {
  min-height: 44px;
  border: 1px solid rgba(11, 143, 131, 0.2);
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 16px 30px rgba(11, 143, 131, 0.22);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(50, 109, 255, 0.2);
  outline-offset: 2px;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 12px;
  min-height: 100vh;
  padding: 12px;
}

.sidebar {
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: calc(100vh - 24px);
  overflow: auto;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--blue));
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(11, 143, 131, 0.24);
}

.brand-title {
  color: var(--ink-strong);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.18;
}

.brand-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-list {
  display: grid;
  gap: 14px;
}

.nav-section {
  display: grid;
  gap: 5px;
}

.nav-section-title {
  margin: 0 0 4px;
  padding: 0 4px;
  color: var(--muted-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-item {
  display: grid;
  position: relative;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 10px 0 7px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 800;
  letter-spacing: 0;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.nav-primary {
  color: #3e4b58;
}

.nav-secondary {
  min-height: 32px;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  padding: 0 8px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.nav-secondary::after {
  color: #9aa5ad;
  font-size: 18px;
  line-height: 1;
  content: "›";
}

.nav-item::before {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--brand);
  font-size: 15px;
  line-height: 1;
  content: attr(data-icon);
}

.nav-secondary::before {
  width: 24px;
  height: 24px;
  font-size: 13px;
}

.nav-item:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  transform: translateY(-1px);
}

.nav-item.active {
  border-color: rgba(20, 33, 41, 0.18);
  background: #162830;
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(20, 40, 48, 0.16);
}

.nav-item.active::before {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.nav-accent {
  border-color: rgba(50, 109, 255, 0.18);
  background: rgba(238, 243, 255, 0.58);
  color: #244ed8;
}

.nav-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  border-radius: 6px;
  padding: 0 6px;
  background: #eee1ff;
  color: #6c31d8;
  font-size: 10px;
  font-weight: 800;
}

.connector-panel {
  display: grid;
  gap: 6px;
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.54);
}

.panel-label,
.eyebrow {
  margin: 0 0 10px;
  color: var(--muted-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.connector-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted-soft);
  box-shadow: 0 0 0 4px rgba(135, 146, 155, 0.12);
}

.status-dot.ok {
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(11, 143, 131, 0.13);
}

.status-dot.pending {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(184, 121, 9, 0.13);
}

.status-dot.muted {
  background: #9aa5ad;
}

.workspace {
  min-width: 0;
  padding: 6px 2px 2px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--ink-strong);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  color: var(--ink-strong);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  margin: 16px 0 8px;
  color: var(--ink-strong);
  font-size: 13px;
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-pill,
.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid rgba(11, 143, 131, 0.2);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(226, 247, 243, 0.8);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.mode-pill::before,
.account-pill::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  content: "";
}

.account-pill {
  border-color: rgba(20, 33, 41, 0.12);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
}

.account-pill::before {
  background: var(--blue);
}

.mode-pill.api {
  border-color: rgba(50, 109, 255, 0.22);
  background: var(--blue-soft);
  color: var(--blue);
}

.mode-pill.api::before {
  background: var(--blue);
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

.primary-button {
  gap: 7px;
  padding: 0 13px;
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(11, 143, 131, 0.22);
}

.primary-button span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 6px;
  line-height: 1;
}

.primary-button:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(11, 143, 131, 0.26);
}

.secondary-button {
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.78);
  border-color: var(--line);
  color: var(--ink);
}

.compact-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
}

.secondary-button:hover,
.icon-button:hover {
  border-color: var(--line-strong);
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.icon-button {
  width: 36px;
  padding: 0;
  background: rgba(255, 255, 255, 0.78);
  border-color: var(--line);
  color: var(--ink);
  font-size: 18px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric-card,
.surface,
.table-wrap {
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
}

.metric-card {
  position: relative;
  min-height: 104px;
  overflow: hidden;
  padding: 14px;
}

.metric-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--brand);
  content: "";
}

.metric-card:nth-child(2)::before {
  background: var(--blue);
}

.metric-card:nth-child(3)::before {
  background: var(--coral);
}

.metric-card:nth-child(4)::before {
  background: var(--amber);
}

.metric-label {
  display: block;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.metric-card strong {
  display: block;
  margin: 10px 0 4px;
  color: var(--ink-strong);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.metric-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-grid,
.analysis-layout,
.settings-grid {
  display: grid;
  gap: 12px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
}

.analysis-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

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

.surface {
  padding: 14px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: right;
}

.manager-list,
.issue-list,
.criteria-list,
#insightsList {
  display: grid;
  gap: 0;
}

.manager-row,
.issue-row,
.criteria-row,
.insight {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.manager-row:last-child,
.issue-row:last-child,
.criteria-row:last-child,
.insight:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.manager-row:first-child,
.issue-row:first-child,
.criteria-row:first-child,
.insight:first-child {
  padding-top: 0;
}

.manager-row {
  display: grid;
  grid-template-columns: minmax(110px, 150px) minmax(140px, 1fr) 48px;
  align-items: center;
  gap: 10px;
}

.manager-name,
.issue-title,
.criteria-title,
.insight strong {
  color: var(--ink-strong);
  font-weight: 800;
  line-height: 1.3;
}

.manager-meta,
.issue-meta,
.insight p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--blue));
}

.issue-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 26px;
  border-radius: 8px;
  padding: 0 9px;
  background: var(--coral-soft);
  color: var(--coral);
  font-weight: 800;
}

.toolbar {
  display: grid;
  grid-template-columns: 170px 150px minmax(220px, 1fr);
  gap: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

select {
  min-height: 36px;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input::placeholder,
textarea::placeholder {
  color: #9aa5ad;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(11, 143, 131, 0.58);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(11, 143, 131, 0.11);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
  transition:
    background-color 160ms ease,
    box-shadow 160ms ease;
}

tbody tr:hover {
  background: rgba(226, 247, 243, 0.42);
}

tbody tr.selected {
  background: rgba(50, 109, 255, 0.09);
}

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

.risk-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 800;
}

.risk-low {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.risk-medium {
  background: var(--amber-soft);
  color: var(--amber);
}

.risk-high {
  background: var(--coral-soft);
  color: var(--coral);
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.score-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.56);
}

.score-strip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.score-strip strong {
  display: block;
  margin-top: 5px;
  color: var(--ink-strong);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
}

.audio-panel {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(220px, 2fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.62);
}

.audio-panel strong {
  display: block;
  margin-top: 4px;
  color: var(--ink-strong);
  font-size: 12px;
  font-weight: 800;
}

.audio-panel audio {
  width: 100%;
  min-width: 0;
}

.audio-panel.empty audio,
.audio-panel.empty button {
  display: none;
}

.audio-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
}

.audio-chip.muted {
  background: rgba(135, 146, 155, 0.12);
  color: var(--muted);
}

.call-summary {
  border: 1px solid rgba(11, 143, 131, 0.15);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 10px 11px;
  background: rgba(226, 247, 243, 0.72);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.48;
}

.transcript {
  max-height: 400px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.76);
  color: #25323b;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.insight {
  border-left: 4px solid var(--sky);
  padding-left: 10px;
}

.insight.warning {
  border-left-color: var(--amber);
}

.insight.danger {
  border-left-color: var(--coral);
}

.criteria-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  align-items: center;
  gap: 10px;
}

.criteria-row .issue-meta {
  display: block;
}

.criteria-row input {
  padding: 7px 9px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 12px;
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 12px;
}

.megafon-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 12px;
}

.megafon-controller {
  grid-row: span 2;
}

.megafon-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.wide-field {
  grid-column: 1 / -1;
}

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

.toggle-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--ink);
  font-size: 11px;
}

.toggle-row input {
  width: 14px;
  height: 14px;
  padding: 0;
}

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

.connection-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 8px;
  padding: 0 9px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.connection-pill[data-status="ready"] {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.connection-pill[data-status="draft"] {
  background: var(--amber-soft);
  color: var(--amber);
}

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

.mini-metric,
.topic-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.58);
}

.mini-metric span,
.topic-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.mini-metric strong,
.topic-card strong {
  display: block;
  margin: 5px 0 3px;
  color: var(--ink-strong);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.mini-metric small,
.topic-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.action-list,
.queue-list,
.integration-list,
.quality-list,
.automation-list,
.cloud-checklist,
.endpoint-list,
.data-map,
.employee-map {
  display: grid;
  gap: 0;
}

.action-row,
.data-row,
.queue-row,
.integration-row,
.quality-row,
.automation-row,
.cloud-row,
.data-map-row,
.employee-row,
.empty-state {
  display: grid;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.action-row,
.data-row,
.integration-row,
.automation-row,
.cloud-row,
.employee-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.data-map-row {
  gap: 3px;
}

.data-row {
  width: 100%;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

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

.quality-row {
  grid-template-columns: minmax(0, 1fr) minmax(110px, 0.8fr) 42px;
  gap: 10px;
}

.action-row:last-child,
.data-row:last-child,
.queue-row:last-child,
.integration-row:last-child,
.quality-row:last-child,
.automation-row:last-child,
.cloud-row:last-child,
.empty-state:last-child,
.endpoint-list code:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.action-row:first-child,
.data-row:first-child,
.queue-row:first-child,
.integration-row:first-child,
.quality-row:first-child,
.automation-row:first-child,
.cloud-row:first-child,
.data-map-row:first-child,
.employee-row:first-child,
.empty-state:first-child,
.endpoint-list code:first-child {
  padding-top: 0;
}

.action-row strong,
.data-row strong,
.integration-row strong,
.quality-row strong,
.automation-row strong,
.cloud-row strong,
.data-map-row strong,
.employee-row strong,
.empty-state strong {
  color: var(--ink-strong);
  font-weight: 800;
}

.action-row small,
.data-row small,
.integration-row small,
.quality-row small,
.automation-row small,
.cloud-row small,
.data-map-row small,
.employee-row small,
.empty-state small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.employee-row {
  grid-template-columns: 30px minmax(0, 1fr) auto;
}

.employee-row > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #162830;
  color: #ffffff;
  font-weight: 800;
}

.employee-row code {
  color: var(--muted);
  font-size: 11px;
}

.queue-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.queue-row strong,
.quality-row b,
.automation-row span {
  justify-self: end;
  color: var(--ink-strong);
  font-size: 13px;
  font-weight: 800;
}

.integration-row {
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: start;
}

.integration-row code,
.endpoint-list code {
  display: block;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 7px;
  background: rgba(20, 33, 41, 0.04);
  color: #30404b;
  font-size: 11px;
  white-space: normal;
}

.endpoint-list code {
  margin-top: 0;
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
  padding: 8px 0;
}

.cloud-row em {
  border-radius: 7px;
  padding: 4px 7px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.admin-panel {
  min-height: 240px;
}

.access-list {
  display: grid;
  gap: 0;
}

.access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.access-row:first-child {
  padding-top: 0;
}

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

.access-row strong {
  color: var(--ink-strong);
  font-weight: 800;
}

.access-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.access-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 0 9px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
}

.access-badge.muted {
  background: var(--surface-strong);
  color: var(--muted);
}

.team-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.team-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px auto;
  gap: 8px;
  margin-bottom: 10px;
}

.team-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.team-card span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #162830;
  color: #ffffff;
  font-weight: 800;
}

.team-card strong {
  color: var(--ink-strong);
  font-weight: 800;
}

.team-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

dialog {
  width: min(760px, calc(100vw - 30px));
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(15, 27, 34, 0.28);
  backdrop-filter: blur(26px) saturate(145%);
  -webkit-backdrop-filter: blur(26px) saturate(145%);
}

dialog::backdrop {
  background: rgba(14, 23, 29, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.import-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.mobile-tabbar {
  display: none;
}

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

  .dashboard-grid,
  .analysis-layout,
  .settings-grid,
  .admin-grid,
  .ops-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 10px;
  }

  .sidebar {
    top: 10px;
    z-index: 5;
    height: auto;
    padding: 12px;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .connector-panel {
    display: none;
  }

  .workspace {
    padding: 0;
  }

  h1 {
    font-size: 28px;
  }
}

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

  .auth-gate {
    padding: 0;
  }

  .auth-shell {
    height: 100vh;
    min-height: 100vh;
    padding: 12px;
  }

  .auth-card {
    gap: 14px;
    padding: 14px;
  }

  .auth-card h1 {
    font-size: 28px;
  }

  body::before {
    background-size: 34px 34px;
  }

  .app-shell {
    gap: 12px;
    padding: 10px 10px 88px;
  }

  .sidebar {
    top: 10px;
    padding: 12px;
  }

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

  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 13px;
  }

  .brand-title {
    font-size: 13px;
  }

  .brand-subtitle {
    font-size: 11px;
  }

  .sidebar .nav-list {
    display: none;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
  }

  .eyebrow {
    margin-bottom: 8px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 15px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 40px 40px;
    justify-content: stretch;
  }

  .topbar-actions .primary-button {
    grid-column: 1 / -1;
  }

  .mode-pill,
  .primary-button,
  .secondary-button,
  .icon-button {
    min-height: 36px;
  }

  .icon-button {
    width: 36px;
  }

  .primary-button {
    padding: 0 12px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
  }

  .metric-card {
    min-height: 104px;
    padding: 12px;
  }

  .metric-card strong {
    font-size: 26px;
  }

  .dashboard-grid,
  .analysis-layout,
  .settings-grid,
  .admin-grid,
  .ops-grid,
  .megafon-layout,
  .toolbar,
  .form-grid,
  .megafon-form,
  .toggle-grid,
  .score-strip,
  .audio-panel {
    grid-template-columns: 1fr;
  }

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

  .surface,
  .toolbar {
    padding: 12px;
  }

  .section-head {
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
  }

  .section-head span {
    text-align: left;
  }

  .manager-row,
  .criteria-row,
  .access-row,
  .team-preview,
  .team-form,
  .employee-row,
  .quality-row,
  .action-row,
  .data-row,
  .automation-row,
  .cloud-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

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

  .manager-row strong {
    justify-self: start;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 8px;
  }

  tbody tr {
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
  }

  tbody tr.selected {
    border-color: rgba(50, 109, 255, 0.22);
    background: rgba(238, 243, 255, 0.88);
  }

  td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 8px;
    border-bottom: 0;
    padding: 5px 0;
  }

  td::before {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  td:nth-child(1)::before {
    content: "Клиент";
  }

  td:nth-child(2)::before {
    content: "Менеджер";
  }

  td:nth-child(3)::before {
    content: "АТС";
  }

  td:nth-child(4)::before {
    content: "Аудио";
  }

  td:nth-child(5)::before {
    content: "Длительность";
  }

  td:nth-child(6)::before {
    content: "Балл";
  }

  td:nth-child(7)::before {
    content: "Риск";
  }

  .transcript {
    max-height: 320px;
  }

  menu {
    display: grid;
    grid-template-columns: 1fr;
  }

  .mobile-tabbar {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 7px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 18px 48px rgba(20, 33, 41, 0.18);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
  }

  .mobile-tabbar .nav-item {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 4px;
    min-height: 52px;
    padding: 5px 4px;
    font-size: 10px;
    line-height: 1.1;
    text-align: center;
  }

  .mobile-tabbar .nav-item::before {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    font-size: 14px;
  }
}

@media (max-width: 390px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    grid-template-columns: 1fr 1fr 40px 40px;
  }

  .topbar-actions .primary-button {
    grid-column: 1 / -1;
  }
}

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