:root {
  color-scheme: light;
  --bg-start: #f3ecfb;
  --bg-mid: #faf7ff;
  --bg-end: #efe6fa;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-soft: linear-gradient(180deg, #ffffff 0%, #fcfbff 55%, #f7f4ff 100%);
  --line: rgba(107, 78, 230, 0.14);
  --line-strong: rgba(107, 78, 230, 0.28);
  --text: #1a1a2e;
  --muted: #6b7280;
  --accent: #6b4ee6;
  --accent-strong: #5538d4;
  --accent-soft: rgba(107, 78, 230, 0.1);
  --danger: #c83e4d;
  --warning: #af6b00;
  --success: #1d7f52;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow: 0 10px 28px rgba(74, 48, 140, 0.07);
  --shadow-hover: 0 16px 36px rgba(74, 48, 140, 0.12);
  --font: "Manrope", "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-width: 320px;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  background:
    radial-gradient(circle at 12% 8%, rgba(155, 123, 255, 0.12), transparent 28%),
    radial-gradient(circle at 88% 0%, rgba(107, 78, 230, 0.1), transparent 24%),
    linear-gradient(165deg, var(--bg-start) 0%, var(--bg-mid) 45%, var(--bg-end) 100%);
  background-attachment: fixed;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes softPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(107, 78, 230, 0.08); }
  50% { box-shadow: 0 0 0 6px rgba(107, 78, 230, 0.03); }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.layout {
  animation: riseIn 0.55s var(--ease);
}

.workband,
.side-block,
.settings-panel,
.login-panel,
.hud-chip,
.tariff-card,
.addon-item,
.company-table th,
.company-table td,
.details-panel,
.stat,
.tab,
.btn,
.field input,
.field select,
.field textarea,
.inline-input,
.inline-select,
.status-trigger,
.status-dropdown,
.city-dropdown,
.city-option,
.call-btn,
.logout-btn {
  animation: fadeIn 0.42s var(--ease);
}

.hud-user {
  gap: 10px;
  animation: fadeIn 0.42s var(--ease);
}

.workband,
.side-block,
.settings-panel,
.login-panel,
.stat,
.parse-status,
.details-panel {
  background: var(--surface-soft);
}

.btn,
.tab,
.hud-chip,
.stat,
.tariff-card,
.addon-item,
.company-table tbody tr {
  transition:
    transform 0.22s var(--ease),
    box-shadow 0.22s var(--ease),
    border-color 0.22s var(--ease),
    background 0.22s var(--ease);
}

.stat:hover,
.tariff-card:hover,
.addon-item:hover,
.hud-chip:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6b4ee6, #9b7bff);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  flex: 0 0 auto;
}

.hud-user strong {
  font-size: 14px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-phone {
  order: -1;
}

.call-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  border: 0;
  display: grid;
  place-items: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.call-btn:hover {
  transform: translateY(-1px) scale(1.03);
}

.call-btn-icon {
  width: 22px;
  height: 22px;
}

.call-btn-hold {
  background: rgba(107, 78, 230, 0.12);
  box-shadow: inset 0 0 0 1px rgba(107, 78, 230, 0.25);
}

.call-btn-hold.active {
  background: linear-gradient(135deg, #6b4ee6, #8d6df0);
  box-shadow: 0 8px 20px rgba(107, 78, 230, 0.35);
}

.call-btn-hold.active .call-btn-icon {
  filter: brightness(0) invert(1);
}

.call-btn-hangup {
  background: linear-gradient(135deg, #e54857, #c83e4d);
  box-shadow: 0 8px 20px rgba(200, 62, 77, 0.35);
}

.logout-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.logout-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(74, 48, 140, 0.12);
}

.logout-icon {
  width: 20px;
  height: 20px;
}

.checkbox-card {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #f8f4ff);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.checkbox-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(107, 78, 230, 0.1);
}

.checkbox-card input {
  width: 22px;
  height: 22px;
}

.checkbox-card input:checked::after {
  left: 6px;
  top: 2px;
}

#app input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  flex-shrink: 0;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

#app input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(107, 78, 230, 0.15);
}

#app input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

#app input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(107, 78, 230, 0.25);
}

#app input[type="checkbox"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.checkbox-card strong {
  display: block;
  font-size: 14px;
}

.checkbox-card em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  margin-top: 2px;
}

