:root{
  --bg:#f3f6fb;
  --panel:#fff;
  --panel2:#f8fafc;
  --text:#0f172a;
  --muted:#64748b;
  --line:#e2e8f0;
  --primary:#0891b2;
  --success:#16a34a;
  --success-bg:#dcfce7;
  --warn:#d97706;
  --warn-bg:#fef3c7;
  --danger:#dc2626;
  --danger-bg:#fee2e2;
  --shadow:0 10px 25px rgba(15,23,42,.06);
}

*{
  box-sizing:border-box;
}

html,body{
  margin:0;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:var(--bg);
}

a{
  text-decoration:none;
  color:inherit;
}

.layout{
  display:grid;
  grid-template-columns:280px 1fr;
  min-height:100vh;
}

.sidebar{
  background:#020617;
  color:#fff;
  border-right:1px solid #0f172a;
  padding:20px 16px;
  position:sticky;
  top:0;
  height:100vh;
  overflow:auto;
}

.brand-kicker{
  color:#67e8f9;
  font-size:11px;
  letter-spacing:.24em;
  text-transform:uppercase;
  font-weight:700;
}

.brand-title{
  font-size:26px;
  font-weight:700;
  margin:8px 0 8px;
  line-height:1.1;
}

.brand-text{
  color:#cbd5e1;
  line-height:1.45;
  font-size:13px;
}

.nav-group{
  margin-top:20px;
  display:grid;
  gap:6px;
}

.nav-link{
  padding:10px 12px;
  border-radius:16px;
  color:#cbd5e1;
  font-size:13px;
}

.nav-link:hover{
  background:#0f172a;
}

.nav-link.active{
  background:rgba(8,145,178,.16);
  color:#cffafe;
  border:1px solid rgba(103,232,249,.18);
}

.context-card{
  margin-top:18px;
  background:#0f172a;
  border:1px solid #1e293b;
  border-radius:20px;
  padding:14px;
}

.context-card .label{
  color:#94a3b8;
  text-transform:uppercase;
  font-size:10px;
  letter-spacing:.16em;
}

.context-card .value{
  font-size:15px;
  font-weight:700;
  margin-top:8px;
}

.context-card .sub{
  color:#94a3b8;
  font-size:12px;
  margin-top:4px;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:11px;
  font-weight:700;
  border-radius:999px;
  padding:4px 10px;
}

.badge.primary{
  background:#ecfeff;
  color:#0e7490;
}

.badge.success{
  background:var(--success-bg);
  color:var(--success);
}

.badge.warn{
  background:var(--warn-bg);
  color:var(--warn);
}

.badge.danger{
  background:var(--danger-bg);
  color:var(--danger);
}

.badge.neutral{
  background:#e2e8f0;
  color:#475569;
}

.main{
  padding:0;
}

.topbar{
  position:sticky;
  top:0;
  background:rgba(255,255,255,.93);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
  padding:14px 22px;
  display:flex;
  justify-content:space-between;
  gap:14px;
  align-items:center;
}

.topbar h1{
  margin:2px 0 4px;
  font-size:28px;
  line-height:1.05;
}

.topbar .eyebrow{
  color:var(--primary);
  text-transform:uppercase;
  font-size:11px;
  letter-spacing:.18em;
  font-weight:700;
}

.topbar p{
  margin:0;
  color:var(--muted);
  max-width:760px;
  line-height:1.35;
  font-size:13px;
}

.topbar-cards{
  display:grid;
  grid-template-columns:repeat(3,minmax(140px,1fr));
  gap:10px;
  min-width:440px;
}

.top-mini{
  background:var(--panel2);
  border:1px solid var(--line);
  border-radius:16px;
  padding:10px 12px;
  box-shadow:var(--shadow);
}

.top-mini .k{
  font-size:10px;
  letter-spacing:.14em;
  color:var(--muted);
  text-transform:uppercase;
}

.top-mini .v{
  margin-top:6px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px 12px;
  font-size:13px;
  font-weight:600;
}

.content{
  padding:18px 22px 24px;
}

.grid-4,
.grid-3,
.grid-2{
  display:grid;
  gap:16px;
}

.grid-4{
  grid-template-columns:repeat(4,minmax(0,1fr));
}

.grid-3{
  grid-template-columns:repeat(3,minmax(0,1fr));
}

.grid-2{
  grid-template-columns:1fr 1fr;
}

.card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:22px;
  padding:18px;
  box-shadow:var(--shadow);
}

.card .eyebrow{
  color:var(--muted);
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.18em;
  font-weight:700;
}

.kpi{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:22px;
  padding:16px;
  box-shadow:var(--shadow);
}

.kpi .label{
  color:var(--muted);
  font-size:13px;
}

.kpi .value{
  margin-top:10px;
  font-size:28px;
  font-weight:700;
}

.kpi .hint{
  margin-top:6px;
  color:var(--muted);
  font-size:11px;
}

.table-wrap{
  overflow:auto;
  border:1px solid var(--line);
  border-radius:18px;
}

table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}

th,td{
  padding:10px 12px;
  text-align:left;
  border-bottom:1px solid var(--line);
  vertical-align:middle;
}

thead th{
  background:#f8fafc;
  color:var(--muted);
  font-weight:700;
  font-size:12px;
}

.input,
.select{
  width:100%;
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px 12px;
  font-size:13px;
  color:var(--text);
}

.label-text{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.16em;
  color:var(--muted);
  font-weight:700;
  margin-bottom:6px;
}

.btns{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.btn{
  border:1px solid var(--line);
  border-radius:14px;
  padding:8px 12px;
  background:#fff;
  font-size:13px;
  font-weight:600;
  cursor:pointer;
}

.btn.primary{
  background:#0f172a;
  color:#fff;
  border-color:#0f172a;
}

.login-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns:1.1fr .9fr;
}

