.color-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.color-btn:hover { background: var(--tool-hover); }
.color-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.formula-bar { display: flex; align-items: center; gap: 8px; margin: 6px 16px 0; height: 30px; flex-shrink: 0; }
.name-box { width: 80px; text-align: center; border: 1px solid var(--border); border-radius: 6px; line-height: 26px; font-size: 13px; background: #fff; }
.fx { color: var(--muted); font-style: italic; font-size: 13px; }
.formula-input { flex: 1; height: 28px; border: 1px solid var(--border); border-radius: 6px; padding: 0 10px; font-size: 13px; outline: none; font-family: "SFMono-Regular", Consolas, monospace; }
.formula-input:focus { border-color: var(--accent); }
.grid-scroll { flex: 1; overflow: auto; background: #fff; min-width: 0; }
.grid { border-collapse: collapse; table-layout: fixed; font-size: 13px; user-select: none; }
.grid th { position: sticky; background: #f8f9fa; color: var(--muted); font-weight: 500; border: 1px solid #e1e3e6; text-align: center; z-index: 2; cursor: default; }
.grid thead th { top: 0; height: 24px; }
.grid tbody th { left: 0; width: 46px; min-width: 46px; z-index: 1; }
.grid thead th.corner { left: 0; z-index: 3; width: 46px; min-width: 46px; }
.grid th.sel { background: #d3e3fd; color: var(--active-text); }
.grid td { border: 1px solid #e1e3e6; height: 24px; padding: 0 4px; overflow: hidden; white-space: nowrap; text-overflow: clip; cursor: cell; font-size: 10pt; }
.grid td.in-range { background: #e8f0fe; }
.grid td.cur { outline: 2px solid var(--accent); outline-offset: -2px; background: #fff; }
.grid.painting td { cursor: var(--brush-cursor), cell; }
.grid td.err { color: #c5221f; }
.grid td.num { text-align: right; }
.grid td .editor { position: absolute; z-index: 5; border: 2px solid var(--accent); background: #fff; font: inherit; padding: 0 4px; outline: none; }
.col-resize { position: absolute; right: -3px; top: 0; width: 6px; height: 100%; cursor: col-resize; }
.grid thead th { position: sticky; }
.grid thead th > div { position: relative; }
.grid-scroll { position: relative; }
.grid td.bd { box-shadow: inset 0 0 0 1px #202124; }
.grid td.fmt-text { text-align: left; }
.editor-overlay { position: absolute; z-index: 6; border: 2px solid var(--accent); background: #fff; font: 13px inherit; padding: 0 4px; outline: none; box-sizing: border-box; }
.grid-scroll:focus { outline: none; }
