:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --sidebar-w: 250px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.p-6 { padding: 1.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.flex-1 { flex: 1; }

.icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}
.icon-lg { width: 32px; height: 32px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13.5px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:disabled,
.btn[disabled],
button:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  filter: grayscale(30%) !important;
  box-shadow: none !important;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}
.btn-secondary:hover {
  background-color: #e2e8f0;
}

.btn-outline {
  background-color: #ffffff;
  color: #334155;
  border-color: var(--border);
}
.btn-outline:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

.btn-block { width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
}
.btn-icon:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-secondary { background: #f1f5f9; color: #475569; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.score-badge-red { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.score-badge-amber { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }
.score-badge-green { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.score-special-badge { background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; font-weight: 700; }
.origin-badge-pdf { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; display: inline-block; }
.origin-badge-editado { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; display: inline-block; }
.origin-badge-manual { background: #dcfce7; color: #15803d; border: 1px solid #86efac; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; display: inline-block; }

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.2s ease;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Login Screen */
.screen-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #0369a1 100%);
  padding: 20px;
}
.login-card {
  background: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  padding: 32px;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2), 0 10px 10px -5px rgba(0,0,0,0.1);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.login-logo { width: 42px; height: 42px; }
.brand-text h2 { font-size: 18px; font-weight: 800; color: #0284c7; line-height: 1.1; }
.brand-text span { font-size: 10px; font-weight: 700; color: #0369a1; letter-spacing: 1px; }
.login-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13.5px;
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(2,132,199,0.15); }
.form-control[readonly] { background-color: #f8fafc; color: #334155; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; display: block; }
.login-footer { margin-top: 24px; text-align: center; font-size: 11.5px; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 16px; }

/* Main Wrapper & Layout */
.app-layout { min-height: 100vh; display: flex; flex-direction: column; }
.main-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.header-brand-nav { display: flex; align-items: center; gap: 10px; }
.nav-logo { width: 32px; height: 32px; }
.nav-brand-text { display: flex; flex-direction: column; }
.nav-title { font-size: 14px; font-weight: 800; color: #0284c7; line-height: 1.1; }
.nav-sub { font-size: 8.5px; font-weight: 700; color: #0369a1; letter-spacing: 0.8px; }

.sidebar-nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  color: #475569;
  text-decoration: none;
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.15s;
}
.nav-item:hover { background-color: #f1f5f9; color: var(--text-main); }
.nav-item.active { background-color: var(--primary-light); color: var(--primary); }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.user-profile { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e0f2fe;
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 12.5px; font-weight: 600; color: var(--text-main); }
.user-role { font-size: 10.5px; color: var(--text-muted); }
.btn-logout { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 6px; border-radius: 4px; }
.btn-logout:hover { background: #fee2e2; color: var(--danger); }

/* Main Content */
.main-content {
  flex: 1;
  padding: 32px 40px;
  overflow-y: auto;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.page-title { font-size: 24px; font-weight: 700; color: var(--text-main); }
.page-subtitle { font-size: 13.5px; color: var(--text-muted); margin-top: 2px; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}
.stat-label { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.5px; }
.stat-number { font-size: 26px; font-weight: 800; color: var(--text-main); margin-top: 6px; }
.stat-card-success .stat-number { color: var(--success); }

/* Tables */
.table-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.table-header h3 { font-size: 14px; font-weight: 700; color: #334155; }
.search-input {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
  width: 260px;
  outline: none;
}
.search-input:focus { border-color: var(--primary); }

.table-responsive { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}
.data-table tr:hover td { background-color: #f8fafc; }

/* Card base */
.card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.drop-icon { width: 48px; height: 48px; color: var(--primary); }

.selected-file-box {
  margin-top: 16px;
  padding: 14px 18px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.file-meta { display: flex; align-items: center; gap: 12px; }
.file-actions { display: flex; gap: 10px; }

/* Process Progress */
.process-progress-box {
  margin-top: 24px;
  padding: 24px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  margin: 12px 0 16px 0;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}
.progress-checklist {
  list-style: none;
  max-width: 360px;
  margin: 0 auto;
  text-align: left;
  font-size: 12.5px;
  color: var(--text-muted);
}
.progress-checklist li {
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress-checklist li.done { color: var(--success); font-weight: 600; }
.progress-checklist li.done::before { content: '✓ '; }
.progress-checklist li.active { color: var(--primary); font-weight: 600; }

/* Conference Screen */
.conference-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.conference-actions { display: flex; gap: 10px; }

.notice-bar {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}
.notice-info { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.notice-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.notice-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.conf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.conf-group { margin-bottom: 12px; }
.conf-group label { display: block; font-size: 11.5px; font-weight: 600; color: #475569; margin-bottom: 4px; }
.conf-subtable-header { margin-bottom: 8px; }
.conf-subtable-header h4 { font-size: 13px; font-weight: 700; color: #334155; }

.conf-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}
.conf-section-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: #1e3a5f;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-nada-consta {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 12px 16px;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stat-pill {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  color: #475569;
}
.stat-pill strong {
  color: #0f172a;
}
.badge-score-green { background: #dcfce7; color: #166534; border: 1px solid #86efac; font-weight: 700; }
.badge-score-light-green { background: #ecfccb; color: #3f6212; border: 1px solid #bef264; font-weight: 700; }
.badge-score-amber { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; font-weight: 700; }
.badge-score-red { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; font-weight: 700; }
.badge-score-gray { background: #f3f4f6; color: #6b7280; border: 1px solid #d1d5db; font-weight: 600; }


/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-dialog {
  background: #ffffff;
  border-radius: 8px;
  width: 95vw;
  height: 92vh;
  max-width: none;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.35);
  overflow: hidden;
}
.modal-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  height: 60px;
}
.modal-title-wrap { display: flex; align-items: center; gap: 10px; }
.modal-actions-top { display: flex; align-items: center; gap: 10px; }
.modal-body-pdf {
  flex: 1;
  height: calc(92vh - 70px);
  background: #525659;
  overflow: hidden;
}
.modal-body-pdf iframe,
.modal-body-pdf object {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