.login-hero{
  background:linear-gradient(135deg,#020617 0%,#0f172a 45%,#164e63 100%);
  color:#fff;
  padding:48px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

.login-panel{
  padding:40px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.login-box{
  width:100%;
  max-width:520px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:26px;
  padding:26px;
  box-shadow:var(--shadow);
}

.form-grid{
  display:grid;
  gap:14px;
}

.hero-note{
  border:1px dashed #bae6fd;
  background:#f0f9ff;
  color:#075985;
  border-radius:14px;
  padding:10px 12px;
  font-size:13px;
}

.login-stat{
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.04);
  border-radius:18px;
  padding:16px;
}

.toast{
  position:fixed;
  right:16px;
  bottom:16px;
  background:#0f172a;
  color:#fff;
  padding:14px 16px;
  border-radius:14px;
  box-shadow:var(--shadow);
  z-index:9999;
  max-width:360px;
}

.toast.error{
  background:#7f1d1d;
}

.toast.success{
  background:#14532d;
}

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

  .sidebar{
    display:none;
  }

  .topbar{
    flex-direction:column;
    align-items:stretch;
    padding:14px 16px;
  }

  .topbar-cards{
    min-width:0;
    grid-template-columns:1fr;
  }

  .grid-4{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .grid-3,
  .grid-2,
  .login-shell{
    grid-template-columns:1fr;
  }

  .login-hero{
    min-height:340px;
  }

  .content{
    padding:16px;
  }
}

@media (max-width:980px){
  .grid-2{
    grid-template-columns:1fr;
  }
}

@media (max-width:760px){
  .content,
  .topbar,
  .login-hero,
  .login-panel{
    padding-left:16px;
    padding-right:16px;
  }

  .grid-4,
  .grid-3,
  .grid-2{
    grid-template-columns:1fr;
  }
}
.nav-section{display:grid;gap:6px;margin-bottom:14px}.nav-title{font-size:10px;letter-spacing:.16em;text-transform:uppercase;color:#67e8f9;font-weight:700;margin:8px 10px 2px}.page-actions{display:flex;gap:8px;flex-wrap:wrap}.muted{color:var(--muted)}.stack{display:grid;gap:14px}.empty{padding:18px;color:var(--muted);text-align:center}.chip{display:inline-flex;padding:6px 10px;border-radius:999px;background:#eff6ff;color:#1d4ed8;font-size:12px;font-weight:700}.split{display:grid;grid-template-columns:1.1fr .9fr;gap:16px}.row{display:flex;justify-content:space-between;gap:12px;align-items:center}.actions-cell{display:flex;gap:6px;flex-wrap:wrap}.pre{white-space:pre-wrap;word-break:break-word;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;background:#0f172a;color:#e2e8f0;border-radius:14px;padding:12px}.pillbar{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}.link{color:#0e7490;font-weight:700;cursor:pointer}.tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:14px}.tab{padding:8px 12px;border-radius:999px;border:1px solid var(--line);background:#fff;cursor:pointer;font-size:13px;font-weight:600}.tab.active{background:#0f172a;color:#fff;border-color:#0f172a}@media (max-width:1100px){.split{grid-template-columns:1fr}}



/* Empresas layout horizontal */
.empresas-head{
  align-items:flex-end;
}
.empresas-toolbar{
  align-items:center;
  justify-content:flex-end;
}
.empresas-search{
  min-width:280px;
  max-width:420px;
}
.empresas-filter{
  min-width:180px;
  max-width:220px;
}
.empresas-sections{
  grid-template-columns:1.08fr .92fr;
}
@media (max-width:1200px){
  .empresas-toolbar{
    width:100%;
    justify-content:flex-start;
  }
}
@media (max-width:980px){
  .empresas-head{
    align-items:flex-start;
  }
  .empresas-toolbar{
    width:100%;
  }
  .empresas-search,
  .empresas-filter{
    min-width:0;
    max-width:none;
    flex:1 1 100%;
  }
  .empresas-sections{
    grid-template-columns:1fr;
  }
}


/* Empresas layout horizontal */
.empresas-head{
  align-items:flex-end;
}
.empresas-toolbar{
  align-items:center;
  justify-content:flex-end;
}
.empresas-search{
  min-width:280px;
  max-width:420px;
}
.empresas-filter{
  min-width:180px;
  max-width:220px;
}
.empresas-sections{
  grid-template-columns:1.08fr .92fr;
}
.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.45);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  z-index:1200;
}
.modal-card{
  width:min(920px, 96vw);
  max-height:90vh;
  overflow:auto;
  background:#fff;
  border:1px solid #e2e8f0;
  border-radius:24px;
  box-shadow:0 20px 40px rgba(15,23,42,.18);
  padding:24px;
}
@media (max-width:1200px){
  .empresas-toolbar{
    width:100%;
    justify-content:flex-start;
  }
}
@media (max-width:980px){
  .empresas-head{
    align-items:flex-start;
  }
  .empresas-toolbar{
    width:100%;
  }
  .empresas-search,
  .empresas-filter{
    min-width:0;
    max-width:none;
    flex:1 1 100%;
  }
  .empresas-sections{
    grid-template-columns:1fr;
  }
}

.modal-backdrop[hidden]{
  display:none !important;
}

.solicitudes-top{
  grid-template-columns: .95fr 1.05fr;
}
.solicitudes-search{
  min-width: 230px;
  max-width: 320px;
}
.solicitudes-terminal-toolbar{
  align-items: center;
}
.solicitud-cell .strong{
  font-weight: 700;
}
.checkbox-inline{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 14px;
  border:1px solid #d9e2ef;
  border-radius: 18px;
  background:#fff;
}
.icon-btn{
  width:42px;
  height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius: 14px;
  font-size: 18px;
  padding: 0;
}
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-word;
}
@media (max-width: 1100px){
  .solicitudes-top{
    grid-template-columns: 1fr;
  }
}


.grid-5{
  display:grid;
  grid-template-columns:repeat(5, minmax(0, 1fr));
  gap:18px;
}
.resumen-panels{
  grid-template-columns:1fr 1fr;
}
.mini-stat{
  border:1px solid #e2e8f0;
  border-radius:18px;
  padding:14px 16px;
  background:#fff;
}
.mini-stat-k{
  color:#64748b;
  font-size:12px;
}
.mini-stat-v{
  font-size:22px;
  font-weight:700;
  margin-top:6px;
}
.mini-stat-h{
  color:#94a3b8;
  font-size:12px;
  margin-top:4px;
}
.bar-row{
  display:grid;
  grid-template-columns:120px 1fr 72px;
  gap:12px;
  align-items:center;
}
.bar-label{
  color:#334155;
  font-weight:600;
}
.bar-track{
  height:12px;
  background:#e2e8f0;
  border-radius:999px;
  overflow:hidden;
}
.bar-fill{
  height:100%;
  background:#0891b2;
  border-radius:999px;
}
.bar-value{
  text-align:right;
  font-weight:700;
}
@media (max-width:1200px){
  .grid-5{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}
@media (max-width:780px){
  .grid-5,
  .resumen-panels{
    grid-template-columns:1fr;
  }
  .bar-row{
    grid-template-columns:1fr;
  }
  .bar-value{
    text-align:left;
  }
}


/* =========================
   Resumen EFOS + cancelabilidad
   ========================= */
.tone-success{
  border-color:#bbf7d0;
  background:#f0fdf4;
}
.tone-warn{
  border-color:#fde68a;
  background:#fffbeb;
}
.tone-danger{
  border-color:#fecaca;
  background:#fef2f2;
}
.tone-neutral{
  border-color:#e2e8f0;
  background:#fff;
}
.bar-fill.success{
  background:#16a34a;
}
.bar-fill.warn{
  background:#d97706;
}
.bar-fill.danger{
  background:#dc2626;
}
.bar-fill.primary{
  background:#0891b2;
}

/* =========================
   Solicitudes SAT - mejora de distribución
   ========================= */
.solicitudes-create-card{
  padding:22px 22px 20px;
}

.solicitudes-create-head{
  margin-bottom:18px;
}

.solicitudes-create-title{
  margin:10px 0 0;
  font-size:34px;
  line-height:1.08;
  letter-spacing:-.02em;
}

.solicitudes-form-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:18px 22px;
  align-items:start;
}

