:root{
  --office-blue:#2b579a;
  --line:#d9d9d9;
  --line-soft:#ececec;
  --surface:#ffffff;
  --chrome:#f8f8f8;
  --workspace:#f5f6f7;
  --header:#f3f4f6;
  --selection:#eef1f5;
  --active-ring:#60666f;
  --row-height:26px;
  --cell-font-size:12.5px;
  --cell-line-height:1.24;
  --cell-min-width:156px;
  --column-count:5;
  --header-height:42px;
  --header-font-size:17px;
  --editor-line-height:16px;
  --editor-min-height:28px;
  --excel-cell-cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 13 13'%3E%3Cpath d='M6.5 1v11M1 6.5h11' stroke='%23000' stroke-width='2' stroke-linecap='square'/%3E%3Cpath d='M6.5 1.8v9.4M1.8 6.5h9.4' stroke='%23fff' stroke-width='1' stroke-linecap='square'/%3E%3C/svg%3E") 6 6, cell;
  --aff:#244c73;
  --neg:#b63a3a;
  --ink:#1f1f1f;
  --muted:#666;
  --font:"Segoe UI",system-ui,sans-serif;
}

*{box-sizing:border-box}
html,body{margin:0;height:100%;font-family:var(--font);color:var(--ink);background:var(--workspace);font-size:12px}
button,select,input{font:inherit;color:inherit}
button{cursor:pointer}
button:disabled{cursor:default;opacity:.45}
button:focus-visible,select:focus-visible,input:focus-visible,[contenteditable]:focus-visible,td:focus-visible{outline:1px solid var(--active-ring);outline-offset:-1px}
td:focus-visible{outline:0}

