:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --paper: #f6eee4;
  --surface: #fffaf4;
  --ink: #33251e;
  --muted: #715d50;
  --line: #e6d6c6;
  --accent: #8a4c30;
  --accent-hover: #723c25;
  --tint: #f6e9db;
  --shadow: 0 14px 34px #5734190b, 0 2px 6px #57341908;
  --display: "Songti SC", "Noto Serif CJK SC", SimSun, Georgia, serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 0, #fff9f0 0, transparent 36rem),
    radial-gradient(ellipse at 93% 18%, #eedbc9 0, transparent 36rem),
    var(--paper);
}

main {
  max-width: 55rem;
  margin-inline: auto;
  padding: clamp(1.15rem, 5vw, 4rem);
}

h1, h2, h3, p { margin: 0; }
p { line-height: 1.65; }
h1 {
  font: 700 clamp(1.85rem, 5vw, 2.75rem)/1.25 var(--display);
  letter-spacing: .025em;
}
h2 { font-size: 1.18rem; line-height: 1.4; }

.kicker {
  color: var(--accent);
  font-size: .71rem;
  font-weight: 750;
  letter-spacing: .16em;
}

.monogram {
  display: grid;
  place-items: center;
  width: 3rem;
  aspect-ratio: 1;
  margin-inline: auto;
  border: 1px solid #d9bda7;
  border-radius: .85rem;
  color: var(--accent);
  background: #fff7eb;
  font: italic 700 1.65rem/1 Georgia, serif;
}

.card {
  padding: clamp(1.2rem, 3.5vw, 1.8rem);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

button {
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: .65rem;
  padding: .6rem 1.25rem;
  color: #fffbf6;
  background: var(--accent);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: .65; cursor: default; }
button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.secondary {
  min-height: 2.25rem;
  padding: .35rem .8rem;
  border-color: var(--line);
  color: var(--accent);
  background: transparent;
  font-size: .82rem;
}
.secondary:hover:not(:disabled) { background: var(--tint); }

.sign-in {
  display: grid;
  place-items: center;
}
.sign-in main {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  width: 100%;
}
.login {
  width: min(100%, 26rem);
  padding: clamp(1.45rem, 6vw, 2.6rem);
  text-align: center;
}
.login .kicker { margin-block: .95rem .55rem; }
.login .description {
  margin-top: .65rem;
  color: var(--muted);
  font-size: .9rem;
}
.login form {
  display: grid;
  gap: .95rem;
  margin-top: 1.5rem;
  text-align: start;
}
.login label { font-size: .87rem; font-weight: 650; }
.login input {
  display: block;
  width: 100%;
  margin-top: .4rem;
  border: 1px solid #d9c4b1;
  border-radius: .6rem;
  padding: .62rem .75rem;
  color: var(--ink);
  background: #fffcf8;
  font: inherit;
}
.login button { width: 100%; margin-top: .3rem; }

.status-page main { padding-block: clamp(1.4rem, 4.5vw, 2.65rem); }
.status-page .card { padding: clamp(1.2rem, 3vw, 1.45rem); }
.dashboard-header {
  margin-bottom: clamp(1.4rem, 3.5vw, 1.85rem);
  text-align: center;
}
.dashboard-header .kicker { margin-block: .85rem .5rem; }
.session-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .45rem .8rem;
  margin-top: .9rem;
}

#refresh, .note, .source, .speed > p, dt { color: var(--muted); }
#refresh, .note, .source { font-size: .83rem; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }

.state {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: .65rem;
  border-radius: 1.5rem;
  padding: .22rem .7rem;
  color: #684e3e;
  background: #f3e6d8;
  font-size: .83rem;
  font-weight: 650;
}
.state::before {
  content: "";
  width: .42rem;
  height: .42rem;
  flex: 0 0 .42rem;
  border-radius: 50%;
  background: currentColor;
}
.state[data-state="ok"] { color: #3d5b45; background: #e9f0e3; }
.state[data-state="path_down"],
.state[data-state="node_down"],
.state[data-state="unreachable"] { color: #8d3f2d; background: #fae5db; }

dl { margin: 1rem 0 0; }
dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.grid dl div {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  border-bottom: 1px solid var(--line);
  padding-block: .48rem;
  font-size: .9rem;
}
.source { margin-top: .8rem; }
.note { margin: .85rem auto 1.4rem; text-align: center; }

.usage { margin-bottom: 1rem; }
.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .4rem .9rem;
}
.section-heading > span, .section-hint { color: var(--muted); font-size: .82rem; }
.section-hint { margin-top: .55rem; }
.usage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-top: .9rem;
}
.usage-tile {
  padding: .85rem .95rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: #fbf3e9;
}
.usage-tile h3, .usage-figure h3 { font-size: .94rem; }
.today-values {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem 1.25rem;
  margin-top: .6rem;
}
.today-values dt { font-size: .76rem; }
.today-values dd { font-size: 1.07rem; }
.usage-figure { margin: 1.15rem 0 0; }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .8rem;
  color: var(--muted);
  font-size: .76rem;
}
.chart-legend span::before {
  display: inline-block;
  width: .56rem;
  height: .56rem;
  margin-right: .3rem;
  border-radius: .15rem;
  background: var(--series);
  content: "";
}
.six-key { --series: #965837; }
.qqg-key { --series: #bd873f; }
.usage-chart { display: block; width: 100%; margin-top: .45rem; }
.usage-chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.usage-chart line { stroke: var(--line); }
.usage-chart rect { fill: var(--series); }
.usage-chart rect.partial { opacity: .46; }
.usage-details { margin-top: .7rem; color: var(--muted); font-size: .83rem; }
.usage-details summary { color: var(--accent); cursor: pointer; }
.usage-details table { width: 100%; margin-top: .55rem; border-collapse: collapse; }
.usage-details th, .usage-details td {
  border-bottom: 1px solid var(--line);
  padding: .45rem .3rem;
  text-align: start;
  font-variant-numeric: tabular-nums;
}
.device-list { margin: .35rem 0 0; padding: 0; list-style: none; }
.device-list li {
  display: flex;
  justify-content: space-between;
  gap: .4rem;
  border-bottom: 1px solid var(--line);
  padding: .38rem 0;
  font-size: .86rem;
}
.device-list li span { overflow-wrap: anywhere; }
.device-list li small { flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; }

.speed { text-align: center; }
.speed > p {
  max-width: 36rem;
  margin: .65rem auto 0;
  font-size: .9rem;
}
.speed-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-top: 1rem;
}
progress { width: min(100%, 13rem); height: .55rem; accent-color: var(--accent); }
.speed-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .6rem;
}
.speed-results div {
  border: 1px solid #efe2d5;
  border-radius: .65rem;
  padding: .65rem .35rem;
  background: #fbf3e9;
}
.speed-results dt { font-size: .8rem; }
.speed-results dd { margin-top: .25rem; font-size: clamp(.9rem, 3vw, 1.2rem); }

@media (max-width: 37rem) {
  .grid { grid-template-columns: 1fr; }
  .usage-grid { grid-template-columns: 1fr; }
}
