/* ── Inter self-hosted (sin CDN externo en el navegador) ─────── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/Inter-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/Inter-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/Inter-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/Inter-700.woff2') format('woff2');
}

/* ── Masigas Design Tokens — "Deep Flame" (Fase 1) ───────────── */
:root {
  --bg:        #0A0D19;
  --bg-2:      #0D1024;
  --bg-3:      #161B35;
  --accent:    #00D4FF;
  --accent-dk: #00A6CC;
  --accent-2:  #FF7F2B;
  --accent-2dk:#C94B08;
  --secondary: #5B3FC4;
  --secondary-dk: #37257C;
  --text:      #F4F6FB;
  --text-2:    rgba(244,246,251,.68);
  --text-3:    rgba(244,246,251,.46);
  --border:    rgba(255,255,255,.09);
  --border-hi: rgba(255,255,255,.16);
  --success:   #16A160;
  --error:     #E01C3B;
  --warning:   #D8930A;
  --glass:     rgba(255,255,255,.045);
  --glow:      rgba(0,212,255,.35);
  --r-sm:      6px;
  --r-md:      8px;
  --r-lg:      10px;
  --r-xl:      14px;
  --r-pill:    999px;
  --shadow:    0 10px 30px rgba(5,7,13,.38), inset 0 1px 0 rgba(255,255,255,.04);
  --ease:      cubic-bezier(.16,1,.3,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
}

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

body {
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Motion: fondo con auroras vivas (capa 0) ─────────────────── */
.aurora-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  will-change: transform, translate;
}
.blob-1 {
  width: 900px; height: 900px; left: -12%; top: -18%;
  background: radial-gradient(circle, rgba(0,212,255,.15), transparent 68%);
}
.blob-2 {
  width: 700px; height: 700px; right: -10%; top: 28%;
  background: radial-gradient(circle, rgba(91,63,196,.13), transparent 65%);
}
.blob-3 {
  width: 600px; height: 600px; left: 28%; bottom: -22%;
  background: radial-gradient(circle, rgba(255,127,43,.08), transparent 62%);
}
/* Nota: se quito la animacion continua (scale/translate) de las auroras —
   junto al backdrop-filter del sidebar/topbar generaba recalculo de blur
   en cada frame. Quedan fijas: mismo efecto ambiental, costo unico. */
@keyframes auroraDrift1{
  0%,100%{ transform:scale(1) }
  33%{ transform:translate(60px,40px) scale(1.08) }
  66%{ transform:translate(-30px,70px) scale(.96) }
}
@keyframes auroraDrift2{
  0%,100%{ transform:scale(1) }
  50%{ transform:translate(-70px,-50px) scale(1.1) }
}
@keyframes auroraDrift3{
  0%,100%{ transform:scale(1); opacity:.85 }
  50%{ transform:translate(40px,-30px) scale(1.12); opacity:1 }
}
@media (prefers-reduced-motion: reduce){
  .aurora-blob{ animation: none !important; }
}

/* ── Sidebar ────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 108px;
  background: linear-gradient(180deg, rgba(9,11,15,.98), rgba(7,9,13,.99));
  border-right: 1px solid var(--border);
  box-shadow: 12px 0 40px rgba(5,7,13,.28);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width .35s var(--ease);
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 22px 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}

.sidebar-logo .brand {
  position: relative;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem;
  font-weight: 800;
  background: var(--accent);
  color: #001824;
  letter-spacing: 0;
  clip-path: polygon(6px 0,100% 0,100% calc(100% - 6px),calc(100% - 6px) 100%,0 100%,0 6px);
  animation: logoFloat 5s ease-in-out infinite;
}
@keyframes logoFloat{ 0%,100%{ transform:translateY(0) } 50%{ transform:translateY(-3px) } }
.sidebar-logo .brand::after{
  content:''; position:absolute; inset:-7px;
  border:1px solid rgba(0,212,255,.4);
  clip-path: polygon(9px 0,100% 0,100% calc(100% - 9px),calc(100% - 9px) 100%,0 100%,0 9px);
  animation: ringPulseSb 2.6s ease-out infinite;
}
@keyframes ringPulseSb{ 0%{ transform:scale(1); opacity:.65 } 100%{ transform:scale(1.3); opacity:0 } }

.sidebar-logo .sub { display: none; }

.sidebar-nav {
  flex: 1;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

.nav-label { display: none; }

.nav-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 9px 2px;
  color: var(--text-3);
  text-decoration: none;
  font-size: .56rem;
  font-family: var(--mono, monospace);
  letter-spacing: .01em;
  text-transform: uppercase;
  text-align: center;
  position: relative;
  transition: color .2s var(--ease);
  cursor: pointer;
  white-space: nowrap;
}

.nav-item::before{
  content:''; position:absolute; inset:1px 8px; background:transparent; transition:background .2s var(--ease);
}
.nav-item:hover::before{ background: rgba(255,255,255,.05); }
.nav-item:hover { color: var(--text-2); transform: none; }
.nav-item.active { background: none; color: var(--accent); }
.nav-item.active .icon svg{ filter: drop-shadow(0 0 6px rgba(0,212,255,.6)); }

.nav-item .icon { width: 19px; height: 19px; flex-shrink: 0; position: relative; }
.icon-spin svg { animation: spinSlow 9s linear infinite; transform-origin: center; }
@keyframes spinSlow { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce){ .icon-spin svg{ animation:none !important; } }
.nav-item .icon svg{ width: 100%; height: 100%; transition: filter .25s var(--ease); }

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
  font-size: .6rem;
  color: var(--text-3);
  text-align: center;
}
.sidebar-footer a { display: block; margin-bottom: 6px; }

/* ── Main content ───────────────────────────────────────────── */
.main {
  margin-left: 108px;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.topbar {
  padding: 26px 36px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.015em; }
.topbar .date { font-size: .72rem; color: var(--text-3); font-family: var(--mono, monospace); letter-spacing: .04em; text-transform: uppercase; }

.content { padding: 32px; flex: 1; }

/* ── Cards de proyectos ─────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.project-card {
  position: relative;
  background:
    linear-gradient(105deg, transparent 40%, rgba(255,255,255,.035) 50%, transparent 60%),
    var(--bg-2);
  border: 1px solid var(--border-hi);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 14px 34px rgba(0,0,0,.35);
  transform: translateY(var(--lift,0px));
  transition: border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  animation: cardRise .45s var(--ease) backwards;
}
.project-card:nth-of-type(1){ animation-delay: .04s }
.project-card:nth-of-type(2){ animation-delay: .1s }
.project-card:nth-of-type(3){ animation-delay: .16s }
.project-card:nth-of-type(4){ animation-delay: .22s }
@keyframes cardRise{ from{ opacity:0; transform:translateY(16px) } to{ opacity:1; transform:translateY(0) } }

.project-card::before{
  content: attr(data-mod-status);
  position: absolute; top: 12px; right: 14px;
  font-family: var(--mono, monospace); font-size: .56rem; letter-spacing: .04em;
  color: var(--text-3);
}
.project-card::after{
  content:''; position:absolute; top:0; left:-40%; width:30%; height:100%;
  background: linear-gradient(90deg, transparent, rgba(0,212,255,.09), transparent);
  transform: skewX(-18deg); pointer-events: none; opacity: 0;
}
.project-card:hover::after{ opacity: 1; animation: scanSweepCard 1.1s ease-out; }
@keyframes scanSweepCard{ from{ transform: translateX(0) skewX(-18deg); } to{ transform: translateX(420%) skewX(-18deg); } }

.project-card:hover {
  --lift: -5px;
  border-color: rgba(0,212,255,.45);
  box-shadow: 0 26px 54px rgba(0,0,0,.45), 0 0 40px rgba(0,212,255,.18);
}

.card-icon {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  background: none;
  transition: color .25s var(--ease), filter .25s var(--ease);
}
.card-icon svg{ width: 100%; height: 100%; }
.project-card:hover .card-icon{ color: var(--accent); filter: drop-shadow(0 0 8px rgba(0,212,255,.4)); }

.card-title { font-size: .95rem; font-weight: 650; }
.card-desc  { font-size: .78rem; color: var(--text-3); line-height: 1.5; }

.card-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .75rem;
  color: var(--text-3);
  font-family: var(--mono, monospace);
}

.card-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--accent);
  color: #001824;
  font-size: .76rem;
  font-weight: 650;
  font-family: var(--mono, monospace);
  border: none;
  cursor: pointer;
  transition: filter .15s var(--ease);
  text-decoration: none;
  margin-top: 4px;
  width: fit-content;
  clip-path: polygon(6px 0,100% 0,100% calc(100% - 6px),calc(100% - 6px) 100%,0 100%,0 6px);
}

.card-btn:hover { filter: brightness(1.12); }

/* ── Historial reciente ─────────────────────────────────────── */
.section-title {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.history-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 24px;
  margin-top: 32px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.history-item:last-child { border-bottom: none; }
.history-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.history-info { flex: 1; }
.history-time { color: var(--text-3); font-size: .75rem; }

/* ── Página de proyecto (2 paneles) ─────────────────────────── */
.project-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .project-layout { grid-template-columns: 1fr; }
}

.panel {
  position: relative;
  background:
    linear-gradient(105deg, transparent 40%, rgba(255,255,255,.028) 50%, transparent 60%),
    var(--bg-2);
  border: 1px solid var(--border-hi);
  padding: 22px;
  box-shadow: 0 12px 28px rgba(0,0,0,.32);
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
  animation: panelRise .4s var(--ease) backwards;
}
@keyframes panelRise{ from{ opacity:0; transform:translateY(10px) } to{ opacity:1; transform:translateY(0) } }

.panel-title {
  font-size: .82rem;
  font-weight: 650;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-family: var(--mono, monospace);
}
.panel-title::before{ content:'// '; color: var(--text-3); font-weight: 400; }

/* ── Formulario ─────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: .68rem 1rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: .86rem;
  font-family: var(--mono, monospace);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  outline: none;
}

.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,212,255,.16); }
.form-control::placeholder { color: var(--text-3); }

select.form-control {
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
select.form-control option {
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--sans, sans-serif);
}

/* ── Botones ────────────────────────────────────────────────── */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: .68rem 1.5rem;
  border-radius: var(--r-sm);
  font-size: .82rem;
  font-weight: 650;
  font-family: var(--mono, monospace);
  letter-spacing: .01em;
  border: none;
  cursor: pointer;
  clip-path: polygon(7px 0,100% 0,100% calc(100% - 7px),calc(100% - 7px) 100%,0 100%,0 7px);
  transform: translate(var(--mag-x,0px), var(--mag-y,0px));
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), background .2s var(--ease), opacity .15s var(--ease), border-color .2s var(--ease), filter .15s var(--ease);
}
.btn::after{
  content:''; position:absolute; top:0; left:-60%; width:35%; height:100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,.3), transparent);
  transform: skewX(-20deg); transition: left .55s var(--ease); pointer-events: none;
}
.btn:hover::after{ left: 130%; }
.ripple-fx{
  position: absolute; border-radius: 50%; background: rgba(255,255,255,.45);
  width: 10px; height: 10px; margin-left: -5px; margin-top: -5px;
  transform: scale(0); animation: rippleGrow .55s ease-out forwards; pointer-events: none;
}
@keyframes rippleGrow{ to{ transform: scale(20); opacity: 0; } }

