:root {
  --ru-white: #ffffff;
  --ru-blue: #0039a6;
  --ru-red: #d52b1e;
  --ink: #172033;
  --muted: #667085;
  --line: #e6eaf2;
  --surface: rgba(255, 255, 255, 0.60);
  --shadow: 0 24px 70px rgba(0, 57, 166, 0.16);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--ink);
  background: #f7f9fc;
}

/* Полупрозрачный фон-картинка с лёгкой "дышащей" анимацией. Лежит за контентом. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url('/assets/bg.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0.8;
  transform-origin: center center;
  animation: bgFloat 18s ease-in-out infinite alternate;
  pointer-events: none;
}

/* Лёгкая вуаль поверх картинки — улучшает читаемость текста, оставаясь полупрозрачной. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,.10) 45%, rgba(247,249,252,.20) 100%);
  pointer-events: none;
}

@keyframes bgFloat {
  0%   { transform: scale(1.00) translate3d(0, 0, 0); }
  50%  { transform: scale(1.03) translate3d(-0.6%, -0.4%, 0); }
  100% { transform: scale(1.05) translate3d(0.4%, 0.6%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

a { color: var(--ru-blue); font-weight: 600; text-decoration: none; }
a:hover { color: var(--ru-red); text-decoration: underline; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 32px 16px; }

.card {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.60);
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 22px;
  padding: 28px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--ru-white) 0 33.33%, var(--ru-blue) 33.33% 66.66%, var(--ru-red) 66.66% 100%);
}

h1, h2, h3 { margin-top: 0; color: #101828; }
h1 { font-size: clamp(26px, 4vw, 40px); line-height: 1.12; margin-bottom: 8px; }
h2 { font-size: 22px; margin-bottom: 12px; }
p { color: var(--muted); line-height: 1.6; margin-top: 0; }

/* Hero layout */
.hero { display: grid; grid-template-columns: 1.3fr .7fr; gap: 28px; align-items: center; }
.hero-content { }
.hero-side { text-align: center; }

.badge { display: inline-flex; gap: 8px; align-items: center; padding: 6px 14px; border-radius: 999px; background: rgba(0,57,166,.08); color: var(--ru-blue); font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }

