/* ================================================================
   Credit Score Judicial — Sistema de Gestión
   Aesthetic: Luxury Legal / Refined Dark
   Fonts: Cormorant Garamond (display) + DM Sans (body)
================================================================ */

:root {
  --bg:          #0f0f1a;
  --bg2:         #16162a;
  --bg3:         #1e1e35;
  --surface:     #1a1a2e;
  --surface2:    #22223a;
  --border:      #2e2e50;
  --gold:        #c9a84c;
  --gold2:       #e8c96d;
  --gold-dim:    rgba(201,168,76,0.12);
  --text:        #e8e8f0;
  --text2:       #9090b0;
  --text3:       #6060a0;
  --danger:      #e05555;
  --success:     #4caf7d;
  --info:        #5b9bd5;
  --warning:     #e8a83a;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --sidebar-w:   260px;
}

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

html { font-size: 15px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold2); }

/* ─── AUTH PAGES ─────────────────────────────────────────────── */
.auth-page { background: var(--bg); }

.auth-split {
  display: flex;
  min-height: 100vh;
}

.auth-brand {
  width: 420px;
  flex-shrink: 0;
  background: linear-gradient(160deg, #0c0c1e 0%, #1a1230 100%);
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(201,168,76,0.07) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(91,155,213,0.05) 0%, transparent 50%);
}

.auth-brand-inner {
  position: relative;
  z-index: 1;
  padding: 40px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 48px;
}

.logo-icon {
  font-size: 2.4rem;
  line-height: 1;
  color: var(--gold);
  filter: drop-shadow(0 0 12px rgba(201,168,76,0.5));
}

.logo-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.logo-sub {
  font-size: 0.75rem;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-quote {
  margin-bottom: 48px;
  padding-left: 20px;
  border-left: 2px solid var(--gold);
}

.brand-quote blockquote {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text2);
  line-height: 1.7;
  margin-bottom: 8px;
}

.brand-quote cite {
  font-size: 0.75rem;
  color: var(--gold);
  letter-spacing: 0.05em;
}

.brand-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text3);
  font-size: 0.85rem;
  transition: color 0.2s;
}

.step.active { color: var(--text); }

.step span {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  color: var(--text3);
}

.step.active span {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
  font-weight: 700;
}

.auth-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background:
    radial-gradient(circle at 80% 10%, rgba(201,168,76,0.04) 0%, transparent 40%);
}

.auth-form-wrap {
  width: 100%;
  max-width: 460px;
}

.auth-header { margin-bottom: 32px; }
.auth-header h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.auth-header p { color: var(--text2); }
.back-link {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text3);
  margin-bottom: 12px;
  transition: color 0.2s;
}
.back-link:hover { color: var(--gold); }

/* ─── FORMS ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

input[type=text],
input[type=email],
input[type=password],
input[type=tel],
select,
textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}

select { appearance: none; cursor: pointer; }
textarea { resize: vertical; }

.form-hint {
  font-size: 0.78rem;
  color: var(--text3);
  margin-bottom: 20px;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text3);
}

/* File drop */
.file-drop {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  color: var(--text3);
  transition: border-color 0.2s;
}
.file-drop:hover { border-color: var(--gold); color: var(--text2); }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-name { font-size: 0.8rem; color: var(--gold); margin-top: 8px; }

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-block { width: 100%; justify-content: center; }

