:root {
  color-scheme: light;
  --bg: #eef3f8;
  --ink: #101827;
  --muted: rgba(32, 43, 60, 0.64);
  --subtle: rgba(32, 43, 60, 0.42);
  --line: rgba(255, 255, 255, 0.46);
  --line-strong: rgba(255, 255, 255, 0.72);
  --glass: rgba(255, 255, 255, 0.42);
  --glass-strong: rgba(255, 255, 255, 0.62);
  --shadow: 0 24px 70px rgba(31, 45, 72, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.82);
  --green: #0f9f6e;
  --red: #d94343;
  --yellow: #c48114;
  --blue: #2577e8;
  --cyan: #0c9bb0;
  --violet: #7759e8;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 18% 12%, rgba(102, 176, 255, 0.45), transparent 28rem),
    radial-gradient(circle at 88% 4%, rgba(139, 112, 255, 0.32), transparent 25rem),
    radial-gradient(circle at 78% 80%, rgba(64, 210, 177, 0.28), transparent 28rem),
    linear-gradient(135deg, #f7fbff 0%, #e9f0f7 48%, #f8fafc 100%);
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -3;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.42) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.34) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 72%);
}

button {
  border: 0;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.aurora span {
  position: absolute;
  width: 42vw;
  min-width: 360px;
  aspect-ratio: 1;
  border-radius: 999px;
  filter: blur(38px);
  opacity: 0.44;
  transform: translate3d(0, 0, 0);
}

.aurora span:nth-child(1) {
  left: -10vw;
  top: 2vh;
  background: #67b7ff;
}

.aurora span:nth-child(2) {
  right: -12vw;
  top: -8vh;
  background: #9d84ff;
}

.aurora span:nth-child(3) {
  bottom: -20vh;
  left: 34vw;
  background: #5ee2c4;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 44px;
}

.shell.is-locked {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px 14px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.32));
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
}

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

.brand img {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  filter: drop-shadow(0 12px 24px rgba(31, 45, 72, 0.18));
}

.topbar h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 780;
  letter-spacing: 0;
  line-height: 1;
}

.topbar p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.user-chip {
  max-width: 260px;
  min-height: 38px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#refresh-button,
#users-button,
#logout-button {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: radial-gradient(circle at 30% 16%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.42) 58%, rgba(255, 255, 255, 0.24));
  box-shadow: 0 12px 28px rgba(31, 45, 72, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.88);
  font-size: 22px;
  transition: transform 160ms ease, box-shadow 160ms ease;
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
}

#users-button,
#settings-button,
#logout-button {
  width: 42px;
  height: 42px;
  color: rgba(16, 24, 39, 0.72);
  font-size: 15px;
  font-weight: 820;
}

#logout-button {
  color: var(--red);
}

#refresh-button:hover,
#users-button:hover,
#logout-button:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 18px 34px rgba(31, 45, 72, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.summary-item,
.node-card,
.alerts,
.detail,
.login-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.3)),
    rgba(255, 255, 255, 0.34);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
}

.summary-item::before,
.node-card::before,
.alerts::before,
.detail::before,
.login-card::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.76), transparent 36%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.44), transparent 42%);
}

.summary-item > *,
.node-card > *,
.alerts > *,
.detail > *,
.login-card > * {
  position: relative;
}

.summary-item {
  min-height: 110px;
  padding: 18px;
  border-radius: 22px;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.summary-item strong {
  display: block;
  margin-top: 10px;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 0;
}

.summary-item:nth-child(2) strong {
  color: var(--green);
}

.summary-item:nth-child(3) strong {
  color: var(--red);
}

.summary-item:nth-child(4) strong {
  color: var(--yellow);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 18px;
  align-items: start;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 11px;
  padding: 0 4px;
}

.section-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 760;
}

.detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.range-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: min(60vw, 520px);
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  overflow-x: auto;
  scrollbar-width: none;
}

