:root{color-scheme:light;--accent:#7442e8;--ink:#182238;--muted:#64718a;--line:#dfe4ef;--paper:#fff;--bg:#f5f6fc}
*{box-sizing:border-box}body{margin:0;background:var(--bg);font:14px/1.5 Inter,system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--ink)}
button,input,select,textarea{font:inherit;color:inherit}button,a,select{touch-action:manipulation}
button{min-height:38px;border:1px solid var(--line);border-radius:8px;background:#fff;padding:8px 13px;cursor:pointer;white-space:nowrap}
button:hover{background:#f0ecff;border-color:#c8b8f4}button:disabled{opacity:.45;cursor:default}button.primary{background:var(--accent);border-color:var(--accent);color:white;font-weight:600}button.primary:hover{background:#6330d2}button.danger{color:#aa2942}
input,select,textarea{border:1px solid var(--line);border-radius:8px;background:#fff;padding:9px 11px;min-width:0}input:focus-visible,button:focus-visible,select:focus-visible,a:focus-visible,textarea:focus-visible{outline:3px solid #b99bef;outline-offset:2px}
label{display:block;font-size:12px;font-weight:600;margin-bottom:7px}a{color:#6833cd;text-decoration:none}a:hover{text-decoration:underline}[hidden]{display:none!important}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.eyebrow{font-size:11px;letter-spacing:.09em;color:#7348c9;font-weight:650}.muted{color:var(--muted);font-size:12px}.error{color:#a7203c;background:#fff0f3;border:1px solid #f2cad3;padding:10px 14px;border-radius:8px}
.top{height:70px;background:white;border-bottom:1px solid var(--line);padding:0 26px;display:flex;align-items:center;justify-content:space-between;gap:18px}.brand{font-weight:800;letter-spacing:-.03em;font-size:22px}.brand span{color:#8252e9;font-size:13px;letter-spacing:.04em;margin-left:9px}.top-label{margin-left:25px;color:var(--muted);font-size:12px}.top nav{display:flex;gap:22px;align-items:center}
.layout{display:grid;grid-template-columns:260px minmax(0,1fr);height:calc(100dvh - 70px)}.sidebar{padding:22px 16px;background:#fff;border-right:1px solid var(--line);overflow:auto}.sidebar select,.sidebar input{width:100%;margin-bottom:16px}.sidebar #sheets{display:grid;gap:3px;margin-top:12px}
.sheet-button{text-align:left;overflow:hidden;text-overflow:ellipsis;width:100%;border:0;background:none;padding:10px 12px;font-size:13px}.sheet-button.active{background:#efe8ff;color:#6032be;font-weight:650}.side-help{font-size:12px;color:var(--muted);padding:17px 11px 0;margin-top:24px;border-top:1px solid var(--line)}.side-help strong{color:#51426f}.side-help p{margin:7px 0 12px}
main{padding:24px 26px 14px;min-width:0;display:flex;flex-direction:column;overflow:hidden}.heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:18px}h1{font-size:25px;line-height:1.25;letter-spacing:-.025em;margin:5px 0 7px}.actions{display:flex;gap:8px}
.notice{display:flex;justify-content:space-between;align-items:center;gap:12px;background:#eeebf8;color:#5d3d94;padding:8px 12px;border-radius:8px;font-size:12px;min-height:48px;margin-bottom:12px}.notice>div{display:flex;gap:8px}.notice button{font-size:12px;min-height:30px;padding:4px 9px}
.formula{display:grid;grid-template-columns:90px 110px minmax(120px,1fr) auto;gap:8px}.cell-help{margin:8px 1px 12px;color:var(--muted);font-size:12px;min-height:18px}.sheet-find{display:flex;gap:8px;align-items:center;margin-bottom:12px}.sheet-find input{width:min(360px,65%)}
.grid-wrap{flex:1;min-height:180px;overflow:auto;background:white;border:1px solid var(--line);border-radius:10px;position:relative}table{border-collapse:separate;border-spacing:0;table-layout:fixed;font-size:12px;min-width:100%}
th,td{padding:0;border-right:1px solid #e5e8f1;border-bottom:1px solid #e5e8f1;width:160px;min-width:160px;max-width:160px;height:34px}thead th{position:sticky;top:0;z-index:2;background:#f0f2f8;color:#69748b;text-align:center;font-weight:500;height:30px}th:first-child{position:sticky;left:0;z-index:1;width:48px;min-width:48px;max-width:48px;text-align:center;background:#f0f2f8;color:#69748b;font-weight:400}thead th:first-child{z-index:3}
.cell{display:block;border:0;border-radius:0;width:100%;height:33px;min-height:33px;background:transparent;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;padding:6px 9px;line-height:20px;font-size:12px}.cell.numeric{text-align:right;font-variant-numeric:tabular-nums}.cell.selected{box-shadow:inset 0 0 0 2px var(--accent);background:#f7f3ff}.cell.edited{background:#fff5cf}.cell.private{color:#8d8796;background:#f5f4f7}.cell:focus-visible{outline:0;box-shadow:inset 0 0 0 3px var(--accent)}tr.pending-delete td{text-decoration:line-through;opacity:.45;background:#fff0f3}
.pager{display:flex;justify-content:space-between;gap:12px;align-items:center;padding-top:12px}.pager>div{display:flex;align-items:center;gap:8px}.pager button{font-size:12px;padding:7px 10px;min-height:34px}#range{font-size:12px;color:var(--muted)}#loading{position:absolute;top:40px;left:30px;background:#fff;padding:16px;border-radius:8px;box-shadow:0 8px 30px #18223810}
dialog{width:min(600px,calc(100vw - 32px));max-height:85dvh;overflow:auto;border:1px solid var(--line);border-radius:18px;padding:26px;color:var(--ink);box-shadow:0 20px 80px #18223830}dialog::backdrop{background:#25304a66}dialog h2{font-size:22px;margin:0 0 15px}dialog p{color:var(--muted);font-size:13px}dialog textarea{width:100%;min-height:90px;resize:vertical}dialog .check{display:flex;gap:10px;margin:14px 0;align-items:flex-start;font-weight:400}.dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}.history-item{border-top:1px solid var(--line);padding:12px 0;display:flex;align-items:center;justify-content:space-between;gap:15px}
.login{display:grid;place-items:center;min-height:100dvh;padding:24px}.login-card{width:100%;max-width:420px;border:1px solid var(--line);border-radius:20px;padding:36px;background:white;box-shadow:0 12px 50px #25304a08}.login-card h1{margin-top:16px}.login-card p{color:var(--muted);margin-bottom:26px}.login-card input{width:100%;margin-bottom:18px}.login-card button{width:100%}.login-card #login-error{color:#a7203c;margin:0 0 10px}
@media(max-width:1000px){.top-label{display:none}.layout{grid-template-columns:210px minmax(0,1fr)}main{padding:18px 16px}.pager{align-items:flex-start;flex-direction:column}.heading{align-items:flex-start;flex-direction:column}}
@media(max-width:640px){.top{padding:0 14px;height:60px}.top nav a{font-size:11px}.top nav{gap:10px}.layout{height:auto;min-height:calc(100dvh - 60px);grid-template-columns:1fr}.sidebar{padding:14px;display:grid;grid-template-columns:1fr 1fr;gap:7px 12px;max-height:210px;border-bottom:1px solid var(--line)}.sidebar label{margin:0}.sidebar label[for=book]{grid-column:1;grid-row:1}.sidebar #book{grid-column:1;grid-row:2}.sidebar label[for=sheet-search]{grid-column:2;grid-row:1}.sidebar #sheet-search{grid-column:2;grid-row:2}.sidebar #sheets{grid-column:1/-1;display:flex;overflow:auto;margin:0}.sheet-button{width:auto;min-width:max-content}.sidebar #sheet-count,.side-help{display:none}main{height:calc(100dvh - 240px);min-height:520px}.formula{grid-template-columns:70px 95px minmax(90px,1fr)}#apply-cell{grid-column:1/-1}.notice{align-items:flex-start;flex-direction:column}.pager>div{flex-wrap:wrap}.heading{gap:10px;margin-bottom:12px}h1{font-size:22px}.cell-help{min-height:35px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
