/* ===== Base ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg-soft: #f8fafc;
  --border-soft: #e2e8f0;
  --text-soft: #64748b;
}

html, body {
  min-height: 100%;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hidden { display: none !important; }

/* ===== Login ===== */
.body, .login-page {
  margin: 0;
}

.login-page {
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.22), transparent 30%),
    linear-gradient(135deg, #020617 0%, #0f172a 55%, #111827 100%);
}

.dark .login-page {
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.26), transparent 30%),
    linear-gradient(135deg, #020617 0%, #020617 45%, #0f172a 100%);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 960px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 420px);
  gap: 28px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 30px 80px rgba(2, 6, 23, 0.35);
  border-radius: 32px;
  overflow: hidden;
  padding: 28px;
  color: #0f172a;
}

.dark .login-card {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(51, 65, 85, 0.7);
  color: #e2e8f0;
}

.login-brand {
  border-radius: 28px;
  padding: 34px;
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.03)),
    #eff6ff;
  border: 1px solid rgba(37, 99, 235, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dark .login-brand {
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.16), rgba(37, 99, 235, 0.04)),
    rgba(15, 23, 42, 0.8);
  border-color: rgba(59, 130, 246, 0.18);
}

.login-main-logo {
  width: 110px;
  height: auto;
  object-fit: contain;
  margin-bottom: 24px;
}

.login-kicker {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--primary);
}

.login-brand h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.login-subtitle {
  margin: 16px 0 0;
  font-size: 0.98rem;
  line-height: 1.65;
  color: #334155;
  max-width: 34rem;
}

.dark .login-subtitle { color: #cbd5e1; }

.login-panel {
  border-radius: 28px;
  padding: 30px;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dark .login-panel {
  background: rgba(2, 6, 23, 0.65);
  border-color: rgba(51, 65, 85, 0.85);
}

.login-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 18px 30px rgba(37, 99, 235, 0.26);
  margin-bottom: 18px;
}

.login-panel h2 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.login-panel > p {
  margin: 10px 0 26px;
  color: #64748b;
  font-size: 0.95rem;
}

.dark .login-panel > p { color: #94a3b8; }

.login-label {
  display: block;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #64748b;
}

.dark .login-label { color: #94a3b8; }

.input-base {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  border-radius: 14px;
  padding: 0.82rem 0.95rem;
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease;
}

.input-base:focus {
  border-color: rgba(37, 99, 235, 0.9);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.dark .input-base {
  background: rgba(15, 23, 42, 0.88);
  border-color: #334155;
  color: #e2e8f0;
}

.dark .input-base::placeholder { color: #64748b; }

.login-submit-btn,
.crm-mobile-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 800;
  padding: 0.95rem 1rem;
  box-shadow: 0 18px 32px rgba(37, 99, 235, 0.24);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s ease;
}

.login-submit-btn:hover,
.crm-mobile-action-btn:hover { transform: translateY(-1px); }

.login-error {
  margin: 14px 0 0;
  color: #dc2626;
  font-size: 0.85rem;
  font-weight: 800;
}

.login-help-box {
  margin-top: 18px;
  border-radius: 18px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  padding: 14px 15px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dark .login-help-box {
  border-color: rgba(59, 130, 246, 0.2);
  background: rgba(30, 41, 59, 0.76);
}

.login-help-title {
  margin: 0;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--primary);
}

.login-help-text {
  margin: 6px 0 0;
  font-size: 0.88rem;
  color: #334155;
}
.dark .login-help-text { color: #cbd5e1; }

.login-help-badge {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: #dbeafe;
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.dark .login-help-badge {
  background: rgba(59, 130, 246, 0.18);
  color: #bfdbfe;
}

.login-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 4px;
}

.login-footer-dev {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-dev-logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  object-fit: contain;
  background: #fff;
  padding: 8px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.login-footer-label {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 900;
  color: #64748b;
}

.login-footer-name {
  margin: 4px 0 0;
  font-size: 0.98rem;
  font-weight: 800;
}

.login-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  font-weight: 700;
  padding: 0.8rem 1rem;
  cursor: pointer;
}

.dark .login-theme-btn {
  border-color: #334155;
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
}

/* ===== App layout / shared ===== */
#startup-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.no-print {}

.custom-scrollbar::-webkit-scrollbar { width: 8px; height: 8px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.55); border-radius: 999px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }

.view-section { display: none; }
.view-section.active { display: block; }

.crm-sidebar { overflow: hidden; }
.sidebar-brand { background: linear-gradient(180deg, rgba(37, 99, 235, 0.05), transparent); }
.crm-pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--primary-dark);
  background: #dbeafe;
}

.dark .crm-pro-badge { background: rgba(37, 99, 235, 0.14); color: #bfdbfe; }

.menu-caption {
  padding: 0 12px 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #94a3b8;
}

.reports-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.45), transparent);
  margin: 10px 10px 8px;
}

