:root {
  --bg: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --card: #ffffff;
  --accent: #4f46e5;
  --sidebar: #0f172a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
[data-master-only] {
  display: none;
}
body.access-pending .main {
  visibility: hidden;
}
.page-loading {
  position: fixed;
  inset: 0;
  background: rgba(241, 245, 249, 0.7);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
body.access-pending .page-loading {
  display: flex;
}
.page-loading-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}
.page-loading-text {
  font-weight: 600;
  color: #334155;
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
a { color: inherit; }
.layout { min-height: 100vh; }
.sidebar {
  width: 256px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--sidebar);
  color: #e2e8f0;
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand-wrap {
  padding: 22px 22px 18px;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon {
  color: #818cf8;
  font-size: 24px;
}
.brand {
  font-size: 22px;
  font-weight: 800;
  color: #f8fafc;
}
.nav {
  padding: 14px;
  display: grid;
  gap: 6px;
}
.nav a {
  text-decoration: none;
  color: #cbd5e1;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav a i { color: #94a3b8; width: 18px; }
.nav a:hover {
  background: #1e293b;
  color: #fff;
}
.nav a:hover i { color: #fff; }
.nav a.active {
  background: #1e293b;
  border-color: #334155;
  color: #fff;
}
.nav a.active i { color: #fff; }
.nav-group {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid #334155;
  display: grid;
  gap: 6px;
}
.sidebar-user {
  margin-top: auto;
  border-top: 1px solid #334155;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #4f46e5;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.user-meta { min-width: 0; flex: 1; }
.user-name {
  font-size: 13px;
  color: #f8fafc;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 11px;
  color: #94a3b8;
  margin: 2px 0 0;
}
.logout {
  width: auto;
  min-width: 38px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
}
.logout:hover { color: #fff; background: #1e293b; }
.main {
  margin-left: 256px;
  min-height: 100vh;
}
.topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.topbar-title { font-weight: 700; font-size: 20px; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-right-rel {
  position: relative;
}
.topbar-search {
  position: relative;
}
.topbar-search i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 13px;
}
.topbar-search input {
  width: 220px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 10px;
  padding: 9px 12px 9px 32px;
  font-size: 13px;
}
.global-search-wrap {
  position: relative;
}
.global-search-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, .14);
  overflow: hidden;
  z-index: 45;
}
.global-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
}
.global-search-item:last-child {
  border-bottom: 0;
}
.global-search-item:hover {
  background: #f8fafc;
}
.global-search-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #eef2ff;
  color: #4338ca;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.global-search-main {
  display: grid;
  min-width: 0;
}
.global-search-label {
  font-size: 13px;
  color: #0f172a;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.global-search-subtitle {
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.global-search-empty {
  font-size: 12px;
  color: #64748b;
  padding: 12px;
}
.notify-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.notify-btn:hover { color: #4f46e5; border-color: #cbd5e1; }
.notify-count {
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
}
.notify-panel {
  position: absolute;
  right: 58px;
  top: calc(100% + 8px);
  width: min(360px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, .14);
  z-index: 55;
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
}
.notify-head {
  padding: 11px 12px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.notify-head strong {
  font-size: 13px;
  color: #0f172a;
}
.notify-head a {
  font-size: 12px;
  color: #4338ca;
  text-decoration: none;
  font-weight: 600;
}
.notify-item {
  display: grid;
  text-decoration: none;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
}
.notify-item:last-child {
  border-bottom: 0;
}
.notify-item:hover {
  background: #f8fafc;
}
.notify-item-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}
.notify-item-text {
  color: #64748b;
  font-size: 12px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notify-item-time {
  color: #94a3b8;
  font-size: 11px;
  margin-top: 4px;
}
.notify-item.warn .notify-item-title {
  color: #92400e;
}
.notify-item.danger .notify-item-title {
  color: #b91c1c;
}
.notify-item.info .notify-item-title {
  color: #1d4ed8;
}
.notify-empty {
  padding: 14px 12px;
  color: #64748b;
  font-size: 12px;
}
.topbar-badge {
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.content { padding: 24px; }
.title {
  font-size: 30px;
  margin: 0 0 6px;
}
.subtitle { color: var(--muted); margin: 0 0 20px; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.head-actions {
  display: flex;
  gap: 8px;
}
.head-actions button { width: auto; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.card h3 {
  margin: 0 0 12px;
  color: #0f172a;
  font-size: 17px;
}
.row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 10px; }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }
input, select, button, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}
input[type="checkbox"] {
  width: auto;
  padding: 0;
  margin-right: 6px;
}
button {
  cursor: pointer;
  background: var(--accent);
  border-color: #4338ca;
  color: #fff;
  font-weight: 600;
}
button:hover { filter: brightness(1.04); }
.btn { text-decoration: none; }
.btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}
.btn-danger {
  background: #ef4444;
  border-color: #dc2626;
  color: #fff;
}
.btn-outline {
  background: #fff;
  color: #0f172a;
  border-color: #cbd5e1;
}
.code-block, pre {
  margin: 0;
  background: #0f172a;
  color: #dbeafe;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 12px;
  min-height: 80px;
  overflow: auto;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
}
.pill {
  display: flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  align-items: center;
  gap: 4px;
}
.ok { background: #dcfce7; color: #166534; }
.warn { background: #fef3c7; color: #92400e; }
.danger { background: #fee2e2; color: #991b1b; }
.stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}
.stat {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
}
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 4px;
  color: #0f172a;
}

.metric-head .value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 4px;
  color: #0f172a;
}
.table-wrap {
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.ip-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
}
.ip-tab {
  width: auto;
  background: #e2e8f0;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
}
.ip-tab.active {
  background: #4f46e5;
  color: #fff;
  border-color: #4338ca;
}
.domain-list {
  display: grid;
  gap: 12px;
}
.domain-card {
  border-width: 1px;
}
.domain-card.pending {
  border-color: #fde68a;
  border-left-width: 4px;
}
.domain-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.domain-main {
  display: flex;
  align-items: center;
  gap: 12px;
}
.domain-icon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.domain-icon.ok {
  background: #dcfce7;
  color: #166534;
}
.domain-icon.warn {
  background: #fef3c7;
  color: #92400e;
}
.domain-name {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}
.domain-checks {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  color: #64748b;
}
.ok-text { color: #166534; }
.warn-text { color: #92400e; }
.domain-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.domain-action-link {
  width: auto;
  background: transparent;
  border: 0;
  color: #4f46e5;
  padding: 0;
  font-weight: 600;
}
.domain-action-link:hover {
  text-decoration: underline;
  filter: none;
}
.modal-x-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #94a3b8;
  border-radius: 6px;
}
.modal-x-btn:hover {
  background: #f1f5f9;
  color: #64748b;
  filter: none;
}
.modal-x-invert {
  color: #e2e8f0;
}
.modal-x-invert:hover {
  background: rgba(255, 255, 255, .15);
  color: #fff;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
th, td {
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  font-size: 13px;
  color: #0f172a;
  background: #fff;
}
th {
  background: #f8fafc;
  color: #334155;
  position: sticky;
  top: 0;
}
.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.btn-sm {
  width: auto;
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 8px;
}
.btn-success {
  background: #16a34a;
  border-color: #15803d;
  color: #fff;
}
.btn-warning {
  background: #f59e0b;
  border-color: #d97706;
  color: #fff;
}
.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.metric-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.metric-note {
  margin-top: 6px;
  font-size: 12px;
  color: #10b981;
}
.metric-note.danger { color: #ef4444; background: transparent; padding: 0; }
.progress {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4f46e5, #6366f1);
}
.progress-bar.danger {
  background: linear-gradient(90deg, #ef4444, #f59e0b);
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .52);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal {
  width: 100%;
  max-width: 760px;
  max-height: calc(100vh - 40px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, .22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-head {
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head.modal-accent {
  background: #4f46e5;
  color: #fff;
  border-bottom: 0;
}
.modal-body { padding: 16px; overflow: auto; }
.modal-foot {
  padding: 14px 16px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal-foot button { width: auto; }
.alert-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.alert-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e0e7ff;
  color: #4338ca;
  flex: 0 0 auto;
}
.alert-icon.danger { background: #fee2e2; color: #dc2626; }
.alert-icon.success { background: #dcfce7; color: #166534; }
.alert-title { font-weight: 800; margin: 0 0 4px; }
.alert-text { margin: 0; color: #334155; white-space: pre-wrap; }
#alertModal .modal { max-width: 520px; }
.inline-note {
  color: #64748b;
  font-size: 12px;
}
/* --- ESTILOS DE LOGIN MELHORADOS --- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* Lado Marketing com Padrão Geométrico */
.login-marketing {
  background-color: #4f46e5;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 20%),
    linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  padding: 56px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

/* Padrão de fundo sutil (opcional) */
.login-marketing::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.marketing-content {
  position: relative;
  z-index: 1;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-logo i {
  font-size: 32px;
  background: rgba(255,255,255,0.2);
  padding: 12px;
  border-radius: 12px;
}

.login-marketing h1 {
  font-size: 42px;
  margin: 0;
  letter-spacing: -1px;
}

.login-marketing p {
  opacity: .9;
  font-size: 18px;
  margin: 0 0 32px;
  line-height: 1.5;
  max-width: 480px;
}

.login-marketing ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 16px;
}

.login-marketing li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 500;
}

.login-marketing li i {
  color: #a5f3fc; /* Cor de destaque para os checks */
  font-size: 18px;
}

/* Lado Formulário */
.login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: #f8fafc; /* Fundo levemente cinza para contrastar com o card branco */
}

.login-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  border: none; /* Removendo borda 'navajowhite' */
  box-shadow: 0 10px 25px rgba(0,0,0,0.05), 0 1px 4px rgba(0,0,0,0.05);
  padding: 40px;
  border-radius: 16px;
}

.login-card .title {
  font-size: 28px;
  margin: 0 0 8px;
  color: #0f172a;
}

.login-card .subtitle {
  margin-bottom: 32px;
}

.mobile-brand {
  display: none;
  margin-bottom: 24px;
  font-size: 20px;
  font-weight: 700;
  color: #4f46e5;
}

/* Grupo de Input com Ícone */
.input-group {
  position: relative;
}

.input-group i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  transition: color 0.2s;
}

.input-group input {
  padding-left: 42px; /* Espaço para o ícone */
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-group input:focus + i,
.input-group input:focus ~ i {
  color: var(--accent);
}

/* Opções do Login (Lembrar/Esqueci) */
.login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 6px; /* Ajuste fino */
  color: #64748b;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.forgot-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.forgot-link:hover {
  text-decoration: underline;
}

/* Botão de Login */
.btn-login {
  margin-top: 8px;
  padding: 12px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.1s, box-shadow 0.2s;
}

.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-login:active {
  transform: translateY(0);
}

/* Footer do Card */
.login-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #f1f5f9;
  font-size: 13px;
  color: #64748b;
}

.login-footer a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* Responsividade */
@media (max-width: 1100px) {
  .login-wrap { grid-template-columns: 1fr; }
  
  .login-marketing { display: none; }
  
  .mobile-brand { display: block; }
  
  .login-form-wrap {
    background: #fff; /* Volta para branco em mobile */
  }
  
  .login-card {
    box-shadow: none;
    padding: 24px;
    border-radius: 0;
  }
}
.output-box { margin-top: 14px; }

@media (max-width: 960px) {
  .sidebar {
    position: static;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid #1e293b;
  }
  .main { margin-left: 0; }
  .grid.two { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .topbar { padding: 0 12px; }
  .topbar-search input { width: 150px; }
  .notify-panel {
    right: 44px;
    width: min(340px, calc(100vw - 24px));
  }
  .content { padding: 14px; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
.grid.four {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}


/* --- ESTRUTURA DO PAINEL (DASHBOARD) --- */

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

/* Sidebar Refinada */
.sidebar {
  width: 260px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--sidebar);
  color: #e2e8f0;
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: transform 0.3s ease;
}

.brand-wrap {
  padding: 20px 20px 20px;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-icon {
  color: #818cf8;
  font-size: 22px;
}
.brand {
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.5px;
}

.nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav a {
  text-decoration: none;
  color: #94a3b8;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  transition: all 0.2s;
}

.nav a i { 
  width: 20px; 
  text-align: center;
  font-size: 14px;
}

.nav a:hover {
  background: #1e293b;
  color: #fff;
}

.nav a.active {
  background: rgba(79, 70, 229, 0.15);
  color: #fff;
  font-weight: 600;
}

/* Indicador lateral para item ativo */
.nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10%;
  bottom: 10%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.nav a.active i { color: #a5b4fc; }

.nav-group {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #334155;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  padding: 0 12px;
  margin-bottom: 8px;
  font-weight: 600;
}

/* User Sidebar Corrigido */
.sidebar-user {
  margin-top: auto;
  border-top: 1px solid #334155;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0,0,0,0.1);
}

.user-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0; /* Para o text-overflow funcionar */
  border-radius: 8px;
  padding: 4px;
  transition: background 0.2s;
}

.user-link:hover {
  background: rgba(255,255,255,0.05);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px; /* Quadrado arredondado fica mais moderno */
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-meta { 
  min-width: 0; 
  flex: 1; 
}

.user-name {
  font-size: 13px;
  color: #f8fafc;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.user-role {
  font-size: 11px;
  color: #94a3b8;
  margin: 2px 0 0;
}

.logout {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #64748b;
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.logout:hover { 
  color: #fff; 
  background: rgba(255,255,255,0.1); 
}

/* Main Content Area */
.main {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* Topbar Modernizada */
.topbar {
  height: 70px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .03);
}

.topbar-title { 
  font-weight: 700; 
  font-size: 18px; 
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-search {
  position: relative;
}

.topbar-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 13px;
  pointer-events: none;
}

.topbar-search input {
  width: 240px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 12px 8px 36px;
  font-size: 13px;
  transition: all 0.2s;
}

.topbar-search input:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  outline: none;
}

.topbar-icon-wrap {
  position: relative;
}

.notify-btn {
  width: 38px;
  height: 38px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.notify-btn:hover { 
  color: var(--accent); 
  border-color: #cbd5e1; 
  background: #f8fafc;
}

.notify-count {
  position: absolute;
  right: -6px;
  top: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
}

.topbar-badge {
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.content { 
  padding: 24px 32px; 
  flex: 1;
}

/* Cards Refinados */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
  transition: box-shadow 0.2s;
}

.card:hover {
  /* Um toque sutil de sombra no hover para interatividade */
  box-shadow: 0 4px 6px rgba(15, 23, 42, .04);
}

/* Tabelas */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px; /* Mais arredondado */
}

th, td {
  padding: 12px 16px; /* Mais espaço */
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  color: var(--text);
  background: #fff;
}

th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* Modal Refinado */
.modal {
  max-width: 800px;
  border-radius: 16px;
}

.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-x-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #94a3b8;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-x-btn:hover {
  background: #f1f5f9;
  color: var(--text);
}

/* Responsividade */
@media (max-width: 1100px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    z-index: 100;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
  }
  
  /* Classe para mostrar sidebar em mobile via JS */
  .sidebar.open { 
    transform: translateX(0); 
  }
  
  .main { 
    margin-left: 0; 
  }
  
  .topbar { 
    padding: 0 16px; 
  }
  
  .topbar-search input {
    width: 180px;
  }
  
  .topbar-badge {
    display: none; /* Esconde badge em telas pequenas para economizar espaço */
  }
  
  .content { 
    padding: 16px; 
  }
}

/* --- DASHBOARD WIDGETS --- */

/* Hero Card (Banner de Boas Vindas) */
.hero-card {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border: none;
}

.hero-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.hero-content h3 { margin: 0 0 4px; font-size: 18px; }
.hero-content p { margin: 0; opacity: 0.9; font-size: 14px; }
.hero-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* Usage Card (Plano) */
.usage-card {
  padding: 18px 24px;
}

.usage-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
}

.usage-info .label {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.usage-info h3 {
  font-size: 18px;
  margin: 4px 0 0;
}

/* Dashboard Grid (KPIs) */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: box-shadow 0.2s, transform 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.metric-body .label {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 8px;
}

.metric-body .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 12px;
}

.metric-hint {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-hint.ok { color: #16a34a; padding: 5px 10px; border-radius: 5px; }
.metric-hint.warn { color: #d97706; padding: 5px 10px; border-radius: 5px; }
.metric-hint.danger { color: #dc2626; padding: 5px 10px; border-radius: 5px; }

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
}

.bg-blue { background: linear-gradient(135deg, #4f46e5, #6366f1); }
.bg-red { background: linear-gradient(135deg, #ef4444, #f87171); }
.bg-yellow { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #fff; }
.bg-green { background: linear-gradient(135deg, #10b981, #34d399); }

/* Stats Grid inside Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 4px;
}

.stat-item .label {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 2px;
}

.stat-item .value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.ok-text { color: #16a34a; }
.warn-text { color: #d97706; }
.danger-text { color: #dc2626; }

/* Table Improvements */
.table-wrap table th {
  background: #f8fafc;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
}

.table-wrap table td {
  font-size: 14px;
  color: #0f172a;
}

.table-wrap table tr:hover td {
  background: #f8fafc;
}

/* Responsive */
@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .hero-content { flex-direction: column; align-items: flex-start; text-align: left; }
  .hero-actions { width: 100%; }
  .hero-actions a { flex: 1; text-align: center; }
  .usage-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}
