/* ⭐ Sheets Studio (2026-11-11) — loaded on demand with sheets.js */

/* ================= the page in the app ================= */
#studentSheetsView { padding: 0; }
html.sh-editing, html.sh-editing body { overflow: hidden; }
/* the view's fade-in moves it (transform), which would carry the fixed editor along and misplace every tap */
html.sh-editing #studentSheetsView { animation: none !important; transform: none !important; }
html.sh-editing #appHeader, html.sh-editing .mobile-bottom-nav, html.sh-editing #appFooter, html.sh-editing .app-footer, html.sh-editing #askFab { display: none !important; }
.sh-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 70px 16px; color: var(--text-secondary); }
.sh-empty { text-align: center; padding: 56px 16px; color: var(--text-secondary); background: var(--bg-surface); border: 1px dashed var(--border-default); border-radius: 16px; }
.sh-empty.small { padding: 22px 16px; }
.sh-empty > i { font-size: 34px; color: #16a34a; margin-bottom: 10px; display: block; }
.sh-empty h3 { margin: 4px 0 6px; color: var(--text-primary); }
.sh-empty p { margin: 0 auto 14px; max-width: 520px; }
.sh-grow { flex: 1; }
.sh-hint { font-size: 12.5px; color: var(--text-secondary); margin: 6px 0; line-height: 1.45; }
.sh-hint code, .sh-dlg code { font-size: 12px; background: var(--bg-surface-2); padding: 1px 4px; border-radius: 4px; }
.sh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- home ---------- */
.sh-home { max-width: 1240px; margin: 0 auto; padding: 4px 0 40px; }
.sh-home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.sh-home-head h2 { margin: 0 0 4px; font-size: 24px; color: var(--text-primary); display: flex; align-items: center; gap: 10px; }
.sh-home-head h2 i { color: #16a34a; }
.sh-home-head p { margin: 0; color: var(--text-secondary); font-size: 14px; max-width: 660px; line-height: 1.5; }
.sh-home-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.sh-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 22px 0 10px; }
.sh-sec-head h3 { margin: 0; font-size: 16px; color: var(--text-primary); }
.sh-sec-head h3 small { font-weight: 500; color: var(--text-tertiary, var(--text-secondary)); font-size: 12px; margin-left: 6px; }
.sh-tpls { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(190px, 210px); gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x proximity; }
.sh-tpls:empty { display: none; }
.sh-tpl { display: flex; flex-direction: column; gap: 5px; text-align: left; border: 1px solid var(--border-subtle); background: var(--bg-surface); border-radius: 14px; padding: 12px; cursor: pointer; scroll-snap-align: start; transition: border-color .15s, transform .15s, box-shadow .15s; color: inherit; font: inherit; }
.sh-tpl:hover, .sh-tpl:focus-visible { border-color: #86efac; transform: translateY(-2px); box-shadow: var(--shadow-md); outline: none; }
.sh-tpl-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #dcfce7, #d1fae5); color: #15803d; font-size: 17px; margin-bottom: 4px; }
[data-theme="dark"] .sh-tpl-ic, [data-theme="dim"] .sh-tpl-ic { background: rgba(34, 197, 94, .15); color: #4ade80; }
.sh-tpl b { font-size: 13.5px; color: var(--text-primary); }
.sh-tpl > span:last-child { font-size: 12px; color: var(--text-secondary); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sh-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sh-search { display: flex; align-items: center; gap: 6px; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 10px; padding: 0 10px; height: 34px; color: var(--text-secondary); }
.sh-search input { border: 0; background: transparent; outline: none; width: 160px; color: var(--text-primary); font: inherit; font-size: 13px; }
.sh-filters select { height: 34px; border-radius: 10px; border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--text-primary); padding: 0 8px; font: inherit; font-size: 13px; }
.sh-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--text-secondary); cursor: pointer; font: inherit; font-size: 12.5px; white-space: nowrap; }
.sh-chip:hover { color: var(--text-primary); border-color: var(--border-strong); }
.sh-chip.on { background: rgba(22, 163, 74, .1); color: #15803d; border-color: #86efac; }
.sh-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.sh-list > .sh-empty { grid-column: 1 / -1; }
.sh-card { position: relative; display: flex; align-items: center; gap: 12px; border: 1px solid var(--border-subtle); background: var(--bg-surface); border-radius: 14px; padding: 12px 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; min-width: 0; }
.sh-card:hover, .sh-card:focus-visible { border-color: #86efac; box-shadow: var(--shadow-md); transform: translateY(-1px); outline: none; }
.sh-card-ic { width: 42px; height: 42px; flex-shrink: 0; border-radius: 11px; display: grid; place-items: center; font-size: 19px; color: #fff; background: linear-gradient(135deg, #22c55e, #059669); }
.sh-card-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sh-card-meta b { color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.sh-card-meta span { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-card-acts { display: flex; gap: 2px; }
.sh-ib { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text-secondary); display: inline-grid; place-items: center; cursor: pointer; flex-shrink: 0; font: inherit; }
.sh-ib:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.sh-ib:focus-visible { outline: 2px solid var(--brand-500); }
.sh-ib.on { color: #f59e0b; }
.sh-foot-note { margin-top: 18px; font-size: 12px; color: var(--text-secondary); }
.sh-join { max-width: 520px; margin: 40px auto; text-align: center; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 18px; padding: 28px 24px; }
.sh-join-ic { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; color: #fff; background: linear-gradient(135deg, #22c55e, #0891b2); }
.sh-join h3 { margin: 0 0 8px; color: var(--text-primary); }
.sh-join p { color: var(--text-secondary); line-height: 1.5; }
.sh-btnrow { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.sh-share-sec .sh-btnrow, .sh-side .sh-btnrow { justify-content: flex-start; }

/* ---------- dialogs, menus, pop-overs ---------- */
.sh-dlg-ov { position: fixed; inset: 0; z-index: 9500; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(2px); }
.sh-dlg { background: var(--bg-elevated, var(--bg-surface)); color: var(--text-primary); border-radius: 18px; box-shadow: var(--shadow-xl, 0 20px 60px rgba(0,0,0,.3)); width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; padding: 20px 22px; }
.sh-dlg.wide { max-width: 860px; }
.sh-dlg h3 { margin: 0 0 10px; font-size: 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sh-dlg h3 i { color: #16a34a; }
.sh-dlg-sub { font-size: 12px; font-weight: 600; color: var(--text-secondary); background: var(--bg-surface-2); padding: 3px 8px; border-radius: 999px; }
.sh-dlg-p { color: var(--text-secondary); font-size: 14px; line-height: 1.5; margin: 0 0 12px; }
.sh-dlg-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.sh-err-msg { color: #dc2626; font-size: 13px; margin: 0 0 6px; }
.sh-field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.sh-field input, .sh-field textarea, .sh-field select, .sh-side input:not([type=checkbox]):not([type=color]), .sh-side textarea, .sh-side select { width: 100%; border: 1px solid var(--border-default); border-radius: 10px; padding: 8px 10px; background: var(--bg-surface); color: var(--text-primary); font: inherit; font-weight: 400; font-size: 14px; box-sizing: border-box; }
.sh-field textarea, .sh-side textarea { resize: vertical; min-height: 60px; }
.sh-field input:focus, .sh-field textarea:focus, .sh-field select:focus, .sh-side input:focus, .sh-side textarea:focus { outline: 2px solid var(--brand-500); outline-offset: 0; border-color: transparent; }
.sh-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sh-check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-secondary); margin: 4px 12px 8px 0; cursor: pointer; }
.sh-busy-dlg { max-width: 420px; }
.sh-busy { display: flex; gap: 14px; align-items: center; }
.sh-busy > i { font-size: 26px; color: #16a34a; }
.sh-busy p { margin: 4px 0 0; color: var(--text-secondary); font-size: 13px; min-height: 1.2em; }
.sh-menu { position: fixed; z-index: 9800; min-width: 210px; max-width: 340px; max-height: calc(100vh - 16px); overflow: auto; background: var(--bg-elevated, var(--bg-surface)); border: 1px solid var(--border-subtle); border-radius: 12px; box-shadow: var(--shadow-lg, 0 12px 40px rgba(0,0,0,.2)); padding: 5px; }
.sh-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: transparent; color: var(--text-primary); text-align: left; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13.5px; }
.sh-menu button > i:first-child { width: 18px; text-align: center; color: var(--text-secondary); flex-shrink: 0; }
.sh-menu button:hover, .sh-menu button:focus { background: var(--bg-surface-2); outline: none; }
.sh-menu button.danger, .sh-menu button.danger i { color: #dc2626; }
.sh-menu button:disabled { opacity: .45; cursor: default; }
.sh-menu button span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-menu kbd { font: inherit; font-size: 11px; color: var(--text-tertiary, #94a3b8); }
.sh-menu-on { color: #16a34a !important; }
.sh-menu-sub { font-size: 10px; color: var(--text-tertiary, #94a3b8); }
.sh-menu-sep { height: 1px; background: var(--border-subtle); margin: 4px 6px; }
.sh-menu-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary, #94a3b8); padding: 8px 10px 4px; font-weight: 700; }
.sh-sw-dot { width: 14px !important; height: 14px; border-radius: 4px; border: 1px solid var(--border-default); display: inline-block; }
.sh-pop { position: fixed; z-index: 9800; background: var(--bg-elevated, var(--bg-surface)); border: 1px solid var(--border-subtle); border-radius: 14px; box-shadow: var(--shadow-lg, 0 12px 40px rgba(0,0,0,.2)); padding: 10px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto; color: var(--text-primary); }
.sh-pop-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary, #94a3b8); font-weight: 700; margin: 4px 2px 6px; }
.sh-cpop { width: 268px; }
.sh-sw { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; margin-bottom: 8px; }
.sh-sw button { width: 100%; aspect-ratio: 1; border-radius: 7px; border: 1px solid rgba(0, 0, 0, .12); cursor: pointer; padding: 0; }
.sh-sw button.on { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.sh-cp-row { display: flex; gap: 6px; align-items: center; }
.sh-cp-row input[type=color] { width: 40px; height: 32px; border: 0; padding: 0; background: none; cursor: pointer; }
.sh-cp-row input[type=text] { flex: 1; min-width: 0; height: 32px; border: 1px solid var(--border-default); border-radius: 8px; padding: 0 8px; font: inherit; font-size: 13px; background: var(--bg-surface); color: var(--text-primary); }
.sh-rows { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.sh-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border-subtle); border-radius: 10px; }
.sh-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sh-row b { color: var(--text-primary); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-row span { font-size: 12px; color: var(--text-secondary); }
.sh-hist-save { display: flex; gap: 8px; margin-bottom: 12px; }
.sh-hist-save input { flex: 1; min-width: 0; border: 1px solid var(--border-default); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13.5px; background: var(--bg-surface); color: var(--text-primary); }
.sh-hist-pv { padding: 6px 2px 10px; overflow-x: auto; }
.sh-mini-t { font-size: 12.5px; margin: 0 0 6px; color: var(--text-secondary); }
.sh-mini { border-collapse: collapse; font-size: 12px; }
.sh-mini th, .sh-mini td { border: 1px solid var(--border-subtle); padding: 3px 6px; min-width: 54px; max-width: 120px; overflow: hidden; white-space: nowrap; text-align: left; }
.sh-mini th { background: var(--bg-surface-2); color: var(--text-secondary); font-weight: 600; text-align: center; min-width: 22px; }
.sh-danger-t { color: #dc2626 !important; background: transparent; border: 1px solid transparent; }
.sh-danger-t:hover { background: rgba(220, 38, 38, .08); }
.sh-link { display: flex; gap: 8px; margin-bottom: 12px; }
.sh-link input { flex: 1; min-width: 0; border: 1px solid var(--border-default); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13px; background: var(--bg-surface-2); color: var(--text-primary); }
.sh-share-sec { border-top: 1px solid var(--border-subtle); padding-top: 12px; margin-top: 12px; }
.sh-share-sec:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.sh-share-sec h4 { margin: 0 0 8px; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.sh-members { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.sh-member { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.sh-member > div { flex: 1; display: flex; flex-direction: column; font-size: 13px; }
.sh-member > div span { font-size: 12px; color: var(--text-secondary); }
.sh-on { color: #16a34a; font-size: 8px; }
.sh-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.sh-av { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex-shrink: 0; border: 2px solid var(--bg-surface); }
.sh-av.more { background: #64748b; }
.sh-keys { width: 100%; border-collapse: collapse; font-size: 13px; }
.sh-keys td { padding: 5px 6px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); }
.sh-keys kbd { font: 600 11.5px/1.4 Inter, sans-serif; color: var(--text-primary); background: var(--bg-surface-2); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.sh-levels { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 10px; }
.sh-level { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sh-level span { width: 60px; font-size: 13px; color: var(--text-secondary); }
.sh-level select { flex: 1; min-width: 120px; height: 34px; border-radius: 9px; border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: 13px; padding: 0 6px; }
.sh-fx-top { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.sh-fx-top input { flex: 1; min-width: 200px; border: 1px solid var(--border-default); border-radius: 10px; padding: 8px 10px; font: inherit; background: var(--bg-surface); color: var(--text-primary); }
.sh-fx-top select { border: 1px solid var(--border-default); border-radius: 10px; padding: 0 8px; font: inherit; background: var(--bg-surface); color: var(--text-primary); }
.sh-fxd { display: grid; grid-template-columns: 220px 1fr; gap: 12px; height: min(50vh, 380px); }
.sh-fx-list { overflow: auto; border: 1px solid var(--border-subtle); border-radius: 10px; padding: 4px; }
.sh-fx-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 5px 8px; border-radius: 6px; font: 600 12.5px/1.3 'JetBrains Mono', Menlo, monospace; color: var(--text-primary); cursor: pointer; }
.sh-fx-list button:hover, .sh-fx-list button.on { background: rgba(22, 163, 74, .12); color: #15803d; }
.sh-fx-info { overflow: auto; font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; }
.sh-fx-sig { display: block; font: 600 13px/1.4 'JetBrains Mono', Menlo, monospace; color: var(--text-primary); margin-bottom: 6px; word-break: break-word; }
.sh-fx-info code { display: inline-block; margin: 4px 0 8px; }
.sh-fx-info small { display: block; color: var(--text-tertiary, #94a3b8); }
.sh-dlg.sh-cmd { max-width: 600px; padding: 0; overflow: hidden; align-self: flex-start; margin-top: 12vh; }
.sh-cmd-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); }
.sh-cmd-in input { flex: 1; border: 0; outline: none; background: transparent; font: inherit; font-size: 16px; color: var(--text-primary); }
.sh-cmd-in kbd { font: 600 11px/1 Inter, sans-serif; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border-subtle); color: var(--text-secondary); }
.sh-cmd-list { max-height: min(56vh, 460px); overflow: auto; padding: 6px; }
.sh-cmd-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: none; font: inherit; font-size: 14px; color: var(--text-primary); cursor: pointer; text-align: left; }
.sh-cmd-row i { width: 18px; text-align: center; color: var(--text-secondary); }
.sh-cmd-row.on, .sh-cmd-row:hover { background: rgba(22, 163, 74, .1); }
.sh-cmd-row.on i { color: #16a34a; }
.sh-cmd-none { color: var(--text-secondary); font-size: 13.5px; padding: 18px 12px; margin: 0; text-align: center; }
.sh-filt-pop { width: 290px; }
.sh-filt-sort { display: flex; gap: 6px; margin-bottom: 8px; }
.sh-filt-sort .btn { flex: 1; }
.sh-filt-cond { display: flex; gap: 6px; margin-bottom: 8px; }
.sh-filt-cond select, .sh-filt-cond input, .sh-filt-q { height: 32px; border: 1px solid var(--border-default); border-radius: 8px; background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: 13px; padding: 0 6px; min-width: 0; }
.sh-filt-cond select { flex: 1.3; } .sh-filt-cond input { flex: 1; }
.sh-filt-q { width: 100%; box-sizing: border-box; margin-bottom: 4px; }
.sh-filt-acts { font-size: 12px; color: var(--text-tertiary, #94a3b8); margin: 2px 0 4px; }
.sh-link-btn { border: 0; background: none; padding: 0; color: var(--brand-600); cursor: pointer; font: inherit; font-size: 12px; }
.sh-filt-list { max-height: 220px; overflow: auto; border: 1px solid var(--border-subtle); border-radius: 8px; padding: 4px; }
.sh-filt-list label { display: flex; align-items: center; gap: 7px; padding: 3px 4px; font-size: 13px; cursor: pointer; border-radius: 6px; }
.sh-filt-list label:hover { background: var(--bg-surface-2); }
.sh-filt-list label[hidden] { display: none; }
.sh-filt-list span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-filt-list small { color: var(--text-tertiary, #94a3b8); }

/* ================= the editor ================= */
.sh-ed { --sh-z: 1; --sh-bg: #ffffff; --sh-ink: #1f2937; --sh-grid: #e2e5e9; --sh-hdr: #f5f6f8; --sh-hdr-ink: #5f6368; --sh-hdr-line: #d6d9de; --sh-sel: #1a73e8; --sh-sel-tint: rgba(26, 115, 232, .10); --sh-hdr-on: #d3e3fd; --sh-hdr-on-ink: #0b57d0;
  position: fixed; left: 0; right: 0; top: var(--sh-top, 0px); bottom: 0; z-index: 150; display: flex; flex-direction: column; background: var(--bg-page, #f1f5f9); color: var(--text-primary); outline: none; }
[data-theme="dark"] .sh-ed, [data-theme="dim"] .sh-ed { --sh-bg: #1b1c22; --sh-ink: #e6e7ec; --sh-grid: #2d2f39; --sh-hdr: #23252e; --sh-hdr-ink: #a3a7b5; --sh-hdr-line: #343744; --sh-sel: #60a5fa; --sh-sel-tint: rgba(96, 165, 250, .14); --sh-hdr-on: #26375a; --sh-hdr-on-ink: #93c5fd; }
.sh-top { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle); min-height: 52px; flex-shrink: 0; }
.sh-tb { height: 32px; min-width: 32px; padding: 0 7px; border: 0; border-radius: 8px; background: transparent; color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; font: inherit; font-size: 13px; flex-shrink: 0; }
.sh-tb:hover:not(:disabled) { background: var(--bg-surface-2); color: var(--text-primary); }
.sh-tb:disabled { opacity: .38; cursor: default; }
.sh-tb:focus-visible { outline: 2px solid var(--brand-500); }
.sh-tb.on { background: rgba(26, 115, 232, .12); color: var(--sh-sel); }
.sh-tb.lbl span { font-size: 12.5px; font-weight: 600; }
.sh-tb-ai i { background: linear-gradient(135deg, #7c3aed, #db2777); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sh-back { width: 36px; border-radius: 10px; background: var(--bg-surface-2); }
.sh-logo { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #22c55e, #059669); flex-shrink: 0; font-size: 15px; }
.sh-titlebox { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.sh-title-in { border: 1px solid transparent; background: transparent; font: inherit; font-weight: 700; font-size: 15.5px; color: var(--text-primary); padding: 3px 6px; border-radius: 8px; width: 260px; min-width: 80px; text-overflow: ellipsis; }
.sh-title-in:hover:not([readonly]) { border-color: var(--border-subtle); }
.sh-title-in:focus { border-color: var(--brand-400); outline: none; background: var(--bg-surface); }
.sh-save { font-size: 11px; color: var(--text-secondary); white-space: nowrap; display: inline-flex; gap: 5px; align-items: center; margin: 0 0 0 7px; }
.sh-save.saved i, .sh-save.live i { color: #16a34a; }
.sh-save.live i { font-size: 8px; }
.sh-save.error, .sh-save.offline { color: #d97706; }
.sh-people { display: flex; align-items: center; gap: 0; border: 0; background: none; cursor: pointer; padding: 0 4px; font: inherit; color: var(--text-secondary); }
.sh-people .sh-av { margin-left: -6px; }
.sh-people .sh-av:first-child { margin-left: 0; }
.sh-people-n { font-size: 12px; margin-left: 6px; white-space: nowrap; }
.sh-cmd-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 11px; border-radius: 10px; border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--text-secondary); font: inherit; font-size: 12.5px; cursor: pointer; flex-shrink: 0; }
.sh-cmd-btn:hover { border-color: #86efac; color: var(--text-primary); }
.sh-cmd-btn kbd { font: 600 10.5px/1 Inter, sans-serif; padding: 4px 6px; border-radius: 6px; background: var(--bg-surface-2); border: 1px solid var(--border-subtle); color: var(--text-secondary); }
.sh-tools { display: flex; align-items: center; gap: 1px; padding: 4px 8px; background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle); overflow-x: auto; scrollbar-width: thin; flex-shrink: 0; }
.sh-tools[hidden] { display: none; }
.sh-tools .sh-tb { height: 30px; min-width: 30px; }
.sh-txt { font-weight: 700; font-size: 12.5px !important; letter-spacing: -.01em; }
.sh-txt i { font-size: 9px; }
.sh-sep { width: 1px; height: 20px; background: var(--border-subtle); margin: 0 5px; flex-shrink: 0; }
.sh-zoom-b span, .sh-font-b span { font-size: 12.5px; }
.sh-font-b { min-width: 96px; justify-content: space-between; border: 1px solid var(--border-subtle) !important; }
.sh-font-b span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-size { display: inline-flex; align-items: center; flex-shrink: 0; }
.sh-size .sh-tb { min-width: 24px; width: 24px; padding: 0; font-size: 10px; }
.sh-size input { width: 34px; height: 26px; text-align: center; border: 1px solid var(--border-subtle); border-radius: 6px; background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: 12.5px; }
.sh-col-b { flex-direction: column; gap: 0 !important; padding-top: 2px !important; }
.sh-col-b i { font-size: 12px; }
.sh-col-bar { width: 16px; height: 3px; border-radius: 1px; margin-top: 1px; border: 1px solid var(--border-subtle); }
.sh-banner[hidden] { display: none; }
.sh-banner { display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: 13px; flex-wrap: wrap; flex-shrink: 0; }
.sh-banner.warn { background: #fef3c7; color: #78350f; }
.sh-banner > span { flex: 1; min-width: 200px; }

/* formula bar */
.sh-fbar { display: flex; align-items: stretch; gap: 0; background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; min-height: 32px; }
.sh-namebox { width: 110px; border: 0; border-right: 1px solid var(--border-subtle); background: transparent; color: var(--text-primary); font: 500 13px/1 Inter, sans-serif; padding: 0 10px; outline: none; flex-shrink: 0; }
.sh-namebox:focus { box-shadow: inset 0 0 0 2px var(--sh-sel); }
.sh-fx { display: inline-flex; align-items: center; gap: 2px; border: 0; border-right: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary); padding: 0 10px; cursor: pointer; font: italic 700 13px/1 Georgia, serif; flex-shrink: 0; }
.sh-fx > i { display: none; }
.sh-fx:hover { color: #16a34a; }
.sh-bar { flex: 1; min-width: 0; height: 32px; }
.sh-ed.bar-tall .sh-bar { height: 92px; }
.sh-bar-x { height: auto !important; border-radius: 0 !important; }
.sh-ro .sh-bar-x, .sh-ro .sh-fx { display: none; }

/* the colour-coded text inputs (formula bar and cell editor) */
.sh-ci { position: relative; overflow: hidden; }
.sh-ci-hl, .sh-ci-ta { margin: 0; border: 0; font: inherit; line-height: 1.3; letter-spacing: normal; tab-size: 4; box-sizing: border-box; }
.sh-ci-hl { position: absolute; inset: 0; pointer-events: none; overflow: hidden; white-space: pre-wrap; word-break: break-all; color: var(--sh-ink); }
.sh-ci-ta { position: relative; display: block; width: 100%; height: 100%; resize: none; outline: none; background: transparent; color: transparent; caret-color: var(--sh-ink); overflow: hidden; white-space: pre-wrap; word-break: break-all; }
.sh-ci-ta::selection { background: rgba(26, 115, 232, .28); color: transparent; }
.sh-bar .sh-ci-hl, .sh-bar .sh-ci-ta { padding: 7px 10px; font: 13.5px/1.35 'JetBrains Mono', Menlo, Consolas, monospace; }
.sh-bar .sh-ci-ta { overflow-y: auto; }
.sh-ed.bar-tall .sh-bar .sh-ci-hl { overflow-y: auto; }
.t-func { color: #7c3aed; font-weight: 600; }
.t-num { color: #0d7a5f; }
.t-str { color: #b45309; }
.t-bool { color: #0369a1; font-weight: 600; }
.t-err { color: #dc2626; font-weight: 600; }
.t-op, .t-paren, .t-comma { color: var(--text-secondary); }
.t-name { color: #0891b2; font-style: italic; }
[data-theme="dark"] .t-func, [data-theme="dim"] .t-func { color: #c4b5fd; }
[data-theme="dark"] .t-num, [data-theme="dim"] .t-num { color: #6ee7b7; }
[data-theme="dark"] .t-str, [data-theme="dim"] .t-str { color: #fcd34d; }

/* main area */
.sh-main { flex: 1; display: flex; min-height: 0; position: relative; }
.sh-wrap { flex: 1; position: relative; overflow: hidden; min-width: 0; background: var(--sh-bg); }
.sh-scroll { position: absolute; inset: 0; overflow: auto; touch-action: pan-x pan-y; overscroll-behavior: contain; background: var(--sh-bg); outline: none; -webkit-user-select: none; user-select: none; scrollbar-width: thin; }
.sh-rg { position: relative; }
.sh-top-r { position: sticky; top: 0; z-index: 5; background: var(--sh-bg); }
.sh-corner { position: sticky; left: 0; z-index: 6; background: var(--sh-bg); }
.sh-body-r { z-index: 1; }
.sh-left { position: sticky; left: 0; z-index: 5; background: var(--sh-bg); }
.sh-l-lines, .sh-l-cells, .sh-l-hdrs, .sh-l-ov, .sh-l-charts { position: absolute; left: 0; top: 0; width: 0; height: 0; overflow: visible; }
.sh-l-lines { z-index: 0; } .sh-l-cells { z-index: 1; } .sh-l-ov { z-index: 2; pointer-events: none; } .sh-l-hdrs { z-index: 3; } .sh-l-charts { z-index: 4; }
.sh-frozen-r .sh-top-r { box-shadow: 0 2px 0 var(--sh-hdr-line), 0 4px 8px -6px rgba(0, 0, 0, .3); }
.sh-frozen-c .sh-corner, .sh-frozen-c .sh-left { box-shadow: 2px 0 0 var(--sh-hdr-line), 4px 0 8px -6px rgba(0, 0, 0, .3); }
.sh-top-r:not(.x), .sh-left { }
.sh-vl, .sh-hl { position: absolute; background: var(--sh-grid); display: block; }
.sh-vl { width: 1px; } .sh-hl { height: 1px; }
.sh-r { display: contents; }
.sh-c { position: absolute; display: flex; flex-direction: column; justify-content: flex-end; box-sizing: border-box; padding: 0 calc(4px * var(--sh-z)) calc(2px * var(--sh-z)); overflow: hidden; white-space: pre; font-size: calc(13px * var(--sh-z)); line-height: 1.25; color: var(--sh-ink); }
.sh-c > span { display: block; overflow: hidden; position: relative; z-index: 1; min-width: 0; }
.sh-c.kn { font-variant-numeric: tabular-nums; }
.sh-c.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.sh-c.wrap > span { overflow: hidden; }
.sh-c.ovf { z-index: 1; }
.sh-c.merged { background: var(--sh-bg); border-right: 1px solid var(--sh-grid); border-bottom: 1px solid var(--sh-grid); }
.sh-c.hasbd { overflow: visible; z-index: 2; }
.sh-c.hasbd > span { overflow: hidden; }
.sh-bd { position: absolute; left: -1px; top: -1px; right: 0; bottom: 0; pointer-events: none; box-sizing: border-box; }
.sh-c.err > span { color: #dc2626; font-weight: 600; }
.sh-c.err::before { content: ''; position: absolute; left: 0; top: 0; border-style: solid; border-width: 6px 6px 0 0; border-color: #16a34a transparent transparent transparent; }
.sh-c.note::after { content: ''; position: absolute; right: 0; top: 0; border-style: solid; border-width: 0 7px 7px 0; border-color: transparent #ef4444 transparent transparent; z-index: 2; }
.sh-bar-fill { position: absolute; left: 1px; top: 3px; bottom: 3px; opacity: .55; border-radius: 0 3px 3px 0; z-index: 0; }
.sh-fbtn { position: absolute; right: 2px; bottom: 2px; width: calc(17px * var(--sh-z)); height: calc(17px * var(--sh-z)); border: 1px solid var(--sh-hdr-line); border-radius: 4px; background: var(--sh-bg); color: var(--sh-hdr-ink); display: grid; place-items: center; padding: 0; font-size: calc(10px * var(--sh-z)); cursor: pointer; z-index: 3; }
.sh-fbtn.on { background: #dcfce7; color: #15803d; border-color: #86efac; }
.sh-c.fhdr { padding-right: calc(22px * var(--sh-z)); }
/* headers */
.sh-ch, .sh-rh { position: absolute; display: flex; align-items: center; justify-content: center; box-sizing: border-box; background: var(--sh-hdr); color: var(--sh-hdr-ink); font: 500 calc(11.5px * var(--sh-z))/1 Inter, sans-serif; border-right: 1px solid var(--sh-hdr-line); border-bottom: 1px solid var(--sh-hdr-line); cursor: default; overflow: hidden; }
.sh-ch { top: 0; cursor: s-resize; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14'%3E%3Cpath d='M7 13L2 6h3V1h4v5h3z' fill='%23333' stroke='%23fff'/%3E%3C/svg%3E") 7 13, s-resize; }
.sh-rh { left: 0; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14'%3E%3Cpath d='M13 7L6 2v3H1v4h5v3z' fill='%23333' stroke='%23fff'/%3E%3C/svg%3E") 13 7, e-resize; }
.sh-ch::after { content: ''; position: absolute; right: -3px; top: 0; bottom: 0; width: 7px; cursor: col-resize; z-index: 2; }
.sh-rh::after { content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 6px; cursor: row-resize; z-index: 2; }
.sh-ch.on, .sh-rh.on { background: var(--sh-hdr-on); color: var(--sh-hdr-on-ink); font-weight: 700; }
.sh-ch.on { box-shadow: inset 0 -2px 0 var(--sh-sel); }
.sh-rh.on { box-shadow: inset -2px 0 0 var(--sh-sel); }
.sh-ch.full, .sh-rh.full { background: var(--sh-sel); color: #fff; }
.sh-all { position: absolute; left: 0; top: 0; background: var(--sh-hdr); border-right: 1px solid var(--sh-hdr-line); border-bottom: 1px solid var(--sh-hdr-line); cursor: cell; box-sizing: border-box; }
.sh-all::after { content: ''; position: absolute; right: 3px; bottom: 3px; border-style: solid; border-width: 0 0 9px 9px; border-color: transparent transparent var(--sh-hdr-line) transparent; }
.sh-hid-c, .sh-hid-r { position: absolute; z-index: 4; cursor: pointer; }
.sh-hid-c { top: 4px; width: 6px; height: calc(100% - 8px); max-height: 16px; border-left: 2px solid var(--sh-hdr-ink); border-right: 2px solid var(--sh-hdr-ink); }
.sh-hid-r { left: 0; height: 6px; border-top: 2px solid var(--sh-hdr-ink); border-bottom: 2px solid var(--sh-hdr-ink); box-sizing: border-box; }
.sh-scroll .sh-l-cells { cursor: cell; }
/* overlays */
.sh-l-ov > div { position: absolute; box-sizing: border-box; pointer-events: none; }
.sh-sf { background: var(--sh-sel-tint); }
.sh-sb { border: 1px solid var(--sh-sel); }
.sh-act { box-shadow: inset 0 0 0 2px var(--sh-sel); }
.sh-act.editing { box-shadow: none; }
.sh-l-ov .sh-fh { width: 8px; height: 8px; background: var(--sh-sel); border: 1px solid var(--sh-bg); pointer-events: auto; cursor: crosshair; z-index: 3; }
.sh-l-ov .sh-th { width: 18px; height: 18px; border-radius: 50%; background: var(--sh-sel); border: 3px solid var(--sh-bg); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); pointer-events: auto; touch-action: none; z-index: 4; }
.sh-ants { border: 2px dashed var(--sh-sel); animation: shAnts 1s linear infinite; }
.sh-ants.cut { border-color: #ea580c; }
@keyframes shAnts { 50% { border-color: transparent; } }
.sh-spill { border: 1px dashed #2563eb; }
.sh-refbox { border: 2px solid; }
.sh-findhit { background: rgba(250, 204, 21, .35); border: 2px solid #eab308; }
.sh-fillprev { border: 1.5px dashed #64748b; }
.sh-peer { border: 2px solid; }
.sh-peer > span { position: absolute; left: -2px; top: -17px; color: #fff; font: 600 10.5px/1 Inter, sans-serif; padding: 3px 5px; border-radius: 4px 4px 4px 0; white-space: nowrap; }
.sh-l-ov .sh-dvbtn { position: absolute; width: 20px; height: 20px; border: 1px solid var(--sh-hdr-line); border-radius: 5px; background: var(--sh-bg); color: var(--sh-hdr-ink); display: grid; place-items: center; padding: 0; cursor: pointer; pointer-events: auto; z-index: 3; }
.sh-rs-guide { position: absolute; z-index: 25; background: var(--sh-sel); pointer-events: none; }
.sh-rs-guide.c { width: 2px; top: 0; bottom: 0; }
.sh-rs-guide.r { height: 2px; left: 0; right: 0; }
.sh-vov { position: absolute; inset: 0; pointer-events: none; z-index: 8; overflow: hidden; }
.sh-vov svg { position: absolute; inset: 0; }
/* the cell editor */
.sh-cell-ed { position: absolute; z-index: 20; opacity: 0; pointer-events: none; background: var(--sh-bg); color: var(--sh-ink); font-size: calc(13px * var(--sh-z)); }
.sh-cell-ed .sh-ci-hl, .sh-cell-ed .sh-ci-ta { padding: calc(3px * var(--sh-z)) calc(4px * var(--sh-z)); white-space: pre; word-break: normal; overflow: hidden; }
.sh-cell-ed.wrapmode .sh-ci-hl, .sh-cell-ed.wrapmode .sh-ci-ta { white-space: pre-wrap; word-break: break-word; }
.sh-cell-ed .sh-ci-hl { color: inherit; }
.sh-cell-ed .sh-ci-ta { caret-color: currentColor; }
.sh-cell-ed:not(.on) .sh-ci-ta { caret-color: transparent; }
.sh-cell-ed:not(.on) .sh-ci-hl { visibility: hidden; }
.sh-cell-ed.on { opacity: 1; pointer-events: auto; box-shadow: 0 0 0 2px var(--sh-sel), 0 6px 18px rgba(15, 23, 42, .2); border-radius: 1px; }
.sh-ac, .sh-hintbox, .sh-errbox { position: absolute; z-index: 30; background: var(--bg-elevated, var(--bg-surface)); color: var(--text-primary); border: 1px solid var(--border-subtle); border-radius: 10px; box-shadow: var(--shadow-lg, 0 12px 36px rgba(0, 0, 0, .2)); }
.sh-ac[hidden], .sh-hintbox[hidden], .sh-errbox[hidden] { display: none; }
.sh-ac { width: 340px; max-width: calc(100% - 8px); padding: 4px; }
.sh-ac-row { display: flex; flex-direction: column; gap: 1px; padding: 6px 9px; border-radius: 7px; cursor: pointer; }
.sh-ac-row b { font: 600 12.5px/1.2 'JetBrains Mono', Menlo, monospace; color: #7c3aed; }
.sh-ac-row span { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-ac-row.on, .sh-ac-row:hover { background: rgba(124, 58, 237, .1); }
.sh-hintbox { max-width: min(460px, calc(100% - 8px)); padding: 8px 11px; font-size: 12.5px; pointer-events: none; }
.sh-hint-sig { font: 12.5px/1.4 'JetBrains Mono', Menlo, monospace; }
.sh-hint-sig b { color: #7c3aed; }
.sh-hint-sig u { text-decoration: none; font-weight: 700; background: rgba(250, 204, 21, .35); border-radius: 3px; padding: 0 2px; }
.sh-hint-desc { color: var(--text-secondary); margin-top: 3px; }
.sh-hint-ex { font: 11.5px 'JetBrains Mono', Menlo, monospace; color: var(--text-tertiary, #94a3b8); margin-top: 3px; }
.sh-errbox { padding: 7px 11px; font-size: 13px; color: #b91c1c; border-color: #fca5a5; max-width: 300px; display: flex; gap: 7px; align-items: flex-start; }
[data-theme="dark"] .sh-errbox, [data-theme="dim"] .sh-errbox { color: #fca5a5; }
.sh-note-tip { position: absolute; z-index: 26; max-width: 240px; background: #fffbeb; color: #422006; border: 1px solid #fcd34d; border-radius: 8px; padding: 7px 10px; font-size: 12.5px; line-height: 1.4; white-space: pre-wrap; box-shadow: 0 6px 18px rgba(0, 0, 0, .15); pointer-events: none; }
.sh-note-tip[hidden] { display: none; }
/* charts */
.sh-chart { position: absolute; background: var(--sh-bg); border: 1px solid var(--border-subtle); border-radius: 10px; box-shadow: 0 2px 10px rgba(15, 23, 42, .12); overflow: hidden; cursor: move; }
.sh-chart.on { outline: 2px solid var(--sh-sel); }
.sh-chart-in { position: absolute; inset: 0; }
.sh-chart-in svg { display: block; width: 100%; height: 100%; }
.sh-chart-msg { display: grid; place-items: center; height: 100%; margin: 0; color: var(--text-secondary); font-size: 13px; text-align: center; padding: 10px; }
.sh-chart-bar { position: absolute; top: 4px; right: 4px; display: none; gap: 2px; background: var(--bg-elevated, var(--bg-surface)); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 1px; }
.sh-chart:hover .sh-chart-bar, .sh-chart.on .sh-chart-bar { display: flex; }
.sh-chart-bar .sh-ib { width: 28px; height: 28px; font-size: 12px; }
.sh-chart-rs { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 50%, var(--sh-sel) 50%); opacity: 0; }
.sh-chart.on .sh-chart-rs, .sh-chart:hover .sh-chart-rs { opacity: .8; }
/* find */
.sh-find { position: absolute; right: 16px; top: 8px; z-index: 32; width: 380px; max-width: calc(100% - 16px); background: var(--bg-elevated, var(--bg-surface)); border: 1px solid var(--border-subtle); border-radius: 12px; box-shadow: var(--shadow-lg, 0 12px 36px rgba(0, 0, 0, .2)); padding: 6px; }
.sh-find[hidden] { display: none; }
.sh-find-row { display: flex; align-items: center; gap: 4px; color: var(--text-secondary); }
.sh-find-row > i { width: 22px; text-align: center; }
.sh-find-row input { flex: 1; min-width: 0; height: 32px; border: 1px solid var(--border-default); border-radius: 8px; padding: 0 8px; background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: 13.5px; }
.sh-find-n { font-size: 11.5px; white-space: nowrap; min-width: 54px; text-align: right; }
.sh-find-more { margin-top: 6px; }
.sh-find-more[hidden] { display: none; }
.sh-find-opts { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 4px 2px 26px; font-size: 12.5px; color: var(--text-secondary); }
.sh-find-opts label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }

/* side panel */
.sh-side { width: 340px; flex-shrink: 0; border-left: 1px solid var(--border-subtle); background: var(--bg-surface); display: flex; flex-direction: column; min-height: 0; z-index: 9; }
.sh-side[hidden] { display: none; }
.sh-side-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 8px 14px; border-bottom: 1px solid var(--border-subtle); }
.sh-side-head b { font-size: 14px; display: flex; gap: 8px; align-items: center; }
.sh-side-head b i { color: #16a34a; }
.sh-side-body { flex: 1; overflow: auto; padding: 12px 14px 20px; font-size: 13.5px; }
.sh-side-body > .btn { margin-top: 6px; }
.sh-rules { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 10px; }
.sh-rule { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border: 1px solid var(--border-subtle); border-radius: 10px; }
.sh-rule > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sh-rule b { font-size: 13px; color: var(--text-primary); font-family: 'JetBrains Mono', Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-rule span { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-rule-sw { width: 40px; height: 26px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; border: 1px solid var(--border-subtle); color: var(--text-secondary); flex-shrink: 0; }
.sh-cf-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.sh-cf-presets button { width: 46px; height: 28px; border-radius: 7px; border: 1px solid var(--border-subtle); cursor: pointer; font: 600 12px/1 Inter, sans-serif; background: var(--bg-surface); color: var(--text-primary); }
.sh-cf-presets button.on { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.sh-swb { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 6px; border: 1px solid var(--border-default); border-radius: 8px; background: var(--bg-surface); color: var(--text-primary); cursor: pointer; font: inherit; font-size: 12.5px; }
.sh-swb i { width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--border-default); }
.sh-ctypes { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; margin-bottom: 12px; }
.sh-ctypes button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--bg-surface); color: var(--text-secondary); cursor: pointer; font: inherit; font-size: 11.5px; }
.sh-ctypes button i { font-size: 17px; }
.sh-ctypes button.on { border-color: #22c55e; color: #15803d; background: rgba(34, 197, 94, .08); }
.sh-ai-tabs { display: flex; gap: 4px; margin-bottom: 10px; background: var(--bg-surface-2); padding: 3px; border-radius: 10px; }
.sh-ai-tabs button { flex: 1; border: 0; background: none; padding: 7px 4px; border-radius: 8px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); cursor: pointer; }
.sh-ai-tabs button.on { background: var(--bg-surface); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.sh-ai-body textarea, .sh-ai-body input { margin-bottom: 8px; }
.sh-ai-f { font: 12.5px/1.45 'JetBrains Mono', Menlo, monospace; background: var(--bg-surface-2); border-radius: 8px; padding: 8px 10px; margin: 6px 0; white-space: pre-wrap; word-break: break-all; color: var(--text-primary); }
.sh-ai-res { margin-top: 12px; border-top: 1px solid var(--border-subtle); padding-top: 10px; }
.sh-ai-res p { line-height: 1.5; color: var(--text-primary); }
.sh-ai-text { white-space: pre-wrap; }
.sh-ai-list { padding-left: 18px; margin: 0 0 10px; line-height: 1.5; }
.sh-ai-card { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border-subtle); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.sh-ai-card span { font-size: 12px; color: var(--text-secondary); }
.sh-ai-card .btn { align-self: flex-start; }
.sh-ai-err { color: #dc2626; }
.sh-ai-note { margin-top: 14px; }

/* bottom: sheet tabs and the status bar */
.sh-bottom { display: flex; align-items: center; gap: 2px; height: 40px; padding: 0 8px; background: var(--bg-surface); border-top: 1px solid var(--border-subtle); flex-shrink: 0; }
.sh-tabs { display: flex; align-items: stretch; gap: 2px; overflow-x: auto; flex: 1; min-width: 0; height: 100%; scrollbar-width: none; padding-top: 4px; }
.sh-tabs::-webkit-scrollbar { display: none; }
.sh-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border: 0; border-radius: 8px 8px 0 0; background: transparent; color: var(--text-secondary); cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap; flex-shrink: 0; user-select: none; touch-action: pan-x; }
.sh-tab::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--tab, transparent); }
.sh-tab:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.sh-tab.on { background: var(--sh-bg); color: #15803d; font-weight: 700; box-shadow: 0 -1px 0 var(--border-subtle) inset; }
.sh-tab.on::after { background: var(--tab, #16a34a); }
[data-theme="dark"] .sh-tab.on, [data-theme="dim"] .sh-tab.on { color: #4ade80; }
.sh-tab.drag { opacity: .5; }
.sh-tab.drop-l { box-shadow: inset 3px 0 0 #16a34a; }
.sh-tab.drop-r { box-shadow: inset -3px 0 0 #16a34a; }
.sh-tab:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.sh-tab-pp { display: inline-flex; gap: 2px; font-style: normal; }
.sh-tab-pp b { width: 7px; height: 7px; border-radius: 50%; }
.sh-stats { display: flex; gap: 2px; align-items: center; flex-shrink: 0; max-width: 60%; overflow: hidden; }
.sh-stat { border: 0; background: none; color: var(--text-secondary); font: inherit; font-size: 12px; padding: 4px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.sh-stat:hover { background: var(--bg-surface-2); }
.sh-stat b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.sh-dead .sh-scroll { opacity: .75; }

/* read only (a share link, a viewer) */
.sh-ro .sh-fh { display: none; }

/* print / PDF */
html.sh-printing body > *:not(.sh-print) { display: none !important; }
.sh-print { display: none; }
html.sh-printing .sh-print { display: block; padding: 0; color: #000; background: #fff; font: 11pt/1.3 Inter, Arial, sans-serif; }
.sh-print h1 { font-size: 13pt; margin: 0 0 8pt; }
.sh-print table { border-collapse: collapse; table-layout: fixed; }
.sh-print td { border: .5pt solid #bbb; padding: 2pt 4pt; overflow: hidden; white-space: nowrap; vertical-align: bottom; }
@media print { html.sh-printing, html.sh-printing body { overflow: visible !important; height: auto !important; background: #fff !important; } @page { margin: 12mm; } }

/* ================= smaller screens ================= */
@media (max-width: 1100px) { .sh-cmd-btn span, .sh-cmd-btn kbd { display: none; } .sh-cmd-btn { width: 36px; padding: 0; justify-content: center; } .sh-people-n { display: none; } }
@media (max-width: 900px) {
  .sh-side { position: absolute; right: 0; top: 0; bottom: 0; width: min(360px, 92vw); box-shadow: -10px 0 30px rgba(0, 0, 0, .18); }
  .sh-title-in { width: 180px; }
}
@media (max-width: 640px) {
  .sh-top { min-height: 0; padding: 5px 6px; gap: 3px; }
  .sh-logo { display: none; }
  .sh-titlebox { flex: 1; min-width: 0; }
  .sh-title-in { width: 100%; font-size: 14.5px; }
  .sh-top > .sh-grow { display: none; }
  .sh-tb.lbl span { display: none; }
  .sh-tools { padding: 3px 4px; }
  .sh-tools .sh-tb { height: 36px; min-width: 36px; }
  .sh-font-b { min-width: 80px; }
  .sh-namebox { width: 64px; padding: 0 6px; font-size: 12.5px; }
  .sh-fx { padding: 0 7px; }
  .sh-bar .sh-ci-hl, .sh-bar .sh-ci-ta { font-size: 14px; padding: 7px 8px; }
  .sh-bar-x { display: none !important; }
  .sh-side { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 62vh; border-left: 0; border-top: 1px solid var(--border-subtle); border-radius: 16px 16px 0 0; z-index: 9000; }
  .sh-bottom { height: 44px; padding: 0 4px; }
  .sh-stats { max-width: 44%; }
  .sh-stat:not(.first) { display: none; }
  .sh-find { left: 8px; right: 8px; width: auto; top: 6px; }
  .sh-ac { width: calc(100% - 12px); }
  .sh-fxd { height: auto; grid-template-columns: 1fr; }
  .sh-fx-list { max-height: 30vh; }
  .sh-dlg.sh-cmd { margin-top: 8px; }
  .sh-row2 { grid-template-columns: 1fr; }
}
@media (pointer: coarse) { .sh-l-ov .sh-fh { width: 14px; height: 14px; margin: -3px 0 0 -3px; } .sh-ch::after { width: 14px; right: -7px; } .sh-rh::after { height: 12px; bottom: -6px; } }