.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translate(var(--mag-x,0px), var(--mag-y,0px)) scale(.94); }

.btn-primary {
  background: var(--accent);
  color: #001824;
  box-shadow: 0 0 0 1px rgba(0,212,255,.5), 0 6px 18px rgba(0,212,255,.24);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 0 0 1px rgba(0,212,255,.7), 0 10px 30px rgba(0,212,255,.38);
}

.btn-secondary {
  background: var(--accent-2);
  color: #1A0E00;
  box-shadow: 0 0 0 1px rgba(255,127,43,.5), 0 6px 18px rgba(255,127,43,.22);
}
.btn-secondary:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 0 0 1px rgba(255,127,43,.7), 0 10px 30px rgba(255,127,43,.34);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-hi);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(0,212,255,.07);
  color: var(--text);
  border-color: rgba(0,212,255,.4);
}

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ── Lista de PDFs generados ────────────────────────────────── */
.pdf-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.pdf-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: .85rem;
  gap: 8px;
  animation: itemRise .35s var(--ease) backwards;
}
@keyframes itemRise{ from{ opacity:0; transform:translateX(-8px) } to{ opacity:1; transform:translateX(0) } }

.pdf-item .pdf-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-item .pdf-size { color: var(--text-3); font-size: .75rem; flex-shrink: 0; }

