@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0b0d12;
  --bg-grad: radial-gradient(1200px 600px at 15% -10%, rgba(201,163,83,.08), transparent 60%),
             radial-gradient(900px 500px at 100% 0%, rgba(62,207,142,.05), transparent 55%);
  --panel: #12141b;
  --panel-2: #191c25;
  --panel-3: #1f2330;
  --line: #262b38;
  --line-soft: #1c2029;
  --text: #edeff4;
  --muted: #8a92a6;
  --muted-2: #5f6678;
  --gold: #d3ab5c;
  --gold-soft: rgba(211,171,92,.12);
  --green: #3ecf8e;
  --green-soft: rgba(62,207,142,.13);
  --red: #f0615f;
  --red-soft: rgba(240,97,95,.13);
  --yellow: #e8b64f;
  --yellow-soft: rgba(232,182,79,.13);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -12px rgba(0,0,0,.55);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.35);
  --ease: cubic-bezier(.2,.7,.3,1);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg) var(--bg-grad) fixed;
  color: var(--text);
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); text-decoration: none; }
code, .mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace; }
svg.icon { width: 16px; height: 16px; flex: none; }
::selection { background: var(--gold-soft); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 10px; border: 2px solid var(--panel); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* ============ Login ============ */
.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: var(--bg) var(--bg-grad) fixed;
}
.login-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 40px 34px; width: 340px; text-align: center; box-shadow: var(--shadow);
  animation: rise .5s var(--ease);
}
.login-icon {
  width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold-soft); color: var(--gold);
  border: 1px solid rgba(211,171,92,.25);
}
.login-icon svg { width: 22px; height: 22px; }
.login-card h1 { margin: 0 0 4px; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.login-card .sub { color: var(--muted); font-size: 12.5px; margin: 0 0 26px; }
.login-card input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 14px; margin-bottom: 16px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.login-card input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.login-card button {
  width: 100%; padding: 11px; border-radius: var(--radius-sm); border: none;
  background: linear-gradient(180deg, #ddb768, var(--gold)); color: #221a08; font-weight: 600;
  cursor: pointer; font-size: 14px; letter-spacing: .01em;
  transition: filter .15s var(--ease), transform .1s var(--ease);
}
.login-card button:hover { filter: brightness(1.06); }
.login-card button:active { transform: translateY(1px); }
.err { color: var(--red); font-size: 12.5px; min-height: 16px; margin: 12px 0 0; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============ Dashboard shell ============ */
header.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--line-soft);
  background: rgba(11,13,18,.82); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(211,171,92,.25);
}
.brand-mark svg { width: 18px; height: 18px; }
header.top h1 { font-size: 15.5px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
header.top .meta { color: var(--muted-2); font-size: 11.5px; margin-top: 1px; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  padding: 7px 13px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12.5px;
  transition: all .15s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--muted-2); background: var(--panel-3); }

main { max-width: 1180px; margin: 0 auto; padding: 26px 28px 60px; display: grid; gap: 20px; }

/* ============ Stat bar ============ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: center; gap: 13px; box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none;
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-icon.gold { background: var(--gold-soft); color: var(--gold); }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.yellow { background: var(--yellow-soft); color: var(--yellow); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-num { font-size: 21px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* ============ Cards ============ */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow-sm); animation: fadeIn .3s var(--ease);
}
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.card-head-icon {
  width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: var(--panel-3); color: var(--muted); flex: none; margin-top: 1px;
}
.card-head-icon svg { width: 15px; height: 15px; }
.card h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.card .desc { color: var(--muted); font-size: 12.5px; margin: 4px 0 18px; max-width: 62ch; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
input[type=text] {
  flex: 1; min-width: 220px; padding: 10px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 13.5px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input[type=text]:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
input[type=text]::placeholder { color: var(--muted-2); }

button.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 17px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: all .15s var(--ease);
}
button.btn:hover { border-color: var(--muted-2); background: var(--panel-3); }
button.btn:active { transform: translateY(1px); }
button.btn.primary {
  background: linear-gradient(180deg, #ddb768, var(--gold)); color: #221a08; border: none; font-weight: 650;
}
button.btn.primary:hover { filter: brightness(1.06); border-color: transparent; }
button.btn.danger { color: var(--red); }
button.btn.danger:hover { border-color: var(--red); background: var(--red-soft); }
button.btn:disabled { opacity: .5; cursor: default; pointer-events: none; }
button.btn.loading svg.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status-line { display: flex; align-items: center; gap: 7px; font-size: 12.5px; margin-top: 12px; min-height: 18px; }
.status-line.ok { color: var(--green); }
.status-line.bad { color: var(--red); }

.advanced { margin-top: 12px; font-size: 12.5px; }
.advanced summary { cursor: pointer; color: var(--muted); user-select: none; }
.advanced summary:hover { color: var(--text); }

pre.log {
  margin-top: 16px; background: #08090c; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 15px 16px; font-size: 12px; font-family: 'JetBrains Mono', ui-monospace, monospace;
  max-height: 360px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
  color: #a9e8c4; display: none; line-height: 1.6;
}
pre.log.show { display: block; animation: fadeIn .25s var(--ease); }

/* ============ Tables ============ */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line-soft); }
th { color: var(--muted-2); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
tbody tr { transition: background .15s var(--ease); }
tbody tr:hover { background: var(--panel-2); }
tr:last-child td { border-bottom: none; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 650; letter-spacing: .01em;
}
.pill svg { width: 11px; height: 11px; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.yellow { background: var(--yellow-soft); color: var(--yellow); }
.pill.muted { background: var(--panel-3); color: var(--muted); }

.domain-cell { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px; }
.small-btn { padding: 6px 12px; font-size: 12px; }
.empty {
  color: var(--muted-2); font-size: 13px; padding: 22px 0; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
}
.skeleton {
  height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel-3) 37%, var(--panel-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ============ Toasts ============ */
#toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 16px; box-shadow: var(--shadow); font-size: 13px; min-width: 240px;
  animation: toastIn .25s var(--ease);
}
.toast.success { border-color: rgba(62,207,142,.35); }
.toast.success svg { color: var(--green); }
.toast.error { border-color: rgba(240,97,95,.35); }
.toast.error svg { color: var(--red); }
.toast svg { width: 16px; height: 16px; flex: none; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5,6,9,.6); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 90; animation: fadeIn .15s var(--ease);
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; width: 380px; box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 8px; font-size: 15.5px; }
.modal p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.modal .row { justify-content: flex-end; }

@media (max-width: 640px) {
  main { padding: 18px 16px 50px; }
  header.top { padding: 14px 18px; }
  .card { padding: 18px; }
}
