:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --card-hover: #f8fafc;

  --text: #111827;
  --text-secondary: #6b7280;

  --border: #d1d5db;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;

  --danger: #dc2626;
  --danger-hover: #b91c1c;

  --success: #15803d;

  --shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

body.dark-theme {
  --bg: #0f172a;
  --card: #111827;
  --card-hover: #1f2937;

  --text: #f3f4f6;
  --text-secondary: #9ca3af;

  --border: #374151;

  --primary: #3b82f6;
  --primary-hover: #2563eb;

  --danger: #ef4444;
  --danger-hover: #dc2626;

  --success: #22c55e;

  --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;

  background: var(--bg);
  color: var(--text);

  transition:
    background 0.25s ease,
    color 0.25s ease;
}

.hidden {
  display: none !important;
}

.page {
  max-width: 1300px;
  margin: 0 auto;
  padding: 20px;
}

.auth-view {
  min-height: 100vh;

  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 360px;

  background: var(--card);

  border: 1px solid var(--border);
  border-radius: 18px;

  padding: 28px;

  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin-top: 0;
  margin-bottom: 20px;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-card input,
.auth-card button {
  border-radius: 12px;
  font-size: 14px;
  padding: 12px 14px;
}

.auth-card input {
  border: 1px solid var(--border);

  background: transparent;
  color: var(--text);
}

.auth-card button {
  border: none;

  background: var(--primary);
  color: white;

  font-weight: 600;

  cursor: pointer;

  transition: background 0.2s ease;
}

.auth-card button:hover {
  background: var(--primary-hover);
}

.login-error {
  margin-top: 14px;
  color: var(--danger);
}
/* 
.header {
  display: flex;
  flex-direction: column;
  gap: 18px;

  margin-bottom: 24px;
} */

.header {
  display: flex;
  flex-direction: column;
  gap: 12px;

  margin-bottom: 16px;
}


.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.header-title {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.header-title h1 {
  margin: 0;
  font-size: 32px;
}

.header-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

/* .header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
} */

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* .header-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;

  background: var(--card);

  border: 1px solid var(--border);
  border-radius: 18px;

  padding: 16px 18px;

  box-shadow: var(--shadow);
} */

.header-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;

  background: var(--card);

  border: 1px solid var(--border);
  border-radius: 14px;

  padding: 10px 12px;

  box-shadow: var(--shadow);
}

.current-user {
  font-size: 14px;
  color: var(--text-secondary);
}

/* .status {
  padding: 10px 14px;

  border-radius: 12px;

  background: rgba(59, 130, 246, 0.12);
  color: var(--primary);

  font-size: 14px;
  font-weight: 600;
} */

.status {
  padding: 7px 11px;

  border-radius: 10px;

  background: rgba(59, 130, 246, 0.12);
  color: var(--primary);

  font-size: 13px;
  font-weight: 600;
}

.push-button,
.logout-button,
.theme-button {
  border: none;
  border-radius: 10px;

  padding: 7px 11px;

  font-size: 13px;
  font-weight: 600;

  white-space: nowrap;

  cursor: pointer;

  transition:
    background 0.2s ease,
    transform 0.15s ease;
}

