:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #1c232d;
  --surface3: #222b36;
  --border: #2a323d;
  --border-soft: #1e2530;
  --text: #e6edf3;
  --muted: #8b949e;
  --faint: #6b7481;
  --accent: #f0b429;
  --accent-dim: #b8891a;
  --green: #3fb950;
  --red: #f85149;
  --blue: #58a6ff;
  --purple: #bc8cff;
  --orange: #e3742f;
  /* chart series (dark, from validated palette) */
  --s1: #3987e5;
  --s2: #199e70;
  --s3: #c98500;
  --s4: #9085e9;
  --s5: #e66767;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { cursor: pointer; font-family: inherit; }
h1 { font-size: 20px; margin: 0; font-weight: 700; }
h2 { font-size: 14px; margin: 0; font-weight: 600; }

/* ---------- LOGIN ---------- */
.login-view {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2230, var(--bg));
}
.login-card {
  width: 340px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 34px 28px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 24px 70px rgba(0,0,0,.55); align-items: stretch;
}
.login-icon { width: 56px; height: 56px; border-radius: 12px; align-self: center; image-rendering: pixelated; }
.login-logo { font-size: 26px; font-weight: 800; text-align: center; letter-spacing: .12em;
  background: linear-gradient(90deg, var(--accent), #ffd76a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-sub { text-align: center; color: var(--muted); margin-bottom: 10px; font-size: 12.5px; letter-spacing: .02em; }
.login-card input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 9px;
  padding: 12px 14px; color: var(--text); font-size: 15px;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button {
  background: var(--accent); color: #1a1200; border: none; border-radius: 9px;
  padding: 12px; font-weight: 700; font-size: 15px; margin-top: 6px;
}
.login-card button:hover { filter: brightness(1.08); }
.login-error { color: var(--red); text-align: center; min-height: 18px; font-size: 13px; }

/* ---------- APP SHELL ---------- */
.app-view { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand img { width: 38px; height: 38px; border-radius: 9px; image-rendering: pixelated; }
.brand-name { font-weight: 800; letter-spacing: .1em; font-size: 15px;
  background: linear-gradient(90deg, var(--accent), #ffd76a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { color: var(--faint); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; background: transparent; border: none;
  color: var(--muted); padding: 10px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; text-align: left; width: 100%;
}
.nav-item .ic { font-size: 15px; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--surface3); color: var(--accent); }

.side-section { margin-top: 22px; }
.side-label { color: var(--faint); font-size: 10.5px; letter-spacing: .14em; padding: 0 12px 8px; }
.server-filter { display: flex; flex-direction: column; gap: 3px; }
.sv-btn {
  display: flex; align-items: center; gap: 9px; background: transparent; border: 1px solid transparent;
  color: var(--muted); padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; text-align: left; width: 100%;
}
.sv-btn img { width: 18px; height: 18px; border-radius: 4px; image-rendering: pixelated; }
.sv-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); margin-left: auto; }
.sv-btn .dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.sv-btn:hover { background: var(--surface2); color: var(--text); }
.sv-btn.active { background: var(--surface3); color: var(--text); border-color: var(--border); }

.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 12px 8px 4px; border-top: 1px solid var(--border-soft); color: var(--muted); font-size: 12.5px; }

.ghost { background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 7px 12px; border-radius: 8px; font-size: 13px; }
.ghost:hover { border-color: var(--accent); }
.ghost.sm { padding: 5px 10px; font-size: 12px; }

/* ---------- CONTENT ---------- */
.content { flex: 1; overflow-y: auto; padding: 22px 26px 40px; }
.page-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.page-head .updated, .page-head .count { color: var(--faint); font-size: 12.5px; }

