:root {
    --bg: #0f1115;
    --panel: #171a21;
    --panel2: #1f232c;
    --border: #2a2f3a;
    --text: #e6e8ee;
    --muted: #8a92a5;
    --accent: #ff6b9a;
    --good: #5ad67d;
    --bad: #ff6b6b;
    --warn: #f0b429;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, sans-serif; }
a { color: var(--accent); }
button, input, textarea, select {
    background: var(--panel2); color: var(--text); border: 1px solid var(--border);
    padding: 8px 12px; border-radius: 6px; font: inherit;
}
button { cursor: pointer; transition: background 0.1s; }
button:hover { background: #262b36; }
button.primary { background: var(--accent); color: #14161c; border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }
button.danger { color: var(--bad); border-color: var(--bad); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
pre.code { background: #0a0c10; padding: 12px; border-radius: 6px; overflow-x: auto; font: 13px/1.4 ui-monospace, monospace; white-space: pre-wrap; word-break: break-all; }

header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px; border-bottom: 1px solid var(--border);
}
header h1 { margin: 0; font-size: 20px; color: var(--accent); }
nav { display: flex; gap: 8px; }
main { max-width: 1100px; margin: 24px auto; padding: 0 24px; }

.vm {
    display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
    padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel); margin-bottom: 10px;
}
.vm .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.vm.alive .dot { background: var(--good); }
.vm.dead  .dot { background: var(--bad); }
.vm .name { font-weight: 600; font-size: 16px; }
.vm .meta { color: var(--muted); font-size: 13px; }
.vm .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.vm .vm-body { min-width: 0; }
.vm .name { display: flex; align-items: center; gap: 8px; }
.vm .ips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.vm .sub { color: var(--muted); font-size: 12px; }

button.ghost {
    background: transparent; border: 1px dashed var(--border); color: var(--muted);
    padding: 2px 8px; font-size: 12px; border-radius: 4px;
}
button.ghost:hover { color: var(--text); border-color: var(--accent); }

.ip-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--panel2); border: 1px solid var(--border);
    padding: 2px 8px; border-radius: 999px; font: 12px ui-monospace, monospace;
    cursor: pointer; transition: border-color 0.1s;
}
.ip-badge:hover { border-color: var(--accent); }
.ip-badge .ip-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.ip-badge .ip-value { color: var(--text); }

.history { max-height: 60vh; overflow-y: auto; }
.hist-row { border: 1px solid var(--border); border-radius: 6px; padding: 10px; margin-bottom: 8px; background: var(--panel2); }
.hist-row.fail { border-color: var(--bad); }
.hist-row.ok   { border-color: transparent; }
.hist-head { display: flex; gap: 10px; align-items: center; font-size: 12px; }
.hist-head .kind { font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; }
.hist-head .exit { margin-left: auto; color: var(--muted); }
.hist-payload { margin-top: 6px; font: 12px ui-monospace, monospace; color: var(--muted); word-break: break-all; }
.hist-result { margin: 6px 0 0; background: #0a0c10; padding: 8px; border-radius: 4px; font: 11px/1.4 ui-monospace, monospace; white-space: pre-wrap; max-height: 200px; overflow-y: auto; }

/* login */
body.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
body.login .card { width: 320px; text-align: center; }
body.login input { display: block; width: 100%; margin: 12px 0; }
body.login button { width: 100%; background: var(--accent); color: #14161c; font-weight: 600; border-color: var(--accent); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal-body { width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; }
.modal h2 { margin-top: 0; }
.modal label { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.modal input, .modal textarea, .modal select { width: 100%; }
.modal textarea { font: 13px/1.4 ui-monospace, monospace; min-height: 80px; }
.modal .btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.output { background: #0a0c10; padding: 10px; border-radius: 6px; font: 12px/1.4 ui-monospace, monospace; white-space: pre-wrap; max-height: 300px; overflow-y: auto; margin-top: 8px; }
.output.bad { color: var(--bad); }
.output.good { color: var(--good); }

/* mobile */
@media (max-width: 640px) {
    main { padding: 0 12px; margin: 12px auto; }
    header { padding: 12px 16px; }
    .vm { grid-template-columns: auto 1fr; }
    .vm .actions { grid-column: 1 / -1; }
}
