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

:root {
  --bg: #F4F7F6;
  --surface: #FFFFFF;
  --ink: #1E293B;
  --ink-soft: #64748B;
  --line: #E2E8F0;
  --primary: #0F172A; /* Azul corporativo muy oscuro */
  --primary-hover: #1E293B;
  --accent: #2563EB; /* Azul vibrante para botones */
  --accent-soft: #EFF6FF;
  --ok: #059669;
  --error: #DC2626;
  --radius: 8px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

header.top {
  background: var(--primary);
  color: #F8FAFC;
  padding: 2.5rem 1.5rem;
  border-bottom: 4px solid var(--accent);
}

header.top .marca {
  max-width: 1100px;
  margin: 0 auto;
}

header.top h1 {
  font-weight: 700;
  font-size: 2rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

header.top p {
  margin: 0;
  color: #94A3B8;
  max-width: 70ch;
  font-size: 1rem;
}

main {
  max-width: 1100px;
  margin: -2rem auto 4rem;
  padding: 0 1.5rem;
}

section.paso {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

section.paso h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--primary);
}

section.paso h2 .num {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
}

section.paso > .descripcion {
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
  max-width: 80ch;
}

.campo { margin-bottom: 1.2rem; }
.campo label { display: block; font-weight: 600; margin-bottom: 0.4rem; color: var(--primary); }
.campo .ayuda { color: var(--ink-soft); font-size: 0.85rem; margin-top: 0.3rem; }

input[type="file"], input[type="text"], input[type="date"], input[type="number"], input[type="password"], textarea {
  font: inherit;
  padding: 0.6rem 0.8rem;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  background: #F8FAFC;
  color: var(--ink);
  width: 100%;
  transition: border-color 0.2s;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.fila-campos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
}

button {
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover { background: #1D4ED8; }
button:disabled { background: #94A3B8; cursor: not-allowed; }

button.secundario { background: transparent; color: var(--primary); border: 1px solid #CBD5E1; }
button.secundario:hover { background: #F1F5F9; border-color: #94A3B8; }

button.btn-quitar { background: transparent; color: var(--error); border: none; font-weight: bold; padding: 0.2rem 0.5rem; }

.dropzone {
  border: 2px dashed #CBD5E1;
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  background: #F8FAFC;
  transition: all 0.2s ease;
  margin-bottom: 1.5rem;
  cursor: pointer;
}
.dropzone:hover, .dropzone.dragover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.lista-archivos { font-size: 0.95rem; margin-bottom: 1rem; }
.lista-archivos div { padding: 0.5rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }

table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
th { text-align: left; font-size: 0.85rem; color: var(--ink-soft); padding: 0.5rem; border-bottom: 2px solid var(--line); }
td { padding: 0.5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }

.mensaje { margin-top: 1rem; padding: 0.8rem 1rem; border-radius: 6px; font-weight: 500; }
.mensaje.ok { background: #D1FAE5; color: var(--ok); border: 1px solid #A7F3D0; }
.mensaje.error { background: #FEE2E2; color: var(--error); border: 1px solid #FECACA; }
.mensaje.aviso { background: #FEF3C7; color: #B45309; border: 1px solid #FDE68A; }

details.raw { margin-top: 1rem; border: 1px solid var(--line); border-radius: 6px; }
details.raw summary { cursor: pointer; padding: 0.75rem 1rem; font-weight: 600; color: var(--primary); background: #F8FAFC; }
details.raw pre { margin: 0; padding: 1rem; max-height: 250px; overflow: auto; font-size: 0.8rem; background: var(--surface); border-top: 1px solid var(--line); white-space: pre-wrap; }

#cuadroContenedor { overflow-x: auto; margin-top: 1.5rem; }
table.cuadro-prescripcion { width: 100%; font-size: 0.75rem; font-family: Arial, sans-serif; border: 1px solid #CBD5E1; }
table.cuadro-prescripcion th, table.cuadro-prescripcion td { border: 1px solid #CBD5E1; padding: 6px; text-align: center; }
table.cuadro-prescripcion thead th { 
  background: #F2F2F2; /* Gris original del cuadro */
  font-weight: 700; 
  color: #000000; /* Texto negro original */
}
table.cuadro-prescripcion .col-tributo { font-weight: 700; text-align: left; }
table.cuadro-prescripcion .col-valor { text-align: left; }

.acciones { display: flex; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }
.ai-panel { background: #F0FDF4; border: 1px solid #BBF7D0; padding: 1.5rem; border-radius: 6px; margin-bottom: 1.5rem; }
.ai-panel h3 { margin: 0 0 0.5rem; color: #166534; font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; }

/* ---- SCROLL, TABLAS Y BUSCADOR ---- */
.table-container {
  max-height: 420px; /* Tamaño máximo (aprox 8 registros) */
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 1.5rem;
}
.table-container table { margin: 0; border: none; }
.table-container thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #F1F5F9; /* Fondo sólido para que no se traslape el texto al scrollear */
  box-shadow: 0 2px 3px -1px rgba(0,0,0,0.1);
}
.search-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: center;
}
.search-bar input { flex: 1; font-size: 0.95rem; }

/* ---- PANTALLA DE LOGIN ---- */
.pantalla-bloqueo {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.95); /* Fondo oscuro semitransparente */
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.caja-login {
  background: var(--surface);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  max-width: 400px;
  width: 90%;
  border-top: 4px solid var(--accent);
}