/* ---------- STATUS CARDS ---------- */
.status-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 18px; }
.status-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; position: relative; overflow: hidden;
}
.status-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); opacity: .8; }
.sc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sc-top img { width: 40px; height: 40px; border-radius: 9px; image-rendering: pixelated; }
.sc-name { font-weight: 700; font-size: 16px; }
.sc-ver { color: var(--faint); font-size: 12px; }
.sc-state { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.sc-state .dot { width: 8px; height: 8px; border-radius: 50%; }
.sc-state.online { color: var(--green); } .sc-state.online .dot { background: var(--green); box-shadow: 0 0 7px var(--green); }
.sc-state.offline { color: var(--faint); } .sc-state.offline .dot { background: var(--faint); }
.sc-body { display: flex; align-items: flex-end; gap: 20px; }
.sc-players .big { font-size: 34px; font-weight: 800; line-height: 1; }
.sc-players .big .max { font-size: 17px; color: var(--muted); font-weight: 600; }
.sc-players .lbl { color: var(--muted); font-size: 12px; margin-top: 3px; }
.sc-tps { text-align: right; margin-left: auto; }
.sc-tps .v { font-size: 18px; font-weight: 700; }
.sc-tps .v.good { color: var(--green); } .sc-tps .v.mid { color: var(--accent); } .sc-tps .v.bad { color: var(--red); }
.sc-tps .lbl { color: var(--muted); font-size: 11px; }
.sc-list { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 5px; }
.sc-chip { display: flex; align-items: center; gap: 5px; background: var(--surface2); border: 1px solid var(--border-soft);
  border-radius: 20px; padding: 2px 9px 2px 3px; font-size: 12px; }
.sc-chip img { width: 17px; height: 17px; border-radius: 3px; }
.sc-more { color: var(--faint); font-size: 12px; align-self: center; }

/* ---------- STAT TILES ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.tile .v { font-size: 26px; font-weight: 800; line-height: 1.1; }
.tile .l { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.tile.gold .v { color: var(--accent); }

/* ---------- PANELS / GRID ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.panel-sub { color: var(--faint); font-size: 12px; }
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }

/* ---------- ECONOMY BOX ---------- */
.economy-box { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.eco { background: var(--surface2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 12px 14px; }
.eco .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.eco .l { color: var(--muted); font-size: 12px; margin-top: 3px; }
.eco.buy .v { color: var(--red); } .eco.sell .v { color: var(--green); } .eco.pay .v { color: var(--accent); }

/* ---------- TOP LIST ---------- */
.top-list { display: flex; flex-direction: column; gap: 2px; }
.top-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.top-row:hover { background: var(--surface2); }
.top-row .rank { color: var(--faint); font-size: 12px; width: 20px; font-variant-numeric: tabular-nums; }
.top-row img { width: 24px; height: 24px; border-radius: 5px; }
.top-row .nm { font-weight: 600; flex: 1; }
.top-row .val { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ---------- CATEGORY / LOGS BARS ---------- */
.hbar-row { display: grid; grid-template-columns: 120px 1fr 46px; align-items: center; gap: 10px; margin-bottom: 8px; }
.hbar-row .cn { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { background: var(--surface2); border-radius: 5px; height: 10px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 5px; background: var(--s1); }
.hbar-row .cv { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- LOGS TABLE (page) ---------- */
.catbar { display: flex; gap: 4px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 2px; }
.cat-tab { background: transparent; border: none; color: var(--muted); padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.cat-tab:hover { background: var(--surface2); color: var(--text); }
.cat-tab.active { background: var(--accent); color: #1a1200; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
#search, #player-search { flex: 1; max-width: 480px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 14px; color: var(--text); font-size: 14px; }
#search:focus, #player-search:focus { outline: none; border-color: var(--accent); }
.live { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 5px; user-select: none; }
.stats { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
table.logs { width: 100%; border-collapse: collapse; }
table.logs thead th { position: sticky; top: 0; background: var(--surface2); text-align: left; color: var(--muted);
  font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 9px 12px; border-bottom: 1px solid var(--border); z-index: 2; }
table.logs td { padding: 8px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
table.logs tbody tr:hover { background: var(--surface2); }
.c-time { width: 130px; } .c-server { width: 92px; } .c-cat { width: 118px; }
.c-player { width: 140px; } .c-action { width: 128px; } .c-amount { width: 104px; text-align: right; } .c-msg { min-width: 240px; }
td.c-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; white-space: nowrap; }
td.c-amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
td.c-msg { color: #cbd5e1; word-break: break-word; }
.player-cell { display: flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.player-cell:hover { color: var(--accent); }
.player-cell img { width: 20px; height: 20px; border-radius: 4px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.sv-badge { border: 1px solid var(--border); background: var(--surface3); color: var(--text); }
.sv-SkyPvP { color: #7ee0ff; border-color: #26506080; }
.sv-SMP { color: #ffd27e; border-color: #5a482680; }
.sv-Prison { color: #ff9e9e; } .sv-Hub { color: #b9ffb0; }
.cat-badge { background: var(--surface2); color: var(--muted); border: 1px solid var(--border-soft); }
.load-more-wrap { text-align: center; padding: 14px; }
.empty { text-align: center; color: var(--muted); padding: 40px; }

tr.fresh { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { background: rgba(240,180,41,.18); } 100% { background: transparent; } }

/* ---------- PLAYER PROFILE ---------- */
.player-profile { margin-top: 4px; }
.pp-empty { color: var(--muted); padding: 30px 4px; }
.pp-head { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; }
.pp-head img { width: 64px; height: 64px; border-radius: 12px; }
.pp-name { font-size: 22px; font-weight: 800; }
.pp-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.pp-eco { display: flex; gap: 10px; margin-left: auto; }
.pp-eco .eco { min-width: 110px; }
.pp-cols { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.pp-side .panel { margin-bottom: 16px; }

/* ---------- NAV BADGE ---------- */
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 20px; padding: 1px 7px; min-width: 18px; text-align: center; }

/* ---------- ALERTS ---------- */
.alert-list { display: flex; flex-direction: column; gap: 6px; }
.alert-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px; background: var(--surface2);
  border: 1px solid var(--border-soft); border-radius: 9px; border-left: 3px solid var(--faint); }
.alert-item.danger { border-left-color: var(--red); }
.alert-item.warn { border-left-color: var(--accent); }
.alert-item.money { border-left-color: var(--green); }
.alert-item img { width: 26px; height: 26px; border-radius: 5px; flex: 0 0 auto; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 600; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.alert-title .sv { font-size: 11px; }
.alert-msg { color: var(--muted); font-size: 12.5px; margin-top: 2px; word-break: break-word; }
.alert-time { color: var(--faint); font-size: 11.5px; white-space: nowrap; margin-left: auto; }
.alert-amt { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- PUNISHMENT STATUS ---------- */
.st { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.st.active { background: rgba(248,81,73,.16); color: var(--red); }
.st.expired { background: var(--surface3); color: var(--muted); }
.st.removed { background: rgba(63,185,80,.14); color: var(--green); }
td.c-until { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .pp-cols { grid-template-columns: 1fr; }
  .economy-box { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { width: 64px; flex-basis: 64px; }
  .brand-name, .brand-sub, .nav-item span:not(.ic), .side-label, .side-foot span, .sv-btn span:not(.dot) { display: none; }
  .c-msg, .c-action { display: none; }
}
