:root {
  --accent: #4f46e5;
  --accent-soft: #eceafe;
  --accent-text: #3730a3;
  --ink: #1c1e2a;
  --muted: #646a80;
  --line: #dcdfe8;
  --panel: #f6f7fb;
  --surface: #ffffff;
  --hover: #eceef5;
  --danger: #c2410c;
  --note: #fff8db;
  --note-line: #ecd98a;
  --thumb: #c3c7d4;
  --thumb-hover: #9fa4b6;
  --accent-hover: #4338ca;
  --tip: #1c1e2a;
  --tip-ink: #ffffff;
  --chart-surface: #ffffff;
  --chart-line: #c9ced6;
  color-scheme: light;
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink);
  background: var(--panel);
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  min-height: 46px;
}

.brand { display: flex; align-items: center; gap: 8px; flex: none; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
  row-gap: 4px;
}

.tb-group { display: flex; align-items: center; gap: 2px; flex: none; }
.tb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 5px; flex: none; }

.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  flex: none;
}
.tb-btn:hover { background: var(--hover); }
.tb-btn.active { background: var(--accent-soft); color: var(--accent-text); }
.tb-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }
.tb-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tb-btn:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Narrower windows get a denser toolbar before it wraps to a second row. */
@media (max-width: 1640px) {
  .toolbar { gap: 2px; }
  .tb-group { gap: 0; }
  .tb-sep { margin: 0 3px; }
  .tb-btn { min-width: 28px; padding: 0 5px; }
}

.formula-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.name-box, .formula-input {
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 9px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  outline: none;
}
.name-box { width: 96px; text-align: center; font-weight: 550; flex: none; }
.formula-input { flex: 1; min-width: 0; }
.name-box:focus, .formula-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fx { color: var(--muted); font-style: italic; font-weight: 600; font-family: Georgia, "Times New Roman", serif; flex: none; }