.solicitudes-field{
  display:grid;
  gap:8px;
  min-width:0;
}

.solicitudes-field .label-text{
  margin-bottom:0;
  font-size:11px;
  line-height:1.2;
  letter-spacing:.18em;
}

.solicitudes-control{
  min-height:60px;
  border-radius:18px;
  padding:14px 16px;
  font-size:15px;
}

.solicitudes-create-actions{
  margin-top:22px;
  gap:12px;
}

.solicitudes-btn-main,
.solicitudes-btn-alt{
  min-height:52px;
  padding:0 22px;
  border-radius:18px;
  font-size:15px;
}

.solicitudes-process-head,
.solicitudes-done-head{
  align-items:flex-end;
  gap:16px;
}

.solicitudes-terminal-toolbar{
  align-items:flex-end;
  gap:12px;
}

.solicitudes-search{
  min-height:48px;
}

@media (max-width:1200px){
  .solicitudes-create-title{
    font-size:30px;
  }

  .solicitudes-form-grid{
    gap:16px 18px;
  }
}

@media (max-width:980px){
  .solicitudes-form-grid{
    grid-template-columns:1fr;
  }

  .solicitudes-process-head,
  .solicitudes-done-head{
    align-items:stretch;
  }

  .solicitudes-terminal-toolbar{
    width:100%;
    align-items:stretch;
  }

  .solicitudes-btn-main,
  .solicitudes-btn-alt{
    width:100%;
    justify-content:center;
  }
}

@media (max-width:760px){
  .solicitudes-create-card{
    padding:18px;
  }

  .solicitudes-create-title{
    font-size:28px;
  }

  .solicitudes-create-actions{
    grid-template-columns:1fr;
  }

  .solicitudes-create-actions .btn{
    width:100%;
  }
}

/* =========================
   Bandeja CFDI
   ========================= */
.bandeja-actions-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(88px, 1fr));
  gap:8px;
  min-width:190px;
}

.bandeja-action-btn{
  min-height:34px;
  padding:6px 10px;
  font-size:12px;
  border-radius:12px;
  justify-content:center;
}

.uuid-cell{
  display:grid;
  gap:4px;
  min-width:220px;
}

.monto-stack{
  display:grid;
  gap:4px;
  min-width:160px;
  font-size:12px;
  line-height:1.35;
}

@media (max-width:980px){
  .bandeja-actions-grid{
    grid-template-columns:1fr 1fr;
    min-width:160px;
  }
}

@media (max-width:760px){
  .bandeja-actions-grid{
    grid-template-columns:1fr;
  }
}

/* =========================
   Bandeja CFDI - ajuste visual responsive
   ========================= */

