.sheet-preview { color: var(--color-text-primary, #1c1917); min-width: 0; }
.sheet-preview-toolbar, .sheet-preview-tabs { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.sheet-preview-toolbar label { display: flex; align-items: center; gap: 8px; }
.sheet-preview-toolbar select, .sheet-preview-tabs button { min-height: 40px; border: 1px solid var(--color-border, #d6d0c8); background: var(--color-surface, #fff); color: inherit; border-radius: 8px; padding: 8px 12px; font: inherit; }
.sheet-preview-tabs button[aria-selected=true] { border-color: var(--color-brand, #ff6b00); font-weight: 700; }
.sheet-preview-tabs button:hover { background: var(--color-surface-hover, #f4f2ef); }
.sheet-preview :focus-visible { outline: 2px solid var(--ui-accent, #b64000); outline-offset: 2px; }
.sheet-preview-status { margin: 12px 0; }
.sheet-preview-unsupported { margin-bottom: 12px; }
.sheet-preview-unsupported summary { cursor: pointer; }
.sheet-preview-tabs { margin-bottom: 12px; }
.sheet-preview-viewport { overflow: auto; max-height: min(65vh, 760px); min-height: 240px; max-width: 100%; border: 1px solid var(--color-border, #d6d0c8); background: #fff; }
.sheet-preview-extent, .sheet-preview-grid { position: relative; }
.sheet-preview-grid { transform-origin: top left; background: #fff; color: #000; }
.sheet-preview-cell { position: absolute; box-sizing: border-box; display: flex; overflow: hidden; padding: 0 2px; }
.sheet-preview-cell-text { display: block; width: 100%; line-height: normal; overflow: hidden; }
.sheet-preview-accounting-sign { position: absolute; left: 2px; }
.sheet-preview-borders { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.sheet-preview-border { position: absolute; box-sizing: border-box; }
.sheet-preview-border-thin, .sheet-preview-border-medium, .sheet-preview-border-thick { background: currentColor; }
.sheet-preview-border-double.sheet-preview-border-v { border-left: 1px solid currentColor; border-right: 1px solid currentColor; }
.sheet-preview-border-double.sheet-preview-border-h { border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; }
.sheet-preview-has-note::after { content: ""; position: absolute; top: 0; right: 0; border-top: 6px solid #d00; border-left: 6px solid transparent; }
.sheet-preview-notes { margin-top: 12px; }
.sheet-preview-notes summary { cursor: pointer; padding: 12px 0; }
.sheet-preview-note { border-top: 1px solid var(--color-border, #d6d0c8); padding: 12px 0; }
.sheet-preview-note button { min-height: 44px; font: inherit; color: inherit; }
.sheet-preview-note p { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 767px) { .sheet-preview-toolbar select, .sheet-preview-tabs button { min-height: 44px; } .sheet-preview-viewport { max-height: 55dvh; } }
/* Review overlay (opt-in, SUPPORT-CELL-OVERLAY). The workbook grid stays white in every theme, so marks use colours that
   keep 3:1+ on white. Inset lines leave cell text, fill and borders readable; each kind also differs by line style and
   by the symbol in its numbered tag (colour is never the only signal). */
.sheet-preview-overlay { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.sheet-preview-mark { position: absolute; box-sizing: border-box; color: #fff; outline: 2px solid var(--sp-mark, #b64000); outline-offset: -2px; }
.sheet-preview-mark-change { --sp-mark: #b64000; }
.sheet-preview-mark-add { --sp-mark: #15803d; outline-style: dashed; }
.sheet-preview-mark-delete { --sp-mark: #dc2626; outline-style: double; outline-width: 4px; outline-offset: -4px; }
.sheet-preview-mark-mixed { --sp-mark: #b64000; outline-width: 3px; outline-offset: -3px; }
.sheet-preview-mark-blocked { --sp-mark: #dc2626; outline-style: dashed; outline-width: 3px; outline-offset: -3px; }
.sheet-preview-mark-unknown { --sp-mark: #b45309; outline-style: dotted; }
.sheet-preview-mark-keep { --sp-mark: #6f7785; outline-style: dotted; outline-width: 1px; outline-offset: -1px; }
.sheet-preview-mark.is-selected { box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 6px var(--sp-mark, #b64000); }
.sheet-preview-mark-index { position: absolute; top: 0; right: 0; min-width: 16px; height: 14px; padding: 0 3px; box-sizing: border-box; border-bottom-left-radius: 4px; background: var(--sp-mark, #b64000); color: #fff; font: 700 10px/14px -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; text-align: center; white-space: nowrap; }
.sheet-preview-overlay-panel { margin-top: 12px; }
.sheet-preview-overlay-panel summary { cursor: pointer; padding: 12px 0; font-weight: 700; overflow-wrap: anywhere; }
.sheet-preview-overlay-legend, .sheet-preview-overlay-note, .sheet-preview-overlay-hint { margin: 6px 0; color: var(--color-text-secondary, #6f7785); overflow-wrap: anywhere; }
.sheet-preview-overlay-detail { margin: 8px 0 12px; padding: 12px; border: 1px solid var(--color-border, #d6d0c8); border-radius: 8px; }
.sheet-preview-overlay-detail-title { margin: 0 0 8px; font-weight: 700; overflow-wrap: anywhere; }
.sheet-preview-overlay-detail-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.sheet-preview-overlay-detail-heading { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.sheet-preview-overlay-detail-line, .sheet-preview-overlay-detail-why { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.sheet-preview-overlay-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sheet-preview-overlay-list button { min-height: 40px; border: 1px solid var(--color-border, #d6d0c8); background: var(--color-surface, #fff); color: inherit; border-radius: 8px; padding: 8px 12px; font: inherit; text-align: left; overflow-wrap: anywhere; }
.sheet-preview-overlay-list button[aria-pressed="true"] { border-color: var(--color-brand, #ff6b00); font-weight: 700; }
.sheet-preview-overlay-unplaced { margin: 4px 0 0; padding-left: 18px; overflow-wrap: anywhere; }
@media (max-width: 767px) { .sheet-preview-overlay-list button { min-height: 44px; } }
/* r4 (MAIN, final audit): the overlay's own controls (list buttons, toggle) had the renderer's ring (--ui-accent #ff6b00,
   2.8:1 on white). They use the DESIGN light ring #b64000 (5.6:1); dark keeps the app's dark ring. Scoped to the overlay.
   r5: the panel's own summary is one of those controls too. */
.sheet-preview-overlay-panel button:focus-visible, .sheet-preview-overlay-toggle input:focus-visible, .sheet-preview-overlay-panel > summary:focus-visible { outline: 2px solid #b64000; outline-offset: 2px; }
html[data-ui-theme="dark"] .sheet-preview-overlay-panel button:focus-visible, html[data-ui-theme="dark"] .sheet-preview-overlay-toggle input:focus-visible, html[data-ui-theme="dark"] .sheet-preview-overlay-panel > summary:focus-visible { outline-color: #fb923c; }
/* r6: a selected list button is brought back into view with a nearest-only scroll; keep its 2px+2px ring inside too. */
.sheet-preview-overlay-list button { scroll-margin: 8px; }