/* ── Toast / notificaciones ─────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
}

.toast {
  padding: 12px 18px 12px 16px;
  border-radius: var(--r-sm);
  border-left: 3px solid currentColor;
  font-size: .82rem;
  font-weight: 550;
  font-family: var(--mono, monospace);
  background: var(--bg-2);
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
  backdrop-filter: blur(16px);
  animation: slideIn .3s var(--ease);
  max-width: 340px;
}

.toast.success { color: #5EE0A0; }
.toast.error   { color: #FF8B98; }
.toast.info    { color: var(--accent); }

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

/* ── Progress bar ───────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 5px;
  background: var(--bg-3);
  overflow: hidden;
  margin-top: 12px;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  background-image: repeating-linear-gradient(90deg, rgba(0,24,36,.4) 0, rgba(0,24,36,.4) 2px, transparent 2px, transparent 8px);
  box-shadow: 0 0 10px rgba(0,212,255,.5);
  transition: width .3s var(--ease);
}

/* ── Badge de estado ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: .66rem;
  font-weight: 650;
  font-family: var(--mono, monospace);
  letter-spacing: .01em;
  border: 1px solid transparent;
}
.badge-success { background: rgba(22,161,96,.14);  color: #5EE0A0; border-color: rgba(22,161,96,.35); }
.badge-error   { background: rgba(224,28,59,.14);   color: #FF8B98; border-color: rgba(224,28,59,.35); }
.badge-pending { background: rgba(0,212,255,.1);    color: var(--accent); border-color: rgba(0,212,255,.35); }
.badge-warning { background: rgba(216,147,10,.14);  color: #F5C356; border-color: rgba(216,147,10,.35); animation: badgePulse 2.4s ease-in-out infinite; }
@keyframes badgePulse{ 0%,100%{ box-shadow:0 0 0 0 rgba(216,147,10,.3) } 50%{ box-shadow:0 0 0 4px rgba(216,147,10,0) } }

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(0,212,255,.15);
  border-top-color: var(--accent);
  border-right-color: rgba(0,212,255,.5);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  filter: drop-shadow(0 0 4px rgba(0,212,255,.4));
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tabla de suministros ───────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--r-md); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
}

th {
  background: transparent;
  color: var(--text-3);
  font-size: .64rem;
  font-weight: 700;
  font-family: var(--mono, monospace);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-hi);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  transition: background .15s var(--ease);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0,212,255,.055); }
tbody tr { animation: rowRise .35s var(--ease) backwards; }
@keyframes rowRise{ from{ opacity:0; transform:translateY(8px) } to{ opacity:1; transform:translateY(0) } }
@media (prefers-reduced-motion: reduce){ tbody tr, .pdf-item, .panel, .project-card { animation: none !important; } }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
  font-size: .9rem;
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }

/* ── Slots de fotos DDJJ ────────────────────────────────────── */
.foto-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.foto-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.slot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.overlay-ctrl {
  font-size: .68rem;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  padding: 1px 0;
}

