*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;overflow:hidden;background:#3a4150;font:14px -apple-system,Helvetica,Arial,sans-serif;overscroll-behavior:none}
#bar{position:fixed;top:0;left:0;right:0;z-index:5;background:#1f2430;color:#e5e7eb;display:flex;flex-wrap:wrap;gap:6px 10px;align-items:center;padding:6px 8px;padding-top:max(6px,env(safe-area-inset-top))}
.grp{display:flex;gap:4px}
button{font:inherit;font-size:14px;padding:7px 10px;border-radius:7px;border:1px solid #475569;background:#2b3242;color:#e5e7eb;touch-action:manipulation;user-select:none;-webkit-user-select:none}
button.on{background:#e5e7eb;color:#111;border-color:#fff;font-weight:600}
button.col{border:2px solid var(--c);color:#fff;background:color-mix(in srgb,var(--c) 45%,#2b3242);font-weight:700}
button.col.on{background:var(--c);outline:3px solid #fff;outline-offset:1px}
button.save{background:#2563eb;border-color:#3b82f6;color:#fff;font-weight:600}
button.danger{background:#7f1d1d;border-color:#b91c1c;color:#fff}
#legend{font-size:12px;color:#cbd5e1;width:100%}#status{margin-left:8px;color:#fbbf24}
canvas{position:fixed;left:0;right:0;bottom:0;touch-action:none;display:block}
#dlg{position:fixed;inset:0;z-index:10;background:#0008;display:flex;align-items:center;justify-content:center}
#dlg[hidden]{display:none}
#dlg .box{background:#fff;border-radius:12px;padding:16px;width:min(440px,92vw)}#dlg h3{margin:0 0 8px}
#dlg textarea{width:100%;font-size:16px;padding:8px;border:1px solid #94a3b8;border-radius:8px}
#dlg .row{display:flex;gap:8px;margin-top:10px}#dlg .row span{flex:1}#dlg .row button:not(.save):not(.danger){background:#e5e7eb;color:#111}
@media (max-width:500px){button{font-size:13px;padding:6px 8px}#bar{gap:5px 6px;padding:5px 6px}#legend{font-size:11px}}
button.mv{border:2px solid #8E24AA;background:color-mix(in srgb,#8E24AA 45%,#2b3242);color:#fff;font-weight:700}button.mv.on{background:#8E24AA;color:#fff;outline:3px solid #fff;outline-offset:1px}
#sheetSel{font:inherit;font-size:14px;padding:7px 6px;border-radius:7px;border:1px solid #8E24AA;background:#2b3242;color:#fff;font-weight:600}
#bar{touch-action:manipulation}#zpct{min-width:44px;text-align:center;align-self:center;font-size:12px;color:#cbd5e1}
canvas.grab{cursor:grab}canvas.panning{cursor:grabbing}html,body{touch-action:none}#bar,#dlg{touch-action:manipulation}

#tabs{flex-basis:100%;flex-wrap:wrap;border-bottom:1px solid #334155;padding-bottom:4px}.tab{background:#2b3240;color:#cbd5e1;border-radius:6px 6px 0 0}.tab.on{background:#f8fafc;color:#111;font-weight:bold}.tab.new{background:#1e3a8a;color:#fff}button.print{background:#f59e0b;color:#111;font-weight:bold}
#symbar{position:fixed;left:0;bottom:0;width:200px;z-index:4;background:#1f2430ee;color:#e5e7eb;overflow-y:auto;padding:4px 6px;border-right:1px solid #475569;touch-action:pan-y}#symbar[hidden]{display:none}
.symhd{font-weight:700;padding:4px 2px}.symhd small{display:block;font-weight:400;font-size:11px;color:#94a3b8}#symbar summary{font-size:12px;font-weight:700;color:#fbbf24;padding:6px 2px 3px;cursor:pointer}
button.sym{display:flex;align-items:center;gap:6px;width:100%;margin:2px 0;padding:4px 6px;text-align:left;font-size:12px}button.sym .symico{width:42px;height:26px;flex:none;color:#e5e7eb}button.sym.on .symico{color:#111}

.tabgrp{display:inline-flex;border:1px solid #475569;font-size:14px;align-items:center;gap:4px;padding:4px 8px;cursor:pointer}.revSel{font:inherit;font-size:13px;padding:2px 4px;border-radius:5px;border:1px solid #64748b;background:#fff;color:#111;cursor:pointer}

#lineMenu{position:fixed;z-index:20;background:#fff;border-radius:10px;box-shadow:0 4px 16px #0008;padding:6px;display:flex;flex-direction:column;gap:4px;min-width:190px}#lineMenu button{background:#f1f5f9;color:#111;border-color:#cbd5e1;text-align:left;cursor:pointer}#lineMenu button.undoop{background:#fee2e2;border-color:#fca5a5}#lineMenu .lmh{font-weight:700;color:#1d4ed8;padding:2px 4px}

.tab.unsent{position:relative}.tab.unsent::after{content:"";position:absolute;top:3px;right:3px;width:8px;height:8px;border-radius:50%;background:#ef4444;box-shadow:0 0 0 1.5px #fff}

/* Toolbar Option B: left icon rail */
#rail{position:fixed;left:0;bottom:0;width:54px;z-index:6;background:#1f2430;border-right:1px solid #334155;display:flex;flex-direction:column;align-items:center;gap:4px;padding:6px 0;overflow-y:auto;touch-action:manipulation}
#rail #tools{display:contents}#rail button{width:42px;height:38px;padding:0;font-size:18px;line-height:1;flex:none}#rail hr{width:36px;border:0;border-top:1px solid #475569;margin:3px 0;flex:none}
canvas{left:54px}#symbar{left:54px}
#simLink{color:#111;background:#22c55e;padding:7px 10px;border-radius:7px;text-decoration:none;font-weight:700;align-self:center}
#active{font-size:12px;color:#e5e7eb;align-items:center;gap:6px}#active b{color:#fff}#active i{display:inline-block;width:14px;height:14px;border-radius:3px;border:1px solid #fff;vertical-align:middle}
#rail button.qsym{padding:2px}#rail button.qsym .symico{width:38px;height:24px;color:#e5e7eb}#rail button.qsym.on .symico{color:#111}
button.sym{position:relative}button.sym .pin{margin-left:auto;font-size:16px;color:#94a3b8;padding:0 2px;cursor:pointer}button.sym .pin.on{color:#fbbf24}
#dlgEUl{display:flex;gap:8px;align-items:center;margin-top:8px;font-weight:700;color:#1565c0;cursor:pointer}#dlgEU{width:20px;height:20px}
