:root {
  color-scheme: light;
  --bg: #f6f7f7;
  --surface: #fff;
  --raised: #edf0f2;
  --text: #20282e;
  --muted: #586772;
  --border: #d8e0e5;
  --blue: #4d7fae;
  --green: #566b48;
  --amber: #946000;
  --danger: #ad3039;
  --chart: #6f9cc9;
  --shadow: 0 4px 18px #19263106;
  --nav-active: #6f9cc919;
}
html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0d1013;
  --surface: #151a1f;
  --raised: #1d252d;
  --text: #e6e8e8;
  --muted: #a2abb1;
  --border: #2b353f;
  --blue: #8db2d7;
  --green: #a6bf95;
  --amber: #fcb539;
  --danger: #f08c93;
  --shadow: 0 4px 18px #00000016;
  --nav-active: #6f9cc91a;
}
@media (prefers-color-scheme: dark) {
  html[data-theme='system'] {
    color-scheme: dark;
    --bg: #0d1013;
    --surface: #151a1f;
    --raised: #1d252d;
    --text: #e6e8e8;
    --muted: #a2abb1;
    --border: #2b353f;
    --blue: #8db2d7;
    --green: #a6bf95;
    --amber: #fcb539;
    --danger: #f08c93;
    --shadow: 0 4px 18px #00000016;
    --nav-active: #6f9cc91a;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    15px/1.6 Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button,
a,
select,
input {
  touch-action: manipulation;
}
button,
select {
  cursor: pointer;
}
button {
  border: 0;
}
a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button,
select,
input {
  border-radius: 8px;
  min-height: 42px;
}
input,
select {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
}
button {
  padding: 9px 15px;
  transition: background 0.15s;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -0.035em;
  font-weight: 650;
}
h2 {
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  font-weight: 620;
}
small {
  font-size: 12px;
}
select {
  max-width: 100%;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.skip {
  position: fixed;
  top: -80px;
  left: 16px;
  background: var(--surface);
  padding: 12px;
  z-index: 10;
}
.skip:focus {
  top: 10px;
}
.topbar {
  height: 84px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 34px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  font-size: 21px;
  font-weight: 750;
  letter-spacing: 0.15em;
  line-height: 1.1;
}
.brand:hover {
  text-decoration: none;
}
.brand img {
  border-radius: 8px;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.14em;
  font-weight: 500;
  margin-top: 8px;
}
.preferences {
  display: flex;
  align-items: center;
  gap: 10px;
}
.preferences select {
  min-height: 36px;
  padding: 5px 9px;
  font-size: 12px;
}
.quiet {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.quiet:hover {
  background: var(--raised);
}
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #4d7fae;
  color: white;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 8px;
}
.primary:hover {
  background: #3d6d99;
  text-decoration: none;
}
.secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
}
.secondary:hover {
  background: var(--raised);
}
.danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 13px;
}
.danger:hover {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}
main:has(> .welcome:not([hidden])) {
  min-height: calc(100svh - 84px);
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
.welcome {
  width: min(100%, 460px);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.welcome-art {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 2;
  border-bottom: 1px solid var(--border);
}
.welcome-copy {
  padding: 30px 32px 32px;
}
.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  color: var(--muted);
}
.welcome h1 {
  font-size: 28px;
  margin: 12px 0;
}
.welcome-copy > p {
  color: var(--muted);
  font-size: 14px;
}
.login {
  width: 100%;
  min-height: 48px;
  margin-top: 26px;
  gap: 12px;
  background: #3d6d99;
}
.login:hover {
  background: #315b82;
}
.welcome .fine {
  font-size: 12px;
  margin-top: 12px;
  text-align: center;
}
.welcome-copy .login-access {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding-top: 20px;
  font-size: 12px;
}
.login-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 16px;
  font-size: 12px;
}
.login-links a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 84px);
}
.sidebar {
  padding: 34px 20px 24px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.sidebar-caption {
  font-size: 9px;
  color: var(--muted);
  font-weight: 650;
  letter-spacing: 0.15em;
  padding: 0 14px 20px;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.nav-item {
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 11px 14px;
  width: 100%;
}
.nav-item > span:first-child {
  font-size: 20px;
  line-height: 1;
}
.nav-item:hover {
  background: var(--raised);
}
.nav-item.active {
  background: var(--nav-active);
  color: var(--blue);
  font-weight: 650;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 90px 12px 0;
  color: var(--muted);
  font-size: 11px;
}
.sidebar-bottom small {
  display: block;
  font-size: 10px;
  margin-top: 8px;
}
.online-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  margin-right: 6px;
}
.content {
  max-width: 1550px;
  width: 100%;
  margin: 0 auto;
  padding: 37px 38px 20px;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
}
.page-header h1 {
  margin: 8px 0 10px;
}
.overview-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.overview-tabs button {
  color: var(--muted);
  background: transparent;
  border-radius: 6px 6px 0 0;
  border-bottom: 2px solid transparent;
  padding: 10px 18px;
}
.overview-tabs button:hover:not(:disabled) {
  background: var(--raised);
}
.overview-tabs button[aria-selected='true'] {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 650;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--green);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
  margin-top: 32px;
}
.filters {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 17px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 170px;
}
.field label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 650;
}
.field select {
  font-size: 12px;
}
.guild-field {
  min-width: 250px;
}
.guild-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.guild-status {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--muted);
  background: var(--raised);
}
#guild option.inactive-server,
#guild.has-inactive-selection {
  color: var(--muted);
}
.filters > button {
  margin-left: auto;
}
.freshness {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  font-size: 10px;
  color: var(--muted);
  margin: 15px 2px 22px;
}
.notice {
  padding: 11px 15px;
  border: 1px solid color-mix(in srgb, var(--amber) 38%, var(--border));
  color: var(--amber);
  border-radius: 8px;
  font-size: 12px;
  background: color-mix(in srgb, var(--amber) 5%, var(--surface));
  margin-top: 16px;
}
.notice.error {
  color: var(--danger);
  border-color: var(--danger);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.metric {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.metric > span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 550;
}
.metric strong {
  display: block;
  font-size: 35px;
  letter-spacing: -0.05em;
  line-height: 1.4;
  margin: 6px 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.metric small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.chart-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}
.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 24px;
}
.card-heading p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}
.legend {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.legend i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--chart);
}
.chart {
  height: 245px;
}
.chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.chart .gridline {
  stroke: var(--border);
  stroke-width: 1;
}
.chart .axis {
  fill: var(--muted);
  font: 10px system-ui;
}
.chart .bar {
  fill: var(--chart);
}
.chart .bar:hover {
  fill: var(--green);
}
.channel-bars {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 2px 0;
  max-height: 245px;
  overflow: auto;
}
.channel-row .channel-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  margin-bottom: 8px;
}
.channel-caption .channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}
.channel-caption strong {
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bar-track {
  height: 6px;
  background: var(--raised);
  border-radius: 5px;
  overflow: hidden;
}
.bar-fill {
  height: 6px;
  background: #8aa07a;
  border-radius: 5px;
}
.empty {
  padding: 35px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
}
.empty > span {
  font-size: 42px;
  color: var(--blue);
}
.empty p {
  font-size: 12px;
  color: var(--muted);
  margin: 10px auto 0;
  max-width: 470px;
}
#people-card,
#admin-card {
  margin-bottom: 20px;
}
.exports {
  display: flex;
  gap: 8px;
}
.exports button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 11px;
}
.table-scroll {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 12px;
}
th {
  text-align: left;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  padding: 0 12px 13px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 15px 12px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td {
  border-bottom: none;
}
td:first-child {
  font-weight: 600;
}
td:nth-child(2),
td:last-child {
  color: var(--muted);
  font-size: 11px;
}
.fine {
  font-size: 11px;
  color: var(--muted);
  margin-top: 12px;
}
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.help {
  align-self: start;
  padding: 18px 22px;
}
.help summary {
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.help p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
}
.help button {
  margin-top: 15px;
  margin-right: 6px;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  margin-top: 16px;
}
.check input {
  min-height: 18px;
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}
.buffer-status {
  display: flex;
  gap: 35px;
  color: var(--muted);
  font-size: 12px;
}
.buffer-status strong {
  color: var(--text);
  font-size: 20px;
  display: block;
  font-variant-numeric: tabular-nums;
}
footer {
  display: flex;
  gap: 20px;
  align-items: center;
  margin: 35px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--muted);
}
footer > span:first-child {
  font-weight: 750;
  letter-spacing: 0.12em;
}
footer a {
  margin-left: auto;
}
dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px;
  max-width: 470px;
  width: calc(100vw - 32px);
}
dialog::backdrop {
  background: #0009;
}
dialog p {
  font-size: 13px;
  color: var(--muted);
  margin: 15px 0 20px;
}
dialog label {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
}
dialog input {
  width: 100%;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}
