:root {
  color-scheme: dark;
  font-family: ui-rounded, "Avenir Next", "Segoe UI", system-ui, sans-serif;
  background: #171717;
  color: #e2e5e4;
  --surface: rgba(39, 42, 42, .96);
  --surface-soft: rgba(255, 255, 255, .045);
  --border: rgba(235, 238, 237, .14);
  --border-strong: rgba(235, 238, 237, .22);
  --muted: #8d9692;
  --green: #54b37d;
  --gold: #c8aa61;
  --red: #c2544c;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #171717; }
body {
  min-height: 100vh;
  margin: 0;
  background: #171717;
}
button, input { font: inherit; }
button:focus-visible, input:focus-visible {
  outline: 2px solid rgba(200, 170, 97, .82);
  outline-offset: 2px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.eyebrow { margin: 0; color: var(--muted); font-size: 10px; letter-spacing: .1em; }
.muted { color: var(--muted); }

.quiet-button {
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(54, 58, 58, .82);
  color: #d8dcda;
  cursor: pointer;
}
.quiet-button:hover { border-color: var(--border-strong); background: rgba(72, 77, 76, .92); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 5;
  width: 48px;
  padding: 14px 8px;
  border-right: 1px solid var(--border);
  background: #202020;
}
.sidebar nav { position: fixed; top: 14px; left: 8px; display: flex; width: 32px; margin: 0; padding: 0; flex-direction: column; gap: 12px; }
.sidebar-section { display: flex; width: 32px; margin: 0; padding: 0; flex-direction: column; gap: 5px; }
.sidebar-link {
  display: grid;
  width: 32px;
  height: 34px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #aeb5b2;
  text-decoration: none;
}
.sidebar-link:hover { border-color: var(--border); background: rgba(255, 255, 255, .05); color: #e2e5e4; }
.sidebar-link.active { border-color: rgba(200, 170, 97, .28); background: rgba(200, 170, 97, .12); color: #e2d39f; }
.sidebar-link-disabled { cursor: default; opacity: .48; }
.sidebar-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.sidebar-divider { width: 32px; height: 1px; margin: 2px 0; background: var(--border-strong); }
.dashboard { width: min(1280px, calc(100% - 80px)); margin: 0 16px 0 max(64px, calc(48px + (100vw - 48px - 1280px) / 2)); padding: 26px 0 80px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.toolbar > .muted { margin: 0; font-size: 11px; }
.controls { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.search-control input {
  width: min(320px, 46vw);
  height: 38px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(54, 58, 58, .72);
  color: #e2e5e4;
}
.search-control input::placeholder { color: #7b827f; }
.segmented-control { display: flex; min-height: 38px; align-items: stretch; border: 1px solid var(--border); border-radius: 8px; background: rgba(54, 58, 58, .72); overflow: hidden; }
.segmented-control button { padding: 0 11px; border: 0; border-right: 1px solid var(--border); background: transparent; color: #aeb5b2; font-size: 11px; cursor: pointer; }
.segmented-control button:last-child { border-right: 0; }
.segmented-control button:hover, .segmented-control button[aria-pressed="true"] { background: rgba(200, 170, 97, .16); color: #e2d39f; }
.toggle {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(54, 58, 58, .72);
  color: #bbc1be;
  font-size: 11px;
  cursor: pointer;
}
.toggle input { accent-color: var(--gold); }

.notice, .empty-state {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: #aeb5b2;
  font-size: 13px;
}
.notice.error { border-color: rgba(194, 84, 76, .45); color: #e3a29d; }
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr)); gap: 12px; }
.pin-divider { grid-column: 1 / -1; height: 1px; margin: 8px 0 2px; background: var(--border-strong); }
.server-card {
  position: relative;
  display: flex;
  height: 445px;
  flex-direction: column;
  min-width: 0;
  padding: 16px 16px 14px 19px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .2);
}
.server-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--green);
}
.server-card.offline { opacity: .52; filter: grayscale(.45); }
.server-card.offline::before { background: #707875; }
.server-card > header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.server-name { margin: 0; overflow-wrap: anywhere; color: #edf0ee; font-size: 15px; font-weight: 650; line-height: 1.3; }
.server-meta { margin: 4px 0 0; font-size: 10px; }
.server-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.pin-button {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #8d9692;
  font-size: 17px;
  line-height: 20px;
  cursor: pointer;
}
.pin-button:hover, .pin-button.pinned { border-color: rgba(200, 170, 97, .3); background: rgba(200, 170, 97, .12); color: #e0c87e; }
.server-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 15px 0 13px; }
.server-facts div { min-width: 0; }
.server-facts dt { color: #969d9a; font-size: 9px; font-weight: 600; }
.server-facts dd { margin: 3px 0 0; overflow: hidden; color: #dce0de; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.player-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 7px; }
.server-count { flex: 0 0 auto; color: #e1e4e2; font-size: 12px; }
.server-card.capacity-warn::before { background: var(--gold); }
.server-card.capacity-full::before { background: var(--red); }
.server-count.capacity-warn { color: #d4bd7e; }
.server-count.capacity-full { color: #e3a29d; }
.capacity-bar { height: 3px; flex: 1; overflow: hidden; border-radius: 2px; background: rgba(255, 255, 255, .08); }
.capacity-bar i { display: block; width: 0; height: 100%; background: var(--green); }
.capacity-bar i.capacity-warn { background: var(--gold); }
.capacity-bar i.capacity-full { background: var(--red); }
.player-columns { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 8px; padding: 0 8px 5px; color: #7f8884; font-size: 9px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.player-list { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; gap: 2px; overflow-y: auto; padding: 6px; border: 1px solid rgba(235, 238, 237, .1); border-radius: 6px; background: rgba(29, 32, 35, .72); scrollbar-color: rgba(200, 170, 97, .55) transparent; }
.player-row { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 8px; min-height: 27px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.player-row:last-child { border-bottom: 0; }
.player-cell { display: flex; min-width: 0; align-items: center; gap: 3px; }
.player-link { min-width: 0; overflow: hidden; padding: 4px 3px; color: #d3d8d5; font-size: 10px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.player-link[href] { cursor: pointer; text-decoration: none; }
.player-link[href]:hover { color: #f0e6c6; text-decoration: underline; text-decoration-color: rgba(200, 170, 97, .65); text-underline-offset: 3px; }
.player-link.playfab { color: #aeb7b2; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; }
.copy-button { display: grid; width: 18px; height: 18px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 3px; background: transparent; color: #7f8884; cursor: pointer; }
.copy-button svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.copy-button:hover, .copy-button:focus-visible { background: rgba(200, 170, 97, .12); color: #e0c87e; }
.copy-button:disabled { cursor: default; opacity: .35; }
.no-players { margin: 0; color: #8d9692; font-size: 11px; }
.server-updated { margin-top: auto; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .07); font-size: 9px; }
.empty-state { text-align: center; }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 20; padding: 9px 12px; border: 1px solid rgba(200, 170, 97, .35); border-radius: 7px; background: #252a28; color: #e5e8e6; font-size: 11px; box-shadow: 0 8px 26px rgba(0, 0, 0, .35); }

.charts-dashboard {
  --chart-rule: rgba(235, 238, 237, .11);
  width: min(1500px, calc(100% - 80px));
  margin-left: max(64px, calc(48px + (100vw - 48px - 1500px) / 2));
}
.charts-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.charts-title { margin: 5px 0 5px; color: #eceeed; font-size: clamp(30px, 4vw, 44px); font-weight: 540; letter-spacing: -.035em; }
.charts-heading .muted { margin: 0; font-size: 11px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 54px; border-block: 1px solid var(--chart-rule); }
.metric-card { position: relative; display: grid; gap: 7px; padding: 20px 26px; }
.metric-card:first-child { padding-left: 0; }
.metric-card:not(:last-child)::after { content: ""; position: absolute; inset: 20px 0 20px auto; width: 1px; background: var(--chart-rule); }
.metric-card strong { color: #f0f1f0; font-size: clamp(30px, 4vw, 42px); font-weight: 520; letter-spacing: -.04em; line-height: 1; }
.metric-card .muted { font-size: 10px; }
.chart-section { display: grid; grid-template-columns: minmax(150px, 190px) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); padding: 0 0 52px; }
.chart-section + .chart-section { padding-top: 46px; border-top: 1px solid var(--chart-rule); }
.chart-section-heading { align-self: start; }
.chart-section-heading h2 { max-width: 170px; margin: 8px 0 0; color: #dfe2e0; font-size: 18px; font-weight: 560; line-height: 1.25; letter-spacing: -.015em; }
.chart-grid { display: grid; min-width: 0; }
.chart-grid-overview { grid-template-columns: minmax(0, 1.3fr) minmax(260px, .7fr); column-gap: clamp(30px, 5vw, 68px); row-gap: 42px; }
.chart-grid-rankings { grid-template-columns: minmax(0, 1.25fr) minmax(250px, .75fr); column-gap: clamp(30px, 5vw, 68px); row-gap: 40px; }
.chart-grid-history { grid-template-columns: minmax(0, 1fr); }
.chart-panel { min-width: 0; }
.chart-panel-occupancy { grid-column: 1 / -1; padding-top: 38px; border-top: 1px solid var(--chart-rule); }
.chart-panel-servers { grid-row: span 2; padding-right: clamp(12px, 2vw, 32px); border-right: 1px solid var(--chart-rule); }
.chart-panel-modes { padding-top: 38px; border-top: 1px solid var(--chart-rule); }
.chart-panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.chart-panel-heading h2 { margin: 0; color: #edf0ee; font-size: 14px; font-weight: 620; }
.chart-panel-heading p { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.chart-flex { display: flex; min-height: 210px; align-items: center; gap: clamp(22px, 5vw, 64px); }
.donut-chart { position: relative; width: 190px; height: 190px; flex: 0 0 auto; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.donut-chart::after { display: none; }
.donut-center { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; justify-items: center; }
.donut-center strong { color: #eceeed; font-size: 24px; font-weight: 650; }
.donut-center span { color: var(--muted); font-size: 10px; }
.chart-legend { display: grid; min-width: 0; flex: 1; gap: 9px; }
.legend-row { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 8px; align-items: center; border: 0; padding: 0; background: transparent; color: #cbd0ce; font-size: 10px; text-align: left; cursor: pointer; }
.legend-row:hover, .legend-row:focus-visible { color: #f0f1f0; }
.legend-row.is-muted { opacity: .42; }
.legend-row strong { color: #e2e5e4; font-size: 10px; font-weight: 500; white-space: nowrap; }
.legend-swatch { width: 8px; height: 8px; border-radius: 2px; }
.bar-list { display: grid; gap: 16px; }
.bar-row { min-width: 0; }
.bar-heading { display: flex; justify-content: space-between; gap: 12px; color: #cbd0ce; font-size: 11px; }
.bar-heading span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-heading strong { flex: 0 0 auto; color: #e2e5e4; font-size: 11px; font-weight: 550; }
.bar-track { height: 5px; margin-top: 7px; overflow: hidden; background: rgba(255, 255, 255, .08); }
.bar-track i { display: block; height: 100%; min-width: 2px; border-radius: inherit; }
.bar-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.chart-empty { margin: 0; color: var(--muted); font-size: 11px; }
.trend-chart { min-width: 0; }
.chart-canvas-wrap { position: relative; width: 100%; min-height: 190px; }
.chart-canvas { display: block; width: 100% !important; height: 100% !important; }
.chart-range-controls { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.chart-range-controls button { border: 0; padding: 3px 5px; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
.chart-range-controls button:hover, .chart-range-controls button:focus-visible, .chart-range-controls button.active { color: #eceeed; }
.chart-range-controls button.active { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; }
.trend-svg { display: block; width: 100%; height: auto; min-height: 190px; overflow: visible; }
.trend-axis { stroke: rgba(235, 238, 237, .16); stroke-width: 1; }
.trend-label { fill: var(--muted); font-size: 10px; }
.trend-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 4px; color: #bbc1be; font-size: 10px; }
.trend-legend span { display: inline-flex; align-items: center; gap: 5px; }
.trend-legend i { width: 8px; height: 8px; border-radius: 50%; }
.trend-legend small { margin-left: auto; color: var(--muted); font-size: 9px; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 340px; }
.login-card .brand-mark { width: 62px; height: 62px; margin-bottom: 20px; border-radius: 15px; font-size: 17px; }
.login-card h1 { margin: 5px 0 8px; font-size: 25px; font-weight: 600; }
.login-copy { margin: 0 0 24px; color: #8d9692; font-size: 13px; line-height: 1.5; }
.login-card label { display: block; margin-bottom: 7px; color: #c8cdca; font-size: 12px; }
.login-card input, .login-card button { width: 100%; height: 43px; border-radius: 10px; }
.login-card input { border: 1px solid var(--border-strong); padding: 0 13px; background: #1b1e1d; color: #eee; }
.login-card button { margin-top: 10px; border: 1px solid #ddd; border-radius: 999px; background: #eee; color: #111; cursor: pointer; }
.login-card button:hover { background: #fff; }
.login-card #discord-login { display: grid; place-items: center; min-height: 43px; margin: 16px 0; border-radius: 999px; background: #5865f2; color: #fff; font-weight: 600; text-decoration: none; }
.login-card #discord-login:hover { background: #6874f5; }
.error { margin: 14px 0 0; color: #e88; font-size: 11px; }

@media (max-width: 780px) {
  .dashboard { width: calc(100% - 80px); margin: 0 16px 0 64px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .controls { justify-content: flex-start; }
  .search-control { width: 100%; }
  .search-control input { width: 100%; }
  .server-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts-heading { align-items: stretch; flex-direction: column; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 40px; }
  .metric-card { padding: 17px 14px; }
  .metric-card:first-child { padding-left: 0; }
  .metric-card strong { font-size: clamp(25px, 7vw, 34px); }
  .metric-card .muted { display: none; }
  .chart-section { grid-template-columns: 1fr; gap: 28px; padding-bottom: 42px; }
  .chart-section + .chart-section { padding-top: 38px; }
  .chart-section-heading h2 { max-width: none; }
  .chart-grid-overview, .chart-grid-rankings { grid-template-columns: 1fr; row-gap: 36px; }
  .chart-panel-occupancy, .chart-panel-modes { grid-column: auto; padding-top: 34px; }
  .chart-panel-types { padding-top: 34px; border-top: 1px solid var(--chart-rule); }
  .chart-panel-servers { grid-row: auto; padding-right: 0; padding-bottom: 34px; border-right: 0; border-bottom: 1px solid var(--chart-rule); }
  .chart-flex { align-items: flex-start; flex-direction: column; }
  .chart-legend { width: 100%; }
  .trend-legend small { margin-left: 0; }
}

@media (max-width: 480px) {
  .dashboard { width: calc(100% - 74px); margin: 0 10px 0 64px; padding-top: 28px; }
  .server-card { padding: 14px 12px 12px 16px; }
}

.login-card .remember-login { display: flex; align-items: center; gap: 9px; margin: 16px 0 6px; }
.login-card .remember-login input { width: 16px; height: 16px; padding: 0; accent-color: #c8aa61; }

.account-card { max-width: 360px; }
.account-card button:focus-visible, .account-card input:focus-visible { outline-color: #aaa; }
.account-help { margin: 22px 0 16px; color: #aeb5b2; font-size: 13px; line-height: 1.5; }
.link-code-panel { margin-top: 16px; padding: 14px; border: 1px solid #424242; border-radius: 10px; background: #1d1d1d; }
.link-code-panel[hidden] { display: none; }
.link-code-row { display: flex; gap: 8px; }
.login-card .link-code-row input { min-width: 0; height: 46px; flex: 1; border: 1px solid #4b4b4b; border-radius: 8px; background: #151515; color: #f1f1f1; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 15px; font-weight: 700; letter-spacing: .01em; text-align: center; cursor: text; }
.login-card .link-code-row button { width: 74px; height: 46px; flex: 0 0 auto; margin: 0; border: 1px solid #595959; border-radius: 8px; background: #343434; color: #f1f1f1; font-size: 12px; font-weight: 700; }
.login-card .link-code-row button:hover { background: #444; }
.login-card .link-code-row button:disabled { cursor: not-allowed; opacity: .5; }
.link-expiry { margin: 10px 0 0; color: #aeb5b2; font-size: 11px; }
.link-result { min-height: 16px; margin: 10px 0 0; color: #aeb5b2; font-size: 11px; }
.account-deployment { margin-top: 28px; }
.account-deployment pre { max-height: 220px; overflow: auto; font-size: 10px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
