/* === PANMEX - Estilo Global Elegante y Responsive === */

/* Fuente moderna y profesional */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

/* ===== Variables de layout ===== */
:root{
    --header-h: 70px;
    --footer-h: 70px;
    --rail-max: 1080px;   /* ancho máximo de riel para header/footer/cards */
    --rail-pad: 16px;
}

/* Reset y base */
*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:'Poppins',sans-serif;
}

html,body{
    min-height:100dvh;
    height:auto;
    display:block;
    background-color:#f4f6f9;
    color:#2c3e50;
    font-size:16px;
    line-height:1.6;
}

a{ color:#1e3799; text-decoration:none; }
a:hover{ text-decoration:underline; }

/* ===== Header y Footer ===== */
.header,
.footer{
    position:fixed;
    left:0; right:0;
    background:#2c3e50;
    color:#fff;
    display:flex;
    z-index:1000;
}
.header{ top:0; height:var(--header-h); }
.footer{ bottom:0; height:var(--footer-h); }

/* Contenedor interno alineado (Riel) */
.bar-inner{
    width:min(var(--rail-max), 92vw);
    margin:0 auto;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:0 var(--rail-pad);
    height:100%;
}

/* ===== Contenido centrado ===== */
.viewport-center{
    min-height:100dvh;
    padding-block: var(--header-h) var(--footer-h);
    display:grid;
    place-items:center;
}

/* ===== Encabezados ===== */
h1,h2,h3,h4,h5{
    font-weight:600;
    color:#2c3e50;
    margin-bottom:1rem;
    text-align:center;
}

/* ===== Botones ===== */
button,.btn{
    padding:0.6rem 1.2rem;
    background-color:#1e3799;
    color:#fff;
    border:none;
    border-radius:6px;
    cursor:pointer;
    font-weight:500;
    transition:background-color .3s;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:.4rem;
    text-align:center;
    white-space:nowrap;
    font-size:.82rem;
    line-height:1.1;
}
button:hover,.btn:hover{ background-color:#3c6382; }

.btn.secondary{ background-color:#6c757d; }
.btn.secondary:hover{ background-color:#5a6268; }

.btn.red{ background-color:#e74c3c; }
.btn.red:hover{ background-color:#c0392b; }

.btn.blue{ background-color:#1e3799; }
.btn.blue:hover{ background-color:#3c6382; }

.btn.dark{ background-color:#2c3e50; color:#fff; }
.btn.dark:hover{ background-color:#1e272e; }

.btn.success{ background-color:#28a745; color:#fff; }
.btn.success:hover{ background-color:#218838; }

.btn.small-btn{
    padding:.25rem .6rem;
    font-size:.75rem;
    line-height:1.2;
}

/* ===== Tarjetas ===== */
.card{
    background:#fff;
    border-radius:16px;
    box-shadow:0 8px 20px rgba(0,0,0,.08);
    width:100%;
    max-width:var(--rail-max);
    padding:24px;
    margin:0 auto;
    text-align:center;
}

/* ===== Dashboard ===== */
.dashboard-card{
    background:#fff;
    border-radius:16px;
    padding:2rem;
    box-shadow:0 8px 20px rgba(0,0,0,.08);
    text-align:center;
    max-width:var(--rail-max);
    width:100%;
}

.modules-grid{
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    gap:2rem;
    margin:2rem 0;
}

.module{
    display:flex;
    flex-direction:column;
    align-items:center;
    background:#ffffff;
    padding:1.5rem;
    border-radius:10px;
    width:160px;
    text-align:center;
    text-decoration:none;
    color:#2c3e50;
    box-shadow:0 4px 10px rgba(0,0,0,.06);
    transition:transform .2s ease, background .2s ease;
}
.module:hover{
    transform:translateY(-5px);
    background:#f0f4ff;
}
.module i{ margin-bottom:.5rem; color:#1e3799; }

/* Botón cerrar sesión */
.logout-btn{
    display:inline-block;
    margin-top:2rem;
    padding:.75rem 1.5rem;
    background-color:#e74c3c;
    color:#fff;
    border-radius:6px;
    font-weight:bold;
    text-decoration:none;
    transition:background-color .3s ease;
}
.logout-btn:hover{ background-color:#c0392b; }

/* ===== Formularios ===== */
.form-card{
    background:#fff;
    border-radius:16px;
    padding:2rem;
    box-shadow:0 8px 20px rgba(0,0,0,.08);
    width:100%;
    max-width:600px;
    margin:0 auto;
}
.form-card h2{ text-align:center; margin-bottom:1.5rem; }
.form-styled{ display:flex; flex-direction:column; gap:1rem; width:100%; }
.form-group{ margin-bottom:1.2rem; text-align:left; width:100%; }
.form-group label{ display:block; font-weight:500; margin-bottom:.4rem; color:#2c3e50; }
.form-group input{
    width:100%;
    padding:.7rem 1rem;
    border:1px solid #ccc;
    border-radius:6px;
    font-size:1rem;
    transition:border-color .3s;
}
.form-group input:focus{ border-color:#1e3799; outline:none; }
.form-actions{ display:flex; justify-content:center; gap:1rem; margin-top:1rem; flex-wrap:wrap; }
.auth-links{ margin-top:.75rem; text-align:center; }
.auth-links a{ font-size:.95rem; color:#1e3799; text-decoration:none; }
.auth-links a:hover{ text-decoration:underline; }

/* ===== Tablas ===== */
.table-responsive{
    width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
}

table{
    width:100%;
    border-collapse:collapse;
    background-color:#fff;
    border-radius:10px;
    overflow:hidden;
    box-shadow:0 6px 12px rgba(0,0,0,.05);
}

th,td{
    padding:.6rem .9rem;
    border-bottom:1px solid #e0e0e0;
    vertical-align:middle;
    text-align:center;
    font-size:.95rem;
}

.table-actions{
    display:flex;
    gap:.4rem;
    justify-content:center;
    align-items:center;
    flex-wrap:nowrap;
}

table tr:nth-child(even){ background-color:#f9f9f9; }
table tr:nth-child(odd){ background-color:#ffffff; }

/* ===== Productos (LISTADO) ===== */
.productos-card{
    background:#fff;
    border-radius:16px;
    box-shadow:0 8px 20px rgba(0,0,0,.08);
    width:100%;
    max-width: var(--rail-max);
    padding:18px 16px 20px;
    display:flex;
    flex-direction:column;
    max-height:calc(100dvh - var(--header-h) - var(--footer-h) - 24px);
    overflow:hidden;
}

.botonera-horizontal{
    display:flex;
    justify-content:center;
    gap:1rem;
    flex-wrap:wrap;
    margin-bottom:15px;
}

.tabla-productos-scroll{
    flex:1;
    min-height:0;
    overflow-y:auto;
    padding:0;
}

.productos-card table{
    margin:0;
    box-shadow:none;
}

.productos-card th,
.productos-card td{
    padding:.55rem .9rem;
    height:34px;
    font-size:.95rem;
}

/* ===== Alertas ===== */
.alert{
    padding:1rem;
    border-radius:6px;
    margin-bottom:1rem;
}
.alert-success{ background-color:#dff0d8; color:#3c763d; }
.alert-error{ background-color:#f2dede; color:#a94442; }

/* ===== Responsive ===== */
@media (max-width:992px){
    .card{ max-width:95%; }
}
@media (max-width:768px){
    html,body{ font-size:15px; }
    .card{ padding:1.5rem; max-width:96%; }
    .table-actions{ flex-direction:column; gap:.5rem; }
    .btn.small-btn{ width:100%; }
    .form-actions{ flex-direction:column; width:100%; }
    .form-actions .btn{ width:100%; }
}

/* Ocultar input file */
input[type="file"]{ display:none !important; }

/* ====== SCOPE SOLO AUTH ====== */
.auth-page{
  min-height: calc(100dvh - var(--header-h) - var(--footer-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--rail-pad);
}
.auth-page .form-card,
.auth-page .card{
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

/* ====== SCOPE SOLO LANDING ====== */
.landing-page{
  min-height: calc(100dvh - var(--header-h) - var(--footer-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--rail-pad);
}
.landing-page .card{
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

/* Centrado de la página de productos (wrapper) */
.productos-page{
  min-height: calc(100dvh - var(--header-h) - var(--footer-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}
.productos-card{
  max-height: calc(100dvh - var(--header-h) - var(--footer-h) - 24px);
}

/* ==== LAYOUT UNIFICADO ==== */
.page{
  min-height: 100dvh;
  padding-block: var(--header-h,70px) var(--footer-h,70px);
  display: grid;
  place-items: center;
}
.page__card{
  width: min(var(--rail-max,1080px), 92vw);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
  padding: 24px;
}
.page__card--scroll{
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--header-h,70px) - var(--footer-h,70px) - 24px);
}
.card-scroll{
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.page .botonera-horizontal{
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 15px;
}
.page__card--scroll table{
  margin: 0;
  box-shadow: none;
}
.page__card--scroll th,
.page__card--scroll td{
  padding: .55rem .9rem;
  height: 34px;
  font-size: .95rem;
}

/* === Import Preview === */
.import-stats{
  display:flex; gap:1rem; justify-content:center; flex-wrap:wrap; margin: .25rem 0 1rem 0;
}
.stat{
  background:#fff; border-radius:12px; box-shadow:0 6px 12px rgba(0,0,0,.06);
  padding:14px 22px; min-width:220px; text-align:center;
}
.stat-num{ font-size:2rem; font-weight:700; line-height:1; margin-bottom:.25rem; color:#2c3e50; }
.stat-label{ font-size:.95rem; color:#576574; }
.stat-warn .stat-num{ color:#c0392b; }
.tabla-productos-scroll h3{ margin: .75rem 0 .5rem 0; }

.contenido-productos.import-preview{
  display:grid;
  place-items:center;
  min-height:100dvh;
  padding-block: var(--header-h) var(--footer-h);
}
.contenido-productos.import-preview .productos-card{
  width:100%;
  max-width: var(--rail-max);
  margin-inline:auto;
}
.contenido-productos.import-preview .tabla-productos-scroll{
  max-height: calc(100dvh - var(--header-h) - var(--footer-h) - 220px);
}
@media (max-width:768px){
  .contenido-productos.import-preview .tabla-productos-scroll{
    max-height: calc(100dvh - var(--header-h) - var(--footer-h) - 260px);
  }
}

/* Tabs look sutil */
.botonera-horizontal .btn.dark { box-shadow: inset 0 -2px 0 rgba(255,255,255,0.6); }

/* ===== CONFIGURACIÓN ===== */
.config-page{
  min-height: calc(100dvh - var(--header-h) - var(--footer-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}
.config-card{
  background:#fff;
  border-radius:16px;
  box-shadow:0 8px 20px rgba(0,0,0,.08);
  width:100%;
  max-width: var(--rail-max);
  padding:18px 16px 20px;
  display:flex;
  flex-direction:column;
  max-height: calc(100dvh - var(--header-h) - var(--footer-h) - 24px);
  overflow:hidden;
}
.config-tabs{
  display:flex; justify-content:center; gap:.5rem; margin-bottom:.75rem;
}
.config-tabs a{
  background:#6c757d; color:#fff; padding:.45rem .9rem; border-radius:8px;
  text-decoration:none; font-size:.9rem; line-height:1; display:inline-flex;
}
.config-tabs a.active{ background:#1e3799; }
.config-scroll{
  flex:1; min-height:0; overflow-y:auto; padding: 8px 4px;
}
.config-form .form-group{ margin-bottom:1rem; text-align:left; }
.config-form label{ display:block; font-weight:500; margin-bottom:.35rem; color:#2c3e50; }
.config-form input, .config-form select{
  width:100%; padding:.7rem 1rem; border:1px solid #ccc; border-radius:6px; font-size:1rem;
}
.config-actions{
  display:flex; justify-content:center; gap:.75rem; margin-top:1rem; flex-wrap:wrap;
}
.config-table{
  width:100%; border-collapse:collapse; background:#fff; border-radius:10px; overflow:hidden;
  box-shadow:0 6px 12px rgba(0,0,0,.05);
}
.config-table th, .config-table td{
  padding:.6rem .9rem; border-bottom:1px solid #e0e0e0; text-align:left;
}
.config-table tr:nth-child(even){ background:#f9f9f9; }
.config-table tr:nth-child(odd){ background:#ffffff; }

/* ===========================
   CONFIGURACIÓN – LAYOUT FIJO
   =========================== */
.settings-page{
  min-height: calc(100dvh - var(--header-h,70px) - var(--footer-h,70px));
  padding: 12px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.settings-card{
  width: min(var(--rail-max,1080px), 92vw);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
  padding: 16px;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--header-h,70px) - var(--footer-h,70px) - 24px);
  min-height: 480px;
  overflow: hidden;
}
.settings-tabs{
  display: flex;
  gap: .5rem;
  justify-content: center;
  margin: .25rem 0 .75rem 0;
}
.settings-tabs .tab{
  padding:.45rem .9rem;
  border-radius: 8px;
  background:#6c757d;
  color:#fff;
  font-size:.9rem;
  border:none;
}
.settings-tabs .tab.active{ background:#1e3799; }
.settings-title{
  text-align:center;
  font-weight:600;
  margin: .1rem 0 .35rem 0;
}
.settings-scroll{
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 2px 2px 2px;
}
.settings-form .form-group{
  margin-bottom: .7rem;
}
.settings-form label{
  display:block; font-weight:500; margin-bottom:.28rem; color:#2c3e50;
}
.settings-form input, .settings-form select{
  width:100%;
  padding:.55rem .8rem;
  border:1px solid #dcdcdc;
  border-radius:8px;
  font-size:.92rem;
  line-height:1.2;
}
.settings-actions{
  display:flex;
  justify-content:center;
  gap:.75rem;
  margin-top:.8rem;
  flex-wrap:wrap;
}
.settings-table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
  border-radius:10px;
  overflow:hidden;
  box-shadow:0 6px 12px rgba(0,0,0,.05);
}
.settings-table th, .settings-table td{
  padding:.5rem .75rem;
  border-bottom:1px solid #e0e0e0;
  text-align:left;
  font-size:.92rem;
}
.settings-table tr:nth-child(even){ background:#f9f9f9; }
.settings-table tr:nth-child(odd){ background:#ffffff; }

/* ============ ADD-ON CONFIG (tabs + compacto) ============ */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; margin-bottom:.6rem;
}
.tabs{ display:flex; gap:.5rem; flex-wrap:wrap; }
.tab{
  background:#6c757d; color:#fff; padding:.45rem .9rem; border-radius:8px;
  text-decoration:none; font-size:.9rem; line-height:1;
}
.tab.active{ background:#1e3799; }
.form-compact .form-group{ margin-bottom:.85rem; text-align:left; }
.form-compact label{ display:block; font-weight:500; margin-bottom:.35rem; color:#2c3e50; }
.form-compact input, .form-compact select{
  width:100%; padding:.6rem .9rem; border:1px solid #dcdcdc; border-radius:8px; font-size:.95rem;
}

/* ===== Pedidos - FILTROS (en una sola línea, compacto) ===== */
.filters-bar{ margin-bottom:.4rem; }

.filters-grid.inline-labels{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:.6rem 1rem;
}
.filters-grid.inline-labels .form-group{
  display:flex;
  align-items:center;
  gap:.4rem;
  margin:0;
  flex:0 0 auto;
}
.filters-grid.inline-labels .form-group label{
  display:inline-block;
  font-size:.85rem;
  font-weight:500;
  margin:0;
  white-space:nowrap;
}
.filters-grid.inline-labels .filters-input{
  display:inline-block;
  padding:.35rem .55rem;
  font-size:.85rem;
  line-height:1.2;
  height:auto;
  border:1px solid #dcdcdc;
  border-radius:6px;
  min-width:140px;
}
.filters-input--folio{ width:240px; max-width:42vw; }

/* ===== Pedidos – Filtros compactos (override final) ===== */
.filters-row{
  display:flex;
  align-items:center;
  gap:.5rem;
  flex-wrap:wrap;
  margin-bottom:.5rem;
}
.filters-label{
  font-size:.82rem;
  color:#2c3e50;
  margin-right:.25rem;
}
.filters-input{
  padding:.36rem .6rem;
  border:1px solid #dcdcdc;
  border-radius:8px;
  font-size:.82rem;
  line-height:1.2;
}
.filters-input--folio{ width:220px; }
.filters-actions{
  display:flex;
  gap:.5rem;
  margin-left:auto;
}

/* ===== Pedidos - Tabla compacta ===== */
.orders-table th,
.orders-table td{
  font-size:.88rem;
  padding:.5rem .7rem;
  height:32px;
  white-space:nowrap;
}
.orders-table td.col-folio{ font-weight:600; color:#1e3799; }
.orders-table .btn.small-btn{
  font-size:.78rem;
  padding:.2rem .5rem;
}
.pager{
  display:flex; align-items:center; justify-content:flex-end;
  gap:.6rem; margin-top:.6rem;
}

/* Título del header siempre en mayúsculas */
.header .bar-inner div { text-transform: uppercase; }

/* =================================================================
   UI UNIFICADO (pc-*) — Card, Tabla sticky, Scroll e Inputs compactos
   ================================================================= */

.pc-root{ font-family: 'Poppins',sans-serif; color:#0f172a; }

/* CARD / HEAD */
.pc-card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:12px;
  box-shadow:0 4px 18px rgba(2,6,23,.06);
  padding:16px;
}
.pc-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px; }
.pc-title{ font-size:16px; font-weight:700; margin:0; }
.pc-meta{ font-size:12px; color:#64748b; display:flex; gap:14px; align-items:center; }
.pc-badge{ background:#e8f7ff; color:#0369a1; font-weight:600; border-radius:999px; padding:2px 8px; font-size:12px; }

/* BOTONES */
.pc-btn{
  border-radius:10px;
  padding:6px 12px;
  font-size:12px;
  border:1px solid #d1d5db;
  background:#0b2239; color:#fff;
  display:inline-flex; align-items:center; gap:6px;
}
.pc-btn.secondary{ background:#f1f5f9; color:#0f172a; }
.pc-btn.ghost{ background:#fff; color:#0f172a; }
.pc-btn:disabled{ opacity:.6; cursor:not-allowed; }

.pc-icon-btn{
  width:28px; height:28px; border-radius:8px;
  border:1px solid #d1d5db; background:#fff;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:16px; line-height:1;
}
.pc-icon-btn:hover{ background:#f8fafc; }

/* INPUTS */
.pc-input{
  width:100%; height:28px; padding:2px 8px; font-size:13px;
  border:1px solid #d1d5db; border-radius:8px; background:#fff; outline:none;
}
.pc-input:focus{ border-color:#bae6fd; box-shadow:0 0 0 3px #e0f2fe; }

/* TABLA UNIFICADA */
.pc-table-wrap{
  border:1px solid #e5e7eb;
  border-radius:10px;
  overflow:hidden;
  background:#fff;
}
.pc-scroll{
  max-height:62vh;            /* Ajusta si lo necesitas para cada vista */
  overflow:auto;
}
.pc-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  table-layout:fixed;
}
.pc-table th, .pc-table td{
  padding:8px 16px;
  border-bottom:1px solid #e5e7eb;
  font-size:13px;
  line-height:1.2;
  background:#fff;
}
.pc-table th{
  position:sticky; top:0; z-index:5;
  background:#f7f7fb;
  text-transform:uppercase; letter-spacing:.02em;
  color:#0f172a; font-weight:700;
  border-bottom:1px solid #d1d5db;
}
.pc-table.compact th, .pc-table.compact td{ padding-top:6px; padding-bottom:6px; }
.pc-table tbody tr:hover td{ background:#fbfdff; }

/* Alineaciones útiles */
.pc-table .cell-num{ text-align:center; }
.pc-table .cell-right{ text-align:right; }
.pc-table .cell-key{ font-weight:700; color:#0f172a; }

/* UTILIDADES */
.pc-toolbar{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ml-auto{ margin-left:auto; }
.muted{ color:#64748b; }

/* CONTENEDOR DE PÁGINA (opcional) */
.pc-page{
  min-height:100dvh;
  padding-block: var(--header-h,70px) var(--footer-h,70px);
  display:grid; place-items:center;
}
.pc-card--max{
  width:min(var(--rail-max,1080px), 92vw);
}

/* Compatibilidad con estilos globales de table */
.pc-table{ box-shadow:none; border-radius:0; background:transparent; }
.pc-table th, .pc-table td{ text-align:left; }
.pc-table .cell-num{ text-align:center; }

/* ========= OVERRIDES ESPECÍFICOS – SEPARACIÓN ========= */
#sep-entregas .sep-card{
  /* Override del límite global de .card */
  max-width: 1600px;
  width: min(1600px, 98vw);
}
#sep-entregas .table-shell{
  position: relative;           /* para recortar el header transformado */
  overflow: hidden;             /* oculta el excedente al sincronizar */
}
#sep-entregas .table-shell > table{
  position: relative;           /* para poder moverlo con transform */
  will-change: transform;
}
