@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #1a0608;
  --bg-2: #2a0c10;
  --panel: rgba(42, 12, 16, 0.72);
  --panel-solid: #2e1014;
  --line: rgba(255, 120, 120, 0.18);
  --line-strong: rgba(255, 90, 90, 0.35);
  --text: #ffffff;
  --muted: rgba(255, 235, 235, 0.72);
  --accent: #e11d2e;
  --accent-2: #ff4d5a;
  --accent-deep: #8b0f1a;
  --ok: #3dd68c;
  --warn: #f5c542;
  --err: #ff6b6b;
  --pending: #ff9f43;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --glow: 0 0 40px rgba(225, 29, 46, 0.22);
  --font: "Outfit", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 480px at 8% -8%, rgba(225, 29, 46, 0.45), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(255, 77, 90, 0.22), transparent 50%),
    radial-gradient(800px 500px at 50% 110%, rgba(139, 15, 26, 0.55), transparent 55%),
    linear-gradient(165deg, #2b070c 0%, #140406 45%, #1a0608 100%);
  background-attachment: fixed;
}

a { color: #ffb4b8; text-decoration: none; transition: color .15s ease; }
a:hover { color: #fff; }
code, .mono { font-family: ui-monospace, Consolas, monospace; color: #ffd0d3; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 268px;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(55, 12, 18, 0.96), rgba(28, 6, 10, 0.98));
  border-right: 1px solid var(--line);
  padding: 1.35rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 8px 0 40px rgba(0, 0, 0, 0.25);
}
.brand {
  display: flex;
  gap: .85rem;
  align-items: center;
  padding: .45rem .5rem .85rem;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.15rem;
  background: linear-gradient(145deg, #ff4d5a, #a01020);
  color: #fff;
  box-shadow: var(--glow);
}
.brand strong { display: block; font-size: 1.05rem; letter-spacing: .02em; color: #fff; }
.brand small { color: var(--muted); font-size: .78rem; }

.sidebar nav { display: flex; flex-direction: column; gap: .28rem; flex: 1; overflow: auto; }
.sidebar nav a {
  color: var(--muted);
  padding: .72rem .9rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: .94rem;
  border: 1px solid transparent;
}
.sidebar nav a:hover {
  background: rgba(255, 77, 90, 0.12);
  color: #fff;
  border-color: var(--line);
}
.sidebar nav a.active {
  background: linear-gradient(135deg, rgba(225, 29, 46, 0.55), rgba(139, 15, 26, 0.75));
  color: #fff;
  border-color: var(--line-strong);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.sidebar nav a.nav-exit { margin-top: auto; color: #ffb0b0; }
.sidebar-foot {
  padding: .55rem .5rem 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .75rem;
}

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(40, 8, 12, 0.85), rgba(25, 5, 8, 0.7));
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
}
.menu-btn {
  display: none;
  background: rgba(255, 77, 90, 0.15);
  border: 1px solid var(--line-strong);
  color: #fff;
  border-radius: 12px;
  width: 42px;
  height: 42px;
  cursor: pointer;
}
.page { padding: 1.35rem 1.5rem 2.6rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.15rem;
}
.card {
  background: linear-gradient(160deg, rgba(70, 18, 24, 0.9), rgba(35, 8, 12, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #ff4d5a, transparent 70%);
}
.card h3 {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.card strong {
  display: block;
  margin-top: .5rem;
  font-size: 1.85rem;
  color: #fff;
  font-weight: 800;
}
.card .hint { color: var(--muted); font-size: .85rem; margin-top: .4rem; }

.panel {
  background: linear-gradient(165deg, rgba(55, 14, 20, 0.88), rgba(28, 7, 11, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.3rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}
.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: #fff;
  font-weight: 700;
}
.panel p.lead { color: var(--muted); margin: -.35rem 0 1rem; }

/* Troca de DNS em massa fica visualmente separada do cadastro MAC. */
.bulk-dns-panel {
  margin-top: 1.75rem;
  border-top: 3px solid rgba(239, 68, 68, 0.55);
}
.bulk-dns-panel h2 {
  margin-bottom: .65rem;
}
.bulk-dns-panel p {
  color: var(--muted);
  margin: 0 0 1rem;
}

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

label {
  display: grid;
  gap: .38rem;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 600;
}
input, select, textarea, button, .btn {
  font: inherit;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(18, 5, 8, 0.85);
  color: var(--text);
  padding: .68rem .8rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(225, 29, 46, 0.2);
}
textarea { resize: vertical; min-height: 90px; }
input::placeholder, textarea::placeholder { color: rgba(255, 220, 220, 0.35); }

button, .btn {
  background: linear-gradient(135deg, #ff3b4b, #b01020);
  border: none;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(176, 16, 32, 0.35);
  transition: transform .12s ease, filter .12s ease;
}
button:hover, .btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
button.secondary, .btn.secondary, button.ghost, .btn.ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: #fff;
  box-shadow: none;
}
button.ok, .btn.ok { background: linear-gradient(135deg, #2ecc71, #1e8449); box-shadow: none; }
button.danger, .btn.danger { background: linear-gradient(135deg, #c0392b, #6b1010); }

.inline-form { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; }
.inline-form input { min-width: 0; }
button.link {
  background: none;
  border: none;
  color: #ffb4b8;
  padding: 0;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}
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: 14px;
  background: rgba(0, 0, 0, 0.18);
}
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td {
  text-align: left;
  padding: .8rem .75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: #fff;
}
th {
  color: var(--muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: rgba(225, 29, 46, 0.12);
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255, 77, 90, 0.05); }
.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: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.badge.active { background: rgba(61, 214, 140, 0.18); color: #7dffc0; }
.badge.pending { background: rgba(255, 159, 67, 0.2); color: #ffd08a; }
.badge.blocked, .badge.inactive { background: rgba(255, 107, 107, 0.18); color: #ffb0b0; }

.alert {
  padding: .85rem 1.05rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  color: #fff;
}
.alert.ok { background: rgba(61, 214, 140, 0.14); border-color: rgba(61, 214, 140, 0.35); }
.alert.error { background: rgba(255, 107, 107, 0.14); border-color: rgba(255, 107, 107, 0.4); }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background:
    radial-gradient(700px 400px at 20% 10%, rgba(225, 29, 46, 0.5), transparent 55%),
    radial-gradient(600px 380px at 90% 80%, rgba(139, 15, 26, 0.6), transparent 50%),
    linear-gradient(160deg, #3a0a10, #120305);
}
.auth-card {
  width: min(420px, 100%);
  background: linear-gradient(165deg, rgba(70, 16, 22, 0.95), rgba(30, 6, 10, 0.98));
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 1.85rem 1.7rem;
  box-shadow: var(--shadow), var(--glow);
}
.auth-card h1 { margin: 0 0 .3rem; color: #fff; font-size: 1.65rem; }
.auth-card .muted { color: var(--muted); margin: 0 0 1.25rem; }
.auth-card form { display: grid; gap: .95rem; }
.auth-card button { width: 100%; padding: .88rem; font-size: 1rem; }
.auth-badge {
  display: inline-flex;
  margin-bottom: 1rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  background: rgba(225, 29, 46, 0.25);
  border: 1px solid var(--line);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
}

.info-box {
  background: linear-gradient(135deg, rgba(225, 29, 46, 0.16), rgba(80, 10, 16, 0.35));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .95rem 1.1rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.info-box strong { color: #fff; }
.info-box code { display: none; }

label.check {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-direction: row;
  padding-top: 1.6rem;
}
label.check input { width: auto; }

.section-title {
  margin: 0 0 .85rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.preview-logo, .preview-bg {
  max-width: 100%;
  max-height: 120px;
  border-radius: 12px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: rgba(0,0,0,.25);
}
.rebrand-preview { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }

@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 .22s 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; }
}


/* ===== Dashboard moderno / responsivo ===== */
.dashboard-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card { min-height: 145px; padding-right: 4.2rem; }
.card-icon {
  position: absolute; top: 1rem; right: 1rem;
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.3rem;
  background: rgba(255, 77, 90, .12); border: 1px solid var(--line);
}
.dashboard-panel { overflow: hidden; }
.section-heading {
  display:flex; align-items:center; justify-content:space-between; gap:1rem;
  margin-bottom:1rem;
}
.section-heading h2 { margin:0 0 .25rem; }
.section-heading p { margin:0; color:var(--muted); font-size:.86rem; }
.device-card-grid, .dns-card-grid, .client-card-grid {
  display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:.9rem;
}
.info-card {
  position:relative; overflow:hidden; min-width:0;
  padding:1rem; border-radius:16px;
  background:linear-gradient(160deg, rgba(73,18,25,.9), rgba(29,7,11,.94));
  border:1px solid var(--line); box-shadow:0 12px 32px rgba(0,0,0,.24);
  transition:transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.info-card:hover { transform:translateY(-2px); border-color:var(--line-strong); box-shadow:0 16px 36px rgba(0,0,0,.34); }
.info-card::after {
  content:""; position:absolute; inset:auto -30px -40px auto; width:110px; height:110px;
  border-radius:50%; background:rgba(225,29,46,.08); pointer-events:none;
}
.info-card-top { display:flex; justify-content:space-between; align-items:center; gap:.6rem; margin-bottom:.85rem; }
.round-icon {
  width:38px; height:38px; border-radius:12px; display:grid; place-items:center;
  background:rgba(255,255,255,.055); border:1px solid var(--line); font-size:1.1rem;
}
.info-title { font-weight:800; font-size:1rem; margin-bottom:.7rem; color:#fff; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.info-row { display:flex; align-items:center; justify-content:space-between; gap:.7rem; padding:.42rem 0; border-top:1px solid rgba(255,255,255,.055); font-size:.76rem; }
.info-row span { color:var(--muted); flex:0 0 auto; }
.info-row strong { color:#fff; text-align:right; max-width:65%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.78rem; }
.info-actions { display:flex; margin-top:.8rem; }
.btn.small { padding:.48rem .7rem; border-radius:10px; font-size:.78rem; }
.dns-order { color:#ff9da4; font-size:.68rem; font-weight:800; letter-spacing:.08em; margin-bottom:.28rem; }
.dns-url { font-size:.72rem; color:#ffd0d3; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin-bottom:.45rem; }
.health-pill { display:inline-flex; align-items:center; gap:.38rem; padding:.32rem .55rem; border-radius:999px; font-size:.63rem; font-weight:800; letter-spacing:.04em; border:1px solid transparent; }
.health-pill i { width:7px; height:7px; border-radius:50%; display:block; }
.health-pill.online { color:#b8ffd9; background:rgba(61,214,140,.1); border-color:rgba(61,214,140,.28); }
.health-pill.online i { background:#3dd68c; box-shadow:0 0 9px rgba(61,214,140,.8); }
.health-pill.offline { color:#ffd0d0; background:rgba(255,107,107,.1); border-color:rgba(255,107,107,.28); }
.health-pill.offline i { background:#ff6b6b; box-shadow:0 0 9px rgba(255,107,107,.7); }
.dns-info-card.is-online { border-color:rgba(61,214,140,.18); }
.empty-card { grid-column:1/-1; padding:1.4rem; text-align:center; color:var(--muted); border:1px dashed var(--line-strong); border-radius:14px; background:rgba(0,0,0,.12); }
.truncate { display:block; }

@media (max-width: 1180px) {
  .dashboard-stats, .device-card-grid, .dns-card-grid, .client-card-grid { grid-template-columns:repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .device-card-grid, .dns-card-grid, .client-card-grid { grid-template-columns:1fr; }
  .dashboard-stats { grid-template-columns:repeat(2, minmax(0,1fr)); }
  .section-heading { align-items:flex-start; }
  .section-heading .btn { flex:0 0 auto; }
}
@media (max-width: 560px) {
  .page { padding:.9rem .7rem 2rem; }
  .dashboard-stats { grid-template-columns:1fr 1fr; gap:.65rem; }
  .stat-card { min-height:126px; padding:.9rem; padding-right:3.4rem; }
  .stat-card strong { font-size:1.55rem; }
  .card-icon { width:36px; height:36px; top:.8rem; right:.75rem; border-radius:11px; font-size:1rem; }
  .section-heading { gap:.65rem; flex-direction:column; }
  .section-heading .btn { width:100%; }
  .dashboard-panel { padding:1rem; }
  .info-card { padding:.9rem; }
}
