/* ============================================================
   NEXUS SCALING — Estilos compartidos del portal
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black:       #000000;
  --navy:        #050d1f;
  --dark-blue:   #0a1628;
  --blue:        #1e40af;
  --bright-blue: #3b82f6;
  --sky:         #38bdf8;
  --light-sky:   #7dd3fc;
  --white:       #f0f6ff;
  --muted:       #94a3b8;
  --border:      rgba(56,189,248,0.15);
  --green:       #34d399;
  --amber:       #fbbf24;
  --red:         #f87171;
  --heading: 'Space Grotesk', sans-serif;
  --body:    'Inter', sans-serif;
}

html { scroll-behavior: smooth; }
body {
  background: var(--black);
  color: var(--white);
  font-family: var(--body);
  font-weight: 400;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: var(--sky); }

/* ---------- NAV ---------- */
.nav {
  position: fixed; top: 0; left: 0; width: 100%; z-index: 100;
  padding: 1.1rem 5%;
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  font-family: var(--heading);
  font-size: 1.15rem; font-weight: 700;
  color: var(--white); text-decoration: none;
}
.nav-logo span { color: var(--sky); }
.nav-actions { display: flex; gap: 0.8rem; align-items: center; }
.nav-user { font-size: 0.8rem; color: var(--muted); }
.nav-user b { color: var(--white); font-weight: 600; }

/* ---------- BOTONES ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.8rem 1.9rem;
  font-size: 0.88rem; font-weight: 600;
  border-radius: 8px; border: none;
  text-decoration: none; transition: all 0.2s;
}
.btn-primary { background: var(--bright-blue); color: #fff; }
.btn-primary:hover { background: var(--sky); color: var(--black); transform: translateY(-2px); }
.btn-secondary { background: transparent; color: var(--white); border: 1px solid rgba(255,255,255,0.22); }
.btn-secondary:hover { border-color: var(--sky); color: var(--sky); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid transparent; padding: 0.55rem 1rem; }
.btn-ghost:hover { color: var(--sky); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(248,113,113,0.35); }
.btn-danger:hover { background: rgba(248,113,113,0.12); }
.btn-sm { padding: 0.45rem 1rem; font-size: 0.78rem; border-radius: 6px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ---------- VISTAS / AUTH ---------- */
.view { display: block; }
.hidden { display: none !important; }

.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 7rem 5% 4rem;
  position: relative;
}
.auth-wrap::before {
  content: '';
  position: fixed; top: -25%; right: -15%;
  width: 720px; height: 720px;
  background: radial-gradient(circle, rgba(59,130,246,0.16) 0%, transparent 65%);
  pointer-events: none;
}
.auth-card {
  width: 100%; max-width: 460px;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.8rem 2.5rem;
  position: relative;
  animation: fadeUp 0.45s ease both;
}
.auth-card.wide { max-width: 560px; }
.auth-eyebrow {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.3);
  border-radius: 999px;
  font-size: 0.7rem; font-weight: 600;
  color: var(--sky); letter-spacing: 0.1em;
  text-transform: uppercase; margin-bottom: 1.4rem;
}
.auth-title {
  font-family: var(--heading);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 800; line-height: 1.1;
  margin-bottom: 0.8rem;
}
.auth-title .accent { color: var(--sky); }
.auth-sub { font-size: 0.9rem; color: var(--muted); margin-bottom: 2rem; }
.auth-actions { display: flex; flex-direction: column; gap: 0.8rem; }
.auth-foot { margin-top: 1.6rem; font-size: 0.8rem; color: var(--muted); text-align: center; }
.auth-foot a { cursor: pointer; }

/* ---------- FORMULARIOS ---------- */
.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.4rem;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--dark-blue);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--white);
  font-size: 0.9rem;
  transition: border-color 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--sky);
}
.field select option { background: var(--dark-blue); }
.field textarea { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-error {
  display: none;
  padding: 0.7rem 1rem; margin-bottom: 1rem;
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: 8px;
  font-size: 0.82rem; color: var(--red);
}
.form-error.show { display: block; }
.form-info {
  padding: 0.8rem 1rem; margin-bottom: 1.2rem;
  background: rgba(56,189,248,0.08);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem; color: var(--light-sky);
}

/* ---------- DASHBOARD ---------- */
.dash {
  min-height: 100vh;
  padding: 6.2rem 5% 3rem;
  max-width: 1280px; margin: 0 auto;
}
.dash-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 1rem;
  margin-bottom: 2rem;
}
.dash-title {
  font-family: var(--heading);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800; line-height: 1.15;
}
.dash-title .accent { color: var(--sky); }
.dash-sub { font-size: 0.85rem; color: var(--muted); margin-top: 0.2rem; }