.flowline-shell{height:100vh;display:grid;grid-template-rows:minmax(0,1fr);background:var(--surface)}
.flowline-workspace{display:block;min-height:0;height:100vh;background:var(--surface)}
.flowline-flow{position:relative;height:100vh;min-width:0;min-height:0;display:grid;grid-template-rows:minmax(0,1fr) auto;background:var(--surface)}
.icon-control{width:24px;height:24px;border:1px solid transparent;background:transparent;border-radius:50%;color:#555;font:16px/1 "Segoe UI Symbol","Segoe UI",sans-serif;flex:0 0 auto}
.icon-control:hover{background:#fafafa;border-color:#ecebea}

.sheet-frame{position:relative;min-height:0;overflow:auto;background:var(--surface);scroll-behavior:auto;overscroll-behavior:contain}
.flowline-sheet{min-width:calc(var(--cell-min-width) * var(--column-count));width:100%;height:100%;border-collapse:collapse;table-layout:fixed;font:var(--cell-font-size)/var(--cell-line-height) var(--font)}
.flowline-sheet th{position:sticky;top:0;z-index:6;height:var(--header-height);border-right:1px solid #d6d6d6;border-bottom:1px solid #c8c8c8;background:var(--header);text-align:center;font-size:var(--header-font-size);font-weight:700;color:var(--aff)}
.flowline-sheet th.neg{color:var(--neg)}
.flowline-sheet td{position:relative;height:auto;min-height:var(--row-height);border-right:1px solid #e4e4e4;border-bottom:1px solid var(--line-soft);padding:0;vertical-align:top;white-space:normal;overflow:visible;background:#fff;cursor:var(--excel-cell-cursor)}
.flowline-sheet td.neg{color:var(--neg)}
.flowline-sheet td.aff{color:var(--aff)}
.flowline-sheet td:hover .cell-value{background:#fbfcfe}
.flowline-sheet td.is-active:hover .cell-value{background:transparent}
.flowline-sheet td.is-selected{background:var(--selection)}
.flowline-sheet td.is-active{background:#fff}
.flowline-sheet td.is-find-match .cell-value{background:#fff5cb}
.flowline-sheet td.is-find-current .cell-value{background:#ffe999;box-shadow:inset 0 0 0 1px #b38b00}
.cell-value{display:flex;align-items:flex-start;min-height:var(--row-height);padding:4px 6px 5px;line-height:var(--cell-line-height);white-space:pre-wrap;overflow-wrap:anywhere}
.cell-value.is-bold{font-weight:700}
.flowline-sheet td.is-editing{z-index:4;background:#fff}
.cell-editor{display:block;position:absolute;z-index:5;left:-2px;top:-2px;width:calc(100% + 4px);min-height:var(--editor-min-height);border:2px solid var(--active-ring);padding:4px 6px 5px;margin:0;background:#fff;color:inherit;font:inherit;line-height:var(--editor-line-height);outline:0;resize:none;overflow:hidden;cursor:text;caret-color:#1f1f1f;box-shadow:0 0 0 1px #fff}
.cell-editor.is-bold{font-weight:700}
.flowline-sheet td.is-editing .cell-value{display:none}
.flowline-sheet td.is-editing .cell-editor{display:block}
.selection-frame{position:absolute;top:0;left:0;display:none;z-index:3;pointer-events:none;border:2px solid var(--active-ring);box-shadow:inset 0 0 0 1px rgba(255,255,255,.4);will-change:transform,width,height;transition:transform 150ms cubic-bezier(.16,1,.3,1),width 150ms cubic-bezier(.16,1,.3,1),height 150ms cubic-bezier(.16,1,.3,1)}
.selection-frame::after{content:"";position:absolute;right:-4px;bottom:-4px;width:5px;height:5px;background:var(--active-ring);border:1px solid #fff;box-sizing:border-box}
.selection-frame.is-dragging-range{transition:none}
.selection-frame.is-editing{display:none!important}
.selection-frame.is-editing::after{display:none}
.flow-find{position:absolute;right:12px;top:10px;z-index:12;height:32px;display:flex;align-items:center;gap:4px;padding:3px;border:1px solid #c8c6c4;border-radius:4px;background:#fff;box-shadow:0 4px 14px rgba(0,0,0,.12)}
.flow-find[hidden]{display:none}
.flow-find-input{width:150px;height:24px;border:1px solid #d2d0ce;border-radius:2px;padding:0 7px;background:#fff;color:var(--ink)}
.flow-find-input:focus{outline:1px solid var(--active-ring);outline-offset:-1px}
.flow-find-count{min-width:34px;text-align:center;color:#605e5c;font-variant-numeric:tabular-nums}
.flow-find-button,.flow-find-close{width:23px;height:23px;border:1px solid transparent;border-radius:2px;background:transparent;color:#323130;padding:0;line-height:20px}
.flow-find-button:hover,.flow-find-close:hover{background:#f4f4f4;border-color:#e1dfdd}
.sheet-tabs{position:relative;height:34px;display:flex;align-items:center;gap:5px;padding:0 6px;border-top:1px solid #d0d0d0;background:#f4f4f4;overflow:visible}
.round-title-input{height:24px;width:128px;min-width:64px;max-width:16vw;overflow:hidden;text-overflow:ellipsis;border:1px solid transparent;border-radius:2px;background:transparent;color:#323130;padding:0 6px;text-align:left;white-space:nowrap;font-weight:600;flex:0 0 auto}
.round-title-input:hover{background:#fafafa;border-color:#e9e7e5}
.round-title-input:focus{background:#fff;border-color:#8a8886;outline:0;box-shadow:inset 0 0 0 1px #8a8886}
.flow-tabs{display:flex;align-items:center;gap:2px;min-width:80px;overflow-x:auto;overflow-y:hidden;flex:1 1 auto;scrollbar-width:none}
.flow-tabs::-webkit-scrollbar{display:none}
.sheet-tab{position:relative;height:24px;max-width:86px;display:flex;align-items:center;border:0;border-radius:4px;color:#555;background:transparent;white-space:nowrap;transition:background-color 80ms ease-out,color 80ms ease-out,box-shadow 80ms ease-out}
.sheet-tab:hover{background:#e9eaec}
.sheet-tab.is-dragging{opacity:.55}
.sheet-tab.is-drop-before::before,
.sheet-tab.is-drop-after::after{content:"";position:absolute;top:4px;bottom:4px;width:2px;border-radius:1px;background:var(--active-ring)}
.sheet-tab.is-drop-before::before{left:-3px}
.sheet-tab.is-drop-after::after{right:-3px}
.sheet-tab.side-aff{color:var(--aff)}
.sheet-tab.side-neg{color:var(--neg)}
.sheet-tab[aria-selected="true"]{background:#fff;color:#1f1f1f;box-shadow:inset 0 -2px 0 currentColor}
.sheet-tab.side-aff[aria-selected="true"]{color:var(--aff)}
.sheet-tab.side-neg[aria-selected="true"]{color:var(--neg)}
.sheet-tab-label{height:24px;max-width:62px;min-width:0;border:0;background:transparent;color:inherit;padding:0 5px 0 7px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sheet-tab-close{position:relative;width:14px;height:14px;margin-right:3px;border:0;border-radius:50%;background:transparent;color:#575757;opacity:0;transition:opacity 80ms ease-out,background-color 80ms ease-out,color 80ms ease-out}
.sheet-tab-close::before{content:"\00d7";position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font:13px/1 "Segoe UI",system-ui,sans-serif}
.sheet-tab:hover .sheet-tab-close,
.sheet-tab:focus-within .sheet-tab-close{opacity:.62}
.sheet-tab-close:hover{background:#edebe9;color:#111;opacity:1}
.flow-tab-actions{display:flex;align-items:center;gap:5px;flex:0 0 auto}
.compact-menu-shell{position:relative;display:flex;align-items:center;flex:0 0 auto}
.flow-add-group{display:flex;align-items:center;gap:2px;flex:0 0 auto}
.sheetbar-text-button{height:24px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:3px;background:transparent;padding:0 7px;font-weight:600;font-size:11.5px;letter-spacing:0;line-height:22px;transition:background-color 70ms ease-out,border-color 70ms ease-out,color 70ms ease-out}
.sheetbar-text-button:hover{background:#f3f3f3;border-color:#e1dfdd}
.sheetbar-text-button:active{background:#e9e9e9;border-color:#c8c6c4}
.utility-menu-button{font-size:18px;font-weight:600;letter-spacing:0;padding:0}
.ellipsis-icon{width:14px;height:14px;display:flex;align-items:center;justify-content:center;gap:2px}
.ellipsis-dot{width:3px;height:3px;border-radius:50%;background:currentColor;display:block}
.sheetbar-icon-button{width:26px;height:26px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;background:transparent;color:#323130;border-radius:3px;padding:0;line-height:1;transition:background-color 70ms ease-out,border-color 70ms ease-out,color 70ms ease-out,transform 70ms ease-out}
.sheetbar-icon-button:hover{background:#f3f3f3;border-color:#e1dfdd}
.sheetbar-icon-button:active,.sheetbar-icon-button[aria-expanded="true"]{background:#efefef;border-color:#d8d6d4}
.sheetbar-menu{position:absolute;right:0;bottom:29px;width:268px;max-height:min(520px,78vh);overflow:visible;border:1px solid #c8c6c4;background:#fff;box-shadow:0 8px 22px rgba(0,0,0,.14);z-index:20;padding:6px;border-radius:4px}
.sheetbar-menu[hidden]{display:none}
.menu-item{width:100%;min-height:30px;display:grid;grid-template-columns:20px minmax(0,1fr);align-items:center;gap:8px;border:1px solid transparent;background:transparent;border-radius:2px;padding:3px 7px;text-align:left;color:#323130}
.menu-item:hover,.menu-item:focus{background:#fafafa;border-color:#ecebea;outline:0}
.menu-item:active{background:#edebe9;border-color:#c8c6c4}
.menu-icon{width:18px;height:18px;display:inline-flex;align-items:center;justify-content:center;color:#605e5c}
.menu-icon svg{width:16px;height:16px;display:block;fill:none;stroke:currentColor;stroke-width:1.3;stroke-linecap:round;stroke-linejoin:round}
.add-aff-item .menu-icon,.add-aff-item{color:var(--aff)}
.add-neg-item .menu-icon,.add-neg-item{color:var(--neg)}
.menu-divider{height:1px;margin:5px 2px;background:#edebe9}
.open-command{grid-template-columns:20px minmax(0,1fr) 10px}
.open-command::after{content:"";justify-self:end;width:8px;height:5px;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' fill='none' stroke='%23605e5c' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/8px 5px no-repeat;grid-column:3;grid-row:1}
.open-command span:last-of-type{padding-right:0}
.open-menu{position:absolute;right:calc(100% + 6px);top:41px;width:260px;max-height:min(330px,70vh);overflow:auto;border:1px solid #c8c6c4;background:#fff;box-shadow:0 8px 22px rgba(0,0,0,.14);z-index:30;padding:7px;margin:0;border-radius:4px}
.open-menu[hidden]{display:none}
.open-search{width:100%;height:28px;border:1px solid #c8c6c4;border-radius:2px;padding:0 8px;font:inherit;color:var(--ink);background:#fff}
.open-search:focus{outline:1px solid var(--active-ring);outline-offset:-1px}
.open-section{margin-top:8px}
.open-section-title{height:18px;color:#605e5c;font-size:11px;font-weight:600;display:flex;align-items:center}
.open-list{display:grid;gap:1px}
.open-item{min-height:34px;border:1px solid transparent;background:transparent;border-radius:2px;padding:3px 7px;text-align:left;color:#323130;display:grid;grid-template-columns:minmax(0,1fr);align-content:center;gap:1px}
.open-item:hover,.open-item:focus{background:#fafafa;border-color:#ecebea;outline:0}
.open-item[aria-current="true"]{background:#f3f7fb;border-color:#d5e4f0}
.open-item-primary{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.open-item-meta{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#777;font-size:11px}
.open-empty{height:24px;display:flex;align-items:center;color:#777;padding:0 7px}
.danger-flow{color:#9f2f2f}
.danger-flow:hover{background:#fff4f4;border-color:#f1d5d5;color:#8f2727}
.zoom-panel{display:grid;gap:7px;padding:5px 7px 6px}
.zoom-panel-head{display:flex;align-items:center;justify-content:space-between;color:#323130;font-weight:600}
.zoom-control{display:grid;grid-template-columns:26px minmax(80px,1fr) 26px;align-items:center;gap:7px}
.zoom-button{width:26px;height:24px;border:1px solid #d2d0ce;background:#fff;border-radius:2px;color:#323130;padding:0;line-height:20px}
.zoom-button:hover{background:#fafafa;border-color:#d8d6d4}
.zoom-track{height:4px;border-radius:999px;background:#e5e5e5;overflow:hidden}
.zoom-fill{display:block;height:100%;width:50%;background:var(--active-ring);border-radius:inherit}
.zoom-value{min-width:42px;text-align:right;color:#444;font-variant-numeric:tabular-nums}
.hidden-file-input{display:none}
.command-palette{position:fixed;inset:0;z-index:40;display:grid;place-items:start center;padding:54px 12px 12px;background:rgba(0,0,0,.12)}
.command-palette[hidden]{display:none}
.command-palette-panel{width:min(420px,calc(100vw - 24px));overflow:hidden;border:1px solid #c8c6c4;border-radius:4px;background:#fff;box-shadow:0 10px 24px rgba(0,0,0,.16)}
.command-palette-input{width:100%;height:36px;border:0;border-bottom:1px solid #edebe9;background:#fff;color:#1f1f1f;padding:0 11px;font-size:13px}
.command-palette-input:focus{outline:0;box-shadow:inset 0 -1px 0 var(--active-ring)}
.command-list{display:grid;gap:1px;max-height:min(330px,65vh);overflow:auto;padding:5px}
.command-item{width:100%;min-height:34px;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;border:1px solid transparent;border-radius:2px;background:transparent;padding:4px 8px;text-align:left;color:#323130}
.command-item:hover,.command-item:focus,.command-item[aria-selected="true"]{background:#fafafa;border-color:#ecebea;outline:0}
.command-item-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.command-item-shortcut{color:#777;font-size:11px;font-variant-numeric:tabular-nums;white-space:nowrap}
.command-empty{min-height:34px;display:flex;align-items:center;padding:4px 8px;color:#777}
.flow-feedback{position:fixed;right:12px;bottom:44px;z-index:50;min-height:28px;max-width:min(280px,calc(100vw - 24px));display:flex;align-items:center;padding:5px 10px;border:1px solid #c8c6c4;border-radius:4px;background:#fff;color:#323130;box-shadow:0 6px 14px rgba(0,0,0,.14);opacity:0;transform:translateY(6px);transition:opacity 120ms ease-out,transform 120ms ease-out}
.flow-feedback[hidden]{display:none}
.flow-feedback.is-visible{opacity:1;transform:translateY(0)}
.flow-feedback[data-tone="success"]{border-color:#bad7ba;background:#f7fbf7;color:#244b24}
.flow-feedback[data-tone="error"]{border-color:#e3b6b6;background:#fff7f7;color:#8f2727}
.settings-dialog{width:min(420px,92vw);border:1px solid #c8c6c4;border-radius:4px;padding:0;background:#fff;color:var(--ink);box-shadow:0 10px 24px rgba(0,0,0,.16)}
.settings-dialog::backdrop{background:rgba(0,0,0,.24)}
.settings-head{height:34px;display:flex;align-items:center;justify-content:space-between;background:#f8f8f8;padding:0 10px}
.settings-head h2{font-size:14px;margin:0;font-weight:600}
.settings-tabs{height:34px;display:flex;align-items:flex-end;gap:2px;padding:5px 8px 0;border-top:1px solid #f3f2f1;border-bottom:1px solid #edebe9;background:#f8f8f8}
.settings-tab{height:28px;border:1px solid transparent;border-bottom:0;border-radius:3px 3px 0 0;background:transparent;color:#605e5c;padding:0 10px;min-width:72px;text-align:center;transition:background-color 90ms ease-out,border-color 90ms ease-out,color 90ms ease-out,box-shadow 90ms ease-out}
.settings-tab:hover{background:#fff;border-color:#edebe9;color:#323130}
.settings-tab:focus-visible{outline:1px solid var(--active-ring);outline-offset:-2px}
.settings-tab[aria-selected="true"]{background:#fff;border-color:#edebe9;color:#1f1f1f;font-weight:600;box-shadow:inset 0 2px 0 var(--active-ring)}
.settings-body{max-height:min(560px,72vh);overflow:auto;padding:10px}
.settings-section{border:0;border-radius:0;background:#fff;margin-bottom:0;overflow:visible}
.settings-panel[hidden]{display:none}
.settings-section h3{height:26px;display:flex;align-items:center;margin:0 0 2px;padding:0;border-bottom:1px solid #edebe9;background:#fff;font-size:12px;font-weight:600;color:#323130}
.setting-row{display:grid;grid-template-columns:1fr auto;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid #f3f2f1}
.setting-row:last-child{border-bottom:0}
.setting-row span{color:var(--muted)}
.setting-row select{width:112px;height:28px;border:1px solid #c8c6c4;border-radius:2px;background:#fff;padding:0 7px}
.color-grid{display:grid}
.color-row{min-height:40px}
.color-control{display:inline-flex;align-items:center;gap:6px}
.color-input{width:42px;height:24px;border:1px solid #c8c6c4;border-radius:3px;background:#fff;padding:2px}
.color-swatch{box-shadow:inset 0 0 0 1px #fff}
.color-swatch:hover{border-color:#8a8886}
.color-swatch::-webkit-color-swatch-wrapper{padding:0}
.color-swatch::-webkit-color-swatch{border:0;border-radius:2px}
.color-swatch::-moz-color-swatch{border:0;border-radius:2px}
.shortcut-list{display:grid;padding:2px 0}
.shortcut-row{min-height:34px;display:grid;grid-template-columns:minmax(0,1fr) 124px;align-items:center;gap:10px;padding:5px 0;border-bottom:1px solid #f3f2f1}
.shortcut-row:last-child{border-bottom:0}
.shortcut-row span{color:var(--muted)}
.shortcut-input{height:24px;border:1px solid #c8c6c4;border-radius:2px;background:#fff;padding:0 7px;text-align:center;color:#323130}
.shortcut-input:focus{outline:1px solid var(--active-ring);outline-offset:-1px;border-color:var(--active-ring)}
.settings-actions{height:42px;display:flex;align-items:center;justify-content:space-between;gap:8px;border-top:1px solid #edebe9;background:#f8f8f8;padding:0 10px}
.reset-defaults{height:28px;border:1px solid transparent;border-radius:3px;background:transparent;color:#323130;padding:0 9px}
.reset-defaults:hover{background:#f3f3f3;border-color:#e1dfdd}

.confirm-dialog,.name-dialog{width:min(340px,92vw);border:1px solid var(--line);border-radius:6px;padding:0;background:#fff;color:var(--ink);box-shadow:0 10px 30px rgba(0,0,0,.18)}
.confirm-dialog::backdrop{background:rgba(0,0,0,.24)}
.name-dialog::backdrop{background:rgba(0,0,0,.24)}
.confirm-body,.name-body{padding:16px}
.confirm-body h2,.name-body h2{font-size:14px;margin:0 0 8px;font-weight:600}
.confirm-body p,.name-body p{margin:0;color:#444;line-height:1.38}
.confirm-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}
.confirm-cancel,.confirm-ok{height:28px;border:1px solid #c8c8c8;border-radius:3px;background:#fff;padding:0 12px}
.confirm-cancel:hover,.confirm-ok:hover{background:#f3f3f3}
.confirm-ok.is-danger{border-color:#9f2f2f;background:#9f2f2f;color:#fff}
.confirm-ok.is-danger:hover{background:#8a2929}
.name-field{display:grid;gap:6px;margin-top:12px}
.name-field span{color:var(--muted)}
.name-input{height:30px;border:1px solid #bdbdbd;border-radius:2px;padding:0 8px;background:#fff;color:var(--ink)}
.name-input:focus{outline:1px solid var(--office-blue);outline-offset:-1px;border-color:var(--office-blue)}
.name-error{margin-top:7px;color:#9f2f2f}

@media (max-width:720px){
  .sheet-tabs{gap:4px;padding:0 5px}
  .round-title-input{width:104px;max-width:28vw;min-width:52px}
  .flow-tabs{min-width:64px}
  .sheetbar-menu{right:0;width:min(268px,calc(100vw - 12px))}
  .open-menu{right:0;top:auto;bottom:31px;width:min(260px,calc(100vw - 12px))}
  .flow-feedback{right:6px;bottom:40px;max-width:calc(100vw - 12px)}
  .zoom-value{min-width:38px}
  .flow-find{right:6px;top:6px;width:calc(100vw - 12px)}
  .flow-find-input{width:100%;min-width:0}
  .settings-dialog{width:min(420px,calc(100vw - 12px))}
  .settings-tab{min-width:0;flex:1 1 0}
}

@media (prefers-reduced-motion: reduce){
.sheet-tab,
  .sheet-tab-close,
  .sheetbar-icon-button,
  .menu-item,
  .settings-tab,
  .flow-feedback,
  .round-title-input,
  .zoom-button,
  .selection-frame{transition:none}
}
