* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background: #ffffff;
  color: #1a1a1a;
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

/* Минималистичная форма авторизации */
.auth-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: #ffffff;
}

#loginForm {
  width: 100%;
  max-width: 360px;
  padding: 3rem 2rem;
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: 2px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

#loginForm h1 {
  font-size: 1.75rem;
  font-weight: 300;
  margin-bottom: 0.5rem;
  color: #1a1a1a;
  text-align: center;
  letter-spacing: -0.5px;
}

#loginForm p {
  margin-bottom: 2rem;
  color: #666666;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 400;
}

#loginForm input {
  width: 100%;
  padding: 0.875rem 0;
  border: none;
  border-bottom: 1px solid #e0e0e0;
  background: transparent;
  font-size: 1rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s ease;
  outline: none;
}

#loginForm input::placeholder {
  color: #999999;
  font-weight: 300;
}

#loginForm input:focus {
  border-bottom-color: #1a1a1a;
}

#loginForm button {
  width: 100%;
  background: #1a1a1a;
  color: #ffffff;
  padding: 0.875rem;
  border: none;
  border-radius: 2px;
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 1rem;
}

#loginForm button:hover {
  background: #333333;
  transform: translateY(-1px);
}

#loginForm button:active {
  transform: translateY(0);
}

#loginForm button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.error {
  color: #d32f2f;
  background: #ffeaea;
  border: 1px solid #ffcdd2;
  padding: 0.75rem;
  border-radius: 2px;
  margin-top: 1rem;
  font-size: 0.875rem;
  text-align: center;
}

/* Основной интерфейс */
.main-content {
  display: flex;
  min-height: 100vh;
  background: #fafafa;
}

.main-content-inner {
  flex: 1;
  margin-left: 240px;
  padding: 2rem;
  background: #fafafa;
}

/* Информация о компании */
#currentCompany {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: #666666;
}

#companyName {
  font-weight: 500;
  color: #1a1a1a;
}

/* Сайдбар */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 240px;
  height: 100vh;
  background: #ffffff;
  border-right: 1px solid #e8e8e8;
  z-index: 20;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
  font-size: 1.1rem;
  color: #1a1a1a;
}

.sidebar-nav {
  padding: 1rem 0;
}

.nav-section {
  margin-bottom: 1.5rem;
}

.nav-section-title {
  padding: 0 1.5rem 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #999999;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: #666666;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.nav-item:hover {
  background: #f8f8f8;
  color: #1a1a1a;
}

.nav-item.active {
  color: #1a1a1a;
  background: #f0f0f0;
  font-weight: 500;
  border-right: 2px solid #1a1a1a;
}

.nav-item-icon {
  margin-right: 0.75rem;
  font-size: 1.1rem;
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 2px;
  font-size: 0.875rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.25px;
}

.btn-primary {
  background: #1a1a1a;
  color: #ffffff;
}

.btn-primary:hover {
  background: #333333;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  color: #1a1a1a;
  border: 1px solid #e0e0e0;
}

.btn-secondary:hover {
  background: #f8f8f8;
  border-color: #cccccc;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Заголовки страниц */
.page-title {
  margin-bottom: 2rem;
}

.page-title h1 {
  font-size: 2rem;
  font-weight: 300;
  color: #1a1a1a;
  letter-spacing: -0.5px;
}

/* Карточки */
.settings-card {
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: 2px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.settings-card h2 {
  font-size: 1.25rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  color: #1a1a1a;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.input-group {
  display: flex;
  flex-direction: column;
}

.input-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
}

.input-group input {
  padding: 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 2px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: #1a1a1a;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: #1a1a1a;
}

.checkbox-group label {
  font-size: 0.875rem;
  color: #666666;
}

.last-updated {
  font-size: 0.875rem;
  color: #999999;
}

/* Алерты */
.alert {
  padding: 1rem;
  border-radius: 2px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.alert-error {
  background: #ffeaea;
  border: 1px solid #ffcdd2;
  color: #d32f2f;
}

.alert-error-icon {
  display: inline-block;
  margin-right: 0.5rem;
}

/* Статистика */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: 2px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.sidebar-toggle {
  position: fixed;
  top: 16px;
  left: 276px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  width: 36px;
  height: 36px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  z-index: 1001;
  display: none;
  justify-content: center;
  align-items: center;
  font-size: 14px;
  color: var(--gray-600);
  transition: all 0.2s ease;
}

.sidebar-toggle.visible {
  display: flex;
}

.sidebar-toggle:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.sidebar.collapsed + .sidebar-toggle {
  left: 16px;
}

.stat-card-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-info h3 {
  font-size: 0.875rem;
  color: #666666;
  margin-bottom: 0.5rem;
  font-weight: 400;
}

.stat-info p {
  font-size: 1.75rem;
  font-weight: 300;
  color: #1a1a1a;
  letter-spacing: -0.5px;
}

.stat-icon {
  font-size: 1.5rem;
  opacity: 0.6;
}

/* Карточки звонков */
.calls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.call-card {
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: 2px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: box-shadow 0.2s ease;
}

.call-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.call-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.call-card-header h3 {
  font-size: 1.1rem;
  font-weight: 500;
  color: #1a1a1a;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.25px;
}

.status-completed {
  background: #e8f5e8;
  color: #2e7d32;
}

.status-connected {
  background: #e3f2fd;
  color: #1565c0;
}

.status-waiting {
  background: #fff8e1;
  color: #f57c00;
}

.status-connecting {
  background: #fce4ec;
  color: #c2185b;
}

.status-ringing {
  background: #f3e5f5;
  color: #7b1fa2;
}

.status-error {
  background: #ffeaea;
  color: #d32f2f;
}

.status-unknown {
  background: #f5f5f5;
  color: #666666;
}

.call-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.call-detail-row {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
}

.call-detail-icon {
  margin-right: 0.5rem;
  color: #999999;
}

.call-detail-label {
  color: #666666;
}

.call-detail-value {
  color: #1a1a1a;
  margin-left: 0.5rem;
}

.call-detail-between {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
}

.call-detail-between .label {
  color: #666666;
}

.call-detail-between .value {
  color: #1a1a1a;
}

.call-id {
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", monospace;
  font-size: 0.75rem;
  background: #f8f8f8;
  padding: 0.25rem 0.5rem;
  border-radius: 2px;
  color: #666666;
}

.call-summary {
  padding-top: 1rem;
  border-top: 1px solid #f0f0f0;
  margin-top: 1rem;
}

.call-summary-label {
  font-size: 0.875rem;
  color: #666666;
  margin-bottom: 0.5rem;
}

.call-summary-text {
  font-size: 0.875rem;
  color: #1a1a1a;
  line-height: 1.5;
}

.spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Адаптивность */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .main-content-inner {
    margin-left: 0;
    padding: 1rem;
  }

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

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

  #loginForm {
    padding: 2rem 1.5rem;
  }
}
