:root {
  /* Discord-like dark */
  --bg: #1e1f22;
  --surface: #2b2d31;
  --surface-hover: #35373c;
  --surface-elevated: #313338;
  --border: #3f4147;
  --text: #f2f3f5;
  --text-muted: #b5bac1;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --success: #23a559;
  --danger: #f23f42;
  --warning: #f0b232;
  --error: #c084fc;
  --radius: 8px;
  --font: 'Segoe UI', system-ui, sans-serif;
  --outline: 1px solid var(--border);
}

/* Светлая по умолчанию: нейтральная бело-серая, без холодных/ментоловых оттенков */
body.theme-light {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-hover: #f4f4f5;
  --surface-elevated: #ffffff;
  --border: #e0e2e6;
  --text: #18181b;
  --text-muted: #55575e;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #a16207;
  --error: #7c3aed;
}

/* ——— Палитры (выбираются на вкладке «Настройки») ——— */
/* Светлая: Slate (холодная, по спеке) */
body.theme-light.palette-light-slate {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
}

/* Светлая: чисто белая */
body.theme-light.palette-light-white {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
}

/* Тёмная: Slate (по спеке) */
body.palette-dark-slate:not(.theme-light) {
  --bg: #0b1220;
  --surface: #111827;
  --surface-hover: #1f2937;
  --surface-elevated: #1e293b;
  --border: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
}

/* Тёмная: чёрная */
body.palette-dark-black:not(.theme-light) {
  --bg: #0a0a0b;
  --surface: #131316;
  --surface-hover: #1c1c21;
  --surface-elevated: #18181c;
  --border: #26262c;
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
}

/* Тёмная: аметист (фиолетовая) */
body.palette-dark-purple:not(.theme-light) {
  --bg: #16121f;
  --surface: #1e1829;
  --surface-hover: #2a2138;
  --surface-elevated: #251d31;
  --border: #3b2f52;
  --text: #f3f0fa;
  --text-muted: #a89cc4;
  --accent: #a78bfa;
  --accent-hover: #8b5cf6;
}

/* Тёмная: океан (глубокая сине-зелёная) */
body.palette-dark-ocean:not(.theme-light) {
  --bg: #071318;
  --surface: #0d1f26;
  --surface-hover: #143039;
  --surface-elevated: #112831;
  --border: #1e4450;
  --text: #ecfeff;
  --text-muted: #7fa8b3;
  --accent: #22d3ee;
  --accent-hover: #06b6d4;
}

/* Светлая: тёплая (бежево-серая) */
body.theme-light.palette-light-warm {
  --bg: #f5f5f4;
  --surface: #ffffff;
  --surface-hover: #fafaf9;
  --border: #e0ddd9;
  --text: #1c1917;
  --text-muted: #57534e;
  --accent: #ea580c;
  --accent-hover: #c2410c;
}

/* Светлая: лаванда */
body.theme-light.palette-light-lavender {
  --bg: #f5f3ff;
  --surface: #ffffff;
  --surface-hover: #faf8ff;
  --border: #e4dcf7;
  --text: #211c3a;
  --text-muted: #5f5a75;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
}

body.theme-light #login-screen {
  background: linear-gradient(160deg, #f6f7f9 0%, #e9ebef 55%, #dfe2e8 100%);
}

body.theme-light .data-table th {
  background: #f0f1f4;
  color: #4c4f57;
  border-bottom: 1px solid var(--border);
}

body.theme-light .login-box,
body.theme-light .modal-content,
body.theme-light .add-sips-section,
body.theme-light .supplier-item,
body.theme-light .sip-card {
  box-shadow: 0 1px 3px rgba(20, 24, 34, 0.07);
  outline: var(--outline);
  outline-offset: -1px;
}

body.theme-light .header,
body.theme-light .tabs {
  border-bottom-color: #cfd3da;
}

