:root {
  color-scheme: dark;
  --ground: #0d1520;
  --surface: #141f2d;
  --surface-raised: #19283a;
  --navy: #0e1825;
  --navy-deep: #0a121c;
  --ink: #edf4ff;
  --muted: #a0b1c6;
  --line: #29394c;
  --blue: #8bb8ff;
  --teal: #64dec9;
  --green: #84dfb1;
  --amber: #f1c275;
  --danger: #ffafb2;
  --focus: #9fcbff;
}

body {
  background: var(--ground);
}

.dashboard {
  background: radial-gradient(ellipse at 42% 0, #17273b 0, transparent 54%), var(--ground);
}

.sidebar {
  background: var(--navy-deep);
  border-right: 1px solid var(--line);
}

.sidebar .brand {
  margin-bottom: 27px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.nav-link {
  position: relative;
  color: var(--muted);
  border: 1px solid transparent;
}

.nav-link:hover,
.nav-link.active {
  background: var(--surface-raised);
  color: var(--ink);
}

.nav-link.active {
  border-color: #36516f;
}

.nav-link.active .icon {
  color: var(--blue);
}

.sidebar-bottom {
  border-top: 1px solid var(--line);
  padding-top: 15px;
}

.sidebar-bottom > button {
  margin-top: 8px;
}

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px 16px;
  margin-bottom: 18px;
}

.page-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.device-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  color: var(--blue);
  background: var(--surface-raised);
  border: 1px solid #334c69;
  border-radius: 11px;
}

.device-mark .icon {
  width: 22px;
  height: 22px;
}

.page-header h1 {
  font-size: clamp(23px, 2.2vw, 34px);
  line-height: 1.2;
}

.page-header p {
  margin-top: 5px;
  font-size: 12px;
}

.live-connection {
  --signal: var(--muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 9px;
  min-height: 40px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--navy);
  color: var(--muted);
  font-size: 12px;
}

.live-connection[data-state="live"] {
  --signal: var(--green);
}

.live-connection:is([data-state="stale"], [data-state="reconnecting"]) {
  --signal: var(--amber);
}

.live-connection[data-state="offline"] {
  --signal: var(--danger);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
}

.live-connection[data-state="live"] .live-dot {
  box-shadow: 0 0 0 4px rgb(132 223 177 / 15%);
}

.live-connection strong {
  color: var(--signal);
  white-space: nowrap;
}

