/* =====================================================
   PREVEO - ASISTENTE INTELIGENTE DE GASTOS
   style.css organizado, depurado y modernizado
===================================================== */


/* =====================================================
   1. VARIABLES CORPORATIVAS / CONFIGURACIÓN GENERAL
===================================================== */

:root {
  --preveo-green: #4e7b4f;
  --preveo-green-dark: #345a36;
  --preveo-green-soft: #eef6ee;
  --preveo-lime: #c9d400;
  --preveo-gray: #2f3430;
  --preveo-border: #dfe6df;
  --preveo-bg: #f3f7f3;
  --card-bg: rgba(255, 255, 255, 0.94);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--preveo-gray);
  background:
    radial-gradient(circle at top left, rgba(201, 212, 0, 0.20), transparent 34%),
    linear-gradient(135deg, #f8faf8 0%, #eef5ef 100%);
}


/* =====================================================
   2. HERO / ENCABEZADO PREVEO
   Usa el header moderno del index:
   <header class="topbar">...
===================================================== */

.topbar {
  padding: 8px 12px;

  background:
    linear-gradient(
      135deg,
      #1f2b23 20%,
      #2f4632 60%,
      #bed43f 100%
    );

  border-bottom: 4px solid var(--preveo-lime);
}

.hero-card {
  max-width: 1380px;
  margin: 0 auto;
  padding: 26px 30px;
  border-radius: 28px;
  background: rgba(245, 242, 242, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 45px rgba(247, 244, 244, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand-block {
  width: 100%;

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 22px;

  text-align: center;
}

.brand-block > div {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
  display: block;
  border-radius: 16px;

}

.badge-ai {

  display: inline-flex;

  align-items: center;

  gap: 6px;

  padding: 8px 14px;

  border-radius: 999px;

  background:
    rgba(201,212,0,.12);

  color: #f3ffd7;

  border:
    1px solid rgba(201,212,0,.22);

  font-size: 12px;

  font-weight: 700;

  margin-bottom: 12px;

  letter-spacing: .3px;
}

.hero-card h1,
.hero-card p,
.badge-ai,
.hero-stats strong,
.hero-stats span {
  color: white !important;
}
.hero-card h1 {

  margin: 0;

  color: #ffffff !important;

  font-size: 38px;

  line-height: 1.05;

  letter-spacing: -.8px;

  font-weight: 800;

  text-align: center;

  text-shadow:
    0 2px 10px rgba(0,0,0,.28);
}

.hero-card p {

  margin: 10px auto 0;

  color: rgba(255,255,255,.92) !important;

  font-size: 16px;

  max-width: 620px;

  text-align: center;

  line-height: 1.45;

  text-shadow:
    0 2px 8px rgba(0,0,0,.18);
}

.hero-stats {
  display: flex;
  gap: 12px;
}

.hero-stats div {
  min-width: 120px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  color: white;
}

.hero-stats strong {
  display: block;
  font-size: 22px;
}

.hero-stats span {
  font-size: 12px;
  opacity: 0.85;
}


/* =====================================================
   3. LAYOUT PRINCIPAL
   Panel izquierdo: formulario
   Panel derecho: vista del formato generado
===================================================== */

.app {
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 24px;
  padding: 24px;
  max-width: 1480px;
  margin: 0 auto;
}

.panel,
.preview {
  background: var(--card-bg);
  border-radius: 26px;
  padding: 24px;
  box-shadow: 0 18px 45px rgba(30, 60, 30, 0.10);
  border: 1px solid rgba(78, 123, 79, 0.12);
  backdrop-filter: blur(10px);
}

.preview {
  width: 100%;
  overflow-x: auto;
  display: flex;
  justify-content: center;
}

#contenidoPDF {
  width: 1120px;
  max-width: 1120px;
  margin: 0 auto;
  background: white;
}


/* =====================================================
   4. FORMULARIOS E INPUTS
===================================================== */

label {
  font-weight: 700;
  display: block;
  margin-top: 16px;
  color: #263228;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--preveo-border);
  border-radius: 14px;
  box-sizing: border-box;
  margin-top: 7px;
  background: white;
  font-size: 15px;
  transition: 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--preveo-green);
  box-shadow: 0 0 0 4px rgba(78, 123, 79, 0.13);
}

textarea {
  min-height: 84px;
}


/* =====================================================
   5. BOTONES
===================================================== */

button {
  width: 100%;
  margin-top: 15px;
  padding: 13px 16px;
  background: linear-gradient(135deg, var(--preveo-green), #5f9360);
  color: white;
  border: none;
  border-radius: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(78, 123, 79, 0.22);
  transition: 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(78, 123, 79, 0.28);
  background: linear-gradient(135deg, var(--preveo-green-dark), var(--preveo-green));
}


/* =====================================================
   6. ESTADO DEL SISTEMA
===================================================== */

#estado {
  margin-top: 18px;
  padding: 14px;
  background: #f6faf6;
  border-left: 6px solid var(--preveo-green);
  border-radius: 16px;
  font-weight: 600;
}


/* =====================================================
   7. TABLAS NORMALES DE LA APP
   No afecta las tablas oficiales SGC
===================================================== */

table:not(.sgc-documento):not(.fcon09) {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 14px;
  font-size: 13px;
  overflow: hidden;
  border-radius: 14px;
}

table:not(.sgc-documento):not(.fcon09) th {
  background: var(--preveo-green);
  color: white;
  padding: 10px;
}

table:not(.sgc-documento):not(.fcon09) td {
  border-bottom: 1px solid #e5ebe5;
  padding: 10px;
  background: white;
}

table:not(.sgc-documento):not(.fcon09) tr:hover td {
  background: #f6faf6;
}


/* =====================================================
   8. FORMATOS SGC GENERALES
   Base para Legalización de gastos y otros formatos
===================================================== */

.logo-preveo {
  width: 70px;
  max-width: 70px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.formato-sgc {
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.sgc-documento {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
  background: white;
}

.sgc-documento td,
.sgc-documento th {
  border: 1px solid black;
  padding: 4px;
  vertical-align: middle;
  word-break: break-word;
}

.sgc-header {
  font-size: 28px;
  font-weight: bold;
  text-align: center;
}

.sgc-logo {
  text-align: center;
  font-size: 22px;
  font-weight: bold;
  color: #777;
}

.sgc-label {
  font-weight: bold;
  background: #f4f4f4;
}

.sgc-center {
  text-align: center;
}

.sgc-right {
  text-align: right;
}

.sgc-total {
  font-weight: bold;
  background: #efefef;
}

.sgc-firma {
  height: 80px;
}

.sgc-area-grande {
  height: 140px;
}

.sgc-titulo {
  font-size: 16px;
  font-weight: bold;
  text-align: center;
}

.sgc-small {
  font-size: 10px;
  color: #666;
}


/* =====================================================
   9. FORMATO LEGALIZACIÓN DE GASTOS F-AD-05
===================================================== */

.sgc-gastos {
  table-layout: fixed;
  width: 100%;
}

.sgc-gastos td,
.sgc-gastos th {
  font-size: 10px;
  padding: 3px;
}

/* La tabla actual tiene 6 columnas */
.sgc-gastos col:nth-child(1) { width: 14%; }
.sgc-gastos col:nth-child(2) { width: 18%; }
.sgc-gastos col:nth-child(3) { width: 16%; }
.sgc-gastos col:nth-child(4) { width: 14%; }
.sgc-gastos col:nth-child(5) { width: 14%; }
.sgc-gastos col:nth-child(6) { width: 24%; }


/* =====================================================
   10. FORMATO F-CON-09
===================================================== */

.pagina-fcon09 {
  width: 1020px;
  page-break-before: always;
  background: white;
}

.fcon09 {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
  background: white;
}

.fcon09 td {
  border: 1px solid black;
  padding: 4px;
  vertical-align: middle;
}

.fcon-title {
  font-weight: bold;
  text-align: center;
}

.fcon-center {
  text-align: center;
}

.fcon-company {
  font-size: 15px;
  font-weight: bold;
}

.fcon-logo {
  width: 90px;
  text-align: center;
}

.fcon-label {
  background: #c6e0b4;
  font-weight: bold;
}

.fcon-total {
  background: #c6e0b4;
  font-weight: bold;
  text-align: center;
}

.fcon-firmas {
  height: 70px;
}

.fcon-texto {
  font-size: 8px;
  line-height: 1.25;
}

.fcon-footer {
  font-size: 9px;
  font-weight: bold;
  text-align: right;
}


/* =====================================================
   11. MODAL F-CON-09
===================================================== */

.modal-fcon {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999;
  padding: 30px;
  overflow-y: auto;
}

.modal-contenido {
  background: white;
  max-width: 720px;
  margin: 0 auto;
  padding: 26px;
  border-radius: 22px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
}


/* =====================================================
   12. PDF / IMPRESIÓN / SOPORTES
   Estos estilos aplican al HTML temporal de impresión
===================================================== */

@page {
  size: tabloid landscape;
  margin: 8mm;
}

.pdf-export {
  width: 1020px;
  background: white;
  color: black;
  padding: 0;
}

.pagina-formato { 
  width: 1020px;
  margin-bottom: 24px;
}

.pagina-soportes {
  width: 1020px;
  margin-top: 20px;
  page-break-before: auto !important;
  break-before: auto !important;
}

.soporte-item {
  margin-top: 10px;
  page-break-before: auto !important;
  break-before: auto !important;
  page-break-inside: avoid;
  break-inside: avoid;
}

.soporte-item img {
  width: 100%;
  max-height: 900px;
  object-fit: contain;
  border: 1px solid #ccc;
}

@media print {
  body {
    margin: 0;
    background: white;
  }

  .no-print,
  header,
  .topbar,
  #estado,
  .panel {
    display: none !important;
  }

  .app {
    display: block;
    padding: 0;
  }

  .preview {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    display: block;
  }

  #contenidoPDF {
    width: 1120px;
    max-width: 1120px;
    margin: 0 auto;
  }
}


/* =====================================================
   13. RESPONSIVE MÓVIL
   El formulario se apila, pero los formatos SGC NO se deforman.
   Se navegan con scroll horizontal.
===================================================== */

@media (max-width: 768px) {
  .topbar {
    padding: 12px;
  }

  .hero-card {
    padding: 18px;
    border-radius: 22px;
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-block {
    gap: 14px;
  }

  .hero-logo {
    width: 54px;
  }

  .hero-card h1 {
    font-size: 28px;
  }

  .hero-card p {
    font-size: 14px;
  }

  .hero-stats {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-stats div {
    min-width: 0;
    padding: 10px;
  }

  .hero-stats strong {
    font-size: 16px;
  }

  .hero-stats span {
    font-size: 10px;
  }

  .app {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    width: 100% !important;
    padding: 12px !important;
  }

  .panel,
  .preview {
    width: 100% !important;
    max-width: 100% !important;
  }

  .preview {
    overflow-x: auto !important;
    overflow-y: visible !important;
    margin-top: 16px;
    display: block !important;
    justify-content: initial !important;
  }

  #contenidoPDF {
    width: 1120px !important;
    min-width: 1120px !important;
    max-width: none !important;
    margin: 0 !important;
    transform: none !important;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .modal-fcon {
    padding: 14px;
  }

  .modal-contenido {
    width: 100%;
    max-width: 100%;
    padding: 18px;
  }
}

.hero-card {
  justify-content: center !important;
}

.brand-block {
  justify-content: center !important;
  text-align: center !important;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-logo {
  width: 90px !important;
  height: 90px !important;
  max-width: 90px !important;
  object-fit: contain !important;
}

.hero-card h1,
.hero-card p {
  color: #ffffff !important;
  text-align: center !important;
}

.preview {
  display: block !important;
}

.preview h2 {
  margin: 0 0 18px 0;
  font-size: 30px;
  line-height: 1.1;
  color: var(--preveo-gray);
}

#contenidoPDF {
  margin: 0 auto;
}
/* =====================================================
   BOTONES MODERNOS PREVEO
===================================================== */

.btn-add {

  background:
    linear-gradient(
      135deg,
     #a1ce26,
      #b3d81b
    ) !important;

  color: white;

  box-shadow:
    0 10px 24px rgba(107,156,108,.25);
}

.btn-add:hover {

  background:
    linear-gradient(
      135deg,
      #546c47,
      #426f3e
    ) !important;
}


/* ========================= */

.btn-formato {

  background:
    linear-gradient(
      135deg,
      #a1ce26,
      #b3d81b
    ) !important;

  color: white;

  box-shadow:
    0 12px 28px rgba(78,123,79,.28);
}

.btn-formato:hover {

  background:
    linear-gradient(
      135deg,
      #546c47,
      #426f3e
    ) !important;
}


/* ========================= */

.btn-pdf {

  background:
    linear-gradient(
      135deg,
      #1e2420,
      #34423a
    ) !important;

  color: white;

  box-shadow:
    0 14px 30px rgba(0,0,0,.22);
}

.btn-pdf:hover {

  background:
    linear-gradient(
      135deg,
      #101512,
      #27332c
    ) !important;

  transform:
    translateY(-2px);

  box-shadow:
    0 18px 38px rgba(0,0,0,.30);
}

.rut-proveedor {
  margin-top: 20px;
}

.rut-item {
  margin-top: 12px;
}

.rut-item img {
  width: 100%;
  max-height: 900px;
  object-fit: contain;
  border: 1px solid #ccc;
}