:root {
    --bg: #f4f6f9; --card: #fff; --ink: #1f2933; --muted: #6b7280;
    --primary: #2563eb; --primary-d: #1d4ed8; --border: #e5e7eb;
    --ok: #16a34a; --okbg: #dcfce7; --warn: #b45309; --warnbg: #fef3c7;
    --err: #dc2626; --errbg: #fee2e2; --wait: #2563eb; --waitbg: #dbeafe;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: var(--bg); color: var(--ink); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { display: flex; justify-content: space-between; align-items: center;
    padding: 14px 22px; background: #0f172a; color: #fff; }
.topbar a { color: #cbd5e1; margin-left: 16px; }
.topbar .brand { color: #fff; font-weight: 600; margin: 0; }
.topbar .who { color: #94a3b8; font-size: .9rem; }

.container { max-width: 940px; margin: 28px auto; padding: 0 18px; }
.foot { text-align: center; color: var(--muted); padding: 30px; font-size: .85rem; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 22px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card.narrow { max-width: 420px; margin: 40px auto; }

h1 { font-size: 1.5rem; margin: 0 0 16px; }
.head-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.muted { color: var(--muted); font-size: .92rem; }

label { display: block; margin: 14px 0 6px; font-weight: 500; }
input, select { width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 1rem; background: #fff; }

.btn { display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
    background: #fff; color: var(--ink); cursor: pointer; font-size: .95rem; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); text-decoration: none; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
button.btn { font: inherit; }
form button { margin-top: 12px; }
.inline { display: inline; }
.inline button { margin-top: 0; }

.flash { background: var(--warnbg); color: var(--warn); border: 1px solid #fcd34d;
    padding: 10px 14px; border-radius: 8px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.instance .inst-top { display: flex; justify-content: space-between; align-items: center; }
.inst-meta { color: var(--muted); font-size: .85rem; margin: 8px 0 14px; display: flex; gap: 14px; }
.inst-actions { display: flex; gap: 8px; align-items: center; }

.badge { font-size: .78rem; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.badge.ok { background: var(--okbg); color: var(--ok); }
.badge.wait { background: var(--waitbg); color: var(--wait); }
.badge.warn { background: var(--warnbg); color: var(--warn); }
.badge.err { background: var(--errbg); color: var(--err); }

.alias-row { display: flex; align-items: stretch; }
.alias-row input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.alias-row .suffix { display: flex; align-items: center; padding: 0 12px; background: #f1f5f9;
    border: 1px solid var(--border); border-left: 0; border-radius: 0 8px 8px 0; color: var(--muted); }
.hint { font-size: .88rem; min-height: 1.2em; margin: 6px 0 0; }
.hint.ok { color: var(--ok); } .hint.err { color: var(--err); }

.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: .9rem; }
.table th { background: #f8fafc; }
.actions-cell input { width: 70px; display: inline-block; }
.actions-cell .btn { margin: 2px; padding: 5px 10px; font-size: .82rem; }
