:root {
  --bg: #0b1220;
  --bg-elev: #121a2b;
  --bg-card: #172033;
  --line: #2a3a55;
  --text: #e8eef8;
  --muted: #8ea0b8;
  --accent: #4cc2c4;
  --accent-2: #f0b45a;
  --ok: #5dcaa5;
  --warn: #e2b15a;
  --crit: #e06b6b;
  --unk: #7d8da3;
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
a { color: inherit; text-decoration: none; }
h1, h2 { font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 1.4rem 0 0.6rem; }
.muted { color: var(--muted); }
.shell { display: flex; min-height: 100vh; }
.sidebar {
  display: none;
  width: 220px;
  padding: 1.25rem 1rem;
  border-right: 1px solid var(--line);
  background: var(--bg-elev);
  flex-direction: column;
  gap: 1.5rem;
}
.brand { display: flex; gap: 0.7rem; align-items: center; }
.brand small { display: block; color: var(--muted); font-size: 0.75rem; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px;
  object-fit: cover; display: block; flex-shrink: 0;
  border: 0; outline: none; box-shadow: none;
}
.status-block { text-align: right; max-width: 16rem; }
.status-reasons {
  list-style: none; margin: 0.45rem 0 0; padding: 0;
  font-size: 0.72rem; color: var(--muted); text-align: right;
}
.status-reasons li { margin: 0.15rem 0; }
.side-nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.side-nav a {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  color: var(--muted);
}
.side-nav a.active, .bottom-nav a.active { background: var(--bg-card); color: var(--text); }
.logout button, button, .login-card button {
  background: var(--accent);
  color: #062022;
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-weight: 650;
  cursor: pointer;
  width: 100%;
}
.logout button { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.main { flex: 1; padding: 1rem 1rem 7rem; max-width: 1100px; width: 100%; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.top-status {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--unk);
  color: #061018;
}
.top-status.HEALTHY { background: var(--ok); }
.top-status.WARNING { background: var(--warn); }
.top-status.CRITICAL { background: var(--crit); color: #1a0606; }
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
.metric, .card, .row {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.metric { padding: 0.95rem 1rem; border-left: 3px solid var(--line); }
.metric-btn { cursor: pointer; }
.metric-btn[aria-expanded="true"] { box-shadow: inset 0 0 0 1px var(--accent); }
.metric .metric-head { display: flex; align-items: center; gap: 0.55rem; }
.metric-icon {
  width: 2.05rem; height: 2.05rem; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
  background: #243049; color: var(--accent);
}
.metric-icon svg, .dash-icon svg, .identity-toggle svg, .chevron, .fav-btn svg, .dash-empty svg, .server-icon svg {
  width: 1.15rem; height: 1.15rem; stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.metric .label { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.metric .value { font-size: 1.55rem; font-weight: 700; margin-top: 0.45rem; }
.metric.ok { border-left-color: var(--ok); }
.metric.ok .metric-icon { background: rgba(93, 202, 165, 0.16); color: var(--ok); }
.metric.ok .value { color: var(--ok); }
.metric.warn { border-left-color: var(--warn); }
.metric.warn .metric-icon { background: rgba(226, 177, 90, 0.16); color: var(--warn); }
.metric.warn .value { color: var(--warn); }
.metric.crit { border-left-color: var(--crit); }
.metric.crit .metric-icon { background: rgba(224, 107, 107, 0.16); color: var(--crit); }
.metric.crit .value { color: var(--crit); }
.metric.unk .value { color: var(--unk); }
.list { display: flex; flex-direction: column; gap: 0.45rem; }
.row { display: flex; justify-content: space-between; align-items: center; padding: 0.7rem 0.85rem; }
.chip {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem; border-radius: 999px; background: #2a3548; color: var(--muted);
}
.chip.ONLINE, .chip.HEALTHY, .chip.SUCCESS, .chip.ok { background: rgba(93, 202, 165, 0.18); color: var(--ok); }
.chip.WARNING, .chip.warn { background: rgba(226, 177, 90, 0.18); color: var(--warn); }
.chip.OFFLINE, .chip.CRITICAL, .chip.FAILED, .chip.crit { background: rgba(224, 107, 107, 0.18); color: var(--crit); }
.chip.RUNNING { background: rgba(91, 156, 246, 0.18); color: var(--accent); }
.chip.UNKNOWN { background: #2a3548; color: var(--unk); }
.card { padding: 0.9rem 1rem; }
.identity { margin-bottom: 0.9rem; padding: 0.55rem 0.75rem; }
.identity h2 { margin-top: 0; }
.identity-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  background: transparent !important;
  color: var(--text) !important;
  padding: 0.35rem 0.15rem;
  text-align: left;
  font-weight: 650;
  cursor: pointer;
}
.identity-toggle-main { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.identity-toggle-main small { display: block; font-weight: 500; margin-top: 0.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-toggle .chevron { width: 1.35rem; height: 1.35rem; color: var(--muted); transition: transform 0.15s ease; flex-shrink: 0; }
.identity.open .chevron { transform: rotate(180deg); }
.identity-body { padding: 0.35rem 0.2rem 0.45rem; border-top: 1px solid var(--line); margin-top: 0.45rem; }
.identity dl {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem 1rem;
  margin: 0.35rem 0 0;
}
.identity dl > div { display: grid; grid-template-columns: 7.2rem 1fr; gap: 0.35rem 0.75rem; align-items: baseline; }
.identity dt {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.identity dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.grid-2 { display: grid; gap: 0.8rem; }
.banner.error { background: rgba(224, 107, 107, 0.15); color: var(--crit); padding: 0.7rem; border-radius: 10px; margin: 0.8rem 0; }
.banner.ok { background: rgba(93, 202, 165, 0.15); color: var(--ok); padding: 0.7rem; border-radius: 10px; margin: 0.8rem 0; }
.banner.warn { background: rgba(226, 177, 90, 0.15); color: var(--warn); padding: 0.7rem; border-radius: 10px; margin: 0; font-size: 0.82rem; }
.card label { display: block; margin: 0.85rem 0; color: var(--muted); font-size: 0.85rem; }
.card input {
  display: block; width: 100%; margin-top: 0.35rem; padding: 0.7rem 0.75rem;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.login-card { width: min(420px, 100%); background: var(--bg-elev); border: 1px solid var(--line); border-radius: 20px; padding: 1.5rem; }
.login-card h1 { margin: 1rem 0 0.3rem; }
.login-card label { display: block; margin: 0.85rem 0; color: var(--muted); font-size: 0.85rem; }
.login-card input {
  display: block; width: 100%; margin-top: 0.35rem; padding: 0.7rem 0.75rem;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 0.2rem;
  background: rgba(11, 18, 32, 0.96);
  border-top: 1px solid var(--line);
  padding: 0.4rem 0.35rem calc(0.55rem + env(safe-area-inset-bottom));
  backdrop-filter: blur(10px);
  z-index: 20;
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: 3.6rem;
  padding: 0.4rem 0.2rem;
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav svg {
  width: 1.85rem;
  height: 1.85rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  pointer-events: none;
}
.bottom-nav a.active svg { color: var(--accent); }
.range-tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.range-tabs button { width: auto; background: var(--bg-card); color: var(--muted); }
.range-tabs button.active { background: var(--accent); color: #062022; }
.charts { display: grid; gap: 0.8rem; }
.charts canvas { width: 100%; display: block; }
.fav-btn {
  width: 2.7rem !important;
  min-height: 2.7rem;
  flex-shrink: 0;
  background: #243049 !important;
  color: var(--muted);
  border-radius: 12px;
  padding: 0;
  display: grid;
  place-items: center;
}
.fav-btn svg { width: 1.4rem; height: 1.4rem; pointer-events: none; }
.fav-btn.on { color: var(--accent-2); background: rgba(240, 180, 90, 0.16) !important; }
.fav-btn.on svg { fill: currentColor; }
.item-row { gap: 0.7rem; border: 0; padding: 0; background: transparent; }
.item-copy { flex: 1; min-width: 0; }
.item-card .muted { margin: 0.45rem 0 0 3.4rem; }
.item-actions { margin: 0.55rem 0 0 3.4rem; }
.item-actions-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.btn-restart {
  width: auto !important;
  min-width: 0;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  background: #243049 !important;
  color: var(--text) !important;
  border: 1px solid var(--line);
}
.btn-restart.danger {
  color: var(--crit) !important;
  border-color: rgba(224, 107, 107, 0.45);
}
.restart-form {
  margin: 0.65rem 0 0;
  display: grid;
  gap: 0.4rem;
}
.restart-form label { margin: 0; }
.restart-form button[type="submit"] { width: auto; justify-self: start; }
.restart-msg .banner { margin: 0.35rem 0 0; }
.item-card .log-panel { margin: 0.65rem 0 0 3.4rem; }
.log-panel {
  margin-top: 0.65rem;
  max-height: 16rem;
  overflow: auto;
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}
.dash-grid { display: grid; gap: 0.55rem; }
.dash-tile, .dash-empty {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--radius);
}
.dash-tile.ONLINE, .dash-tile.HEALTHY, .dash-tile.SUCCESS { border-left-color: var(--ok); }
.dash-tile.WARNING { border-left-color: var(--warn); }
.dash-tile.OFFLINE, .dash-tile.CRITICAL, .dash-tile.FAILED { border-left-color: var(--crit); }
.dash-tile.RUNNING { border-left-color: var(--accent); }
.dash-icon {
  width: 2.2rem; height: 2.2rem; border-radius: 10px;
  display: grid; place-items: center; background: #243049; color: var(--accent); flex-shrink: 0;
}
.dash-tile.ONLINE .dash-icon, .dash-panel.ONLINE .metric-icon,
.dash-panel.SUCCESS .metric-icon { background: rgba(93, 202, 165, 0.16); color: var(--ok); }
.dash-tile.OFFLINE .dash-icon, .dash-tile.CRITICAL .dash-icon,
.dash-panel.FAILED .metric-icon { background: rgba(224, 107, 107, 0.16); color: var(--crit); }
.dash-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.dash-copy small { color: var(--muted); font-size: 0.75rem; }
.dash-empty { color: var(--muted); }
.dash-empty svg { width: 1.2rem; height: 1.2rem; flex-shrink: 0; color: var(--accent-2); }
.dash-panel-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.55rem; }
.dash-stat { font-size: 1.7rem; font-weight: 700; color: var(--accent-2); }
.dash-stat small { display: block; font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.15rem; }
.dash-panel.ONLINE, .dash-panel.SUCCESS { border-left: 3px solid var(--ok); }
.dash-panel.WARNING { border-left: 3px solid var(--warn); }
.dash-panel.FAILED, .dash-panel.CRITICAL, .dash-panel.OFFLINE { border-left: 3px solid var(--crit); }
.dash-panel.RUNNING { border-left: 3px solid var(--accent); }
a.dash-panel { color: inherit; text-decoration: none; display: block; }
.facts { display: grid; gap: 0.45rem; margin: 0; }
.facts > div { display: grid; grid-template-columns: 8.2rem 1fr; gap: 0.3rem 0.7rem; align-items: baseline; }
.facts dt {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.facts dd { margin: 0; word-break: break-word; }
.log-tail {
  margin: 0;
  max-height: 16rem;
  overflow: auto;
  font-size: 0.75rem;
  line-height: 1.35;
  white-space: pre-wrap;
  color: var(--muted);
}
.inline-form { display: grid; gap: 0.6rem; }
@media (min-width: 700px) {
  .inline-form { grid-template-columns: 1fr auto; align-items: end; }
}
.inline-form button { width: auto; min-width: 7rem; }
.check { display: flex !important; align-items: center; gap: 0.45rem; color: var(--text); }
.check input { width: auto; margin: 0; }
.linkish {
  width: auto !important;
  background: transparent !important;
  color: var(--accent) !important;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
}
.table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th, .data-table td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .mono { font-variant-numeric: tabular-nums; color: var(--muted); }
.proc-top tr.warn td:nth-child(4) { color: var(--warn); }
.proc-top tr.crit td:nth-child(4) { color: var(--crit); }
@media (max-width: 699px) {
  .proc-top .col-user, .proc-top .col-ram { display: none; }
}
.lookup .row { margin-top: 0.4rem; }
.timeline { display: grid; gap: 0.9rem; }
.cluster {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.9rem;
}
.cluster.CRITICAL { border-left: 3px solid var(--crit); }
.cluster.WARNING { border-left: 3px solid var(--warn); }
.cluster.INFO { border-left: 3px solid var(--accent); }
.cluster-head { display: flex; justify-content: space-between; gap: 0.7rem; align-items: center; margin-bottom: 0.55rem; }
.cluster-head small { color: var(--muted); }
.timeline-item {
  display: grid;
  grid-template-columns: 5.8rem 1fr;
  gap: 0.65rem;
  padding: 0.35rem 0;
  border-top: 1px solid var(--line);
}
.timeline-item:first-of-type { border-top: 0; }
.timeline-item time { color: var(--muted); font-size: 0.75rem; }
.event-list { display: grid; gap: 0.45rem; }
@media (min-width: 900px) {
  .sidebar { display: flex; }
  .bottom-nav { display: none; }
  .main { padding: 1.5rem 2rem; }
  .metrics { grid-template-columns: repeat(4, 1fr); }
  .grid-2, .charts, .dash-grid { grid-template-columns: 1fr 1fr; }
  .identity dl { grid-template-columns: 1fr 1fr; }
}
