/* ============================================================
   Avito Anti-Cancel — админ-панель
   Тёмный рейл + светлая рабочая область, синий «защитный» сигнал.
   Стиль по образцу SmsSender (4.Claude/SmsSender/frontend/src/styles.css).
   ============================================================ */

:root {
  --ink: #16202b;
  --ink-soft: #243341;
  --graphite: #5b6b7b;
  --paper: #e8edf1;
  --panel: #ffffff;
  --panel-2: #f4f7f9;
  --line: #d4dce4;
  --line-soft: #e6ebef;

  --accent: #1f6fb0;
  --accent-deep: #185a8f;
  --accent-glow: rgba(31, 111, 176, 0.16);
  --green: #0a7a52;
  --amber: #b06a12;
  --alert: #c23a2b;

  --rail-text: #c2cdd8;
  --rail-dim: #7c8b99;

  --display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(22, 32, 43, 0.05), 0 8px 24px rgba(22, 32, 43, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--body);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; }
.mono { font-family: var(--mono); }

/* ============================================================
   Каркас: рейл + рабочая область
   ============================================================ */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

.rail {
  background: var(--ink);
  color: var(--rail-text);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent);
  display: grid; place-items: center;
  flex: none;
  box-shadow: 0 0 0 4px var(--accent-glow);
}
.brand-mark span { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.brand-mark i { width: 3px; background: #fff; border-radius: 1px; }
.brand-mark i:nth-child(1) { height: 5px; }
.brand-mark i:nth-child(2) { height: 9px; }
.brand-mark i:nth-child(3) { height: 14px; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 16px; color: #fff; }
.brand-sub { font-size: 10px; color: var(--rail-dim); letter-spacing: 0.08em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.tab-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: none; border: none;
  color: var(--rail-text);
  font-family: var(--body); font-size: 14px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.tab-btn:hover { background: var(--ink-soft); color: #fff; }
.tab-btn.active { background: var(--ink-soft); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }

.rail-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }

.diag-chip {
  font-size: 11px;
  font-family: var(--mono);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--ink-soft);
  color: var(--rail-text);
  line-height: 1.4;
  word-break: break-word;
}

.btn-logout {
  padding: 8px 12px;
  border: 1px solid #3a4856;
  background: none;
  color: var(--rail-text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--body);
}
.btn-logout:hover { background: var(--ink-soft); color: #fff; }

/* ============================================================
   Рабочая область
   ============================================================ */
.main { padding: 26px 30px 60px; min-width: 0; }
.tab { display: none; }
.tab.active { display: block; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.card h4 { margin: 18px 0 8px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--graphite); }
.hint { font-size: 13px; color: var(--graphite); margin: 0 0 14px; }

/* ============================================================
   Формы / поля
   ============================================================ */
label { display: block; font-size: 12px; font-weight: 500; color: var(--graphite); margin: 12px 0 5px; letter-spacing: 0.01em; }
input, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--body);
  color: var(--ink);
  background: #fff;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filters { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 14px; flex-wrap: wrap; }
.filters > div { flex: 1; min-width: 150px; }

/* ============================================================
   Кнопки
   ============================================================ */
button.primary, button.secondary {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--body);
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s, transform 0.04s;
}
button.primary:active, button.secondary:active { transform: translateY(1px); }

button.primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  margin-top: 14px;
}
button.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

button.secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}
button.secondary:hover { background: var(--panel-2); border-color: #c2ccd5; }

/* ============================================================
   Таблицы
   ============================================================ */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; vertical-align: middle; }
thead th {
  background: var(--panel-2);
  font-family: var(--display);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--graphite);
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
tbody tr { border-top: 1px solid var(--line-soft); }
tbody tr:first-child { border-top: none; }
tbody tr:hover { background: var(--panel-2); }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }

/* ============================================================
   Бейджи статусов блокировки
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.BLOCKED   { background: #fbf1e3; color: var(--amber); border-color: #f0dcbf; }
.badge.RELEASED  { background: #e3f4ec; color: var(--green); border-color: #bfe6d4; }
.badge.FAILED    { background: #fbe9e6; color: var(--alert); border-color: #f1cac3; }

/* ============================================================
   Статистика (вкладка Журнал)
   ============================================================ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat .l { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--graphite); }
.stat .v { font-family: var(--display); font-size: 26px; font-weight: 600; margin-top: 4px; letter-spacing: -0.02em; }

/* ============================================================
   Сообщения статуса формы
   ============================================================ */
.msg { font-size: 13px; color: var(--graphite); margin-top: 8px; min-height: 16px; }

/* ============================================================
   Экран входа
   ============================================================ */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(900px 500px at 50% -10%, #1d2a36 0%, var(--ink) 55%);
}
.login-card {
  max-width: 360px;
  width: 100%;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(22, 32, 43, 0.3);
  padding: 30px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-title { font-size: 19px; margin: 0; font-weight: 600; }
.login-card input { margin-bottom: 12px; }
.login-card button.primary { width: 100%; margin-top: 4px; }
#err { color: var(--alert); font-size: 13px; margin-bottom: 8px; display: none; }

/* ============================================================
   Адаптив
   ============================================================ */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
  .brand { padding: 0 10px 0 4px; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .tab-btn.active { box-shadow: inset 0 -3px 0 var(--accent); }
  .rail-foot { margin: 0; flex-direction: row; align-items: center; padding: 0; }
  .main { padding: 18px 16px 50px; }
}
