* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --azul: #004aad;
  --roxo: #8a87a1;
  --branco: #ffffff;
  --cinza-claro: #f8faff;
  --cinza-borda: #e5eeff;
  --texto: #1a1a2e;
  --texto-suave: #6b7280;
  --sidebar-bg: #004aad;
  --sidebar-hover: #003d91;
  --sidebar-ativo: #ffffff;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cinza-claro);
  color: var(--texto);
  height: 100%;
}

/* LAYOUT */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar-logo img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-logo-text {
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1px;
}

.sidebar-logo-sub {
  color: rgba(255,255,255,0.6);
  font-size: 9px;
  letter-spacing: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar-section {
  padding: 8px 20px 4px;
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-item:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.sidebar-item.ativo {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
  font-weight: 700;
}

.sidebar-item .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.15);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

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

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

.sidebar-user-role {
  color: rgba(255,255,255,0.5);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* CONTEÚDO PRINCIPAL */
.main-content {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-header {
  background: #ffffff;
  border-bottom: 1px solid var(--cinza-borda);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.main-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--texto);
}

.main-header-sub {
  color: var(--texto-suave);
  font-size: 13px;
  margin-top: 2px;
}

.main-body {
  flex: 1;
  padding: 32px;
}

/* CARDS */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid var(--cinza-borda);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #eef3ff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.card-icon svg {
  width: 20px;
  height: 20px;
  color: var(--azul);
}

.card-valor {
  font-size: 28px;
  font-weight: 800;
  color: var(--texto);
  margin-bottom: 4px;
}

.card-label {
  font-size: 13px;
  color: var(--texto-suave);
}

.card-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #eef3ff; color: #004aad; }

/* TABELAS */
.table-container {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--cinza-borda);
  overflow: hidden;
}

.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--cinza-borda);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-header h2 {
  font-size: 16px;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 12px 24px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--texto-suave);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--cinza-claro);
  border-bottom: 1px solid var(--cinza-borda);
}

td {
  padding: 14px 24px;
  font-size: 14px;
  border-bottom: 1px solid var(--cinza-borda);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--cinza-claro); }

/* BOTÕES */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-primary { background: var(--azul); color: #ffffff; }
.btn-primary:hover { background: #003d91; }
.btn-outline { background: transparent; color: var(--azul); border: 1px solid var(--azul); }
.btn-outline:hover { background: #eef3ff; }
.btn-danger { background: var(--danger); color: #ffffff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* FORMULÁRIOS */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--texto);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--cinza-borda);
  border-radius: 8px;
  font-size: 14px;
  color: var(--texto);
  background: #ffffff;
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(0,74,173,0.1);
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--cinza-borda);
  border-radius: 8px;
  font-size: 14px;
  color: var(--texto);
  background: #ffffff;
  outline: none;
  cursor: pointer;
}

.form-select:focus { border-color: var(--azul); }
.form-hint { font-size: 12px; color: var(--texto-suave); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ALERTS */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #eef3ff; color: #004aad; border: 1px solid #c7d7f8; }

/* LOADING */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--texto-suave);
  font-size: 14px;
  gap: 8px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--cinza-borda);
  border-top-color: var(--azul);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--cinza-borda);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--texto-suave);
  padding: 4px;
}

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--cinza-borda);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--texto-suave);
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; }

.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--texto);
  margin-bottom: 8px;
}

.empty-state p { font-size: 14px; margin-bottom: 24px; }

/* STATUS */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
}

.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.status-ativa    { background: #dcfce7; color: #166534; }
.status-ativa .status-dot { background: #22c55e; }
.status-pendente { background: #fef3c7; color: #92400e; }
.status-pendente .status-dot { background: #f59e0b; }
.status-erro     { background: #fee2e2; color: #991b1b; }
.status-erro .status-dot { background: #ef4444; }
.status-subindo  { background: #eef3ff; color: #004aad; }
.status-subindo .status-dot { background: #004aad; }
.status-pausada  { background: #f3f4f6; color: #6b7280; }
.status-pausada .status-dot { background: #9ca3af; }

/* RESPONSIVO */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .main-body { padding: 16px; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
}