.table-wrap{
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table{
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.table-wrap th,
.table-wrap td{
  padding: 12px 10px;
  vertical-align: middle;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.table-wrap thead th{
  font-size: 12px;
  line-height: 1.1;
}

/* Solo para la tabla principal de bandeja */
#rows td:nth-child(1){ width: 18%; }  /* UUID */
#rows td:nth-child(2){ width: 7%; }   /* Fecha */
#rows td:nth-child(3){ width: 7%; }   /* Origen */
#rows td:nth-child(4){ width: 7%; }   /* Tipo */
#rows td:nth-child(5){ width: 13%; }  /* Emisor */
#rows td:nth-child(6){ width: 13%; }  /* Receptor */
#rows td:nth-child(7){ width: 10%; }  /* Relaciones */
#rows td:nth-child(8){ width: 10%; }  /* Cancelabilidad */
#rows td:nth-child(9){ width: 6%; }   /* Método */
#rows td:nth-child(10){ width: 8%; }  /* Estatus SAT */
#rows td:nth-child(11){ width: 11%; } /* Total */
#rows td:nth-child(12){ width: 12%; } /* Acciones */

.uuid-cell{
  display: grid;
  gap: 3px;
  min-width: 0;
}

.uuid-cell .mono{
  font-size: 12px;
  line-height: 1.25;
}

.uuid-cell .muted{
  font-size: 11px;
  line-height: 1.2;
}

.monto-stack{
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 12px;
  line-height: 1.25;
}

.status-stack{
  display: grid;
  gap: 4px;
  justify-items: start;
  min-width: 0;
}

.status-stack .muted{
  font-size: 11px;
  line-height: 1.1;
  white-space: nowrap;
}

.bandeja-actions-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  gap: 6px;
  min-width: 0;
}

.bandeja-action-btn{
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.1;
  border-radius: 12px;
  justify-content: center;
  text-align: center;
}

#rows .chip{
  font-size: 11px;
  line-height: 1.15;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  white-space: normal;
}

@media (max-width: 1440px){
  .table-wrap th,
  .table-wrap td{
    padding: 10px 8px;
  }

  .bandeja-action-btn{
    min-height: 30px;
    font-size: 11px;
    padding: 5px 7px;
  }

  .monto-stack{
    font-size: 11px;
  }

  .uuid-cell .mono{
    font-size: 11px;
  }
}

@media (max-width: 1280px){
  .table-wrap{
    overflow-x: auto;
  }

  .table-wrap table{
    min-width: 1220px;
  }
}

@media (max-width: 980px){
  .table-wrap table{
    min-width: 1160px;
  }

  .bandeja-actions-grid{
    grid-template-columns: repeat(2, minmax(68px, 1fr));
    gap: 5px;
  }
}

.login-hero{
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  min-height:100vh;
}

.hero-copy{
  max-width:720px;
}

.eyebrow{
  display:inline-block;
  margin-bottom:14px;
  font-size:13px;
  font-weight:800;
  letter-spacing:.28em;
  text-transform:uppercase;
}

.hero-copy h1{
  margin:0 0 14px;
  font-size:52px;
  line-height:1.05;
  font-weight:800;
  letter-spacing:-.03em;
}

.hero-lead{
  margin:0 0 16px;
  font-size:22px;
  line-height:1.4;
  font-weight:700;
  color:#dbeafe;
}

.hero-text{
  max-width:760px;
  margin:0;
  font-size:18px;
  line-height:1.75;
  color:rgba(248,250,252,.82);
}

.hero-cards{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:18px;
  margin-top:42px;
}

.info-card{
  padding:22px 22px 20px;
  border:1px solid rgba(255,255,255,.16);
  border-radius:22px;
  background:rgba(255,255,255,.08);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  box-shadow:0 14px 40px rgba(0,0,0,.18);
}

.info-eyebrow{
  margin-bottom:10px;
  font-size:12px;
  font-weight:800;
  letter-spacing:.22em;
  text-transform:uppercase;
  color:#a5f3fc;
}

.info-card h3{
  margin:0 0 10px;
  font-size:18px;
  line-height:1.35;
  font-weight:800;
  color:#fff;
}

.info-card p{
  margin:0;
  font-size:15px;
  line-height:1.65;
  color:rgba(248,250,252,.82);
}

@media (max-width: 1100px){
  .hero-cards{
    grid-template-columns:1fr;
  }

  .hero-copy h1{
    font-size:42px;
  }

  .hero-lead{
    font-size:20px;
  }

  .hero-text{
    font-size:17px;
  }
}

@media (max-width: 640px){
  .hero-copy h1{
    font-size:34px;
  }

  .hero-lead{
    font-size:18px;
  }

  .hero-text{
    font-size:16px;
    line-height:1.65;
  }

  .info-card{
    padding:18px;
    border-radius:18px;
  }
}

/* =========================
   Resumen CFDI - homologación MXN
   ========================= */
.resumen-head{align-items:flex-end;}

/* =========================
   Detalle CFDI
   ========================= */
.detalle-toolbar-row{align-items:flex-end;}
.detalle-print-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;}
.mini-kpi{border:1px solid var(--line);border-radius:18px;padding:14px 16px;background:#fff;}
.kpi-value{margin-top:8px;font-size:20px;font-weight:700;line-height:1.2;}
.factura-header{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 18px;padding:14px 16px;border:1px solid var(--line);border-radius:18px;background:var(--panel2);}
.factura-box{border:1px solid var(--line);border-radius:18px;padding:16px;background:#fff;}
.factura-totales{border:1px solid var(--line);border-radius:18px;padding:14px 16px;background:#fff;}
.factura-total-row{display:flex;justify-content:space-between;gap:16px;padding:8px 0;border-bottom:1px solid var(--line);}
.factura-total-row:last-child{border-bottom:none;}
.factura-total-row.grand{font-size:18px;}
.detalle-main-split{grid-template-columns:1.15fr .85fr;}

/* =========================
   Bandeja CFDI - acciones extendidas
   ========================= */
.bandeja-top-actions{justify-content:flex-end;}
.bandeja-actions-grid-5{grid-template-columns:repeat(2,minmax(76px,1fr));}
.bandeja-actions-grid-5 .bandeja-action-btn:first-child,
.bandeja-actions-grid-5 .bandeja-action-btn:nth-child(2){font-weight:700;}

/* =========================
   Impresión CFDI / PDF desde ficha
   ========================= */
@media (max-width:1200px){
  .detalle-print-kpis{grid-template-columns:repeat(2,minmax(0,1fr));}
  .detalle-main-split{grid-template-columns:1fr;}
}
@media (max-width:760px){
  .detalle-print-kpis,.factura-header{grid-template-columns:1fr;}
  .detalle-toolbar-row,.bandeja-head-row{align-items:stretch;}
  .bandeja-top-actions{justify-content:flex-start;}
}
@media print{
  html,body{background:#fff !important;}
  .sidebar,.topbar,.no-print,.toast{display:none !important;}
  .layout{display:block !important;}
  .main,.content{padding:0 !important;margin:0 !important;}
  .card,.mini-kpi,.factura-box,.factura-header,.factura-totales,.table-wrap{box-shadow:none !important;background:#fff !important;}
  .card{border:1px solid #d0d7e2 !important;border-radius:0 !important;break-inside:avoid;}
  .detalle-print-sheet{break-inside:avoid;page-break-inside:avoid;}
  .stack,.split{gap:10px !important;}
  .table-wrap{overflow:visible !important;}
  table{font-size:11px !important;}
  .pre{white-space:pre-wrap;word-break:break-word;border:1px solid #d0d7e2;color:#111827;background:#fff;}
}

/* =========================
   Resumen CFDI - ajuste visual de importes por moneda
   ========================= */
#importesPorMoneda .grid-4{
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:16px;
}

#importesPorMoneda .mini-stat{
  min-height:158px;
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
  overflow:hidden;
}

#importesPorMoneda .mini-stat-v{
  font-size:18px;
  line-height:1.18;
  letter-spacing:-.01em;
  word-break:break-word;
  overflow-wrap:anywhere;
}

#importesPorMoneda .mini-stat-h{
  line-height:1.35;
}

#importesPorMoneda .mini-stat-v .currency,
#importesPorMoneda .currency{
  display:block;
  margin-top:4px;
  font-size:13px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:#475569;
}

#importesPorMoneda .hero-note{
  margin-top:2px;
}

@media (max-width:1280px){
  #importesPorMoneda .grid-4{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  #importesPorMoneda .mini-stat-v{
    font-size:17px;
  }
}

@media (max-width:760px){
  #importesPorMoneda .grid-4{
    grid-template-columns:1fr;
  }

  #importesPorMoneda .mini-stat{
    min-height:auto;
  }

  #importesPorMoneda .mini-stat-v{
    font-size:16px;
  }
}

/* =========================
   Resumen CFDI - panel ejecutivo nuevo
   ========================= */
.ejecutivo-layout{
  display:grid;
  grid-template-columns:1.15fr .95fr .95fr;
  gap:18px;
  align-items:start;
}

.ejecutivo-col{
  border:1px solid var(--line);
  border-radius:22px;
  padding:18px;
  background:#fff;
  min-width:0;
}

.ejecutivo-col h3{
  margin:0 0 14px;
  font-size:18px;
  line-height:1.25;
}

.ejecutivo-col-main{
  background:linear-gradient(180deg,#ffffff 0%, #f8fafc 100%);
}

.ejecutivo-stats-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
  margin-top:14px;
}

.ejecutivo-stats-grid-compact{
  grid-template-columns:1fr;
}

.ejecutivo-stats-grid .mini-stat,
.ejecutivo-stats-grid-compact .mini-stat{
  min-height:132px;
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
  overflow:hidden;
}

.ejecutivo-stats-grid .mini-stat-v,
.ejecutivo-stats-grid-compact .mini-stat-v{
  font-size:18px;
  line-height:1.18;
  letter-spacing:-.01em;
  word-break:break-word;
  overflow-wrap:anywhere;
}

.ejecutivo-stats-grid .currency,
.ejecutivo-stats-grid-compact .currency{
  display:block;
  margin-top:4px;
  font-size:13px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:#475569;
}

/* =========================
   Resumen CFDI - desglose ejecutivo
   ========================= */
.desglose-ejecutivo-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
}

.desglose-panel{
  border:1px solid var(--line);
  border-radius:28px;
  padding:20px;
  background:#fff;
}

.desglose-panel h3{
  margin:0 0 16px;
  font-size:18px;
  line-height:1.2;
  letter-spacing:.02em;
}

.desglose-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}