.city-combobox {
  position: relative;
}

.city-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: #fff;
}

.city-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.city-list {
  max-height: calc(6 * 42px);
  overflow-y: auto;
}

.city-option {
  width: 100%;
  min-height: 42px;
  text-align: left;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(107, 78, 230, 0.08);
  color: var(--text);
  font-weight: 600;
}

.city-option:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.city-list::-webkit-scrollbar {
  width: 8px;
}

.city-list::-webkit-scrollbar-thumb {
  background: rgba(107, 78, 230, 0.35);
  border-radius: 999px;
}

.empty {
  min-height: 220px;
}

.empty strong {
  font-size: 28px;
  letter-spacing: -0.03em;
}

.call-history-block .history-list li {
  animation: fadeIn 0.3s ease;
}

.topbar,
.workband,
.side-block,
.login-panel,
.details-panel {
  backdrop-filter: blur(16px);
}

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

button {
  border: 0;
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.bg-blobs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
  animation: float 18s ease-in-out infinite;
}

.blob-a {
  width: 420px;
  height: 420px;
  left: -120px;
  top: -80px;
  background: radial-gradient(circle, #d7b8f5 0%, transparent 70%);
}

.blob-b {
  width: 360px;
  height: 360px;
  right: -80px;
  top: 20%;
  background: radial-gradient(circle, #c9b6ff 0%, transparent 70%);
  animation-delay: -6s;
}

.blob-c {
  width: 480px;
  height: 480px;
  left: 30%;
  bottom: -180px;
  background: radial-gradient(circle, #e7d4f8 0%, transparent 70%);
  animation-delay: -11s;
}

@keyframes float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(18px, -22px, 0) scale(1.05);
  }
}

.app-root {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-btn {
  border: 0;
  padding: 4px 8px 4px 4px;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
}

.brand-btn:hover,
.brand-btn:focus-visible {
  background: transparent;
  box-shadow: none;
}

.brand-btn:hover img,
.brand-btn:focus-visible img {
  transform: translateY(-1px) scale(1.04);
  box-shadow:
    0 0 0 3px rgba(107, 78, 230, 0.16),
    0 10px 24px rgba(107, 78, 230, 0.18);
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex: 0 0 auto;
  object-fit: contain;
  background: #fff;
  transition: transform 0.24s var(--ease), box-shadow 0.24s var(--ease);
}

.login-panel h1 {
  margin: 22px 0 8px;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.login-lead {
  margin: 0 0 18px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field span,
.form-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select,
.field textarea,
.inline-input,
.inline-select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  padding: 8px 12px;
  outline: none;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.inline-input:focus,
.inline-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(107, 78, 230, 0.14);
}

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  color: var(--text);
  background: #efe9fb;
  border: 1px solid transparent;
  white-space: nowrap;
  font-weight: 700;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  background: #e4dbf8;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-outline {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent-soft);
}

.btn-danger {
  background: #fdecef;
  color: var(--danger);
}

.btn-success {
  background: #e8f6f1;
  color: var(--success);
}

.btn-small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.topbar {
  min-height: 70px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(252, 250, 255, 0.92) 100%);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
  animation: fadeIn 0.45s var(--ease);
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

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

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: var(--accent-soft);
}

.brand-btn.btn-ghost:hover {
  background: transparent;
}

.btn-compact {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
}

.ui-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: 0 0 auto;
  display: block;
}

.btn-icon {
  width: 16px;
  height: 16px;
}

.hud-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  white-space: nowrap;
}

.hud-chip > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.hud-chip span,
.hud-chip em {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-style: normal;
}

.hud-chip strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.hud-actions {
  gap: 4px;
  padding: 4px;
}

.hud-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: transparent;
}

.hud-icon-btn:hover,
.hud-icon-btn.active {
  background: var(--accent-soft);
}

.status-menu {
  position: relative;
}

.status-trigger {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-weight: 700;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.status-trigger:hover,
.status-menu.open .status-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(107, 78, 230, 0.12);
  background: #faf7ff;
}

.status-trigger .chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.2s ease;
}

.status-menu.open .status-trigger .chevron {
  transform: rotate(225deg) translateY(-1px);
}

.status-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 40px rgba(74, 48, 140, 0.16);
  display: grid;
  gap: 4px;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 40;
}

.status-menu.open .status-dropdown {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.status-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  text-align: left;
}

