/* ═══════════════════════════════════════════════════════
   WORKBOOK PREVIEW — full-screen, read-only.
   The app chrome follows the theme; the sheet itself is white paper, as in Excel, so the
   workbook's own fills and fonts read as they will in the file.
   Sizes per breakpoint live in responsive.css.
   ═══════════════════════════════════════════════════════ */

body.wbp-open { overflow: hidden; }

.wb-preview {
    position: fixed;
    inset: 0;
    z-index: 1100;                       /* above the cart drawer and the top controls */
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.wbp-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border-color);
}
.wbp-bar h3 { margin: 0; font-size: 1.05rem; }
.wbp-file { color: var(--text-secondary); font-size: 0.85rem; }
.wbp-options { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-left: auto; font-size: 0.85rem; }
.wbp-options label { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; color: var(--text-secondary); }
.wbp-options input { accent-color: var(--brand-orange); }
.wbp-download {
    height: 36px;
    padding: 0 1rem;
    border: none;
    border-radius: 10px;
    background: var(--brand-orange);
    color: #111111;
    font-weight: 700;
    cursor: pointer;
}
.wbp-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: var(--bg-primary);
    box-shadow: var(--neo-btn);
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
}

.wbp-status {
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
    background: #fff2cc;
    color: #7f6000;
}
.wbp-status:empty { display: none; }

.wbp-tabs { display: flex; gap: 0.25rem; padding: 0.4rem 1rem 0; }
.wbp-tab {
    padding: 0.35rem 1rem;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background: var(--bg-deep);
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
}
.wbp-tab[aria-selected="true"] { background: #ffffff; color: #1a1a1a; }

.wbp-fx {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin: 0 1rem;
    border: 1px solid #c8c8c8;
    background: #ffffff;
    color: #1a1a1a;
    font: 13px/1.4 Calibri, "Segoe UI", sans-serif;
}
.wbp-addr { flex: 0 0 auto; min-width: 5.5rem; padding: 0.3rem 0.6rem; border-right: 1px solid #c8c8c8; font-weight: 700; }
.wbp-formula { flex: 1 1 auto; min-width: 0; padding: 0.3rem 0.6rem; font-family: Consolas, "Courier New", monospace; overflow-wrap: anywhere; }

/* The sheet scrolls in both directions inside its own viewport; the page never does. */
.wbp-sheet {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    margin: 0 1rem 1rem;
    border: 1px solid #c8c8c8;
    background: #ffffff;
}
.wbp-grid {
    border-collapse: collapse;
    table-layout: fixed;
    font: 13px/1.3 Calibri, "Segoe UI", sans-serif;
    color: #000000;
}
.wbp-grid th {
    position: sticky;
    background: #f3f3f3;
    color: #444444;
    font-weight: 600;
    font-size: 12px;
    border: 1px solid #d4d4d4;
    padding: 2px 4px;
    z-index: 1;
}
.wbp-grid thead th { top: 0; z-index: 2; }
.wbp-grid tbody th { left: 0; text-align: center; }
.wbp-grid thead th.wbp-corner { left: 0; z-index: 3; }
.wbp-grid td {
    height: 20px;
    padding: 1px 5px;
    border: 1px solid #e3e3e3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    cursor: cell;
}
.wbp-grid td.num { text-align: right; }
.wbp-grid td.wbp-incomplete { background: #fde68a !important; color: #7c2d12 !important; font-weight: 700; }
.wbp-grid td.wbp-err { background: #fee2e2 !important; color: #991b1b !important; font-weight: 700; }
.wbp-grid td.wbp-sel { outline: 2px solid #107c41; outline-offset: -2px; }
.wbp-grid td:focus { outline: 2px solid #107c41; outline-offset: -2px; }

.wb-preview button:focus-visible, .wb-preview input:focus-visible {
    outline: 2px solid var(--brand-cyan);
    outline-offset: 2px;
}