.sample-readout {
  padding-left: 9px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

.sample-readout time {
  color: var(--ink);
}

.sample-age {
  min-width: 3.5em;
  text-align: right;
  white-space: nowrap;
}

.header-tools {
  gap: 7px;
}

.icon-button {
  width: 40px;
  height: 40px;
  background: var(--surface);
  color: var(--muted);
}

.icon-button:hover,
.service-open:hover {
  background: #283e59;
  color: var(--ink);
}

.notice {
  background: #302619;
  border-color: #6f512d;
  color: var(--amber);
}

.connections {
  gap: 18px;
  padding: 11px 14px;
  margin-bottom: 18px;
  background: var(--navy);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.uplink {
  border-radius: 8px;
}

.uplink:hover {
  background: var(--surface-raised);
  border-color: #496887;
}

.uplink.selected {
  color: var(--ink);
  background: #1c304a;
  border-color: #547db0;
}

.uplink.selected .uplink-detail {
  color: #bbcee4;
}

.status-dot.good,
.selected .status-dot.good {
  background: var(--green);
}

.status-dot.off {
  background: var(--danger);
}

.status-dot.unknown {
  background: var(--muted);
}

.traffic-layout {
  grid-template-columns: minmax(0, 1fr) minmax(224px, .365fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  border-radius: 13px;
  box-shadow: 0 12px 24px rgb(4 9 16 / 16%);
}

.chart-panel {
  border-color: #416080;
  background: radial-gradient(ellipse at 12% 12%, #20324b 0, transparent 66%), var(--surface);
}

.chart-panel .section-heading h2,
.usage-panel .section-heading h2 {
  font-size: 18px;
}

.speed-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 17px 0 10px;
}

.speed-values > div {
  display: grid;
  grid-template-columns: minmax(0, max-content) auto;
  justify-content: start;
  align-items: baseline;
  gap: 3px 7px;
  padding: 8px 12px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(9 18 31 / 45%);
}

.speed-label {
  grid-column: 1 / -1;
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.speed-label::after {
  width: 17px;
  margin-left: 4px;
  border-top: 2px solid var(--series);
  content: "";
}

.speed-up .speed-label::after {
  border-top-style: dashed;
}

.speed-down {
  --series: var(--blue);
}

.speed-up {
  --series: var(--teal);
}

.speed-values strong {
  min-width: 0;
  color: var(--series);
  font-size: clamp(24px, 3.5vw, 43px);
  line-height: 1.05;
  letter-spacing: -.045em;
}

.speed-values .unit {
  font-size: 12px;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 12px);
  transform: translateX(-50%);
  padding: 4px 8px;
  border: 1px solid #57779c;
  border-radius: 5px;
  color: var(--ink);
  background: var(--navy-deep);
  text-align: center;
  font-size: 11px;
  pointer-events: none;
}

.speed-chart .chart-cursor-line {
  stroke: #98b6d9;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
}

.speed-chart .chart-cursor {
  pointer-events: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.source-tag {
  color: var(--muted);
  background: var(--surface-raised);
  border: 1px solid var(--line);
}

.usage-total {
  font-size: clamp(24px, 2.35vw, 34px);
  line-height: 1.42;
  letter-spacing: -.035em;
}

.usage-block h3 {
  color: var(--ink);
}

.usage-pair {
  padding-top: 5px;
}

.lower-layout {
  gap: 16px;
}

.wifi-icon,
.service-symbol {
  color: var(--blue);
  background: var(--surface-raised);
  border: 1px solid var(--line);
}

.wifi-info .wifi-network {
  color: var(--teal);
}

.service-row + .service-row {
  border-color: var(--line);
}

.service-row {
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

a.service-row:hover,
button.service-row:hover {
  background: var(--surface-raised);
  text-decoration: none;
}

.service-info > span {
  display: block;
}

.service-action {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--blue);
  font-size: 11px;
  white-space: nowrap;
}

.service-action .icon,
.service-dialog-link .icon {
  width: 14px;
  height: 14px;
}

.service-dialog {
  width: min(430px, calc(100% - 26px));
  padding: 19px;
  border: 1px solid #496b92;
  border-radius: 13px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 20px 55px rgb(0 0 0 / 40%);
}

.service-dialog::backdrop {
  background: rgb(5 10 18 / 75%);
}

.service-dialog .section-heading {
  align-items: center;
  margin-bottom: 9px;
}

.dialog-close {
  font-size: 20px;
}

.service-dialog-links {
  display: grid;
  gap: 7px;
}

.service-dialog-links:not(:empty) {
  margin-top: 14px;
}

.service-dialog-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--blue);
}

.system-strip {
  margin-top: 16px;
  padding: 17px 20px;
  background: var(--navy);
  border: 1px solid var(--line);
  border-radius: 11px;
}

progress {
  background: #26354a;
}

progress::-webkit-progress-bar {
  background: #26354a;
}

.page-footer {
  margin-top: 14px;
}

.login-intro {
  justify-content: flex-start;
  background: radial-gradient(ellipse at 20% 36%, #233c5d 0, transparent 77%), var(--navy-deep);
  border-right: 1px solid var(--line);
  color: var(--ink);
}

.login-copy {
  margin: auto 0;
}

.login-copy h1 {
  font-size: clamp(28px, 4.2vw, 64px);
  line-height: 1.2;
}

.login-copy p {
  margin-top: 18px;
}

.login-form > input {
  border-color: #425a77;
}

.check-label input {
  accent-color: var(--blue);
}

.primary-button,
.primary-button:hover {
  color: var(--navy-deep);
  background: var(--blue);
}

.primary-button:hover {
  background: #b1d0ff;
}

.form-error {
  background: #3b212a;
}

body:has(.demo-banner:not([hidden])) .sidebar {
  top: 38px;
}

@media (max-width: 960px) {
  .sidebar .brand {
    margin-bottom: 20px;
    padding-bottom: 17px;
  }

  .speed-values strong {
    font-size: clamp(24px, 3.5vw, 36px);
  }
}

@media (max-width: 820px) {
  .traffic-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .usage-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
  }

  .usage-panel > .section-heading,
  .usage-panel > .data-note {
    grid-column: 1 / -1;
  }

  .usage-block {
    padding: 15px 0 11px;
  }

  .usage-block + .usage-block {
    padding-left: 14px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  body:has(.demo-banner:not([hidden])) .sidebar {
    top: auto;
  }

  .sidebar {
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .sidebar nav {
    gap: 4px;
    padding: 5px 0;
  }

  .nav-link {
    padding: 5px 4px;
    border-radius: 8px;
  }

  .main-content {
    padding-inline: 12px;
  }

  .page-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
    margin-bottom: 13px;
  }

  .page-heading {
    gap: 8px;
  }

  .device-mark {
    display: none;
  }

  .page-header h1 {
    font-size: 21px;
  }

  .page-header p {
    margin-top: 3px;
    font-size: 11px;
  }

  .live-connection {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .sample-readout {
    margin-left: auto;
  }

  .header-tools {
    gap: 4px;
  }

  .icon-button {
    width: 36px;
    height: 36px;
  }

  .connections {
    padding-inline: 11px;
    margin-bottom: 14px;
  }

  .chart-panel {
    padding-inline: 13px;
  }

  .speed-values {
    gap: 8px;
  }

  .speed-values > div {
    gap: 3px 5px;
    padding-inline: 8px;
  }

  .speed-values strong {
    font-size: clamp(24px, 7.4vw, 34px);
  }

  .usage-total {
    font-size: clamp(21px, 6vw, 27px);
  }

  .system-strip {
    padding: 14px;
  }

  .login-copy {
    padding-top: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  progress::-webkit-progress-value {
    transition: none;
  }
}