.push-button,
.theme-button {
  background: var(--card-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.push-button:hover,
.theme-button:hover {
  background: var(--border);
}

.logout-button {
  background: var(--danger);
  color: white;
}

.logout-button:hover {
  background: var(--danger-hover);
}

.notifications {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.notification {
  background: var(--card);

  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);

  border-radius: 18px;

  padding: 18px;

  box-shadow: var(--shadow);

  transition:
    background 0.25s ease,
    transform 0.2s ease;
}

.notification:hover {
  transform: translateY(-2px);
}

.notification-new {
  animation: pulse 1s ease infinite alternate;
}

.notification-title {
  font-size: 16px;
  font-weight: 700;

  margin-bottom: 10px;
}

.notification-message {
  line-height: 1.5;
  margin-bottom: 12px;

  white-space: pre-line;
}

.notification-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

/* .sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  cursor: pointer;
  user-select: none;

  font-weight: 600;
} */

.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;

  cursor: pointer;
  user-select: none;

  font-weight: 600;
}

.sound-toggle-label {
  font-size: 13px;
}

/* .sound-toggle-track {
  width: 52px;
  height: 28px;

  border-radius: 20px;

  background: #991b1b;

  position: relative;

  transition: background 0.25s ease;
}

.sound-toggle-thumb {
  width: 22px;
  height: 22px;

  border-radius: 50%;

  background: white;

  position: absolute;

  top: 3px;
  left: 3px;

  transition: transform 0.25s ease;
}

.sound-toggle.active .sound-toggle-track {
  background: var(--success);
} */

.sound-toggle-track {
  width: 38px;
  height: 21px;

  border-radius: 20px;

  background: #991b1b;

  position: relative;
  flex-shrink: 0;

  transition: background 0.25s ease;
}

.sound-toggle-thumb {
  width: 15px;
  height: 15px;

  border-radius: 50%;

  background: white;

  position: absolute;

  top: 3px;
  left: 3px;

  transition: transform 0.25s ease;
}

.sound-toggle.active .sound-toggle-thumb {
  transform: translateX(17px);
}

.sound-toggle.active .sound-toggle-thumb {
  transform: translateX(24px);
}

.sound-toggle-label {
  font-size: 14px;
}

@keyframes pulse {
  from {
    box-shadow: 0 0 0 rgba(59, 130, 246, 0.2);
  }

  to {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
  }
}

@media (max-width: 768px) {
  .page {
    padding: 12px;
  }

  .header-panel {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .header-controls {
    width: 100%;
    gap: 6px;
  }

  .push-button,
  .logout-button,
  .theme-button {
    flex: 1 1 auto;
    padding: 7px 9px;
    font-size: 12px;
  }

  .header-title h1 {
    font-size: 22px;
  }

  .ip-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px 10px;
  }
}

@media (max-width: 480px) {
  .sound-toggle-label {
    display: none;
  }
}

.notification-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.notification-done-badge {
  flex-shrink: 0;

  padding: 5px 10px;

  border-radius: 999px;

  background: #16a34a;
  color: white;

  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.notification.notification-done {
  background: #eefbf2;
  border-color: #86efac;
  border-left-color: #16a34a;
}

body.dark-theme .notification.notification-done {
  background: #0f2d1c;
  border-color: #166534;
  border-left-color: #22c55e;
}

.notification.notification-done .notification-title {
  color: #15803d;
}

body.dark-theme .notification.notification-done .notification-title {
  color: #22c55e;
}

.notification.notification-done .notification-message {
  opacity: 0.85;
}

.notification.notification-done .notification-meta {
  opacity: 0.7;
}

.notification-processed {
  display: inline-block;

  margin-top: 10px;
  padding: 5px 10px;

  border-radius: 8px;

  background: rgba(34, 197, 94, 0.12);
  color: #15803d;

  font-size: 13px;
  font-weight: 600;
}

body.dark-theme .notification-processed {
  color: #22c55e;
}

.notification-process-btn {
  margin-top: 12px;

  border: none;
  border-radius: 10px;

  padding: 8px 14px;

  cursor: pointer;

  font-size: 14px;
  font-weight: 700;

  transition:
    background 0.2s ease,
    transform 0.15s ease,
    opacity 0.2s ease;
}

.notification-process-btn:hover {
  transform: translateY(-1px);
}

.notification-process-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.notification-process-btn-pending {
  background: #2563eb;
  color: white;
}

.notification-process-btn-pending:hover {
  background: #1d4ed8;
}

.notification-process-btn-done {
  background: #16a34a;
  color: white;
}

.notification-process-btn-done:hover {
  background: #15803d;
}

@media (max-width: 600px) {
  .notification-header-row {
    flex-direction: column;
  }

  .notification-done-badge {
    align-self: flex-start;
  }
}

/* .ip-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;

  background: var(--card);

  border: 1px solid var(--border);
  border-radius: 18px;

  padding: 16px 18px;
  margin-bottom: 24px;

  box-shadow: var(--shadow);
}

.ip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ip-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.ip-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
}

.ip-value-muted {
  color: var(--text-secondary);
}

.ip-alert {
  padding: 10px 12px;

  border-radius: 12px;

  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);

  font-size: 14px;
  font-weight: 600;
} */

.ip-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;

  background: var(--card);

  border: 1px solid var(--border);
  border-radius: 14px;

  padding: 12px 14px;
  margin-bottom: 16px;

  box-shadow: var(--shadow);
}

.ip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px 14px;
}

.ip-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ip-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.ip-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ip-value-muted {
  color: var(--text-secondary);
}

