:root {
  --bg: #0E0E0F;
  --panel: #161618;
  --panel-2: #1D1D20;
  --line: #2A2A2E;
  --text: #F2F2F3;
  --muted: #9A9AA2;
  --faint: #6B6B73;
  --accent: #F53F5F;
  --accent-soft: rgba(245, 63, 95, 0.14);
  --ok: #3FCF8E;
  --ok-soft: rgba(63, 207, 142, 0.14);
  --warn: #F5B23F;
  --warn-soft: rgba(245, 178, 63, 0.14);
  --radius: 10px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0.2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }

/* ---------- boot / spinner ---------- */
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 36px 32px 32px; }
.login-card .logo { display: block; margin: 0 auto 28px; height: 40px; }
.login-card h1 { font-size: 15px; font-weight: 600; color: var(--muted); text-align: center; margin-bottom: 24px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 8px; height: 42px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.side .logo { height: 30px; margin: 4px 10px 26px; align-self: flex-start; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active svg { color: var(--accent); }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav .sep { height: 1px; background: var(--line); margin: 12px 8px; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); }
.side-foot .who { font-weight: 600; }
.side-foot .role { font-size: 12px; color: var(--faint); margin-bottom: 10px; }

.main { padding: 28px 36px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.2px; flex: 1; }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background-color 0.15s, border-color 0.15s; }
.btn:hover { background: #26262A; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #E2334F; }
.btn.danger { color: #FF8098; }
.btn.danger:hover { background: var(--accent-soft); border-color: rgba(245, 63, 95, 0.4); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- formulários ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--faint); margin-top: 5px; }
.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); outline: none; transition: border-color 0.15s; }
textarea.input { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; font-family: var(--mono); font-size: 13px; }
.input:focus { border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-error { background: var(--accent-soft); color: #FF97AB; border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .input { width: auto; min-width: 160px; }
.toolbar .search { flex: 1; min-width: 220px; max-width: 360px; }

/* ---------- cards / stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -0.5px; }
.stat .sub { color: var(--faint); font-size: 12px; margin-top: 2px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.card-head { padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 700; }
.card-body { padding: 18px; }
.meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.meter > div { height: 100%; background: var(--accent); border-radius: 3px; }
.meter.small { margin-top: 5px; width: 110px; }

/* ---------- tabela ---------- */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }
td .sub { font-size: 12px; color: var(--faint); }
.empty { padding: 44px 18px; text-align: center; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; color: var(--muted); font-size: 13px; }
.pager .btns { display: flex; gap: 6px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.off { background: var(--accent-soft); color: #FF8098; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.on { background: var(--ok); }
.domain { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.copy { cursor: pointer; border-bottom: 1px dashed var(--faint); }
.copy:hover { color: var(--accent); }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; z-index: 50; overflow-y: auto; }
.modal { width: 100%; max-width: 520px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.modal-head { display: flex; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; font-weight: 700; flex: 1; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 22px; line-height: 1; padding: 0 4px; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: #26262A; border: 1px solid var(--line); padding: 11px 18px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 60; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(245, 63, 95, 0.5); color: #FF97AB; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav .sep, .side-foot { display: none; }
  .main { padding: 20px 16px 40px; }
  .grid2 { grid-template-columns: 1fr; }
}
.card .table-wrap { border: none; border-radius: 0 0 12px 12px; }