.range-tabs::-webkit-scrollbar {
  display: none;
}

.range-tabs button {
  min-width: max-content;
  min-height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: rgba(16, 24, 39, 0.62);
  font-size: 12px;
  font-weight: 760;
}

.range-tabs button.active {
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 18px rgba(31, 45, 72, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: var(--blue);
}

.section-head button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.44);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
  gap: 14px;
}

.node-card {
  min-height: 230px;
  padding: 0;
  border-radius: 24px;
  transition: transform 170ms ease, box-shadow 170ms ease, border-color 170ms ease;
}

.node-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.88);
  box-shadow: 0 30px 80px rgba(31, 45, 72, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.node-card-main {
  position: relative;
  display: block;
  width: 100%;
  padding: 17px 17px 0;
  background: transparent;
  text-align: left;
}

.node-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 17px;
}

.node-name {
  margin: 0;
  font-size: 19px;
  font-weight: 780;
}

.node-meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.badge.online {
  background: rgba(230, 255, 244, 0.66);
  color: var(--green);
}

.badge.offline {
  background: rgba(255, 233, 231, 0.72);
  color: var(--red);
}

.metric-list {
  display: grid;
  gap: 12px;
}

.metric-row {
  display: grid;
  grid-template-columns: 58px 1fr 58px;
  align-items: center;
  gap: 10px;
  color: rgba(16, 24, 39, 0.78);
  font-size: 13px;
  font-weight: 640;
}

.metric-row strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bar {
  position: relative;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: inset 0 1px 4px rgba(31, 45, 72, 0.1);
}

.bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--value);
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 18px rgba(37, 119, 232, 0.34);
}

