:root {
  --bg: #0f1217; --panel: #161b22; --panel2: #1c2230; --border: #262e3b;
  --text: #e6e9ef; --muted: #8b95a7; --ok: #3fb950; --warn: #d29922; --bad: #f85149; --accent: #58a6ff;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; background: var(--panel2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.warn { color: var(--warn); }
.err { color: var(--bad); }
.mono { font-family: var(--mono); }

.top { display: flex; align-items: center; gap: 16px; padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand .muted { font-weight: 400; font-size: 13px; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.hostline { flex: 1; color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); white-space: nowrap; }

main { max-width: 1440px; margin: 0 auto; padding: 14px 20px 60px; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 10px; }
.summary { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 2px; color: var(--muted); }
.summary .spacer { flex: 1; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.card.st-ok { border-left-color: var(--ok); }
.card.st-warn { border-left-color: var(--warn); }
.card.st-bad { border-left-color: var(--bad); }
.card.st-muted { border-left-color: var(--border); opacity: .8; }
.card header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h3 { margin: 0; font-size: 15px; flex: 1 1 auto; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .02em; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.pill.st-ok { color: var(--ok); border-color: rgba(63,185,80,.4); background: rgba(63,185,80,.1); }
.pill.st-warn { color: var(--warn); border-color: rgba(210,153,34,.4); background: rgba(210,153,34,.1); }
.pill.st-bad { color: var(--bad); border-color: rgba(248,81,73,.4); background: rgba(248,81,73,.1); }
.pill.build-prod { color: #7ee787; border-color: rgba(126,231,135,.35); }
.pill.build-dev { color: #f2cc60; border-color: rgba(242,204,96,.4); }
.pill.build-unknown { color: var(--muted); }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.stack { color: var(--muted); }
.port { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--panel2); border: 1px solid var(--border); white-space: nowrap; }
.port::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; background: var(--bad); }
.port.on::before { background: var(--ok); }
.probe { font-family: var(--mono); font-size: 12px; }
.probe.ok { color: var(--ok); }
.probe.bad { color: var(--bad); }
.cert { font-size: 12px; white-space: nowrap; }
.cert.ok { color: var(--muted); }
.cert.warn { color: var(--warn); }
.cert.bad { color: var(--bad); }
.meta { color: var(--muted); font-size: 12px; word-break: break-word; }
.notes { font-size: 12px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 6px; }
.actions { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }

.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 11px; font: inherit; font-size: 12px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ok { color: var(--ok); }
.btn-warn { color: var(--warn); }
.btn-bad { color: var(--bad); }
.btn-ghost { background: transparent; }
.btn-big { display: inline-block; margin: 16px 0 6px; padding: 11px 22px; font-size: 15px; background: var(--accent); color: #0b1220; border: none; font-weight: 700; }
.btn-big:hover { text-decoration: none; filter: brightness(1.1); }

.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }

#toast { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 20; }
.toast { background: var(--panel2); border: 1px solid var(--border); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 6px; max-width: 460px; font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 30; }
.modal.hidden { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; width: min(1000px, 94vw); max-height: 86vh; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
.modal pre { margin: 0; padding: 12px 14px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.4; white-space: pre-wrap; word-break: break-all; }

.spin { display: inline-block; width: 10px; height: 10px; border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 28px 30px; width: min(440px, 100%); text-align: center; }
.login-card h1 { margin: 8px 0 6px; font-size: 22px; }
.login-card p { color: var(--muted); margin: 6px 0; }

@media (max-width: 640px) {
  .top { flex-wrap: wrap; }
  .hostline { order: 3; flex-basis: 100%; white-space: normal; }
  main { padding: 12px; }
}
