/* Owner Admin → Infrastruktur. Built on the app.css tokens (--nx-*); status colours stay muted (tinted backgrounds,
   thin accents) — readable status, no dashboard RGB. */

.nx-infra-titlebar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.nx-infra-titlebar h1 { margin-bottom: 4px; }
.nx-infra-sub { margin: 0; color: var(--nx-text-faint); font-size: 0.86rem; }
.nx-infra-titlebar-actions { display: flex; align-items: center; gap: 10px; }
.nx-infra-hint { font-size: 0.78rem; color: var(--nx-text-faint); }
.nx-infra-banner {
    background: rgba(251,191,36,0.08); border: 1px solid rgba(251,191,36,0.25); color: var(--nx-warning);
    border-radius: var(--nx-radius-sm); padding: 8px 12px; font-size: 0.84rem; margin-bottom: 14px;
}
.nx-infra-section { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--nx-text-faint); margin: 28px 0 12px; font-weight: 600; }
.nx-infra-note { font-size: 0.8rem; color: var(--nx-text-faint); line-height: 1.45; }

/* ----- segmented control (host switch, log stream) ----- */
.nx-seg { display: inline-flex; background: var(--nx-bg-elevated); border: 1px solid var(--nx-border); border-radius: var(--nx-radius-sm); padding: 2px; gap: 2px; }
.nx-seg button { background: transparent; border: 0; color: var(--nx-text-dim); padding: 5px 12px; border-radius: 4px; font-size: 0.82rem; cursor: pointer; }
.nx-seg button:hover { color: var(--nx-text); }
.nx-seg button.active { background: var(--nx-bg-hover); color: var(--nx-text); }
.nx-seg small { color: var(--nx-text-faint); }
.nx-infra-hosts { margin-bottom: 16px; }

/* ----- health pill variants + dots ----- */
.nx-health-healthy { background: rgba(74,222,128,0.12); color: var(--nx-success); }
.nx-health-degraded { background: rgba(251,191,36,0.12); color: var(--nx-warning); }
.nx-health-unhealthy, .nx-health-stopped { background: rgba(248,113,113,0.12); color: var(--nx-danger); }
.nx-health-unknown { background: rgba(147,164,186,0.12); color: var(--nx-text-dim); }
.nx-infra-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; background: var(--nx-text-faint); }
.nx-infra-dot-healthy { background: var(--nx-success); box-shadow: 0 0 0 3px rgba(74,222,128,0.12); }
.nx-infra-dot-degraded { background: var(--nx-warning); box-shadow: 0 0 0 3px rgba(251,191,36,0.12); }
.nx-infra-dot-unhealthy, .nx-infra-dot-stopped { background: var(--nx-danger); box-shadow: 0 0 0 3px rgba(248,113,113,0.12); }

/* ----- server hero ----- */
.nx-infra-hero {
    background: var(--nx-bg-card); border: 1px solid var(--nx-border-soft); border-radius: var(--nx-radius);
    padding: 20px 22px; border-left: 3px solid var(--nx-text-faint);
}
.nx-infra-hero-healthy { border-left-color: var(--nx-success); }
.nx-infra-hero-degraded { border-left-color: var(--nx-warning); }
.nx-infra-hero-unhealthy, .nx-infra-hero-stopped { border-left-color: var(--nx-danger); }
.nx-infra-hero-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.nx-infra-hero-name { font-size: 1.45rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.nx-infra-hero-badges { display: flex; align-items: center; gap: 8px; }
.nx-infra-env {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; padding: 4px 10px; border-radius: 999px;
    border: 1px solid var(--nx-border); color: var(--nx-text-dim);
}
.nx-infra-env-prod { border-color: rgba(248,113,113,0.45); color: var(--nx-danger); background: rgba(248,113,113,0.06); }
.nx-infra-env-test { border-color: rgba(96,165,250,0.45); color: var(--nx-info); background: rgba(96,165,250,0.06); }
.nx-infra-env-none { border-style: dashed; }
.nx-infra-hero-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 20px; margin: 0; }
.nx-infra-hero-meta dt, .nx-infra-kv dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--nx-text-faint); margin: 0; }
.nx-infra-hero-meta dd { margin: 2px 0 0; font-size: 0.86rem; color: var(--nx-text); word-break: break-word; }

/* ----- metrics ----- */
.nx-infra-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 12px; }
.nx-infra-metric { background: var(--nx-bg-card); border: 1px solid var(--nx-border-soft); border-radius: var(--nx-radius); padding: 14px 16px; }
.nx-infra-metric-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--nx-text-faint); margin-bottom: 6px; }
.nx-infra-metric-value { font-size: 1.35rem; font-weight: 700; margin-bottom: 10px; }
.nx-infra-metric-value span { font-size: 0.85rem; font-weight: 500; color: var(--nx-text-dim); }
.nx-meter { height: 6px; border-radius: 999px; background: var(--nx-bg-hover); overflow: hidden; }
.nx-meter-fill { height: 100%; border-radius: 999px; transition: width 0.6s ease; }
.nx-meter-low { background: var(--nx-accent); }
.nx-meter-mid { background: var(--nx-warning); }
.nx-meter-high { background: var(--nx-danger); }
.nx-meter-caption { margin-top: 6px; font-size: 0.75rem; color: var(--nx-text-faint); }