.nav-btn.active,
.mobile-nav-btn.active {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
}

.dark .nav-btn.active,
.dark .mobile-nav-btn.active {
  background: rgba(37, 99, 235, 0.18) !important;
  color: #bfdbfe !important;
}

.crm-main-shell {
  padding: 22px;
}

.crm-main-header {
  margin-bottom: 18px;
  padding: 20px 22px;
  border-radius: 24px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: linear-gradient(135deg, rgba(255,255,255,0.94), rgba(239,246,255,0.88));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dark .crm-main-header {
  border-color: rgba(51, 65, 85, 0.8);
  background: linear-gradient(135deg, rgba(15,23,42,0.95), rgba(30,41,59,0.9));
}

.crm-main-header p {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: #64748b;
}

.crm-main-header h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: -.03em;
  font-weight: 900;
  color: #0f172a;
}

.dark .crm-main-header h1 { color: #f8fafc; }

.crm-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.crm-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #1e293b;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(226,232,240,0.9);
}

.dark .crm-chip {
  color: #e2e8f0;
  background: rgba(15,23,42,0.8);
  border-color: rgba(51,65,85,0.8);
}

.crm-content-area { min-height: calc(100vh - 120px); }

#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 16px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 18px 28px rgba(15, 23, 42, 0.22);
}

.toast.success { background: linear-gradient(135deg, #059669, #10b981); }
.toast.error { background: linear-gradient(135deg, #dc2626, #ef4444); }
.toast.info { background: linear-gradient(135deg, #2563eb, #3b82f6); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.34rem 0.62rem;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.badge-atestado { background: #dbeafe; color: #1d4ed8; }
.badge-advertencia { background: #fee2e2; color: #b91c1c; }
.badge-relatorio_bordo, .badge-relatorio_semanal, .badge-relatorio_mensal { background: #e9d5ff; color: #6d28d9; }
.badge-falta_justificada { background: #ffedd5; color: #c2410c; }
.badge-falta_injustificada { background: #fee2e2; color: #b91c1c; }
.badge-avaliacao { background: #dbeafe; color: #1d4ed8; }
.badge-nr1 { background: #dcfce7; color: #15803d; }
.badge-outros { background: #e2e8f0; color: #334155; }

.crm-mobile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
}
.crm-mobile-action-btn {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
}

.falta-card-mobile {
  border: 1px solid rgba(226,232,240,0.95);
  border-radius: 18px;
  background: rgba(255,255,255,0.92);
  padding: 14px;
}

.dark .falta-card-mobile {
  background: rgba(15,23,42,0.7);
  border-color: rgba(51,65,85,0.8);
}

#mobile-menu-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(92vw, 340px);
  padding: 16px;
  transform: translateX(-110%);
  transition: transform .25s ease;
  z-index: 80;
}

body.mobile-sidebar-open #mobile-menu-panel { transform: translateX(0); }
#mobile-sidebar-backdrop { display: none; }
body.mobile-sidebar-open #mobile-sidebar-backdrop { display: block; }

.pagination-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

#loading-spinner { width: 46px; height: 46px; }

/* ===== Print ===== */
@media print {
  .no-print, #mobile-menu-panel, #mobile-sidebar-backdrop, #mobile-topbar { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .print-container, .print-break-inside-avoid { break-inside: avoid; }
}

/* ===== Responsive ===== */
@media (max-width: 980px) {
  .login-card { grid-template-columns: 1fr; }
  .login-brand { padding: 26px; }
}

@media (max-width: 768px) {
  .crm-main-shell { padding: 14px; padding-top: 82px; }
  .crm-main-header { padding: 16px; border-radius: 20px; flex-direction: column; }
  .crm-header-actions { justify-content: flex-start; }
  .login-footer { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  .login-shell { padding: 14px; }
  .login-card { padding: 16px; border-radius: 24px; }
  .login-brand, .login-panel { padding: 20px; border-radius: 22px; }
  .login-main-logo { width: 84px; }
}