.overlay-ctrl input[type=checkbox] {
  cursor: pointer;
  accent-color: var(--accent);
  width: 13px;
  height: 13px;
}

.overlay-ctrl.ref-ocr   { color: var(--accent); font-weight: 600; cursor: default; }
.overlay-ctrl.disabled  { opacity: .35; cursor: default; }

.foto-slot {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-3);
  border: 2px dashed var(--border);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s, background .15s;
  min-height: 80px;
  user-select: none;
}

.foto-slot:hover       { border-color: var(--accent); }
.foto-slot.drag-over   { border-color: var(--accent); background: rgba(0,212,255,.08); }
.foto-slot.tiene-foto  { border-style: solid; border-color: rgba(34,197,94,.5); }

.foto-slot-num {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: .6rem;
  font-weight: 700;
  color: var(--text-3);
  z-index: 1;
}

.foto-slot-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
}

.foto-slot-empty-icon  { font-size: 1.3rem; color: var(--text-3); }
.foto-slot-label       { font-size: .65rem; color: var(--text-3); text-align: center; }

.foto-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.foto-del-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(239,68,68,.9);
  color: #fff;
  border: none;
  font-size: .65rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3;
  line-height: 1;
}

.foto-slot:hover .foto-del-btn { display: flex; }

.foto-slot-label-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,.65);
  font-size: .6rem;
  color: #fff;
  text-align: center;
  padding: 2px 4px;
  z-index: 2;
}

