:root {
  color-scheme: dark;
  --page: #070a0b;
  --panel: rgba(17, 22, 23, 0.91);
  --panel-solid: #111718;
  --soft: #171e1f;
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f6f4;
  --text-soft: #bec6c2;
  --muted: #77817d;
  --faint: #4f5955;
  --niu: #f04635;
  --niu-bright: #ff6754;
  --energy: #68e7aa;
  --warning: #f6b84a;
  --danger: #ff5f57;
  --blue: #76a9ff;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 48% -12%, rgba(104, 231, 170, 0.09), transparent 35rem),
    linear-gradient(180deg, #0a0e0f, var(--page) 32rem);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--niu-bright);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--page);
  font-weight: 750;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(6px);
  opacity: 0.13;
}

.ambient-one {
  top: 21rem;
  right: -25rem;
  background: radial-gradient(circle, var(--niu), transparent 70%);
}

.ambient-two {
  top: 84rem;
  left: -28rem;
  background: radial-gradient(circle, var(--energy), transparent 70%);
}

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(7, 10, 11, 0.76);
  backdrop-filter: blur(24px) saturate(140%);
}

.topbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(100% - 48px, 1440px);
  min-height: 78px;
  margin: 0 auto;
  gap: 24px;
}

.brand {
  display: inline-flex;
  justify-self: start;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark,
.empty-mark {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--niu-bright), #d42f21 72%);
  color: white;
  font-weight: 950;
  transform: skew(-5deg);
  box-shadow: 0 10px 28px rgba(240, 70, 53, 0.22), inset 0 1px rgba(255, 255, 255, 0.25);
}

.brand-mark {
  width: 39px;
  height: 39px;
  border-radius: 12px;
  font-size: 19px;
}

.brand-copy {
  display: grid;
  line-height: 1;
}

.brand-copy strong {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.brand-copy small {
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.connection-pill,
.state-pill,
.section-status,
.model-tag,
.latency-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}

.connection-pill {
  min-height: 32px;
  padding: 6px 11px;
  gap: 8px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 680;
}

.status-dot,
.api-dot,
.state-pill i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}

.connection-pill[data-state="loading"] .status-dot,
.api-dot[data-state="loading"] {
  background: var(--warning);
  animation: pulse 1.2s ease-in-out infinite;
}

.connection-pill[data-state="success"] {
  border-color: rgba(104, 231, 170, 0.2);
  color: #c7f8df;
}

.connection-pill[data-state="success"] .status-dot,
.api-dot[data-state="success"] {
  background: var(--energy);
  box-shadow: 0 0 11px rgba(104, 231, 170, 0.4);
}

.connection-pill[data-state="error"] {
  border-color: rgba(255, 95, 87, 0.25);
  color: #ffbab6;
}

.connection-pill[data-state="error"] .status-dot,
.api-dot[data-state="error"] {
  background: var(--danger);
}

.refresh-time {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.refresh-time time {
  margin-left: 5px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.topbar-actions {
  display: flex;
  justify-self: end;
  align-items: center;
  gap: 9px;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button,
.copy-button,
.danger-text-button,
.modal-close {
  border: 0;
  cursor: pointer;
  transition: 150ms ease;
  transition-property: transform, border-color, background, color, opacity;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 17px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 760;
}

.primary-button {
  background: var(--text);
  color: #0c1011;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.primary-button:hover:not(:disabled) {
  background: #fff;
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-soft);
}

.secondary-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
}

.danger-button {
  background: var(--danger);
  color: #180604;
}

.danger-button:hover:not(:disabled) {
  background: #ff766f;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none !important;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
}

.icon-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.065);
  color: var(--text);
}

.icon-button svg,
.refresh-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.refresh-button {
  min-height: 42px;
  padding: 9px 15px;
  gap: 8px;
}

.refresh-button.is-loading svg {
  animation: spin 850ms linear infinite;
}

