/* ═══════════════════════════════════════════════════════════════
   Legajo Digital — Design System Premium
   Paleta: Azul marino #1a3a6b + Dorado #e8a020 + Gris perla
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;600;700&display=swap');

/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --navy:        #1a3a6b;
  --navy-dark:   #0f2347;
  --navy-light:  #2a5298;
  --gold:        #e8a020;
  --gold-light:  #f5c555;
  --gold-dark:   #c4840d;
  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --info:        #3b82f6;

  --bg-body:     #f0f4f8;
  --bg-card:     #ffffff;
  --bg-sidebar:  #0f2347;
  --border:      #dde3ea;
  --text-primary:#1e293b;
  --text-sec:    #64748b;
  --text-light:  #94a3b8;

  --sidebar-w:   260px;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(26,58,107,0.10);
  --shadow-lg:   0 8px 40px rgba(26,58,107,0.18);
  --transition:  0.22s cubic-bezier(.4,0,.2,1);
}

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 15px; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; }

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ══════════════════════════════════════════════════════════════
   LAYOUT — Admin
   ══════════════════════════════════════════════════════════════ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow: hidden;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-brand .brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.sidebar-brand .brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.sidebar-brand .brand-sub {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
  padding: 1rem 1.25rem 0.4rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: rgba(255,255,255,0.65);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
  position: relative;
}
.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
  border-left-color: rgba(232,160,32,0.5);
}
.nav-item.active {
  color: #fff;
  background: rgba(232,160,32,0.15);
  border-left-color: var(--gold);
}
.nav-item .nav-icon { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: var(--navy-dark);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex; align-items: center; gap: 0.75rem;
}
.sidebar-user .avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--navy-light), var(--gold));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 0.85rem;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 0.8rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 0.7rem; color: var(--gold); }
.btn-logout {
  background: none; border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer; font-size: 1rem;
  transition: color var(--transition);
  padding: 0.25rem;
}
.btn-logout:hover { color: var(--danger); }

/* ── Main content ──────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.page-body {
  flex: 1;
  padding: 2rem;
}

/* ══════════════════════════════════════════════════════════════
   COMPONENTES
   ══════════════════════════════════════════════════════════════ */

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.card-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  flex: 1;
}
.card-body { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-body);
}

