:root {
  --bg: #070b12;
  --text: #eef2f7;
  --muted: #8b9cb3;
  --accent: #38bdf8;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --line: rgba(148, 163, 184, 0.18);
  --radius: 16px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background-color: #050810;
  background-image:
    linear-gradient(180deg, rgba(5, 8, 16, 0.55) 0%, rgba(5, 8, 16, 0.82) 55%, rgba(5, 8, 16, 0.94) 100%),
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(56, 189, 248, 0.14), transparent 70%),
    url("/static/img/panel-bg.png");
  background-size: cover, cover, cover;
  background-position: center top, center top, center center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

button, input, textarea, select { font: inherit; color: inherit; }

.app-atmosphere,
.login-atmosphere { display: none !important; }

/* ── Login ── */

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
}

.login-shell {
  width: min(420px, 100%);
  padding: 36px 32px 32px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 14, 22, 0.55);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo,
.home-logo {
  display: block;
  margin: 0 auto 20px;
  height: 108px;
  width: auto;
  max-width: min(220px, 42vw);
  object-fit: contain;
  border-radius: 22%;
  filter: drop-shadow(0 8px 32px rgba(45, 212, 191, 0.35)) drop-shadow(0 0 48px rgba(56, 189, 248, 0.2));
}

.login-logo { height: 96px; }

.home-title {
  margin: 0 0 8px;
  line-height: 1.1;
  text-align: center;
}

.home-title-sub {
  display: block;
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(186, 230, 253, 0.72);
  margin-bottom: 10px;
}

.home-title-brand {
  display: block;
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(100deg, #5eead4 0%, #38bdf8 28%, #818cf8 55%, #c084fc 78%, #f472b6 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: title-shine 6s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 18px rgba(56, 189, 248, 0.45));
}

@keyframes title-shine {
  from { background-position: 0% center; filter: drop-shadow(0 0 14px rgba(45, 212, 191, 0.4)); }
  to { background-position: 100% center; filter: drop-shadow(0 0 22px rgba(192, 132, 252, 0.45)); }
}

.login-lead {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.95rem;
}

.login-form { display: grid; gap: 12px; text-align: left; }

.field { display: grid; gap: 8px; }
.field span { font-size: 0.82rem; color: var(--muted); letter-spacing: 0.04em; }

.field input,
.editor-input,
.editor-textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(5, 8, 16, 0.72);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

.field input:focus,
.editor-input:focus,
.editor-textarea:focus {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.form-error {
  margin: 0;
  color: #fecaca;
  background: rgba(248, 113, 113, 0.14);
  border: 1px solid rgba(248, 113, 113, 0.35);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
}

.btn {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.08);
}

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

.btn-primary {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.95), rgba(129, 140, 248, 0.95));
  border-color: transparent;
  color: #041018;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7dd3fc, #a5b4fc);
  border-color: transparent;
}

.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(248, 113, 113, 0.4); color: #fecaca; }

/* ── App shell ── */

.app-body { min-height: 100vh; }

.app-main {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 28px 24px 56px;
}

.home-head {
  text-align: center;
  margin-bottom: 28px;
}

.view { display: none; animation: rise 0.28s ease; }
.view.is-active { display: block; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.view-head { margin-bottom: 22px; }
.view-head--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.view-head h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.view-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.view-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Hub cards (стиль panel.prizrak-games.ru) ── */

.home-grid--hub {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.hub-card {
  position: relative;
  display: block;
  min-height: 200px;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none !important;
  color: var(--text) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 14, 22, 0.55);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  transition: transform 0.22s, box-shadow 0.22s, border-color 0.22s;
}

button.hub-card {
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
  padding: 0;
  appearance: none;
}

.hub-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.accent-reputation.hub-card:hover,
.accent-monitoring.hub-card:hover { border-color: rgba(244, 114, 182, 0.45); }
.accent-respawn.hub-card:hover,
.accent-system.hub-card:hover { border-color: rgba(251, 146, 60, 0.45); }
.accent-traders.hub-card:hover,
.accent-games.hub-card:hover { border-color: rgba(34, 211, 238, 0.45); }
.accent-logout.hub-card:hover { border-color: rgba(148, 163, 184, 0.45); }
.accent-sites.hub-card:hover { border-color: rgba(167, 139, 250, 0.45); }
.accent-databases.hub-card:hover { border-color: rgba(74, 222, 128, 0.45); }
.accent-edge.hub-card:hover { border-color: rgba(56, 189, 248, 0.45); }

.hub-card-bg {
  position: absolute;
  inset: 0;
  background-color: #0b1220;
  background-size: cover;
  background-position: center;
  pointer-events: none;
  transition: transform 0.4s ease;
}

.hub-card:hover .hub-card-bg { transform: scale(1.06); }

.hub-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(7, 11, 18, 0.96) 0%,
    rgba(7, 11, 18, 0.55) 45%,
    rgba(7, 11, 18, 0.18) 100%
  );
  pointer-events: none;
}