/* ----- service cards ----- */
.nx-infra-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.nx-infra-card {
    background: var(--nx-bg-card); border: 1px solid var(--nx-border-soft); border-radius: var(--nx-radius);
    padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; border-top: 2px solid transparent;
}
.nx-infra-card-healthy { border-top-color: rgba(74,222,128,0.55); }
.nx-infra-card-degraded { border-top-color: rgba(251,191,36,0.6); }
.nx-infra-card-unhealthy, .nx-infra-card-stopped { border-top-color: rgba(248,113,113,0.6); }
.nx-infra-card-unknown { border-top-color: var(--nx-border); }
.nx-infra-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nx-infra-card-title { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 1rem; }
.nx-infra-card-summary { font-size: 0.82rem; color: var(--nx-text-dim); margin-top: -6px; }
.nx-infra-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 0; }
.nx-infra-kv > div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--nx-border-soft); padding-bottom: 5px; min-width: 0; }
.nx-infra-kv dd { margin: 0; font-size: 0.84rem; font-variant-numeric: tabular-nums; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-infra-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.nx-infra-checks li, .nx-infra-dep { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.nx-infra-check-label { color: var(--nx-text); }
.nx-infra-check-detail { color: var(--nx-text-faint); margin-left: auto; text-align: right; }
.nx-infra-card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }

.nx-infra-phase { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; border-radius: var(--nx-radius-sm); padding: 8px 10px; }
.nx-infra-phase-busy { background: rgba(90,209,255,0.08); color: var(--nx-accent); }
.nx-infra-phase-ok { background: rgba(74,222,128,0.08); color: var(--nx-success); }
.nx-infra-phase-warn { background: rgba(251,191,36,0.08); color: var(--nx-warning); }
.nx-infra-phase-error { background: rgba(248,113,113,0.08); color: var(--nx-danger); }
.nx-infra-spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: nx-infra-spin 0.8s linear infinite; }
@keyframes nx-infra-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .nx-infra-spinner { animation: none; } .nx-meter-fill { transition: none; } }

.nx-infra-error { background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.25); color: var(--nx-danger); border-radius: var(--nx-radius-sm); padding: 8px 10px; font-size: 0.84rem; }
.nx-infra-error details { margin-top: 6px; color: var(--nx-text-dim); }
.nx-infra-error summary { cursor: pointer; font-size: 0.78rem; }
.nx-infra-error pre { white-space: pre-wrap; word-break: break-word; font-size: 0.75rem; margin: 6px 0 0; max-height: 180px; overflow: auto; }

/* ----- dependencies + events ----- */
.nx-infra-deps { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.nx-infra-dep { background: var(--nx-bg-card); border: 1px solid var(--nx-border-soft); border-radius: var(--nx-radius); padding: 10px 14px; }
.nx-infra-dep-label { font-weight: 600; }
.nx-infra-events { list-style: none; margin: 0; padding: 0; background: var(--nx-bg-card); border: 1px solid var(--nx-border-soft); border-radius: var(--nx-radius); }
.nx-infra-events li { display: flex; align-items: center; gap: 12px; padding: 9px 14px; font-size: 0.84rem; border-bottom: 1px solid var(--nx-border-soft); }
.nx-infra-events li:last-child { border-bottom: 0; }
.nx-infra-events time { color: var(--nx-text-faint); font-variant-numeric: tabular-nums; min-width: 108px; }
.nx-infra-event-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--nx-text-faint); flex-shrink: 0; }
.nx-infra-event-ok { background: var(--nx-success); }
.nx-infra-event-info { background: var(--nx-accent); }
.nx-infra-event-warn { background: var(--nx-warning); }
.nx-infra-event-error { background: var(--nx-danger); }

/* ----- log drawer ----- */
.nx-drawer-backdrop { position: fixed; inset: 0; background: rgba(3,8,14,0.55); z-index: 900; }
.nx-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(920px, 100vw); z-index: 901;
    background: var(--nx-bg-elevated); border-left: 1px solid var(--nx-border); box-shadow: var(--nx-shadow);
    display: flex; flex-direction: column; animation: nx-drawer-in 0.18s ease-out;
}
@keyframes nx-drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .nx-drawer { animation: none; } }
.nx-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 20px 12px; border-bottom: 1px solid var(--nx-border-soft); }
.nx-drawer-kicker { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--nx-text-faint); }
.nx-drawer-title { margin: 2px 0 0; font-size: 1.1rem; }
.nx-drawer-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--nx-border-soft); }
.nx-drawer-check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--nx-text-dim); }
.nx-drawer-spacer { flex: 1; }
.nx-drawer-note { padding: 8px 20px; font-size: 0.8rem; color: var(--nx-text-faint); border-bottom: 1px solid var(--nx-border-soft); }
.nx-drawer-log {
    flex: 1; overflow: auto; background: #060B12; padding: 12px 20px;
    font-family: "Cascadia Code", "Consolas", monospace; font-size: 0.76rem; line-height: 1.5; color: var(--nx-text-dim);
}
.nx-drawer-log .nx-log-line { white-space: pre-wrap; word-break: break-word; }
.nx-drawer-log .nx-log-line-error { color: var(--nx-danger); }
.nx-drawer-log .nx-log-line-warn { color: var(--nx-warning); }
.nx-drawer-muted { color: var(--nx-text-faint); }
.nx-drawer-foot { padding: 8px 20px; font-size: 0.75rem; color: var(--nx-text-faint); border-top: 1px solid var(--nx-border-soft); }

@media (max-width: 640px) {
    .nx-infra-grid { grid-template-columns: 1fr; }
    .nx-infra-kv { grid-template-columns: 1fr; }
    .nx-infra-events time { min-width: 0; }
}