body.theme-light #managers-list li,
body.theme-light .supplier-table-group {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

/* Светлая тема: таблица в стиле Excel — белая, с сеткой по обеим осям */
body.theme-light .data-table {
  background: #ffffff;
}

body.theme-light .data-table th {
  background: #f3f4f6;
  color: #3a3d44;
  border-bottom: 2px solid #aeb4bd;
  border-right: 1px solid #cbd0d7;
}

body.theme-light .data-table td {
  border-bottom: 1px solid #c4c9d0;
  border-right: 1px solid #ced3da;
}

body.theme-light .data-table th:last-child,
body.theme-light .data-table td:last-child {
  border-right: none;
}

body.theme-light .table-wrap {
  border: 1px solid #c8ccd3;
  border-radius: 6px;
  background: #ffffff;
}

body.theme-light .data-table tbody tr:hover {
  background: #eef2f8;
}

/* Ячейки-контролы плоские, как в Excel: рамка появляется при наведении/фокусе */
body.theme-light .data-table tbody select {
  background: transparent;
  border-color: transparent;
  transition: border-color 0.12s ease, background 0.12s ease;
}

body.theme-light .data-table tbody select:hover {
  background: #ffffff;
  border-color: #c9cdd4;
}

body.theme-light .data-table tbody select:focus {
  background: #ffffff;
  border-color: var(--accent);
}

/* Светлая тема: статусы должны читаться сразу, особенно БЛОК */
body.theme-light .data-table tbody tr.status-working {
  background: transparent; /* без ментолового налёта — рабочий статус видно по зелёной полосе слева */
  border-left-color: var(--success);
}
body.theme-light .data-table tbody tr.status-block {
  background: rgba(220, 38, 38, 0.2) !important;
  border-left-color: var(--danger) !important;
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.42);
}
body.theme-light .data-table tbody tr.status-block .cell-sip-number {
  color: #b1272c;
}
body.theme-light .data-table tbody tr.status-no-balance {
  background: rgba(222, 168, 30, 0.22) !important;
  border-left-color: #c08c0e !important;
  box-shadow: inset 0 0 0 1px rgba(154, 111, 0, 0.35);
}
body.theme-light .data-table tbody tr.status-error {
  background: rgba(124, 77, 190, 0.15) !important;
  border-left-color: var(--error) !important;
  box-shadow: inset 0 0 0 1px rgba(124, 77, 190, 0.32);
}

/* Светлая: статусный select подчёркивает состояние рамкой (без неона) */
body.theme-light .data-table tr.status-block select[data-field="status"],
body.theme-light .sip-card.status-block select[data-field="status"] {
  border-color: #da373c;
  color: #b1272c;
  font-weight: 600;
}
body.theme-light .data-table tr.status-no-balance select[data-field="status"],
body.theme-light .sip-card.status-no-balance select[data-field="status"] {
  border-color: #c08c0e;
  color: #8a6400;
  font-weight: 600;
}
body.theme-light .data-table tr.status-error select[data-field="status"],
body.theme-light .sip-card.status-error select[data-field="status"] {
  border-color: var(--error);
  color: #6a3fa8;
  font-weight: 600;
}
body.theme-light .data-table tr.status-working select[data-field="status"] {
  border-color: rgba(26, 127, 66, 0.55);
}

body.theme-light .sip-card.status-block { background: rgba(218, 55, 60, 0.12); box-shadow: inset 0 0 0 1px rgba(218, 55, 60, 0.35); }
body.theme-light .sip-card.status-no-balance { background: rgba(222, 168, 30, 0.14); box-shadow: inset 0 0 0 1px rgba(154, 111, 0, 0.32); }
body.theme-light .sip-card.status-error { background: rgba(124, 77, 190, 0.1); box-shadow: inset 0 0 0 1px rgba(124, 77, 190, 0.3); }

/* Светлая: у select/input белый фон и чёткая рамка, а не серое на сером */
body.theme-light select,
body.theme-light input[type="text"],
body.theme-light input[type="password"],
body.theme-light textarea {
  background: #ffffff;
  border-color: #c9cdd4;
}

body.theme-light select:focus,
body.theme-light input[type="text"]:focus,
body.theme-light input[type="password"]:focus,
body.theme-light textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(71, 83, 216, 0.14);
}

body.theme-light .btn-secondary {
  background: #eef0f3;
  border: 1px solid #d7dae0;
  color: #33363d;
}

body.theme-light .btn-secondary:hover {
  background: #e3e6ea;
}

/* Светлая: гасим неоновые свечения статусных select'ов */
body.theme-light .data-table tr select[data-field="status"],
body.theme-light .sip-card select[data-field="status"] {
  box-shadow: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen.hidden {
  display: none;
}

/* ——— Вход ——— */
#login-screen {
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #17181b 0%, #1e1f22 55%, #232530 100%);
}

/* Живой фон: дрейфующие цветные пятна + дымка */
.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-blob {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  will-change: transform;
}

.login-blob-1 {
  background: radial-gradient(circle, rgba(88, 101, 242, 0.55), transparent 65%);
  top: -12vmax;
  left: -8vmax;
  animation: blob-drift-1 19s ease-in-out infinite alternate;
}

.login-blob-2 {
  background: radial-gradient(circle, rgba(0, 174, 239, 0.35), transparent 65%);
  bottom: -14vmax;
  right: -10vmax;
  animation: blob-drift-2 23s ease-in-out infinite alternate;
}

