:root {
  --bg: #f5f6fa; --surface: #fff; --surface-2: #f8f9fc; --line: #e3e6ee; --ink: #111827; --ink-2: #374151; --muted: #6b7280;
  --brand: #2563eb; --brand-soft: #eef3ff; --ok: #047857; --ok-soft: #ecfdf5; --err: #b91c1c; --err-soft: #fef2f2; --warn: #b45309; --warn-soft: #fffbeb;
  --radius: 14px; --shadow: 0 1px 2px rgba(17,24,39,.05), 0 1px 3px rgba(17,24,39,.07);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1017; --surface: #151a23; --surface-2: #1b212c; --line: #262d3b; --ink: #eef1f6; --ink-2: #cbd2de; --muted: #8b93a7;
    --brand: #4f8cff; --brand-soft: #18233a; --ok: #34d399; --ok-soft: #10261f; --err: #f87171; --err-soft: #2a1517; --warn: #fbbf24; --warn-soft: #2a2213;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14.5px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; overflow-wrap: anywhere; }
pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; text-align: left; }
h1 { font-size: 22px; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 15px; margin: 0 0 12px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 28px; padding-bottom: 60px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 18px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.brand.big { font-size: 18px; justify-content: center; margin-bottom: 6px; }
.brand .host { font-weight: 500; color: var(--muted); font-size: 12.5px; }
.mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 800; }
.top nav { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.top nav a { padding: 7px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.top nav a:hover { color: var(--ink); background: var(--surface-2); }
.top nav a.on { color: var(--brand); background: var(--brand-soft); }
.logout { margin: 0; }

.head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.count { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; vertical-align: middle; margin-left: 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card.narrow { max-width: 420px; margin: 60px auto; }
.card.center { text-align: center; }
.card.empty { text-align: center; color: var(--muted); padding: 36px; }
.card.table { padding: 0; overflow: visible; }

label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
input, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; height: 40px; padding: 0 12px; width: 100%; outline: none; }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row .grow { flex: 1 1 220px; }
.row .small { flex: 0 0 120px; }
.row .arrow { padding-bottom: 9px; color: var(--muted); font-size: 18px; }
.with-btn { display: flex; gap: 6px; }
.with-btn input { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.07); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.red { background: var(--err); }

.login { display: grid; gap: 14px; }
.login .btn { width: 100%; }

.filters { display: flex; gap: 8px; margin: 4px 0 14px; flex-wrap: wrap; }
.filters select { width: auto; min-width: 180px; height: 36px; }
.filters input { width: 220px; height: 36px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.card.table th:first-child { border-top-left-radius: var(--radius); }
.card.table th:last-child { border-top-right-radius: var(--radius); }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td.strong { font-weight: 600; overflow-wrap: anywhere; }
td.actions { text-align: right; width: 1%; white-space: nowrap; }
tr.warnrow td { background: var(--warn-soft); }

details { position: relative; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 320px; text-align: left; white-space: normal; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px -12px rgba(0,0,0,.35); padding: 14px; display: grid; gap: 14px; }
.pop form { display: grid; gap: 8px; }
.pop form + form { border-top: 1px solid var(--line); padding-top: 14px; }
.pop .danger label b { color: var(--err); overflow-wrap: anywhere; }

.chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 4px 2px 0; padding: 2px 4px 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: 13px; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 5px; border-radius: 999px; }
.chip button:hover { color: var(--err); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); margin-left: 6px; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

.domain { padding: 0; }
.domain summary { display: flex; align-items: center; gap: 12px; padding: 16px 20px; flex-wrap: wrap; }
.domain[open] summary { border-bottom: 1px solid var(--line); }
.dns td { font-size: 13px; }
.dns code.val { display: inline-block; max-width: 520px; }

.flash { border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid; }
.flash p { margin: 0; font-weight: 600; }
.flash.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }
.flash.err { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 35%, transparent); color: var(--err); }
.creds { margin-top: 10px; display: grid; gap: 6px; color: var(--ink); }
.creds span { display: inline-block; width: 80px; color: var(--muted); font-size: 12.5px; }
.creds small { color: var(--muted); }

@media (max-width: 720px) {
  .card.table { overflow-x: auto; }
  .pop { width: 280px; }
  .top nav { margin-left: 0; width: 100%; }
}