.page-shell {
  width: min(100% - 48px, 1440px);
  margin: 0 auto;
  padding: 34px 0 70px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.022), transparent 45%),
    var(--panel);
  box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.error-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 18px;
  gap: 14px;
  border: 1px solid rgba(255, 95, 87, 0.22);
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(255, 95, 87, 0.11), rgba(255, 95, 87, 0.045));
}

.error-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 95, 87, 0.32);
  border-radius: 50%;
  background: rgba(255, 95, 87, 0.1);
  color: var(--danger);
  font-family: var(--mono);
  font-weight: 900;
}

.error-copy p {
  margin: 2px 0 0;
  color: #d6a5a2;
  font-size: 12px;
}

.error-actions {
  display: flex;
  gap: 8px;
}

.compact-button {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 11px;
  font-size: 12px;
}

.loading-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.7fr);
  gap: 22px;
}

.skeleton {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
}

.skeleton::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.045) 40%, transparent 60%);
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.55s infinite;
}

.skeleton-hero {
  grid-row: span 2;
  min-height: 560px;
}

.empty-state {
  display: flex;
  min-height: min(680px, calc(100vh - 150px));
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 70px 20px;
  text-align: center;
}

.empty-mark {
  width: 88px;
  height: 88px;
  margin-bottom: 28px;
  border-radius: 28px;
  font-size: 35px;
}

.empty-state h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 54px);
  letter-spacing: -0.045em;
}

.empty-state > p:not(.eyebrow) {
  max-width: 570px;
  margin: 14px 0 26px;
  color: var(--muted);
  font-size: 14px;
}

.overview-card {
  position: relative;
  overflow: hidden;
  padding: 34px;
}

.overview-card::before {
  position: absolute;
  top: -170px;
  left: -120px;
  width: 440px;
  height: 440px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(104, 231, 170, 0.08), transparent 68%);
  content: "";
  pointer-events: none;
}

.overview-heading,
.section-heading {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.overview-heading {
  padding-bottom: 27px;
  border-bottom: 1px solid var(--line);
}

.vehicle-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.vehicle-title-row h1 {
  margin: 0;
  font-size: clamp(27px, 3.5vw, 42px);
  font-weight: 760;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.model-tag,
.section-status,
.latency-badge {
  min-height: 25px;
  padding: 4px 9px;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 9px;
}

.vehicle-serial {
  margin: 9px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.state-pills {
  display: flex;
  gap: 8px;
}

.state-pill {
  padding: 7px 11px;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 690;
}

.state-pill[data-tone="positive"] {
  border-color: rgba(104, 231, 170, 0.2);
  background: rgba(104, 231, 170, 0.065);
  color: var(--energy);
}

.state-pill[data-tone="warning"] {
  border-color: rgba(246, 184, 74, 0.2);
  background: rgba(246, 184, 74, 0.065);
  color: var(--warning);
}

.overview-body {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 0.68fr) minmax(560px, 1.55fr);
  align-items: center;
  padding-top: 32px;
  gap: clamp(28px, 5vw, 72px);
}

.energy-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.battery-ring {
  --level: 0%;
  --ring-color: var(--energy);
  position: relative;
  display: grid;
  width: clamp(184px, 17vw, 230px);
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, transparent 59%, rgba(104, 231, 170, 0.055) 60%, transparent 68%),
    conic-gradient(from -90deg, var(--ring-color) var(--level), rgba(255, 255, 255, 0.065) 0);
  box-shadow: 0 0 60px rgba(104, 231, 170, 0.06);
}

.battery-ring::before {
  position: absolute;
  inset: 11px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  background: var(--panel-solid);
  box-shadow: inset 0 16px 40px rgba(0, 0, 0, 0.25);
  content: "";
}

.battery-ring[data-level="medium"] {
  --ring-color: var(--warning);
}

.battery-ring[data-level="low"] {
  --ring-color: var(--danger);
}

.battery-ring-inner {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
}

.battery-number {
  font-size: clamp(52px, 6vw, 72px);
  font-weight: 720;
  letter-spacing: -0.085em;
  line-height: 0.9;
}

.battery-unit {
  margin-left: 5px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 650;
}

.battery-ring-inner small {
  width: 100%;
  margin-top: 14px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-align: center;
}

.energy-readouts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  margin-top: 22px;
}

