:root {
  --bg: #05070b;
  --panel: rgba(10, 14, 24, 0.88);
  --panel-2: rgba(13, 19, 32, 0.94);
  --line: rgba(255,255,255,.08);
  --line-strong: rgba(93, 150, 255, .18);
  --text: #eef4ff;
  --muted: #99a7c0;
  --accent: #27beff;
  --accent-2: #7956ff;
  --success: #2de1a6;
  --danger: #ff647d;
  --shadow: 0 30px 80px rgba(0,0,0,.42);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(39,190,255,.17), transparent 22%),
    radial-gradient(circle at 100% 10%, rgba(121,86,255,.15), transparent 26%),
    linear-gradient(180deg, #04060a 0%, #080d16 45%, #05070b 100%);
}
a { color: inherit; text-decoration: none; }
.wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.page-shell { min-height: 100vh; position: relative; overflow: hidden; }
.top-glow {
  position: absolute; inset: 0 auto auto 50%; width: 900px; height: 420px; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(39,190,255,.11), transparent 60%); pointer-events: none;
}
.topbar, .nav, .panel, .server-card, .news-card, .table-shell, .hero-card, .feature-card, .contact-card, .admin-grid > * {
  backdrop-filter: blur(14px);
}
.topbar {
  display:flex; align-items:center; justify-content:space-between; gap:18px; padding:26px 0 14px;
}
.brand { display:flex; align-items:center; gap:14px; }
.brand-mark {
  width:52px; height:52px; border-radius:16px; display:grid; place-items:center; font-weight:800; font-size:18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color:#fff; box-shadow: var(--shadow); letter-spacing: .08em;
}
.brand strong { display:block; font-size: 20px; }
.brand small, .muted, .leader-row small { color: var(--muted); }
.top-stats, .top-actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.top-stats span {
  color: #d8e6ff; background: rgba(255,255,255,.04); border:1px solid var(--line); padding:10px 14px; border-radius:999px;
}
.user-chip {
  display:flex; align-items:center; gap:12px; padding:8px 12px; border-radius:18px; background: rgba(255,255,255,.04); border:1px solid var(--line);
}
.user-chip img { width:42px; height:42px; border-radius:12px; object-fit: cover; }
.user-chip strong, .user-chip small { display:block; }
.ghost-btn, .primary-btn, .secondary-btn, button {
  border:0; cursor:pointer; font:inherit; padding:12px 16px; border-radius:14px; transition:.25s ease;
}
.ghost-btn { background: rgba(255,255,255,.04); border:1px solid var(--line); }
.primary-btn { color:white; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--shadow); }
.secondary-btn { background: rgba(255,255,255,.06); border:1px solid var(--line); }
.ghost-btn:hover, .secondary-btn:hover, .primary-btn:hover, button:hover { transform: translateY(-1px); }
.nav {
  display:flex; gap:8px; padding:10px; background: rgba(8, 12, 20, .76); border:1px solid var(--line); border-radius:22px; position:sticky; top:10px; z-index:5;
}
.nav-link { padding:14px 18px; border-radius:14px; color:var(--muted); font-weight:600; }
.nav-link.active, .nav-link:hover { color:var(--text); background: rgba(255,255,255,.05); }
.hero { padding:34px 0 12px; }
.hero-grid { display:grid; grid-template-columns: 1.2fr .8fr; gap:24px; align-items:stretch; }
.hero-card, .panel, .feature-card, .contact-card, .server-card, .news-card, .table-shell {
  background: linear-gradient(180deg, rgba(13,18,30,.96), rgba(9,13,22,.92)); border:1px solid var(--line); border-radius:30px; box-shadow: var(--shadow);
}
.hero-card { padding:34px; position:relative; overflow:hidden; }
.hero-card::after {
  content:""; position:absolute; inset:auto -40px -40px auto; width:260px; height:260px; background: radial-gradient(circle, rgba(39,190,255,.28), transparent 65%);
}
.hero-main::before {
  content:""; position:absolute; inset:0; background: linear-gradient(135deg, rgba(39,190,255,.06), transparent 30%, rgba(121,86,255,.05));
}
.badge { display:inline-flex; padding:8px 12px; border-radius:999px; background: rgba(39,190,255,.11); color:#c7ecff; border:1px solid rgba(39,190,255,.24); font-size:13px; font-weight:700; letter-spacing:.02em; }
.hero h1 { font-size: clamp(34px, 5vw, 60px); line-height: 1.02; margin: 16px 0; max-width: 11ch; }
.hero p { color: var(--muted); max-width: 62ch; font-size: 17px; }
.hero-actions { display:flex; flex-wrap:wrap; gap:14px; margin-top:28px; }
.kpi-strip { display:grid; grid-template-columns: repeat(3, 1fr); gap:14px; margin-top:28px; }
.kpi-strip div, .leader-row, .stat-box {
  padding:18px; border-radius:22px; background: rgba(255,255,255,.04); border:1px solid var(--line);
}
.kpi-strip strong, .stat-box strong { display:block; font-size:30px; margin-bottom:8px; }
.panel-label { color: #cce9ff; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 16px; }
.leader-row {
  display:grid; grid-template-columns: 58px 1fr auto; gap:12px; align-items:center; margin-bottom:12px;
}
.leader-row:last-child { margin-bottom: 0; }
.leader-rank {
  width: 40px; height: 40px; border-radius: 14px; display:grid; place-items:center;
  background: linear-gradient(135deg, rgba(39,190,255,.16), rgba(121,86,255,.18)); border:1px solid var(--line-strong); font-weight:800;
}
.leader-points { color:#d8ecff; font-weight: 800; }
.section { padding: 28px 0; }
.section-head { display:flex; align-items:end; justify-content:space-between; gap:20px; margin-bottom:18px; }
.section-head h2 { margin:0; font-size: clamp(26px, 3vw, 40px); }
.server-grid, .news-grid, .feature-grid, .admin-grid { display:grid; gap:18px; }
.server-grid { grid-template-columns: repeat(3, 1fr); }
.server-card { padding:22px; border-color: var(--line-strong); }
.server-top, .server-actions { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.server-status { font-size:13px; border-radius:999px; padding:8px 10px; border:1px solid var(--line); color:#cfe7ff; background:rgba(255,255,255,.04); }
.server-status.ok { border-color: rgba(45,225,166,.3); color: #cffff0; }
.server-card h3, .news-card h3, .feature-card h3 { margin: 14px 0 10px; }
.server-meta { color: var(--muted); font-size:14px; display:flex; flex-wrap:wrap; gap:14px; margin-bottom:12px; }
.server-actions { margin-top:18px; }
.news-grid { grid-template-columns: repeat(3, 1fr); }
.news-card { overflow:hidden; }
.news-thumb {
  aspect-ratio: 16/10; background: linear-gradient(135deg, rgba(39,190,255,.2), rgba(121,86,255,.18)), #0b1020 center/cover no-repeat;
}
.news-body { padding:20px; }
.news-body p { color: var(--muted); }
.feature-grid { grid-template-columns: repeat(3, 1fr); }
.feature-card, .contact-card, .panel { padding:24px; }
.panel p, .contact-card p, .feature-card p, .feature-list p { color: var(--muted); }
.feature-list > div { padding: 0 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.feature-list > div:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.two-col { display:grid; grid-template-columns: 1.05fr .95fr; gap:18px; }
.about-panel p { font-size: 17px; line-height: 1.8; }
.table-shell { overflow:auto; }
table { width:100%; border-collapse: collapse; }
th, td { padding:16px 18px; text-align:left; border-bottom:1px solid var(--line); }
th { color:#cfe0ff; font-size:14px; }
td { color:#dce7fa; }
tr:hover td { background: rgba(255,255,255,.02); }
.alert { padding:16px 18px; border-radius:16px; margin-top:18px; border:1px solid var(--line); }
.alert.success { background: rgba(33,209,159,.10); color:#c9ffee; }
.alert.error { background: rgba(255,94,115,.10); color:#ffd0d8; }
.form-grid { display:grid; grid-template-columns:repeat(2, 1fr); gap:16px; }
.field { display:flex; flex-direction:column; gap:8px; }
.field.full { grid-column:1/-1; }
input, textarea, select {
  width:100%; padding:14px 16px; color:var(--text); background: rgba(255,255,255,.04); border:1px solid var(--line); border-radius:14px; font:inherit;
}
textarea { min-height: 140px; resize: vertical; }
.footer { display:flex; justify-content:space-between; gap:20px; padding:48px 0; color:var(--muted); }
.footer-links { display:flex; gap:14px; flex-wrap:wrap; }
.kpi-line { display:flex; gap:16px; flex-wrap:wrap; color:var(--muted); }
.admin-grid { grid-template-columns: 1fr 1fr; }
.small { font-size: 13px; }
.toast {
  position: fixed; bottom: 20px; right: 20px; padding: 14px 18px; border-radius: 16px; background: rgba(10, 14, 24, .95);
  color: #eef4ff; border: 1px solid rgba(255,255,255,.08); z-index: 9999; box-shadow: var(--shadow); transition: opacity .25s ease;
}
@media (max-width: 1080px) {
  .hero-grid, .server-grid, .news-grid, .feature-grid, .admin-grid, .two-col { grid-template-columns:1fr; }
}
@media (max-width: 780px) {
  .topbar { flex-direction:column; align-items:flex-start; }
  .nav { overflow:auto; }
  .form-grid, .kpi-strip { grid-template-columns:1fr; }
  .footer { flex-direction:column; }
  .user-chip { width: 100%; }
}


.hero-chat-grid { grid-template-columns: 1.15fr .75fr; }
.chat-shell { min-height: 650px; }
.chat-head-row { display:flex; justify-content:space-between; gap:20px; align-items:flex-start; margin-bottom:20px; }
.chat-title { max-width: 12ch !important; margin-bottom: 12px !important; }
.chat-subtitle { max-width: 720px; }
.chat-online-pill { white-space:nowrap; padding:10px 14px; border-radius:999px; border:1px solid rgba(45,225,166,.24); background:rgba(45,225,166,.09); color:#cffff0; font-weight:700; }
.minichat-box { display:flex; flex-direction:column; gap:16px; position:relative; z-index:1; }
.minichat-messages {
  display:flex; flex-direction:column-reverse; gap:12px; max-height:380px; overflow:auto; padding-right:6px;
}
.chat-message { display:flex; gap:12px; align-items:flex-start; }
.chat-avatar img { width:48px; height:48px; border-radius:16px; object-fit:cover; border:1px solid var(--line); }
.chat-bubble { flex:1; padding:14px 16px; border-radius:20px; background:rgba(255,255,255,.04); border:1px solid var(--line); }
.chat-meta { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; }
.chat-meta strong { font-size:15px; }
.chat-meta span { color:var(--muted); font-size:12px; }
.chat-bubble p { margin:0; color:#edf3ff; line-height:1.5; word-break:break-word; }
.chat-empty { color:var(--muted); padding:24px; border-radius:20px; border:1px dashed var(--line); text-align:center; }
.minichat-form { display:flex; flex-direction:column; gap:12px; }
.minichat-form textarea {
  width:100%; resize:vertical; min-height:90px; max-height:180px; padding:16px 18px; border-radius:18px; background:rgba(255,255,255,.045); border:1px solid var(--line);
  color:var(--text); font:inherit; outline:none;
}
.minichat-form textarea:focus { border-color: rgba(39,190,255,.35); box-shadow: 0 0 0 4px rgba(39,190,255,.08); }
.minichat-form textarea:disabled { opacity:.65; cursor:not-allowed; }
.minichat-form-row { display:flex; gap:12px; align-items:center; justify-content:space-between; flex-wrap:wrap; }
.quick-kpi-row { padding-top: 4px; }
.wide-kpi-strip { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1080px) {
  .hero-chat-grid { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .chat-head-row, .minichat-form-row { flex-direction:column; align-items:flex-start; }
  .wide-kpi-strip { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .wide-kpi-strip { grid-template-columns: 1fr; }
  .chat-meta { flex-direction:column; align-items:flex-start; }
}

.chat-head-actions { display:flex; gap:12px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.archive-btn { white-space: nowrap; }
.custom-scrollbar::-webkit-scrollbar { width: 10px; }
.custom-scrollbar::-webkit-scrollbar-track { background: rgba(255,255,255,.04); border-radius: 999px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: linear-gradient(180deg, rgba(39,190,255,.55), rgba(121,86,255,.55)); border-radius: 999px; border: 2px solid rgba(7,12,22,.95); }
.custom-scrollbar { scrollbar-width: thin; scrollbar-color: rgba(83,146,255,.8) rgba(255,255,255,.04); }
.chat-user-link { color: #eef6ff; text-decoration:none; font-weight:800; }
.chat-user-link:hover { color: var(--primary); }
.archive-layout { display:grid; grid-template-columns: minmax(0, 1fr) 320px; gap:18px; }
.archive-sticky { position: sticky; top: 108px; height: fit-content; }
.archive-list { display:flex; flex-direction:column; gap:12px; }
.archive-list .chat-message { padding:0; }
.archive-list .chat-bubble { background: rgba(255,255,255,.045); }
.archive-controls { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom: 16px; }
.archive-note { color: var(--muted); margin: 0; }
.pagination { display:flex; gap:10px; flex-wrap:wrap; margin-top: 20px; }
.pagination .secondary-btn.active { border-color: rgba(39,190,255,.35); color:#fff; background: rgba(39,190,255,.10); }
@media (max-width: 1080px) { .archive-layout { grid-template-columns: 1fr; } .archive-sticky { position: static; } }
@media (max-width: 780px) { .chat-head-actions { width:100%; justify-content:flex-start; } }