.hub-card-body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  padding: 20px 22px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.hub-card-text { min-width: 0; }

.hub-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: #fff !important;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.9);
}

.hub-card-sub {
  margin: 4px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72) !important;
  line-height: 1.2;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
}

.hub-card .section-arrow {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 2;
  font-size: 1.5rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.75);
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.2s;
}

.hub-card:hover .section-arrow { opacity: 1; }

.status-pill {
  flex-shrink: 0;
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: lowercase;
  backdrop-filter: blur(6px);
  border: 1px solid transparent;
}

.st-ok, .st-online, .status-pill--ok {
  color: #a7f3d0;
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.28);
}

.st-warn, .status-pill--warn, .st-partial {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.28);
}

.st-error, .status-pill--danger {
  color: #fecaca;
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.3);
}

.st-offline, .st-inactive, .status-pill--info, .st-soon {
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.25);
}

/* ── Module chrome ── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 8, 16, 0.72);
  backdrop-filter: blur(14px);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
  text-decoration: none;
  color: inherit;
}

.topbar-logo {
  width: 40px;
  height: 40px;
  border-radius: 22%;
  object-fit: cover;
  filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.35));
}

.topbar-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-weight: 800;
  background: linear-gradient(145deg, #122033, #050810);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #bae6fd;
}

.topbar-brand strong { display: block; font-size: 0.95rem; letter-spacing: 0.04em; }
.topbar-brand span { display: block; color: var(--muted); font-size: 0.78rem; }

.topbar-context {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.topbar-context-title {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(186, 230, 253, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .btn-ghost:last-child,
#logout-btn { margin-left: auto; }

a.topbar-brand:hover { opacity: 0.92; }

/* fallback admin-cards (legacy) */
.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.admin-card {
  display: block;
  text-decoration: none;
  color: inherit;
  min-height: 160px;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 14, 22, 0.55);
  backdrop-filter: blur(8px);
  transition: transform 0.2s, border-color 0.2s;
}

a.admin-card { color: inherit; text-decoration: none; }

.admin-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.4);
}

.admin-card__mark {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 26px;
  padding: 0 10px;
  margin-bottom: 12px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
}

.admin-card h2 { margin: 0 0 8px; font-size: 1.15rem; color: var(--text); }
.admin-card p { margin: 0; color: var(--muted); line-height: 1.4; }
.admin-card__meta { margin-top: 14px; color: rgba(56, 189, 248, 0.85); font-size: 0.8rem; }
.admin-card--live { border-color: rgba(52, 211, 153, 0.45); }
.admin-card__badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: rgba(52, 211, 153, 0.2);
  color: #a7f3d0;
}

.split {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
  min-height: 520px;
}

.side-list,
.editor-pane,
.block-editor,
.placeholder-panel {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 14, 22, 0.55);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
}

.side-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
}

.side-item {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
}

.side-item strong { display: block; }
.side-item span { color: var(--muted); font-size: 0.82rem; }
.side-item.is-active,
.side-item:hover {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}

.editor-pane,
.block-editor,
.placeholder-panel { padding: 18px 20px; }

.empty-hint { color: var(--muted); }
.editor-grid { display: grid; gap: 12px; }
.editor-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px;
  align-items: center;
}
.editor-row label { color: var(--muted); font-size: 0.9rem; }

.category-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.category-head,
.item-row,
.inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.category-head { justify-content: space-between; margin-bottom: 10px; }
.item-row { margin-bottom: 8px; }
.item-row .editor-input { flex: 1; min-width: 110px; }