.grid {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.grid-canvas { position: absolute; left: 0; top: 0; touch-action: none; display: block; }

.cell-input {
  position: absolute;
  z-index: 5;
  margin: 0;
  padding: 0 4px;
  border: 2px solid var(--accent);
  border-radius: 2px;
  outline: none;
  resize: none;
  overflow: hidden;
  white-space: pre;
  background: var(--surface);
  color: var(--ink);
  font: 13px var(--font);
  box-shadow: 0 2px 10px rgba(28, 30, 42, 0.18);
}
.cell-input.idle {
  width: 2px;
  height: 2px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  box-shadow: none;
}

.scrollbar { position: absolute; background: var(--panel); }
.scrollbar.vertical { top: 0; right: 0; bottom: 12px; width: 12px; border-left: 1px solid var(--line); }
.scrollbar.horizontal { left: 0; right: 12px; bottom: 0; height: 12px; border-top: 1px solid var(--line); }
.scrollbar .thumb { position: absolute; border-radius: 6px; background: var(--thumb); touch-action: none; }
.scrollbar .thumb:hover, .scrollbar .thumb:active { background: var(--thumb-hover); }
.scrollbar.vertical .thumb { left: 2px; width: 7px; top: 0; }
.scrollbar.horizontal .thumb { top: 2px; height: 7px; left: 0; }

.bottombar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  min-height: 34px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.tabs { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  height: 24px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
}
.tab:hover { background: var(--hover); }
.tab.active { background: var(--accent); color: #fff; }
.tab-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.tab.active .tab-dot { box-shadow: 0 0 0 1.5px #fff; }

.status { display: flex; align-items: center; gap: 14px; color: var(--muted); white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }
.status b { color: var(--ink); font-weight: 600; }
.zoom { display: flex; align-items: center; gap: 2px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.zoom button { border: 0; background: none; color: inherit; font: inherit; border-radius: 6px; height: 24px; cursor: pointer; }
.zoom button:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.zoom button:disabled { opacity: 0.4; cursor: default; }
.zoom-btn { width: 24px; font-size: 15px; line-height: 1; }
.zoom-label { min-width: 46px; padding: 0 4px; }

@media (max-width: 640px) {
  .brand-name { display: none; }
  .name-box { width: 70px; }
  .status .stat-extra { display: none; }
}

.menu {
  position: fixed;
  z-index: 100;
  min-width: 200px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(28, 30, 42, 0.18), 0 2px 6px rgba(28, 30, 42, 0.08);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 30px;
  padding: 0 10px 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item:disabled { opacity: 0.4; cursor: default; }
.menu-check { width: 14px; color: var(--accent); font-weight: 700; flex: none; }
.menu-label { flex: 1; }
.menu-hint { color: var(--muted); font-size: 12px; margin-left: 18px; }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--line); }
.menu-heading { padding: 6px 8px 3px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 52px;
  z-index: 200;
  transform: translate(-50%, 12px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 9px 14px;
  border-radius: 9px;
  background: var(--tip);
  color: var(--tip-ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

.tb-text { font-size: 13px; font-weight: 600; line-height: 1; min-width: 10px; text-align: center; }
.tb-serif { font-family: Georgia, "Times New Roman", serif; font-size: 15px; }
.tb-size { font-weight: 500; min-width: 18px; }
.tb-btn .tb-caret { width: 12px; height: 12px; margin-left: -2px; color: var(--muted); }
.tb-color { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.tb-color svg { width: 16px; height: 16px; }
.tb-color .tb-text { font-size: 14px; height: 14px; line-height: 14px; }
.tb-color i { display: block; width: 18px; height: 4px; border-radius: 1px; }
.tb-color i.empty { box-shadow: inset 0 0 0 1px var(--line); }

.swatches { display: grid; grid-template-columns: repeat(10, 20px); gap: 3px; padding: 6px 6px 4px; }
.swatch { width: 20px; height: 20px; padding: 0; border: 1px solid rgba(28, 30, 42, 0.14); border-radius: 4px; cursor: pointer; }
.swatch:hover { transform: scale(1.18); }
.swatch.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.menu-custom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px; color: var(--muted); }
.swatch-custom { width: 44px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: none; cursor: pointer; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  background: rgba(28, 30, 42, 0.32);
}
.dialog {
  width: 440px;
  max-width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(28, 30, 42, 0.3);
}
.dialog-title { padding: 16px 18px 6px; font-size: 15px; font-weight: 650; }
.dialog-body { padding: 8px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.dialog-text { margin: 0; line-height: 1.5; color: var(--muted); }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }
.btn {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field, .select {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  outline: none;
}
.field:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-label { font-weight: 550; }
.field-hint { color: var(--muted); font-size: 12px; line-height: 1.4; }
.field-row { display: flex; align-items: center; gap: 8px; }
.field-row > label { flex: none; min-width: 84px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }

.tab-add { width: 24px; padding: 0; font-size: 17px; line-height: 1; color: var(--ink); }
.tab { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.cell-input.away { opacity: 0; pointer-events: none; }

.dialog-list { display: flex; flex-direction: column; gap: 8px; }
.link { border: 0; padding: 0; background: none; color: var(--accent); font: inherit; font-weight: 550; cursor: pointer; }
.link:hover { text-decoration: underline; }

.filter-panel { display: flex; flex-direction: column; gap: 8px; padding: 6px; width: 250px; }
.filter-panel .field-hint:empty { display: none; }
.filter-operands { display: flex; gap: 6px; }
.filter-operands[hidden], .filter-operands .field[hidden] { display: none; }
.filter-operands .field { flex: 1; min-width: 0; }
.filter-links { display: flex; gap: 14px; padding: 0 2px; }
.filter-list { max-height: 230px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.filter-item { height: 26px; overflow: hidden; white-space: nowrap; }
.filter-item span { overflow: hidden; text-overflow: ellipsis; }
.filter-item[hidden] { display: none; }
.filter-buttons { display: flex; justify-content: flex-end; gap: 8px; }

.find-panel {
  position: absolute;
  top: 34px;
  right: 24px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 340px;
  max-width: calc(100% - 32px);
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(28, 30, 42, 0.18);
}
.find-panel[hidden] { display: none; }
.find-row { display: flex; align-items: center; gap: 6px; }
.find-row .field { flex: 1; min-width: 0; }
.find-count { color: var(--muted); font-size: 12px; white-space: nowrap; min-width: 54px; text-align: right; }
.find-options { gap: 16px; color: var(--muted); }
.btn.icon { width: 30px; padding: 0; font-size: 17px; line-height: 1; flex: none; }

/* Charts */
.chart-layer { position: absolute; overflow: hidden; pointer-events: none; z-index: 3; }
.chart { position: absolute; left: 0; top: 0; pointer-events: auto; background: var(--chart-surface); border: 1px solid var(--chart-line); border-radius: 8px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 14px rgba(15, 23, 42, 0.06); cursor: default; touch-action: none; user-select: none; }
.chart-body { position: absolute; inset: 0; overflow: hidden; border-radius: 7px; }
.chart-body svg { display: block; }
.chart-body [data-tip]:hover { filter: brightness(0.92); }
.chart.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 4px 14px rgba(15, 23, 42, 0.1); cursor: move; }
.chart-handle { display: none; position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; border-radius: 3px; background: var(--surface); border: 2px solid var(--accent); cursor: nwse-resize; }
.chart.selected .chart-handle { display: block; }
.chart-tip { display: none; position: fixed; z-index: 60; pointer-events: none; background: var(--tip); color: var(--tip-ink); font-size: 12px; line-height: 1.3; padding: 5px 8px; border-radius: 6px; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2); }

/* Conditional formatting */
.cf-swatch { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 26px; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; background: var(--surface); }
.cf-and { flex: none; color: var(--muted); font-size: 12px; }
.cf-list { display: flex; flex-direction: column; gap: 6px; }
.cf-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.cf-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-range { flex: none; border: 0; background: var(--panel); color: var(--accent-text); border-radius: 5px; padding: 3px 7px; font: inherit; font-size: 12px; cursor: pointer; }
.cf-range:hover { background: var(--accent-soft); }

/* Function suggestions and argument hints */
.ac-box { display: none; position: fixed; z-index: 90; min-width: 260px; max-width: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14); padding: 4px; font-size: 12.5px; }
.ac-box.hint { padding: 6px 10px; min-width: 0; }
.ac-item { display: flex; align-items: baseline; gap: 10px; padding: 4px 8px; border-radius: 5px; cursor: pointer; }
.ac-item.current { background: var(--accent-soft); }
.ac-name { font-weight: 600; color: var(--accent-text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.ac-desc { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-sig { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--ink); margin-bottom: 2px; }
.ac-sig b { color: var(--accent-text); background: var(--accent-soft); border-radius: 3px; padding: 0 2px; }
.ac-foot { padding: 4px 8px 2px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); margin-top: 3px; }

/* Help */
.help-body { max-height: 62vh; gap: 4px; }
.help-title { margin-top: 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.help-row { display: flex; gap: 14px; align-items: baseline; padding: 2px 0; }
.help-keys { flex: none; width: 190px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--accent-text); }

/* Pivot table field panel */
.pivot-panel {
  position: fixed;
  right: 14px;
  top: 118px;
  z-index: 30;
  width: 250px;
  max-height: calc(100dvh - 180px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.16);
}
.pivot-panel[hidden] { display: none; }
.pivot-head, .pivot-source, .pivot-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pivot-title { font-weight: 600; font-size: 14px; }
.pivot-source { color: var(--muted); font-size: 12px; }
.pivot-source span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pivot-message { color: #b42318; font-size: 12px; line-height: 1.4; }
.pivot-area { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px dashed var(--line); border-radius: 8px; }
.pivot-area-title { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.pivot-chip { display: flex; align-items: center; gap: 4px; padding: 2px 2px 2px 8px; min-height: 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: grab; }
.pivot-chip-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pivot-agg { flex: none; width: 96px; height: 24px; padding: 0 4px; font-size: 12px; }
.pivot-add { height: 26px; font-size: 12px; color: var(--muted); }
.pivot-x { flex: none; width: 22px; height: 22px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; }
.pivot-x:hover { background: var(--line); color: var(--ink); }
.link-btn { flex: none; border: 0; padding: 2px 4px; background: transparent; color: var(--accent-text, var(--accent)); font: inherit; font-size: 12px; cursor: pointer; border-radius: 4px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: #b42318; }
.pivot-links { display: flex; gap: 8px; }
.pivot-items { display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow-y: auto; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }

/* Comments, validation and names */
.comment-tip {
  position: fixed;
  z-index: 40;
  display: none;
  max-width: 260px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--note-line);
  background: var(--note);
  color: var(--ink);
  box-shadow: 0 6px 20px rgba(20, 22, 40, 0.16);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  pointer-events: none;
  line-height: 1.4;
}
.comment-input { width: 100%; height: auto; padding: 8px 9px; resize: vertical; line-height: 1.4; }
.name-menu {
  flex: none;
  width: 22px;
  height: 28px;
  margin-left: -6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.name-menu:hover { background: var(--hover); color: var(--ink); }
.name-box { width: 104px; }

/* Dark theme */
:root[data-theme="dark"] {
  --accent: #6d66f0;
  --accent-soft: #2b2a55;
  --accent-text: #c3c0ff;
  --ink: #e6e8f0;
  --muted: #9aa0b4;
  --line: #2e313d;
  --panel: #14151a;
  --surface: #1b1c22;
  --hover: #272932;
  --danger: #d9552e;
  --note: #38331f;
  --note-line: #5f5527;
  --thumb: #3b3e4c;
  --thumb-hover: #565b6e;
  --accent-hover: #7f79f3;
  --tip: #e6e8f0;
  --tip-ink: #14151a;
  --chart-surface: #1a1a19;
  --chart-line: #3a3d4a;
  color-scheme: dark;
}
:root[data-theme="dark"] .field-hint[style] { color: #f0875a !important; }

/* Function list */
.fx-button { cursor: pointer; padding: 3px 6px; margin: 0 -6px; border-radius: 6px; }
.fx-button:hover { background: var(--hover); color: var(--ink); }
.fx-button:focus-visible { outline: 2px solid var(--accent); }
.fn-list { margin-top: 10px; height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.fn-item { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 6px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.fn-item:hover, .fn-item:focus-visible { background: var(--hover); outline: none; }
.fn-sig { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
.fn-desc { color: var(--muted); font-size: 12px; }

/* Printing */
#print-area { display: none; }
@media print {
  html, body { height: auto; overflow: visible; background: #fff; }
  #app, .menu, .toast, .overlay, .ac-box, .comment-tip, .chart-tip, .pivot-panel { display: none !important; }
  #print-area { display: block; color: #000; background: #fff; font: 13px var(--font); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-title { font-weight: 600; font-size: 14px; margin-bottom: 10px; }
  .print-table { border-collapse: collapse; table-layout: fixed; }
  .print-table td { padding: 1px 5px; overflow: hidden; }
  .print-table th { padding: 1px 4px; font-weight: 500; font-size: 11px; color: #555; background: #f1f1f5; border: 1px solid #c9c9d2; text-align: center; }
  .print-table.print-lines td { border: 1px solid #c9c9d2; }
  .print-chart { margin-top: 18px; break-inside: avoid; }
}
.grid.painting .grid-canvas { cursor: copy !important; }

/* Sign of a protected sheet in its tab: a small padlock drawn with borders. */
.tab-lock {
  display: inline-block;
  position: relative;
  width: 8px;
  height: 6px;
  margin-left: 6px;
  border-radius: 1.5px;
  background: currentColor;
  opacity: 0.75;
  vertical-align: baseline;
}
.tab-lock::before {
  content: '';
  position: absolute;
  left: 1px;
  top: -4px;
  width: 4px;
  height: 4px;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.pivot-pct.on { background: var(--accent); color: #fff; border-radius: 4px; }
.pivot-order { width: 100%; }