.status-option:hover,
.status-option.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tariff-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.tariff-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.tariff-head h4 {
  margin: 0;
  font-size: 16px;
}

.tariff-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.tariff-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  text-align: left;
}

.tariff-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.tariff-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(107, 78, 230, 0.12);
  background: linear-gradient(180deg, #ffffff 0%, #f7f3ff 100%);
}

.tariff-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tariff-top strong {
  font-size: 18px;
}

.discount {
  background: #efe9fb;
  color: var(--accent);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
}

.tariff-sub {
  color: var(--muted);
  margin: 6px 0 10px;
  font-size: 13px;
}

.tariff-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.tariff-price s {
  color: var(--muted);
  font-size: 13px;
}

.tariff-price b {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.tariff-card ul {
  margin: 0 0 12px;
  padding-left: 16px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.tariff-pick {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.tariff-card.selected .tariff-pick {
  background: var(--success);
}

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

.addon-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.addon-item strong {
  display: block;
}

.addon-item em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.login-lead {
  display: none;
}

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

  .tariff-grid,
  .addon-grid {
    grid-template-columns: 1fr;
  }
}

.operator {
  min-width: 150px;
  display: grid;
  gap: 2px;
  padding-right: 6px;
}

.operator-name {
  font-weight: 800;
  overflow-wrap: anywhere;
}

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

.subscriber,
.sip-status {
  min-width: 170px;
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.subscriber span:first-child,
.sip-status span:first-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.subscriber strong,
.sip-status strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.sip-status.is-ready strong {
  color: var(--success);
}

.sip-status.is-busy strong {
  color: var(--accent);
}

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

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  padding: 18px;
}

.main-column,
.side-column {
  min-width: 0;
}

.workband,
.side-block,
.settings-panel {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.workband {
  margin-bottom: 16px;
  overflow: hidden;
}

.parse-band-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.parse-band-title strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: var(--text, #1a1a2e);
}

.parse-band-title .muted {
  font-size: 12px;
}

.parse-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  padding: 8px 14px;
}

.parse-toggle .chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(225deg);
  transition: transform 0.25s ease;
}

.parse-band.is-collapsed .parse-toggle .chevron {
  transform: rotate(45deg);
}

.parse-collapsible {
  max-height: 1600px;
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s ease,
              transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.parse-band.is-collapsed .parse-collapsible {
  max-height: 0;
  opacity: 0;
  transform: translateY(-14px);
  pointer-events: none;
}

.parse-toolbar {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(120px, 1fr) 100px auto auto auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
}

.checkbox-row {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px 16px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 78px;
  background: linear-gradient(180deg, #ffffff 0%, #fdfcff 100%);
  animation: riseIn 0.5s var(--ease) both;
}

.stats-grid .stat:nth-child(1) { animation-delay: 0.04s; }
.stats-grid .stat:nth-child(2) { animation-delay: 0.08s; }
.stats-grid .stat:nth-child(3) { animation-delay: 0.12s; }
.stats-grid .stat:nth-child(4) { animation-delay: 0.16s; }
.stats-grid .stat:nth-child(5) { animation-delay: 0.2s; }

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  letter-spacing: -0.03em;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 14px 16px 0;
  flex-wrap: wrap;
}

.tab {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 34px;
  padding: 6px 14px;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.tab:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  color: var(--text);
}

.tab.active {
  color: #fff;
  background: linear-gradient(135deg, #6b4ee6, #8d6df0);
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(107, 78, 230, 0.22);
  animation: floatY 3.2s ease-in-out infinite;
}

.table-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 14px 16px;
}

.company-table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.company-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
}

.company-table th,
.company-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.company-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #ffffff 0%, #faf8ff 100%);
}

.company-table tbody tr:hover {
  background: linear-gradient(90deg, rgba(107, 78, 230, 0.04), rgba(255, 255, 255, 0));
  transform: translateX(2px);
}

.company-name {
  font-weight: 800;
  max-width: 260px;
  overflow-wrap: anywhere;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 10px;
  background: #efe9fb;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.status-agreed {
  background: #e6f4ee;
  color: var(--success);
}

.status-not_interested,
.status-wrong_number {
  background: #fdecef;
  color: var(--danger);
}

.status-thinking,
.status-callback {
  background: #fff4df;
  color: var(--warning);
}

