:root {
  --bg-deep: #0d1b2a;
  --bg-ink: #0b1f3a;
  --bg-slate: #1b263b;
  --gold: #d4af37;
  --cyan: #00b4d8;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --card: rgba(15, 23, 42, 0.75);
  --border: rgba(212, 175, 55, 0.25);
  --danger: #ff6b6b;
  --warning: #ffd166;
  --success: #06d6a0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Sora", sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 20% -10%, #14213d 0%, var(--bg-deep) 45%, #050910 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

a {
  color: inherit;
  text-decoration: none;
}

header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(13, 27, 42, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 10px 56px;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 48px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}

.brand-name {
  white-space: nowrap;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(5, 9, 16, 0.4);
}

.nav-links {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  align-items: center;
  font-size: 0.875rem;
  flex: 1;
  overflow: visible;
  padding: 0 12px;
}

.nav-link {
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  color: var(--text);
  transition: color 0.15s, background 0.15s;
  line-height: 1.4;
}

.nav-link:hover {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.07);
}

.nav-link.nav-active {
  color: var(--gold);
  font-weight: 600;
  background: rgba(212, 175, 55, 0.1);
}

.nav-link--admin {
  color: var(--muted);
  font-size: 0.82rem;
}

.nav-sep {
  display: block;
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 10px;
  flex-shrink: 0;
}

.nav-group {
  position: relative;
  display: block;
}

.nav-group-title {
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  color: var(--text);
  transition: color 0.15s, background 0.15s;
  user-select: none;
  line-height: 1.4;
}

.nav-group-title:hover {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.07);
}

.nav-group-title--admin {
  color: var(--muted);
  font-size: 0.82rem;
}

.nav-group-active > .nav-group-title {
  color: var(--gold);
  font-weight: 600;
  background: rgba(212, 175, 55, 0.1);
}

.nav-group-title::-webkit-details-marker {
  display: none;
}

.nav-group-title::after {
  content: "▾";
  margin-left: 5px;
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.8;
}

.nav-group:not([open]) .nav-group-title::after {
  content: "▾";
}

.nav-group[open] .nav-group-title::after {
  content: "▴";
}

.nav-submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 180px;
  background: rgba(11, 31, 58, 0.98);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 24px 56px rgba(5, 9, 16, 0.75);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 300;
}

.nav-submenu a {
  font-size: 0.86rem;
  color: var(--muted);
  padding: 9px 14px;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
  line-height: 1.3;
}

.nav-submenu a:hover,
.nav-submenu a.nav-active {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
}

.nav-submenu a.nav-active {
  font-weight: 600;
}

/* Hamburger — oculto em desktop */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.hero {
  padding: 36px 56px 20px;
}

.hero-card {
  background: linear-gradient(135deg, rgba(13, 27, 42, 0.85), rgba(27, 38, 59, 0.9));
  border: 1px solid var(--border);
  padding: 32px 36px;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(5, 9, 16, 0.4);
}

.hero-title {
  font-size: 2rem;
  margin: 0 0 10px;
  line-height: 1.2;
}

.hero-subtitle {
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

main {
  padding: 28px 56px 72px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 22px 24px;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.login-logo img {
  width: min(320px, 80%);
  border-radius: 18px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: 0 18px 40px rgba(5, 9, 16, 0.45);
}

.card h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.05rem;
  line-height: 1.3;
}

.kpi {
  font-size: 2rem;
  color: var(--gold);
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.95rem;
}

.table th,
.table td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: var(--gold);
  font-weight: 600;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge.success {
  background: rgba(6, 214, 160, 0.2);
  color: var(--success);
}

.badge.warning {
  background: rgba(255, 209, 102, 0.2);
  color: var(--warning);
}

.badge.danger {
  background: rgba(255, 107, 107, 0.2);
  color: var(--danger);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chip-neutral {
  background: rgba(148, 163, 184, 0.18);
  color: var(--muted);
}

.chip-low {
  background: rgba(6, 214, 160, 0.2);
  color: var(--success);
}

.chip-medium {
  background: rgba(255, 209, 102, 0.2);
  color: var(--warning);
}

.chip-high {
  background: rgba(255, 150, 60, 0.2);
  color: #ffb347;
}

.chip-critical {
  background: rgba(255, 107, 107, 0.2);
  color: var(--danger);
}

.filter-toolbar {
  margin-top: 16px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.filter-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.pagination {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.pagination-info {
  color: var(--muted);
  font-size: 0.9rem;
}

button,
.button {
  background: var(--gold);
  color: #0b1f3a;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}

.button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

input,
select,
textarea {
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: inherit;
  line-height: 1.4;
}

textarea {
  min-height: 120px;
}

.footer {
  padding: 22px 56px;
  color: rgba(203, 213, 225, 0.45);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(212, 175, 55, 0.1);
  letter-spacing: 0.03em;
}

.footer-brand {
  font-weight: 600;
  color: rgba(212, 175, 55, 0.6);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.footer-sep {
  opacity: 0.35;
}

@media (max-width: 768px) {
  header,
  .hero,
  main,
  .footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  main {
    padding-top: 20px;
    padding-bottom: 48px;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .nav-hamburger {
    display: flex;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(11, 31, 58, 0.99);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px 24px;
    z-index: 199;
  }

  .nav-links--open {
    display: flex;
  }

  .nav-group {
    width: 100%;
  }

  .nav-submenu {
    position: static;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--border);
    border-radius: 0;
    padding: 4px 0 4px 12px;
    background: transparent;
    margin-top: 2px;
  }

  header {
    position: sticky;
  }
}

/* ─── Container ────────────────────────────────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
}

/* ─── Button variants ──────────────────────────────────── */
.button.danger {
  background: var(--danger);
  color: #fff;
}

.button.sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

button:disabled,
.button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.button.loading {
  opacity: 0.7;
  cursor: wait;
  pointer-events: none;
}

/* ─── Table row hover ──────────────────────────────────── */
.table tbody tr:hover {
  background: rgba(212, 175, 55, 0.05);
  transition: background 0.15s ease;
}

/* ─── Input focus ring (acessibilidade) ────────────────── */
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-color: var(--gold);
}

/* ─── Nav user section ─────────────────────────────────── */
.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── Toast system ─────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-slate);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(5, 9, 16, 0.4);
  animation: toast-in 0.25s ease forwards;
  font-size: 0.9rem;
  line-height: 1.4;
  pointer-events: auto;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.danger  { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--cyan); }

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.toast-body {
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  transition: color 0.15s ease;
}

.toast-close:hover {
  color: var(--text);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

.toast.removing {
  animation: toast-out 0.2s ease forwards;
}