.foto-slot-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* ── Archivos Excel Base (Dashboard) ───────────────────────── */
.excel-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.excel-row:last-child { border-bottom: none; }

.excel-row-icon {
  font-size: 1.2rem;
  width: 30px;
  text-align: center;
  flex-shrink: 0;
}

.excel-row-info {
  flex: 1;
  min-width: 0;
}

.excel-row-proyecto {
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 3px;
}

.excel-row-archivo {
  font-size: .75rem;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.excel-row-archivo.loaded  { color: var(--success); }
.excel-row-archivo.missing { color: var(--error); }

.excel-upload-btn {
  flex-shrink: 0;
  cursor: pointer;
  font-size: .8rem;
  padding: .45rem .9rem;
}

/* ── Back link ──────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  text-decoration: none;
  font-size: .85rem;
  margin-bottom: 24px;
  transition: color .15s;
}
.back-link:hover { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   MEJORAS VISUALES v2.0
   ═══════════════════════════════════════════════════════════ */

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

@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px)  { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border-hi);
  border-top: none;
  padding: 18px 22px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s var(--ease), transform .15s var(--ease);
}

.stat-card:hover {
  border-color: rgba(0,212,255,.35);
  transform: translateY(-2px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(0,212,255,.6);
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  font-family: var(--mono, monospace);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(0,212,255,.35);
  min-height: 1.9rem;
}

.stat-label {
  font-size: .66rem;
  color: var(--text-3);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-family: var(--mono, monospace);
}

.stat-icon {
  position: absolute;
  right: 16px; top: 14px;
  width: 20px; height: 20px;
  opacity: .3;
  color: var(--text-2);
}
.stat-icon svg{ width:100%; height:100% }

/* ── Glassmorphism ──────────────────────────────────────────── */
.glass {
  background: rgba(10, 20, 40, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 200, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
}

/* Aplicar glassmorphism a paneles que lo tengan */
.panel.glass, .history-panel.glass {
  background: rgba(10, 20, 40, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: rgba(0, 200, 255, 0.1);
}

/* ── Skeleton loaders ───────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-3) 25%,
    rgba(255,255,255,.055) 50%,
    var(--bg-3) 75%
  );
  background-size: 1200px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--r-sm);
  display: block;
}

.sk-line  { height: 13px; margin-bottom: 8px; }
.sk-line.w-80 { width: 80%; }
.sk-line.w-60 { width: 60%; }
.sk-line.w-40 { width: 40%; }
.sk-block { height: 40px; width: 100%; }
.sk-avatar { width: 36px; height: 36px; border-radius: 50%; }
.sk-card  { height: 80px; width: 100%; border-radius: var(--r-md); }

/* Fila de skeleton en tabla */
.sk-row td { padding: 12px 14px; }

/* ── Modulo: designacion tecnica + barra segmentada (v4) ─────── */
.mod-code {
  font-family: var(--mono, monospace); font-size: .6rem; color: var(--accent);
  letter-spacing: .03em; opacity: .85; margin-bottom: 2px;
}
.seg-bar { display: flex; gap: 3px; margin-top: 10px; }
.seg { flex: 1; height: 3px; background: var(--border-hi); }
.seg.on { background: var(--accent); box-shadow: 0 0 6px rgba(0,212,255,.55); }

/* ── Sidebar — usuario con avatar ───────────────────────────── */
.sidebar-user {
  padding: 14px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  color: #04141C;
  flex-shrink: 0;
  letter-spacing: .5px;
  box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 3.5px rgba(0,212,255,.35), 0 4px 12px rgba(0,212,255,.22);
}

.user-info { min-width: 0; max-width: 100%; }

.user-name {
  font-size: .68rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  max-width: 92px;
}

.user-role { font-size: .58rem; color: var(--text-3); margin-top: 2px; }

.pdf-count-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #060B18;
  font-size: .62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  min-width: 20px;
  text-align: center;
  opacity: 0;
  transition: opacity .3s;
  flex-shrink: 0;
}
.pdf-count-badge.visible { opacity: 1; }

/* Indicador activo animado — barra izquierda */
.nav-item { position: relative; }

.nav-item.active {
  background: rgba(0,212,255,.12);
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 65%;
  background: linear-gradient(180deg, var(--accent), var(--secondary));
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 10px var(--glow);
  animation: barIn .25s var(--ease) forwards;
}

@keyframes barIn {
  from { height: 0; opacity: 0; }
  to   { height: 65%; opacity: 1; }
}


/* ── Sidebar colapsable (Fase 2) ─────────────────────────────── */
.sidebar-collapse-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text-3); font-size: .74rem; padding: 7px; cursor: pointer;
  transition: all .2s var(--ease); margin-bottom: 10px; font-family: inherit;
}
.sidebar-collapse-btn:hover { color: var(--accent); border-color: rgba(0,212,255,.3); background: rgba(0,212,255,.07); }
.sidebar-collapse-btn .collapse-arrow { transition: transform .35s var(--ease); font-size: .9rem; line-height: 1; }
.layout.sidebar-collapsed .sidebar-collapse-btn .collapse-arrow { transform: rotate(180deg); }