.bar.warn span {
  background: linear-gradient(90deg, #ffc15a, var(--yellow));
  box-shadow: 0 0 18px rgba(196, 129, 20, 0.34);
}

.bar.danger span {
  background: linear-gradient(90deg, #ff7b72, var(--red));
  box-shadow: 0 0 18px rgba(217, 67, 67, 0.36);
}

.net {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 640;
}

.net span {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.66);
  overflow-wrap: anywhere;
}

.node-actions {
  display: flex;
  justify-content: flex-end;
  position: relative;
  padding: 13px 17px 17px;
}

.rename-node,
.delete-node {
  width: auto;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
}

.rename-node {
  border: 1px solid rgba(37, 119, 232, 0.2);
  background: rgba(232, 242, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
  color: var(--blue);
}

.rename-node:hover {
  background: rgba(218, 235, 255, 0.74);
}

.delete-node {
  border: 1px solid rgba(217, 67, 67, 0.2);
  background: rgba(255, 235, 233, 0.48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
  color: var(--red);
}

.delete-node:hover {
  background: rgba(255, 223, 220, 0.7);
}

.alerts {
  min-height: 250px;
  padding: 7px;
  border-radius: 24px;
}

.alert-item {
  padding: 13px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.46);
}

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

.alert-item strong {
  display: block;
  color: var(--red);
  font-size: 14px;
  font-weight: 780;
}

.alert-item div {
  margin-top: 5px;
  color: rgba(16, 24, 39, 0.76);
  font-size: 13px;
  line-height: 1.45;
}

.alert-item span {
  display: block;
  margin-top: 5px;
  color: var(--subtle);
  font-size: 12px;
}

.empty {
  padding: 24px 18px;
  color: var(--muted);
  text-align: center;
}

.detail {
  margin-top: 20px;
  padding: 17px;
  border-radius: 26px;
}

.users-panel {
  margin-bottom: 20px;
}

.settings-panel {
  margin-bottom: 20px;
}

.user-form {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.user-form input,
.user-form select,
.settings-form input,
.login-card input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 14px;
  outline: 0;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font: inherit;
}

.user-form input,
.user-form select,
.settings-form input {
  padding: 0 12px;
}

.user-form input[name="password"] {
  grid-column: span 2;
}

.user-form button,
.settings-form button,
.login-card button {
  min-height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(37, 119, 232, 0.96), rgba(12, 155, 176, 0.9));
  box-shadow: 0 12px 26px rgba(37, 119, 232, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.34);
  color: white;
  font-weight: 780;
}

.settings-form {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.settings-status {
  grid-column: 1 / -1;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.settings-status strong,
.settings-status span,
.settings-form label span {
  display: block;
}

.settings-status strong {
  color: var(--ink);
  font-size: 14px;
}

.settings-status span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.subsection-head {
  position: relative;
  margin: 18px 0 10px;
}

.subsection-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 780;
}

.secret-box {
  position: relative;
  margin: 12px 0 4px;
  padding: 13px 14px;
  border: 1px solid rgba(37, 119, 232, 0.22);
  border-radius: 16px;
  background: rgba(232, 242, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.secret-box strong,
.secret-box code {
  display: block;
}

.secret-box strong {
  color: var(--blue);
  font-size: 13px;
}

.secret-box code {
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.56);
  color: rgba(16, 24, 39, 0.82);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.settings-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.settings-form .inline-check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.28);
}

.inline-check input {
  width: 16px;
  min-height: 16px;
}

.settings-form button {
  align-self: end;
}

.form-message {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.form-message[data-type="error"],
.login-error[data-type="error"] {
  color: var(--red);
}

.form-message[data-type="success"] {
  color: var(--green);
}

.users-table {
  position: relative;
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.users-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) 110px 90px 120px minmax(160px, 0.9fr);
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.28);
  color: rgba(16, 24, 39, 0.78);
  font-size: 13px;
}

.agent-token-row {
  grid-template-columns: minmax(180px, 1.4fr) minmax(120px, 0.9fr) 90px 120px minmax(150px, 0.8fr);
}

.users-row-head {
  background: rgba(255, 255, 255, 0.46);
  color: var(--muted);
  font-weight: 780;
}

.users-row strong,
.users-row small {
  display: block;
}

.users-row small {
  margin-top: 3px;
  color: var(--subtle);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 10px rgba(217, 67, 67, 0.45);
}

.status-dot.active {
  background: var(--green);
  box-shadow: 0 0 10px rgba(15, 159, 110, 0.45);
}

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

.row-actions button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  color: rgba(16, 24, 39, 0.74);
  font-size: 12px;
  font-weight: 720;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(236, 243, 250, 0.28);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.login-card {
  width: min(430px, 100%);
  padding: 26px;
  border-radius: 30px;
  box-shadow: 0 34px 90px rgba(31, 45, 72, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(34px) saturate(190%);
  -webkit-backdrop-filter: blur(34px) saturate(190%);
}

.login-kicker {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.login-card h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.login-card p {
  margin: 8px 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.login-card label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.login-card input {
  padding: 0 13px;
  font-size: 15px;
}

.login-card button {
  width: 100%;
  margin-top: 4px;
}

.login-error {
  min-height: 20px;
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 700;
}

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

canvas {
  width: 100%;
  height: 184px;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 12px 28px rgba(31, 45, 72, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

@media (max-width: 980px) {
  .summary-grid,
  .content-grid,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
  }

  .user-form,
  .settings-form,
  .users-row {
    grid-template-columns: 1fr;
  }

  .detail .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-actions {
    width: 100%;
    align-items: stretch;
  }

  .range-tabs {
    max-width: none;
    flex: 1;
  }

  .user-form input[name="password"] {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 12px;
  }

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

  .topbar {
    align-items: flex-start;
    border-radius: 22px;
  }

  .brand {
    gap: 9px;
  }

  .brand img {
    width: 48px;
    height: 48px;
  }

  .top-actions {
    flex-wrap: wrap;
    max-width: 150px;
  }

  .user-chip {
    max-width: 150px;
    order: 4;
  }

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

  .metric-row {
    grid-template-columns: 50px 1fr 54px;
  }
}