.login-blob-3 {
  background: radial-gradient(circle, rgba(124, 77, 190, 0.3), transparent 65%);
  top: 30%;
  left: 45%;
  width: 34vmax;
  height: 34vmax;
  animation: blob-drift-3 27s ease-in-out infinite alternate;
}

.login-fog {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse 60% 40% at 25% 70%, rgba(255, 255, 255, 0.05), transparent 70%),
    radial-gradient(ellipse 50% 35% at 75% 25%, rgba(255, 255, 255, 0.04), transparent 70%);
  filter: blur(28px);
  animation: fog-roll 34s ease-in-out infinite alternate;
}

@keyframes blob-drift-1 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(9vmax, 7vmax) scale(1.15); }
}

@keyframes blob-drift-2 {
  from { transform: translate(0, 0) scale(1.1); }
  to { transform: translate(-8vmax, -6vmax) scale(0.95); }
}

@keyframes blob-drift-3 {
  from { transform: translate(-4vmax, 2vmax) rotate(0deg); }
  to { transform: translate(5vmax, -4vmax) rotate(25deg); }
}

@keyframes fog-roll {
  from { transform: translate(-3%, -2%) scale(1); }
  to { transform: translate(3%, 2%) scale(1.08); }
}

.login-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 340px;
  padding: 2.25rem 2rem;
  background: rgba(43, 45, 49, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  animation: login-box-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

@keyframes login-box-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-title {
  margin: 0 0 1.5rem 0;
  font-size: 1.9rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.3em;
  text-indent: 0.3em; /* компенсирует letter-spacing последней буквы для центровки */
  color: var(--text);
}

body.theme-light #login-screen {
  background: linear-gradient(160deg, #f6f7f9 0%, #e9ebef 55%, #dfe2e8 100%);
}

body.theme-light .login-box {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(20, 24, 34, 0.1);
  box-shadow: 0 20px 60px rgba(20, 24, 34, 0.18);
}

body.theme-light .login-blob { opacity: 0.35; }
body.theme-light .login-fog { opacity: 0.5; }

@media (prefers-reduced-motion: reduce) {
  .login-blob, .login-fog, .login-title, .login-box {
    animation: none !important;
  }
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#login-form input {
  padding: 0.65rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
}

#login-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(108, 158, 248, 0.2);
}

#login-form button {
  margin-top: 0.25rem;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#login-form button:hover {
  background: var(--accent-hover);
}

.error-msg {
  margin: 0.75rem 0 0 0;
  font-size: 0.85rem;
  color: var(--danger);
  text-align: center;
  min-height: 1.2em;
}

/* ——— Шапка приложения ——— */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

/* Имя юзера — продолжение заголовка: тот же шрифт и размер, выделяется только цветом */
.user-badge {
  font-size: 1.25rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
}

.user-badge:empty {
  display: none;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
              transform 0.12s ease, box-shadow 0.15s ease;
}

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

.btn:active {
  transform: translateY(0);
}

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

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

.btn-secondary {
  color: var(--text);
  background: var(--surface-hover);
}

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

.btn-outline {
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
}

