/* ── Fuente Satoshi (Fontshare) ──────────────────────────────────────────────── */
@import url('https://api.fontshare.com/v2/css?f[]=satoshi@400,500,600,700,900&display=swap');

/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --primary:        #059669;
  --primary-dark:   #047857;
  --primary-light:  #ecfdf5;
  --danger:         #dc2626;
  --warning:        #d97706;
  --radius-card:    1rem;
  --radius-input:   0.75rem;
}

/* ── Base ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Satoshi', system-ui, -apple-system, sans-serif;
  background-color: #f1f5f9;
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
}

/* ── Clases utilitarias de compatibilidad ───────────────────────────────────── */
.d-none   { display: none !important; }
.hidden   { display: none !important; }

/* ── Navbar ──────────────────────────────────────────────────────────────────── */
.app-nav {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 40;
  height: 64px;
  display: flex;
  align-items: center;
}
.app-nav .nav-inner {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-nav .brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
  text-decoration: none;
}
.app-nav .brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.app-nav .nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.app-nav .user-label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
}
.app-nav .btn-logout {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.app-nav .btn-logout:hover { background: #fef2f2; color: #dc2626; border-color: #fecaca; }

/* ── Contenedor principal ───────────────────────────────────────────────────── */
.page-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background: #ffffff;
  border-radius: var(--radius-card);
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-body { padding: 1.5rem; }
.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Botones ──────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-input);
  padding: 0.5rem 1rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary   { background: var(--primary);  color: #fff; box-shadow: 0 1px 4px rgba(5,150,105,.25); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); box-shadow: 0 2px 8px rgba(5,150,105,.35); }

.btn-success   { background: #10b981; color: #fff; box-shadow: 0 1px 4px rgba(16,185,129,.25); }
.btn-success:hover:not(:disabled)  { background: #059669; }

.btn-danger    { background: var(--danger); color: #fff; box-shadow: 0 1px 4px rgba(220,38,38,.2); }
.btn-danger:hover:not(:disabled)   { background: #b91c1c; }

.btn-ghost  { background: transparent; color: #475569; border: 1px solid #e2e8f0; }
.btn-ghost:hover:not(:disabled) { background: #f8fafc; }

.btn-warning   { background: #f59e0b; color: #fff; }
.btn-warning:hover:not(:disabled) { background: #d97706; }

.btn-sm  { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg  { padding: 0.7rem 1.5rem; font-size: 0.95rem; }

.btn-icon {
  padding: 0.4rem;
  border-radius: 8px;
  background: none;
  border: 1px solid #e2e8f0;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: #f1f5f9; color: #0f172a; }
.btn-icon svg { width: 15px; height: 15px; }

/* ── Formularios ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.4rem;
}
.form-label .req { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 0.6rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-input);
  font-family: inherit;
  font-size: 0.875rem;
  color: #0f172a;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  appearance: none;
}
.form-control::placeholder { color: #9ca3af; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(5,150,105,0.1); }
.form-control[disabled], .form-control[readonly] { background: #f8fafc; color: #94a3b8; cursor: not-allowed; }
.form-control[type='file'] { padding: 0.5rem 0.75rem; }
.form-hint { font-size: 0.76rem; color: #6b7280; margin-top: 0.3rem; }

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25em;
  padding-right: 2.5rem;
}

.password-wrapper { position: relative; }
.password-wrapper .form-control { padding-right: 2.75rem; }
.toggle-pwd {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.toggle-pwd:hover { color: #374151; }
.toggle-pwd svg { width: 16px; height: 16px; }

/* ── Badges de estado ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  letter-spacing: 0.01em;
}
.badge svg { width: 11px; height: 11px; }
.badge-warning  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-success  { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.badge-danger   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.badge-primary  { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.badge-gray     { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

/* ── Alertas ──────────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-input);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  border: 1px solid transparent;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-danger  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ── Spinner ──────────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tabs ────────────────────────────────────────────────────────────────────── */
.tab-group {
  display: flex;
  gap: 0.25rem;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  padding: 0.25rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}
.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn svg { width: 15px; height: 15px; }
.tab-btn:hover { color: #0f172a; background: rgba(255,255,255,.6); }
.tab-btn.active { background: #fff; color: #059669; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Tabla ───────────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table thead th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}
.data-table thead th:first-child { border-radius: 8px 0 0 8px; }
.data-table thead th:last-child  { border-radius: 0 8px 8px 0; text-align: right; }
.data-table tbody td {
  padding: 0.75rem;
  border-bottom: 1px solid #f8fafc;
  color: #1e293b;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #fafafa; }
.data-table .col-actions { text-align: right; }

/* ── Modal overlay ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-box {
  background: #fff;
  border-radius: 1.25rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.18);
}
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0;
}
.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.modal-title svg { width: 18px; height: 18px; }
.modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  transition: all 0.15s;
  display: flex;
}
.modal-close:hover { background: #f1f5f9; color: #0f172a; }
.modal-close svg { width: 18px; height: 18px; }
.modal-body   { padding: 1rem 1.5rem; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0 1.5rem 1.25rem;
}

/* ── Campo de revisión ──────────────────────────────────────────────────────── */
.review-field-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
}
.review-field-item.border-danger { border-color: var(--danger) !important; background: #fff5f5; }
.review-radio-group { display: flex; gap: 0.75rem; margin: 0.5rem 0; }
.radio-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  transition: all 0.12s;
  user-select: none;
}
.radio-option input[type='radio'] { width: 14px; height: 14px; accent-color: var(--primary); }
.radio-option.checked-cumple   { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.radio-option.checked-nocumple { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.comment-wrap { margin-top: 0.5rem; }
.comment-wrap textarea {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.comment-wrap textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(5,150,105,0.1); }
.comment-hint { font-size: 0.73rem; color: var(--danger); margin-top: 0.25rem; }

/* ── Campos bloqueados en modo corrección ───────────────────────────────────── */
.field-locked { opacity: 0.5; pointer-events: none; }
.field-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  margin-bottom: 0.35rem;
}
.field-status-badge svg { width: 11px; height: 11px; }
.field-status-badge.needs-fix { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.field-status-badge.locked    { background: #f1f5f9; color: #94a3b8; border: 1px solid #e2e8f0; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: #94a3b8;
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 1rem; opacity: 0.5; }
.empty-state p { margin: 0.5rem 0 0; font-size: 0.9rem; }

/* ── Documentos entregados (revisor) ─────────────────────────────────────────── */
.doc-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6rem 0.875rem;
  border: 1px solid #f1f5f9;
  border-radius: 0.75rem;
  margin-bottom: 0.5rem;
  background: #f8fafc;
  font-size: 0.82rem;
}
.doc-item svg { flex-shrink: 0; }
.doc-item-name { font-weight: 600; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-item-orig { font-size: 0.73rem; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Sección grupo de revisión ────────────────────────────────────────────── */
.review-group-header {
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #f1f5f9;
}

/* ── File current row (operador corrección) ──────────────────────────────────── */
.file-current {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 0.375rem;
  font-size: 0.8rem;
}
.file-current svg { flex-shrink: 0; }
.file-current span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #374151; font-weight: 500; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .page-content { padding: 1rem 0.875rem; }
  .card-body { padding: 1rem; }
  .modal-box { max-width: 100%; border-radius: 1.25rem 1.25rem 0 0; }
}
