/* dark block layout */
:root {
  --bg: #0a0c11;
  --panel: #12151d;
  --panel-2: #171b25;
  --line: #222838;
  --line-2: #2c3346;
  --text: #e7eaf1;
  --muted: #8a93a8;
  --faint: #5b6377;
  --accent: #7c8cff;
  --active: #22c55e;
  --active-dim: rgba(34, 197, 94, .14);
  --bgstate: #f2b01e;
  --bgstate-dim: rgba(242, 176, 30, .14);
  --offline: #ef4444;
  --offline-dim: rgba(239, 68, 68, .14);
  --nodata: #2b3242;
  --radius: 16px;
  --radius-sm: 10px;
  --gap: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, rgba(124, 140, 255, .08), transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { color: var(--faint); padding: 10px 0; list-style: none; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px clamp(16px, 3vw, 28px);
  background: rgba(10, 12, 17, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar form { margin: 0; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); transition: background .3s; }
.live-dot.on { background: var(--active); box-shadow: 0 0 0 4px var(--active-dim); }
.wrap { max-width: 1320px; margin: 0 auto; padding: 20px clamp(16px, 3vw, 28px) 48px; }

/* buttons, tabs */
.btn {
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel-2);
  color: var(--text); font: inherit; padding: 8px 14px; cursor: pointer;
}
.btn:hover { border-color: var(--faint); }
.btn-ghost { background: transparent; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0b0d14; font-weight: 650; }
.btn-primary:hover { filter: brightness(1.08); }
.tabs { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tab { border: 0; background: transparent; color: var(--muted); font: inherit; padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.tab.is-on { background: var(--line-2); color: var(--text); }

/* cards */
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin-right: auto; }

/* states */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.s-active { background: var(--active); }
.s-background { background: var(--bgstate); }
.s-offline { background: var(--offline); }
.s-nodata { background: var(--nodata); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.active { background: var(--active-dim); color: var(--active); }
.pill.background { background: var(--bgstate-dim); color: var(--bgstate); }
.pill.offline { background: var(--offline-dim); color: var(--offline); }

/* KPI row */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.kpi-label { color: var(--muted); font-size: 12px; display: flex; align-items: center; }
.kpi-value { font-size: 28px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* overview tiles */
.users-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--gap); }
.user-tile { display: flex; flex-direction: column; gap: 10px; transition: border-color .2s, transform .2s; }
.user-tile:hover { border-color: var(--line-2); transform: translateY(-1px); }
.user-tile.st-active { border-color: rgba(34, 197, 94, .35); }
.ut-head { display: flex; align-items: center; gap: 8px; }
.ut-name { font-weight: 650; font-size: 15px; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ut-rate { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ut-rate.dim { color: var(--faint); }
.ut-line { color: var(--muted); font-size: 13px; min-height: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ut-foot { display: flex; justify-content: space-between; color: var(--faint); font-size: 12px; gap: 8px; }
.disabled-tag { font-size: 11px; color: var(--offline); border: 1px solid var(--offline-dim); border-radius: 6px; padding: 0 6px; }

/* activity strip (last hour) */
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; height: 16px; }
.strip i { border-radius: 2px; background: var(--nodata); }
.strip i.active { background: var(--active); }
.strip i.background { background: var(--bgstate); opacity: .75; }
.strip i.offline { background: #1d2230; }
.strip-lg { height: 22px; margin-top: 10px; }

/* user page */
.user-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: var(--gap); }
.back { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 18px; }
.back:hover { border-color: var(--line-2); }
.rate { font-weight: 700; font-variant-numeric: tabular-nums; }
.bento { display: grid; grid-template-columns: 1.1fr 1.1fr 1fr 1.4fr; gap: var(--gap); margin-bottom: var(--gap); }
.tile { display: flex; flex-direction: column; }
.tile-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.tile-value { font-size: 26px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.tile-value-sm { font-size: 18px; line-height: 1.3; }
.tile-sub { color: var(--muted); margin-top: 4px; }
.tile-foot { margin-top: auto; padding-top: 10px; font-size: 12px; color: var(--muted); }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #a78bfa); border-radius: 99px; transition: width .4s; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 8px 0 0; }
.facts dt { color: var(--muted); font-size: 12px; padding-top: 2px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts code { font-family: var(--mono); font-size: 12.5px; }

.chart-card { margin-bottom: var(--gap); }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.chart { height: 300px; width: 100%; }
.chart-totals { font-size: 12px; margin: -4px 0 6px; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-bottom: var(--gap); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.toggle { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* sessions list */
.spells, .feed, .bars, .list { list-style: none; margin: 0; padding: 0; }
.spells { max-height: 460px; overflow-y: auto; }
.spells li { padding: 9px 0; border-top: 1px solid var(--line); }
.spells li:first-child { border-top: 0; }
.spells .day { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding-top: 14px; border-top: 0; }
.sp-main { display: flex; align-items: baseline; gap: 10px; }
.sp-span { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 108px; }
.sp-meta { color: var(--muted); }
.sp-services { color: var(--muted); font-size: 12.5px; margin-top: 2px; padding-left: 118px; }
.spells li.bg .sp-span { color: var(--bgstate); font-weight: 500; }
.spells li.bg { opacity: .85; }
.spells li.wake { padding: 3px 0 3px 18px; border-top: 0; font-size: 12.5px; color: var(--muted); }

/* live feed */
.feed { max-height: 460px; overflow-y: auto; }
.feed li { display: flex; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.feed li:first-child { border-top: 0; }
.feed .t { color: var(--faint); font-family: var(--mono); font-size: 12px; min-width: 64px; }
.feed .n { color: var(--faint); margin-left: auto; font-size: 12px; }
.feed li.fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: rgba(124, 140, 255, .14); } to { background: transparent; } }

/* resources bars */
.bars li { display: grid; grid-template-columns: minmax(110px, 200px) 1fr auto; align-items: center; gap: 12px; padding: 5px 0; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 99px; }
.bar-fill.c-video { background: #f472b6; } .bar-fill.c-social { background: #60a5fa; }
.bar-fill.c-messenger { background: #34d399; } .bar-fill.c-music { background: #fbbf24; }
.bar-fill.c-search { background: #a78bfa; } .bar-fill.c-gaming { background: #fb7185; }
.bar-fill.c-betting { background: #f97316; }
.bar-val { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; min-width: 90px; text-align: right; }

/* simple lists */
.list li { padding: 8px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.li-main { display: flex; gap: 8px; align-items: baseline; }
.li-main code { font-family: var(--mono); font-size: 12.5px; }
.li-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.attribution { margin-top: 10px; }
.attribution a { color: var(--faint); }

/* login */
.login { min-height: calc(100vh - 60px); display: grid; place-items: center; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 26px; }
.login-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.login input {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  color: var(--text); font: 15px var(--font); padding: 10px 12px;
}
.login input:focus { outline: 2px solid rgba(124, 140, 255, .45); border-color: var(--accent); }
.login input[name="code"] { font-family: var(--mono); letter-spacing: .3em; font-size: 18px; }
.login .btn { padding: 11px; margin-top: 4px; }
.error { color: #fca5a5; background: var(--offline-dim); border-radius: var(--radius-sm); padding: 8px 12px; margin: 0; }
.notice { color: #fde68a; background: var(--bgstate-dim); border-radius: var(--radius-sm); padding: 8px 12px; margin: 0; }

/* chart tooltip (ECharts html tooltip) */
.tt-time { color: var(--muted); font-size: 12px; }
.tt-val { font-weight: 650; }

@media (max-width: 1100px) {
  .bento { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento, .cols, .cols-3 { grid-template-columns: 1fr; }
  .chart { height: 240px; }
  .sp-services { padding-left: 0; }
  .bars li { grid-template-columns: minmax(90px, 1fr) 1fr; }
  .bar-val { grid-column: 1 / -1; text-align: left; }
}
