:root {
  --bg: #0a0f14;
  --bg-2: #0d151d;
  --surface: rgba(18, 26, 35, 0.86);
  --surface-2: #0f1721;
  --surface-3: #172231;
  --line: #273442;
  --line-strong: #3a4b5e;
  --text: #f2f6fa;
  --muted: #98a8b8;
  --normal: #3ddc84;
  --warm: #f0b84a;
  --high: #ff8a4a;
  --critical: #ff626d;
  --accent: #63b3ff;
  --gpu: #b993ff;
  --disk: #39d3ce;
  --fan: #5be0b4;
  --ram: #7dd3fc;
  --clock: #9fb4ff;
  --chart-cpu: #ffc247;
  --chart-gpu: #ff55dc;
  --chart-disk: #27e7d3;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 16% -12%, rgba(99, 179, 255, 0.24), transparent 32rem),
    radial-gradient(circle at 90% 10%, rgba(185, 147, 255, 0.16), transparent 28rem),
    linear-gradient(180deg, var(--bg), var(--bg-2) 44%, #080c10);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 72%);
}

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

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.brand-block {
  display: grid;
  gap: 6px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(29px, 4vw, 46px);
  line-height: 0.98;
  font-weight: 820;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  line-height: 1.2;
  font-weight: 780;
}

.topbar p,
.panel-head p,
.metric-sub,
.facts dt {
  color: var(--muted);
}

.topbar p {
  font-size: 14px;
}

.status-pill {
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(18, 26, 35, 0.9);
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.logout-button,
.password-field button {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.logout-button {
  width: 38px;
  height: 38px;
  border-radius: 8px;
}

.logout-button:hover,
.password-field button:hover {
  border-color: var(--accent);
  background: var(--surface-3);
}

.logout-button svg,
.password-field svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 12px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(23, 34, 49, 0.9), rgba(14, 21, 30, 0.9));
  box-shadow: var(--shadow);
}

.metric-card {
  grid-column: span 2;
  min-height: 178px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(27, 40, 56, 0.96), rgba(14, 21, 30, 0.94));
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--accent);
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -38px;
  top: -44px;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: var(--accent);
  filter: blur(28px);
  opacity: 0.14;
}

.card-cpu::before,
.card-cpu::after,
.card-cpu .metric-icon,
.card-cpu .bar span {
  background-color: var(--accent);
}

.card-ram::before,
.card-ram::after,
.card-ram .metric-icon {
  background-color: var(--ram);
}

.card-clock::before,
.card-clock::after,
.card-clock .metric-icon {
  background-color: var(--clock);
}

.card-gpu::before,
.card-gpu::after,
.card-gpu .metric-icon {
  background-color: var(--gpu);
}

.card-fan::before,
.card-fan::after,
.card-fan .metric-icon {
  background-color: var(--fan);
}

.metric-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.metric-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.metric-title > span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-icon {
  display: inline-grid;
  width: 31px;
  height: 31px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #071018;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.metric-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric-head b {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 850;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 18px;
}

.metric-value span {
  font-size: clamp(35px, 4.5vw, 48px);
  line-height: 0.95;
  font-weight: 860;
  letter-spacing: 0;
}

.metric-value small {
  color: var(--muted);
  font-size: 16px;
  font-weight: 750;
}

.metric-sub {
  min-height: 20px;
  margin-top: 9px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.bar {
  height: 8px;
  margin-top: 17px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--normal);
  transition: width 260ms ease, background-color 260ms ease;
}

.bar.neutral span {
  background: var(--accent);
}

.panel {
  margin-top: 12px;
  padding: 16px;
}

.history-panel {
  padding: 18px;
}

.panel-head {
  margin-bottom: 14px;
}

canvas {
  width: 100%;
  height: 260px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(12, 19, 27, 0.94), rgba(8, 13, 18, 0.96)),
    var(--surface-2);
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 20px currentColor;
}

.peak-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.peak-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(10, 16, 23, 0.72);
}

.peak-item b {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.peak-item span {
  font-size: 15px;
  font-weight: 780;
}

.cpu-dot {
  background: var(--chart-cpu);
  color: var(--chart-cpu);
}

.gpu-dot {
  background: var(--chart-gpu);
  color: var(--chart-gpu);
}

.disk-dot {
  background: var(--chart-disk);
  color: var(--chart-disk);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 12px;
}

.disk-list {
  display: grid;
  gap: 8px;
}

.disk-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.disk-row:last-child {
  border-bottom: 0;
}

.disk-row strong {
  font-size: 15px;
  font-weight: 780;
}

.disk-row span {
  font-size: 19px;
  font-weight: 820;
}

.facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.facts div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.facts div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.facts dt {
  font-size: 13px;
  font-weight: 780;
}

.facts dd {
  margin: 0;
  font-weight: 780;
  overflow-wrap: anywhere;
}

.state-normal {
  color: var(--normal);
}

.state-warm {
  color: var(--warm);
}

.state-high {
  color: var(--high);
}

.state-critical {
  color: var(--critical);
}

@media (max-width: 1040px) {
  .summary-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .metric-card {
    grid-column: span 2;
  }

  .card-fan,
  .card-clock {
    grid-column: span 3;
  }
}

@media (max-width: 760px) {
  .summary-grid,
  .detail-grid,
  .peak-list {
    grid-template-columns: 1fr;
  }

  .metric-card,
  .card-fan,
  .card-clock {
    grid-column: auto;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1220px);
    padding-top: 18px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .status-pill {
    flex: 1;
  }

  .metric-value span {
    font-size: 38px;
  }
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-shell {
  width: min(100%, 420px);
}

.login-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-brand h1 {
  font-size: 24px;
}

.login-brand p {
  color: var(--muted);
  margin-top: 4px;
}

.login-icon {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #081018;
}

.login-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  padding: 0 12px;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}

.password-field button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.password-field .eye-closed,
.password-field button.is-visible .eye-open {
  display: none;
}

.password-field button.is-visible .eye-closed {
  display: block;
}

.login-submit {
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #081018;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.login-submit:disabled {
  cursor: wait;
  opacity: 0.7;
}

.login-error {
  min-height: 20px;
  color: var(--critical);
  font-size: 14px;
  font-weight: 700;
}