@media (max-width: 1200px) {
  .content {
    padding: 30px 24px;
  }
  .workspace {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .filters {
    flex-wrap: wrap;
  }
  .guild-field {
    min-width: 200px;
  }
  .metric {
    padding: 16px;
  }
  .metric strong {
    font-size: 29px;
  }
  .chart-grid {
    grid-template-columns: 1.3fr 1fr;
  }
}
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .sidebar {
    padding: 12px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar nav {
    flex-direction: row;
  }
  .sidebar-caption,
  .sidebar-bottom {
    display: none;
  }
  .nav-item {
    width: auto;
    font-size: 12px;
  }
  .chart-grid {
    grid-template-columns: 1fr;
  }
  .chart {
    height: 230px;
  }
  .guild-field {
    flex: 1;
  }
  .bottom-grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 0 22px;
  }
}
@media (max-width: 600px) {
  .topbar {
    min-height: 74px;
    height: auto;
    padding: 12px 15px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .brand {
    font-size: 17px;
    gap: 8px;
  }
  .brand small {
    font-size: 7px;
  }
  .brand img {
    width: 35px;
    height: 35px;
  }
  .preferences {
    gap: 5px;
    flex-wrap: wrap;
    max-width: 100%;
    margin-left: auto;
  }
  .preferences select {
    font-size: 10px;
    padding: 4px;
  }
  .preferences button {
    font-size: 10px;
    padding: 4px 7px;
    min-height: 34px;
  }
  .content {
    padding: 25px 16px;
  }
  .page-header {
    flex-direction: column;
    gap: 0;
  }
  .badge {
    margin-top: 12px;
  }
  .page-header h1 {
    font-size: 28px;
  }
  .filters {
    padding: 14px;
    gap: 12px;
  }
  .field {
    min-width: 0;
    flex: 1;
    flex-basis: 40%;
  }
  .guild-field {
    flex-basis: 100%;
  }
  .filters > button {
    margin-left: 0;
    width: 100%;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .metric {
    padding: 15px 12px;
  }
  .metric strong {
    font-size: 28px;
  }
  .metric small {
    font-size: 9px;
  }
  .card {
    padding: 18px 16px;
  }
  .card-heading {
    gap: 12px;
  }
  .card-heading h2 {
    font-size: 15px;
  }
  .card-heading .exports {
    flex-direction: column;
  }
  .freshness {
    flex-direction: column;
    gap: 4px;
  }
  main:has(> .welcome:not([hidden])) {
    min-height: calc(100svh - 74px);
    padding: 24px 16px;
  }
  .welcome-copy {
    padding: 28px 24px;
  }
  .sidebar {
    padding: 10px;
  }
  .nav-item {
    padding: 8px;
    font-size: 11px;
    gap: 5px;
  }
  .nav-item > span:first-child {
    font-size: 16px;
  }
  .chart-grid {
    gap: 16px;
  }
  .chart {
    height: 210px;
  }
  .buffer-status {
    gap: 20px;
  }
  footer {
    gap: 12px;
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.hourly-card {
  margin-bottom: 20px;
}
.pagination {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

#segments-card {
  margin-bottom: 20px;
}
.content,
.card,
.table-scroll {
  min-width: 0;
}
.skip:not(:focus) {
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  padding: 0;
}
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .chart-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Preserve the PICKET palette while keeping controls and small text legible. */
:root {
  --blue: #426f98;
  --chart: #5f8dba;
  --control-border: #85919b;
  --channel-fill: #718462;
}
html[data-theme='dark'] {
  --blue: #8db2d7;
  --chart: #6f9cc9;
  --control-border: #61717e;
  --channel-fill: #8aa07a;
}
@media (prefers-color-scheme: dark) {
  html[data-theme='system'] {
    --blue: #8db2d7;
    --chart: #6f9cc9;
    --control-border: #61717e;
    --channel-fill: #8aa07a;
  }
}
input,
select {
  border-color: var(--control-border);
}
.primary {
  background: #426f98;
}
.bar-fill {
  background: var(--channel-fill);
}
.check {
  min-height: 32px;
}
.chart { position: relative; }
.chart:has(> .series-legend) { height: auto; }
.chart:has(> .series-legend) > svg { display: block; height: auto; }
.chart-grid > .hourly-card { margin-bottom: 0; }
.series-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; max-height: 100px; overflow: auto; padding: 8px 4px; font-size: 11px; color: var(--muted); }
.series-legend span { display: inline-flex; gap: 7px; align-items: center; min-width: 0; overflow-wrap: anywhere; }
.series-legend i { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; }
.series-tooltip { position: absolute; top: 6px; right: 6px; max-width: calc(100% - 12px); padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; pointer-events: none; }
.chart svg:focus-visible, .series-legend:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
#server-summary { margin-bottom: 20px; }
.instance-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.instance-total, .instance-help { margin-bottom: 20px; }
.instance-help { margin-top: 20px; }
