:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --surface: #141925;
  --surface-2: #1a2030;
  --border: #2a3245;
  --text: #f4f6fb;
  --muted: #97a1b5;
  --accent: #7c83ff;
  --green: #45d49a;
  --amber: #f1b75a;
  --red: #ff6b7a;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, ui-sans-serif, system-ui, sans-serif; }
a { color: #aeb3ff; }
button, input, select, textarea { font: inherit; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 236px; display: flex; flex-direction: column; padding: 24px 16px; background: #10141e; border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 6px; padding: 0 12px 24px; color: var(--text); font-size: 22px; font-weight: 800; text-decoration: none; }
.brand-badge { font-size: 11px; background: #22c55e; color: #000; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.sidebar nav { display: grid; gap: 2px; }
.sidebar nav a { padding: 7px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; }
.sidebar nav a:hover, .sidebar nav a.active { background: var(--surface-2); color: var(--text); }
.nav-section { margin: 10px 12px 2px; color: #68748c; font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.sidebar nav { overflow-y: auto; }
.user { margin-top: auto; display: grid; padding: 12px; border-top: 1px solid var(--border); }
.user a { margin-top: 6px; font-size: 12px; }
.user small, .eyebrow, .panel-heading span, time { color: var(--muted); }
.main { margin-left: 236px; padding: 32px clamp(20px, 4vw, 56px) 64px; }
.public-main { max-width: 1180px; margin: 0 auto; padding: 48px 28px; }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-header h1 { margin: 2px 0 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card, .panel { background: linear-gradient(145deg, var(--surface), #111722); border: 1px solid var(--border); border-radius: 16px; }
.kpi-card { display: grid; gap: 6px; min-height: 142px; padding: 20px; }
.kpi-card span, .kpi-card small { color: var(--muted); }
.kpi-card strong { font-size: clamp(26px, 3vw, 38px); line-height: 1; letter-spacing: -.035em; }
.kpi-card.accent strong { color: var(--green); }
.kpi-card.warning strong { color: var(--amber); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.panel { padding: 22px; }
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-heading h2 { margin: 0; font-size: 17px; }
.metrics-list { display: grid; gap: 0; margin: 0; }
.metrics-list div { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.metrics-list div:last-child { border: 0; }
.metrics-list dt { color: var(--muted); }
.metrics-list dd { margin: 0; font-weight: 700; }
.table-panel { margin-top: 14px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.status { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); }
.empty { color: var(--muted); text-align: center; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 14px; }
.filters label, .login-card label { display: grid; gap: 6px; min-width: 150px; color: var(--muted); font-size: 12px; font-weight: 650; }
.filters .wide { flex: 1 1 320px; }
input, select, textarea { width: 100%; min-height: 40px; padding: 8px 10px; color: var(--text); background: #0e131d; border: 1px solid var(--border); border-radius: 8px; }
textarea { min-height: 86px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 13px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #4a5672; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.danger, .danger { color: #ffd4d9; border-color: #77313b; background: #351820; }
.btn.small { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: wait; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.actions form { display: inline-flex; }
.compact { width: 82px; min-height: 34px; }
.text-cell { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 12px 0; color: var(--muted); }
.pagination div { display: flex; gap: 8px; }
.cards { display: grid; gap: 14px; }
.message-card { max-width: 980px; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
pre { overflow: auto; padding: 16px; background: #0a0e15; border: 1px solid var(--border); border-radius: 10px; white-space: pre-wrap; }
.stats, .bulk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bulk-actions { padding: 16px 12px 0; }
.bulk-actions select { width: auto; }
details > summary { cursor: pointer; font-weight: 700; }
details[open] > summary { margin-bottom: 18px; }
.qr-panel { max-width: 620px; text-align: center; }
.qr-image { width: min(100%, 520px); padding: 12px; background: white; border-radius: 12px; }
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-card { display: grid; gap: 18px; width: min(100%, 430px); padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }
.login-card h1 { margin: 0; font-size: 36px; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.notice.danger { background: #351820; }
.error-page { display: grid; place-content: center; min-height: 100vh; text-align: center; }
.error-page h1 { margin: 0; font-size: 96px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
@media (max-width: 950px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .split { grid-template-columns: 1fr; } }
@media (max-width: 680px) { .sidebar { position: static; width: auto; } .sidebar nav { grid-template-columns: repeat(2, 1fr); } .nav-section { grid-column: 1 / -1; } .user { display: none; } .main { margin: 0; padding: 24px 16px 48px; } .page-header { align-items: start; flex-direction: column; } .kpi-grid { grid-template-columns: 1fr; } .pagination { align-items: start; flex-direction: column; } }

/* --- OVERVIEW MODULE V2 --- */
.sidebar nav { flex: 1; min-height: 0; }

.activity-chart {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 160px;
  padding: 0 2px;
}
.activity-bar {
  flex: 1;
  min-width: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  opacity: .72;
  transition: opacity .15s;
}
.activity-bar:hover { opacity: 1; }
.activity-height-1 { height: 5%; }
.activity-height-2 { height: 10%; }
.activity-height-3 { height: 15%; }
.activity-height-4 { height: 20%; }
.activity-height-5 { height: 25%; }
.activity-height-6 { height: 30%; }
.activity-height-7 { height: 35%; }
.activity-height-8 { height: 40%; }
.activity-height-9 { height: 45%; }
.activity-height-10 { height: 50%; }
.activity-height-11 { height: 55%; }
.activity-height-12 { height: 60%; }
.activity-height-13 { height: 65%; }
.activity-height-14 { height: 70%; }
.activity-height-15 { height: 75%; }
.activity-height-16 { height: 80%; }
.activity-height-17 { height: 85%; }
.activity-height-18 { height: 90%; }
.activity-height-19 { height: 95%; }
.activity-height-20 { height: 100%; }
.activity-axis {
  display: flex;
  justify-content: space-between;
  padding-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.cat-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
}
.cat-dot.cat-extremism { background: var(--red); }
.cat-dot.cat-fake { background: var(--amber); }
.cat-dot.cat-spam { background: #64748b; }
.cat-dot.cat-ads { background: #9ca3af; }
.cat-dot.cat-normal { background: var(--green); }
.cat-dot.cat-unknown { background: var(--border); }

.overview-table-panel { margin-top: 0; }
.overview-alerts { display: grid; }
.overview-alert-card { padding: 12px 0; border-bottom: 1px solid var(--border); }
.overview-alert-card:first-child { padding-top: 0; }
.overview-alert-card:last-child { padding-bottom: 0; border-bottom: 0; }
.overview-alert-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.overview-alert-time { color: var(--muted); font-size: 11px; }
.overview-alert-group { margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.overview-alert-text {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.cat-bg-extremism { background: #451520; color: var(--red); }
.cat-bg-fake { background: #3d2e10; color: var(--amber); }
.cat-bg-spam, .cat-bg-ads { background: var(--surface-2); color: var(--muted); }
.cat-bg-normal { background: #132e20; color: var(--green); }
.cat-bg-unknown { background: var(--surface-2); color: var(--muted); }
/* --- END OVERVIEW MODULE V2 --- */

/* BEGIN AUTOJOIN CARDS AUDIT V2 */
/* Все селекторы имеют префикс autojoin: это исключает конфликт с глобальным .compact. */
.autojoin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.autojoin-stat-card {
  min-width: 0;
  padding: 12px 14px;
  background: linear-gradient(145deg, var(--surface), #111722);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.autojoin-stat-card .label { color: var(--muted); font-size: 11px; font-weight: 700; }
.autojoin-stat-card .value { margin-top: 3px; font-size: 20px; font-weight: 800; }
.autojoin-stat-card .value.is-accent { color: var(--accent); }
.autojoin-stat-card .value.is-danger { color: var(--red); }

.autojoin-section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 10px;
}

.autojoin-section-heading:first-of-type { margin-top: 0; }
.autojoin-section-heading h3 { margin: 0; font-size: 14px; }
.autojoin-section-heading span { color: var(--muted); font-size: 12px; }
.autojoin-section-heading.is-attention h3 { color: var(--amber); }

.autojoin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.autojoin-card {
  min-width: 0;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.autojoin-card.is-attention { border-color: color-mix(in srgb, var(--amber) 55%, var(--border)); }
.autojoin-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.autojoin-card-name { overflow-wrap: anywhere; font-size: 14px; font-weight: 700; }
.autojoin-card-phone, .autojoin-card-auth { margin-top: 2px; color: var(--muted); font-size: 11px; }
.autojoin-card-auth strong { color: var(--text); font-weight: 650; }
.autojoin-card-metric { margin-bottom: 10px; }
.autojoin-card-metric-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 4px; font-size: 11px; }

.autojoin-status {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #273044;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.autojoin-status.is-active { background: #143a2c; color: #b9f6dc; }
.autojoin-status.is-throttled { background: #4b2b14; color: #ffdda7; }
.autojoin-status.is-error { background: #4b1f28; color: #ffd1d7; }
.autojoin-status.is-inactive, .autojoin-status.is-pending { background: #273044; color: #c7d0e2; }

/* Native progress передаёт динамическое значение атрибутами value/max без inline CSS. */
.autojoin-progress {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 999px;
  background: #0f1520;
}

.autojoin-progress::-webkit-progress-bar { background: #0f1520; border-radius: 999px; }
.autojoin-progress::-webkit-progress-value { background: var(--green); border-radius: 999px; transition: inline-size .2s ease; }
.autojoin-progress::-moz-progress-bar { background: var(--green); border-radius: 999px; transition: inline-size .2s ease; }
.autojoin-progress.is-warning::-webkit-progress-value { background: var(--amber); }
.autojoin-progress.is-warning::-moz-progress-bar { background: var(--amber); }
.autojoin-progress.is-danger::-webkit-progress-value { background: var(--red); }
.autojoin-progress.is-danger::-moz-progress-bar { background: var(--red); }
.autojoin-progress.is-accent::-webkit-progress-value { background: var(--accent); }
.autojoin-progress.is-accent::-moz-progress-bar { background: var(--accent); }

.autojoin-throttle {
  display: flex;
  align-items: end;
  gap: 8px;
  padding-top: 4px;
}

.autojoin-throttle label { flex: 1 1 auto; color: var(--muted); font-size: 11px; }
.autojoin-limit-input { min-height: 32px; margin-top: 4px; }
.autojoin-card-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; font-size: 11px; }

@media (max-width: 560px) {
  .autojoin-grid { grid-template-columns: 1fr; }
  .autojoin-card-footer { align-items: stretch; flex-direction: column; }
  .autojoin-card-footer form, .autojoin-card-footer .btn { width: 100%; }
}
/* END AUTOJOIN CARDS AUDIT V2 */

/* BEGIN OVERVIEW CHARTS AUDIT v1 */
.chart-container { position: relative; height: 220px; margin: 8px 0; }
.overview-activity-panel { flex: 2 1 0; min-width: 0; }
.overview-categories-panel { flex: 1 1 0; min-width: 280px; }
.overview-alert-triggers { font-size: 11px; color: #f59e0b; margin-top: 4px; }
.overview-alert-details { display: inline-block; margin-top: 4px; font-size: 12px; color: #818cf8; }
.badge-platform { padding: 2px 6px; border-radius: 4px; background: #312e81; color: #a5b4fc; font-size: 10px; font-weight: 600; text-transform: uppercase; }
@media (max-width: 760px) {
  .overview-activity-panel,
  .overview-categories-panel { flex-basis: 100%; min-width: 0; }
}
/* END OVERVIEW CHARTS AUDIT v1 */
