:root {
  --bg: #0b1220;
  --bg-2: #111a2b;
  --panel: #152033;
  --line: #243247;
  --text: #edf2f7;
  --muted: #8fa3bc;
  --accent: #2f80ed;
  --accent-2: #56ccf2;
  --ok: #27ae60;
  --warn: #f2c94c;
  --err: #eb5757;
  --pending: #f2994a;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.28);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(47,128,237,.18), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(86,204,242,.10), transparent 45%),
    var(--bg);
}

a { color: var(--accent-2); text-decoration: none; }
code, .mono { font-family: ui-monospace, Consolas, monospace; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex-shrink: 0; background: rgba(17,26,43,.95);
  border-right: 1px solid var(--line); padding: 1.2rem 1rem;
  display: flex; flex-direction: column; gap: 1.2rem;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: .8rem; align-items: center; padding: .3rem .4rem; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.brand strong { display: block; font-size: 1rem; }
.brand small { color: var(--muted); }
.sidebar nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.sidebar nav a {
  color: var(--muted); padding: .7rem .85rem; border-radius: 10px; font-weight: 600;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: rgba(47,128,237,.14); color: var(--text);
}
.sidebar-foot { padding: .4rem; }
.domain-chip {
  display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: .35rem .7rem; font-size: .78rem;
}

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: .8rem;
  padding: 1rem 1.4rem; border-bottom: 1px solid var(--line);
  background: rgba(11,18,32,.65); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.menu-btn {
  display: none; background: var(--panel); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; width: 40px; height: 40px; cursor: pointer;
}
.page { padding: 1.2rem 1.4rem 2.4rem; }

.cards {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1rem; margin-bottom: 1rem;
}
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.05rem 1.15rem; box-shadow: var(--shadow);
}
.card h3 { margin: 0; color: var(--muted); font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.card strong { display: block; margin-top: .45rem; font-size: 1.8rem; }
.card .hint { color: var(--muted); font-size: .85rem; margin-top: .35rem; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 1rem; font-size: 1.05rem; }
.panel p.lead { color: var(--muted); margin: -.4rem 0 1rem; }

.grid-form {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .9rem 1rem;
}
.grid-form .full { grid-column: 1 / -1; }
.grid-form .actions { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; }

label { display: grid; gap: .35rem; color: var(--muted); font-size: .86rem; font-weight: 600; }
input, select, textarea, button, .btn {
  font: inherit; border-radius: 10px; border: 1px solid var(--line);
  background: #0f1726; color: var(--text); padding: .62rem .75rem;
}
textarea { resize: vertical; min-height: 90px; }
button, .btn {
  background: linear-gradient(135deg, var(--accent), #1c6dd0); border: none;
  color: #fff; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
button.secondary, .btn.secondary { background: transparent; border: 1px solid var(--line); color: var(--text); }
button.danger, .btn.danger { background: #8b1e1e; }
button.link {
  background: none; border: none; color: var(--accent-2); padding: 0; font-weight: 600; cursor: pointer;
}
button.link.danger { color: #ff8e8e; }

.inline { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: .9rem; }
.inline input[type="search"] { flex: 1; min-width: 180px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .75rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; background: rgba(0,0,0,.15); }
tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: .65rem; align-items: center; white-space: nowrap; }
.row-actions form { margin: 0; }

.badge {
  display: inline-flex; align-items: center; padding: .18rem .55rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700; background: #243041;
}
.badge.active { background: rgba(39,174,96,.18); color: #6fcf97; }
.badge.pending { background: rgba(242,153,74,.18); color: #f2c94c; }
.badge.blocked, .badge.inactive { background: rgba(235,87,87,.16); color: #ff8e8e; }

.alert {
  padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid var(--line);
}
.alert.ok { background: rgba(39,174,96,.12); border-color: rgba(39,174,96,.35); }
.alert.error { background: rgba(235,87,87,.12); border-color: rgba(235,87,87,.35); }

.auth-body {
  min-height: 100vh; display: grid; place-items: center; padding: 1.2rem;
}
.auth-card {
  width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 1.6rem; box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 .25rem; }
.auth-card .muted { color: var(--muted); margin: 0 0 1.2rem; }
.auth-card form { display: grid; gap: .9rem; }
.auth-card button { width: 100%; padding: .8rem; }

.info-box {
  background: rgba(47,128,237,.08); border: 1px solid rgba(47,128,237,.25);
  border-radius: 12px; padding: .9rem 1rem; color: var(--muted); margin-bottom: 1rem;
}
.info-box strong { color: var(--text); }
.info-box code { color: var(--accent-2); font-size: .88em; }
label.check {
  display: flex; align-items: center; gap: .55rem; flex-direction: row;
  padding-top: 1.6rem;
}
label.check input { width: auto; }

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 20; transform: translateX(-105%);
    transition: transform .2s ease; height: 100vh;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-grid; place-items: center; }
  .grid-form { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
}
