:root {
  --bg: #080a0f;
  --bg-2: #0d1117;
  --panel: #111722;
  --panel-2: #151d2b;
  --panel-3: #0b1018;
  --border: #263244;
  --border-soft: #1e293b;
  --text: #f8fafc;
  --muted: #8b98aa;
  --soft: #cbd5e1;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --blue: #3b82f6;
  --terminal: #050806;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(140deg, #080a0f 0%, #0b1220 45%, #080a0f 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
  width: min(1440px, calc(100% - 36px));
  margin: 28px auto;
}

.hidden {
  display: none !important;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1;
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 4px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

p {
  color: var(--muted);
}

.login-page {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
}

.logo-box {
  width: 54px;
  height: 54px;
  margin-bottom: 22px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #22c55e;
  color: #052e16;
  font-weight: 950;
  font-size: 25px;
}

#login-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.label {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.metric-card span {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-card strong {
  display: block;
  min-height: 30px;
  color: var(--text);
  font-size: 24px;
  letter-spacing: -0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.split-detail {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.bar {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #0a0f18;
  border: 1px solid var(--border-soft);
}

.bar > div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 220ms ease;
}

.layout {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 18px;
  align-items: stretch;
}

.panel-card {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
}

.side-card,
.console-card {
  padding: 20px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.pill {
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 900;
  background: #1f2937;
  color: var(--soft);
  border: 1px solid #334155;
}

.pill.online {
  background: #063719;
  color: #86efac;
  border-color: #166534;
}

.pill.offline {
  background: #3b0a0a;
  color: #fca5a5;
  border-color: #7f1d1d;
}

.pill.warning {
  background: #3b2504;
  color: #fcd34d;
  border-color: #92400e;
}

.power-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button,
button {
  border: 0;
  border-radius: 13px;
  padding: 12px 14px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.button:hover,
button:hover {
  transform: translateY(-1px);
  filter: brightness(1.07);
}

.button:active,
button:active {
  transform: translateY(0);
}

.green {
  background: var(--green);
  color: #052e16;
}

.red {
  background: var(--red);
  color: #450a0a;
}

.yellow {
  background: var(--yellow);
  color: #451a03;
}

.secondary {
  background: #263244;
  color: var(--text);
  border: 1px solid #334155;
}

.info-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}

.info-boxes > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 15px;
  background: var(--panel-2);
}

.info-boxes span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.info-boxes strong {
  display: block;
  color: var(--soft);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.system-status {
  height: 320px;
  margin: 0;
  padding: 13px;
  border: 1px solid var(--border-soft);
  border-radius: 15px;
  background: var(--panel-3);
  color: #b7c0d4;
  overflow: auto;
  white-space: pre-wrap;
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.console-card {
  min-width: 0;
}

.terminal {
  overflow: hidden;
  border: 1px solid #14391f;
  border-radius: 18px;
  background: var(--terminal);
}

#logs {
  height: 680px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  white-space: pre-wrap;
  color: #d1fae5;
  background: var(--terminal);
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.console-input {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-top: 1px solid #14391f;
  background: #08120b;
}

.console-input span {
  color: var(--green);
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  font-weight: 950;
}

input {
  width: 100%;
  border: 1px solid #334155;
  border-radius: 13px;
  padding: 12px 13px;
  outline: none;
  background: #0b1018;
  color: var(--text);
}

input:focus {
  border-color: var(--green);
}

.console-input input {
  padding: 10px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

.console-input button,
#login-form button {
  background: var(--green);
  color: #052e16;
}

.error {
  color: #fca5a5;
  min-height: 20px;
  margin-top: 12px;
  margin-bottom: 0;
}

@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .system-status {
    height: 230px;
  }
}

@media (max-width: 720px) {
  main {
    width: min(100% - 22px, 1440px);
    margin: 14px auto;
  }

  .topbar {
    flex-direction: column;
  }

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

  .power-grid,
  .info-boxes {
    grid-template-columns: 1fr;
  }

  #logs {
    height: 520px;
  }

  #login-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .console-input {
    grid-template-columns: auto 1fr;
  }

  .console-input button {
    grid-column: 1 / -1;
  }
}
