/* El visor real va en un marco independiente. Como en la ilustración del
   expediente, la guía permanece legible y sus controles quedan accesibles. */
.bd-document {
    position: fixed;
    z-index: 34;
    right: 0;
    bottom: 0;
    left: 0;
    top: clamp(8px, var(--bd-dossier-top, 280px), max(8px, calc(100vh - 180px)));
    top: clamp(8px, var(--bd-dossier-top, 280px), max(8px, calc(100dvh - 180px)));
    padding: 10px max(14px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(23 61 54 / 27%);
}
.bd-document[hidden] { display: none; }
.bd-document-panel {
    display: flex;
    flex-direction: column;
    width: min(1160px, 100%);
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--bd-border);
    border-radius: 18px;
    box-shadow: 0 24px 72px rgb(23 61 54 / 25%);
}
.bd-document.is-open { animation: bd-document-backdrop .25s ease both; }
.bd-document.is-open .bd-document-panel { animation: bd-document-enter .35s cubic-bezier(.2, .75, .25, 1) both; }
.bd-document-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 16px;
    background: #eff8f7;
    border-bottom: 1px solid var(--bd-border);
    flex: none;
}
.bd-document-header h2 { margin: 0; color: var(--bd-dark); font-size: 16px; }
.bd-document-header p { margin: 2px 0 0; color: var(--bd-muted); font-size: 12px; }
.bd-document-header button { flex: none; }
.bd-document-frame { display: block; flex: 1 1 auto; width: 100%; min-height: 0; border: 0; background: #f4f6f5; }
#bd-excel-preview { z-index: 42; }
.bd-excel-preview-panel {
    width: min(1320px, 100%);
    height: auto;
    max-height: 100%;
}
.bd-excel-preview-grid { min-height: 0; overflow: auto; }
.bd-excel-preview-grid:focus-visible { outline: 2px solid #176f6d; outline-offset: -2px; }
.bd-excel-preview-table {
    width: 100%;
    min-width: 1080px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    color: var(--bd-dark);
    line-height: 1.4;
    font-size: .8125rem;
}
.bd-excel-preview-table th,
.bd-excel-preview-table td {
    padding: .6rem .7rem;
    border: solid var(--bd-border);
    border-width: 0 1px 1px 0;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}
.bd-excel-preview-table th { position: sticky; top: 0; background: #e1f0e9; }
.bd-excel-preview-table tr:nth-child(even) td { background: #f5faf7; }
.bd-excel-preview-table :is(th, td):last-child { border-right: 0; }
.bd-excel-preview-table tbody tr:last-child td { border-bottom: 0; }
@keyframes bd-document-enter {
    from { transform: scale(.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes bd-document-backdrop {
    from { background-color: rgb(23 61 54 / 0%); }
    to { background-color: rgb(23 61 54 / 27%); }
}
@media (max-width: 700px) {
    .bd-document { padding: 6px; }
    .bd-document-panel { border-radius: 13px; }
    .bd-document-header { padding: 6px 10px; }
    .bd-document-header h2 { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .bd-document.is-open, .bd-document.is-open .bd-document-panel { animation: none; }
}
