/* ==========================================================================
   Global Reset & Scrollbars
========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Скрытие скроллбаров (IE и Firefox) */
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Скрытие скроллбаров (Webkit) */
::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* ==========================================================================
   Base
========================================================================== */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e5e7eb;
  min-height: 100vh;
}

/* Внутренние страницы (доска, панели) */
body.dashboard-layout {
  padding: 20px;
}

/* Страницы входа (login/index) */
body.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* ==========================================================================
   Authentication Card
========================================================================== */
.auth-card {
  background: #020617;
  border-radius: 16px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.auth-card h1 {
  margin-bottom: 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.auth-card .subtitle {
  margin-bottom: 22px;
  font-size: 13px;
  color: #9ca3af;
}

.auth-card .hint {
  margin-top: 10px;
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
}

/* ==========================================================================
   Header Navbar
========================================================================== */
.header {
  background: #020617;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.user-label {
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.username {
  font-size: 18px;
  font-weight: 600;
  color: #60a5fa;
}

.role {
  font-size: 13px;
  color: #9ca3af;
}

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

/* ==========================================================================
   Typography & Titles
========================================================================== */
.section-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #e5e7eb;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  padding-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.empty-message {
  text-align: center;
  color: #9ca3af;
  padding: 20px;
  font-size: 14px;
}

.empty-message-centered {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 16px;
}

/* ==========================================================================
   Sections & Layout
========================================================================== */
.sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

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

.section {
  background: #020617;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.campaign-info {
  background: #020617;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.campaign-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 16px;
}

.campaign-info h1 {
  font-size: 28px;
  margin-bottom: 0;
  color: #e5e7eb;
}

.campaign-info .info-row {
  display: flex;
  margin-bottom: 12px;
}

.campaign-info .info-label {
  font-weight: 600;
  color: #9ca3af;
  width: 200px;
}

.campaign-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.operator-dashboard .section {
  margin-bottom: 24px;
}

.scroll-container {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 12px;
}

/* ==========================================================================
   Buttons
========================================================================== */
button,
.btn {
  font-family: inherit;
  outline: none;
}

/* Primary buttons (Green / Base) */
.btn-primary,
.logout-btn,
.btn-start {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.btn-primary:hover,
.logout-btn:hover,
.btn-start:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.4);
  filter: brightness(1.03);
}

.btn-primary:active,
.logout-btn:active,
.btn-start:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(34, 197, 94, 0.3);
}

/* Primary Auth button (Full width) */
.btn-auth {
  width: 100%;
  border-radius: 999px;
  box-shadow: 0 16px 30px rgba(22, 163, 74, 0.45);
}

.btn-auth:hover {
  box-shadow: 0 20px 40px rgba(22, 163, 74, 0.55);
}

/* Secondary Buttons */
.btn-secondary,
.back-btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid #4b5563;
  background: transparent;
  color: #e5e7eb;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-secondary:hover,
.back-btn:hover {
  background: rgba(75, 85, 99, 0.2);
}

.back-btn {
  border-radius: 999px;
}

/* Action / Small Buttons */
.btn-action,
.add-btn,
.create-btn,
.btn-edit-campaign {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-action:hover,
.add-btn:hover,
.create-btn:hover,
.btn-edit-campaign:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

/* Danger / Delete Buttons */
.btn-danger,
.btn-delete,
.logout-btn,
.btn-delete-campaign {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  color: white;
}

.btn-danger:hover,
.btn-delete:hover,
.logout-btn:hover,
.btn-delete-campaign:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.logout-btn {
  border-radius: 999px;
  padding: 10px 20px;
  box-shadow: 0 16px 30px rgba(239, 68, 68, 0.45);
}

.logout-btn:hover {
  box-shadow: 0 20px 40px rgba(239, 68, 68, 0.55);
}

/* Warning / Orange Buttons */
.btn-warning,
.btn-edit,
.btn-start.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover,
.btn-edit:hover,
.btn-start.active:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

/* Table Action Buttons */
.btn-table-action {
  padding: 6px 12px;
  border-radius: 6px;
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #e5e7eb;
}

.btn-table-action:hover {
  background: #334155;
  transform: translateY(-1px);
}

.btn-table-action.btn-edit {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
}

.btn-table-action.btn-edit:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
}

/* Action button flex container */
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ==========================================================================
   Forms & Inputs
========================================================================== */
.form-group {
  margin-bottom: 20px;
  position: relative;
}

.form-label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
  color: #e5e7eb;
  font-weight: 500;
}

.form-label.required::after {
  content: " *";
  color: #ef4444;
}

.form-input,
.form-select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 8px;
  /* Standard radius */
  border: 1px solid #4b5563;
  background: #0f172a;
  color: #e5e7eb;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form-input:focus,
.form-select:focus {
  border-color: #3b82f6;
  /* Unified focus color */
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.auth-card .form-input {
  border-radius: 10px;
  /* Slight variation for login */
  background: #020617;
}

.auth-card .form-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px #38bdf8;
}

.form-input[readonly],
.form-input:disabled,
textarea[readonly] {
  opacity: 0.9;
  cursor: default;
  background: #1e293b;
}

