:root {
  --bg: #0a0e18;
  --bg-soft: #111726;
  --card: #151d2e;
  --card-2: #1b2438;
  --line: #263149;
  --text: #eef2fb;
  --muted: #93a0b8;
  --brand: #ffcf33;
  --brand-ink: #2a1f00;
  --ok: #35d07f;
  --warn: #ffb020;
  --danger: #ff5d6c;
  --radius: 18px;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 560px at 12% -12%, rgba(255, 207, 51, 0.12), transparent 60%),
    radial-gradient(900px 520px at 105% 0%, rgba(90, 120, 255, 0.14), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
code { background: #00000055; padding: 2px 6px; border-radius: 6px; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--danger); font-size: 13px; margin-top: 6px; }
[hidden] { display: none !important; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(430px, 100%);
  background: linear-gradient(180deg, var(--card), #101726);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 38px 34px 30px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-logo { margin: 0 auto 4px; }
.login-card h1 { font-size: 30px; letter-spacing: 0.02em; }
.login-card .hint { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin-top: 4px; }
.login-card .field { text-align: left; margin-top: 8px; }

/* ---------- layout ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 48px);
  background: rgba(10, 14, 24, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 18px; letter-spacing: 0.04em; }
.brand span { font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; gap: 10px; }

.container {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 48px) 60px;
  display: grid;
  gap: 22px;
}

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.stat {
  background: linear-gradient(180deg, var(--card), #121a2b);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: grid;
  gap: 4px;
}
.stat span { font-size: 34px; font-weight: 700; line-height: 1; }
.stat small { color: var(--muted); font-size: 12.5px; }

/* ---------- painéis ---------- */
.panel {
  background: linear-gradient(180deg, rgba(21, 29, 46, 0.96), rgba(16, 23, 38, 0.96));
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 22px 24px 16px;
}
.panel-head h2 { font-size: 19px; }
.panel-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.search {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
}
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input {
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  padding: 11px 0;
  width: 230px;
  font-size: 14px;
}

/* ---------- tabela ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #0d1422;
}
.table td { padding: 14px 24px; border-bottom: 1px solid #1c2437; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #131b2c; }
.right { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 26px; }
.empty-state { padding: 10px 24px 26px; color: var(--muted); font-size: 13.5px; }

.code-chip {
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 15px;
  letter-spacing: 0.14em;
  background: #0b1220;
  border: 1px dashed #35425f;
  border-radius: 10px;
  padding: 7px 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.copy {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px;
}
.copy:hover { color: var(--brand); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.pill.on { color: #9df3c4; background: rgba(53, 208, 127, 0.12); border-color: rgba(53, 208, 127, 0.3); }
.pill.off { color: #ffb3ba; background: rgba(255, 93, 108, 0.12); border-color: rgba(255, 93, 108, 0.3); }
.pill.exp { color: #ffd79a; background: rgba(255, 176, 32, 0.12); border-color: rgba(255, 176, 32, 0.32); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- botões / campos ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 15px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: #222d45; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: #ffdb63; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: #1a2335; }
.btn.danger { background: rgba(255, 93, 108, 0.12); border-color: rgba(255, 93, 108, 0.4); color: #ff9aa4; }
.btn.small { padding: 7px 11px; font-size: 12.5px; border-radius: 10px; }
.btn.block { width: 100%; padding: 13px; font-size: 14.5px; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}
.icon-btn:hover { color: var(--text); background: #1c2639; }

.field { display: grid; gap: 7px; font-size: 13px; }
.field > span { color: #c3ccdd; font-weight: 600; }
.field input, .field select {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 14px;
  outline: none;
  width: 100%;
  font-family: inherit;
}
.field input:focus, .field select:focus { border-color: #5b6f9c; box-shadow: 0 0 0 3px rgba(91, 111, 156, 0.18); }
.field input::placeholder { color: #5d6a83; }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 7, 14, 0.72);
  backdrop-filter: blur(6px);
}
.modal-card {
  width: min(720px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #121a2b;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.modal-card.narrow { width: min(480px, 100%); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #121a2b;
  z-index: 2;
}
.modal-body { padding: 22px 24px; display: grid; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .grid-2 { grid-template-columns: 1fr; } }

.switches { display: flex; flex-wrap: wrap; gap: 10px; }
.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.switch input { accent-color: var(--brand); width: 16px; height: 16px; }

/* ---------- canais ---------- */
.channels {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 10px;
}
.channels-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.channels-list { display: grid; gap: 8px; }
.channel-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; align-items: center; }
.channel-row input {
  background: #0d1524;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 13px;
  outline: none;
  width: 100%;
}
.channel-empty { color: var(--muted); font-size: 12.5px; }

/* ---------- dispositivos / auditoria ---------- */
.devices { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.devices li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 13px;
}
.devices small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.audit { list-style: none; margin: 0; padding: 0 24px 22px; display: grid; gap: 2px; }
.audit li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  padding: 9px 0;
  border-bottom: 1px solid #1b2334;
}
.audit li:last-child { border-bottom: 0; }
.audit .tag { font-size: 11px; padding: 3px 8px; border-radius: 999px; }
.audit .ok { color: #9df3c4; background: rgba(53, 208, 127, 0.12); }
.audit .fail { color: #ffb3ba; background: rgba(255, 93, 108, 0.12); }
.audit time { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: #e9eefb;
  color: #0b1020;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 60;
  max-width: min(90vw, 560px);
}
.toast.error { background: #ffd7db; }

@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .panel-head { align-items: flex-start; }
  .search input { width: 150px; }
  .table td, .table th { padding: 12px 14px; }
  .audit { padding: 0 16px 18px; }
}
