* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: #0d1325;
  color: #e2e8f0;
  font-size: 14px;
  min-height: 100vh;
}
.hidden { display: none !important; }

button { cursor: pointer; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; transform-origin: center; }

header {
  background: #111a35;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(34, 211, 238, 0.15);
}
h1 { font-size: 1.4em; }
h1 .muted { color: #64748b; font-weight: 400; }
.muted { color: #64748b; }
.muted-small { color: #64748b; font-size: 0.85em; margin-top: 2px; }

.auth {
  display: flex;
  gap: 8px;
}
.auth input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e2e8f0;
  padding: 6px 10px;
  border-radius: 4px;
  width: 280px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  transition: opacity 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  color: white;
  border-color: transparent;
}
.btn-outline {
  background: rgba(255,255,255,0.05);
  color: #94a3b8;
  border-color: rgba(255,255,255,0.1);
}
.btn-outline:hover {
  color: #e2e8f0;
  border-color: rgba(148,163,184,0.35);
}
.btn-danger {
  background: rgba(244,63,94,0.14);
  color: #fca5a5;
  border-color: rgba(244,63,94,0.35);
}
.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}

main { padding: 20px 24px; max-width: 1400px; margin: 0 auto; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.tab {
  background: transparent;
  color: #94a3b8;
  padding: 8px 16px;
  border-radius: 0;
  font-size: 13px;
  border-width: 0 0 2px;
  border-style: solid;
  border-color: transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.tab:hover { color: #e2e8f0; background: transparent; }
.tab.active {
  color: #22d3ee;
  border-bottom-color: #22d3ee;
  background: transparent;
}
.tab svg { flex: none; }
.card-header select, .card-header input[type="month"] {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e2e8f0;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 12px 16px;
}
.kpi .label {
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
}
.kpi .value {
  font-size: 1.8em;
  font-weight: bold;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.kpi.ok       { border-color: rgba(16, 185, 129, 0.3); }
.kpi.ok .value      { color: #6ee7b7; }
.kpi.warn     { border-color: rgba(245, 158, 11, 0.3); }
.kpi.warn .value    { color: #fcd34d; }
.kpi.critical { border-color: rgba(244, 63, 94, 0.3); }
.kpi.critical .value { color: #fca5a5; }

.card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
}
.card-header {
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.card-header h2 { font-size: 1em; flex: 1; }

.cfg-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(100, 116, 139, 0.5);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.68);
  color: #f8fafc;
  padding: 0 12px 0 40px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.cfg-input::placeholder { color: #64748b; }
.cfg-input:focus {
  border-color: rgba(34, 211, 238, 0.65);
  background: rgba(15, 23, 42, 0.86);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.18);
}
.cfg-check {
  position: absolute;
  left: 12px;
  top: 22px;
  transform: translateY(-50%);
  display: flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.cfg-check svg {
  display: none;
  width: 18px;
  height: 18px;
}
.cfg-check.is-ok {
  color: #2dd4bf;
}
.cfg-check.is-missing {
  color: #fb7185;
}
.cfg-check.is-ok .cfg-icon-ok,
.cfg-check.is-missing .cfg-icon-missing {
  display: block;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  color: #94a3b8;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
td {
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.05);
  vertical-align: top;
}
tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75em;
  font-weight: bold;
  font-family: 'Consolas', monospace;
}
.badge.ok       { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.badge.atrasado { background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }
.badge.warn     { background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }
.badge.critical, .badge.sem_heartbeat, .badge.etl_falhou, .badge.testes_falhando {
  background: rgba(244,63,94,0.15); border: 1px solid rgba(244,63,94,0.3); color: #fca5a5;
}
.badge.nunca_pingou, .badge.inativo {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: #94a3b8;
}
.badge.info { background: rgba(56,189,248,0.15); border: 1px solid rgba(56,189,248,0.3); color: #7dd3fc; }
.badge.aberta { background: rgba(56,189,248,0.15); border: 1px solid rgba(56,189,248,0.3); color: #7dd3fc; }
.badge.paga { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.badge.vencida { background: rgba(244,63,94,0.15); border: 1px solid rgba(244,63,94,0.3); color: #fca5a5; }
.badge.cancelada { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: #94a3b8; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-body {
  background: #111a35;
  padding: 24px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  width: 480px;
  max-width: 90vw;
}
.modal-body h3 { margin-bottom: 14px; }
.modal-body label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.85em;
  color: #94a3b8;
}
.modal-body input, .modal-body select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e2e8f0;
  border-radius: 4px;
  font-size: 13px;
}

/* Inputs soltos dentro de um card (Configurações, Sincronização): mesmo
   visual escuro dos modais, senão o browser pinta o campo de branco. */
.card input[type="text"],
.card input[type="password"],
.card input[type="number"],
.card input[type="email"],
.card select {
  margin-top: 4px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e2e8f0;
  border-radius: 4px;
  font-size: 13px;
}
.card input::placeholder { color: #64748b; }
.card input:focus,
.card select:focus,
.modal-body input:focus,
.modal-body select:focus {
  outline: none;
  border-color: rgba(56,189,248,0.55);
  background: rgba(255,255,255,0.07);
}
.modal-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Tela de login / setup */
.login-screen {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-screen .modal-body { width: 380px; }
.login-erro {
  margin-top: 12px;
  padding: 8px 10px;
  background: rgba(244,63,94,0.1);
  border: 1px solid rgba(244,63,94,0.3);
  border-radius: 4px;
  color: #fca5a5;
  font-size: 0.85em;
}
#user-box .muted-small { align-self: center; }
.border-0 {
  border: none;
}
.toast-success {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  border-radius: 10px !important;
}

.toast-error {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  border-radius: 10px !important;
}

.toast-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  border-radius: 10px !important;
}

.toast-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  border-radius: 10px !important;
}

.toast-loading {
  background: linear-gradient(135deg, #64748b, #475569) !important;
  border-radius: 10px !important;
}

.toast-confirm {
  background: #111a35 !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  border-radius: 10px !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4) !important;
}
.toast-confirm-msg {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 260px;
}
.toast-confirm-text {
  color: #e2e8f0;
  font-size: 13px;
  white-space: pre-line;
}
.toast-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}