.dash-tabs {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.dash-tabs button {
  padding: 0.75rem 1.4rem;
  background: transparent; border: none;
  font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}
.dash-tabs button:hover { color: var(--white); }
.dash-tabs button.active { color: var(--sky); border-bottom-color: var(--sky); }

.seg {
  display: inline-flex;
  background: var(--dark-blue);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 4px; gap: 4px;
}
.seg button {
  padding: 0.6rem 1.8rem;
  background: transparent; border: none; border-radius: 7px;
  font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--muted); transition: all 0.2s;
}
.seg button.active { background: var(--bright-blue); color: #fff; }

/* ---------- CARDS / KPI ---------- */
.card {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.8rem;
  margin-bottom: 1.4rem;
}
.card-title {
  font-family: var(--heading);
  font-size: 1.02rem; font-weight: 600;
  margin-bottom: 1.2rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.1rem; margin-bottom: 1.4rem;
}
.kpi {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.4rem 1.5rem;
  transition: border-color 0.25s;
}
.kpi:hover { border-color: var(--bright-blue); }
.kpi-label {
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.5rem;
}
.kpi-value {
  font-family: var(--heading);
  font-size: 1.9rem; font-weight: 700;
  color: var(--sky); line-height: 1.1;
}
.kpi-hint { font-size: 0.72rem; color: var(--muted); margin-top: 0.35rem; }

/* ---------- TABLAS ---------- */
.table-wrap { overflow-x: auto; }
table.nx {
  width: 100%; border-collapse: collapse;
  font-size: 0.84rem;
}
table.nx th {
  text-align: left;
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted);
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.nx td {
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: var(--white); vertical-align: middle;
}
table.nx tr:hover td { background: rgba(56,189,248,0.04); }
table.nx td.dim { color: var(--muted); }
table.nx select {
  padding: 0.4rem 0.6rem;
  background: var(--dark-blue);
  border: 1px solid var(--border);
  border-radius: 6px; color: var(--white); font-size: 0.78rem;
}

/* ---------- BADGES ---------- */
.badge {
  display: inline-block;
  padding: 0.22rem 0.75rem;
  border-radius: 999px;
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  white-space: nowrap;
}
.badge-ok     { background: rgba(52,211,153,0.12); color: var(--green); border: 1px solid rgba(52,211,153,0.3); }
.badge-pend   { background: rgba(251,191,36,0.12); color: var(--amber); border: 1px solid rgba(251,191,36,0.3); }
.badge-info   { background: rgba(56,189,248,0.12); color: var(--sky);   border: 1px solid rgba(56,189,248,0.3); }
.badge-muted  { background: rgba(148,163,184,0.1); color: var(--muted); border: 1px solid rgba(148,163,184,0.25); }

/* ---------- ESTADO VACÍO ---------- */
.empty {
  text-align: center;
  padding: 2.6rem 1.5rem;
  color: var(--muted); font-size: 0.86rem;
}
.empty .empty-icon { font-size: 1.8rem; display: block; margin-bottom: 0.6rem; opacity: 0.7; }

/* ---------- PROCESO / TIMELINE ---------- */
.fase-row {
  display: flex; gap: 1.3rem;
  padding: 1.3rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.fase-row:last-child { border-bottom: none; }
.fase-dot {
  flex-shrink: 0;
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--heading); font-weight: 700; font-size: 0.95rem;
  border: 2px solid var(--border); color: var(--muted);
  background: var(--dark-blue);
}
.fase-row.done .fase-dot   { border-color: var(--green); color: var(--green); }
.fase-row.active .fase-dot { border-color: var(--sky); color: var(--sky); box-shadow: 0 0 18px rgba(56,189,248,0.35); }
.fase-info h4 { font-family: var(--heading); font-size: 0.98rem; font-weight: 600; }
.fase-info .fase-eta { font-size: 0.7rem; color: var(--sky); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.fase-info p { font-size: 0.82rem; color: var(--muted); margin-top: 0.25rem; }

/* ---------- PROGRESO ---------- */
.progress-track {
  width: 100%; height: 12px;
  background: var(--dark-blue);
  border: 1px solid var(--border);
  border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--sky));
  border-radius: 999px;
  transition: width 0.6s ease;
}
.check-row {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.65rem 0.4rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.88rem;
}
.check-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--bright-blue); cursor: pointer; }
.check-row.done span { text-decoration: line-through; color: var(--muted); }
.check-row .del { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 0.9rem; }
.check-row .del:hover { color: var(--red); }

/* ---------- GRÁFICO DE BARRAS ---------- */
.bars {
  display: flex; align-items: flex-end; gap: 0.9rem;
  height: 170px; padding-top: 0.5rem;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; height: 100%; justify-content: flex-end; }
.bar-val { font-size: 0.68rem; color: var(--light-sky); font-weight: 600; }
.bar-fill {
  width: 100%; max-width: 54px;
  background: linear-gradient(180deg, var(--sky), var(--blue));
  border-radius: 6px 6px 0 0;
  min-height: 3px;
  transition: height 0.5s ease;
}
.bar-label { font-size: 0.68rem; color: var(--muted); text-transform: capitalize; }

/* ---------- MODAL ---------- */
dialog.nx-modal {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  width: min(480px, 92vw);
  color: var(--white);
}
dialog.nx-modal::backdrop { background: rgba(0,0,0,0.72); backdrop-filter: blur(4px); }
dialog.nx-modal h3 { font-family: var(--heading); font-size: 1.15rem; margin-bottom: 1.4rem; }
.modal-actions { display: flex; gap: 0.7rem; justify-content: flex-end; margin-top: 1.4rem; }

/* ---------- TOAST ---------- */
.nx-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9999;
  padding: 0.85rem 1.6rem;
  background: var(--dark-blue);
  border: 1px solid var(--sky);
  border-radius: 10px;
  font-size: 0.86rem; color: var(--white);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: fadeUp 0.3s ease both;
}
.nx-toast.err { border-color: var(--red); }

/* ---------- UTILIDADES ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; align-items: start; }
.mt-1 { margin-top: 0.6rem; } .mt-2 { margin-top: 1.2rem; } .mb-0 { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.code-pill {
  font-family: var(--heading);
  background: var(--dark-blue);
  border: 1px dashed var(--sky);
  border-radius: 8px;
  padding: 0.5rem 1.1rem;
  color: var(--sky); font-weight: 700; letter-spacing: 0.08em;
  display: inline-block;
}

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

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .dash { padding-top: 5.6rem; }
  .auth-card { padding: 2.2rem 1.6rem; }
  .nav-user { display: none; }
}