.status-line {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(52, 211, 153, 0.28);
  background: rgba(52, 211, 153, 0.1);
  color: #a7f3d0;
}

.status-line.is-error {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
}

.status-line.is-warn {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
}

.legacy-banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  line-height: 1.45;
}

.chip-list { display: flex; flex-direction: column; gap: 8px; }
.chip-row { display: flex; gap: 8px; }

.placeholder-eyebrow {
  margin: 0 0 8px;
  color: rgba(186, 230, 253, 0.8);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
}

.placeholder-panel h2 { margin: 0 0 10px; font-size: 1.4rem; }
.placeholder-panel p:last-child { color: var(--muted); max-width: 52ch; line-height: 1.5; }

.rep-meta { margin: 0 0 12px; color: var(--muted); font-size: 0.9rem; }

.rep-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.rep-tab {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.rep-tab.is-active,
.rep-tab:hover {
  color: var(--text);
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.1);
}

.rep-panel[hidden] { display: none !important; }

.btn-pull {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.95), rgba(45, 212, 191, 0.9));
  border-color: transparent;
  color: #042018;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: 0 8px 24px rgba(52, 211, 153, 0.22);
}

.btn-pull:hover {
  background: linear-gradient(135deg, #6ee7b7, #5eead4);
  border-color: transparent;
  color: #042018;
}

.btn-push {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.95), rgba(245, 158, 11, 0.9));
  border-color: transparent;
  color: #1a1200;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: 0 8px 24px rgba(251, 191, 36, 0.22);
}

.btn-push:hover {
  background: linear-gradient(135deg, #fcd34d, #fbbf24);
  border-color: transparent;
  color: #1a1200;
}

.meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 14, 22, 0.45);
  color: var(--muted);
  font-size: 0.86rem;
}

.meta-bar strong {
  color: #e2e8f0;
  font-weight: 700;
}

.table-wrap { overflow: auto; margin-top: 12px; }

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

.data-table th,
.data-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 6px;
  vertical-align: middle;
  text-align: left;
}

.data-table input { width: 100%; min-width: 64px; }

.label.check,
.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 960px) {
  .home-grid--hub { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .editor-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .home-grid--hub { grid-template-columns: 1fr; }
  .home-logo, .login-logo { height: 84px; }
  .app-main { padding: 20px 14px 40px; }
  .topbar { flex-wrap: wrap; }
  .topbar-brand { min-width: 0; width: 100%; }
}

/* Player hub — multi-config sections */
.category-head--config {
  align-items: flex-start;
  gap: 12px;
}

.category-head--config .config-path {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 400;
  word-break: break-all;
}

.config-badge {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
  white-space: nowrap;
}

.config-badge--ok {
  border-color: rgba(52, 211, 153, 0.35);
  color: #6ee7b7;
}

.config-badge--missing {
  border-color: rgba(251, 191, 36, 0.35);
  color: #fcd34d;
}

.side-item__meta {
  display: block;
  font-size: 0.72rem;
  opacity: 0.75;
  margin-top: 2px;
}

.player-intro {
  margin: 0 0 14px;
}

.runtime-details {
  margin-top: 10px;
  font-size: 0.88rem;
}

.runtime-details summary {
  cursor: pointer;
  color: #94a3b8;
  margin-bottom: 8px;
}

.editor-row--wide {
  grid-column: 1 / -1;
}

.editor-row--wide textarea {
  min-height: 72px;
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
}

/* Player card — PDA tabs */
#player-panel.player-pda-panel {
  position: relative;
}

.player-pda-panel .editor-pane {
  position: relative;
  z-index: 1;
}

.player-editor--pda {
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
}

.player-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(251, 191, 36, 0.2);
}

.player-tab {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  color: #94a3b8;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}

.player-tab:hover {
  border-color: rgba(251, 191, 36, 0.4);
  color: #fcd34d;
}

.player-tab.is-active {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.12);
  color: #6ee7b7;
}

.player-tab-panel {
  display: none;
}

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

.player-json-dump {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
  color: #a7f3d0;
  font-size: 0.78rem;
  overflow: auto;
  max-height: 360px;
  white-space: pre-wrap;
  word-break: break-word;
}

.player-pda-panel::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  opacity: 0.4;
  z-index: 0;
}

.player-pda-panel .split {
  position: relative;
  z-index: 1;
}
