/* Sheets - spreadsheet app (canvas grid, ribbon, backstage, dialogs) */
.app-sheets {
  --sh-bg: var(--surface);
  --sh-bg-rgb: 26, 31, 43;
  --sh-grid: rgba(255, 255, 255, .075);
  --sh-head: var(--surface-2);
  --sh-head-line: var(--line-2);
  --sh-link: #6aa8ff;
  --sh-err: #e5484d;
  --sh-ribbon: var(--surface);
  position: relative;
  background: var(--surface);
}
:root[data-theme="light"] .app-sheets { --sh-bg: #ffffff; --sh-bg-rgb: 255, 255, 255; --sh-grid: rgba(10, 20, 40, .1); --sh-head: #f3f5f8; --sh-head-line: rgba(10, 20, 40, .14); --sh-link: #1d63d8; }
.app-sheets [hidden], .sh-bar [hidden] { display: none !important; }
.app-sheets .sh-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.app-sheets .sh-spacer-flex { flex: 1; }
.app-sheets button { font-family: inherit; }

/* ---------- title bar ---------- */
.win-bar-extra .sh-bar { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; }
.sh-bar .sh-home { width: 28px; height: 28px; border-radius: 8px; color: var(--text-2); }
.sh-bar .sh-docname {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 340px; height: 28px; padding: 0 9px;
  border: 0; border-radius: 8px; background: none; color: var(--text); font-size: 13px; font-weight: 600;
}
.sh-bar .sh-docname .ic { color: #22a565; flex: 0 0 auto; }
.sh-bar .sh-docname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-bar .sh-docname em, .app-sheets .sh-recent-name em {
  font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .03em; padding: 1px 5px; border-radius: 4px;
  background: rgba(var(--accent-rgb), .16); color: var(--accent); flex: 0 0 auto;
}
.sh-bar .sh-docname:hover { background: var(--hover); }
.sh-bar .sh-savestate { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.sh-bar .sh-savestate.saving i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: sh-pulse 1s ease-in-out infinite; }
.sh-bar .sh-savestate.error { color: #e5484d; }
@keyframes sh-pulse { 50% { opacity: .3; } }

/* ---------- ribbon ---------- */
.app-sheets .sh-ribbon { flex: 0 0 auto; background: var(--sh-ribbon); border-bottom: 1px solid var(--line); }
.app-sheets .sh-rtabs { display: flex; align-items: center; gap: 2px; height: 34px; padding: 0 8px; }
.app-sheets .sh-rtab {
  height: 26px; padding: 0 11px; border: 0; border-radius: 7px; background: none; color: var(--text-2); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.app-sheets .sh-rtab:hover { background: var(--hover); color: var(--text); }
.app-sheets .sh-rtab.on { color: var(--accent); background: rgba(var(--accent-rgb), .12); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 7px 7px 3px 3px; }
.app-sheets .sh-rtab.file { color: #fff; background: #1e9e55; margin-right: 4px; }
.app-sheets .sh-rtab.file:hover { filter: brightness(1.08); background: #1e9e55; }
.app-sheets .sh-quick { display: flex; gap: 1px; margin-right: 2px; }
.app-sheets .sh-quick .sh-rb { height: 26px; min-width: 28px; }
.app-sheets .sh-rcollapse { width: 26px; height: 26px; border: 0; border-radius: 7px; background: none; color: var(--text-3); display: grid; place-items: center; }
.app-sheets .sh-rcollapse:hover { background: var(--hover); color: var(--text); }
.app-sheets .sh-rbody { display: flex; align-items: stretch; gap: 0; min-height: 86px; padding: 4px 6px 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.app-sheets .sh-ribbon.collapsed .sh-rbody { display: none; }
.app-sheets .sh-rgroup { flex: 0 0 auto; display: flex; flex-direction: column; padding: 0 6px; border-right: 1px solid var(--line); }
.app-sheets .sh-rgroup:last-child { border-right: 0; }
.app-sheets .sh-rgroup-items { flex: 1; display: flex; align-items: flex-start; gap: 2px; }
.app-sheets .sh-rgroup-label { flex: 0 0 auto; text-align: center; font-size: 10.5px; color: var(--text-3); padding: 2px 0 1px; white-space: nowrap; }
.app-sheets .sh-rstack { display: flex; flex-direction: column; gap: 2px; justify-content: flex-start; }
.app-sheets .sh-rrow { display: flex; align-items: center; gap: 1px; }
.app-sheets .sh-rb {
  position: relative; flex: 0 0 auto; height: 28px; min-width: 28px; padding: 0 5px; border: 0; border-radius: 6px; background: none;
  color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 500; white-space: nowrap; transition: background .1s, color .1s;
}
.app-sheets .sh-rb:hover { background: var(--hover); color: var(--text); }
.app-sheets .sh-rb:active { background: var(--press); }
.app-sheets .sh-rb.on { background: rgba(var(--accent-rgb), .16); color: var(--accent); }
.app-sheets .sh-rb:disabled { opacity: .35; pointer-events: none; }
.app-sheets .sh-rb.wl { padding: 0 7px 0 5px; }
.app-sheets .sh-rb.big { flex-direction: column; height: 70px; min-width: 52px; padding: 4px 6px; gap: 3px; font-size: 11.5px; line-height: 1.15; }
.app-sheets .sh-rb.big span { max-width: 74px; white-space: normal; text-align: center; }
.app-sheets .sh-rb.big .ic { color: var(--accent); }
.app-sheets .sh-rb .sh-dd { display: inline-grid; font-style: normal; color: var(--text-3); }
.app-sheets .sh-rb.big .sh-dd { margin-top: -2px; }
.app-sheets .sh-rb-ddonly { min-width: 16px; width: 16px; padding: 0; color: var(--text-3); }
.app-sheets .sh-rsplit { display: inline-flex; align-items: center; border-radius: 6px; }
.app-sheets .sh-rsplit:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
.app-sheets .sh-rsplit > .sh-rb:first-child { border-radius: 6px 0 0 6px; }
.app-sheets .sh-rsplit > .sh-rb:last-child { border-radius: 0 6px 6px 0; }
.app-sheets .sh-pastewrap { align-items: stretch; }
.app-sheets .sh-pastewrap .sh-paste-dd { height: 70px; }
.app-sheets .sh-rb-color { flex-direction: column; gap: 0; padding: 0 5px; }
.app-sheets .sh-rb-color .ic { margin-top: -3px; }
.app-sheets .sh-cbar { position: absolute; left: 6px; right: 6px; bottom: 4px; height: 3px; border-radius: 2px; box-shadow: inset 0 0 0 1px var(--line-2); }
.app-sheets .sh-rb-txt { font-family: var(--mono); font-size: 11px; font-weight: 600; gap: 1px; }
.app-sheets .sh-rb-txt small { font-size: 10px; color: var(--text-3); }
.app-sheets .sh-rsel {
  height: 26px; padding: 0 6px 0 9px; border: 0; border-radius: 6px; background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2);
  display: inline-flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.app-sheets .sh-rsel span { overflow: hidden; text-overflow: ellipsis; }
.app-sheets .sh-rsel .ic { color: var(--text-3); flex: 0 0 auto; }
.app-sheets .sh-fontsel { width: 132px; }
.app-sheets .sh-nfsel { width: 168px; }
.app-sheets .sh-sizewrap { margin: 0 3px; box-shadow: inset 0 0 0 1px var(--line-2); background: var(--surface-2); height: 26px; }
.app-sheets .sh-rsize { width: 34px; height: 26px; border: 0; background: none; color: var(--text); text-align: center; font-size: 12px; outline: none; padding: 0; }
.app-sheets .sh-sizewrap .sh-rb-ddonly { height: 26px; }

/* ---------- formula bar ---------- */
.app-sheets .sh-fbar { flex: 0 0 auto; display: flex; align-items: flex-start; min-height: 34px; padding: 4px 8px; gap: 6px; border-bottom: 1px solid var(--line); background: var(--surface); }
.app-sheets .sh-namewrap { display: flex; align-items: center; flex: 0 0 auto; height: 26px; border-radius: 6px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.app-sheets .sh-namebox { width: 104px; height: 26px; padding: 0 4px 0 8px; border: 0; outline: none; background: none; color: var(--text); font: 600 12px var(--mono); }
.app-sheets .sh-namewrap:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.app-sheets .sh-namedrop { width: 20px; height: 26px; border: 0; background: none; color: var(--text-3); display: grid; place-items: center; border-left: 1px solid var(--line); }
.app-sheets .sh-fxbtns { display: flex; align-items: center; gap: 1px; height: 26px; border-left: 1px solid var(--line-2); padding-left: 4px; }
.app-sheets .sh-fxbtn { width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--text-3); display: grid; place-items: center; }
.app-sheets .sh-fxbtn:hover { background: var(--hover); color: var(--text); }
.app-sheets .sh-fxbtn-fn { font: italic 600 14px Georgia, 'Times New Roman', serif; }
.app-sheets .sh-fxbtn-fn sub { font-size: 9px; }
.app-sheets:not(.sh-editing) .sh-fxbtns .sh-fxbtn:not(.sh-fxbtn-fn) { opacity: .35; pointer-events: none; }
.app-sheets .sh-fx {
  flex: 1; min-width: 0; height: 26px; padding: 4px 8px; border: 0; border-radius: 6px; outline: none; background: none; color: var(--text); font: 13px/18px var(--mono);
  resize: none; overflow: hidden; white-space: pre;
}
.app-sheets .sh-fx.ghost { color: var(--text-3); }
.app-sheets .sh-fx:focus { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.app-sheets .sh-fbar.tall .sh-fx { height: 92px; overflow: auto; white-space: pre-wrap; }
.app-sheets .sh-fx-expand.on .ic { transform: rotate(180deg); }

/* ---------- grid ---------- */
.app-sheets .sh-mainrow { flex: 1; min-height: 0; display: flex; }
.app-sheets .sh-gridwrap { position: relative; flex: 1; min-width: 0; overflow: hidden; background: var(--sh-bg); }
.app-sheets .sh-scroller { position: absolute; inset: 0; overflow: scroll; outline: none; touch-action: pan-x pan-y; overscroll-behavior: contain; cursor: cell; }
.app-sheets .sh-spacer { width: 1px; height: 1px; pointer-events: none; }
.app-sheets .sh-cv { position: absolute; left: 0; top: 0; pointer-events: none; }
.app-sheets.sh-resizing-col, .app-sheets.sh-resizing-col * { cursor: col-resize !important; user-select: none; }
.app-sheets.sh-resizing-row, .app-sheets.sh-resizing-row * { cursor: row-resize !important; user-select: none; }
.app-sheets .sh-editor {
  position: absolute; z-index: 7; margin: 0; padding: 0 4px; border: 0; outline: none; border-radius: 1px; resize: none; overflow: hidden;
  background: var(--sh-bg); color: var(--text); font: 13px var(--font); line-height: 17px;
  box-shadow: 0 0 0 2px var(--accent), 0 8px 22px -6px rgba(0, 0, 0, .4); white-space: pre;
}
.app-sheets .sh-dvbtn {
  position: absolute; z-index: 6; width: 18px; padding: 0; border: 0; border-radius: 0 4px 4px 0; background: var(--surface-2); color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--line-2); display: grid; place-items: center;
}
.app-sheets .sh-dvbtn:hover { color: var(--accent); }
.app-sheets .sh-tip {
  position: absolute; z-index: 25; max-width: 280px; padding: 7px 9px; border-radius: 8px; pointer-events: none;
  background: var(--glass-solid, var(--surface-2)); color: var(--text); box-shadow: var(--shadow-pop); border: 1px solid var(--line-2); font-size: 12px; line-height: 1.4;
}
.app-sheets .sh-tip-note { white-space: pre-wrap; }
.app-sheets .sh-tip-link { display: flex; align-items: center; gap: 6px; color: var(--sh-link); word-break: break-all; }
.app-sheets .sh-tip-sub { color: var(--text-3); font-size: 11px; margin-top: 2px; }
.app-sheets .sh-tip-err b { color: #e5484d; margin-right: 4px; }

/* autocomplete + argument hints */
.app-sheets .sh-ac, .app-sheets .sh-arghint {
  position: absolute; z-index: 30; padding: 4px; border-radius: 10px;
  background: var(--glass-solid, var(--surface-2)); box-shadow: var(--shadow-pop); border: 1px solid var(--line-2);
}
.app-sheets .sh-ac { width: 320px; }
.app-sheets .sh-ac-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; border: 0; border-radius: 6px; background: none; color: var(--text); text-align: left; }
.app-sheets .sh-ac-item .ic { color: var(--text-3); flex: 0 0 auto; }
.app-sheets .sh-ac-item b { font: 600 12px var(--mono); flex: 0 0 auto; }
.app-sheets .sh-ac-item span { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-sheets .sh-ac-item.on { background: rgba(var(--accent-rgb), .16); }
.app-sheets .sh-ac-item.on b, .app-sheets .sh-ac-item.on .ic { color: var(--accent); }
.app-sheets .sh-ac-sig { margin-top: 3px; padding: 6px 8px 4px; border-top: 1px solid var(--line); font: 11.5px var(--mono); color: var(--text-2); }
.app-sheets .sh-arghint { max-width: 460px; padding: 6px 10px; pointer-events: none; }
.app-sheets .sh-arghint-sig { font: 12px var(--mono); color: var(--text-2); }
.app-sheets .sh-arghint-sig b { color: var(--accent); }
.app-sheets .sh-arghint-desc { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ---------- floating objects ---------- */
.app-sheets .sh-objects { position: absolute; inset: 0; pointer-events: none; z-index: 8; overflow: hidden; }
.app-sheets .sh-obj { position: absolute; left: 0; top: 0; pointer-events: auto; outline: none; }
.app-sheets .sh-chart { display: flex; flex-direction: column; background: var(--sh-bg); border-radius: 10px; border: 1px solid var(--line-2); box-shadow: 0 6px 22px -8px rgba(0, 0, 0, .35); }
.app-sheets .sh-obj.sel { box-shadow: 0 0 0 2px var(--accent), 0 8px 26px -8px rgba(0, 0, 0, .4); }
.app-sheets .sh-obj.moving { opacity: .9; }
.app-sheets .sh-chart-head { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; padding: 5px 5px 0 12px; cursor: grab; touch-action: none; min-width: 0; }
.app-sheets .sh-chart.moving .sh-chart-head { cursor: grabbing; }
.app-sheets .sh-chart-names { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; overflow: hidden; }
.app-sheets .sh-chart-title { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-sheets .sh-chart-range { font: 11px var(--mono); color: var(--text-3); white-space: nowrap; }
.app-sheets .sh-chart-btn { width: 26px; height: 26px; color: var(--text-3); opacity: 0; transition: opacity .12s; }
.app-sheets .sh-chart:hover .sh-chart-btn, .app-sheets .sh-chart.sel .sh-chart-btn { opacity: 1; }
.app-sheets .sh-chart-del:hover { color: #e5484d; }
.app-sheets .sh-chart-cv { flex: 1; min-height: 0; width: calc(100% - 16px); margin: 2px 8px 8px; display: block; }
.app-sheets .sh-oh { position: absolute; width: 10px; height: 10px; border-radius: 3px; background: var(--sh-bg); box-shadow: 0 0 0 1.5px var(--accent); display: none; touch-action: none; }
.app-sheets .sh-obj.sel .sh-oh { display: block; }
.app-sheets .sh-oh-n { top: -5px; left: calc(50% - 5px); cursor: ns-resize; }
.app-sheets .sh-oh-s { bottom: -5px; left: calc(50% - 5px); cursor: ns-resize; }
.app-sheets .sh-oh-e { right: -5px; top: calc(50% - 5px); cursor: ew-resize; }
.app-sheets .sh-oh-w { left: -5px; top: calc(50% - 5px); cursor: ew-resize; }
.app-sheets .sh-oh-ne { right: -5px; top: -5px; cursor: nesw-resize; }
.app-sheets .sh-oh-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.app-sheets .sh-oh-nw { left: -5px; top: -5px; cursor: nwse-resize; }
.app-sheets .sh-oh-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.app-sheets .sh-image { cursor: grab; touch-action: none; }
.app-sheets .sh-img-wrap { width: 100%; height: 100%; position: relative; }
.app-sheets .sh-img-wrap img { width: 100%; height: 100%; object-fit: fill; display: block; border-radius: 2px; user-select: none; -webkit-user-drag: none; }
.app-sheets .sh-img-del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; background: var(--glass-solid, var(--surface-2)); color: var(--text-2); opacity: 0; box-shadow: var(--shadow-pop); }
.app-sheets .sh-image.sel .sh-img-del, .app-sheets .sh-image:hover .sh-img-del { opacity: 1; }
.app-sheets .sh-notebox {
  position: absolute; left: 0; top: 0; max-width: 200px; padding: 6px 8px; pointer-events: none; white-space: pre-wrap; font-size: 11.5px; line-height: 1.35;
  background: #fff8c5; color: #3d3200; border: 1px solid #e3d26f; border-radius: 4px; box-shadow: 0 4px 12px -4px rgba(0, 0, 0, .3);
}
.app-sheets .sh-note-ed {
  position: absolute; z-index: 26; width: 250px; padding: 8px; border-radius: 10px; display: flex; flex-direction: column; gap: 6px;
  background: var(--glass-solid, var(--surface-2)); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
}
.app-sheets .sh-note-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.app-sheets .sh-note-ta { min-height: 80px; font-size: 13px; }
.app-sheets .sh-note-actions { display: flex; gap: 6px; align-items: center; }

/* ---------- side panel (pivot fields) ---------- */
.app-sheets .sh-side { width: 270px; flex: 0 0 auto; overflow-y: auto; border-left: 1px solid var(--line); background: var(--surface); padding: 10px 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.app-sheets .sh-side-head { display: flex; align-items: center; justify-content: space-between; }
.app-sheets .sh-side-head span { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
.app-sheets .sh-side-head .ic { color: var(--accent); }
.app-sheets .sh-side-label { font-size: 11.5px; font-weight: 700; color: var(--text-3); margin-top: 6px; }
.app-sheets .sh-side-row { display: flex; gap: 6px; }
.app-sheets .sh-side-row .input { flex: 1; min-width: 0; height: 30px; font-size: 12.5px; }
.app-sheets .sh-side-note { margin: 0; font-size: 12px; color: var(--text-2); }
.app-sheets .sh-pv-fields { display: flex; flex-direction: column; gap: 4px; }
.app-sheets .sh-pv-field { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 4px 6px; align-items: center; padding: 5px 6px; border-radius: 8px; }
.app-sheets .sh-pv-field.on { background: rgba(var(--accent-rgb), .08); }
.app-sheets .sh-pv-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-sheets .sh-pv-sel, .app-sheets .sh-pv-agg { height: 28px; font-size: 12px; padding: 0 24px 0 8px; background-position: calc(100% - 13px) 12px, calc(100% - 8px) 12px; }
.app-sheets .sh-pv-agg { grid-column: 1 / -1; }
.app-sheets .sh-pv-sum { display: flex; gap: 8px; font-size: 12px; }
.app-sheets .sh-pv-sum b { width: 62px; flex: 0 0 auto; color: var(--text-3); }
.app-sheets .sh-side-actions { margin-top: 6px; }

/* ---------- footer: sheet tabs + status ---------- */
.app-sheets .sh-foot { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 8px; border-top: 1px solid var(--line); background: var(--sh-head); }
.app-sheets .sh-tabnav { display: flex; flex: 0 0 auto; }
.app-sheets .sh-tabnav button, .app-sheets .sh-tab-add { width: 26px; height: 26px; border: 0; border-radius: 7px; background: none; color: var(--text-2); display: grid; place-items: center; flex: 0 0 auto; }
.app-sheets .sh-tabnav button:hover, .app-sheets .sh-tab-add:hover { background: var(--hover); color: var(--text); }
.app-sheets .sh-tabs { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; flex: 0 1 auto; }
.app-sheets .sh-tabs::-webkit-scrollbar { display: none; }
.app-sheets .sh-tab {
  position: relative; flex: 0 0 auto; height: 26px; padding: 0 13px; border: 0; border-radius: 7px; background: none; display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; max-width: 200px;
}
.app-sheets .sh-tab span { overflow: hidden; text-overflow: ellipsis; }
.app-sheets .sh-tab:hover { background: var(--hover); color: var(--text); }
.app-sheets .sh-tab.on { background: var(--sh-bg); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .14), inset 0 -2px 0 var(--accent); }
.app-sheets .sh-tab.dropping { box-shadow: inset 2px 0 0 var(--accent); }
.app-sheets .sh-tabcolor { position: absolute; left: 6px; right: 6px; bottom: 0; height: 3px; border-radius: 2px; }
.app-sheets .sh-tab.pivot::before { content: ''; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.app-sheets .sh-tabic { display: inline-grid; color: var(--text-3); }
.app-sheets .sh-stats { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; padding-left: 10px; min-width: 0; }
.app-sheets .sh-stats b { color: var(--text); font-weight: 600; margin-left: 4px; font-variant-numeric: tabular-nums; }
.app-sheets .sh-mode { font-weight: 600; color: var(--text-2); }
.app-sheets .sh-hintpill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; background: rgba(var(--accent-rgb), .14); color: var(--accent); font-weight: 600; }
.app-sheets .sh-zoom { display: flex; align-items: center; gap: 1px; flex: 0 0 auto; margin-left: 8px; }
.app-sheets .sh-zbtn { width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--text-2); display: grid; place-items: center; }
.app-sheets .sh-zbtn:hover, .app-sheets .sh-zlbl:hover { background: var(--hover); color: var(--text); }
.app-sheets .sh-zlbl { min-width: 46px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- find & replace ---------- */
.app-sheets .sh-find {
  position: absolute; z-index: 24; top: 8px; right: 18px; width: 380px; padding: 8px; border-radius: 12px; display: flex; flex-direction: column; gap: 6px;
  background: var(--glass-solid, var(--surface-2)); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
}
.app-sheets .sh-find-row { display: flex; align-items: center; gap: 4px; }
.app-sheets .sh-find .input { flex: 1; min-width: 0; height: 30px; font-size: 13px; }
.app-sheets .sh-find .icon-btn { width: 28px; height: 28px; }
.app-sheets .sh-find-count { font-size: 11.5px; color: var(--text-3); white-space: nowrap; padding: 0 4px; }
.app-sheets .sh-find-reprow, .app-sheets .sh-find-opts { display: none; }
.app-sheets .sh-find.rep .sh-find-reprow, .app-sheets .sh-find.rep .sh-find-opts { display: flex; }
.app-sheets .sh-find.rep .sh-find-toggle .ic { transform: rotate(180deg); }
.app-sheets .sh-find-opts { flex-wrap: wrap; gap: 8px; font-size: 12px; }
.app-sheets .sh-find-opt { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); }
.app-sheets .sh-find-sel { height: 28px; font-size: 12px; padding: 0 24px 0 8px; background-position: calc(100% - 13px) 12px, calc(100% - 8px) 12px; }

/* ---------- popovers, dialogs (inside the window) ---------- */
.app-sheets .sh-layer { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
.app-sheets .sh-layer > * { pointer-events: auto; }
.app-sheets .sh-pop { position: absolute; z-index: 45; }
.app-sheets .sh-filter {
  width: 264px; padding: 6px; border-radius: 12px; display: flex; flex-direction: column; gap: 2px;
  background: var(--glass-solid, var(--surface-2)); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
}
.app-sheets .sh-fl-act { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border: 0; border-radius: 7px; background: none; color: var(--text); font-size: 12.5px; text-align: left; }
.app-sheets .sh-fl-act span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-sheets .sh-fl-act .ic { color: var(--text-3); flex: 0 0 auto; }
.app-sheets .sh-fl-act:hover { background: var(--hover); }
.app-sheets .sh-fl-act:disabled { opacity: .4; pointer-events: none; }
.app-sheets .sh-fl-sep { height: 1px; background: var(--line); margin: 3px 2px; }
.app-sheets .sh-fl-search { height: 30px; font-size: 12.5px; margin: 2px 0 4px; }
.app-sheets .sh-fl-list { max-height: 210px; overflow-y: auto; border-radius: 8px; background: var(--sh-bg); box-shadow: inset 0 0 0 1px var(--line); padding: 4px 0; }
.app-sheets .sh-fl-item { display: flex; align-items: center; gap: 8px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; }
.app-sheets .sh-fl-item:hover { background: var(--hover); }
.app-sheets .sh-fl-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-sheets .sh-fl-item small { color: var(--text-3); font-size: 11px; }
.app-sheets .sh-fl-all { padding-left: 10px; font-weight: 600; }
.app-sheets .sh-fl-more { padding: 6px 10px; font-size: 11.5px; color: var(--text-3); }
.app-sheets .sh-fl-actions { display: flex; justify-content: flex-end; gap: 6px; padding: 6px 2px 2px; }
.app-sheets input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; flex: 0 0 auto; }

.app-sheets .sh-veil { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .28); animation: sh-fade .14s; }
.app-sheets .sh-veil.closing { opacity: 0; transition: opacity .14s; }
@keyframes sh-fade { from { opacity: 0; } }
.app-sheets .sh-dlg {
  width: min(440px, 100%); max-height: 100%; display: flex; flex-direction: column; border-radius: 16px;
  background: var(--glass-strong, var(--surface)); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--glass-border, var(--line-2)); box-shadow: var(--shadow-pop); animation: sh-dlg-in .2s var(--ease, ease);
}
.app-sheets .sh-dlg.wide { width: min(600px, 100%); }
@keyframes sh-dlg-in { from { opacity: 0; transform: scale(.96); } }
.app-sheets .sh-dlg-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 8px 16px; }
.app-sheets .sh-dlg-head h2 { flex: 1; margin: 0; font-size: 15px; font-weight: 700; }
.app-sheets .sh-dlg-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(var(--accent-rgb), .16); color: var(--accent); flex: 0 0 auto; }
.app-sheets .sh-dlg-x { width: 30px; height: 30px; color: var(--text-3); }
.app-sheets .sh-dlg-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 8px; display: flex; flex-direction: column; gap: 9px; }
.app-sheets .sh-dlg-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; align-items: center; }
.app-sheets .sh-dlg-row > label { font-size: 12.5px; color: var(--text-2); }
.app-sheets .sh-dlg-ctl { display: flex; gap: 6px; align-items: center; min-width: 0; flex-wrap: wrap; }
.app-sheets .sh-dlg-ctl > .input, .app-sheets .sh-dlg-ctl > .select, .app-sheets .sh-dlg-ctl > .textarea { flex: 1; min-width: 0; width: 100%; }
.app-sheets .sh-dlg .input, .app-sheets .sh-dlg .select { height: 32px; font-size: 13px; }
.app-sheets .sh-dlg-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.app-sheets .sh-dlg-stack { display: flex; flex-direction: column; gap: 6px; }
.app-sheets .sh-dlg-stack.row { flex-direction: row; flex-wrap: wrap; }
.app-sheets .sh-dlg-note { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.45; }
.app-sheets .sh-dlg-sub { font-size: 12px; font-weight: 700; color: var(--text-3); margin-top: 4px; }
.app-sheets .sh-dlg-err { margin: 0 16px 6px; padding: 7px 10px; border-radius: 8px; background: rgba(229, 72, 77, .12); color: #e5484d; font-size: 12.5px; font-weight: 600; }
.app-sheets .sh-dlg-actions { display: flex; align-items: center; gap: 8px; padding: 10px 16px 14px; }
.app-sheets .sh-dlg-tabs { align-self: flex-start; flex-wrap: wrap; margin-bottom: 2px; }
.app-sheets .sh-fmt-pane { display: flex; flex-direction: column; gap: 9px; }
.app-sheets .sh-fmt-number { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; }
.app-sheets .sh-fmt-number .sh-dlg-row { grid-template-columns: 116px minmax(0, 1fr); }
.app-sheets .sh-nf-cats { display: flex; flex-direction: column; gap: 1px; border-radius: 10px; background: var(--sh-bg); box-shadow: inset 0 0 0 1px var(--line); padding: 4px; align-self: start; }
.app-sheets .sh-nf-cat { height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: none; color: var(--text); text-align: left; font-size: 12.5px; }
.app-sheets .sh-nf-cat:hover { background: var(--hover); }
.app-sheets .sh-nf-cat.on { background: rgba(var(--accent-rgb), .16); color: var(--accent); font-weight: 600; }
.app-sheets .sh-nf-opts { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.app-sheets .sh-nf-preview { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--sh-bg); box-shadow: inset 0 0 0 1px var(--line); font-size: 12px; color: var(--text-3); }
.app-sheets .sh-nf-preview b { font: 600 15px var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-sheets .sh-bd-preview { height: 64px; border-radius: 4px; display: grid; place-items: center; color: var(--text-3); font-size: 12px; background: var(--sh-bg); }
.app-sheets .sh-colorbtn { gap: 8px; justify-content: flex-start; min-width: 130px; }
.app-sheets .sh-cf-sw { width: 18px; height: 18px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--line-2); flex: 0 0 auto; }
.app-sheets .sh-cf-sw.none { background: linear-gradient(135deg, transparent 45%, #e5484d 45%, #e5484d 55%, transparent 55%) !important; }
.app-sheets .sh-cf-lbl { font: 12px var(--mono); }
.app-sheets .sh-dlg-preview { max-height: 120px; overflow: auto; border-radius: 8px; background: var(--sh-bg); box-shadow: inset 0 0 0 1px var(--line); }
.app-sheets .sh-dlg-preview table { border-collapse: collapse; font-size: 12px; }
.app-sheets .sh-dlg-preview td { padding: 3px 8px; border: 1px solid var(--line); white-space: nowrap; }
.app-sheets .sh-rules, .app-sheets .sh-names { display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.app-sheets .sh-rule, .app-sheets .sh-name { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 8px; border-radius: 9px; background: var(--sh-bg); box-shadow: inset 0 0 0 1px var(--line); }
.app-sheets .sh-rule .icon-btn, .app-sheets .sh-name .icon-btn { width: 28px; height: 28px; color: var(--text-3); }
.app-sheets .sh-rule-prev { flex: 0 0 auto; }
.app-sheets .sh-rule-sw { display: grid; place-items: center; width: 44px; height: 26px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line-2); font-size: 12px; }
.app-sheets .sh-rule-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-sheets .sh-rule-main b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-sheets .sh-rule-main small { font: 11px var(--mono); color: var(--text-3); }
.app-sheets .sh-rules-empty { padding: 20px 10px; text-align: center; color: var(--text-3); font-size: 12.5px; }
.app-sheets .sh-name b { width: 110px; flex: 0 0 auto; font: 600 12.5px var(--mono); overflow: hidden; text-overflow: ellipsis; }
.app-sheets .sh-name .input { flex: 1; min-width: 0; height: 30px; font: 12px var(--mono); }
.app-sheets .sh-name-val { width: 70px; flex: 0 0 auto; font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.app-sheets .sh-sort-levels { display: flex; flex-direction: column; gap: 6px; }
.app-sheets .sh-sort-level { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) 30px; gap: 6px; align-items: center; }
.app-sheets .sh-sort-lbl { font-size: 12px; color: var(--text-3); }
.app-sheets .sh-fn-top { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 8px; }
.app-sheets .sh-fn-body { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 10px; min-height: 260px; }
.app-sheets .sh-fn-list { max-height: 300px; overflow-y: auto; border-radius: 10px; background: var(--sh-bg); box-shadow: inset 0 0 0 1px var(--line); padding: 4px; outline: none; }
.app-sheets .sh-fn-item { display: flex; align-items: baseline; gap: 8px; width: 100%; padding: 5px 8px; border: 0; border-radius: 6px; background: none; color: var(--text); text-align: left; }
.app-sheets .sh-fn-item b { font: 600 12px var(--mono); flex: 0 0 auto; }
.app-sheets .sh-fn-item span { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-sheets .sh-fn-item:hover { background: var(--hover); }
.app-sheets .sh-fn-item.on { background: rgba(var(--accent-rgb), .16); }
.app-sheets .sh-fn-item.on b { color: var(--accent); }
.app-sheets .sh-fn-info { font-size: 12.5px; color: var(--text-2); }
.app-sheets .sh-fn-info code { display: block; font: 12px var(--mono); color: var(--text); padding: 8px; border-radius: 8px; background: var(--sh-bg); box-shadow: inset 0 0 0 1px var(--line); word-break: break-word; }
.app-sheets .sh-fn-info small { color: var(--text-3); }

/* colour popup */
.app-sheets .sh-colorpop {
  position: absolute; z-index: 60; width: 244px; padding: 8px; border-radius: 12px; display: flex; flex-direction: column; gap: 6px;
  background: var(--glass-solid, var(--surface-2)); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
}
.app-sheets .sh-sw-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.app-sheets .sh-sw { width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .3); transition: transform .08s; }
.app-sheets .sh-sw:hover { transform: scale(1.15); }
.app-sheets .sh-sw-label { font-size: 11px; color: var(--text-3); font-weight: 600; }
.app-sheets .sh-pop-auto { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 6px; border: 0; border-radius: 7px; background: none; color: var(--text); font-size: 12.5px; font-weight: 600; text-align: left; }
.app-sheets .sh-pop-auto:hover { background: var(--hover); }
.app-sheets .sh-sw-none { width: 18px; height: 18px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--line-2); background: linear-gradient(135deg, transparent 45%, #e5484d 45%, #e5484d 55%, transparent 55%); }
.app-sheets .sh-hexrow { display: flex; gap: 6px; align-items: center; }
.app-sheets .sh-hex { flex: 1; height: 28px; font: 12px var(--mono); padding: 0 8px; }
.app-sheets .sh-hexrow label { position: relative; overflow: hidden; }
.app-sheets .sh-native-color { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- backstage (File) + start ---------- */
.app-sheets .sh-back { position: absolute; inset: 0; z-index: 30; display: flex; background: var(--surface); animation: sh-fade .14s; }
.app-sheets .sh-back-nav { width: 196px; flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; background: linear-gradient(180deg, #1e9e55, #157a41); color: #fff; overflow-y: auto; }
.app-sheets .sh-back-item, .app-sheets .sh-back-return { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: rgba(255, 255, 255, .9); font-size: 13.5px; font-weight: 600; text-align: left; }
.app-sheets .sh-back-item:hover, .app-sheets .sh-back-return:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.app-sheets .sh-back-item.on { background: rgba(255, 255, 255, .22); color: #fff; }
.app-sheets .sh-back-return { margin-bottom: 8px; }
.app-sheets .sh-back-main { flex: 1; min-width: 0; overflow-y: auto; padding: 26px 34px 40px; }
.app-sheets .sh-back-main > * { max-width: 980px; }
.app-sheets .sh-back-head h1 { margin: 0; font: 600 26px var(--font-display); letter-spacing: -.01em; }
.app-sheets .sh-back-head p { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; }
.app-sheets .sh-start-sub { margin: 24px 0 10px; font-size: 14px; font-weight: 700; color: var(--text-2); }
.app-sheets .sh-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 16px; margin-top: 4px; }
.app-sheets .sh-tpl { display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 0; border: 0; background: none; color: var(--text); text-align: left; }
.app-sheets .sh-tpl-th { display: block; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; margin-bottom: 8px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); transition: box-shadow .14s, transform .14s; }
.app-sheets .sh-tpl:hover .sh-tpl-th, .app-sheets .sh-tpl:focus-visible .sh-tpl-th { box-shadow: inset 0 0 0 2px var(--accent); transform: translateY(-2px); }
.app-sheets .sh-tpl:focus-visible { outline: none; }
.app-sheets .sh-tpl-th svg { display: block; width: 100%; height: 100%; }
.app-sheets .sh-tpl-th .g line { stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.app-sheets .sh-tpl-th .a { fill: var(--accent); }
.app-sheets .sh-tpl-th .t { fill: rgba(var(--accent-rgb), .2); }
.app-sheets .sh-tpl-th .t2 { fill: rgba(var(--accent-rgb), .38); }
.app-sheets .sh-tpl-th .ln { stroke: var(--accent); stroke-width: 2.5; fill: none; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.app-sheets .sh-tpl-th .ln2 { stroke: #f59e0b; stroke-width: 2; fill: none; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.app-sheets .sh-th-plus circle { fill: var(--accent); }
.app-sheets .sh-th-plus path { stroke: var(--accent-fg); stroke-width: 2.4; stroke-linecap: round; }
.app-sheets .sh-tpl-name { font-size: 13.5px; font-weight: 700; }
.app-sheets .sh-tpl-desc { font-size: 12px; color: var(--text-3); }
.app-sheets .sh-more { margin-top: 10px; font-size: 13px; }
.app-sheets .sh-open-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.app-sheets .sh-open-btns.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-top: 14px; }
.app-sheets .sh-open-btn {
  flex: 1 1 220px; display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left;
  padding: 12px 14px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line);
}
.app-sheets .sh-open-btn:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.app-sheets .sh-open-btn .ic { grid-row: 1 / 3; color: var(--accent); }
.app-sheets .sh-open-btn b { font-size: 13.5px; }
.app-sheets .sh-open-btn span { font-size: 12px; color: var(--text-3); }
.app-sheets .sh-drop { margin-top: 14px; height: 74px; border-radius: 12px; border: 2px dashed var(--line-2); display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text-3); font-size: 13px; }
.app-sheets .sh-drop.on { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb), .06); }
.app-sheets .sh-recent { overflow: hidden; }
.app-sheets .sh-recent-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto 72px; align-items: center; gap: 12px; width: 100%; padding: 8px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); text-align: left; }
.app-sheets .sh-recent-row:last-child { border-bottom: 0; }
.app-sheets .sh-recent-row:hover { background: var(--hover); }
.app-sheets .sh-recent-ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: rgba(34, 165, 101, .16); color: #22a565; }
.app-sheets .sh-recent-ic.csv, .app-sheets .sh-recent-ic.tsv { background: rgba(var(--accent-rgb), .14); color: var(--accent); }
.app-sheets .sh-recent-ic.ods { background: rgba(59, 130, 246, .14); color: #3b82f6; }
.app-sheets .sh-recent-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.app-sheets .sh-recent-dir, .app-sheets .sh-recent-time { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.app-sheets .sh-recent-time { text-align: right; }
.app-sheets .sh-recent-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 16px; text-align: center; color: var(--text-3); font-size: 12.5px; }
.app-sheets .sh-recent-empty b { color: var(--text-2); font-size: 13.5px; }
.app-sheets .sh-saveas { display: grid; grid-template-columns: 110px minmax(0, 480px); gap: 12px 14px; align-items: center; margin-top: 18px; }
.app-sheets .sh-saveas > label { font-size: 13px; color: var(--text-2); }
.app-sheets .sh-saveas-actions { grid-column: 2; display: flex; gap: 8px; margin-top: 6px; }
.app-sheets .sh-dirrow { display: flex; align-items: center; gap: 10px; }
.app-sheets .sh-dirlbl { font: 12.5px var(--mono); color: var(--text-2); }
.app-sheets .sh-fmt-cards { display: grid; gap: 6px; }
.app-sheets .sh-fmt-card { display: flex; flex-direction: column; gap: 1px; padding: 9px 12px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--text); text-align: left; box-shadow: inset 0 0 0 1px var(--line); }
.app-sheets .sh-fmt-card b { font-size: 13px; }
.app-sheets .sh-fmt-card span { font-size: 12px; color: var(--text-3); }
.app-sheets .sh-fmt-card.on { box-shadow: inset 0 0 0 2px var(--accent); background: rgba(var(--accent-rgb), .08); }
.app-sheets .sh-info { margin-top: 18px; max-width: 560px; }
.app-sheets .sh-info-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.app-sheets .sh-info-row:last-child { border-bottom: 0; }
.app-sheets .sh-info-row span { color: var(--text-3); }
.app-sheets .sh-info-row b { font-weight: 600; text-align: right; word-break: break-all; }
.app-sheets .sh-loading { position: absolute; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; gap: 10px; background: rgba(var(--sh-bg-rgb), .7); font-size: 13px; color: var(--text-2); }
.sh-printframe { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; visibility: hidden; }

/* ---------- phone ---------- */
@media (max-width: 759px) {
  .app-sheets .sh-rtabs { overflow-x: auto; scrollbar-width: none; }
  .app-sheets .sh-rtabs::-webkit-scrollbar { display: none; }
  .app-sheets .sh-quick { display: none; }
  .app-sheets .sh-rbody { min-height: 0; padding: 4px; }
  .app-sheets .sh-rgroup { padding: 0 4px; }
  .app-sheets .sh-rgroup-label { display: none; }
  .app-sheets .sh-rgroup-items { align-items: center; }
  .app-sheets .sh-rstack { flex-direction: row; }
  .app-sheets .sh-rb { min-width: 34px; height: 34px; }
  .app-sheets .sh-rb.big { flex-direction: row; height: 34px; min-width: 34px; font-size: 12px; padding: 0 8px; }
  .app-sheets .sh-rb.big span { max-width: none; white-space: nowrap; }
  .app-sheets .sh-rb.big .ic { width: 18px; height: 18px; }
  .app-sheets .sh-pastewrap .sh-paste-dd { height: 34px; }
  .app-sheets .sh-fontsel { width: 104px; }
  .app-sheets .sh-nfsel { width: 116px; }
  .app-sheets .sh-namewrap { display: none; }
  .app-sheets .sh-fxbtns .sh-fxbtn:not(.sh-fxbtn-fn) { display: none; }
  .app-sheets .sh-fx { font-size: 14px; }
  .app-sheets .sh-stats { gap: 10px; font-size: 11.5px; }
  .app-sheets .sh-stats .sh-stat-avg, .app-sheets .sh-stats .sh-stat-mm, .app-sheets .sh-stats .sh-mode { display: none; }
  .app-sheets .sh-tabnav, .app-sheets .sh-zoom .sh-zbtn { display: none; }
  .app-sheets .sh-side { position: absolute; right: 0; top: 0; bottom: 0; z-index: 20; width: min(300px, 86%); box-shadow: var(--shadow-pop); }
  .app-sheets .sh-mainrow { position: relative; }
  .app-sheets .sh-back { flex-direction: column; }
  .app-sheets .sh-back-nav { width: auto; flex-direction: row; overflow-x: auto; padding: 8px; gap: 4px; }
  .app-sheets .sh-back-item, .app-sheets .sh-back-return { height: 34px; padding: 0 10px; white-space: nowrap; flex: 0 0 auto; margin: 0; }
  .app-sheets .sh-back-main { padding: 18px 16px 32px; }
  .app-sheets .sh-tpls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .app-sheets .sh-recent-row { grid-template-columns: 32px minmax(0, 1fr) 64px; }
  .app-sheets .sh-recent-dir { display: none; }
  .app-sheets .sh-saveas { grid-template-columns: 1fr; }
  .app-sheets .sh-saveas-actions { grid-column: 1; }
  .app-sheets .sh-dlg-row { grid-template-columns: 1fr; gap: 4px; }
  .app-sheets .sh-fmt-number { grid-template-columns: 1fr; }
  .app-sheets .sh-nf-cats { flex-direction: row; flex-wrap: wrap; }
  .app-sheets .sh-fn-top, .app-sheets .sh-fn-body { grid-template-columns: 1fr; }
  .app-sheets .sh-find { left: 8px; right: 8px; width: auto; }
  .app-sheets .sh-veil { padding: 8px; }
  .sh-bar .sh-savestate { display: none; }
  .sh-bar .sh-docname { max-width: 46vw; }
}