.btn-outline:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.btn-danger {
  color: #fff;
  background: var(--danger);
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

.btn-danger:hover {
  filter: brightness(1.1);
}

/* ——— Вкладки (ровное меню) ——— */
.tabs {
  display: flex;
  gap: 0;
  padding: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 0.75rem 0.5rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  text-align: center;
  min-width: 0;
  transition: color 0.15s ease, border-bottom-color 0.18s ease, background 0.15s ease;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ——— Панели вкладок ——— */
.tab-panel {
  display: none;
  flex: 1;
  padding: 1rem 1.5rem;
  overflow: auto;
}

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

/* ——— Вкладка «Добавить сипы» ——— */
.add-sips-section {
  max-width: 720px;
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.add-sips-section h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.add-sips-section .hint {
  margin: 0 0 0.75rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.add-sips-section .hint code {
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.form-row input[type="text"],
.form-row select {
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  min-width: 160px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-row input[type="text"]:focus,
.form-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.18);
}

.form-row select {
  cursor: pointer;
}

.add-sips-section textarea {
  width: 100%;
  min-height: 180px;
  padding: 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  resize: vertical;
}

.add-sips-section textarea:focus {
  border-color: var(--accent);
}

/* ——— Список поставщиков ——— */
.suppliers-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.suppliers-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* ——— Настройки (модалка) ——— */
.settings-group {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.settings-group:last-child {
  margin-bottom: 0;
}

.settings-group h3 {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
}

.setting-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.palette-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.55rem;
}

.palette-options label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
}

.palette-options input[type="radio"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.pal-swatch {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: inline-block;
  flex-shrink: 0;
}

.supplier-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
  animation: list-item-in 0.16s ease-out;
}

.supplier-item:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.supplier-name {
  font-weight: 600;
  font-size: 1rem;
}

.supplier-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.supplier-actions .btn {
  white-space: nowrap;
}

/* ——— Модалки: широкий контент и кнопки ——— */
/* Двойной класс — иначе перебивает базовый .modal-content { max-width: 420px } ниже по файлу */
.modal-content.modal-content-wide {
  max-width: min(94vw, 620px);
}

.modal-content.modal-content-edit-supplier {
  /* Окно само подстраивается: почти весь экран, на большом мониторе до 1040px */
  max-width: min(96vw, 1040px);
  width: 100%;
}

.modal-content-edit-supplier .edit-supplier-sips {
  overflow: auto; /* и вертикаль, и горизонталь на узких экранах */
  max-height: 55vh;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.modal-content-edit-supplier .modal-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-content-edit-supplier .modal-actions-end {
  flex-shrink: 0;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  gap: 0.5rem;
}

.modal-content-edit-supplier .edit-supplier-table {
  /* auto-layout: колонки сами подстраиваются под содержимое */
  width: 100%;
  min-width: 620px; /* на совсем узком экране — горизонтальный скролл вместо каши */
}

.modal-content-edit-supplier .edit-supplier-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  white-space: nowrap;
}

.modal-content-edit-supplier .edit-supplier-table input {
  width: 100%;
}

/* Номер — компактный, пароль и домен забирают всё остальное место */
.edit-supplier-table td:nth-child(1) { width: 7.5rem; }
.edit-supplier-table td:nth-child(4) { width: 6.5rem; }
.edit-supplier-table input[data-field="password"] { min-width: 16rem; }
.edit-supplier-table input[data-field="domain"] { min-width: 12rem; }

/* Пароль и домен — моноширинные, чтобы символы не сливались */
.edit-supplier-table input[data-field="password"],
.edit-supplier-table input[data-field="domain"] {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.85rem;
}

.modal-actions {
  margin-top: 1rem;
}

.modal-actions-end {
  display: flex;
  justify-content: flex-end;
}

.modal-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  margin-bottom: 0.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.modal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.18);
}

.modal-sip-check-info {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.modal-sip-check-row {
  margin-bottom: 0.75rem;
}
.modal-sip-check-row input {
  flex: 1;
  min-width: 180px;
}
.modal-sip-check-status {
  margin: 0.75rem 0 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.modal-sip-check-advanced {
  margin-top: 1rem;
  font-size: 0.9rem;
}
.modal-sip-check-advanced summary {
  cursor: pointer;
  color: var(--text-muted);
}
.modal-sip-check-advanced input {
  margin-top: 0.5rem;
}

.edit-supplier-sips {
  max-height: 50vh;
  overflow: auto;
  margin-bottom: 1rem;
}

.edit-supplier-table {
  font-size: 0.9rem;
}

.edit-supplier-table th,
.edit-supplier-table td {
  padding: 0.5rem 0.75rem;
}

.edit-supplier-table input {
  width: 100%;
  min-width: 80px;
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
}

.edit-supplier-table input:focus {
  border-color: var(--accent);
}

.edit-supplier-table .cell-actions {
  white-space: nowrap;
}

#modal-load-sips .modal-body textarea {
  width: 100%;
  min-height: 200px;
  padding: 0.75rem;
  font-size: 0.9rem;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#modal-load-sips .modal-body textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.18);
}

.modal-hint code {
  background: rgba(88, 101, 242, 0.12);
  color: var(--accent);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Список форматов в модалке загрузки сипов */
.modal-formats {
  list-style: none;
  margin: 0 0 1rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.modal-formats li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.modal-formats code {
  flex-shrink: 0;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.85rem;
  background: rgba(88, 101, 242, 0.14);
  color: var(--accent);
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
  white-space: nowrap;
}

body.theme-light .modal-formats code,
body.theme-light .modal-hint code {
  background: rgba(71, 83, 216, 0.1);
}

.modal-formats span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ——— Карточки (упрощенный режим) ——— */
.cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.sip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  border-left: 4px solid var(--border);
  transition: border-left-color 0.15s ease, background-color 0.15s ease;
}

.sip-card.status-working { border-left-color: var(--success); }
.sip-card.status-block { border-left-color: var(--danger); background: rgba(248, 81, 73, 0.12); box-shadow: inset 0 0 0 1px rgba(248, 81, 73, 0.2); }
.sip-card.status-no-balance { border-left-color: var(--warning); background: rgba(210, 153, 34, 0.12); box-shadow: inset 0 0 0 1px rgba(210, 153, 34, 0.25); }
.sip-card.status-error { border-left-color: var(--error); background: rgba(168, 85, 247, 0.12); box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.25); }

.sip-card.status-working select[data-field="status"] { border-color: var(--success); box-shadow: 0 0 8px rgba(63, 185, 80, 0.5); }
.sip-card.status-block select[data-field="status"] { border-color: #e02020; box-shadow: 0 0 8px rgba(224, 32, 32, 0.6); }
.sip-card.status-no-balance select[data-field="status"] { border-color: #e6a800; box-shadow: 0 0 8px rgba(230, 168, 0, 0.6); }
.sip-card.status-error select[data-field="status"] { border-color: #a855f7; box-shadow: 0 0 8px rgba(168, 85, 247, 0.6); }

.sip-card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.sip-card-title {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.sip-card-number {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.sip-card-supplier {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sip-card-actions {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.sip-card-header .btn-copy-card,
.sip-card-header .btn-bat-card {
  flex: 1 1 0;
  white-space: nowrap;
}

.sip-card-body .sip-card-line {
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}

.sip-card-body .sip-card-line-password,
.sip-card-body .sip-card-line-domain {
  opacity: 0.85;
}

#cards-container.hide-column-operator .sip-card-operator-row {
  display: none;
}

#cards-container.hide-column-password .sip-card-line-password {
  display: none;
}

#cards-container.hide-column-domain .sip-card-line-domain {
  display: none;
}

.sip-card-controls {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sip-card-control-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sip-card-control-row label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sip-card-control-row select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  min-height: 40px;
}

/* ——— Основной контент ——— */
.main {
  flex: 1;
  padding: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

/* Отступы даёт сама вкладка (.tab-panel) — тулбар и контент всегда на одной вертикали */
.toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0;
}

.filter-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-status label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.filter-status select {
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

/* ——— Таблица ——— */
#panel-table .table-wrap {
  margin: 0;
}

#panel-table .stats {
  margin: 1rem 0 0;
}

#panel-cards .cards-container {
  padding: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(0,0,0,0.2);
  white-space: nowrap;
}

.data-table .th-lamp {
  width: 40px;
  padding-left: 0.5rem;
  padding-right: 0.25rem;
}

/* Заголовок «●» — сортировка по цвету менеджера */
.data-table th.th-lamp.th-sort {
  text-align: center;
  padding-right: 0.25rem;
  font-size: 0.75rem;
}

.data-table th.th-lamp.th-sort.sort-asc::after,
.data-table th.th-lamp.th-sort.sort-desc::after {
  position: static;
  margin-left: 2px;
}

.data-table .th-sort {
  cursor: pointer;
  user-select: none;
  padding-right: 1.25rem;
  position: relative;
}

.data-table .th-sort:hover {
  color: var(--text);
}

.data-table .th-sort.sort-asc::after,
.data-table .th-sort.sort-desc::after {
  position: absolute;
  right: 0.35rem;
  font-size: 0.7rem;
  opacity: 0.8;
}

.data-table .th-sort.sort-asc::after {
  content: '▲';
}

.data-table .th-sort.sort-desc::after {
  content: '▼';
}

.data-table tbody tr {
  transition: background 0.13s ease;
  /* Постоянная ширина левой рамки — строки не «прыгают» при смене статуса */
  border-left: 5px solid transparent;
}

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

.data-table tbody tr.row-editing {
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 12px rgba(108, 158, 248, 0.35);
  outline: none;
  position: relative;
  z-index: 1;
}

.data-table tbody tr.row-just-edited {
  box-shadow: inset 0 0 0 2px var(--success), 0 0 10px rgba(63, 185, 80, 0.3);
  outline: none;
  position: relative;
  z-index: 1;
  animation: row-just-edited-fade 2s ease-out forwards;
}

@keyframes row-just-edited-fade {
  0% { box-shadow: inset 0 0 0 2px var(--success), 0 0 10px rgba(63, 185, 80, 0.3); }
  70% { box-shadow: inset 0 0 0 2px var(--success), 0 0 6px rgba(63, 185, 80, 0.2); }
  100% { box-shadow: none; }
}

.data-table tbody tr.status-working {
  border-left-color: var(--success);
  background: rgba(35, 165, 89, 0.06);
}

.data-table tbody tr.status-block {
  border-left-color: #e02020 !important;
  background: rgba(224, 32, 32, 0.25) !important;
  box-shadow: inset 0 0 0 1px rgba(224, 32, 32, 0.4);
}

.data-table tbody tr.status-no-balance {
  border-left-color: #e6a800 !important;
  background: rgba(230, 168, 0, 0.25) !important;
  box-shadow: inset 0 0 0 1px rgba(230, 168, 0, 0.4);
}

.data-table tbody tr.status-error {
  border-left-color: #a855f7 !important;
  background: rgba(168, 85, 247, 0.2) !important;
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.4);
}

.data-table .cell-lamp {
  width: 36px;
  padding: 0.45rem 0.35rem 0.45rem 0.55rem;
  vertical-align: middle;
  text-align: center;
}

.data-table .status-lamp,
.sip-card .status-lamp {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
}

.data-table .status-lamp.status-working,
.sip-card .status-lamp.status-working { background: var(--success); box-shadow: 0 0 6px rgba(35, 165, 89, 0.55); }
.data-table .status-lamp.status-block,
.sip-card .status-lamp.status-block { background: #e02020; box-shadow: 0 0 8px rgba(224, 32, 32, 0.55); }
.data-table .status-lamp.status-no-balance,
.sip-card .status-lamp.status-no-balance { background: #e6a800; box-shadow: 0 0 8px rgba(230, 168, 0, 0.5); }
.data-table .status-lamp.status-error,
.sip-card .status-lamp.status-error { background: #a855f7; box-shadow: 0 0 8px rgba(168, 85, 247, 0.5); }

/* Operator logos — fixed 22×22, brand marks (узнаваемые фигуры, не только буквы) */
.operator-logo,
.sip-card .operator-logo {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.12s ease;
}

.operator-logo:hover {
  transform: scale(1.15);
}

/* МегаФон: зелёный круг, белая "М" */
.operator-logo.op-mega {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='11' fill='%2300B956'/%3E%3Cpath d='M5.5 15.5V7l3 4.5L11 7l2.5 4.5 3-4.5v8.5h-2.4v-3.6l-1.8 2.7h-1.6l-1.8-2.7v3.6z' fill='white' opacity='0.95'/%3E%3C/svg%3E");
}
/* МТС: красный круг, белое «яйцо» */
.operator-logo.op-mts {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='11' fill='%23E30611'/%3E%3Cellipse cx='11' cy='12' rx='4.6' ry='6' fill='white'/%3E%3Cellipse cx='11' cy='12' rx='2.1' ry='3.4' fill='%23E30611'/%3E%3C/svg%3E");
}
/* Билайн: жёлтый круг с чёрными полосами */
.operator-logo.op-beeline {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cdefs%3E%3CclipPath id='c'%3E%3Ccircle cx='11' cy='11' r='11'/%3E%3C/clipPath%3E%3C/defs%3E%3Ccircle cx='11' cy='11' r='11' fill='%23FFC800'/%3E%3Cg clip-path='url(%23c)' stroke='%23111' stroke-width='2.6'%3E%3Cline x1='-2' y1='6' x2='24' y2='2'/%3E%3Cline x1='-2' y1='13' x2='24' y2='9'/%3E%3Cline x1='-2' y1='20' x2='24' y2='16'/%3E%3Cline x1='-2' y1='27' x2='24' y2='23'/%3E%3C/g%3E%3C/svg%3E");
}
/* Газпром: синий круг, белый огонёк */
.operator-logo.op-gazprom {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='11' fill='%230079C2'/%3E%3Cpath d='M11 4.5c1.2 2.6 4 4.2 4 7.3A4 4 0 0 1 11 16a4 4 0 0 1-4-4.2c0-3.1 2.8-4.7 4-7.3z' fill='white'/%3E%3Cpath d='M11 9.5c.6 1.3 1.9 2.1 1.9 3.5a1.9 1.9 0 1 1-3.8 0c0-1.4 1.3-2.2 1.9-3.5z' fill='%230079C2'/%3E%3C/svg%3E");
}
/* Т2: чёрный круг, белое "t2" */
.operator-logo.op-t2 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='11' fill='%23141414'/%3E%3Ctext x='11' y='15' text-anchor='middle' font-family='Arial,sans-serif' font-size='9.5' font-weight='800' fill='white'%3Et2%3C/text%3E%3C/svg%3E");
}
/* Йота: голубой круг, белая "Y" с точкой */
.operator-logo.op-yota {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='11' fill='%2300AEEF'/%3E%3Cpath d='M6.5 5.5l4.5 6v5h2v-5l4.5-6h-2.7L11.5 10 8.2 5.5z' fill='white' transform='translate(-0.7 0)'/%3E%3C/svg%3E");
}
/* Т-Мобайл: маджента, белая "T" */
.operator-logo.op-tmobile {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='11' fill='%23E20074'/%3E%3Cpath d='M5.5 6h11v3.4h-1.6V8h-2.3v8.3h1.7V18H7.7v-1.7h1.7V8H7.1v1.4H5.5z' fill='white'/%3E%3C/svg%3E");
}
/* ВТБ Мобайл: тёмно-синий круг, три наклонные полосы */
.operator-logo.op-vtb {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='11' fill='%23002882'/%3E%3Cpath d='M7 6.2h9.5l-1 2.2H6z' fill='%2300AAFF'/%3E%3Cpath d='M6.3 9.9h9.5l-1 2.2H5.3z' fill='white'/%3E%3Cpath d='M5.6 13.6h9.5l-1 2.2H4.6z' fill='white'/%3E%3C/svg%3E");
}
/* Мотив: оранжевый круг, белая «м» */
.operator-logo.op-motiv {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='11' fill='%23FF5A00'/%3E%3Ctext x='11' y='15.3' text-anchor='middle' font-family='Arial,sans-serif' font-size='13' font-weight='800' fill='white'%3E%D0%BC%3C/text%3E%3C/svg%3E");
}
/* Сбер Мобайл: зелёный круг, белая галочка в кольце */
.operator-logo.op-sber {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='11' fill='%2321A038'/%3E%3Ccircle cx='11' cy='11' r='6.3' fill='none' stroke='white' stroke-width='1.6'/%3E%3Cpath d='M8.2 11.1l2.1 2.1 4.8-4.9' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* НМК: бирюзовый круг, белое «НМК» */
.operator-logo.op-nmk {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='11' fill='%23007C89'/%3E%3Ctext x='11' y='13.4' text-anchor='middle' font-family='Arial,sans-serif' font-size='6.4' font-weight='800' fill='white'%3E%D0%9D%D0%9C%D0%9A%3C/text%3E%3C/svg%3E");
}

.operator-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 0.35rem;
  flex-shrink: 0;
}

.data-table .cell-readonly {
  color: var(--text);
}

.data-table .cell-sip-number {
  font-weight: 700;
  color: var(--text);
}

.data-table .cell-password,
.data-table .cell-domain {
  color: var(--text-muted);
  opacity: 0.9;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table .cell-copyable {
  cursor: pointer;
}

.data-table select {
  max-width: 100%;
}

.data-table.hide-column-password .th-password,
.data-table.hide-column-password .cell-password {
  display: none;
}

.data-table.hide-column-domain .th-domain,
.data-table.hide-column-domain .cell-domain {
  display: none;
}

.data-table.hide-column-operator .th-operator,
.data-table.hide-column-operator .cell-operator {
  display: none;
}

.data-table tr.status-working select[data-field="status"] { border-color: var(--success); box-shadow: 0 0 8px rgba(63, 185, 80, 0.5); }
.data-table tr.status-block select[data-field="status"] { border-color: #e02020; box-shadow: 0 0 8px rgba(224, 32, 32, 0.6); }
.data-table tr.status-no-balance select[data-field="status"] { border-color: #e6a800; box-shadow: 0 0 8px rgba(230, 168, 0, 0.6); }
.data-table tr.status-error select[data-field="status"] { border-color: #a855f7; box-shadow: 0 0 8px rgba(168, 85, 247, 0.6); }

.column-toggles {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-toggle-column {
  font-size: 0.85rem;
}

.btn-toggle-column.column-hidden {
  opacity: 0.7;
}

.data-table select {
  width: 100%;
  min-width: 100px;
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
}

.data-table select:focus {
  border-color: var(--accent);
}

.data-table select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.5rem;
}

.data-table .cell-actions {
  width: 1%;
  white-space: nowrap;
}
.data-table .cell-actions .btn {
  margin-right: 0.25rem;
}

/* ——— Статистика ——— */
.stats {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.stats span {
  white-space: nowrap;
}

#stat-working { color: var(--success); }
#stat-block { color: var(--danger); }
#stat-no-balance { color: var(--warning); }
#stat-error { color: var(--error); }

/* ——— Модальное окно ——— */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: modal-backdrop-in 0.15s ease-out;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  animation: modal-pop-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

@keyframes modal-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-pop-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .modal, .modal-content, .btn, .operator-logo {
    animation: none !important;
    transition: none !important;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 4px;
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.modal-body {
  padding: 1.25rem;
}

.modal-hint {
  margin: 0 0 1rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

#managers-list {
  list-style: none;
  margin: 0 0 1rem 0;
  padding: 0;
}

#managers-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  margin-bottom: 0.4rem;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
  animation: list-item-in 0.16s ease-out;
}

#managers-list li:hover {
  background: var(--surface-hover);
  transform: translateX(2px);
}

@keyframes list-item-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

#managers-list li span {
  font-size: 0.95rem;
}

.manager-reserve-badge {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: normal;
  margin-left: 0.35rem;
}

.add-manager {
  display: flex;
  gap: 0.5rem;
}

.add-manager input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
}

.add-manager input {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.add-manager input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.18);
}

/* ——— Вкладка «Таблица поставщиков» ——— */
.supplier-tables-container {
  padding: 0;
}

.supplier-table-group {
  margin-bottom: 1.5rem;
}

.supplier-table-header h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.supplier-table-count {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.supplier-data-table {
  table-layout: fixed;
}

.supplier-data-table .th-lamp { width: 40px; }
.supplier-data-table th:nth-child(2) { width: 13%; }
.supplier-data-table th:nth-child(3) { width: 13%; }
.supplier-data-table th:nth-child(4) { width: 14%; }
.supplier-data-table th:nth-child(5) { width: 14%; }
.supplier-data-table th:nth-child(6) { width: 12%; }
.supplier-data-table th:nth-child(7) { width: 12%; }
.supplier-data-table th:nth-child(8) { width: 11%; }
.supplier-data-table th:nth-child(9) { width: auto; }

.supplier-data-table select {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.supplier-data-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#supplier-tables-container.hide-column-password .th-password,
#supplier-tables-container.hide-column-password .cell-password {
  display: none;
}

#supplier-tables-container.hide-column-domain .th-domain,
#supplier-tables-container.hide-column-domain .cell-domain {
  display: none;
}

#supplier-tables-container.hide-column-operator .th-operator,
#supplier-tables-container.hide-column-operator .cell-operator {
  display: none;
}

.cell-status-time {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ——— Страничное уведомление (toast) ——— */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  z-index: 1000;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: calc(100vw - 2rem);
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(0.5rem);
  pointer-events: none;
}

.toast-success {
  background: var(--success);
  color: #fff;
}

.toast-error {
  background: var(--danger);
  color: #fff;
}

.toast-info {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ——— Адаптив: планшеты и телефоны, PWA на iPhone ——— */
body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

@media (max-width: 768px) {
  .header {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
  }

  .header h1 {
    font-size: 1.1rem;
    flex: 1;
    min-width: 0;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .header-actions .btn {
    min-height: 44px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  .tabs {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .tab {
    padding: 0.85rem 0.35rem;
    font-size: 0.8rem;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .tab-panel {
    padding: 1rem;
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  .add-sips-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    max-width: none;
  }

  .add-sips-section h2 {
    font-size: 1rem;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .form-row input[type="text"],
  .form-row select {
    min-width: 0;
    min-height: 44px;
  }

  .add-sips-section textarea {
    min-height: 140px;
  }

  .supplier-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .supplier-actions {
    flex-direction: column;
  }

  .supplier-actions .btn {
    min-height: 44px;
    justify-content: center;
  }

  .cards-container {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0;
  }

  .sip-card {
    padding: 1rem;
  }

  .sip-card-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .sip-card-controls select {
    min-height: 44px;
    min-width: 0;
    width: 100%;
  }

  .sip-card-header .btn-copy-card,
  .sip-card-header .btn-bat-card {
    min-height: 44px;
  }

  .toolbar {
    flex-wrap: wrap;
    padding: 0;
  }

  .filter-status select {
    min-height: 44px;
    min-width: 0;
  }

  #panel-table .table-wrap {
    margin: 0;
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }

  .data-table {
    font-size: 0.85rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem 0.6rem;
  }

  .data-table .cell-actions .btn {
    min-height: 40px;
    padding: 0.5rem 0.75rem;
  }

  #panel-table .stats {
    margin: 1rem 0 0;
    flex-direction: column;
    gap: 0.5rem;
  }

  .modal-content {
    max-width: calc(100vw - 2rem);
    max-height: min(90vh, calc(100dvh - 2rem));
    margin: 1rem;
  }

  .modal-content-wide,
  .modal-content-edit-supplier {
    max-width: calc(100vw - 2rem);
  }

  .modal-body {
    padding: 1rem;
  }

  .btn {
    min-height: 44px;
    padding: 0.6rem 1rem;
  }

  .btn-danger {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
  }

  .modal-actions-end {
    flex-direction: column;
  }

  .modal-actions-end .btn {
    width: 100%;
  }

  .login-box {
    margin: 1rem;
    margin-left: calc(1rem + env(safe-area-inset-left));
    margin-right: calc(1rem + env(safe-area-inset-right));
  }
}

@media (max-width: 480px) {
  .tab {
    font-size: 0.75rem;
    padding: 0.75rem 0.25rem;
  }

  .header h1 {
    font-size: 1rem;
  }
}
