/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #F1F5F9; color: #1E293B; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ─── Layout ─── */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ─── Sidebar ─── */
.sidebar {
  width: 240px; min-width: 240px;
  background: #0A0E1A;
  display: flex; flex-direction: column;
  padding: 0;
  border-right: 1px solid #1E2535;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #1E2535;
}
.sidebar-logo-img {
  width: 54px; height: 54px; object-fit: contain;
  flex-shrink: 0;
}
.brand-name { font-size: 1.05rem; font-weight: 700; color: #F1F5F9; letter-spacing: -0.3px; }
.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  font-size: 0.875rem; font-weight: 500;
  color: #94A3B8;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.nav-item:hover { background: #1E2535; color: #E2E8F0; }
.nav-item.active { background: #007BE5; color: #fff; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: #EF4444; color: #fff;
  font-size: 0.7rem; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: none; align-items: center; justify-content: center; padding: 0 4px;
}
.nav-badge.visible { display: flex; }
.sidebar-footer { padding: 16px 14px; border-top: 1px solid #1E2535; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar-sm {
  width: 34px; height: 34px; border-radius: 50%;
  background: #007BE5; color: #fff;
  font-size: 0.75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; }
.user-name { font-size: 0.8rem; font-weight: 600; color: #E2E8F0; }
.user-role-label { font-size: 0.7rem; color: #64748B; }

/* ─── Main Wrapper ─── */
.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ─── Topbar ─── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 60px;
  background: #fff; border-bottom: 1px solid #E2E8F0;
  flex-shrink: 0;
}
.page-title { font-size: 1.1rem; font-weight: 700; color: #1E293B; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: #F1F5F9; border: 1px solid #E2E8F0;
  border-radius: 8px; padding: 6px 12px;
}
.search-box input { border: none; background: none; outline: none; font-size: 0.85rem; color: #475569; width: 180px; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #007BE5; color: #fff;
  font-size: 0.75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ─── Main Content ─── */
.main-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ─── Section Header ─── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 1.2rem; font-weight: 700; color: #1E293B; }
.section-subtitle { font-size: 0.8rem; color: #64748B; margin-top: 2px; }

/* ─── KPI Cards ─── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: #fff; border-radius: 12px;
  padding: 20px; border: 1px solid #E2E8F0;
  display: flex; align-items: flex-start; gap: 14px;
}
.kpi-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.kpi-icon.blue { background: #EFF6FF; }
.kpi-icon.green { background: #F0FDF4; }
.kpi-icon.yellow { background: #FFFBEB; }
.kpi-icon.red { background: #FEF2F2; }
.kpi-data { flex: 1; }
.kpi-value { font-size: 1.6rem; font-weight: 800; color: #1E293B; line-height: 1; }
.kpi-label { font-size: 0.78rem; color: #64748B; margin-top: 4px; font-weight: 500; }
.kpi-change { font-size: 0.72rem; margin-top: 6px; font-weight: 600; }
.kpi-change.up { color: #16A34A; }
.kpi-change.down { color: #DC2626; }

/* ─── Charts Row ─── */
.charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px; }
.chart-card { background: #fff; border-radius: 12px; padding: 20px; border: 1px solid #E2E8F0; }
.chart-card-title { font-size: 0.9rem; font-weight: 700; color: #1E293B; margin-bottom: 16px; }
.chart-wrap { position: relative; }

/* ─── Tables ─── */
.table-card { background: #fff; border-radius: 12px; border: 1px solid #E2E8F0; overflow: hidden; }
.table-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid #E2E8F0;
}
.table-search {
  display: flex; align-items: center; gap: 8px;
  background: #F8FAFC; border: 1px solid #E2E8F0;
  border-radius: 8px; padding: 7px 12px; flex: 1; max-width: 280px;
}
.table-search input { border: none; background: none; outline: none; font-size: 0.85rem; color: #475569; width: 100%; }
.filter-select {
  border: 1px solid #E2E8F0; border-radius: 8px;
  padding: 7px 12px; font-size: 0.85rem; color: #475569;
  background: #F8FAFC; outline: none;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 11px 16px; text-align: left;
  font-size: 0.75rem; font-weight: 700; color: #64748B;
  text-transform: uppercase; letter-spacing: 0.05em;
  background: #F8FAFC; border-bottom: 1px solid #E2E8F0;
}
tbody tr { border-bottom: 1px solid #F1F5F9; transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #F8FAFC; }
tbody td { padding: 12px 16px; font-size: 0.85rem; color: #334155; }
.td-id { font-weight: 600; color: #007BE5; font-size: 0.8rem; }
.td-name { font-weight: 600; color: #1E293B; }

/* ─── Status Badges ─── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: #F0FDF4; color: #16A34A; }
.badge-yellow { background: #FFFBEB; color: #CA8A04; }
.badge-red { background: #FEF2F2; color: #DC2626; }
.badge-blue { background: #EFF6FF; color: #2563EB; }
.badge-gray { background: #F1F5F9; color: #64748B; }

/* ─── Action Buttons ─── */
.actions-cell { display: flex; align-items: center; gap: 6px; }
.btn-icon {
  width: 30px; height: 30px; border-radius: 6px; border: none;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.btn-icon.view { background: #EFF6FF; color: #2563EB; }
.btn-icon.edit { background: #F0FDF4; color: #16A34A; }
.btn-icon.delete { background: #FEF2F2; color: #DC2626; }
.btn-icon:hover { filter: brightness(0.9); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 8px; border: none;
  font-size: 0.85rem; font-weight: 600;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-primary { background: #007BE5; color: #fff; }
.btn-primary:hover { background: #0568C8; }
.btn-secondary { background: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; }
.btn-secondary:hover { background: #E2E8F0; }
.btn-danger { background: #EF4444; color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* ─── Forms ─── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 0.8rem; font-weight: 600; color: #374151; }
.form-control {
  border: 1.5px solid #E2E8F0; border-radius: 8px;
  padding: 9px 12px; font-size: 0.875rem; color: #1E293B;
  outline: none; transition: border-color 0.15s;
  background: #fff;
}
.form-control:focus { border-color: #007BE5; }
.form-control.error { border-color: #EF4444; }
.form-hint { font-size: 0.72rem; color: #94A3B8; }
.error-msg { font-size: 0.72rem; color: #EF4444; }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 580px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal.modal-lg { max-width: 720px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid #E2E8F0;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; color: #1E293B; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: #F1F5F9; color: #64748B; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: #E2E8F0; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid #E2E8F0;
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ─── Toast ─── */
#toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 10px;
  font-size: 0.85rem; font-weight: 500; color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: slideIn 0.25s ease;
}
.toast.success { background: #16A34A; }
.toast.error { background: #DC2626; }
.toast.info { background: #007BE5; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Alert Cards ─── */
.alert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.alert-kpi { background: #fff; border-radius: 12px; padding: 18px 20px; border: 1px solid #E2E8F0; }
.alert-kpi-num { font-size: 2rem; font-weight: 800; }
.alert-kpi-label { font-size: 0.78rem; color: #64748B; font-weight: 500; margin-top: 2px; }
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item {
  background: #fff; border-radius: 10px; padding: 14px 16px;
  border: 1px solid #E2E8F0; display: flex; align-items: flex-start; gap: 12px;
}
.alert-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.alert-dot.urgente { background: #EF4444; }
.alert-dot.proximo { background: #F59E0B; }
.alert-dot.ok { background: #16A34A; }
.alert-content { flex: 1; }
.alert-title { font-size: 0.875rem; font-weight: 600; color: #1E293B; }
.alert-desc { font-size: 0.78rem; color: #64748B; margin-top: 2px; }
.alert-date { font-size: 0.72rem; color: #94A3B8; margin-top: 4px; }

/* ─── Gantt ─── */
.gantt-wrap { background: #fff; border-radius: 12px; border: 1px solid #E2E8F0; overflow: auto; }
.gantt-grid { display: grid; min-width: 900px; }
.gantt-header { display: grid; grid-template-columns: 240px 1fr; border-bottom: 1px solid #E2E8F0; }
.gantt-header-label { padding: 12px 16px; font-size: 0.75rem; font-weight: 700; color: #64748B; text-transform: uppercase; background: #F8FAFC; }
.gantt-months { display: flex; background: #F8FAFC; border-left: 1px solid #E2E8F0; }
.gantt-month { flex: 1; padding: 12px 8px; text-align: center; font-size: 0.72rem; font-weight: 700; color: #64748B; text-transform: uppercase; border-right: 1px solid #F1F5F9; }
.gantt-row { display: grid; grid-template-columns: 240px 1fr; border-bottom: 1px solid #F1F5F9; }
.gantt-row:last-child { border-bottom: none; }
.gantt-task-info { padding: 10px 16px; border-right: 1px solid #E2E8F0; display: flex; flex-direction: column; justify-content: center; }
.gantt-task-name { font-size: 0.82rem; font-weight: 600; color: #1E293B; }
.gantt-task-contract { font-size: 0.72rem; color: #94A3B8; }
.gantt-bar-area { position: relative; padding: 8px 0; display: flex; align-items: center; }
.gantt-bar {
  position: absolute; height: 22px; border-radius: 5px;
  display: flex; align-items: center; padding: 0 8px;
  font-size: 0.68rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden;
}

/* ─── Reportes ─── */
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }

/* ─── Usuarios ─── */
.role-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 6px; font-size: 0.72rem; font-weight: 700; }
.role-admin { background: #EFF6FF; color: #2563EB; }
.role-supervisor { background: #F0FDF4; color: #16A34A; }
.role-auditor { background: #FFF7ED; color: #EA580C; }
.role-usuario { background: #F8FAFC; color: #64748B; }

/* ─── Empty State ─── */
.empty-state { text-align: center; padding: 48px 24px; color: #94A3B8; }
.empty-state svg { margin: 0 auto 12px; display: block; opacity: 0.4; }
.empty-state p { font-size: 0.875rem; }

/* ─── Detail View ─── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-label { font-size: 0.72rem; font-weight: 700; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.05em; }
.detail-value { font-size: 0.9rem; color: #1E293B; font-weight: 500; }

/* ─── Progress Bar ─── */
.progress-wrap { background: #F1F5F9; border-radius: 4px; height: 8px; overflow: hidden; margin-top: 4px; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.progress-fill.green { background: #16A34A; }
.progress-fill.yellow { background: #F59E0B; }
.progress-fill.red { background: #EF4444; }
.progress-fill.blue { background: #007BE5; }

/* ─── Responsive tweaks ─── */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: 60px; min-width: 60px; }
  .brand-name, .nav-item span:last-child, .user-meta { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── IA Contractual ─── */
.ia-config-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: 10px;
  margin-bottom: 20px; font-size: 0.85rem;
}
.ia-config-banner code {
  background: rgba(0,0,0,0.08); padding: 1px 6px;
  border-radius: 4px; font-size: 0.8rem;
}
.ia-config-warning {
  background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E;
}
.ia-config-warning strong { display: block; margin-bottom: 2px; }

.ia-upload-zone {
  background: #fff; border: 2px dashed #CBD5E1;
  border-radius: 16px; padding: 60px 24px;
  text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.ia-upload-zone:hover, .ia-upload-zone.drag-over {
  border-color: #7C3AED; background: #FAF5FF;
}
.ia-upload-content { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ia-upload-icon { margin-bottom: 8px; }
.ia-upload-title { font-size: 1rem; font-weight: 700; color: #1E293B; }
.ia-upload-hint { font-size: 0.82rem; color: #94A3B8; }
.ia-upload-btn { margin-top: 8px; cursor: pointer; }

/* Processing */
.ia-processing {
  display: flex; justify-content: center; padding: 48px 24px;
}
.ia-processing-card {
  background: #fff; border-radius: 16px; border: 1px solid #E2E8F0;
  padding: 40px; display: flex; align-items: center; gap: 32px;
  max-width: 560px; width: 100%; box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.ia-spinner {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  border: 4px solid #E2E8F0; border-top-color: #7C3AED;
  animation: ia-spin 0.8s linear infinite;
}
@keyframes ia-spin { to { transform: rotate(360deg); } }

.ia-processing-title { font-size: 1rem; font-weight: 700; color: #1E293B; }
.ia-processing-subtitle { font-size: 0.82rem; color: #94A3B8; margin-top: 2px; }

.ia-steps { display: flex; gap: 20px; margin-top: 16px; }
.ia-step { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: #94A3B8; }
.ia-step-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #E2E8F0; transition: background 0.3s, box-shadow 0.3s;
}
.ia-step-dot.active {
  background: #7C3AED;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
}
.ia-step-dot.done { background: #16A34A; }

/* Results */
.ia-result-header {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border-radius: 12px; padding: 18px 22px;
  border: 1px solid #E2E8F0; margin-bottom: 16px;
}
.ia-result-header-left { display: flex; align-items: center; gap: 14px; }
.ia-result-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: #F0FDF4; display: flex; align-items: center; justify-content: center;
}
.ia-result-title { font-size: 0.95rem; font-weight: 700; color: #1E293B; }
.ia-result-file { font-size: 0.78rem; color: #94A3B8; margin-top: 1px; }

.ia-card {
  background: #fff; border-radius: 12px; padding: 20px;
  border: 1px solid #E2E8F0; margin-bottom: 16px;
}
.ia-card-highlight { border-left: 4px solid #7C3AED; }
.ia-card-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.9rem; font-weight: 700; color: #1E293B; margin-bottom: 14px;
}
.ia-resumen-text { font-size: 0.9rem; color: #475569; line-height: 1.65; }
.ia-object-text { font-size: 0.85rem; color: #475569; line-height: 1.6; }

.ia-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.ia-detail-list { display: flex; flex-direction: column; gap: 10px; }
.ia-detail-row { display: flex; justify-content: space-between; align-items: center; }
.ia-detail-label { font-size: 0.78rem; color: #94A3B8; font-weight: 500; }
.ia-detail-value { font-size: 0.875rem; color: #1E293B; font-weight: 600; }

.ia-monto-display {
  font-size: 1.6rem; font-weight: 800; color: #1E293B; margin-bottom: 4px;
}
.ia-monto-moneda { font-size: 0.78rem; color: #94A3B8; font-weight: 600; }

.ia-clausulas-list { display: flex; flex-direction: column; gap: 12px; }
.ia-clausula-item {
  padding: 12px 14px; border-radius: 8px; background: #F8FAFC;
  border-left: 3px solid #2563EB;
}
.ia-clausula-titulo { font-size: 0.82rem; font-weight: 700; color: #1E293B; margin-bottom: 4px; }
.ia-clausula-desc { font-size: 0.78rem; color: #64748B; line-height: 1.5; }

.ia-penalidades-list { display: flex; flex-direction: column; gap: 10px; }
.ia-penalidad-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: 8px; background: #FEF2F2;
}
.ia-penalidad-condicion { font-size: 0.82rem; color: #1E293B; font-weight: 500; flex: 1; }

.ia-riesgos-list { display: flex; flex-direction: column; gap: 10px; }
.ia-riesgo-item { display: flex; align-items: center; gap: 12px; }
.ia-riesgo-desc { font-size: 0.82rem; color: #475569; }

.ia-ocr-details {
  margin-top: 16px; background: #fff; border-radius: 12px;
  border: 1px solid #E2E8F0; overflow: hidden;
}
.ia-ocr-summary {
  padding: 14px 20px; cursor: pointer; font-size: 0.85rem;
  font-weight: 600; color: #64748B;
  display: flex; align-items: center; gap: 8px;
  list-style: none;
}
.ia-ocr-summary::-webkit-details-marker { display: none; }
.ia-ocr-summary svg { transition: transform 0.2s; }
details[open] .ia-ocr-summary svg { transform: rotate(180deg); }
.ia-ocr-text {
  padding: 16px 20px; border-top: 1px solid #E2E8F0;
  font-size: 0.8rem; color: #64748B; line-height: 1.7;
  max-height: 400px; overflow-y: auto; white-space: pre-wrap;
  font-family: 'Courier New', monospace;
}

@media (max-width: 768px) {
  .ia-grid-2 { grid-template-columns: 1fr; }
  .ia-processing-card { flex-direction: column; text-align: center; }
  .ia-steps { flex-direction: column; gap: 8px; }
}

/* ─── Login Screen ─── */
.login-screen {
  position: fixed; inset: 0; z-index: 2000;
  background: linear-gradient(135deg, #0A0E1A 0%, #1a1f35 50%, #0d1526 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-screen.hidden { display: none; }
.login-container { width: 100%; max-width: 420px; }
.login-card {
  background: #fff; border-radius: 20px;
  padding: 40px 36px; box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: loginFadeIn 0.4s ease;
}
@keyframes loginFadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.login-header { text-align: center; margin-bottom: 28px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 20px; }
.login-brand-name { font-size: 1.3rem; font-weight: 800; color: #1E293B; letter-spacing: -0.5px; }
.login-logo-img {
  width: 64px; height: 64px; object-fit: contain;
}
.login-title { font-size: 1.2rem; font-weight: 700; color: #1E293B; margin-bottom: 6px; }
.login-subtitle { font-size: 0.82rem; color: #94A3B8; }

.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form .form-group { gap: 6px; }
.login-form .form-control { padding: 12px 14px; font-size: 0.9rem; }

.login-password-wrap { position: relative; }
.login-password-wrap .form-control { padding-right: 44px; width: 100%; }
.login-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px;
  display: flex; align-items: center; justify-content: center;
}

.login-options {
  display: flex; align-items: center; justify-content: space-between;
}
.login-remember {
  font-size: 0.8rem; color: #64748B; display: flex; align-items: center; gap: 6px; cursor: pointer;
}
.login-remember input { accent-color: #007BE5; }

.login-btn {
  width: 100%; justify-content: center; padding: 12px;
  font-size: 0.9rem; border-radius: 10px; margin-top: 4px;
}
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  text-align: center; font-size: 0.82rem; color: #DC2626;
  background: #FEF2F2; border-radius: 8px; padding: 10px;
  margin-top: 4px;
}
.login-error.hidden { display: none; }

.login-footer {
  text-align: center; margin-top: 20px; padding-top: 16px;
  border-top: 1px solid #F1F5F9;
}
.login-footer p { font-size: 0.75rem; color: #94A3B8; }
.login-footer code {
  background: #F1F5F9; padding: 2px 8px; border-radius: 4px;
  font-size: 0.78rem; color: #475569;
}

.app-layout.hidden { display: none !important; }

/* ─── Notification Dropdown ─── */
.notif-wrapper { position: relative; }
.notif-btn {
  position: relative; background: none; border: none;
  padding: 8px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.notif-btn:hover { background: #F1F5F9; }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  background: #EF4444; color: #fff;
  font-size: 0.6rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: none; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1;
}
.notif-badge.visible { display: flex; }

.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 380px; background: #fff;
  border-radius: 14px; border: 1px solid #E2E8F0;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  z-index: 500; overflow: hidden;
  animation: dropdownFade 0.15s ease;
}
.notif-dropdown.hidden { display: none; }
@keyframes dropdownFade { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.notif-dropdown-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #E2E8F0;
}
.notif-dropdown-title { font-size: 0.9rem; font-weight: 700; color: #1E293B; }
.notif-mark-all {
  background: none; border: none; font-size: 0.75rem; color: #007BE5;
  font-weight: 600; cursor: pointer;
}
.notif-mark-all:hover { text-decoration: underline; }

.notif-dropdown-body { max-height: 360px; overflow-y: auto; }
.notif-empty { padding: 32px; text-align: center; color: #94A3B8; font-size: 0.85rem; }

.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 18px; cursor: pointer; transition: background 0.1s;
  border-bottom: 1px solid #F8FAFC;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #F8FAFC; }
.notif-item.unread { background: #EFF6FF; }
.notif-item.unread:hover { background: #DBEAFE; }

.notif-dot-wrap { padding-top: 4px; flex-shrink: 0; }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.notif-dot.urgente { background: #EF4444; }
.notif-dot.proximo { background: #F59E0B; }
.notif-dot.ok { background: #16A34A; }

.notif-item-content { flex: 1; min-width: 0; }
.notif-item-title {
  font-size: 0.82rem; font-weight: 600; color: #1E293B;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-item-date { font-size: 0.72rem; color: #94A3B8; margin-top: 2px; }

.notif-dropdown-footer {
  padding: 10px 18px; border-top: 1px solid #E2E8F0;
  text-align: center;
}
.notif-dropdown-footer a {
  font-size: 0.8rem; font-weight: 600; color: #007BE5;
}
.notif-dropdown-footer a:hover { text-decoration: underline; }

/* ─── User Menu Dropdown ─── */
.user-menu-wrapper { position: relative; }
.user-avatar-btn {
  background: none; border: none; cursor: pointer; padding: 0;
  display: flex; align-items: center;
}

.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 240px; background: #fff;
  border-radius: 14px; border: 1px solid #E2E8F0;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  z-index: 500; overflow: hidden;
  animation: dropdownFade 0.15s ease;
}
.user-dropdown.hidden { display: none; }

.user-dropdown-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 12px;
}
.user-dropdown-meta { display: flex; flex-direction: column; }
.user-dropdown-name { font-size: 0.85rem; font-weight: 700; color: #1E293B; }
.user-dropdown-role { font-size: 0.72rem; color: #94A3B8; }

.user-dropdown-divider { height: 1px; background: #E2E8F0; margin: 0 12px; }

.user-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 16px; border: none; background: none;
  font-size: 0.82rem; color: #475569; cursor: pointer; font-family: inherit;
  transition: background 0.1s;
}
.user-dropdown-item:hover { background: #F8FAFC; }
.user-dropdown-item.logout { color: #DC2626; }
.user-dropdown-item.logout:hover { background: #FEF2F2; }