.status-in_call {
  background: var(--accent-soft);
  color: var(--accent);
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.company-row-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex-wrap: nowrap;
}

.company-row-actions .btn {
  width: 100%;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.status-pill {
  transition: background 0.3s ease, color 0.3s ease, transform 0.3s var(--ease);
}

.pill-flash {
  animation: pillFlash 0.7s var(--ease);
}

@keyframes pillFlash {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(107, 78, 230, 0.35); }
  40% { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(107, 78, 230, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(107, 78, 230, 0); }
}

.btn-saved {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: #fff !important;
}

.details-row td {
  background: #faf7ff;
  padding: 0;
}

.details-anim {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(-8px);
  transition:
    grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.32s ease,
    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.details-anim.open {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
}

.details-anim > .details-body {
  overflow: hidden;
  min-height: 0;
}

.details-loading {
  display: flex !important;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
}

.details-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent-soft, #e6ddfb);
  border-top-color: var(--accent, #6b4ee6);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.details-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 16px;
  padding: 16px;
}

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

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

.history-list,
.activity-list,
.task-list,
.script-list,
.team-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-list li,
.activity-list li,
.task-list li,
.script-list li,
.team-list li {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #fff;
}

.side-column {
  display: grid;
  gap: 16px;
  align-content: start;
}

.side-block {
  padding: 16px;
}

.side-block h2,
.details-panel h3,
.settings-panel h2 {
  margin: 0 0 12px;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.parse-inline-status {
  margin: 0 16px 14px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(180deg, #ffffff 0%, #faf8ff 100%);
  border: 1px solid rgba(107, 78, 230, 0.12);
}

.parse-inline-status[hidden] {
  display: none;
}

.parse-inline-status.success {
  color: var(--success);
}

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

.checkbox-compact span {
  display: block;
}

.checkbox-compact em {
  display: none;
}

.parse-status-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.parse-status-hint {
  display: none;
}

.notice {
  margin: 0 16px 16px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.notice:empty {
  display: none;
}

.parse-status {
  margin: 0 16px 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(107, 78, 230, 0.14);
  background: linear-gradient(180deg, #ffffff 0%, #faf8ff 100%);
  box-shadow: var(--shadow);
  animation: riseIn 0.45s var(--ease);
}

.parse-status.active {
  border-color: rgba(107, 78, 230, 0.32);
  animation: riseIn 0.45s var(--ease), softPulse 2.8s ease-in-out infinite;
}

.parse-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.parse-status-head strong {
  font-size: 15px;
}

.parse-status-head span {
  color: var(--accent);
  font-weight: 700;
}

.parse-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(107, 78, 230, 0.12);
  overflow: hidden;
  margin-bottom: 12px;
}

.parse-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6b4ee6, #9b7bff, #6b4ee6);
  background-size: 200% 100%;
  transition: width 0.55s var(--ease);
  animation: shimmer 2.4s linear infinite;
}

.parse-status-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.parse-status-grid div {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  border: 1px solid rgba(107, 78, 230, 0.08);
}

.parse-status-grid span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.parse-status-grid strong {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.parse-status-hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.city-empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

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

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

.empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
  padding: 36px 24px;
}

.empty strong {
  color: var(--text);
  font-size: 20px;
}

.settings-shell {
  padding: 18px;
}

.settings-panel {
  padding: 20px;
  max-width: 920px;
}

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

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

.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.settings-hint {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.team-panel {
  max-width: 1100px;
}

.team-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.team-panel-head h2 {
  margin: 0 0 4px;
}

.team-panel-head .settings-hint {
  margin: 0;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.team-panel .side-block {
  animation: riseIn 0.4s var(--ease) both;
}

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

.view-switch {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.view-switch button {
  min-height: 34px;
  border-radius: 999px;
  padding: 6px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.view-switch button.active {
  background: var(--accent);
  color: #fff;
}

.hidden {
  display: none !important;
}

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

  .side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .topbar-actions {
    justify-content: flex-start;
  }

  .parse-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .parse-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid,
  .side-column,
  .details-panel,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .layout,
  .settings-shell {
    padding: 10px;
  }

  .parse-toolbar,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 10px;
  }

  .btn,
  .inline-select {
    width: 100%;
  }

  .view-switch {
    width: 100%;
  }

  .view-switch button {
    flex: 1;
  }
}
