:root{color-scheme:light}*{box-sizing:border-box}#root,body,html{height:100%;margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;overflow-x:hidden}.app{display:flex;flex-direction:column;height:100%}.toolbar{padding:8px 12px;border-bottom:1px solid #ddd;background:#fff;color:#111}.toolbar,.toolbar-file-info{display:flex;align-items:center;gap:8px}.toolbar-file-info{margin-right:16px}.toolbar-file-info .file-name{font-weight:500;color:#333}.toolbar-file-info .file-name.unsaved{color:#888;font-style:italic}.toolbar-file-info .save-indicator{display:inline-flex;align-items:center;justify-content:center;margin-left:6px}.toolbar-file-info .save-indicator.saving .saving-spinner{width:14px;height:14px;border:2px solid #cfe0ff;border-top-color:#1d4ed8;border-radius:50%;animation:autosheet-spin .8s linear infinite}.toolbar-file-info .save-indicator.saved svg{display:block}@keyframes autosheet-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.title{font-weight:600}.menubar{display:flex;align-items:center;gap:8px;font-size:14px}.menu{position:relative}.menu-button{padding:6px 10px;border:1px solid #ccc;background:#f7f7f7;border-radius:4px;cursor:pointer;font:inherit}.menu-dropdown{position:absolute;top:calc(100% + 4px);left:0;min-width:220px;background:#fff;border:1px solid #ddd;border-radius:6px;box-shadow:0 6px 18px rgba(0,0,0,.12);z-index:100;padding:6px}.menu-item{display:block;width:100%;text-align:left;padding:6px 8px;background:transparent;border:none;border-radius:4px;cursor:pointer;color:#111;font:inherit}.menu-item:hover{background:#f5f5f5}.menu-item.disabled{color:#888;cursor:default}.menu-divider{height:1px;background:#e0e0e0;margin:4px 8px}.submenu-dropdown{position:absolute;top:-6px;left:calc(100% - 1px);min-width:180px;background:#fff;border:1px solid #ddd;border-radius:6px;box-shadow:0 6px 18px rgba(0,0,0,.12);z-index:101;padding:6px}.tabs{display:flex;gap:4px}.tab{padding:6px 10px;border:1px solid #ccc;background:#f7f7f7;border-radius:4px;cursor:pointer}.tab.active{background:#e8eefc;border-color:#a8c1ff}.github-badge{position:relative}.github-badge .hack-hint{position:absolute;left:50%;transform:translate(-50%,8px);bottom:-24px;background:#24292e;color:#fff;padding:4px 8px;border-radius:6px;font-size:12px;line-height:1;pointer-events:none;white-space:nowrap;opacity:0;transition:opacity .18s ease,transform .18s ease;font-family:Comic Sans MS,Comic Sans,Bradley Hand,Segoe Print,Chalkboard SE,cursive}.github-badge:hover .hack-hint{opacity:1;transform:translate(-50%)}.formula-bar{display:flex;gap:8px;padding:8px;border-bottom:1px solid #eee;background:#fff}.formula-bar .name{width:40px;display:flex;align-items:center;justify-content:center;background:#f6f6f6;border:1px solid #ddd;border-radius:4px;color:#111;font-size:12px}.formula-bar input{flex:1 1;padding:6px 8px;background:#fff;color:#111}.formula-bar button,.formula-bar input{border:1px solid #ccc;border-radius:4px}.formula-bar button{background:#f0f0f0;padding:6px 10px;cursor:pointer}.main{flex:1 1;display:flex;min-height:0;overflow:hidden}.main,.main>*,.pane{min-width:0}.pane{display:flex;flex-direction:column;flex:0 0 auto}.sheet-pane{min-width:320px}.editor-pane{min-width:280px}.split-resizer{width:6px;flex:0 0 6px;height:100%;cursor:col-resize;background:transparent;position:relative}.split-resizer:before{content:"";position:absolute;top:0;bottom:0;left:2px;right:2px;background:#e9e9e9}.main:not(.split) .editor-pane,.main:not(.split) .sheet-pane{flex:1 1;display:flex;min-width:0}.grid{flex:1 1;overflow:auto;background:#fff;color:#111;position:relative;font-size:12px}.grid:focus,.grid:focus-visible{outline:none}table{border-collapse:separate;border-spacing:0;background:#fff;table-layout:fixed}td,th{border:1px solid #e0e0e0;background:#fff;color:#111}td,th{overflow:hidden;min-width:0}th{padding:4px 6px;position:relative}td{padding:1px;overflow:hidden;min-width:0}thead th{top:0;z-index:3}tbody th,thead th{background:#fafafa;position:-webkit-sticky;position:sticky;color:#555}tbody th{left:0;z-index:2}thead .corner-cell{position:-webkit-sticky;position:sticky;left:0;top:0;z-index:4;background:#fafafa}thead .col-header{z-index:3;background:#fafafa}td.sel{outline:2px solid #3b82f6;outline-offset:-2px}td.sel-range{background:rgba(59,130,246,.12);position:relative}td.sel-anchor{outline:2px solid #3b82f6;outline-offset:-2px}.selection-outline{position:absolute;pointer-events:none;border:1px solid #3b82f6;box-sizing:border-box;z-index:4}.col-resizer{top:0;right:-3px;width:6px;height:100%;cursor:col-resize}.col-resizer,.row-resizer{position:absolute;z-index:3}.row-resizer{bottom:-3px;left:0;width:100%;height:6px;cursor:row-resize}.col-header{position:relative}.col-header-label{-webkit-user-select:none;-moz-user-select:none;user-select:none;display:block;padding-right:6px}.cell-display,.col-header-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cell-display{width:100%;height:100%}.cell-text{display:block;overflow:hidden;text-overflow:ellipsis}.sheet-tabs{flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 8px;border-top:1px solid #eee;background:#fafafa}.sheet-tabs-list{display:flex;gap:6px;overflow-x:auto;padding-bottom:2px}.sheet-tab{flex:0 0 auto;padding:4px 10px;border:1px solid #ccc;background:#f7f7f7;border-radius:14px;cursor:pointer;font-size:12px;color:#111}.sheet-tab.active{background:#e8eefc;border-color:#a8c1ff}.sheet-tabs-actions{display:flex;align-items:center;gap:6px}.sheet-add-btn{background:#f0f0f0}.sheet-action-btn,.sheet-add-btn{flex:0 0 auto;padding:4px 8px;border:1px solid #ccc;border-radius:6px;cursor:pointer;color:#111}.scripts-pane,.sheet-action-btn{background:#fff}.scripts-pane{display:flex;flex-direction:column;height:100%;color:#111}.scripts-toolbar{display:flex;align-items:center;gap:8px;padding:8px;border-bottom:1px solid #eee}.scripts-title{font-weight:600}.scripts-body{flex:1 1;min-height:0;display:flex;flex-direction:column;overflow:hidden;position:relative}.file-tree{width:100%;border-right:0;border-bottom:1px solid #eee;display:flex;flex-direction:row;align-items:center;gap:8px;padding:6px;flex:0 0 auto}.file-tree-header{padding:0;border-bottom:0;margin-right:8px;flex:0 0 auto}.file-list{flex:1 1;overflow-x:auto;overflow-y:hidden;display:flex;gap:6px;white-space:nowrap}.file-item{display:flex;align-items:center;gap:6px;padding:6px 8px;flex:0 0 auto}.file-item.active{background:#f5f8ff}.file-name{flex:0 0 auto;text-align:left;color:#111}.file-actions .icon,.file-name{background:transparent;border:none;cursor:pointer}.editor-area{flex:1 1;min-width:0;min-height:0;display:flex;flex-direction:column}.editor-area .cm-editor{font-size:12px}.btn{padding:4px 8px;border:1px solid #ccc;background:#f7f7f7;border-radius:4px;cursor:pointer}.toggle{display:flex;align-items:center;gap:6px;font-size:12px;color:#333}.scripts-error{padding:6px 8px;background:#fff3f3;color:#a10000;border-top:1px solid #ffd0d0;font-size:12px}.chat-pane{display:flex;flex-direction:column;height:100%;background:#fff;color:#111;padding-left:6px;padding-right:6px}.chat-toolbar{display:flex;align-items:center;gap:8px;padding:8px;border-bottom:1px solid #eee}.chat-title{font-weight:600}.chat-select{padding:4px 8px;border:1px solid #ccc;background:#f7f7f7;color:#111;border-radius:4px;font:inherit;font-weight:400}.chat-select:disabled{opacity:.7}.chat-toolbar .chat-select{font-size:14px}.chat-toolbar .btn,.chat-toolbar .chat-select{height:32px;padding-top:0;padding-bottom:0}.chat-toolbar .btn{display:inline-flex;align-items:center}.chat-apikey{width:280px;padding:6px 8px;border:1px solid #ccc;border-radius:4px;background:#fff;color:#111}.chat-system{display:flex;gap:8px;align-items:center;padding:8px;border-bottom:1px solid #f3f3f3}.chat-system input{flex:1 1;padding:6px 8px;border:1px solid #ccc;border-radius:4px;background:#fff;color:#111}.chat-error{padding:6px 8px;background:#fff3f3;color:#a10000;border-bottom:1px solid #ffd0d0;font-size:12px}.chat-body{min-height:0}.chat-body,.chat-messages{flex:1 1;display:flex;flex-direction:column}.chat-messages{overflow-y:auto;overflow-x:hidden;padding:10px;gap:8px}.msg{max-width:80%;min-width:0;border:1px solid #e0e0e0;border-radius:8px;padding:8px 10px;background:#fafafa;overflow-wrap:anywhere;word-break:break-word}.msg-user{margin-left:auto;background:#eef6ff;border-color:#c7e1ff}.msg-assistant{margin-right:auto;background:#f7f7f7}.msg-system{margin:0 auto;background:#fffbe6;border-color:#ffe58f}.msg-tool{margin-right:auto;background:#f4fff5;border-color:#bfeac8}.msg-reasoning{margin-right:auto;background:#f9fbff;border-color:#c9ddff}.msg-role{font-size:11px;color:#666;margin-bottom:4px;text-transform:uppercase}.msg-content{white-space:pre-wrap;word-break:break-word;color:#111;line-height:1.3}.msg-content p{margin:.2em 0;padding:0}.msg-content ol,.msg-content ul{margin:.2em 0;padding-left:1.2em;list-style-position:outside}.msg-content li,.msg-content ol,.msg-content ul{white-space:normal}.msg-content>ol,.msg-content>ul{list-style-position:outside}.msg-content ul.msg-root-list{list-style:none;padding-left:0}.msg-content li{margin:.1em 0;padding:0}.msg-content li>:first-child{display:inline;margin:0;padding:0}.msg-content li>p{margin:0;padding:0}.msg-content li>ol,.msg-content li>ul{margin:.1em 0;padding-left:1.2em;list-style-position:outside}.msg-content pre{margin:.25em 0;max-width:100%;overflow:auto;background:transparent;border:1px solid #eee;border-radius:4px;padding:4px}.msg-content blockquote{margin:.25em 0;padding:0}.msg-content h1,.msg-content h2,.msg-content h3,.msg-content h4,.msg-content h5,.msg-content h6{margin:.3em 0 .15em;padding:0}.msg-content>:first-child{margin-top:0}.msg-content>:last-child{margin-bottom:0}.msg-content{overflow-wrap:anywhere}.msg-content code{white-space:break-spaces;word-break:break-word}.msg-content table{display:block;max-width:100%;overflow:auto}.msg-content img{max-width:100%;height:auto}.msg-content a{word-break:break-all}.reasoning-header{display:flex;align-items:center;gap:8px;margin-bottom:4px}.reasoning-loading{color:#335;font-size:12px;background:#eef3ff;border:1px solid #d9e6ff;padding:2px 6px;border-radius:999px}.reasoning-loading .dot{animation:blink 1.2s infinite}.reasoning-loading .dot:nth-child(2){animation-delay:.2s}.reasoning-loading .dot:nth-child(3){animation-delay:.4s}@keyframes blink{0%{opacity:.2}50%{opacity:1}to{opacity:.2}}.reasoning-content{max-height:300px;overflow:auto;background:#fff;color:#111;border:1px solid #d9e6ff;border-radius:6px;padding:8px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;white-space:pre-wrap}.tool-header{display:flex;align-items:center;gap:8px;margin-bottom:4px;flex-wrap:wrap}.tool-header .msg-role{margin-bottom:0;display:inline-flex;align-items:center}.tool-name{font-weight:600;color:#0b7a28;flex:0 0 auto}.tool-args{font-size:11px;color:#2d6a4f;background:#e7f7eb;padding:2px 4px;text-overflow:ellipsis;white-space:nowrap;flex:1 1 auto}.tool-args,.tool-preview{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;border-radius:4px;max-width:100%;overflow:hidden}.tool-preview{font-size:12px;color:#0b7a28;background:#edfff0;padding:6px;border:1px dashed #bfeac8;overflow-wrap:anywhere;word-break:break-word}.tool-details{margin-top:6px;max-height:240px;overflow:auto;background:#fff;color:#111;border:1px solid #d5f0db;border-radius:6px;padding:8px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;white-space:pre-wrap;max-width:100%;overflow-wrap:anywhere}.expand-btn{margin-left:auto;padding:2px 6px;border:1px solid #cdebd4;background:#f3fff6;border-radius:4px;cursor:pointer;font-size:12px}.chat-input{display:flex;gap:8px;padding:8px;border-top:1px solid #eee}.chat-input textarea{flex:1 1;min-height:64px;max-height:200px;padding:8px;border:1px solid #ccc;border-radius:6px;resize:vertical;background:#fff;color:#111;font:inherit}.modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.25);display:flex;align-items:center;justify-content:center;z-index:1000}.modal{width:760px;max-width:calc(100% - 32px);max-height:calc(100% - 64px);background:#fff;color:#111;border:1px solid #ddd;border-radius:12px;box-shadow:0 12px 36px rgba(0,0,0,.22);display:flex;flex-direction:column;overflow:hidden}.modal-header{display:flex;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid #eee}.modal-title{font-weight:700;font-size:16px}.modal-body{padding:16px;display:flex;flex-direction:column;gap:14px;overflow:auto}.modal-footer{display:flex;align-items:center;gap:8px;padding:10px 12px;border-top:1px solid #eee}.form-row{display:flex;flex-direction:column;gap:6px}.form-row label{font-size:12px;color:#444}.form-row input[type=password],.form-row input[type=text],.form-row select,.form-row textarea{width:100%;padding:8px;border:1px solid #ccc;border-radius:6px;background:#fff;color:#111;font:inherit}.form-row textarea{resize:vertical;min-height:72px}.help-text{font-size:12px;color:#666;margin-top:-2px;margin-bottom:6px}.server-row{margin-bottom:8px;padding:8px;border:1px solid #eee;border-radius:8px;background:#fafafa}.server-row:hover{border-color:#e2e2e2;background:#f7f7f7}.connections-list{display:flex;flex-direction:column;gap:6px}.connection-row{padding:6px 8px;border:1px dashed #e6e6e6;border-radius:8px;background:#fbfdff}.modal .form-row input[type=password],.modal .form-row input[type=text],.modal .form-row select,.modal .form-row textarea{font-size:14px}.inline-input-action{display:flex;gap:8px;align-items:center}.inline-input-action input{flex:1 1}