/* Buttons */
.button, button {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 12px 20px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--ru-blue), #0d57db);
  box-shadow: 0 8px 20px rgba(0,57,166,.22);
  font-weight: 700;
  font-size: 14px;
  transition: filter .15s, transform .1s;
}
.button.secondary, button.secondary { background: linear-gradient(135deg, var(--ru-red), #f04438); box-shadow: 0 8px 20px rgba(213,43,30,.18); }
button:hover, .button:hover { filter: brightness(1.06); transform: translateY(-1px); text-decoration: none; color: #fff; }
button:active, .button:active { transform: translateY(0); }

.btn-danger {
  background: transparent;
  color: var(--ru-red);
  border: 1px solid var(--ru-red);
  box-shadow: none;
  padding: 6px 12px;
  font-size: 16px;
}
.btn-danger:hover { background: rgba(213,43,30,.08); }

/* Inputs */
input[type="text"], input[type="password"], input[type="file"], input[type="url"], input:not([type]):not([role]) {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
  transition: border-color .15s;
}
input:focus { outline: none; border-color: var(--ru-blue); box-shadow: 0 0 0 3px rgba(0,57,166,.1); }

label { display: block; font-size: 13px; font-weight: 600; color: #344054; margin-bottom: 4px; }
.required { color: var(--ru-red); }

/* Form grid */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-field { display: flex; flex-direction: column; }

code { padding: 2px 6px; border-radius: 7px; background: #eef2ff; color: var(--ru-blue); font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ok { color: #067647; font-weight: 700; }
.bad { color: #b42318; font-weight: 700; }

/* Admin header */
.admin-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.admin-stats { font-size: 14px; color: var(--muted); margin: 4px 0 0; }

/* Group list (user side) */
.group-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.group-list li {
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 16px;
  background: rgba(255,255,255,0.60);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.group-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.task-link-copy { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-link-copy .badge { margin-bottom: 0; padding: 4px 10px; font-size: 12px; }
.task-link-copy span:not(.badge) { color: var(--muted); line-height: 1.45; }
.group-link { font-size: 13px; color: var(--ru-blue); font-weight: 600; }
.group-link:hover { color: var(--ru-red); }

.status { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.status.yes { background: #ecfdf3; color: #067647; }
.status.no { background: #fef3f2; color: #b42318; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 14px; text-align: left; vertical-align: middle; }
th { color: #344054; background: #f8fafc; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .3px; }
tr:last-child td { border-bottom: 0; }
.status-pending { color: #9a6b00; font-weight: 700; }
.status-processing { color: var(--ru-blue); font-weight: 700; }
.status-done { color: #067647; font-weight: 700; }
.status-failed { color: #b42318; font-weight: 700; }

/* Footer */
.footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.footer .logo-wrap { position: relative; display: inline-block; overflow: hidden; border-radius: 6px; }
.footer img.logo { display:block; height: 16px; width: auto; max-width: 60px; object-fit: contain; }
.footer .logo-wrap::after {
  content: "";
  position: absolute; top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,0) 30%, rgba(255,255,255,0.85) 50%, rgba(255,255,255,0) 70%, transparent 100%);
  transform: skewX(-20deg);
  animation: logoShine 3.5s ease-in-out infinite;
  pointer-events: none;
  mix-blend-mode: screen;
}
@keyframes logoShine {
  0%   { left: -120%; }
  60%  { left: 130%; }
  100% { left: 130%; }
}
.footer img.qr { height: 104px; width: 104px; border-radius: 16px; background: #fff; object-fit: cover; border: 1px solid var(--line); box-shadow: 0 10px 24px rgba(23, 32, 51, 0.08); }
.footer-tag { display:block; font-size:11px; color: var(--muted); margin-top:4px; letter-spacing:.4px; }

/* Responsive */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .hero-side { display: none; }
  .wrap { padding-top: 18px; }
  .card { padding: 20px; border-radius: 18px; }
  .footer { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-header { flex-direction: column; }
}

/* ==========================================================================
   Unified Admin UI (topbar, KPI, charts, sections)
   ========================================================================== */

.admin-body { padding-top: 0; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.60);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border-bottom: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 4px 20px rgba(16,24,40,.08);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto;
  padding: 14px 24px;
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 24px; align-items: center;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--ru-blue), #0d57db);
  color: #fff;
  box-shadow: 0 8px 22px rgba(0,57,166,.28);
}
.brand-title { font-weight: 800; font-size: 16px; color: var(--ink); letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.tabs { display: flex; gap: 8px; justify-content: center; }
.tab {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: 14px;
  color: var(--ink); text-decoration: none;
  border: 1px solid transparent;
  transition: all .15s ease;
}
.tab:hover { background: rgba(0,57,166,.06); color: var(--ru-blue); text-decoration: none; }
.tab-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: #eef2ff; color: var(--ru-blue);
}
.tab-text { display: flex; flex-direction: column; line-height: 1.15; }
.tab-title { font-weight: 700; font-size: 14px; }
.tab-sub { font-size: 11px; color: var(--muted); }
.tab-active {
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 6px 18px rgba(16,24,40,.07);
}
.tab-active .tab-icon { background: linear-gradient(135deg, var(--ru-blue), #0d57db); color: #fff; }

.btn-logout {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px;
  background: transparent; color: var(--ru-red);
  border: 1px solid rgba(213,43,30,.35);
  font-weight: 700; font-size: 14px; text-decoration: none;
  transition: all .15s;
}
.btn-logout:hover { background: rgba(213,43,30,.08); color: var(--ru-red); text-decoration: none; }

/* Page content under topbar */
.admin-wrap {
  max-width: 1240px; margin: 0 auto; padding: 28px 24px 64px;
}

/* Section card with icon header */
.section {
  background: rgba(255, 255, 255, 0.60);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 20px;
  padding: 26px 28px;
  margin-bottom: 22px;
  box-shadow: 0 6px 24px rgba(16,24,40,.08);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}
.section-head {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px;
}
.section-icon {
  width: 44px; height: 44px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eef2ff; color: var(--ru-blue);
  flex-shrink: 0;
}
.section-icon.is-red    { background: #fef3f2; color: var(--ru-red); }
.section-icon.is-green  { background: #ecfdf3; color: #067647; }
.section-icon.is-amber  { background: #fff7e6; color: #b54708; }
.section-title { margin: 0; font-size: 18px; font-weight: 800; color: var(--ink); }
.section-sub { font-size: 13px; color: var(--muted); margin: 2px 0 0; }

/* KPI cards */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.kpi {
  position: relative; overflow: hidden;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255,255,255,0.60);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 6px 18px rgba(16,24,40,.08);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  display: flex; gap: 14px; align-items: flex-start;
}
.kpi-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
}
.kpi-blue   .kpi-icon { background: linear-gradient(135deg, #1976d2, #0d47a1); }
.kpi-red    .kpi-icon { background: linear-gradient(135deg, #ef4444, #b42318); }
.kpi-green  .kpi-icon { background: linear-gradient(135deg, #22c55e, #067647); }
.kpi-amber  .kpi-icon { background: linear-gradient(135deg, #f59e0b, #b54708); }
.kpi-purple .kpi-icon { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.kpi-body { flex: 1; min-width: 0; }
.kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--ink); margin-top: 4px; }
.kpi-trend { font-size: 12px; margin-top: 2px; color: var(--muted); }
.kpi-trend.up   { color: #067647; }
.kpi-trend.down { color: #b42318; }

/* Charts row */
.chart-row {
  display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-bottom: 22px;
}
@media (max-width: 980px) { .chart-row { grid-template-columns: 1fr; } }
.chart-card {
  background: rgba(255,255,255,0.60);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: 0 6px 18px rgba(16,24,40,.08);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
}
.chart-card h3 {
  margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.chart-card canvas { max-height: 280px; }

/* Tabs alerts/messages */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px; border-radius: 12px;
  margin-bottom: 18px; font-size: 14px; font-weight: 600;
}
.alert-ok  { background: #ecfdf3; color: #067647; border: 1px solid #a6f4c5; }
.alert-bad { background: #fef3f2; color: #b42318; border: 1px solid #fda29b; }
.alert-warn{ background: #fffaeb; color: #b54708; border: 1px solid #fec84b; }

/* Buttons icon-aware */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px;
  border: 0; cursor: pointer;
  font-weight: 700; font-size: 14px; line-height: 1;
  text-decoration: none;
  background: linear-gradient(135deg, var(--ru-blue), #0d57db);
  color: #fff; box-shadow: 0 6px 16px rgba(0,57,166,.18);
  transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); color: #fff; text-decoration: none; }
.btn-red    { background: linear-gradient(135deg, var(--ru-red), #f04438); box-shadow: 0 6px 16px rgba(213,43,30,.2); }
.btn-green  { background: linear-gradient(135deg, #22c55e, #067647); box-shadow: 0 6px 16px rgba(6,118,71,.2); }
.btn-ghost  {
  background: transparent; color: var(--ru-blue); border: 1px solid var(--line);
  box-shadow: none;
}
.btn-ghost:hover { background: #f8fafc; color: var(--ru-blue); }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-pending    { background: #fffaeb; color: #b54708; }
.pill-processing { background: #eef4ff; color: var(--ru-blue); }
.pill-done       { background: #ecfdf3; color: #067647; }
.pill-failed     { background: #fef3f2; color: #b42318; }

/* Inline form row layout */
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }

/* Worker output */
.log-pane {
  background: #0f172a; color: #e2e8f0;
  border-radius: 12px; padding: 14px 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; max-height: 340px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}

/* Responsive topbar */
@media (max-width: 900px) {
  .topbar-inner { grid-template-columns: 1fr; gap: 12px; padding: 12px 16px; }
  .tabs { justify-content: stretch; flex-wrap: wrap; }
  .tab { flex: 1 1 auto; justify-content: center; padding: 8px 12px; }
  .tab-text { display: none; }
  .btn-logout { justify-self: end; }
  .admin-wrap { padding: 18px 14px 48px; }
  .section { padding: 20px 18px; border-radius: 16px; }
}

/* ==========================================================================
   Mobile-friendly tweaks for admin panel (≤ 760px)
   ========================================================================== */
@media (max-width: 760px) {
  body { -webkit-text-size-adjust: 100%; }

  .topbar-inner { padding: 10px 12px; gap: 10px; }
  .brand { gap: 10px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
  .brand-title { font-size: 14px; }
  .brand-sub { font-size: 11px; }

  .admin-wrap { padding: 14px 10px 48px; }
  .admin-header { gap: 10px; }
  .admin-header h1 { font-size: 22px; }

  .section { padding: 16px 14px; border-radius: 14px; margin-bottom: 14px; }
  .section-head { gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
  .section-icon { width: 36px; height: 36px; border-radius: 10px; }
  .section-title { font-size: 16px; }
  .section-sub { font-size: 12px; }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .kpi { padding: 12px 14px; gap: 10px; border-radius: 14px; }
  .kpi-icon { width: 36px; height: 36px; border-radius: 10px; }
  .kpi-icon svg { width: 18px; height: 18px; }
  .kpi-label { font-size: 10px; letter-spacing: .3px; }
  .kpi-value { font-size: 20px; }
  .kpi-trend { font-size: 11px; }

  .chart-row { gap: 12px; margin-bottom: 14px; }
  .chart-card { padding: 14px 14px; border-radius: 14px; }
  .chart-card canvas { max-height: 240px; }

  .inline-form { gap: 8px; }
  .inline-form .btn,
  .inline-form button { width: 100%; justify-content: center; }
  .form-field { width: 100%; }
  .form-field input,
  .form-field select { width: 100%; }

  /* Кнопки в строку, чтобы не выходили за экран */
  .btn { padding: 10px 14px; font-size: 13px; }
  .btn-sm { padding: 6px 10px; font-size: 12px; }

  /* Таблицы — горизонтальная прокрутка на мобиле */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table { font-size: 12px; }
  th, td { padding: 8px 10px; }
  th { font-size: 11px; letter-spacing: .2px; }

  /* Сетка истории загрузок — в одну колонку */
  .upload-history-grid { grid-template-columns: 1fr !important; gap: 12px !important; }

  /* Алёрты компактнее */
  .alert { padding: 10px 12px; font-size: 13px; border-radius: 10px; }

  /* Лог-панель ниже на мобилке */
  .log-pane { font-size: 12px; padding: 10px 12px; max-height: 240px; }

  /* Pillы поменьше */
  .pill { font-size: 11px; padding: 3px 8px; }

  /* Прогресс-блок: вертикальный */
  .kpi[style*="display:flex"][style*="flex-wrap:wrap"] > div { min-width: 0 !important; text-align: left !important; }
}

@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .tab { padding: 8px 10px; }
  .tab-icon { width: 32px; height: 32px; border-radius: 8px; }
}

/* ===== TG panel: kind-badges, progress bars, log modal ===== */

.tg-reports-table td { vertical-align: middle; }

.kind-badge {
  display: inline-block;
  padding: 2px 8px;
  margin-right: 4px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
  line-height: 1.5;
  white-space: nowrap;
}
.kind-full { background:#ecfdf5; color:#067647; border:1px solid #a7f3d0; }
.kind-vk   { background:#eff6ff; color:#1d4ed8; border:1px solid #bfdbfe; }
.kind-eta  { background:#f0f9ff; color:#0369a1; border:1px solid #bae6fd; }
.kind-res  { background:#f5f3ff; color:#6d28d9; border:1px solid #ddd6fe; }
.kind-auto { background:#fffbeb; color:#b45309; border:1px solid #fde68a; }
.kind-cmp  { background:#f1f5f9; color:#334155; border:1px solid #e2e8f0; }
.kind-camp { background:#fdf2f8; color:#9d174d; border:1px solid #fbcfe8; }

/* Progress bar */
.pb {
  position: relative;
  height: 8px;
  background: #eef2f6;
  border-radius: 6px;
  overflow: hidden;
}
.pb-fill {
  height: 100%;
  width: 0;
  border-radius: 6px;
  transition: width .35s ease;
  background: linear-gradient(90deg, #22c55e, #16a34a);
}
.pb-pending    { background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.pb-processing { background: linear-gradient(90deg, #60a5fa, #2563eb); position: relative; }
.pb-processing::after {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(45deg,
    rgba(255,255,255,.25) 25%, transparent 25%,
    transparent 50%, rgba(255,255,255,.25) 50%,
    rgba(255,255,255,.25) 75%, transparent 75%, transparent);
  background-size: 16px 16px;
  animation: pb-stripe 1s linear infinite;
}
.pb-done       { background: linear-gradient(90deg, #22c55e, #16a34a); }
.pb-failed     { background: linear-gradient(90deg, #f87171, #b91c1c); }
@keyframes pb-stripe {
  from { background-position: 0 0; }
  to   { background-position: 16px 0; }
}

/* Log modal */
.log-modal[hidden] { display: none !important; }
.log-modal {
  position: fixed; inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.log-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.log-modal__panel {
  position: relative;
  width: min(960px, 96vw);
  max-height: 86vh;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.log-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}
.log-modal__title { font-size: 15px; font-weight: 700; color: #f1f5f9; }
.log-modal__sub   { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.log-modal__head-actions { display: flex; gap: 10px; align-items: center; }
.log-modal__follow {
  font-size: 12px; color: #cbd5e1;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.log-modal__body {
  padding: 12px 16px;
  overflow: auto;
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
}
.log-line { display: grid; grid-template-columns: 165px 60px 130px 1fr; gap: 8px; padding: 2px 0; border-bottom: 1px dashed rgba(148,163,184,.12); }
.log-ts    { color: #94a3b8; }
.log-lvl   { font-weight: 700; text-transform: uppercase; font-size: 10.5px; padding-top: 1px; }
.log-stage { color: #a5b4fc; }
.log-msg   { color: #e2e8f0; word-break: break-word; }
.log-line.lvl-info  .log-lvl { color: #4ade80; }
.log-line.lvl-warn  .log-lvl { color: #fbbf24; }
.log-line.lvl-err   .log-lvl { color: #f87171; }
.log-line.lvl-err   .log-msg { color: #fecaca; }
.log-empty { color: #94a3b8; padding: 18px; text-align: center; }

@media (max-width: 640px) {
  .log-modal__panel { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  .log-line { grid-template-columns: 1fr; gap: 2px; padding: 6px 0; }
  .kind-badge { font-size: 10px; padding: 1px 6px; }
}
