/* C3 复用 C1 令牌，保持工具带、公式栏及工作表处于同一工作平面。 */
.xlsx-editor { height: 100dvh; min-height: 420px; overflow: hidden; background: var(--ed-neutral-0); }
.xlsx-editor .ed-toolbar { position: relative; flex: 0 0 auto; grid-template-columns: minmax(0, 1fr) auto; gap: 0; padding: 0; min-height: 0; }
.xlsx-editor .ed-toolbar-start { min-height: 48px; padding: 8px 16px; gap: 12px; }
.xlsx-editor .ed-toolbar-end { padding: 8px 16px 8px 12px; }
.xlsx-editor .ed-toolbar-center { grid-row: 2; grid-column: 1 / -1; min-height: 44px; padding: 6px 14px; gap: 4px; background: var(--ed-neutral-0); border-top: 1px solid var(--ed-neutral-300); }
.xlsx-editor .ed-toolbar .ed-icon-button:not([aria-pressed="true"]) { background: transparent; }
.xlsx-editor .ed-toolbar .ed-icon-button:not(:disabled):not([aria-pressed="true"]):hover { background: var(--ed-neutral-200); }
.xlsx-editor .ed-toolbar .ed-icon-button:disabled { color: var(--ed-neutral-400); }
.xlsx-editor .ed-file-badge { background: var(--ed-saved-bg); color: var(--ed-saved-fg); }
.ed-shell.xlsx-editor .ed-workspace, .ed-shell.xlsx-editor .ed-stage, .ed-shell.xlsx-editor .ed-canvas-card { display: flex; flex: 1; min-height: 0; padding: 0; margin: 0; width: 100%; max-width: none; border: 0; border-radius: 0; box-shadow: none; background: var(--ed-neutral-0); }
.xlsx-editor .ed-sidebar[hidden] { display: none; }
.xlsx-content, .xlsx-grid-host { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
.xlsx-editor .sg-grid { flex: 1; height: auto; min-height: 0; }
.xlsx-editor .sg-formula-bar { flex-basis: 40px; }
.xlsx-editor .sg-name-box { width: 112px; flex-basis: 112px; }
.xlsx-editor .sg-cell { font-size: 13px; }
.xlsx-editor .sg-footer { background: var(--ed-neutral-100); padding-inline: 14px; flex-basis: 40px; }
.xlsx-editor .sg-summary { display: none; }
.xlsx-editor .ed-tab[aria-selected="true"] { color: var(--ed-saving-fg); background: var(--ed-neutral-0); box-shadow: inset 0 -2px var(--ed-blue); border-radius: 0; }
.xlsx-editor .ed-statusbar { flex-shrink: 0; min-height: 32px; padding: 5px 24px; gap: 12px; background: var(--ed-neutral-0); }
.xlsx-editor .ed-statusbar-start { white-space: nowrap; min-width: 0; }
.xlsx-editor .ed-statusbar-end { min-width: 0; }
.xlsx-protection { font-size: 11px; color: var(--ed-neutral-600); }
.xlsx-protection[hidden] { display: none; }
.xlsx-editor .ed-engine-label { font-size: 11px; }
.xlsx-save { min-width: 68px; border-radius: var(--ed-radius-md); }
.xlsx-editor .xlsx-save.ed-button-primary { background: var(--ed-neutral-900); border-color: var(--ed-neutral-900); }
.xlsx-editor .xlsx-save:disabled { background: transparent; border-color: var(--ed-neutral-300); color: var(--ed-neutral-500); }
.xlsx-bold .ed-icon { font-weight: 750; font-family: Georgia, serif; font-size: 16px; }
.xlsx-italic .ed-icon { font-style: italic; font-family: Georgia, serif; font-size: 16px; }
.xlsx-color { position: relative; display: inline-grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; color: var(--ed-neutral-800); border-radius: var(--ed-radius-sm); font-size: 15px; cursor: pointer; }
.xlsx-color:hover, .xlsx-color:focus-within { background: var(--ed-active-bg); }
.xlsx-color input { position: absolute; width: 20px; height: 7px; bottom: 2px; left: 5px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.xlsx-color input::-webkit-color-swatch-wrapper { padding: 0; }
.xlsx-color input::-webkit-color-swatch { border: 0; border-radius: 1px; }
.xlsx-color:has(input:disabled) { opacity: .4; }
.xlsx-macro-banner { flex: 0 0 auto; padding: 8px 20px; background: #eef6fc; color: #1d4b6e; border-bottom: 1px solid #cde2f2; font-size: 13px; line-height: 20px; }
.xlsx-macro-banner[hidden] { display: none; }
.xlsx-notice { padding: 9px 20px; background: var(--ed-conflict-bg); color: var(--ed-conflict-fg); border-bottom: 1px solid var(--ed-neutral-300); }
.xlsx-notice[hidden] { display: none; }
.xlsx-recovery { padding: 8px 12px; background: var(--ed-draft-bg); color: var(--ed-draft-fg); font-size: 12px; }
.xlsx-recovery textarea { display: block; width: 100%; max-height: 100px; margin-top: 4px; resize: vertical; border: 1px solid var(--ed-neutral-400); background: var(--ed-neutral-0); color: var(--ed-neutral-800); font: 12px/18px var(--ed-font-mono); }
.xlsx-recovery[hidden] { display: none; }
@media (max-width: 700px) {
  .xlsx-editor .ed-toolbar-start { grid-row: 1; grid-column: 1 / -1; height: auto; min-height: 58px; padding: 10px 12px; gap: 8px; }
  .xlsx-editor .ed-toolbar-end { grid-row: 2; grid-column: 1 / -1; padding: 0 12px 8px; gap: 8px; justify-content: flex-end; }
  .xlsx-editor .ed-toolbar-start .ed-pill { display: none; }
  .xlsx-editor .ed-toolbar-center { grid-row: 3; padding: 4px 8px; min-height: 52px; }
  .xlsx-editor .ed-icon-button, .xlsx-color { width: 44px; height: 44px; flex-basis: 44px; }
  .xlsx-color input { width: 24px; left: 10px; bottom: 6px; }
  .xlsx-editor .ed-filename { max-width: 120px; }
  .xlsx-editor .ed-button { padding-inline: 10px; }
  .xlsx-editor .ed-segmented .ed-tab { padding-inline: 8px; }
  .xlsx-editor .sg-footer { flex-basis: 46px; flex-wrap: nowrap; }
  .xlsx-editor .ed-statusbar { align-items: flex-start; flex-direction: column; gap: 2px; padding: 6px 12px; }
  .xlsx-editor .ed-statusbar-end { flex-wrap: wrap; gap: 4px; }
  .xlsx-protection { max-width: 100%; font-size: 10px; line-height: 16px; }
  .xlsx-editor .ed-engine-label { display: none; }
}

/* —— 直接体验：阅读时没有工具栏；双击或直接键入进入编辑后才出现一行格式工具。—— */
.ed-direct .xlsx-editor .ed-toolbar-start, .ed-direct .xlsx-editor .ed-toolbar-end { display: none; }
.ed-direct:is([data-ed-state="saved"], [data-ed-state="entering"], [data-ed-state="blocked"], [data-ed-can-edit="false"]) .xlsx-editor .ed-toolbar { display: none; }
.ed-direct .xlsx-editor .ed-toolbar { display: block; }
.ed-direct .xlsx-editor .ed-toolbar-center { border-top: 0; }
/* 底部只留一行：左侧工作表标签，右侧选区汇总；引擎名、就绪字样和保护说明不再常驻。 */
.ed-direct .xlsx-editor .ed-statusbar { display: none; }
.ed-direct .xlsx-editor .sg-summary { display: block; margin-left: auto; padding-right: 6px; }
.ed-direct .sg-summary[data-state="idle"] { display: none; }
