/* ── Logs ── */
.log-box {
  background: var(--bg);
  border: 1px solid var(--b1);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted2);
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all
}

.log-box .ok {
  color: var(--accent)
}

.log-box .err {
  color: var(--red)
}

.log-box .info {
  color: var(--blue)
}

.log-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted2);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 12px;
  padding: 6px 14px 8px;
  transition: all .12s
}

.log-tab:hover {
  color: var(--text)
}

.log-tab.on {
  color: var(--accent);
  border-bottom-color: var(--accent)
}

.b-test {
  background: rgba(212, 144, 10, .12);
  color: var(--yellow)
}

.b-test::before {
  display: none
}

/* ── Events ── */
.ev {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--b1)
}

.ev:last-child {
  border-bottom: none
}

.ev-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0
}

.ev-title {
  font-size: 13px
}

.ev-meta {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: 2px
}

/* ── Resource bars ── */
.rbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px
}

.rbar-track {
  flex: 1;
  height: 5px;
  background: var(--b2);
  border-radius: 99px;
  overflow: hidden
}

.rbar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .3s
}

.rbar-fill.ok {
  background: var(--green)
}

.rbar-fill.warn {
  background: var(--yellow)
}

.rbar-fill.attn {
  background: var(--orange)
}

.rbar-fill.crit {
  background: var(--red)
}

/* Toggle switch */
.field .toggle-wrap { display: flex }
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted2);
  user-select: none;
  white-space: nowrap
}
.toggle-wrap input[type=checkbox] { display: none }
.toggle {
  width: 32px;
  height: 18px;
  background: var(--b2);
  border: 1px solid var(--b3);
  border-radius: 99px;
  position: relative;
  transition: background .2s, border-color .2s;
  flex-shrink: 0
}
.toggle::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--muted2);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: left .2s, background .2s
}
.toggle-wrap input:checked ~ .toggle {
  background: var(--accent);
  border-color: var(--accent)
}
.toggle-wrap input:checked ~ .toggle::after {
  left: 16px;
  background: var(--bg)
}
.toggle-wrap:hover .toggle { border-color: var(--accent2) }
.toggle-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  font-size: 9px;
  font-weight: 700;
  border-radius: 99px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  padding: 0 3px;
  vertical-align: middle;
  margin-left: 2px
}

.rbar-label {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted2);
  white-space: nowrap;
  min-width: 60px;
  text-align: right
}

.stat-cell {
  display: flex;
  flex-direction: column;
  gap: 4px
}

/* ── Server chart period dropdown ── */
.sc-menu-item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: background .15s;
}
.sc-menu-item:hover { background: var(--s1); }
.sc-menu-item:first-child { border-radius: 6px 6px 0 0; }
.sc-menu-item:last-child  { border-radius: 0 0 6px 6px; }

/* ── Diag cards ── */
.diag-card {
  background: var(--s1);
  border: 1px solid var(--b1);
  border-radius: 10px;
  padding: 20px 22px
}

.diag-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px
}

.diag-card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600
}

.diag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0
}

.diag-dot.ok {
  background: var(--accent)
}

.diag-dot.err {
  background: var(--red)
}

.diag-dot.warn {
  background: var(--yellow)
}

.diag-dot.off {
  background: var(--muted)
}

.diag-meta {
  font-size: 11px;
  color: var(--muted2);
  font-family: var(--mono);
  line-height: 1.6;
  margin-bottom: 14px;
  min-height: 18px
}

.diag-result {
  font-size: 12px;
  min-height: 18px;
  margin-top: 8px;
  font-family: var(--mono);
  border-top: 1px solid var(--b1);
  padding-top: 10px;
  display: none
}

.diag-result.on {
  display: block
}

.diag-result.ok {
  color: var(--accent)
}

.diag-result.err {
  color: var(--red)
}

.diag-inputs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px
}

.diag-inputs input {
  flex: 1;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--b2);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-family: var(--mono);
  outline: none
}

.diag-inputs input:focus {
  border-color: var(--accent)
}

.secret-blur {
  filter: blur(5px);
  transition: filter .2s
}

.secret-blur.revealed {
  filter: none
}

@media(max-width:800px) {
  #app.on {
    grid-template-columns: 1fr
  }

  .sidebar {
    display: none
  }

  .cards {
    grid-template-columns: repeat(2, 1fr)
  }
}
