/* JH Technology • Workspace documental. No altera formularios, editores, PDF ni impresión. */
.jhtdw-root {
  --jhtdw-accent:#2563eb;
  --jhtdw-accent-rgb:37,99,235;
  --jhtdw-surface:#ffffff;
  --jhtdw-surface-2:#f8fbff;
  --jhtdw-ink:#14253d;
  --jhtdw-muted:#66758b;
  --jhtdw-line:#e4eaf2;
  --jhtdw-soft:#f3f7fb;
  --jhtdw-shadow:0 8px 26px rgba(17,39,70,.05);
  min-width:0;
}
.jhtdw-root[data-jhtdw-kind="factura"] {--jhtdw-accent:#1fb7b2;--jhtdw-accent-rgb:31,183,178;}
.jhtdw-root[data-jhtdw-kind="remision"] {--jhtdw-accent:#6e57cc;--jhtdw-accent-rgb:110,87,204;}
.jhtdw-root[data-jhtdw-kind="cotizacion"] {--jhtdw-accent:#2563eb;--jhtdw-accent-rgb:37,99,235;}

/* Encabezado superior / hero, sin duplicar el título que ya entrega la aplicación. */
.jhtdw-root .jhtdw-hero {
  box-sizing:border-box;
  position:relative;
  isolation:isolate;
  width:100%;
  min-width:0;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  column-gap:24px;
  row-gap:14px;
  margin:0 0 18px;
  padding:22px 25px;
  color:var(--jhtdw-ink);
  background:linear-gradient(112deg,rgba(var(--jhtdw-accent-rgb),.095),#fff 65%,rgba(var(--jhtdw-accent-rgb),.025));
  border:1px solid rgba(var(--jhtdw-accent-rgb),.16);
  border-radius:19px;
  box-shadow:0 6px 24px rgba(17,39,70,.045);
}
.jhtdw-root .jhtdw-hero:before {
  content:"";
  position:absolute;
  z-index:-1;
  top:0;bottom:0;left:0;
  width:4px;
  border-radius:19px 0 0 19px;
  background:var(--jhtdw-accent);
}
.jhtdw-root .jhtdw-title {
  min-width:0;
  max-width:100%;
  margin:0;
  font-weight:750;
  line-height:1.18;
  font-size:clamp(1.25rem,2vw,1.7rem);
  letter-spacing:-.035em;
  color:var(--jhtdw-ink);
  overflow-wrap:anywhere;
}
.jhtdw-root .jhtdw-subtitle {
  max-width:68ch;
  margin:5px 0 0;
  color:var(--jhtdw-muted);
  line-height:1.55;
  font-size:.84rem;
}
.jhtdw-root .jhtdw-hero button,
.jhtdw-root .jhtdw-hero a[role="button"],
.jhtdw-root .jhtdw-actions button,
.jhtdw-root .jhtdw-actions a[role="button"] {
  min-height:34px;
  max-width:100%;
  border-radius:10px;
  font-size:.825rem;
  font-weight:650;
  white-space:normal;
  overflow-wrap:anywhere;
}
.jhtdw-root .jhtdw-actions {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  min-width:0;
  max-width:100%;
}

/* Resumen ejecutivo: números existentes, sin recalcular valores. */
.jhtdw-root .jhtdw-stats {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,185px),1fr));
  gap:11px;
  align-items:stretch;
  min-width:0;
  margin-bottom:18px;
}
.jhtdw-root .jhtdw-stats > .jhtdw-stat {
  min-width:0;
  box-sizing:border-box;
  padding:15px 16px;
  background:var(--jhtdw-surface);
  border:1px solid var(--jhtdw-line);
  border-radius:15px;
  box-shadow:0 4px 15px rgba(20,37,61,.03);
  overflow-wrap:anywhere;
}
.jhtdw-root .jhtdw-stat strong,
.jhtdw-root .jhtdw-stat [class*="value"],
.jhtdw-root .jhtdw-stat [class*="number"] {
  font-size:clamp(1.05rem,1.8vw,1.4rem);
  letter-spacing:-.035em;
  color:var(--jhtdw-ink);
  font-weight:750;
  font-variant-numeric:tabular-nums;
}

/* Búsqueda y filtros: compactos, sin afectar la edición de documentos. */
.jhtdw-root .jhtdw-toolbar {
  box-sizing:border-box;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:9px 11px;
  width:100%;
  min-width:0;
  margin:0 0 14px;
  padding:13px 14px;
  background:var(--jhtdw-surface);
  border:1px solid var(--jhtdw-line);
  border-radius:16px;
  box-shadow:0 4px 18px rgba(17,39,70,.03);
}
.jhtdw-root .jhtdw-toolbar input:not([type="checkbox"]):not([type="radio"]),
.jhtdw-root .jhtdw-toolbar select {
  max-width:100%;
  min-height:35px;
  box-sizing:border-box;
  border-radius:11px;
  font-size:.845rem;
}
.jhtdw-root .jhtdw-toolbar button {
  min-height:34px;
  border-radius:10px;
  font-size:.825rem;
}

/* Tablas y listas de consulta; no toca las tablas del documento / PDF. */
.jhtdw-root .jhtdw-table-scroll {
  box-sizing:border-box;
  max-width:100%;
  overflow-x:auto;
  overflow-y:visible;
  border:1px solid var(--jhtdw-line);
  border-radius:18px;
  background:var(--jhtdw-surface);
  box-shadow:var(--jhtdw-shadow);
  scrollbar-width:thin;
  -webkit-overflow-scrolling:touch;
}
.jhtdw-root .jhtdw-table {
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  font-size:.845rem;
}
.jhtdw-root .jhtdw-table thead th,
.jhtdw-root .jhtdw-table [role="columnheader"] {
  background:#f7fafc;
  color:#61738c;
  font-size:.76rem;
  letter-spacing:.01em;
  text-transform:none;
  font-weight:760;
  border-bottom:1px solid var(--jhtdw-line);
  white-space:nowrap;
}
.jhtdw-root .jhtdw-table th,
.jhtdw-root .jhtdw-table td {
  padding:13px 14px;
  vertical-align:middle;
  border-left:0;
  border-right:0;
  overflow-wrap:anywhere;
}
.jhtdw-root .jhtdw-table tbody tr,
.jhtdw-root .jhtdw-table [role="row"] {
  transition:background-color .18s ease, box-shadow .18s ease;
}
.jhtdw-root .jhtdw-table tbody tr:not(:last-child) td,
.jhtdw-root .jhtdw-table [role="row"]:not(:last-child) [role="cell"] {
  border-bottom:1px solid #eef2f7;
}
.jhtdw-root .jhtdw-table tbody tr:hover {background:rgba(var(--jhtdw-accent-rgb),.028);}
.jhtdw-root .jhtdw-records {display:grid;gap:10px;min-width:0;}
.jhtdw-root .jhtdw-table :is(td,th):last-child {text-align:right;}
.jhtdw-root .jhtdw-table :is(button,a,[role="button"]) {
  border-radius:12px;
}
.jhtdw-root .jhtdw-table [class*="badge"],
.jhtdw-root .jhtdw-table [class*="pill"],
.jhtdw-root .jhtdw-table [class*="chip"],
.jhtdw-root .jhtdw-table [class*="status"] {
  border-radius:999px;
}

/* Vista lista de FACTURA: compacta, tipo celdas, con acciones al extremo derecho. */
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-hero {
  padding:18px 22px;
  margin-bottom:14px;
  border-radius:18px;
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-hero .jhtdw-title {
  font-size:clamp(1.2rem,1.8vw,1.55rem);
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-subtitle {
  max-width:74ch;
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-stats {
  gap:10px;
  margin-bottom:14px;
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-stat {
  padding:13px 14px;
  border-radius:14px;
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-toolbar {
  padding:10px 12px;
  gap:8px 10px;
  border-radius:16px 16px 0 0;
  border-bottom:0;
  box-shadow:none;
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-table-scroll {
  border-radius:0 0 18px 18px;
  box-shadow:var(--jhtdw-shadow);
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-table th,
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-table td {
  padding:15px 16px;
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-table thead th {
  font-size:.8rem;
  background:#f8fbfd;
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-table tbody td {
  font-size:.93rem;
  color:#24364f;
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-table tbody td:nth-last-child(-n+2) {
  white-space:nowrap;
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-table tbody td:last-child {
  min-width:112px;
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-table [class*="status"],
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-table [class*="badge"],
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-table [class*="chip"],
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-table [class*="pill"] {
  display:inline-flex;
  align-items:center;
  gap:6px;
  min-height:30px;
  padding:5px 11px;
  border:1px solid rgba(0,0,0,.06);
  font-size:.82rem;
  font-weight:680;
  background:#fffaf0;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.28);
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-table tbody tr:hover {
  background:linear-gradient(90deg, rgba(var(--jhtdw-accent-rgb),.03), rgba(var(--jhtdw-accent-rgb),.015));
}

/* Menús del LISTADO de Facturación: sin afectar otros apartados de WordPress. */
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] .jhtdw-action-menu,
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] [role="menu"],
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] [class*="dropdown-menu"],
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] [class*="context-menu"] {
  border-radius:16px !important;
  border:1px solid #e5ebf2 !important;
  box-shadow:0 18px 42px rgba(15,23,42,.12) !important;
  background:#fff !important;
}
.jhtdw-root[data-jhtdw-kind="factura"][data-jhtdw-view="list"] :is([role="menu"],[class*="dropdown-menu"],[class*="context-menu"]) :is(button,a,[role="menuitem"]) {
  min-height:42px;
  border-radius:10px !important;
}

/* Modal utilitario de pago / cobro en factura. */
.jhtdw-pay-dialog {
  box-sizing:border-box;
  max-width:min(96vw,1120px);
  border-radius:26px !important;
  overflow:hidden;
  border:1px solid #e8edf3 !important;
  box-shadow:0 22px 70px rgba(15,23,42,.16) !important;
}
.jhtdw-pay-dialog .jhtdw-pay-head {
  padding-bottom:12px;
  margin-bottom:10px;
  border-bottom:1px solid #e7edf4;
}
.jhtdw-pay-dialog :is(h1,h2,h3) {
  letter-spacing:-.03em;
}
.jhtdw-pay-dialog :is(input,select,textarea,button) {
  border-radius:16px !important;
}
.jhtdw-pay-dialog .jhtdw-pay-footer {
  display:flex;
  gap:14px;
  justify-content:space-between;
  flex-wrap:wrap;
  margin-top:14px;
  padding-top:16px;
  border-top:1px solid #e8edf3;
}

/* Vista de documento ya emitido: solo zonas de información exteriores a la hoja. */
.jhtdw-root.jhtdw-detail .jhtdw-hero {margin-bottom:15px;}
.jhtdw-root .jhtdw-detail-meta {
  box-sizing:border-box;
  min-width:0;
  padding:17px 19px;
  margin-bottom:16px;
  border:1px solid var(--jhtdw-line);
  border-radius:15px;
  background:var(--jhtdw-surface);
  box-shadow:0 4px 18px rgba(20,37,61,.035);
}

/* Solo modales de CONSULTA; se excluyen crear, editar, enviar correo, compartir. */
.jhtdw-dialog {
  box-sizing:border-box;
  max-width:min(96vw,1100px);
  border-radius:18px !important;
}
.jhtdw-dialog .jhtdw-dialog-head {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:10px 18px;
  padding-bottom:12px;
  margin-bottom:13px;
  border-bottom:1px solid #e5eaf2;
}
.jhtdw-dialog .jhtdw-dialog-head h1,
.jhtdw-dialog .jhtdw-dialog-head h2,
.jhtdw-dialog .jhtdw-dialog-head h3 {
  margin:0;
  font-size:clamp(1.05rem,1.65vw,1.4rem);
  line-height:1.25;
  overflow-wrap:anywhere;
}
.jhtdw-dialog .jhtdw-dialog-actions {display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px;}

/* Modo limpio: ocultar solo la zona previa al editor de factura. */
.jhtdw-invoice-pre-editor {display:none !important;}

@media (max-width:900px) {
  .jhtdw-root .jhtdw-hero {padding:19px 20px;border-radius:16px;column-gap:14px;}
  .jhtdw-root .jhtdw-stats {grid-template-columns:repeat(2,minmax(0,1fr));}
  .jhtdw-root .jhtdw-actions {justify-content:flex-start;}
}
@media (max-width:620px) {
  .jhtdw-root .jhtdw-hero {
    display:flex;
    flex-direction:column;
    align-items:stretch;
    row-gap:10px;
    padding:15px 16px;
    margin-bottom:13px;
    border-radius:14px;
  }
  .jhtdw-root .jhtdw-title {font-size:1.28rem;line-height:1.22;}
  .jhtdw-root .jhtdw-subtitle {font-size:.8rem;}
  .jhtdw-root .jhtdw-hero > :not(.jhtdw-title):not(.jhtdw-subtitle),
  .jhtdw-root .jhtdw-actions {max-width:100%;}
  .jhtdw-root .jhtdw-actions {justify-content:flex-start;gap:7px;}
  .jhtdw-root .jhtdw-hero button,
  .jhtdw-root .jhtdw-hero a[role="button"] {font-size:.8rem;min-height:33px;}
  .jhtdw-root .jhtdw-stats {grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:12px;}
  .jhtdw-root .jhtdw-stat {padding:12px 10px !important;border-radius:12px !important;}
  .jhtdw-root .jhtdw-stat strong {font-size:1.08rem;}
  .jhtdw-root .jhtdw-toolbar {padding:10px;gap:8px;margin-bottom:0;border-radius:12px 12px 0 0;}
  .jhtdw-root .jhtdw-toolbar input:not([type="checkbox"]):not([type="radio"]),
  .jhtdw-root .jhtdw-toolbar select {flex:1 1 150px;min-width:0;}
  .jhtdw-root .jhtdw-table-scroll {border-radius:0 0 12px 12px;}
  .jhtdw-root .jhtdw-table {min-width:620px;font-size:.8rem;}
  .jhtdw-root .jhtdw-table th,
  .jhtdw-root .jhtdw-table td {padding:10px 10px;}
  .jhtdw-root .jhtdw-detail-meta {padding:13px 12px;margin-bottom:12px;}
  .jhtdw-dialog {max-width:calc(100vw - 16px);border-radius:14px !important;}
  .jhtdw-dialog .jhtdw-dialog-head {gap:8px;}
  .jhtdw-pay-dialog {max-width:calc(100vw - 12px);border-radius:20px !important;}
}

/* Edición de factura: un solo icono de acciones secundarias junto a Guardar.
   Originales permanecen enlazados a los controladores de JH (sin copia de lógica). */
.jhtdw-invoice-action-anchor {
  display:inline-flex;
  vertical-align:middle;
  align-items:center;
  flex:0 0 auto;
  margin-left:6px;
}
.jhtdw-invoice-action-trigger {
  appearance:none;
  box-sizing:border-box;
  width:40px;
  height:40px;
  padding:0;
  display:inline-flex;
  justify-content:center;
  align-items:center;
  border:1px solid #dcdff7;
  border-radius:12px;
  background:#fff !important;
  color:#4838d0 !important;
  cursor:pointer;
  transition:background .16s ease, border-color .16s ease, transform .16s ease;
  box-shadow:0 2px 9px rgba(27,36,83,.04);
}
.jhtdw-invoice-action-trigger:hover,
.jhtdw-invoice-action-trigger[aria-expanded="true"] {
  background:#f3f1ff !important;
  border-color:#ac9efe;
}
.jhtdw-invoice-action-trigger:focus-visible {
  outline:2px solid #6b4df7;
  outline-offset:3px;
}
.jhtdw-invoice-actions-panel {
  box-sizing:border-box;
  position:fixed;
  z-index:2147483000;
  max-width:calc(100vw - 20px);
  max-height:72vh;
  padding:8px;
  display:flex;
  flex-direction:column;
  gap:2px;
  overflow-y:auto;
  border:1px solid #e4e6f3;
  border-radius:16px;
  background:#fff;
  color:#25344b;
  box-shadow:0 18px 42px rgba(24,31,70,.19);
  animation:jhtdw-invoice-actions-in .13s ease-out;
}
@keyframes jhtdw-invoice-actions-in {
  from { opacity:0; transform:translateY(-4px); }
  to { opacity:1; transform:translateY(0); }
}
.jhtdw-invoice-action-option {
  appearance:none;
  box-sizing:border-box;
  width:100%;
  min-height:43px;
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  text-align:left;
  border:0;
  border-radius:10px;
  color:#283952;
  background:transparent;
  font:600 13px/1.35 inherit;
  font-size:13px;
  font-weight:610;
  cursor:pointer;
  transition:background .13s ease;
}
.jhtdw-invoice-action-option:hover,
.jhtdw-invoice-action-option:focus-visible {background:#f5f4ff;outline:none;}
.jhtdw-invoice-action-option svg {flex:0 0 18px;color:#6550d4;}
.jhtdw-invoice-action-option.is-danger {color:#cc3845;}
.jhtdw-invoice-action-option.is-danger svg {color:#dc3545;}
.jhtdw-invoice-action-option.is-danger:hover {background:#fff0f2;}
.jhtdw-invoice-action-option:disabled {opacity:.42;cursor:not-allowed;}
@media (max-width:620px) {
  .jhtdw-invoice-action-anchor {margin-left:3px;}
  .jhtdw-invoice-action-trigger {width:37px;height:37px;border-radius:11px;}
  .jhtdw-invoice-actions-panel {border-radius:14px;}
  .jhtdw-invoice-action-option {min-height:47px;font-size:13px;}
}
@media (prefers-reduced-motion:reduce) {
  .jhtdw-invoice-actions-panel {animation:none;}
  .jhtdw-invoice-action-trigger,.jhtdw-invoice-action-option {transition:none;}
}

/* Modos de entrada. No desmontar ni reinicializar formularios. */
.jhtdw-entry-hidden { display:none !important; }

.jhtdw-root .jhtdw-entry-empty {
  box-sizing:border-box;
  margin-top:15px;
  padding:35px 22px;
  text-align:center;
  background:#fff;
  border:1px solid #e1e9f3;
  border-radius:17px;
  color:#64748b;
  box-shadow:0 5px 22px rgba(19,36,66,.035);
}
.jhtdw-root .jhtdw-entry-empty h3 {margin:0 0 6px;font-size:1rem;font-weight:750;color:#172843;}
.jhtdw-root .jhtdw-entry-empty p {max-width:60ch;margin:0 auto;font-size:.86rem;line-height:1.55;}
@media(max-width:620px) {.jhtdw-root .jhtdw-entry-empty {padding:24px 13px;}}