.energy-readouts > div {
  min-width: 115px;
  padding: 0 20px;
  text-align: center;
}

.energy-readouts > div + div {
  border-left: 1px solid var(--line);
}

.energy-readouts p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.energy-readouts strong {
  font-family: var(--mono);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.energy-readouts small,
.track-stats small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  display: flex;
  min-width: 0;
  min-height: 113px;
  align-items: flex-start;
  padding: 18px;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.022);
}

.metric-card.accent-card {
  border-color: rgba(104, 231, 170, 0.14);
  background: linear-gradient(135deg, rgba(104, 231, 170, 0.11), rgba(104, 231, 170, 0.018));
}

.metric-icon {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--energy);
  font-family: var(--mono);
}

.metric-card > div {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.metric-card span:not(.metric-icon) {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card strong {
  margin-top: 5px;
  overflow: hidden;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-bars {
  display: flex;
  height: 13px;
  align-items: flex-end;
  margin-top: 7px;
  gap: 3px;
}

.signal-bars i {
  width: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.09);
}

.signal-bars i:nth-child(1) { height: 4px; }
.signal-bars i:nth-child(2) { height: 6px; }
.signal-bars i:nth-child(3) { height: 8px; }
.signal-bars i:nth-child(4) { height: 10px; }
.signal-bars i:nth-child(5) { height: 12px; }

.signal-bars i.is-active {
  background: var(--energy);
  box-shadow: 0 0 5px rgba(104, 231, 170, 0.25);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  margin-top: 22px;
  gap: 22px;
}

.section-panel,
.api-panel {
  padding: 28px;
}

.section-heading {
  margin-bottom: 24px;
}

.section-heading h2,
.danger-heading h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.section-status {
  color: var(--muted);
  white-space: nowrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line);
}

.detail-item {
  min-width: 0;
  padding: 17px 12px 17px 0;
  border-bottom: 1px solid var(--line);
}

.detail-item:nth-child(even) {
  padding-right: 0;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.detail-item dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.detail-item dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 660;
}

.track-map {
  position: relative;
  height: 148px;
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #101516;
}

.track-map::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(5, 8, 9, 0.82));
  content: "";
  pointer-events: none;
}

.track-map img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.76;
}

.track-map > span {
  position: absolute;
  z-index: 1;
  right: 11px;
  bottom: 10px;
  padding: 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(5, 8, 9, 0.72);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.12em;
}

.track-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.track-stats > div {
  display: flex;
  min-width: 0;
  min-height: 75px;
  justify-content: center;
  flex-direction: column;
  padding: 13px;
  border-right: 1px solid var(--line);
}

.track-stats > div:last-child {
  border-right: 0;
}

.track-stats span,
.route-line span {
  color: var(--muted);
  font-size: 9px;
}

.track-stats strong {
  margin-top: 4px;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-stats b {
  font-weight: inherit;
}

.route-line {
  display: grid;
  margin-top: 22px;
  gap: 13px;
}

.route-line > div {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: baseline;
  gap: 8px;
}

.route-line strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-line small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.inline-empty {
  display: flex;
  min-height: 260px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.inline-empty > span {
  font-size: 24px;
}

.inline-empty strong {
  margin-top: 10px;
  color: var(--text);
}

.inline-empty p {
  margin: 5px 0 0;
  font-size: 11px;
}

.api-panel {
  margin-top: 22px;
}

.latency-badge {
  border-color: rgba(118, 169, 255, 0.18);
  background: rgba(118, 169, 255, 0.06);
  color: #a9c9ff;
  font-size: 10px;
}

.api-health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
}

.api-health-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  min-width: 0;
  align-items: center;
  min-height: 66px;
  padding: 13px 16px;
  gap: 10px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}

