:root {
  --bg: #080b12;
  --surface: rgba(18, 23, 35, .82);
  --surface-2: #151b29;
  --line: rgba(255, 255, 255, .085);
  --text: #f7f8fb;
  --muted: #8f99aa;
  --blue: #5b8cff;
  --cyan: #62d8ff;
  --green: #57d9a3;
  --red: #ff6b7a;
  --shadow: 0 24px 60px rgba(0, 0, 0, .34);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 15% 0%, #111b35 0, transparent 32%), var(--bg); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(100px); opacity: .18; pointer-events: none; }
.ambient-one { width: 360px; height: 360px; background: #335cff; left: -140px; top: 14%; }
.ambient-two { width: 300px; height: 300px; background: #00c2ff; right: -120px; bottom: 4%; opacity: .09; }
.shell { width: min(1160px, calc(100% - 40px)); margin: auto; }
.public-shell { padding: 28px 0 44px; }
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 22px; margin-bottom: 58px; }
.topbar .live-pill { justify-self: end; }
.topbar-links { display: flex; align-items: center; justify-content: center; gap: 9px; }
.topbar-link { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; color: #cbd3df; background: rgba(14,19,29,.72); text-decoration: none; font-size: 11px; font-weight: 650; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.topbar-link:hover { transform: translateY(-1px); border-color: rgba(91,140,255,.42); background: #171e2c; }
.topbar-link span { color: #83a5ff; font-size: 15px; line-height: 1; }
.topbar-link.accent { border-color: rgba(91,140,255,.25); background: rgba(91,140,255,.12); color: #dce6ff; }
.topbar-link.join { border-color: rgba(87,217,163,.24); background: rgba(87,217,163,.09); color: #d8fff0; }
.topbar-link.join span { color: var(--green); }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand span:last-child { display: grid; }
.brand strong { font-size: 15px; letter-spacing: .02em; }
.brand small { font-size: 9px; letter-spacing: .22em; color: var(--muted); margin-top: 2px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(145deg, #6a97ff, #3c62d9); box-shadow: 0 10px 26px rgba(67, 105, 222, .3); }
.brand-mark.large { width: 52px; height: 52px; border-radius: 16px; margin-bottom: 28px; }
.brand-mark svg { width: 23px; fill: none; stroke: white; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark.large svg { width: 29px; }
.live-pill { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 99px; background: rgba(14, 19, 29, .66); color: #cbd2df; font-size: 12px; }
.live-pill.offline .live-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(255,107,122,.12); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(87,217,163,.12); }
.hero { display: grid; grid-template-columns: 1fr 360px; align-items: center; gap: 80px; min-height: 320px; margin-bottom: 72px; }
.eyebrow { color: #7fa4ff; font-size: 10px; font-weight: 700; letter-spacing: .22em; }
.hero h1 { margin: 18px 0 18px; max-width: 680px; font-size: clamp(38px, 6vw, 68px); letter-spacing: -.055em; line-height: 1.05; }
.hero-copy > p { max-width: 620px; color: var(--muted); line-height: 1.8; font-size: 15px; }
.hero-meta { display: flex; align-items: center; gap: 14px; margin-top: 28px; color: var(--muted); font-size: 12px; }
.hero-meta b { color: #cbd3e1; font-weight: 600; }
.meta-separator { width: 3px; height: 3px; border-radius: 50%; background: #495267; }
.capacity-card { min-height: 278px; display: grid; place-items: center; align-content: center; position: relative; border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(145deg, rgba(27, 35, 55, .8), rgba(13, 17, 27, .8)); box-shadow: var(--shadow); overflow: hidden; }
.capacity-card::before { content: ""; position: absolute; width: 200px; height: 200px; border-radius: 50%; background: rgba(76, 116, 238, .15); filter: blur(50px); }
.ring { --value: 0%; width: 146px; height: 146px; position: relative; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--blue) var(--value), rgba(255,255,255,.075) 0); }
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: #121827; box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
.ring-inner { position: relative; display: grid; text-align: center; }
.ring-inner strong { font-size: 42px; letter-spacing: -.06em; line-height: 1; }
.ring-inner span { margin-top: 7px; font-size: 11px; color: var(--muted); }
.capacity-copy { display: grid; text-align: center; margin-top: 16px; }
.capacity-copy b { font-size: 13px; }
.capacity-copy span { color: var(--muted); font-size: 10px; margin-top: 4px; }
.insights-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(250px, .8fr); gap: 15px; margin: -35px 0 15px; }
.trend-panel, .popular-panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden; }
.trend-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 19px 21px 5px; }
.trend-head h2, .popular-panel h2 { margin: 7px 0 0; font-size: 15px; }
.trend-peaks { display: flex; gap: 18px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.trend-peaks b { display: block; margin-top: 4px; color: white; font-size: 17px; text-align: right; }
.chart-wrap { height: 155px; position: relative; padding: 5px 14px 14px; }
#onlineChart { width: 100%; height: 100%; overflow: visible; }
.chart-grid-line { stroke: rgba(255,255,255,.055); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-line { fill: none; stroke: #6e9aff; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 4px 7px rgba(91,140,255,.28)); }
.chart-area { fill: url(#trendGradient); opacity: .55; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.popular-panel { padding: 19px 21px; }
.popular-panel ol { display: grid; gap: 10px; margin: 18px 0 0; padding: 0; list-style: none; counter-reset: popular; }
.popular-panel li { counter-increment: popular; display: grid; grid-template-columns: 22px minmax(0,1fr) auto; align-items: center; gap: 8px; color: #cbd2df; font-size: 11px; }
.popular-panel li::before { content: counter(popular); width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; color: #93afff; background: rgba(91,140,255,.1); font-size: 9px; }
.popular-panel li span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.popular-panel li small { color: var(--muted); }
.user-ranking-panel { margin-bottom: 62px; padding: 19px 21px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.user-ranking-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.user-ranking-head h2 { margin: 7px 0 0; font-size: 15px; }
.user-ranking-panel ol { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px 26px; margin: 18px 0 0; padding: 0; list-style: none; counter-reset: ranking; }
.user-ranking-panel li { counter-increment: ranking; display: grid; grid-template-columns: 22px minmax(0,1fr) auto; align-items: center; gap: 8px; color: #cbd2df; font-size: 11px; }
.user-ranking-panel li::before { content: counter(ranking); width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; color: #93afff; background: rgba(91,140,255,.1); font-size: 9px; }
.user-ranking-panel li span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.user-ranking-panel li small { color: var(--muted); }
.section-head, .panel-head, .admin-header, .dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.section-head { margin-bottom: 20px; }
.section-head h2, .panel-head h2 { margin: 7px 0 0; font-size: 20px; letter-spacing: -.02em; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; }
.icon-button:hover { background: #20283a; }
.icon-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.channel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.channel-card, .skeleton-card { min-height: 155px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); backdrop-filter: blur(16px); }
.channel-card { padding: 19px; transition: transform .2s, border-color .2s; }
.channel-card:hover { transform: translateY(-2px); border-color: rgba(91,140,255,.3); }
.channel-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.channel-title h3 { margin: 0; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-count { padding: 3px 8px; border-radius: 99px; background: rgba(91,140,255,.12); color: #9eb8ff; font-size: 10px; }
.channel-topic { min-height: 17px; margin: 8px 0 16px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-list { display: flex; flex-wrap: wrap; gap: 7px; }
.member-chip { display: flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px 4px 4px; border: 1px solid rgba(255,255,255,.06); border-radius: 99px; background: rgba(255,255,255,.035); color: #cdd3df; font-size: 10px; }
.member-chip span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { flex: 0 0 auto; width: 21px; height: 21px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg, #466ddd, #293e82); color: white; font-size: 8px; font-weight: 700; }
.empty-members { color: #697386; font-size: 11px; padding-top: 5px; }
.skeleton-card { overflow: hidden; position: relative; }
.skeleton-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.05) 50%, transparent 80%); animation: shimmer 1.5s infinite; transform: translateX(-100%); }
@keyframes shimmer { to { transform: translateX(100%); } }
footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; margin-top: 42px; text-align: center; color: #596275; font-size: 10px; letter-spacing: .04em; }
footer a { color: #68748b; text-decoration: none; }
footer a:hover { color: #93afff; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: 360px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: #1b2231; box-shadow: var(--shadow); font-size: 12px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

.hidden { display: none !important; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-card { width: min(420px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 24px; background: rgba(17,22,34,.9); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.login-card h1 { margin: 12px 0 8px; font-size: 32px; letter-spacing: -.04em; }
.login-card > p { color: var(--muted); font-size: 13px; }
form label { display: grid; gap: 7px; margin: 18px 0; color: #bcc5d4; font-size: 11px; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #0d111a; color: var(--text); padding: 11px 12px; }
textarea { resize: vertical; }
.primary-button, .secondary-button, .text-button { border: 0; border-radius: 10px; cursor: pointer; font-weight: 650; font-size: 12px; }
.primary-button { width: 100%; padding: 12px 16px; color: white; background: linear-gradient(145deg, #618dff, #456ce1); box-shadow: 0 8px 24px rgba(69,108,225,.22); }
.primary-button:hover { filter: brightness(1.08); }
.primary-button.small { width: auto; padding: 9px 13px; }
.secondary-button { padding: 9px 13px; border: 1px solid var(--line); background: #171e2c; color: #cad2df; }
.text-button { padding: 8px; background: transparent; color: var(--muted); }
.login-error { min-height: 17px; color: var(--red) !important; text-align: center; }
.dashboard { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 18px 20px; border-right: 1px solid var(--line); background: rgba(10,13,20,.82); backdrop-filter: blur(18px); display: flex; flex-direction: column; }
.admin-brand { padding: 0 7px; margin-bottom: 42px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px; border: 0; border-radius: 10px; color: #858fa1; background: transparent; font-size: 12px; text-align: left; cursor: pointer; }
.nav-item span { width: 17px; color: #78849a; text-align: center; }
.nav-item:hover { color: #d6dce7; background: rgba(255,255,255,.035); }
.nav-item.active { color: white; background: rgba(91,140,255,.12); }
.nav-item.active span { color: #82a4ff; }
.sidebar-foot { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid var(--line); }
.live-pill.compact { border: 0; padding: 0; background: transparent; margin-bottom: 8px; }
.admin-main { min-width: 0; padding: 36px clamp(24px, 4vw, 58px) 60px; }
.admin-header { margin-bottom: 28px; }
.admin-header h1 { margin: 7px 0 0; font-size: 28px; letter-spacing: -.04em; }
.view { display: none; }
.view.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.metric { min-width: 0; padding: 19px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.metric > span { color: var(--muted); font-size: 11px; }
.metric strong { display: block; margin: 13px 0 6px; font-size: 29px; letter-spacing: -.05em; }
.metric small { display: block; overflow: hidden; color: #697487; font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.metric.accent { background: linear-gradient(145deg, rgba(56,89,172,.34), rgba(24,31,48,.82)); }
.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 18px 50px rgba(0,0,0,.15); overflow: hidden; }
.panel-head { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 16px; }
.panel-head p { margin: 6px 0 0; color: var(--muted); font-size: 10px; }
.distribution { display: grid; gap: 15px; padding: 24px; }
.dist-row { display: grid; grid-template-columns: minmax(100px, 180px) 1fr 34px; align-items: center; gap: 16px; font-size: 11px; }
.dist-row > span:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dist-track { height: 7px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.05); }
.dist-bar { height: 100%; min-width: 0; border-radius: inherit; background: linear-gradient(90deg, #4c73dc, #6ad5ff); }
.dist-row b { text-align: right; }
.search-input { width: 230px; padding: 9px 11px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { padding: 12px 16px; color: #727d90; font-weight: 550; text-align: left; white-space: nowrap; background: rgba(255,255,255,.015); }
td { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.055); color: #c2cad6; white-space: nowrap; }
.user-cell { display: flex; align-items: center; gap: 9px; }
.user-cell small { display: block; color: var(--muted); margin-top: 3px; }
.table-actions { display: flex; gap: 5px; }
.action-button { border: 1px solid var(--line); border-radius: 7px; padding: 5px 7px; color: #aeb8c7; background: #151b27; font-size: 9px; cursor: pointer; }
.action-button:hover { border-color: rgba(91,140,255,.4); color: white; }
.action-button.danger:hover { border-color: rgba(255,107,122,.45); color: #ff8e99; }
.channel-admin-list { padding: 8px 20px 20px; }
.channel-admin-row { display: flex; align-items: center; gap: 14px; padding: 13px 3px; border-bottom: 1px solid rgba(255,255,255,.055); }
.channel-admin-row:last-child { border-bottom: 0; }
.channel-admin-info { min-width: 0; flex: 1; }
.channel-admin-info b { display: block; font-size: 12px; }
.channel-admin-info small { display: block; margin-top: 4px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.channel-admin-meta { color: var(--muted); font-size: 10px; }
.settings-panel { max-width: 720px; }
.settings-stack { display: grid; gap: 18px; }
.settings-form { padding: 4px 22px 22px; }
.settings-form .primary-button { width: auto; margin-top: 4px; }
label small { color: #667084; margin-left: 5px; }
dialog { width: min(480px, calc(100% - 30px)); padding: 0; border: 1px solid var(--line); border-radius: 18px; color: var(--text); background: #131925; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(3,5,9,.72); backdrop-filter: blur(5px); }
.dialog-head { padding: 19px 22px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 6px 0 0; font-size: 18px; }
.dialog-head .icon-button { border: 0; background: transparent; font-size: 20px; }
#dialogFields { padding: 1px 22px; }
.check-list { display: grid; gap: 8px; max-height: 220px; overflow: auto; margin: 8px 0 18px; }
.check-row { display: flex; grid-template-columns: none; align-items: center; gap: 9px; margin: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: #0d111a; }
.check-row input { width: auto; margin: 0; }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px; overflow: hidden; margin: 18px 0 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--line); }
.details-grid > div { min-width: 0; padding: 10px 11px; background: #0d111a; }
.details-grid .wide { grid-column: 1 / -1; }
.details-grid dt { color: var(--muted); font-size: 9px; }
.details-grid dd { margin: 4px 0 0; overflow: hidden; color: #d8dee9; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }
.dialog-actions .primary-button { width: auto; }
.empty-state { padding: 36px; color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr 300px; gap: 38px; }
  .channel-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .insights-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 1160px); }
  .topbar { grid-template-columns: 1fr auto; gap: 16px; margin-bottom: 38px; }
  .topbar-links { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .topbar-link { flex: 1; justify-content: center; }
  .hero { grid-template-columns: 1fr; gap: 28px; margin-bottom: 52px; }
  .insights-grid { margin-top: 0; margin-bottom: 15px; }
  .user-ranking-panel { margin-bottom: 48px; }
  .user-ranking-head { align-items: start; flex-direction: column; gap: 8px; }
  .user-ranking-panel ol { grid-template-columns: 1fr; }
  .capacity-card { min-height: 220px; }
  .channel-grid { grid-template-columns: 1fr; }
  .dashboard { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-brand { margin-bottom: 18px; }
  .sidebar nav { grid-template-columns: repeat(5, minmax(80px,1fr)); overflow-x: auto; }
  .nav-item { justify-content: center; }
  .nav-item span { display: none; }
  .sidebar-foot { display: none; }
  .admin-main { padding: 26px 16px 50px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .hero h1 { font-size: 42px; }
  .live-pill { padding: 0 10px; }
  .topbar-links { flex-wrap: wrap; }
  .topbar-link { min-width: calc(50% - 5px); }
  .trend-head { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .search-input { width: 100%; }
  .sidebar nav { grid-template-columns: repeat(5, 100px); }
  .login-card { padding: 30px 24px; }
}
