:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: #2d3a4f;
  --text: #e8edf5;
  --muted: #8b9cb3;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,.35);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: linear-gradient(145deg, #0a0e14 0%, #121a26 50%, #0f1419 100%);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

.view { min-height: 100vh; }

.login-card {
  max-width: 400px;
  margin: 12vh auto;
  padding: 2.5rem;
}

.brand { text-align: center; margin-bottom: 2rem; }
.logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 1rem;
}
.logo.small { width: 32px; height: 32px; font-size: 1rem; border-radius: 8px; }
.brand h1 { font-size: 1.6rem; margin-bottom: .25rem; }
.brand p, .muted { color: var(--muted); font-size: .9rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

label { display: block; font-size: .85rem; color: var(--muted); margin: .75rem 0 .35rem; }

input, select {
  width: 100%;
  padding: .7rem .9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: .95rem;
}
input:focus { outline: 2px solid var(--primary); border-color: transparent; }

.btn {
  border: none;
  border-radius: 8px;
  padding: .65rem 1.1rem;
  font-size: .9rem;
  cursor: pointer;
  transition: .15s;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn.ghost:hover { color: var(--text); border-color: var(--muted); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.danger:hover { background: rgba(239,68,68,.1); }

#login-form button { width: 100%; margin-top: 1.25rem; }
.error { color: var(--danger); font-size: .85rem; margin-top: .75rem; text-align: center; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(26,35,50,.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand-inline { display: flex; align-items: center; gap: .6rem; }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }

.layout { display: flex; min-height: calc(100vh - 65px); }

.sidebar {
  width: 200px;
  padding: 1rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.nav-btn {
  display: block; width: 100%; text-align: left;
  padding: .7rem 1rem; margin-bottom: .35rem;
  background: transparent; border: none; border-radius: 8px;
  color: var(--muted); cursor: pointer; font-size: .95rem;
}
.nav-btn.active, .nav-btn:hover { background: var(--surface2); color: var(--text); }

.content { flex: 1; padding: 1.5rem 2rem; overflow-y: auto; }
.content h2 { margin-bottom: 1.25rem; font-size: 1.4rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}
.stat span { display: block; font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat label { color: var(--muted); font-size: .85rem; }

.info-card { padding: 1.25rem; }
.info-card h3 { margin-bottom: 1rem; font-size: 1rem; }
.info-card dl { display: grid; grid-template-columns: 140px 1fr; gap: .5rem .75rem; }
.info-card dt { color: var(--muted); font-size: .85rem; }
.info-card dd { font-family: monospace; font-size: .9rem; }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

.list { display: flex; flex-direction: column; gap: .6rem; }
.list.compact { margin-top: 1rem; }

.list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.list-item:hover { border-color: var(--primary); }
.list-item .meta { color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.list-item .actions { display: flex; gap: .5rem; }

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 1.5rem;
  max-width: 720px;
  width: 92vw;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }

.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.detail-header h3 { font-size: 1.2rem; }

.tabs-inline { display: flex; gap: .5rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: .5rem; }
.tab-btn {
  background: transparent; border: none; color: var(--muted);
  padding: .5rem 1rem; cursor: pointer; border-radius: 6px;
}
.tab-btn.active { background: var(--surface2); color: var(--text); }

.detail-panel { min-height: 200px; }
.inline-form {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
}
.inline-form input { flex: 1; min-width: 120px; }
.inline-form input[type=number] { max-width: 100px; }

.dns-record {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .85rem 1rem;
  margin-bottom: .6rem;
  font-size: .88rem;
}
.dns-record .type {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  margin-right: .5rem;
}
.dns-record .name { font-family: monospace; word-break: break-all; margin: .4rem 0; }
.dns-record .value {
  font-family: monospace; word-break: break-all;
  background: var(--bg); padding: .5rem; border-radius: 6px; margin-top: .35rem;
}
.dns-record .note { color: var(--muted); font-size: .8rem; margin-top: .35rem; }

.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  background: rgba(34,197,94,.15);
  color: var(--success);
}
.badge.off { background: rgba(239,68,68,.15); color: var(--danger); }

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; display: flex; gap: .5rem; border-right: none; border-bottom: 1px solid var(--border); }
  .nav-btn { flex: 1; text-align: center; }
}
