/* Packing list sheet (sheet-edit-1): read only / editable supplier sheet in its own tab. Ledger tokens, light and dark. */
.sh-file-link{display:inline-flex;align-items:center;gap:6px;max-width:100%;color:var(--accent);font-weight:550;font-size:.8125rem;text-decoration:none;border-radius:6px;padding:2px 4px;margin:-2px -4px;transition:background-color .12s var(--ease-out)}
.sh-file-link span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--accent) 35%,transparent);text-underline-offset:3px}
.sh-file-link svg,.sp-file svg{width:15px;height:15px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.sh-file-link:hover{background:var(--accent-tint)}
.sh-file-link:hover span{text-decoration-color:currentColor}
.sh-file-link:active{background:var(--accent-tint);transform:scale(.98);transition-duration:60ms}
.sp-list td .sh-file-link{max-width:340px}

.sh-page{display:flex;flex-direction:column;gap:var(--s4);min-width:0}
.sh-head{display:flex;flex-direction:column;gap:var(--s2)}
.sh-head-row{display:flex;align-items:flex-end;justify-content:space-between;gap:var(--s4);flex-wrap:wrap}
.sh-title{min-width:0}
.sh-title h1{font-size:clamp(1.25rem,2.4vw,1.6rem);line-height:1.15;letter-spacing:-.02em;margin:0;overflow-wrap:anywhere}
.sh-title p{margin:4px 0 0;color:var(--ink-3);font-size:.8125rem}
.sh-hint{margin:0;color:var(--ink-2);font-size:.8125rem;line-height:1.5;max-width:70ch}

/* Read only | Editable: a clear two-way switch, Read only first and selected by default */
.sh-mode{display:inline-flex;background:var(--sunk);border:1px solid var(--rule);border-radius:10px;padding:3px;gap:3px;flex:none}
.sh-mode button{display:inline-flex;align-items:center;gap:7px;background:none;border:0;border-radius:7px;padding:8px 14px;min-height:36px;font-size:.8125rem;font-weight:550;color:var(--ink-2);cursor:pointer;transition:background-color .15s var(--ease-out),color .15s var(--ease-out),transform .1s ease-out}
.sh-mode button:active{transform:scale(.97);transition-duration:60ms}
.sh-mode svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.sh-mode button[aria-checked=true]{background:var(--sheet);color:var(--ink);font-weight:650;box-shadow:0 0 0 1px var(--rule),0 1px 3px rgba(20,26,33,.08)}
.sh-mode button[data-sh-mode=edit][aria-checked=true]{background:var(--accent);color:var(--on-accent,#fff);box-shadow:none}

/* the grid */
.sh-body{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--s4)}
.sh-body.sh-with-pages{grid-template-columns:minmax(0,1fr) minmax(260px,34%)}
.sh-scroll{overflow:auto;max-height:calc(100vh - 250px);min-height:240px;border:1px solid var(--rule);border-radius:var(--r-l,12px);background:var(--sheet);overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.sh-scroll:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sh-grid{border-collapse:separate;border-spacing:0;font-size:.8125rem;font-variant-numeric:tabular-nums;min-width:100%}
.sh-grid th,.sh-grid td{border-right:1px solid var(--rule);border-bottom:1px solid var(--rule);padding:0 10px;height:34px;white-space:nowrap;max-width:320px;overflow:hidden;text-overflow:ellipsis;text-align:left;vertical-align:middle}
.sh-grid td.num{text-align:right}
.sh-grid thead th{position:sticky;top:0;z-index:2;background:var(--material-bar);-webkit-backdrop-filter:saturate(180%) blur(14px);backdrop-filter:saturate(180%) blur(14px);height:auto;padding:6px 10px;font-weight:600;color:var(--ink-3);text-align:center;vertical-align:bottom}
.sh-letter{display:block;font-size:.6875rem;letter-spacing:.04em}
.sh-field{display:inline-block;margin-top:4px;padding:1px 7px;border-radius:20px;background:var(--accent-tint);color:var(--accent);font-size:.6875rem;font-weight:600;letter-spacing:0}
.sh-grid .sh-rn{position:sticky;left:0;z-index:1;background:var(--sunk);color:var(--ink-3);font-weight:500;text-align:right;padding:0;min-width:56px;overflow:visible}
.sh-grid thead .sh-corner{left:0;z-index:3;background:var(--sunk)}
.sh-rn-btn{display:flex;align-items:center;justify-content:flex-end;gap:6px;width:100%;height:100%;min-height:34px;padding:0 10px;background:none;border:0;color:inherit;font:inherit;font-variant-numeric:tabular-nums}
button.sh-rn-btn{cursor:pointer;color:var(--ink-2)}
button.sh-rn-btn:hover,button.sh-rn-btn[aria-expanded=true]{background:var(--accent-tint);color:var(--accent)}
button.sh-rn-btn:active{transform:scale(.96)}
.sh-header-row td{font-weight:650;color:var(--ink);background:color-mix(in srgb,var(--sunk) 55%,var(--sheet))}
.sh-no-product td{color:var(--ink-2)}
.sh-dot{display:inline-block;width:7px;height:7px;border-radius:50%;flex:none}
.sh-dot.in{background:var(--in)}
.sh-dot.warn{background:var(--pend)}
.sh-dot.none{box-shadow:inset 0 0 0 1.5px var(--bad)}
.sh-dot.skip{box-shadow:inset 0 0 0 1.5px var(--ink-3)}
.sh-photo{display:block;padding:2px;margin:0 auto;border:0;background:none;border-radius:6px;cursor:zoom-in}
.sh-photo img{display:block;width:30px;height:30px;object-fit:cover;border-radius:5px}
.sh-photo:active{transform:scale(.95)}

/* editable */
.sh-editing .sh-scroll{border-color:color-mix(in srgb,var(--accent) 45%,var(--rule));box-shadow:0 0 0 3px var(--accent-tint)}
.sh-editing .sh-grid td{cursor:cell}
.sh-grid td:focus{outline:2px solid var(--accent);outline-offset:-2px;background:var(--accent-tint)}
.sh-grid td.sh-dirty{background:var(--pend-tint);color:var(--ink);font-weight:600}
.sh-grid td.sh-editing-cell{padding:0;overflow:visible;outline:2px solid var(--accent);outline-offset:-2px}
.sh-input{display:block;width:100%;min-width:90px;height:34px;border:0;border-radius:0;background:var(--sheet);color:var(--ink);padding:0 9px;font:inherit;font-variant-numeric:tabular-nums}
.sh-input:focus{outline:none}
.sh-menu{position:absolute;left:calc(100% + 4px);top:2px;z-index:5;display:flex;flex-direction:column;min-width:170px;padding:4px;border-radius:10px;background:var(--sheet);border:1px solid var(--rule);box-shadow:var(--shadow-pop,0 12px 32px rgba(0,0,0,.18));transform-origin:left top;animation:sh-pop .16s var(--ease-out)}
.sh-menu button{text-align:left;background:none;border:0;border-radius:7px;padding:9px 12px;min-height:38px;font:inherit;font-size:.8125rem;color:var(--ink);cursor:pointer}
.sh-menu button:hover,.sh-menu button:focus-visible{background:var(--accent-tint);color:var(--accent);outline:none}
.sh-menu button.danger{color:var(--bad)}
.sh-menu button.danger:hover{background:var(--bad-tint)}
@keyframes sh-pop{from{opacity:0;transform:scale(.96)}to{opacity:1;transform:none}}

/* the save bar floats over the sheet as a translucent layer */
.sh-bar{position:sticky;bottom:12px;z-index:6;display:flex;align-items:center;gap:var(--s2);padding:10px 12px 10px 16px;border-radius:14px;background:var(--material-bar);-webkit-backdrop-filter:saturate(180%) blur(18px);backdrop-filter:saturate(180%) blur(18px);border:1px solid var(--rule);box-shadow:0 10px 30px rgba(15,20,26,.16);animation:sh-rise .2s var(--ease-out)}
.sh-bar[hidden]{display:none}
.sh-count{flex:1;font-size:.8125rem;font-weight:600;color:var(--ink-2)}
@keyframes sh-rise{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

.sh-pages{border:1px solid var(--rule);border-radius:var(--r-l,12px);background:var(--sheet);overflow:hidden;align-self:start;max-height:calc(100vh - 250px);display:flex;flex-direction:column}
.sh-pages>summary{padding:10px 14px;font-weight:600;font-size:.8125rem;cursor:pointer;border-bottom:1px solid var(--rule)}
#sh-pages{overflow:auto;display:grid;gap:8px;padding:8px}
#sh-pages img{width:100%;border-radius:6px;border:1px solid var(--rule)}
#sh-pages iframe{width:100%;height:calc(100vh - 320px);min-height:360px;border:0}

.sh-result{display:flex;flex-direction:column;gap:6px;border-left:3px solid var(--in);animation:sh-rise .2s var(--ease-out)}
.sh-result.warn{border-left-color:var(--pend);flex-direction:row;align-items:center;flex-wrap:wrap;gap:var(--s2)}
.sh-result-head{display:flex;align-items:center;gap:var(--s3);flex-wrap:wrap}
.sh-result-head strong{flex:1;min-width:160px}
.sh-result p{margin:4px 0 0}
.sh-close{background:none;border:0;font-size:1.3rem;line-height:1;color:var(--ink-3);cursor:pointer;width:36px;height:36px;border-radius:8px}
.sh-close:hover{background:var(--sunk)}
.sh-changes{margin:0;padding-left:18px;font-size:.8125rem;line-height:1.6;columns:2 260px;column-gap:28px}
.sh-changes.warn li::marker{color:var(--pend)}
.sh-legend{display:flex;flex-wrap:wrap;gap:6px 18px;color:var(--ink-3);margin:0}
.sh-legend span{display:inline-flex;align-items:center;gap:6px}
.sh-dirty-key{display:inline-block;width:14px;height:10px;border-radius:3px;background:var(--pend-tint);box-shadow:inset 0 0 0 1px var(--pend)}
.sh-history{font-size:.8125rem;color:var(--ink-2)}
.sh-history summary{cursor:pointer;font-weight:600}
.sh-history ul{margin:8px 0 0;padding-left:18px;line-height:1.7}
.sh-restore{margin:0}
body:has(.sh-editing) .cb-fab{display:none}

@media(max-width:900px){
 .sh-body.sh-with-pages{grid-template-columns:minmax(0,1fr)}
 .sh-pages{order:-1;max-height:none}
 .sh-pages:not([open]) #sh-pages{display:none}
 #sh-pages iframe{height:60vh}
}
@media(max-width:700px){
 .sh-head-row{flex-direction:column;align-items:stretch}
 .sh-mode{display:grid;grid-template-columns:1fr 1fr}
 .sh-mode button{justify-content:center;min-height:44px}
 .sh-scroll{max-height:68vh;border-radius:10px;margin:0 calc(-1 * var(--s1))}
 .sh-grid{font-size:.875rem}
 .sh-grid th,.sh-grid td{height:44px;max-width:220px}
 .sh-rn-btn{min-height:44px}
 .sh-input{height:44px;font-size:16px}       /* 16px stops iOS zooming into the field */
 .sh-photo img{width:36px;height:36px}
 .sh-bar{bottom:calc(76px + env(safe-area-inset-bottom,0px));padding:8px 8px 8px 14px}
 .sh-bar .btn{min-height:44px}
 .sh-menu{left:calc(100% + 2px)}
 .sh-menu button{min-height:44px}
 .sh-changes{columns:1}
}
@media(hover:none){.sh-file-link:hover,button.sh-rn-btn:hover{background:none}}
@media(prefers-reduced-motion:reduce){
 .sh-menu,.sh-bar,.sh-result{animation:none}
 .sh-mode button,.sh-file-link,.sh-photo,button.sh-rn-btn{transition:none;transform:none!important}
}
@media(prefers-reduced-transparency:reduce){
 .sh-bar,.sh-grid thead th{background:var(--sheet);-webkit-backdrop-filter:none;backdrop-filter:none}
}
@media(prefers-contrast:more){
 .sh-grid th,.sh-grid td{border-color:var(--ink-3)}
 .sh-grid td.sh-dirty{box-shadow:inset 0 0 0 2px var(--pend)}
}
.sh-head .in-back{overflow-wrap:anywhere;font-size:.8125rem}
@media(max-width:700px){.sh-result-head strong{flex-basis:100%}.sh-result-head .btn{flex:1}}
.sh-result:focus{outline:none}.sh-result:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
a.sh-file-link,.sp-table a.sh-file-link,.sp-list a.sh-file-link,.hs-alts a.sh-file-link,.sp-source a.sh-file-link{color:var(--accent)}