.desglose-metric{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  min-height:54px;
  padding:12px 16px;
  border:1px solid var(--line);
  border-radius:18px;
  background:#f8fafc;
}

.desglose-metric span{
  color:#6b7280;
  font-weight:700;
  font-size:12px;
  letter-spacing:.02em;
}

.desglose-metric strong{
  color:#0f172a;
  font-size:18px;
  line-height:1.15;
  text-align:right;
}

.desglose-metric.dual{
  align-items:flex-start;
}

.desglose-metric.dual strong{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.desglose-sub{
  display:block;
  color:#64748b;
  font-size:12px;
  font-weight:700;
}

/* =========================
   Responsive resumen ejecutivo
   ========================= */
@media (max-width:1400px){
  .ejecutivo-layout{
    grid-template-columns:1fr;
  }

  .ejecutivo-stats-grid-compact{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width:1200px){
  .desglose-ejecutivo-grid{
    grid-template-columns:1fr;
  }
}

@media (max-width:760px){
  .ejecutivo-stats-grid,
  .ejecutivo-stats-grid-compact,
  .desglose-grid{
    grid-template-columns:1fr;
  }

  .desglose-metric,
  .desglose-metric.dual{
    flex-direction:column;
    align-items:flex-start;
  }

  .desglose-metric strong{
    text-align:left;
  }
}

/* =========================
   Resumen CFDI - moneda inline para USD
   ========================= */
.inline-currency{
  display:flex;
  align-items:baseline;
  gap:8px;
  flex-wrap:wrap;
}

.currency-inline{
  font-size:.82em;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:#475569;
}

.ejecutivo-stats-grid .mini-stat-v.inline-currency,
.ejecutivo-stats-grid-compact .mini-stat-v.inline-currency{
  font-size:18px;
  line-height:1.18;
}

.ejecutivo-stats-grid .mini-stat-v.inline-currency .currency-inline,
.ejecutivo-stats-grid-compact .mini-stat-v.inline-currency .currency-inline{
  margin-top:0;
}

@media (max-width:760px){
  .inline-currency{
    gap:6px;
  }
}

/* =========================
   Resumen CFDI - compactación vertical fuerte
   ========================= */
.ejecutivo-layout{
  gap:10px;
}

.ejecutivo-col{
  padding:14px;
  border-radius:18px;
}

.ejecutivo-col h3{
  margin:0 0 10px;
  font-size:17px;
  line-height:1.2;
}

.ejecutivo-stats-grid,
.ejecutivo-stats-grid-compact{
  gap:10px;
  margin-top:10px;
}

.ejecutivo-stats-grid .mini-stat,
.ejecutivo-stats-grid-compact .mini-stat{
  min-height:92px;
  padding:10px 12px;
  border-radius:16px;
}

.ejecutivo-stats-grid .mini-stat-k,
.ejecutivo-stats-grid-compact .mini-stat-k{
  font-size:11px;
}

.ejecutivo-stats-grid .mini-stat-v,
.ejecutivo-stats-grid-compact .mini-stat-v{
  margin-top:2px;
  font-size:16px;
  line-height:1.1;
}

.ejecutivo-stats-grid .mini-stat-h,
.ejecutivo-stats-grid-compact .mini-stat-h{
  margin-top:2px;
  font-size:11px;
  line-height:1.2;
}

.inline-currency{
  gap:6px;
}

.currency-inline{
  font-size:.78em;
}

.ejecutivo-col .hero-note{
  margin-top:8px;
  padding:8px 10px;
  font-size:12px;
  line-height:1.3;
}

@media (max-width:760px){
  .ejecutivo-stats-grid .mini-stat,
  .ejecutivo-stats-grid-compact .mini-stat{
    min-height:auto;
  }
}

/* =========================
   Detalle CFDI - depuración de impresión
   ========================= */
.detalle-cfdi-page{
  gap:12px;
}

.detalle-print-hero h1{
  margin:4px 0 0;
  font-size:30px;
  line-height:1.05;
}

.detalle-print-topline{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
}

.detalle-print-statuses{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.factura-header-main{
  grid-template-columns:repeat(3,minmax(0,1fr));
}

.detalle-emisor-receptor{
  grid-template-columns:1fr 1fr;
}

.detalle-main-split{
  grid-template-columns:1.25fr .75fr;
  gap:14px;
}

.detalle-side-stack{
  gap:12px;
}

.detalle-side-card h2,
.detalle-factura-card h2{
  margin-bottom:8px;
}

.detalle-sat-badges{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.detalle-side-table table th{
  width:38%;
}

.detalle-conceptos-table table th:nth-child(1){width:6%;}
.detalle-conceptos-table table th:nth-child(2){width:12%;}
.detalle-conceptos-table table th:nth-child(3){width:10%;}
.detalle-conceptos-table table th:nth-child(4){width:10%;}
.detalle-conceptos-table table th:nth-child(5){width:34%;}
.detalle-conceptos-table table th:nth-child(6){width:9%;}
.detalle-conceptos-table table th:nth-child(7){width:9%;}
.detalle-conceptos-table table th:nth-child(8){width:10%;}

@media (max-width:1100px){
  .factura-header-main{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .detalle-main-split,
  .detalle-emisor-receptor{
    grid-template-columns:1fr;
  }
}

@media (max-width:760px){
  .detalle-print-topline{
    flex-direction:column;
  }

  .factura-header-main{
    grid-template-columns:1fr;
  }
}

@media print{
  @page{
    size:auto;
    margin:10mm;
  }

  html,body{
    background:#fff !important;
    color:#111827 !important;
    font-family:Arial, Helvetica, sans-serif !important;
  }

  .sidebar,
  .topbar,
  .no-print,
  .toast{
    display:none !important;
  }

  .layout{
    display:block !important;
  }

  .main,
  .content{
    padding:0 !important;
    margin:0 !important;
  }

  .detalle-cfdi-page{
    gap:8px !important;
  }

  .card,
  .mini-kpi,
  .factura-box,
  .factura-header,
  .factura-totales,
  .table-wrap{
    box-shadow:none !important;
    background:#fff !important;
  }

  .card{
    border:1px solid #d0d7e2 !important;
    border-radius:0 !important;
    break-inside:avoid;
    page-break-inside:avoid;
    padding:10px 12px !important;
  }

  .detail-print-hero,
  .detalle-print-sheet{
    break-inside:avoid;
    page-break-inside:avoid;
  }

  .eyebrow,
  .card .eyebrow,
  .label-text{
    letter-spacing:.08em !important;
    word-spacing:normal !important;
    font-size:9px !important;
    margin-bottom:6px !important;
  }

  .detalle-print-hero h1{
    font-size:20px !important;
    margin:0 !important;
  }

  .detail-print-topline,
  .detalle-print-topline{
    gap:8px !important;
  }

  .detalle-print-statuses{
    justify-content:flex-start !important;
    gap:6px !important;
  }

  .chip{
    font-size:10px !important;
    padding:3px 8px !important;
  }

  .factura-header-main{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:6px 12px !important;
    padding:8px 10px !important;
    border-radius:0 !important;
  }

  .detalle-emisor-receptor{
    grid-template-columns:1fr 1fr !important;
    gap:10px !important;
  }

  .factura-box,
  .factura-totales{
    border-radius:0 !important;
    padding:10px !important;
  }

  .detalle-main-split{
    grid-template-columns:1fr .62fr !important;
    gap:10px !important;
    align-items:start !important;
  }

  .detalle-side-stack{
    gap:8px !important;
  }

  .detalle-side-card{
    padding:8px 10px !important;
  }

  .detalle-side-card h2,
  .detalle-factura-card h2{
    font-size:15px !important;
    line-height:1.15 !important;
    margin:0 0 6px !important;
  }

  .detalle-conceptos-card h2{
    font-size:15px !important;
    margin:0 0 6px !important;
  }

  .factura-total-row{
    padding:5px 0 !important;
  }

  .factura-total-row.grand{
    font-size:16px !important;
  }

  .table-wrap{
    overflow:visible !important;
    border-radius:0 !important;
    border:1px solid #d0d7e2 !important;
  }

  table{
    font-size:10px !important;
    width:100% !important;
  }

  th,td{
    padding:5px 6px !important;
    border-bottom:1px solid #d0d7e2 !important;
  }

  thead th{
    background:#f8fafc !important;
    color:#334155 !important;
    font-size:9px !important;
    letter-spacing:0 !important;
    white-space:normal !important;
  }

  .mono{
    word-break:break-all !important;
    font-size:9px !important;
  }

  .muted,
  .mini-stat-h{
    color:#475569 !important;
    font-size:10px !important;
  }

  .hero-note{
    font-size:10px !important;
    line-height:1.3 !important;
    padding:8px 10px !important;
    border-radius:0 !important;
  }

  .pre{
    white-space:pre-wrap;
    word-break:break-word;
    border:1px solid #d0d7e2;
    color:#111827;
    background:#fff;
  }

  .detalle-toolbar-card{
    display:none !important;
  }

  .detalle-conceptos-table,
  .detalle-side-table{
    break-inside:avoid;
    page-break-inside:avoid;
  }
}

.factura-header-secondary{
  grid-template-columns:repeat(3,minmax(0,1fr));
}

@media print{
  .factura-header-main{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }

  .factura-header-secondary{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  }
}

/* =========================
   Detalle CFDI - ajuste fino visual de cabecera
   ========================= */
.detalle-print-hero{
  padding-top:14px;
  padding-bottom:14px;
}

.detalle-print-hero h1{
  font-size:24px;
  line-height:1.02;
  margin:2px 0 0;
  letter-spacing:-.02em;
}

.detalle-print-topline{
  align-items:flex-start;
  margin-bottom:6px;
}

.detalle-print-statuses{
  gap:6px;
}

.factura-header-main,
.factura-header-secondary{
  padding:10px 14px;
  gap:8px 18px;
}

.factura-header-main div,
.factura-header-secondary div{
  line-height:1.25;
}

.factura-header-main strong,
.factura-header-secondary strong{
  font-weight:800;
}

@media print{
  .detalle-print-hero{
    padding:8px 10px !important;
  }

  .detalle-print-hero h1{
    font-size:16px !important;
    line-height:1 !important;
    margin:0 !important;
    letter-spacing:0 !important;
  }

  .detalle-print-topline{
    margin-bottom:4px !important;
    gap:6px !important;
  }

  .detalle-print-statuses{
    gap:4px !important;
  }

  .factura-header-main,
  .factura-header-secondary{
    padding:6px 8px !important;
    gap:4px 12px !important;
    margin-top:6px !important;
  }

  .factura-header-main div,
  .factura-header-secondary div{
    font-size:10px !important;
    line-height:1.15 !important;
  }

  .factura-header-main strong,
  .factura-header-secondary strong{
    font-weight:700 !important;
  }

  .chip{
    font-size:9px !important;
    padding:2px 7px !important;
  }
}

/* =========================
   Detalle CFDI - fix real de cabecera print
   ========================= */
@media print{
  .detalle-print-topline{
    display:block !important;
    margin-bottom:6px !important;
  }

  .detalle-print-statuses{
    display:flex !important;
    justify-content:flex-start !important;
    gap:4px !important;
    flex-wrap:wrap !important;
    margin-top:6px !important;
  }

  .factura-header-main,
  .factura-header-secondary{
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:2px !important;
    padding:6px 8px !important;
    margin-top:6px !important;
  }

  .factura-header-main div,
  .factura-header-secondary div{
    display:block !important;
    font-size:10px !important;
    line-height:1.2 !important;
    white-space:normal !important;
    word-break:break-word !important;
    overflow-wrap:anywhere !important;
  }

  .factura-header-main strong,
  .factura-header-secondary strong{
    display:inline !important;
  }

  .detalle-print-hero{
    padding:8px !important;
  }

  .detalle-print-hero h1{
    font-size:16px !important;
    line-height:1 !important;
    margin:0 !important;
  }

  .chip{
    font-size:9px !important;
    padding:2px 6px !important;
  }
}

/* =========================
   Detalle CFDI - formato más estructurado
   ========================= */
.detalle-print-hero{
  border-radius:18px;
}

.detalle-print-hero .eyebrow{
  font-size:11px;
  letter-spacing:.22em;
  margin-bottom:8px;
  color:#64748b;
}

.detalle-print-hero h1{
  font-size:26px;
  line-height:1.02;
  margin:0;
  font-weight:800;
  letter-spacing:-.02em;
}

.detalle-print-statuses .chip{
  font-size:12px;
  padding:6px 12px;
  border-radius:999px;
}

.factura-header-main,
.factura-header-secondary{
  border-radius:18px;
  padding:12px 16px;
  gap:10px 20px;
}

.factura-header-main div,
.factura-header-secondary div{
  font-size:14px;
  line-height:1.3;
  color:#1f2937;
}

.factura-header-main strong,
.factura-header-secondary strong{
  font-size:15px;
  font-weight:800;
  color:#0f172a;
}

.detalle-factura-card .eyebrow,
.detalle-side-card .eyebrow,
.detalle-conceptos-card .eyebrow{
  font-size:10px;
  letter-spacing:.2em;
  margin-bottom:6px;
}

.detalle-factura-card h2,
.detalle-side-card h2,
.detalle-conceptos-card h2{
  font-size:20px;
  line-height:1.15;
  margin:0 0 10px;
}

.factura-box{
  border-radius:18px;
  padding:14px 16px;
}

.factura-box strong{
  font-weight:800;
}

.detalle-conceptos-table table{
  font-size:12px;
}

.detalle-conceptos-table thead th{
  font-size:11px;
  font-weight:800;
  color:#475569;
  background:#f8fafc;
}

.detalle-conceptos-table tbody td{
  font-size:12px;
  line-height:1.25;
}

.detalle-observacion-box{
  min-height:auto;
}

.detalle-observacion-box p{
  font-size:13px;
  line-height:1.45;
}

.factura-totales{
  border-radius:18px;
  padding:12px 16px;
}

.factura-total-row{
  font-size:14px;
  line-height:1.3;
}

.factura-total-row strong{
  font-weight:800;
}

.factura-total-row.grand{
  font-size:18px;
  padding-top:10px;
}

.factura-total-row.grand strong{
  font-size:20px;
}

.detalle-side-table table{
  font-size:12px;
}

.detalle-side-table thead th,
.detalle-side-table tbody th{
  font-size:11px;
  font-weight:800;
  color:#475569;
}

@media print{
  .detalle-print-hero{
    border-radius:0 !important;
    padding:8px 10px !important;
  }

  .detalle-print-hero .eyebrow{
    font-size:8px !important;
    letter-spacing:.14em !important;
    margin-bottom:4px !important;
    color:#475569 !important;
  }

  .detalle-print-hero h1{
    font-size:15px !important;
    line-height:1 !important;
    margin:0 !important;
    font-weight:800 !important;
  }

  .detalle-print-statuses .chip{
    font-size:8px !important;
    padding:2px 7px !important;
    border-radius:999px !important;
  }

  .factura-header-main,
  .factura-header-secondary{
    border-radius:0 !important;
    padding:6px 8px !important;
    gap:3px !important;
  }

  .factura-header-main div,
  .factura-header-secondary div{
    font-size:10px !important;
    line-height:1.18 !important;
    color:#111827 !important;
  }

  .factura-header-main strong,
  .factura-header-secondary strong{
    font-size:10px !important;
    font-weight:700 !important;
  }

  .detalle-factura-card .eyebrow,
  .detalle-side-card .eyebrow,
  .detalle-conceptos-card .eyebrow{
    font-size:8px !important;
    letter-spacing:.12em !important;
    margin-bottom:3px !important;
  }

  .detalle-factura-card h2,
  .detalle-side-card h2,
  .detalle-conceptos-card h2{
    font-size:13px !important;
    line-height:1.1 !important;
    margin:0 0 5px !important;
  }

  .factura-box{
    padding:8px !important;
  }

  .factura-box,
  .factura-totales,
  .table-wrap{
    border-radius:0 !important;
  }

  .factura-box div,
  .factura-box strong{
    font-size:10px !important;
    line-height:1.2 !important;
  }

  .detalle-conceptos-table table,
  .detalle-side-table table{
    font-size:9px !important;
  }

  .detalle-conceptos-table thead th,
  .detalle-side-table thead th,
  .detalle-side-table tbody th{
    font-size:8px !important;
    font-weight:700 !important;
  }

  .detalle-conceptos-table tbody td,
  .detalle-side-table tbody td{
    font-size:9px !important;
    line-height:1.15 !important;
  }

  .detalle-observacion-box p{
    font-size:9px !important;
    line-height:1.25 !important;
    margin-top:4px !important;
  }

  .factura-totales{
    padding:8px 10px !important;
  }

  .factura-total-row{
    font-size:10px !important;
    line-height:1.2 !important;
    padding:4px 0 !important;
  }

  .factura-total-row strong{
    font-size:10px !important;
    font-weight:700 !important;
  }

  .factura-total-row.grand{
    font-size:12px !important;
    padding-top:6px !important;
  }

  .factura-total-row.grand strong{
    font-size:13px !important;
    font-weight:800 !important;
  }
}

/* =========================
   Bandeja CFDI - ajuste de layout tabla
   ========================= */
.bandeja-table-wrap{
  overflow-x:auto;
  overflow-y:hidden;
}

.bandeja-table{
  min-width:1680px;
  table-layout:fixed;
}

.bandeja-table th,
.bandeja-table td{
  vertical-align:top;
}

.bandeja-table th:nth-child(1),
.bandeja-table td:nth-child(1){width:170px;}   /* UUID */
.bandeja-table th:nth-child(2),
.bandeja-table td:nth-child(2){width:95px;}    /* Fecha */
.bandeja-table th:nth-child(3),
.bandeja-table td:nth-child(3){width:110px;}   /* Origen */
.bandeja-table th:nth-child(4),
.bandeja-table td:nth-child(4){width:110px;}   /* Tipo */
.bandeja-table th:nth-child(5),
.bandeja-table td:nth-child(5){width:170px;}   /* Emisor */
.bandeja-table th:nth-child(6),
.bandeja-table td:nth-child(6){width:170px;}   /* Receptor */
.bandeja-table th:nth-child(7),
.bandeja-table td:nth-child(7){width:160px;}   /* Relaciones */
.bandeja-table th:nth-child(8),
.bandeja-table td:nth-child(8){width:165px;}   /* Cancelabilidad */
.bandeja-table th:nth-child(9),
.bandeja-table td:nth-child(9){width:90px;}    /* Método */
.bandeja-table th:nth-child(10),
.bandeja-table td:nth-child(10){width:180px;}  /* Estatus SAT */
.bandeja-table th:nth-child(11),
.bandeja-table td:nth-child(11){width:170px;}  /* Total */
.bandeja-table th:nth-child(12),
.bandeja-table td:nth-child(12){width:150px;}  /* Acciones */

.bandeja-table .chip,
.bandeja-table .status-badge{
  white-space:normal;
  word-break:break-word;
}

.chip-compact{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  max-width:100%;
  font-size:12px;
  line-height:1.15;
  padding:6px 10px;
  text-align:center;
}

.status-stack-compact{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}

.status-stack-compact .muted{
  font-size:12px;
  line-height:1.2;
}

.monto-stack-compact{
  display:flex;
  flex-direction:column;
  gap:4px;
  font-size:13px;
  line-height:1.2;
}

.monto-stack-compact div{
  display:flex;
  justify-content:space-between;
  gap:8px;
}

.monto-stack-compact span{
  color:#64748b;
  white-space:nowrap;
}

.monto-stack-compact strong{
  text-align:right;
  white-space:nowrap;
}

.monto-stack-compact .monto-total-line{
  padding-top:2px;
  border-top:1px dashed #dbe2ea;
}

.uuid-cell .mono{
  word-break:break-word;
}

.bandeja-actions-grid{
  gap:8px;
}

.bandeja-actions-grid .btn{
  white-space:normal;
  line-height:1.15;
  min-height:38px;
}

@media (max-width:1200px){
  .bandeja-table{
    min-width:1600px;
  }
}

.uuid-cell .mono{
  word-break: break-word;
}

.status-stack,
.monto-stack{
  line-height: 1.25;
}

.bandeja-actions-grid .btn{
  white-space: normal;
}

/* =======================================================================
   KOGU ASISTENCIAS — Componentes globales
   Clases usadas en todas las páginas: modales, botones, formularios, tabla
   ======================================================================= */

/* ── Modal box ─────────────────────────────────────────────────────────── */
.modal-box{
  width:min(540px,94vw);
  max-height:90vh;
  overflow-y:auto;
  background:#fff;
  border:1px solid #e2e8f0;
  border-radius:22px;
  box-shadow:0 20px 40px rgba(15,23,42,.18);
}

.modal-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:16px 24px;
  border-bottom:1px solid #f1f5f9;
}

.modal-title{
  font-size:15px;
  font-weight:700;
  color:#0f172a;
  margin:0;
}

.modal-close{
  width:28px;
  height:28px;
  border-radius:50%;
  border:none;
  background:#f1f5f9;
  cursor:pointer;
  font-size:16px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#64748b;
  flex-shrink:0;
  line-height:1;
}
.modal-close:hover{background:#e2e8f0;color:#0f172a}

.modal-body{
  padding:20px 24px;
}

/* ── Botones ────────────────────────────────────────────────────────────── */
.btn-primary{
  background:#0f172a;
  color:#fff;
  border-color:#0f172a;
}
.btn-primary:hover{background:#1e293b;border-color:#1e293b}

.btn-ghost{
  background:#fff;
  color:#475569;
  border-color:#e2e8f0;
}
.btn-ghost:hover{background:#f8fafc;border-color:#cbd5e1}

.btn-sm{
  padding:5px 10px;
  font-size:12px;
  border-radius:10px;
}

/* ── Formularios ────────────────────────────────────────────────────────── */
.form-group{
  display:flex;
  flex-direction:column;
  gap:5px;
}
.form-group label{
  font-size:12px;
  font-weight:600;
  color:#475569;
}
.form-group--full{grid-column:1/-1}

.form-control{
  height:38px;
  padding:0 12px;
  border-radius:8px;
  border:1px solid #e2e8f0;
  font-size:13px;
  width:100%;
  box-sizing:border-box;
  background:#fff;
  color:#0f172a;
  font-family:inherit;
}
.form-control:focus{
  outline:none;
  border-color:#0891b2;
  box-shadow:0 0 0 3px rgba(8,145,178,.1);
}
textarea.form-control{
  height:auto;
  padding:10px 12px;
  resize:vertical;
}
select.form-control{background:#fff}

.checkbox-item{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:13px;
  cursor:pointer;
  padding:6px 12px;
  border-radius:8px;
  border:1px solid #e2e8f0;
  background:#fff;
}

/* ── Bandeja — skeleton y elementos especiales ─────────────────────────── */
.skeleton-row td{padding:10px 12px}
.skeleton-line{
  height:14px;
  border-radius:4px;
  background:#f1f5f9;
  animation:pulse-skel 1.5s infinite;
}
@keyframes pulse-skel{0%,100%{opacity:1}50%{opacity:.4}}

.folio-link{
  font-family:ui-monospace,monospace;
  font-size:11px;
  font-weight:700;
  color:#0891b2;
  cursor:pointer;
}
.folio-link:hover{text-decoration:underline}

.row-meta{font-size:11px;color:#94a3b8;margin-top:2px}
.canal-icon{font-size:16px;display:inline-block;text-align:center}

/* ── Urgencia row highlight ─────────────────────────────────────────────── */
tr.urgencia-row--critico{background:#fff5f5}
tr.urgencia-row--critico:hover{background:#fee2e2}
tr.urgencia-row--alto{background:#fffbf0}
tr.urgencia-row--alto:hover{background:#fef3c7}
tr.urgencia-row--medio,
tr.urgencia-row--bajo{background:#fff}
tr.urgencia-row--medio:hover,
tr.urgencia-row--bajo:hover{background:#f8fafc}

/* ── Bandeja tabs ───────────────────────────────────────────────────────── */
[data-tab]{
  padding:7px 14px;
  border-radius:999px;
  border:1px solid #e2e8f0;
  background:#fff;
  cursor:pointer;
  font-size:13px;
  font-weight:600;
  color:#475569;
  transition:all .15s;
}
[data-tab].active{background:#0f172a;color:#fff;border-color:#0f172a}
[data-tab]:hover:not(.active){background:#f8fafc}

/* ── Retícula de datos para pantallas de detalle (póliza, cliente, oportunidad) ── */
/* Bloque de sección dentro de una .card. Vivía suelto en detalle.html y
   oportunidad.html (KA-F-14), así que en el panel comercial, la ficha de
   cliente, renovaciones y el detalle de póliza los títulos salían sin
   formato. detalle.html conserva su variante local, más densa, a juego con
   sus overrides de .data-grid/.data-field. */
.data-section{margin-bottom:14px}
.data-section__title{
  font-size:12px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:#475569;
  margin-bottom:14px;
}

.data-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:12px}
.data-field{background:#f8fafc;border:1px solid #eef1f5;border-radius:10px;padding:10px 13px}
.data-field__label{font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:#94a3b8;font-weight:700}
.data-field__value{font-size:13.5px;color:#0f172a;margin-top:4px;font-weight:600;line-height:1.45}
.data-field__value a{color:#0891b2;text-decoration:none;font-weight:700}

/* ── Picker de búsqueda (Bf-07) ────────────────────────────────────────────
   Modal reutilizable que sustituye a los <select> que se llenaban bajando la
   tabla completa. Comparte .modal-box; solo define su lista y el campo que lo
   dispara. */
.picker-box{ width:min(520px,94vw); }

.picker-list{
  margin-top:12px;
  max-height:min(52vh,420px);
  overflow-y:auto;
  border:1px solid #e2e8f0;
  border-radius:12px;
}

.picker-item{
  padding:10px 12px;
  cursor:pointer;
  border-bottom:1px solid #f1f5f9;
}
.picker-item:last-child{ border-bottom:none; }
.picker-item:hover,
.picker-item--activo{ background:#f8fafc; }
.picker-item--activo{ box-shadow:inset 3px 0 0 var(--primary,#2563eb); }

.picker-item__t{ font-weight:600; font-size:13px; color:#0f172a; }
.picker-item__s{ font-size:11px; color:#64748b; margin-top:2px; }

.picker-msg{
  padding:24px 12px;
  text-align:center;
  font-size:13px;
  color:#94a3b8;
}
.picker-msg--error{ color:#dc2626; }

.picker-mas{ display:block; width:100%; border-radius:0 0 12px 12px; }

/* Campo que dispara el picker: input readonly + botón de lupa */
.picker-field{ display:flex; gap:6px; align-items:center; }
.picker-field input[type="text"]{ flex:1; cursor:pointer; background:#fff; }
.picker-field input[type="text"]:disabled{ cursor:not-allowed; background:#f1f5f9; }