.form-input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35);
}

.script-textarea {
  max-height: 260px;
  overflow-y: auto;
  resize: vertical;
}

/* Убираем стрелочки (spinners) у числовых полей */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* Checkboxes */
input[type="checkbox"] {
  width: auto;
  cursor: pointer;
  accent-color: #3b82f6;
}

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

/* Filters Layout */
.filters-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  margin-top: 12px;
}

.filters-row .form-input {
  flex: 1;
  min-width: 130px;
}

.filters-panel {
  margin-bottom: 20px;
  padding: 16px;
  background: #0f172a;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

/* ==========================================================================
   Modals
========================================================================== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  background: #020617;
  margin: 5% auto;
  padding: 32px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  color: #e5e7eb;
}

.close {
  color: #9ca3af;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.close:hover {
  color: #e5e7eb;
}

/* ==========================================================================
   Tables
========================================================================== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

th {
  font-weight: 600;
  color: #9ca3af;
  font-size: 12px;
  text-transform: uppercase;
  background: #1e293b;
  border-bottom: 2px solid #334155;
}

td {
  color: #e5e7eb;
}

tr:hover {
  background: rgba(59, 130, 246, 0.05);
}

/* Sticky Header Table */
.sticky-table-container {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
}

.sticky-table-container thead th {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* ==========================================================================
   Badges & Statuses
========================================================================== */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}

.status-ready,
.status-active,
.status-success {
  background: rgba(34, 197, 94, 0.16);
  color: #4ade80;
}

.status-busy,
.status-rejected {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
}

.status-offline,
.status-inactive,
.status-unavailable {
  background: rgba(107, 114, 128, 0.16);
  color: #9ca3af;
}

.status-paused,
.status-retry,
.status-no_answer {
  background: rgba(251, 191, 36, 0.16);
  color: #fbbf24;
}

.status-calling {
  background: rgba(59, 130, 246, 0.16);
  color: #60a5fa;
  animation: pulse 1.5s ease-in-out infinite;
}

.status-failed {
  background: rgba(127, 29, 29, 0.3);
  color: #fca5a5;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

.card-open-status {
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
}

.card-open-status-open {
  background: rgba(34, 197, 94, 0.16);
  color: #4ade80;
}

.card-open-status-closed {
  background: rgba(148, 163, 184, 0.2);
  color: #e5e7eb;
}

/* ==========================================================================
   Tabs
========================================================================== */
.tabs-header {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.55);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.9);
  margin-bottom: 18px;
  gap: 2px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: #9ca3af;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.08s ease, box-shadow 0.12s ease;
}

.tab-btn:hover {
  background: rgba(30, 64, 175, 0.28);
  color: #e5e7eb;
}

.tab-btn:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.9);
  outline-offset: 1px;
}

.tab-btn-active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #e5e7eb;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.75);
  transform: translateY(-1px);
}

.tab-panel {
  display: none;
}

.tab-panel-active {
  display: block;
}

/* ==========================================================================
   Toasts
========================================================================== */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: #e5e7eb;
  font-size: 13px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

.toast-show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast-success {
  border-color: rgba(34, 197, 94, 0.7);
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.7);
}

/* ==========================================================================
   Audio & Recording specific
========================================================================== */
.audio-btn-inline,
.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.5);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
}

.audio-btn-inline:hover,
.audio-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.6);
  filter: brightness(1.05);
}

.audio-inline {
  display: block;
  width: 100%;
  max-width: 260px;
  height: 26px;
}

.recording-id {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

.copy-id-btn {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.95);
  color: #9ca3af;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 10px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, transform 0.06s ease, box-shadow 0.06s ease;
}

.copy-id-btn:hover {
  background: #1e293b;
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.8);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.7);
  transform: translateY(-0.5px);
}

.copy-id-btn:active {
  transform: translateY(0.5px);
  box-shadow: none;
  opacity: 0.95;
}

.success-toggle-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.95);
  color: #22c55e;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease, box-shadow 0.06s ease, color 0.12s ease, opacity 0.12s ease;
}

.success-toggle-btn-on {
  background: rgba(22, 163, 74, 0.18);
  border-color: rgba(34, 197, 94, 0.8);
  box-shadow: 0 3px 10px rgba(22, 163, 74, 0.45);
}

.success-toggle-btn:not(.success-toggle-btn-on) {
  color: transparent;
}

.success-toggle-btn:hover {
  border-color: rgba(148, 163, 184, 0.9);
  background: #1e293b;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.8);
}

.success-toggle-btn:active {
  transform: translateY(0.5px);
  box-shadow: none;
  opacity: 0.95;
}

/* ==========================================================================
   Search / Filter Additions
========================================================================== */
.search-results {
  position: absolute;
  z-index: 1001;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  width: 100%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.9);
}

.search-result-item {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  transition: background 0.15s ease;
}

.search-result-item:hover {
  background: rgba(59, 130, 246, 0.1);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item .city {
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 4px;
}

.search-result-item .region {
  font-size: 12px;
  color: #9ca3af;
}

/* Current Call Highlight */
.current-call-card {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  padding: 24px;
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}