:root{--bg:#fff;--surface:#fff;--surface2:#f8fafd;--line:#dadce0;--line2:#c6c8cc;--text:#202124;--muted:#5f6368;--blue:#1a73e8;--blue2:#e8f0fe;--green:#188038;--red:#d93025;--header:#f8f9fa;--selection:#1a73e8;--sel-fill:rgba(26,115,232,.08);--row-h:24px;--col-w:120px;--row-head-w:50px;--toolbar-h:42px;--grid-font:12px}
*{box-sizing:border-box}html,body,#app{height:100%;margin:0}body{font-family:Arial,Helvetica,sans-serif;background:var(--bg);color:var(--text);overflow:hidden}.app-shell{height:100%;display:flex;flex-direction:column;min-width:900px}.topbar{height:58px;display:flex;align-items:center;justify-content:space-between;padding:0 14px;border-bottom:1px solid var(--line);background:#fff}.brand-wrap{display:flex;align-items:center;gap:10px;min-width:320px}.brand-mark{width:38px;height:38px;border:0;border-radius:9px;background:#fff;color:var(--blue);font-size:25px;cursor:pointer}.file-title{border:0;outline:0;font-size:18px;color:var(--text);width:270px;padding:8px 6px;border-radius:4px}.file-title:hover,.file-title:focus{background:var(--surface2)}.top-actions{display:flex;align-items:center;gap:6px}.save-state{font-size:12px;color:var(--muted);margin-right:8px}.outline-btn,.primary-btn,.icon-btn{border:1px solid var(--line);background:#fff;color:var(--text);height:34px;padding:0 13px;border-radius:5px;cursor:pointer;font-size:13px}.primary-btn{background:var(--blue);border-color:var(--blue);color:#fff}.icon-btn{width:34px;padding:0;font-size:19px}.outline-btn:hover,.icon-btn:hover{background:var(--surface2)}.primary-btn:hover{filter:brightness(.96)}.menubar{height:32px;display:flex;align-items:center;padding:0 16px;border-bottom:1px solid var(--line);gap:2px}.menu-button{border:0;background:transparent;padding:5px 10px;border-radius:4px;color:var(--text);font-size:13px;cursor:pointer}.menu-button:hover,.menu-button.active{background:#f1f3f4}.toolbar-wrap{border-bottom:1px solid var(--line);background:#fff}.toolbar{height:44px;display:flex;align-items:center;padding:0 10px;gap:4px;white-space:nowrap}.tool-btn{height:30px;min-width:30px;border:0;background:transparent;border-radius:4px;color:var(--text);cursor:pointer;font-size:14px}.tool-btn:hover,.tool-btn.active{background:#f1f3f4}.tool-select{height:30px;border:1px solid var(--line);border-radius:4px;background:#fff;padding:0 5px;color:var(--text)}.tool-sep{width:1px;height:24px;background:var(--line);margin:0 4px}.toolbar-spacer{flex:1}.zoom-control{font-size:12px;color:var(--muted);display:flex;align-items:center;gap:6px}.zoom-control input{width:90px}.formula-bar{height:38px;display:flex;align-items:center;padding:0 10px;gap:8px;border-top:1px solid #f0f0f0}.name-box{width:76px;height:28px;border:1px solid var(--line);border-radius:3px;padding:0 8px;font-size:12px}.fx-label{font-style:italic;font-weight:600;color:var(--muted);font-size:14px}.formula-input{height:28px;flex:1;border:1px solid var(--line);border-radius:3px;padding:0 9px;font-size:12px;outline:none}.formula-input:focus,.name-box:focus{border-color:var(--blue);box-shadow:0 0 0 1px var(--blue)}.sheet-area{flex:1;min-height:0;background:#fff}.grid-viewport{height:100%;width:100%;overflow:auto;outline:none}.grid{position:relative;display:grid;grid-template-columns:var(--row-head-w);grid-auto-rows:var(--row-h);width:max-content;min-width:100%;font-size:var(--grid-font)}.cell{min-width:var(--col-w);height:var(--row-h);border-right:1px solid var(--line);border-bottom:1px solid var(--line);padding:3px 6px;display:flex;align-items:center;position:relative;background:#fff;white-space:nowrap;overflow:hidden}.cell.row-head,.cell.col-head,.cell.corner{background:var(--header);font-weight:500;color:var(--muted);justify-content:center;padding:0}.cell.col-head{height:28px;cursor:pointer}.cell.row-head{cursor:pointer}.cell.corner{height:28px;position:sticky;left:0;z-index:7}.cell.col-head{position:sticky;top:0;z-index:5}.cell.row-head{position:sticky;left:0;z-index:4}.cell.selected{outline:2px solid var(--selection);outline-offset:-2px;z-index:3;background:var(--sel-fill)}.cell.active{z-index:4}.cell.selected::after{content:"";position:absolute;right:-1px;bottom:-1px;width:5px;height:5px;border:1px solid #fff;background:var(--selection)}.cell.editing{padding:0}.cell-input{width:100%;height:100%;border:0;outline:0;padding:3px 6px;background:#fff;font:inherit;color:var(--text)}.cell.header-data{font-weight:600;background:#fafafa}.cell.text-center{justify-content:center}.cell.text-right{justify-content:flex-end}.cell.wrap{white-space:normal;overflow:visible;line-height:16px;align-items:flex-start;padding-top:4px}.cell.merged{z-index:2}.cell.invalid{color:var(--red)}.sheet-footer{height:38px;border-top:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;background:#fff}.sheet-tabs{display:flex;align-items:center;height:100%;min-width:0}.sheet-menu-btn,.add-sheet-btn{height:100%;min-width:38px;border:0;border-right:1px solid var(--line);background:#fff;color:var(--muted);cursor:pointer}.add-sheet-btn{font-size:20px;border-left:1px solid var(--line);border-right:0}.tabs{display:flex;height:100%;align-items:stretch;overflow:hidden}.tab{min-width:105px;max-width:180px;border:0;background:#fff;border-right:1px solid var(--line);padding:0 14px;color:var(--muted);cursor:pointer;font-size:12px;position:relative}.tab.active{color:var(--blue);background:#f8fbff;font-weight:600}.tab.active:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--blue)}.statusbar{display:flex;align-items:center;gap:20px;padding:0 12px;color:var(--muted);font-size:11px}.statusbar #statusSpacer{flex:1}.menu-layer{position:fixed;inset:0;pointer-events:none;z-index:100}.dropdown-menu{position:absolute;min-width:190px;background:#fff;border:1px solid var(--line);box-shadow:0 5px 18px rgba(60,64,67,.25);border-radius:5px;padding:5px 0;pointer-events:auto}.menu-item{display:flex;justify-content:space-between;align-items:center;padding:7px 12px;font-size:12px;cursor:pointer}.menu-item:hover{background:#f1f3f4}.menu-item.disabled{color:#9aa0a6;cursor:default}.menu-item .shortcut{color:var(--muted);margin-left:28px}.separator{height:1px;background:#eee;margin:4px 0}.toast{position:fixed;left:50%;bottom:55px;transform:translate(-50%,10px);background:#202124;color:#fff;padding:9px 14px;border-radius:5px;font-size:12px;opacity:0;pointer-events:none;transition:.18s;z-index:300}.toast.show{opacity:1;transform:translate(-50%,0)}.dialog{border:0;border-radius:8px;padding:22px;min-width:340px;box-shadow:0 12px 40px rgba(0,0,0,.18)}.dialog::backdrop{background:rgba(32,33,36,.24)}.dialog form{display:flex;flex-direction:column;gap:14px}.dialog h2{margin:0;font-size:18px}.dialog p{margin:0;color:var(--muted);font-size:13px;line-height:1.45}.dialog label{display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--muted)}.dialog input,.dialog select{height:34px;border:1px solid var(--line);border-radius:4px;padding:0 8px;color:var(--text)}.dialog-actions{display:flex;justify-content:flex-end;gap:7px;margin-top:5px}.context-menu{position:fixed;background:#fff;border:1px solid var(--line);box-shadow:0 6px 18px rgba(60,64,67,.24);border-radius:5px;padding:5px 0;min-width:190px;z-index:250}.context-menu.hidden{display:none}.context-item{padding:7px 12px;font-size:12px;cursor:pointer}.context-item:hover{background:#f1f3f4}.chart-object{position:absolute;background:#fff;border:1px solid #dadce0;box-shadow:0 2px 8px rgba(60,64,67,.16);resize:both;overflow:hidden;z-index:12}.chart-object .chart-head{height:28px;display:flex;align-items:center;justify-content:space-between;padding:0 8px;border-bottom:1px solid #eee;font-weight:600;font-size:12px}.chart-object svg{display:block;width:100%;height:calc(100% - 28px)}.filter-indicator{position:absolute;right:5px;top:7px;color:var(--blue);font-size:10px}.conditional-positive{background:#e6f4ea!important}.conditional-negative{background:#fce8e6!important}.frozen-row .cell.col-head{position:sticky}.print-mode .topbar,.print-mode .menubar,.print-mode .toolbar-wrap,.print-mode .sheet-footer{display:none}.print-mode .sheet-area{overflow:auto}
@media (max-width:1000px){.app-shell{min-width:760px}.top-actions .outline-btn{display:none}.brand-wrap{min-width:220px}.file-title{width:190px}.toolbar{overflow:hidden}.zoom-control{display:none}}
.dialog-title-row{display:flex;align-items:center;gap:8px}.google-account-card{display:flex;align-items:center;gap:10px;padding:10px;border:1px solid var(--line);border-radius:6px;background:var(--surface2)}.google-account-card>div:last-child{display:flex;flex-direction:column;gap:2px;min-width:0}.google-account-card strong{font-size:12px;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.google-account-card span{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.google-avatar{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:#e8f0fe;color:var(--blue);font-weight:700;flex:none}.account-btn{max-width:190px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.drive-dot{width:9px;height:9px;border-radius:50%;background:#bdc1c6}.drive-dot.connected{background:#188038}.drive-dialog{min-width:560px;max-width:720px}.drive-help{font-size:11px!important;color:var(--muted)}.drive-actions{justify-content:flex-start;flex-wrap:wrap}.drive-file-list{border:1px solid var(--line);border-radius:6px;max-height:260px;overflow:auto;background:#fff}.drive-empty{padding:16px;color:var(--muted);font-size:12px}.drive-file{display:flex;align-items:stretch;border-bottom:1px solid #eee}.drive-file:last-child{border-bottom:0}.drive-file.active{background:#f8fbff}.drive-file-open{flex:1;display:flex;flex-direction:column;align-items:flex-start;gap:3px;border:0;background:transparent;padding:10px 12px;text-align:left;cursor:pointer}.drive-file-open:hover{background:#f1f3f4}.drive-file-open strong{font-size:12px;font-weight:600;color:var(--text)}.drive-file-open span{font-size:10px;color:var(--muted)}.drive-file-trash{width:40px;border:0;background:transparent;color:var(--muted);cursor:pointer;font-size:18px}.drive-file-trash:hover{background:#fce8e6;color:var(--red)}
@media (max-width:700px){.drive-dialog{min-width:0;width:calc(100vw - 28px)}}

.drive-bridge-frame {
  position: fixed;
  width: 2px;
  height: 2px;
  right: -10px;
  bottom: -10px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