.api-health-item:last-child {
  border-right: 0;
}

.api-health-item > div {
  display: grid;
  min-width: 0;
}

.api-health-item strong {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
}

.api-health-item small,
.api-health-item > span {
  color: var(--muted);
  font-size: 8px;
  white-space: nowrap;
}

.api-footnote {
  margin: 13px 1px 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
}

.raw-section {
  margin-top: 58px;
}

.raw-heading p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.raw-grid {
  display: grid;
  gap: 15px;
}

.raw-card {
  overflow: hidden;
  border-radius: 20px;
}

.raw-card-heading {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.raw-card-heading > div {
  display: flex;
  align-items: center;
  gap: 13px;
}

.raw-card-heading > div > span {
  color: var(--niu-bright);
  font-family: var(--mono);
  font-size: 9px;
}

.raw-card-heading h3 {
  display: grid;
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
}

.raw-card-heading h3 small {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 400;
}

.copy-button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 9px;
}

.copy-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--text);
}

.json-viewer {
  max-height: min(68vh, 700px);
  overflow: auto;
  padding: 15px 18px 19px;
  background: rgba(5, 8, 9, 0.44);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.7;
  scrollbar-color: var(--line-strong) transparent;
}

.json-details {
  min-width: max-content;
}

.json-details > summary {
  display: flex;
  width: max-content;
  align-items: center;
  padding: 1px 5px 1px 0;
  gap: 7px;
  border-radius: 5px;
  cursor: pointer;
  list-style: none;
}

.json-details > summary::-webkit-details-marker {
  display: none;
}

.json-details > summary:hover {
  background: rgba(255, 255, 255, 0.035);
}

.json-caret {
  width: 12px;
  color: var(--faint);
  text-align: center;
  transition: transform 150ms ease;
}

.json-details[open] > summary .json-caret {
  transform: rotate(90deg);
}

.json-key {
  color: #aab6ff;
  overflow-wrap: anywhere;
}

.json-kind,
.json-count,
.json-separator {
  color: var(--faint);
}

.json-count {
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 8px;
}

.json-children {
  margin-left: 5px;
  padding-left: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.07);
}

.json-row {
  display: flex;
  min-width: max-content;
  gap: 7px;
}