/* ── Stat cards ─────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--navy);
}
.stat-card.gold::before  { background: var(--gold); }
.stat-card.green::before { background: var(--success); }
.stat-card.red::before   { background: var(--danger); }
.stat-card.info::before  { background: var(--info); }

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-icon.navy  { background: rgba(26,58,107,0.1);  color: var(--navy); }
.stat-icon.gold  { background: rgba(232,160,32,0.12); color: var(--gold-dark); }
.stat-icon.green { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-icon.red   { background: rgba(239,68,68,0.1);  color: var(--danger); }
.stat-icon.info  { background: rgba(59,130,246,0.1); color: var(--info); }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--text-sec);
  font-weight: 500;
  margin-top: 0.2rem;
}

/* ── Botones ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  font-family: inherit;
  line-height: 1.4;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.btn-primary:hover:not(:disabled) {
  background: var(--navy-dark);
  border-color: var(--navy-dark);
  transform: translateY(-1px);
}

.btn-gold {
  background: var(--gold);
  color: var(--navy-dark);
  border-color: var(--gold);
}
.btn-gold:hover:not(:disabled) {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover:not(:disabled) {
  background: #059669;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--navy);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
  background: var(--bg-body);
  border-color: var(--navy);
}

.btn-ghost {
  background: transparent;
  color: var(--text-sec);
  border-color: transparent;
  padding: 0.4rem 0.75rem;
}
.btn-ghost:hover { background: var(--bg-body); color: var(--text-primary); }

.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.8rem; font-size: 1rem; }
.btn-icon { padding: 0.5rem; border-radius: var(--radius-sm); }
.btn-block { width: 100%; justify-content: center; }

/* ── Formularios ───────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}
.form-label .required { color: var(--danger); margin-left: 0.2rem; }

.form-control {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(42,82,152,0.12);
}
.form-control::placeholder { color: var(--text-light); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint { font-size: 0.75rem; color: var(--text-sec); margin-top: 0.3rem; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 0.3rem; display: none; }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid + .form-error { display: block; }

.form-row { display: grid; gap: 1rem; }
.form-row.col-2 { grid-template-columns: 1fr 1fr; }
.form-row.col-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.col-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* ── Tabla ─────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--navy);
  color: #fff;
  padding: 0.75rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:nth-child(even) { background: var(--bg-body); }
tbody tr:hover { background: rgba(42,82,152,0.04); }
tbody td { padding: 0.75rem 1rem; font-size: 0.855rem; }
tbody td:last-child { white-space: nowrap; }

.table-actions { display: flex; gap: 0.4rem; align-items: center; }

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-success { background: rgba(16,185,129,0.12); color: #059669; }
.badge-warning { background: rgba(245,158,11,0.12); color: #b45309; }
.badge-danger  { background: rgba(239,68,68,0.12);  color: #dc2626; }
.badge-info    { background: rgba(59,130,246,0.12); color: #2563eb; }
.badge-navy    { background: rgba(26,58,107,0.12);  color: var(--navy); }
.badge-gold    { background: rgba(232,160,32,0.15); color: var(--gold-dark); }
.badge-gray    { background: var(--bg-body); color: var(--text-sec); }

/* ── Tabs ───────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 0.65rem 1.1rem;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-sec);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active {
  color: var(--navy);
  border-bottom-color: var(--gold);
}
.tab-panel { display: none; animation: fadeIn 0.2s ease; }
.tab-panel.active { display: block; }

/* ── Modales ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,35,71,0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal.modal-lg  { max-width: 860px; }
.modal.modal-xl  { max-width: 1100px; }

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--navy); flex: 1; }
.modal-close {
  background: none; border: none;
  font-size: 1.2rem; cursor: pointer;
  color: var(--text-sec);
  transition: color var(--transition);
  line-height: 1;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ── Alertas ─────────────────────────────────────────────────────── */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.alert-success { background: rgba(16,185,129,0.1); color: #065f46; border-left: 4px solid var(--success); }
.alert-danger  { background: rgba(239,68,68,0.1);  color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: rgba(245,158,11,0.1); color: #92400e; border-left: 4px solid var(--warning); }
.alert-info    { background: rgba(59,130,246,0.1); color: #1e40af; border-left: 4px solid var(--info); }

/* ── Toast ──────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}
.toast {
  background: var(--navy-dark);
  color: #fff;
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: all;
  animation: toastIn 0.3s ease;
  max-width: 340px;
  border-left: 4px solid var(--gold);
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes toastIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Search & Filters ────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-input-wrap .search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}
.search-input-wrap .form-control {
  padding-left: 2.5rem;
}

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-sec);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; color: var(--text-primary); margin-bottom: 0.5rem; }
.empty-state p  { font-size: 0.875rem; }

/* ── Legajo tabs ─────────────────────────────────────────────────── */
.legajo-header {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 60%, var(--navy-light) 100%);
  padding: 2rem;
  border-radius: var(--radius) var(--radius) 0 0;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.legajo-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 800; color: var(--navy-dark);
  flex-shrink: 0;
  border: 3px solid rgba(255,255,255,0.3);
}
.legajo-info h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.25rem; }
.legajo-info .meta { font-size: 0.85rem; opacity: 0.8; display: flex; gap: 1rem; flex-wrap: wrap; }
.legajo-actions { margin-left: auto; display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Firma canvas ────────────────────────────────────────────────── */
.firma-canvas-wrap {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fafbfc;
  position: relative;
  overflow: hidden;
  cursor: crosshair;
}
.firma-canvas-wrap canvas {
  display: block;
  width: 100%;
  touch-action: none;
}
.firma-canvas-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.85rem;
  pointer-events: none;
  transition: opacity 0.2s;
}
.firma-canvas-wrap.has-signature .firma-canvas-placeholder { opacity: 0; }

/* ── Portal — diseño diferente ───────────────────────────────────── */
.portal-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f2347 0%, #1a3a6b 50%, #2a5298 100%);
  display: flex;
  flex-direction: column;
}
.portal-header {
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(8px);
}
.portal-brand {
  display: flex; align-items: center; gap: 0.75rem;
  font-family: 'Outfit', sans-serif;
}
.portal-brand .portal-icon {
  width: 38px; height: 38px;
  background: var(--gold);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.portal-brand .portal-title { font-size: 1rem; font-weight: 700; color: #fff; }
.portal-brand .portal-sub   { font-size: 0.72rem; color: rgba(255,255,255,0.55); }

.portal-main {
  flex: 1;
  padding: 2rem;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.portal-welcome {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  color: #fff;
}
.portal-welcome .pw-icon {
  width: 56px; height: 56px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: var(--navy-dark);
  flex-shrink: 0;
}
.portal-welcome h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.2rem; }
.portal-welcome p  { font-size: 0.85rem; opacity: 0.75; }

.portal-card {
  background: rgba(255,255,255,0.95);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.portal-card .card-header { background: #fff; }
.portal-card .card-header h2 { color: var(--navy); }

/* ── Login pages ─────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f2347 0%, #1a3a6b 100%);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}
.login-wrapper::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(232,160,32,0.12) 0%, transparent 70%);
  top: -200px; right: -200px;
  pointer-events: none;
}
.login-wrapper::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(42,82,152,0.3) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  pointer-events: none;
}

.login-card {
  background: rgba(255,255,255,0.97);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.4s ease;
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo .logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 1rem;
  box-shadow: 0 8px 24px rgba(26,58,107,0.35);
}
.login-logo h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.25rem;
}
.login-logo p { font-size: 0.82rem; color: var(--text-sec); }

/* ── Documento viewer ────────────────────────────────────────────── */
.doc-viewer {
  background: var(--bg-body);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.doc-viewer iframe { width: 100%; height: 500px; border: none; }
.doc-viewer img { max-width: 100%; max-height: 500px; object-fit: contain; }

/* ── Doc cards (portal) ──────────────────────────────────────────── */
.doc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all var(--transition);
  background: #fff;
  cursor: pointer;
}
.doc-card:hover { border-color: var(--navy-light); box-shadow: var(--shadow); }
.doc-card.pendiente { border-left: 4px solid var(--warning); }
.doc-card.firmado   { border-left: 4px solid var(--success); }
.doc-card .doc-icon {
  width: 44px; height: 44px;
  background: rgba(26,58,107,0.08);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.doc-card .doc-info { flex: 1; min-width: 0; }
.doc-card .doc-title { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); margin-bottom: 0.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-card .doc-meta  { font-size: 0.75rem; color: var(--text-sec); }

/* ── Progress ────────────────────────────────────────────────────── */
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy), var(--gold));
  border-radius: 99px;
  transition: width 0.5s ease;
}

/* ── Spinner ─────────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-navy {
  border-color: rgba(26,58,107,0.2);
  border-top-color: var(--navy);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Animations ──────────────────────────────────────────────────── */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp  { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

/* ── Info list ───────────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.info-item {}
.info-item .info-label { font-size: 0.72rem; font-weight: 600; color: var(--text-sec); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.2rem; }
.info-item .info-value { font-size: 0.9rem; color: var(--text-primary); font-weight: 500; }
.info-item .info-value.empty { color: var(--text-light); font-style: italic; font-weight: 400; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-260px); width: 260px; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { padding: 0 1rem; }
  .page-body { padding: 1rem; }
  .form-row.col-2, .form-row.col-3, .form-row.col-4 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .modal { max-width: 100%; border-radius: var(--radius-sm); }
  .legajo-header { flex-direction: column; text-align: center; }
  .legajo-actions { margin: 0; }
  .portal-main { padding: 1rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 1.75rem; }
}

/* ── Utilidades ──────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-sec); }
.text-small  { font-size: 0.8rem; }
.text-navy   { color: var(--navy); }
.text-gold   { color: var(--gold-dark); }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.fw-bold     { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.p-2 { padding: 0.5rem; } .p-3 { padding: 1rem; }
.d-flex { display: flex; } .align-center { align-items: center; } .gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }
.flex-1 { flex: 1; }
.w-100 { width: 100%; }
.rounded { border-radius: var(--radius-sm); }
.shadow { box-shadow: var(--shadow); }
.hidden { display: none !important; }
.separator { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
