:root {
  --bg: #050816;
  --bg2: #0b1024;
  --card: rgba(15, 23, 42, .82);
  --card2: rgba(2, 6, 23, .72);
  --line: rgba(148, 163, 184, .18);
  --text: #e5edf7;
  --muted: #94a3b8;
  --primary: #38bdf8;
  --primary2: #22d3ee;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --purple: #a855f7;
  --radius: 22px;
  --shadow: 0 24px 80px rgba(0,0,0,.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 15%, rgba(56,189,248,.22), transparent 32%),
    radial-gradient(circle at 85% 25%, rgba(168,85,247,.18), transparent 30%),
    radial-gradient(circle at 50% 100%, rgba(34,197,94,.12), transparent 32%),
    linear-gradient(135deg, #020617, #08111f 50%, #030712);
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148,163,184,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,.08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent);
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: linear-gradient(145deg, rgba(15,23,42,.92), rgba(2,6,23,.78));
  box-shadow: var(--shadow);
}

.login-brand {
  padding: 44px;
  border-right: 1px solid var(--line);
}

.logo {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #00111f;
  font-weight: 900;
  box-shadow: 0 0 40px rgba(56,189,248,.35);
}

.login-brand h1 {
  margin: 24px 0 10px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1;
  letter-spacing: -2px;
}

.login-brand p {
  color: var(--muted);
  max-width: 560px;
  line-height: 1.65;
}

.login-list {
  margin-top: 28px;
  display: grid;
  gap: 12px;
}

.login-list span {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(15,23,42,.58);
  color: #cbd5e1;
}

.auth-box {
  padding: 44px;
  display: grid;
  align-content: center;
  gap: 16px;
}

.auth-box h2 {
  margin: 0;
  font-size: 28px;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(2,6,23,.72);
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(56,189,248,.85);
  box-shadow: 0 0 0 4px rgba(56,189,248,.12);
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 13px 16px;
  color: #00111f;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
}

.btn:hover {
  filter: brightness(1.08);
}

.btn.secondary {
  color: var(--text);
  background: rgba(15,23,42,.95);
  border: 1px solid var(--line);
}

.btn.danger {
  color: white;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: rgba(2,6,23,.62);
  backdrop-filter: blur(18px);
}

.side-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.side-head strong {
  display: block;
}

.side-head small {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  border: 1px solid transparent;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  padding: 13px 14px;
  border-radius: 15px;
}

.nav button.active,
.nav button:hover {
  border-color: var(--line);
  background: rgba(56,189,248,.1);
  color: white;
}

.main {
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -1px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 20px 55px rgba(0,0,0,.22);
  padding: 20px;
}

.card small {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.card strong {
  font-size: 34px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 20px 55px rgba(0,0,0,.20);
  overflow: hidden;
}

.panel-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(148,163,184,.12);
  text-align: left;
  vertical-align: top;
}

th {
  color: #93c5fd;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: rgba(2,6,23,.35);
}

td {
  color: #dbeafe;
  font-size: 14px;
}

.badge {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(148,163,184,.12);
}

.badge.ok {
  color: #86efac;
  background: rgba(34,197,94,.12);
}

.badge.warn {
  color: #fde68a;
  background: rgba(234,179,8,.12);
}

.badge.danger {
  color: #fecaca;
  background: rgba(239,68,68,.14);
}

.badge.info {
  color: #bae6fd;
  background: rgba(56,189,248,.13);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar input {
  max-width: 360px;
}

.empty {
  padding: 34px;
  text-align: center;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(2,6,23,.75);
  backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(980px, 100%);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: #071024;
  box-shadow: var(--shadow);
}

.modal-head {
  position: sticky;
  top: 0;
  background: rgba(7,16,36,.95);
  backdrop-filter: blur(14px);
  padding: 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-grid {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
}

.full {
  grid-column: 1 / -1;
}

.modal-foot {
  padding: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 10px;
}

.toast {
  padding: 13px 15px;
  border-radius: 14px;
  background: rgba(15,23,42,.95);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.toast.ok {
  border-color: rgba(34,197,94,.4);
}

.toast.error {
  border-color: rgba(239,68,68,.4);
}

.small-muted {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .login-card,
  .layout,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 620px) {
  .cards,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 18px;
  }

  .login-brand,
  .auth-box {
    padding: 28px;
  }
}

/* ===============================
   DASHBOARD PREMIUM SEM SCROLL
   =============================== */

.dashboard-grid {
  align-items: stretch;
}

.dashboard-panel {
  overflow: hidden;
}

.dashboard-indicators {
  display: grid;
  gap: 0;
}

.dashboard-indicator-item {
  min-height: 72px;
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
  background:
    linear-gradient(90deg, rgba(56, 189, 248, .035), transparent 60%),
    rgba(2, 6, 23, .10);
}

.dashboard-indicator-item:last-child {
  border-bottom: 0;
}

.dashboard-indicator-item:hover {
  background:
    linear-gradient(90deg, rgba(56, 189, 248, .08), transparent 65%),
    rgba(15, 23, 42, .28);
}

.dashboard-indicator-item strong {
  display: block;
  color: #e5edf7;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 5px;
}

.dashboard-indicator-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-indicator-right {
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.dashboard-indicator-right b {
  font-size: 22px;
  color: #e5edf7;
}

.dashboard-empty {
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.audit-list {
  display: grid;
}

.audit-item {
  min-height: 72px;
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
  background:
    linear-gradient(90deg, rgba(168, 85, 247, .035), transparent 60%),
    rgba(2, 6, 23, .10);
}

.audit-item:last-child {
  border-bottom: 0;
}

.audit-item:hover {
  background:
    linear-gradient(90deg, rgba(168, 85, 247, .08), transparent 65%),
    rgba(15, 23, 42, .28);
}

.audit-item strong {
  display: block;
  font-size: 14px;
  color: #e5edf7;
  margin-bottom: 5px;
}

.audit-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.audit-item small {
  color: #93c5fd;
  font-size: 12px;
  white-space: nowrap;
}

.card-alert {
  border-color: rgba(239, 68, 68, .32);
  box-shadow:
    0 20px 55px rgba(0, 0, 0, .22),
    inset 0 0 0 1px rgba(239, 68, 68, .08);
}

.card-alert small {
  color: #fecaca;
}

/* Remove qualquer comportamento de tabela/scroll dentro do dashboard */
.dashboard-grid .table-wrap {
  overflow: visible;
}

.dashboard-grid table {
  min-width: 0;
  width: 100%;
}

/* Responsivo do dashboard */
@media (max-width: 720px) {
  .dashboard-indicator-item,
  .audit-item {
    grid-template-columns: 1fr;
  }

  .dashboard-indicator-right {
    width: 100%;
    justify-content: space-between;
  }

  .audit-item small {
    white-space: normal;
  }
}