:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --bg-soft: #101419;
  --panel: #14191f;
  --panel-2: #171d24;
  --line: #27313b;
  --line-soft: #1f2730;
  --text: #eef4f2;
  --muted: #8e9ba7;
  --faint: #66717c;
  --ok: #37d991;
  --warn: #f1b94b;
  --crit: #ef5e67;
  --cyan: #56c7df;
  --shadow: 0 18px 60px rgba(0, 0, 0, .32);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(23, 29, 36, .8), rgba(11, 13, 16, 0) 360px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.15;
  font-weight: 720;
}

h2 {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 720;
}

.subline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

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

.ghost,
.state {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #11161b;
  color: var(--text);
  padding: 0 14px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 680;
}

.ghost {
  cursor: pointer;
}

.ghost:hover {
  border-color: #3b4652;
  background: #161c23;
}

.state {
  min-width: 84px;
  border-color: rgba(55, 217, 145, .45);
  background: rgba(55, 217, 145, .12);
  color: var(--ok);
}

.state.warn {
  border-color: rgba(241, 185, 75, .45);
  background: rgba(241, 185, 75, .12);
  color: var(--warn);
}

.state.crit {
  border-color: rgba(239, 94, 103, .5);
  background: rgba(239, 94, 103, .12);
  color: var(--crit);
}

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

.metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.panel,
.chart-panel {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, 0)), var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 112px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.metric span,
.metric small,
.panel-head p,
.row small,
.event small {
  color: var(--muted);
}

.metric span {
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 760;
}

.metric strong {
  display: block;
  font-size: clamp(22px, 1.7vw, 30px);
  line-height: 1;
  font-weight: 760;
  white-space: nowrap;
}

.metric small {
  display: block;
  margin-top: 8px;
  font-size: 12px;
}

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

.chart-panel {
  padding: 17px;
  min-height: 280px;
}

.chart-panel.wide {
  grid-column: 1 / -1;
}

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

.panel-head p {
  margin-top: 5px;
  font-size: 12px;
}

.panel-head span {
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
}

.panel-head.tight {
  align-items: center;
  margin-bottom: 12px;
}

canvas {
  display: block;
  width: 100%;
  height: 220px;
}

#memoryChart,
#diskChart {
  height: 190px;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  padding: 16px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.row,
.event {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(255, 255, 255, .018);
  padding: 10px 11px;
}

.row.session {
  align-items: flex-start;
  min-height: 72px;
}

.row.session .path {
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  word-break: break-word;
}

.event {
  align-items: flex-start;
  justify-content: flex-start;
}

.compact .row {
  min-height: 40px;
}

.row strong,
.event strong {
  font-size: 13px;
}

.row small,
.event small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

.pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.pill.ok,
.signal.ok {
  color: var(--ok);
  border-color: rgba(55, 217, 145, .42);
  background: rgba(55, 217, 145, .08);
}

.pill.warn,
.signal.warn {
  color: var(--warn);
  border-color: rgba(241, 185, 75, .42);
  background: rgba(241, 185, 75, .09);
}

.pill.crit,
.signal.crit {
  color: var(--crit);
  border-color: rgba(239, 94, 103, .46);
  background: rgba(239, 94, 103, .09);
}

.signal {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  margin-top: 3px;
  border-radius: 99px;
  border: 1px solid;
}

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

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-mark {
  width: 54px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(55, 217, 145, .38);
  border-radius: 7px;
  background: rgba(55, 217, 145, .1);
  color: var(--ok);
  font-size: 12px;
  font-weight: 820;
  margin-bottom: 20px;
}

.login-card h1 {
  font-size: 22px;
}

.login-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

form {
  margin-top: 24px;
}

label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
  margin-bottom: 8px;
}

input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0f1419;
  color: var(--text);
  padding: 0 13px;
  outline: none;
}

input:focus {
  border-color: rgba(55, 217, 145, .65);
  box-shadow: 0 0 0 3px rgba(55, 217, 145, .12);
}

form button {
  width: 100%;
  height: 46px;
  margin-top: 14px;
  border: 0;
  border-radius: 7px;
  background: var(--ok);
  color: #06100c;
  cursor: pointer;
  font-weight: 820;
}

.login-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.login-error {
  min-height: 18px;
  margin-top: 12px;
  color: var(--crit);
  font-size: 13px;
  font-weight: 700;
}

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

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

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

@media (max-width: 860px) {
  .shell {
    width: min(100% - 24px, 1480px);
  }

  .topbar,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics,
  .main-grid,
  .rail,
  .session-grid {
    grid-template-columns: 1fr;
  }

  .chart-panel.wide {
    grid-column: auto;
  }
}
