.ticket-dialog{box-sizing:border-box;width:min(720px,calc(100% - 24px));max-height:90dvh;border:0;border-radius:16px;padding:0;color:#183b46;background:#fff;box-shadow:0 20px 80px #1236}
.ticket-dialog::backdrop{background:#122e45a8}
.ticket-dialog header,.ticket-dialog footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 24px;background:#f1f7f8}
.ticket-dialog h2{font-size:1.25rem;margin:0}
.ticket-dialog button{border:1px solid #b6ced3;border-radius:8px;padding:10px 16px;background:white;color:#235c6b;font:inherit;cursor:pointer}
.ticket-dialog footer{justify-content:flex-end;flex-wrap:wrap}
.ticket-dialog footer button:first-child{background:#2f7197;color:white;border-color:#2f7197}
.ticket-sheet{padding:8px 24px 24px}
.ticket-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 24px;margin:0}
.ticket-fields>div{padding:14px 0;border-bottom:1px solid #e2ecef;min-width:0}
.ticket-fields dt{font-size:.8rem;color:#56717a;margin-bottom:5px}
.ticket-fields dd{margin:0;font-weight:600;overflow-wrap:anywhere}
@media(max-width:600px){.ticket-fields{grid-template-columns:1fr}.ticket-dialog header,.ticket-dialog footer{padding:16px}.ticket-sheet{padding:0 16px 20px}}
@media print{body:has(.ticket-dialog[open])>*{display:none!important}body:has(.ticket-dialog[open])>.ticket-dialog{display:block!important;position:static;width:100%;max-height:none;overflow:visible;border-radius:0;box-shadow:none}.ticket-dialog header{background:white}.ticket-dialog header button,.ticket-dialog footer{display:none!important}.ticket-fields{grid-template-columns:1fr 1fr}.ticket-dialog::backdrop{background:white}}

.ticket-dialog{width:min(960px,calc(100% - 16px))}
.ticket-sheet:has(.ticket-a5){padding:0;overflow:auto;background:#e5ecef}
.ticket-a5{display:block;width:100%;height:auto;background:white;min-width:0}
@media print{@page{size:A5 landscape;margin:0}.ticket-dialog header,.ticket-dialog footer{display:none!important}.ticket-sheet:has(.ticket-a5){padding:0!important;overflow:visible;background:white}.ticket-a5{width:210mm;height:148mm;max-width:none}body:has(.ticket-dialog[open]){margin:0!important}.ticket-dialog{margin:0!important;padding:0!important}}

.ticket-previous-pdf{display:block;width:100%;height:70vh;border:0}

.ticket-dialog header{justify-content:flex-end}
.ticket-summary{padding:20px 24px;background:#f6fafb;color:#183b46;}
.ticket-summary h2{font-size:22px;margin:0 0 12px;}
.ticket-summary dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 24px;margin:0;}
.ticket-summary dl>div{min-width:0;overflow-wrap:anywhere;}
.ticket-summary dt{font-size:16px;color:#45616a;margin-bottom:4px;}
.ticket-summary dd{font-size:21px;line-height:1.3;font-weight:600;margin:0;}
.ticket-summary .ticket-summary-net{grid-column:1/-1;background:#e0eff3;border-radius:8px;padding:12px;}
.ticket-summary-net dd{font-size:28px;}
@media(max-width:400px){.ticket-summary{padding:18px 16px;}.ticket-summary dl{grid-template-columns:1fr;}}
@media print{.ticket-summary{display:none!important;}}

.ticket-dialog > header { position: sticky; top: 0; z-index: 3; padding: 12px 16px; border-bottom: 1px solid #e2ecef; }
.ticket-dialog .ticket-close-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 0 0 auto; width: auto; min-height: 44px; margin: 0; padding: 9px 13px; border: 1px solid #b6cbd6; border-radius: 8px; background: #fff; color: #2f7197; font-size: 16px; line-height: 1.4; box-shadow: none; transform: none; }
.ticket-close-button svg { width: 18px; height: 18px; flex: 0 0 18px; }
.ticket-dialog .ticket-close-button:hover { background: #f7fbfd; box-shadow: none; transform: none; }
.ticket-dialog .ticket-close-button:focus { outline: none; }
.ticket-dialog .ticket-close-button:focus-visible { outline: none; border-color: #2f7197; }
@media print { .ticket-dialog > header { display: none !important; } }

/* Mantener el tamaño del diálogo mientras llegan los datos y se preparan imágenes. */
.ticket-dialog { height: min(900px, 90dvh); }
.ticket-dialog[open] { display: flex; flex-direction: column; }
.ticket-dialog > header, .ticket-dialog > footer { flex: 0 0 auto; }
.ticket-dialog > .ticket-sheet { flex: 1 1 auto; min-height: 0; overflow: auto; }
.ticket-dialog > footer:empty { display: none; }
.ticket-dialog .ticket-loading { display: flex; align-items: center; justify-content: center; box-sizing: border-box; padding: 24px; }
@media print { .ticket-dialog { height: auto; } .ticket-dialog > .ticket-sheet { overflow: visible; } }
