/* ── Services chip in toolbar ── */
.svc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-variant-numeric: tabular-nums;
}

.svc-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.2);
  transition: background 300ms ease, box-shadow 300ms ease;
}

.svc-dot.up {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.22);
  animation: svc-pulse 2.8s ease-in-out infinite;
}

.svc-dot.slow {
  background: #eab308;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.22);
}

.svc-dot.down {
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.22);
}

@keyframes svc-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.22); }
  50%       { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.06); }
}

/* ── Backdrop ── */
.svc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(4, 6, 10, 0.45);
}

/* ── Drawer ── */
.svc-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 100vw);
  z-index: 96;
  display: flex;
  flex-direction: column;
  background: rgba(9, 12, 18, 0.97);
  border-left: 0.5px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: -16px 0 48px rgba(2, 6, 23, 0.55);
  overflow: hidden;
}

.svc-drawer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 14px 11px;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.svc-drawer-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

.svc-drawer-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  margin-left: 2px;
}

.svc-drawer-spacer { flex: 1; }

.svc-refresh-btn,
.svc-close-btn {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 140ms, color 140ms;
  flex-shrink: 0;
}

.svc-refresh-btn:hover,
.svc-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.svc-refresh-btn svg,
.svc-close-btn svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}

.svc-spinning svg {
  animation: svc-spin 700ms linear infinite;
}

@keyframes svc-spin { to { transform: rotate(360deg); } }

/* ── Body ── */
.svc-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 20px;
}

.svc-group-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.2);
  padding: 14px 14px 5px;
}

.svc-group-label:first-child { padding-top: 8px; }

.svc-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 6px 14px;
  transition: background 120ms;
}

.svc-row:hover { background: rgba(255, 255, 255, 0.03); }

.svc-row-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  justify-self: center;
  background: rgba(255, 255, 255, 0.12);
  transition: background 300ms, box-shadow 300ms;
}

.svc-row-dot.up   { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,0.18); }
.svc-row-dot.slow { background: #eab308; box-shadow: 0 0 0 2px rgba(234,179,8,0.18); }
.svc-row-dot.down { background: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,0.18); }

.svc-row-name {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.svc-row-links {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.svc-pill {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  display: inline-block;
  line-height: 1.5;
  transition: background 120ms, color 120ms;
}

.svc-pill-lan {
  border: 0.5px solid rgba(56, 189, 248, 0.28);
  color: rgba(100, 190, 240, 0.82);
  background: rgba(56, 189, 248, 0.05);
}
.svc-pill-lan:hover {
  background: rgba(56, 189, 248, 0.13);
  color: rgba(147, 220, 255, 1);
}

.svc-pill-ts {
  border: 0.5px solid rgba(139, 92, 246, 0.28);
  color: rgba(165, 140, 255, 0.82);
  background: rgba(139, 92, 246, 0.05);
}
.svc-pill-ts:hover {
  background: rgba(139, 92, 246, 0.13);
  color: rgba(196, 175, 255, 1);
}

/* ── Footer ── */
.svc-drawer-footer {
  flex-shrink: 0;
  padding: 8px 14px;
  border-top: 0.5px solid rgba(255, 255, 255, 0.05);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.18);
}

/* ── Light theme overrides (drawer must not stay dark) ── */
html:not([data-theme="dark"]) .svc-backdrop { background: rgba(15, 18, 28, 0.26); }
html:not([data-theme="dark"]) .svc-drawer {
  background: rgba(255, 255, 255, 0.98);
  border-left-color: var(--border);
  box-shadow: -16px 0 48px rgba(40, 38, 60, 0.16);
}
html:not([data-theme="dark"]) .svc-drawer-head { border-bottom-color: var(--border); }
html:not([data-theme="dark"]) .svc-drawer-title { color: var(--text-3); }
html:not([data-theme="dark"]) .svc-drawer-count { color: var(--text-1); }
html:not([data-theme="dark"]) .svc-refresh-btn,
html:not([data-theme="dark"]) .svc-close-btn { background: var(--bg-raised); color: var(--text-2); }
html:not([data-theme="dark"]) .svc-refresh-btn:hover,
html:not([data-theme="dark"]) .svc-close-btn:hover { background: var(--bg-active); color: var(--text-1); }
html:not([data-theme="dark"]) .svc-group-label { color: var(--text-3); }
html:not([data-theme="dark"]) .svc-row:hover { background: var(--bg-hover); }
html:not([data-theme="dark"]) .svc-dot,
html:not([data-theme="dark"]) .svc-row-dot { background: var(--border-strong); }
html:not([data-theme="dark"]) .svc-row-name { color: var(--text-1); }
html:not([data-theme="dark"]) .svc-pill-lan {
  border-color: rgba(37, 99, 235, 0.30);
  color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
}
html:not([data-theme="dark"]) .svc-pill-lan:hover { background: rgba(37, 99, 235, 0.14); color: #1d4ed8; }
html:not([data-theme="dark"]) .svc-pill-ts {
  border-color: rgba(124, 58, 237, 0.30);
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.06);
}
html:not([data-theme="dark"]) .svc-pill-ts:hover { background: rgba(124, 58, 237, 0.14); color: #6d28d9; }
html:not([data-theme="dark"]) .svc-drawer-footer { border-top-color: var(--border); color: var(--text-3); }

/* ── Mobile: bottom sheet ── */
@media (max-width: 540px) {
  .svc-drawer {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 78vh;
    border-left: none;
    border-top: 0.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -16px 48px rgba(2, 6, 23, 0.55);
  }
}