.ip-alert {
  padding: 8px 10px;
  border-radius: 10px;

  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);

  font-size: 13px;
  font-weight: 600;
}

.fp-changed {
  color: var(--danger);
  font-weight: 700;
}

.fp-changes {
  display: flex;
  flex-direction: column;
  gap: 8px;

  margin-top: 4px;
  padding-top: 12px;

  border-top: 1px solid var(--border);
}

.fp-change {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;

  font-size: 13px;
}

.fp-change-label {
  min-width: 150px;
  color: var(--text-secondary);
}

.fp-change-old,
.fp-change-new {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--card-hover);
}

.fp-change-new {
  color: var(--danger);
}

.fp-change-arrow {
  color: var(--text-secondary);
}

@media (max-width: 600px) {
  .fp-change-label {
    min-width: 100%;
  }
}
/* ---------------- новый интерфейс (lab) ---------------- */

.lab-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
}

.lab-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.lab-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.lab-tab {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.lab-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.lab-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.lab-filters label {
  font-size: 13px;
  color: var(--text-secondary);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.lab-filters select,
.lab-filters input,
.lab-form select,
.lab-form input {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
}

.lab-chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 13px;
  cursor: pointer;
}

.lab-chip.active {
  background: rgba(37, 99, 235, 0.14);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.lab-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.lab-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.lab-card-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.lab-card-value {
  font-size: 22px;
  font-weight: 700;
}

.lab-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.lab-section h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.lab-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

.lab-subtitle {
  margin: 14px 0 6px;
  font-size: 14px;
}

.lab-details {
  margin-top: 14px;
}

.lab-details summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

/* блоки статистики и мониторинга: свёрнуты, раскрываются по заголовку */
.lab-fold:not([open]) {
  margin-bottom: 8px;
}

.lab-fold > summary {
  position: relative;
  padding-left: 18px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.lab-fold > summary::-webkit-details-marker {
  display: none;
}

.lab-fold > summary::before {
  content: "▸";
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--text-secondary);
  transition: transform 0.15s;
}

.lab-fold[open] > summary {
  margin-bottom: 10px;
}

.lab-fold[open] > summary::before {
  transform: rotate(90deg);
}

.lab-fold > summary h3 {
  display: inline;
  margin: 0;
}

.lab-fold-note {
  margin-left: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.lab-fold-note:empty {
  display: none;
}

/* галочки «верно» / «отметить» в теннисных блоках мониторинга */
.lab-pick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
}

.lab-pick:has(input:checked) {
  border-color: var(--success);
  color: var(--success);
}

.lab-table-wrap {
  overflow-x: auto;
}

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

.lab-table th,
.lab-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.lab-table th {
  color: var(--text-secondary);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--card);
}

.lab-table td.num,
.lab-table th.num {
  text-align: right;
}

.lab-table tr.lab-total td {
  font-weight: 700;
}

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

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

.st {
  display: inline-block;
  min-width: 70px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.st-ok {
  background: rgba(21, 128, 61, 0.14);
  color: var(--success);
}

.st-warn,
.st-silent {
  background: rgba(217, 119, 6, 0.16);
  color: #b45309;
}

.st-error {
  background: rgba(220, 38, 38, 0.14);
  color: var(--danger);
}

.st-off {
  background: var(--card-hover);
  color: var(--text-secondary);
}

.lab-small-btn {
  border: 1px solid var(--border);
  background: var(--card-hover);
  color: var(--text);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
}

.lab-small-btn:hover {
  background: var(--border);
}

/* статистика по лигам: строки рынков внутри лиги; состояние лиги в мониторинге */
.lab-table tr.lab-sub td {
  font-size: 12px;
  opacity: 0.85;
}

.lab-off {
  color: #b45309;
  font-weight: 600;
}

.lab-addon-input {
  width: 68px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: 12px;
}

.lab-thr h4 {
  margin: 14px 0 6px;
}

.lab-thr small {
  opacity: 0.7;
}

.lab-form {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}

.notification-bk {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--card-hover);
  border: 1px solid var(--border);
}

.notification-result {
  font-size: 12px;
  font-weight: 700;
  margin-left: 6px;
}

.lab-more {
  margin: 14px auto;
  display: block;
}

@media (max-width: 600px) {
  .page {
    padding: 12px;
  }

  .header-title h1 {
    font-size: 24px;
  }

  .lab-card-value {
    font-size: 18px;
  }
}
