:root {
  --bg: #0d1014; --panel: #151a20; --panel2: #1c222a; --panel3: #232a33; --line: #262e38;
  --text: #e6e9ee; --muted: #8b95a3; --accent: #d9822b; --accent2: #f0a050; --blue: #5b9cf0;
  --good: #3fb950; --bad: #f85149; --warn: #d29922; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }

/* Dark scrollbars everywhere (no white bars) */
* { scrollbar-color: #3a4350 transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3a4350; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; }
h1, h2, h3 { margin: 0; }
h1 { font-size: 20px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; font-weight: 650; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand > div { display: flex; flex-direction: column; line-height: 1.25; }
.logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #111; font-weight: 800; letter-spacing: .5px; flex: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.flush { padding: 0; overflow: auto; }
.card-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 10px; }
.card-head.pad { padding: 14px 16px 0; }

label { display: block; margin: 12px 0 0; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
label .muted { text-transform: none; font-weight: 400; letter-spacing: 0; }
label.check { display: flex; align-items: center; gap: 6px; margin: 0; text-transform: none; font-weight: 500; font-size: 13px; letter-spacing: 0; cursor: pointer; }
label.check input { width: auto; margin: 0; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 9px 11px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px; outline: none; text-transform: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }

.btn { font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3a4350; background: var(--panel3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.wide { width: 100%; margin-top: 18px; padding: 11px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--accent2); font: inherit; font-size: 12px; cursor: pointer; padding: 0; }
.link:hover { text-decoration: underline; }

.error { color: var(--bad); min-height: 1em; margin: 10px 0 0; }
.warn { color: var(--warn); margin: 12px 0 0; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; padding: 28px; }
.auth-card .brand { margin-bottom: 8px; }

/* layout */
#app { display: flex; min-height: 100vh; }
.side { width: 230px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { padding: 16px; border-bottom: 1px solid var(--line); }
#tabs { flex: 1; overflow-y: auto; padding: 8px; }
.nav-group { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; padding: 14px 10px 6px; }
#tabs button { display: flex; align-items: center; gap: 10px; width: 100%; font: inherit; text-align: left; background: none; border: 0; color: var(--muted); padding: 8px 10px; border-radius: 7px; cursor: pointer; }
#tabs button:hover { background: var(--panel2); color: var(--text); }
#tabs button.active { background: var(--panel3); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.ico { width: 16px; text-align: center; opacity: .8; }
.count { margin-left: auto; font-size: 11px; background: var(--panel3); border-radius: 99px; padding: 0 7px; color: var(--text); }
.count:empty { display: none; }
.side-foot { border-top: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 22px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.menu-btn { display: none; }
.spacer { flex: 1; }
.grow { flex: 1; margin: 0; }
.status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status.on .dot { background: var(--good); box-shadow: 0 0 0 3px rgba(63,185,80,.2); }
.status.off .dot { background: var(--bad); }
.who { color: var(--muted); font-size: 13px; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; color: var(--text); white-space: nowrap; }
.pill.police { color: #8fc1ff; border-color: #2d4a6b; }
.pill.good { color: var(--good); border-color: #23462c; }
.pill.bad { color: var(--bad); border-color: #5a2a29; }
.pill.warn { color: var(--warn); border-color: #4d3d1a; }

main { padding: 22px; width: 100%; max-width: 1320px; margin: 0 auto; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { max-width: 320px; margin: 0; }
.wide-search { max-width: 520px; }
.grid2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start; margin-bottom: 16px; }
.grid2.even { grid-template-columns: 1fr 1fr; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
#tab-admins .grid2 { grid-template-columns: 1fr 380px; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { margin-top: 0; }
.row.end { justify-content: flex-end; margin-top: 18px; }

/* segmented control */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { font: inherit; font-size: 13px; background: none; border: 0; color: var(--muted); padding: 4px 11px; border-radius: 6px; cursor: pointer; }
.seg button.on { background: var(--panel3); color: var(--text); }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .k { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.tile .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tile.click { cursor: pointer; }
.tile.click:hover { border-color: #3a4350; }

/* charts */
.chart { position: relative; height: 190px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .empty-chart { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.tooltip { position: fixed; pointer-events: none; background: var(--panel3); border: 1px solid #3a4350; border-radius: 7px; padding: 6px 10px; font-size: 12px; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.4); white-space: nowrap; }
.tooltip b { font-size: 14px; }

/* feeds */
.feed ul { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.feed li:first-child { border-top: 0; }
.feed li .t { color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
.feed .none { color: var(--muted); }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; background: var(--panel2); position: sticky; top: 0; z-index: 1; }
tr:last-child td { border-bottom: 0; }
tbody.clickable tr { cursor: pointer; }
tbody.clickable tr:hover td { background: var(--panel2); }
td select { width: auto; min-width: 100px; margin-top: 0; padding: 5px 8px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 4px; }
td .sub, .sub { display: block; color: var(--muted); font-size: 12px; font-family: ui-monospace, Consolas, monospace; }
td .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
td .tags { margin-top: 3px; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.empty { padding: 30px; text-align: center; color: var(--muted); margin: 0; }
.rankbadge { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px; border-radius: 6px; background: #1d3149; color: #8fc1ff; font-weight: 700; font-size: 12px; margin-right: 8px; }

/* logs */
.logbox { max-height: calc(100vh - 210px); }
#logLines div { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; padding: 5px 14px; border-bottom: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; }
#logLines div:hover { background: var(--panel2); }
#logLines .t, .minilog .t { color: var(--muted); }
#logLines mark { background: rgba(217,130,43,.3); color: inherit; border-radius: 2px; }
.minilog div { font-family: ui-monospace, Consolas, monospace; font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); word-break: break-word; }

/* drawer (player profile) */
.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 20; display: flex; justify-content: flex-end; }
.drawer-panel { width: 100%; max-width: 720px; height: 100%; background: var(--bg); border-left: 1px solid var(--line); display: flex; flex-direction: column; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: flex-start; gap: 8px; padding: 18px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 20px; }
.drawer-head .tags { margin: 6px 0 4px; }
.drawer-body { overflow-y: auto; padding: 18px 20px 40px; }
.pstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.pstats .tile { padding: 10px 12px; }
.pstats .tile .v { font-size: 17px; }
.pactions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.pactions .grp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pactions .grp > span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; width: 88px; }
.psec { margin-top: 22px; }
.note-form { display: flex; gap: 8px; margin-bottom: 10px; }
.note-form select { width: 120px; margin: 0; flex: none; }
.note-form input { margin: 0; }
.notes { list-style: none; margin: 0; padding: 0; }
.notes li { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: 7px; padding: 8px 12px; margin-bottom: 8px; display: flex; gap: 10px; align-items: flex-start; }
.notes li.warning { border-left-color: var(--warn); }
.notes li .body { flex: 1; }
.notes li .meta { color: var(--muted); font-size: 12px; }
.notes .none, .psec .none { color: var(--muted); font-size: 13px; }
.rec-sum { display: flex; gap: 14px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.rec-sum b { color: var(--text); }
.psec table td, .psec table th { padding: 7px 10px; font-size: 13px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 20px; z-index: 30; }
.modal-card { width: 100%; max-width: 460px; max-height: calc(100vh - 40px); overflow-y: auto; }
.modal-card h3 { margin-bottom: 2px; font-size: 16px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.presets button { font: inherit; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 2px 10px; cursor: pointer; }
.presets button:hover { color: var(--text); border-color: #3a4350; }
.pick { margin-top: 6px; border: 1px solid var(--line); border-radius: 7px; max-height: 200px; overflow-y: auto; background: var(--bg); text-transform: none; letter-spacing: 0; font-weight: 400; }
.pick button { display: block; width: 100%; text-align: left; font: inherit; font-size: 13px; color: var(--text); background: none; border: 0; border-bottom: 1px solid var(--line); padding: 7px 10px; cursor: pointer; }
.pick button:hover { background: var(--panel2); }
.pick button .sub { display: inline; margin-left: 6px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel3); border: 1px solid var(--line); padding: 11px 18px; border-radius: 8px; z-index: 60; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.bad { border-color: var(--bad); }

@media (max-width: 1000px) {
  .grid3 { grid-template-columns: 1fr; }
  .grid2, .grid2.even, #tab-admins .grid2 { grid-template-columns: 1fr; }
  .pstats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .side { position: fixed; left: 0; z-index: 15; transform: translateX(-100%); transition: transform .15s; }
  #app.menu-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  .menu-btn { display: inline-block; }
  main { padding: 14px; }
  .topbar { padding: 10px 14px; }
}

/* "Sign in to RP / Sign in to PVP" switch on the login page */
.panel-switch { display: flex; gap: 4px; padding: 4px; margin: -8px 0 20px; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; }
.panel-switch a, .panel-switch span { flex: 1; text-align: center; padding: 8px 10px; border-radius: 7px; font-weight: 600; font-size: 13px; text-decoration: none; }
.panel-switch a { color: #9aa4b2; }
.panel-switch a:hover { color: #fff; background: rgba(255,255,255,.06); }
.panel-switch .on { background: var(--accent); color: #0d1014; }