.json-value {
  max-width: min(880px, 64vw);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.json-string { color: #9ee8c3; }
.json-number { color: #f6c66e; }
.json-boolean { color: #83b4ff; }
.json-null { color: #9a858d; font-style: italic; }
.json-empty { padding: 12px 0; color: var(--faint); font-style: italic; }

.danger-panel {
  margin-top: 58px;
  padding: 28px;
  border: 1px solid rgba(255, 95, 87, 0.2);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 0 0, rgba(255, 95, 87, 0.08), transparent 30rem),
    rgba(25, 13, 13, 0.56);
}

.danger-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.danger-heading p:last-child {
  margin: 5px 0 0;
  color: #a9817e;
  font-size: 11px;
}

.danger-heading .eyebrow,
.danger-eyebrow {
  color: #b96661;
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 23px;
  gap: 10px;
}

.command-button {
  display: flex;
  min-width: 0;
  min-height: 76px;
  align-items: center;
  padding: 13px;
  gap: 11px;
  border: 1px solid rgba(255, 95, 87, 0.14);
  border-radius: 15px;
  background: rgba(255, 95, 87, 0.025);
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
  transition: 150ms ease;
}

.command-button:hover:not(:disabled) {
  border-color: rgba(255, 95, 87, 0.32);
  background: rgba(255, 95, 87, 0.07);
  transform: translateY(-1px);
}

.command-button i {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border: 1px solid rgba(255, 95, 87, 0.2);
  border-radius: 10px;
  background: rgba(255, 95, 87, 0.07);
  color: #e8827c;
  font-family: var(--mono);
  font-style: normal;
}

.command-button > span {
  display: grid;
  min-width: 0;
}

.command-button strong,
.command-button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-button strong {
  font-size: 12px;
}

.command-button small {
  margin-top: 3px;
  color: #8e6b69;
  font-size: 8px;
}

.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 34px;
  padding: 0 4px;
  gap: 20px;
  color: var(--faint);
  font-size: 9px;
}

.page-footer span {
  font-family: var(--mono);
  letter-spacing: 0.12em;
}

.page-footer p {
  margin: 0;
  text-align: right;
}

.modal {
  width: min(calc(100% - 32px), 700px);
  max-height: min(calc(100vh - 32px), 800px);
  margin: auto;
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: #111617;
  color: var(--text);
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.72);
}

.modal::backdrop {
  background: rgba(2, 4, 5, 0.78);
  backdrop-filter: blur(9px);
}

.modal[open] {
  animation: modal-enter 190ms ease-out;
}

.modal-shell {
  padding: 27px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.modal-header h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.035em;
}

.modal-close {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 35px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 20px;
}

.risk-note,
.confirm-warning {
  display: flex;
  align-items: flex-start;
  margin-top: 22px;
  padding: 14px;
  gap: 11px;
  border-radius: 14px;
}

.risk-note {
  border: 1px solid rgba(246, 184, 74, 0.18);
  background: rgba(246, 184, 74, 0.055);
}

.risk-note > span,
.confirm-warning > span {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  place-items: center;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 900;
}

.risk-note > span {
  background: rgba(246, 184, 74, 0.12);
  color: var(--warning);
}

.risk-note p {
  margin: 0;
  color: #bba880;
  font-size: 10px;
}

.risk-note strong {
  display: block;
  color: #e1cb9c;
  font-size: 11px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 22px;
  gap: 17px;
}

.field,
.token-state {
  display: grid;
  gap: 7px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 620;
}

.field input {
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  transition: 150ms ease;
}

.field input:focus {
  border-color: rgba(240, 70, 53, 0.55);
  box-shadow: 0 0 0 3px rgba(240, 70, 53, 0.08);
}

.field input::placeholder {
  color: var(--faint);
}

.field > small {
  color: var(--faint);
  font-size: 8px;
  font-weight: 500;
}

.password-field {
  grid-column: 1 / -1;
}

.password-input,
.country-input {
  position: relative;
  display: block;
}

.password-input input {
  padding-right: 61px;
}

.password-input button {
  position: absolute;
  top: 50%;
  right: 6px;
  min-width: 48px;
  min-height: 33px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
  transform: translateY(-50%);
}

.country-input b {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 13px;
  color: var(--muted);
  font-family: var(--mono);
  transform: translateY(-50%);
}

.country-input input {
  padding-left: 28px;
}

.token-state {
  align-content: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.token-state span {
  color: var(--muted);
  font-size: 9px;
}

.token-state strong {
  overflow: hidden;
  color: var(--energy);
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 26px;
  gap: 9px;
}

.modal-action-spacer {
  flex: 1;
}

.danger-text-button {
  padding: 8px 2px;
  background: transparent;
  color: #b36f6b;
  font-size: 10px;
  font-weight: 650;
}

.confirm-modal {
  width: min(calc(100% - 32px), 510px);
}

.confirm-warning {
  border: 1px solid rgba(255, 95, 87, 0.19);
  background: rgba(255, 95, 87, 0.1);
}

.confirm-warning > span {
  border: 1px solid rgba(255, 95, 87, 0.25);
  color: var(--danger);
}

.confirm-warning p {
  margin: 4px 0 0;
  color: #b98683;
  font-size: 10px;
}

.confirm-sn {
  margin: 14px 3px 0;
  color: var(--muted);
  font-size: 9px;
}

.confirm-sn strong {
  margin-left: 3px;
  color: var(--text-soft);
  font-family: var(--mono);
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  display: flex;
  width: min(calc(100% - 44px), 380px);
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: 58px;
  padding: 12px 13px;
  gap: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: rgba(22, 28, 29, 0.97);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.48);
  pointer-events: auto;
  animation: toast-enter 210ms ease-out;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: 180ms ease;
}

.toast-mark {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: rgba(104, 231, 170, 0.09);
  color: var(--energy);
  font-size: 10px;
}

.toast[data-tone="error"] .toast-mark {
  background: rgba(255, 95, 87, 0.09);
  color: var(--danger);
}

.toast[data-tone="warning"] .toast-mark {
  background: rgba(246, 184, 74, 0.09);
  color: var(--warning);
}

.toast-copy {
  display: grid;
}

.toast-copy strong {
  font-size: 11px;
}

.toast-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.toast-close {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.noscript {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  padding: 15px;
  border: 1px solid rgba(255, 95, 87, 0.3);
  border-radius: 14px;
  background: #261110;
  color: #ffc4c0;
  text-align: center;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

@keyframes pulse {
  50% { opacity: 0.4; }
}

@keyframes modal-enter {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
}

@media (max-width: 1180px) {
  .overview-body {
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 30px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .command-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .api-health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .api-health-item:nth-child(2) {
    border-right: 0;
  }

  .api-health-item:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 960px) {
  .topbar-inner {
    grid-template-columns: 1fr auto;
    padding: 10px 0;
    gap: 9px 18px;
  }

  .topbar-status {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: space-between;
    padding-top: 9px;
    border-top: 1px solid var(--line);
  }

  .overview-body,
  .content-grid,
  .loading-layout {
    grid-template-columns: 1fr;
  }

  .skeleton-hero {
    grid-row: auto;
    min-height: 470px;
  }

  .energy-visual {
    display: grid;
    grid-template-columns: auto auto;
    gap: 38px;
  }
}

@media (max-width: 700px) {
  .topbar-inner,
  .page-shell {
    width: min(100% - 28px, 1440px);
  }

  .brand-copy small,
  .refresh-button span {
    display: none;
  }

  .refresh-button {
    width: 42px;
    padding: 0;
  }

  .page-shell {
    padding-top: 20px;
  }

  .error-banner {
    grid-template-columns: auto 1fr;
  }

  .error-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .overview-card,
  .section-panel,
  .api-panel,
  .danger-panel {
    padding: 21px;
    border-radius: 22px;
  }

  .overview-heading {
    flex-direction: column;
  }

  .state-pills {
    width: 100%;
  }

  .state-pill {
    flex: 1;
    justify-content: center;
  }

  .energy-visual {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .battery-ring {
    width: 190px;
    margin: 0 auto;
  }

  .metric-grid,
  .command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .track-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .track-stats > div:nth-child(2) {
    border-right: 0;
  }

  .track-stats > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .password-field {
    grid-column: auto;
  }

  .settings-actions {
    flex-wrap: wrap;
  }

  .settings-actions .danger-text-button {
    width: 100%;
    text-align: left;
  }

  .settings-actions .modal-action-spacer {
    display: none;
  }

  .page-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-footer p {
    text-align: left;
  }
}

@media (max-width: 500px) {
  .page-shell,
  .topbar-inner {
    width: min(100% - 20px, 1440px);
  }

  .brand-copy {
    display: none;
  }

  .overview-card,
  .section-panel,
  .api-panel,
  .danger-panel {
    padding: 17px;
  }

  .metric-grid,
  .command-grid,
  .api-health-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-item,
  .detail-item:nth-child(even) {
    padding: 14px 0;
    border-left: 0;
  }

  .api-health-item,
  .api-health-item:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .api-health-item:last-child {
    border-bottom: 0;
  }

  .route-line > div {
    grid-template-columns: 35px 1fr;
  }

  .route-line small {
    grid-column: 2;
  }

  .modal-shell {
    padding: 20px;
  }

  .toast-region {
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