.main { transition: margin-left .35s var(--ease); }

.layout.sidebar-collapsed .sidebar { width: 64px; }
.layout.sidebar-collapsed .main { margin-left: 64px; }
.layout.sidebar-collapsed .sidebar-logo { text-align: center; padding: 20px 8px; }
.layout.sidebar-collapsed .sidebar-logo .brand { font-size: .82rem; }
.layout.sidebar-collapsed .sidebar-logo .sub,
.layout.sidebar-collapsed .nav-label,
.layout.sidebar-collapsed .nav-item span:not(.icon),
.layout.sidebar-collapsed .user-info,
.layout.sidebar-collapsed .pdf-count-badge,
.layout.sidebar-collapsed .sidebar-footer a,
.layout.sidebar-collapsed .sidebar-footer > div:last-child,
.layout.sidebar-collapsed .sidebar-collapse-btn .label { display: none; }
.layout.sidebar-collapsed .nav-item { justify-content: center; }
.layout.sidebar-collapsed .sidebar-user { padding: 14px 4px; }


/* ── Scrollbar premium (Fase 3) ──────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,212,255,.35); background-clip: padding-box; }

/* ── Tooltip reutilizable (v4) — usar atributo data-tooltip ──── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px);
  background: var(--bg-2); border: 1px solid var(--border-hi);
  color: var(--text-2); font-size: .68rem; font-family: var(--mono, monospace);
  padding: 5px 9px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .15s var(--ease), transform .15s var(--ease);
  box-shadow: 0 8px 20px rgba(0,0,0,.4); z-index: 800;
}
[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Modal PDF inline ───────────────────────────────────────── */
.pdf-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,7,13,.86);
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn .25s var(--ease);
}

.pdf-modal-overlay.open { display: flex; }

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

.pdf-modal {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  width: 100%; max-width: 920px;
  height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 90px rgba(5,7,13,.6), 0 0 40px rgba(0,212,255,.1);
  overflow: hidden;
  animation: slideUp .3s var(--ease-spring);
}
.pdf-modal::before, .pdf-modal::after{
  content:''; position:absolute; width:16px; height:16px; z-index:2; pointer-events:none;
  animation: bracketGlowModal 3s ease-in-out infinite;
}
.pdf-modal::before{ top:-1px; left:-1px; border-top:2px solid var(--accent); border-left:2px solid var(--accent); }
.pdf-modal::after{ bottom:-1px; right:-1px; border-bottom:2px solid var(--accent); border-right:2px solid var(--accent); }
@keyframes bracketGlowModal{ 0%,100%{ opacity:.5 } 50%{ opacity:1 } }

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

.pdf-modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}

.pdf-modal-title {
  font-size: .82rem;
  font-weight: 650;
  font-family: var(--mono, monospace);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.pdf-modal-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.pdf-modal-close {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-2);
  padding: 5px 14px;
  cursor: pointer;
  font-size: .8rem;
  font-family: inherit;
  transition: color .15s, background .15s;
}
.pdf-modal-close:hover { background: rgba(239,68,68,.15); color: var(--error); border-color: var(--error); }

.pdf-modal-body { flex: 1; overflow: hidden; background: #1a1a2e; }
.pdf-modal-body iframe { width: 100%; height: 100%; border: none; }