.btn-primary {
  background: var(--gold);
  color: var(--bg);
  font-weight: 600;
}
.btn-primary:hover { background: var(--gold2); color: var(--bg); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(201,168,76,0.3); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ─── ALERTS ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 0.875rem;
}
.alert-error   { background: rgba(224,85,85,0.12); border: 1px solid rgba(224,85,85,0.3); color: #f08080; }
.alert-success { background: rgba(76,175,125,0.12); border: 1px solid rgba(76,175,125,0.3); color: #7dcfa0; }
.alert-info    { background: rgba(91,155,213,0.12); border: 1px solid rgba(91,155,213,0.3); color: #8bbde0; }

/* ─── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-pending  { background: rgba(232,168,58,0.15); color: var(--warning); border: 1px solid rgba(232,168,58,0.3); }
.badge-process  { background: rgba(91,155,213,0.15); color: var(--info);    border: 1px solid rgba(91,155,213,0.3); }
.badge-approved { background: rgba(76,175,125,0.15); color: var(--success); border: 1px solid rgba(76,175,125,0.3); }
.badge-rejected { background: rgba(224,85,85,0.15);  color: var(--danger);  border: 1px solid rgba(224,85,85,0.3); }

/* ─── SUCCESS BOX (verificación) ────────────────────────────── */
.success-box { text-align: center; padding: 40px 20px; }
.success-icon {
  font-size: 3rem;
  color: var(--gold);
  margin-bottom: 16px;
  display: block;
}
.success-box h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  margin-bottom: 12px;
  color: var(--text);
}
.success-box p { color: var(--text2); margin-bottom: 24px; line-height: 1.7; }

/* ─── VERIFY PAGE ────────────────────────────────────────────── */
.verify-page {
  display: flex;
  align-items: center;
  justify-content: center;
}
.verify-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  max-width: 440px;
  width: 90%;
}
.verify-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
  color: var(--gold);
}
.verify-box h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  margin-bottom: 12px;
}
.verify-box p { color: var(--text2); margin-bottom: 24px; }

/* ─── DASHBOARD LAYOUT ───────────────────────────────────────── */
.dashboard-page {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  padding: 24px 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-nav {
  flex: 1;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 0.875rem;
  transition: all 0.2s;
  position: relative;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--gold-dim); color: var(--gold); }

.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-avatar { background: var(--info); }

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.72rem; color: var(--text3); }

.logout-btn {
  color: var(--text3);
  font-size: 1rem;
  padding: 4px;
  transition: color 0.2s;
  flex-shrink: 0;
}
.logout-btn:hover { color: var(--danger); }

/* Main */
.dashboard-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px;
  max-width: calc(100vw - var(--sidebar-w));
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.dash-header h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.dash-header p { color: var(--text2); font-size: 0.875rem; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stats-admin { grid-template-columns: repeat(5, 1fr); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--border); }

.stat-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label { font-size: 0.75rem; color: var(--text3); letter-spacing: 0.06em; text-transform: uppercase; }

.stat-pending  .stat-num { color: var(--warning); }
.stat-process  .stat-num { color: var(--info); }
.stat-approved .stat-num { color: var(--success); }
.stat-rejected .stat-num { color: var(--danger); }

/* Sections */
.dash-section { margin-bottom: 32px; }

.section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.count-badge {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  background: var(--surface2);
  color: var(--text3);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

/* Table */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  background: var(--surface2);
  color: var(--text3);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(46,46,80,0.5);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.data-table code {
  background: var(--surface2);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--gold);
}

/* Client cell */
.client-cell strong { display: block; }
.client-cell small { color: var(--text3); font-size: 0.75rem; }

/* Filters */
.filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-form input {
  width: 280px;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.filter-tabs { display: flex; gap: 4px; }
.filter-tab {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text3);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.filter-tab:hover { color: var(--text); background: var(--surface2); }
.filter-tab.active { background: var(--gold-dim); color: var(--gold); border-color: rgba(201,168,76,0.3); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text3);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; display: block; }
.muted { color: var(--text3); font-size: 0.85rem; }

/* Doc list */
.doc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.doc-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.doc-tipo {
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ─── MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease;
}

.modal-lg { max-width: 680px; }

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--danger); }

.modal-body {
  padding: 24px;
  max-height: 80vh;
  overflow-y: auto;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.tramite-meta {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: var(--text2);
}

.estado-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239090b0' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .auth-brand { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-admin { grid-template-columns: repeat(3, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: none; }
  .dashboard-main { margin-left: 0; padding: 16px; }
  .filters-bar { flex-direction: column; align-items: flex-start; }
  .search-form input { width: 100%; }
}
