:root{color-scheme:light;--ink:#152742;--muted:#52657e;--line:#d5dfed;--blue:#2556e6;--blue-dark:#1843bb;--paper:#fff;--background:#f3f6fa;--table-header:#edf2f9;font-family:Inter,"Noto Sans Thai","Segoe UI","Microsoft YaHei",sans-serif}
*{box-sizing:border-box}
body{margin:0;background:var(--background);color:var(--ink);font-size:15px;line-height:1.5}
[hidden]{display:none!important}
.site-header{background:var(--paper);border-bottom:1px solid var(--line)}
.header-inner{min-height:72px;max-width:1600px;margin:auto;padding:12px clamp(14px,3.6vw,44px);display:flex;align-items:center;justify-content:space-between;gap:10px}
.brand,.header-actions{display:flex;align-items:center;gap:12px}
.brand strong{letter-spacing:.035em}
.brand-mark{display:grid;place-items:center;background:var(--ink);color:#fff;font-weight:800;border-radius:7px;width:36px;height:36px;flex:none}
#session-user{font-size:.88em;color:var(--muted);overflow-wrap:anywhere}
main{width:min(1600px,100%);margin:auto;padding:clamp(17px,3.8vw,48px)}
h1{margin:0;font-size:clamp(25px,4.2vw,39px);line-height:1.18}
p{margin:0}
.th{color:var(--muted);margin-top:6px}
.environment{display:inline-block;font-size:.82rem;background:#e8efff;color:#254a9c;padding:5px 10px;border-radius:6px;margin:0 0 8px}
button,input{font:inherit;color:inherit}
button{appearance:none;border:1px solid var(--line);border-radius:8px;padding:8px 13px;min-height:42px;background:var(--paper);cursor:pointer;font-weight:600;line-height:1.25}
button:not(:disabled):hover{border-color:#9aafe2;background:#f0f5ff}
button.primary{background:var(--blue);border-color:var(--blue);color:#fff}
button.primary:not(:disabled):hover{background:var(--blue-dark);border-color:var(--blue-dark)}
button:disabled{opacity:.45;cursor:default}
:focus-visible{outline:3px solid #80a3ff;outline-offset:2px}
.login-card{margin:clamp(20px,8vh,85px) auto 0;width:min(100%,440px);padding:clamp(18px,5vw,34px);background:var(--paper);border:1px solid var(--line);border-radius:14px}
.login-card .environment{margin-top:13px}
.login-card form{display:grid;gap:14px;margin:18px 0 4px}
.login-card label{display:grid;gap:5px;font-weight:600}
.login-card label span,.audit-panel summary span{display:inline;color:var(--muted);font-size:.82rem;font-weight:400}
.login-card input{border:1px solid #afc0d7;border-radius:8px;padding:9px 12px;min-height:45px;width:100%;background:#fff;font-size:16px}
.heading{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:23px}
.toolbar{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:11px;margin-bottom:12px}
.toolbar-actions{display:flex;gap:6px;flex-wrap:wrap}
.sheet-option{display:flex;align-items:center;gap:5px;color:var(--muted);font-size:.88rem}
.sheet-option input,.sheet-option select{min-height:36px;margin:0;padding:5px 8px;background:var(--paper);border:1px solid var(--line);border-radius:6px;color:inherit;font:inherit}
.sheet-option input{width:9.2rem}
.sheet-search input{width:min(285px,42vw)}
.shared-sheet .sheet-table{min-width:3800px}
.shared-sheet .sheet-table :is(th,td)[data-column="note"]{width:120px}
.shared-sheet .sheet-table :is(th,td)[data-column="sku"]{width:170px}
.shared-sheet .sheet-table :is(th,td)[data-column="name"],.shared-sheet .sheet-table :is(th,td)[data-column="thai"]{width:190px}
.shared-sheet .sheet-table :is(th,td)[data-column="tracking"],.shared-sheet .sheet-table :is(th,td)[data-column="receipt"]{width:155px}
.shared-sheet .sheet-table td[data-column="receipt"]>span,.shared-sheet .sheet-table td[data-column="receipt"]>a{display:block}
.shared-sheet .sheet-table td:is([data-column="receipt"],[data-column="customerOrderId"]){padding:5px 8px;font-size:.86rem}
.sheet-table :is(th,td)[data-column]:is([data-column="costTotal"],[data-column="costThb"],[data-column="saleTotal"],[data-column="profit"]){background:#e6f0ff;color:#153e77;text-align:right;padding-right:8px}
.sheet-table .supplier-shipment :is(th,td){background:#f2f6fa;padding:5px 8px}
.sheet-table tr[data-color="green"] td{background:#d4e7ce}
.sheet-table tr[data-color="lightGreen"] td{background:#e7f1db}
.sheet-table tr[data-color="yellow"] td{background:#fdf1cf}
.sheet-table tr[data-color="red"] td{background:#f8dfdf}
.sheet-table tfoot :is(th,td){background:var(--table-header);height:36px}
.sheet-table td input[readonly]{color:var(--muted)}
.sheet-status,.hint{font-size:.88rem;color:var(--muted)}
.feedback{margin:0 0 12px;padding:9px 11px;color:#184885;background:#eaf2ff;border-radius:7px}
.feedback[data-type=error]{color:#8b2518;background:#fff0eb}
.feedback[data-type=success]{color:#146341;background:#e7f8ed}
.login-card .feedback{margin:14px 0 0}
.grid-wrap{position:relative;overflow:auto;max-height:min(68vh,740px);border:1px solid #aebed4;border-radius:10px;background:var(--paper)}
.sheet-table{border-spacing:0;width:100%;min-width:1365px;table-layout:fixed;background:var(--paper)}
.sheet-table th,.sheet-table td{border-right:1px solid var(--line);border-bottom:1px solid var(--line);vertical-align:middle;padding:0}
.sheet-table tr:last-child td,.sheet-table tr:last-child th[scope=row]{border-bottom:0}
.sheet-table th:last-child,.sheet-table td:last-child{border-right:0}
.sheet-table thead th{position:sticky;top:0;z-index:3;padding:9px 7px;background:var(--table-header);color:#22416a;text-align:left;font-size:.87rem}
.sheet-table thead small{display:block;font-size:.71rem;font-weight:400;color:var(--muted)}
.sheet-table tr>:first-child{position:sticky;left:0;width:46px;text-align:center;background:var(--table-header);z-index:2}
.sheet-table tr>:nth-child(2){position:sticky;left:46px;width:145px;z-index:1;box-shadow:2px 0 0 #c8d6eb}
.sheet-table td:nth-child(2){background:var(--paper)}
.sheet-table thead tr>:first-child,.sheet-table thead tr>:nth-child(2){z-index:4}
.sheet-table tr>:nth-child(3){width:180px}
.sheet-table tr>:nth-child(4){width:118px}
.sheet-table tr>:nth-child(5),.sheet-table tr>:nth-child(6),.sheet-table tr>:nth-child(7),.sheet-table tr>:nth-child(8){width:107px}
.sheet-table tr>:nth-child(9){width:141px}
.sheet-table tr>:nth-child(10){width:116px}
.sheet-table tr>:nth-child(11){width:203px}
.sheet-table tbody button{display:block;width:100%;border:0;border-radius:0;background:transparent}
.sheet-table tr[data-selected=true] td,.sheet-table tr[data-selected=true] th[scope=row]{background:#edf4ff}
.sheet-table td input{display:block;width:100%;min-height:46px;margin:0;padding:7px 9px;background:transparent;border:1px solid transparent;border-radius:0;font-size:16px}
.sheet-table td input:focus{outline:0;background:#fff;border:1px solid var(--blue);box-shadow:inset 0 0 0 1px var(--blue)}
.sheet-table td input[data-kind]{text-align:right;font-variant-numeric:tabular-nums}
.sheet-table tr[data-new=true] td:nth-child(2) input{box-shadow:inset 3px 0 0 #58a478}
.sheet-table td input[aria-invalid=true]{border-color:#bc3826;background:#fff5f3}
.sheet-table td.empty{padding:18px;text-align:left;width:auto;position:static;color:var(--muted)}
.hint{margin-top:10px}
.audit-panel{margin-top:18px;border:1px solid var(--line);border-radius:8px;background:var(--paper);padding:11px 14px}
.audit-panel summary{cursor:pointer;font-weight:600}
.audit-panel ul{list-style:none;margin:10px 0 0;padding:0}
.audit-panel li{margin-top:7px;font-size:.87rem;overflow-wrap:anywhere}
.audit-panel time{color:var(--muted)}
.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}
@media(max-width:570px){
 .header-inner{min-height:55px}.brand{gap:6px}.brand strong{font-size:.85em}.brand-mark{width:29px;height:29px}.header-actions{gap:5px}
 .heading{align-items:flex-end}.heading button{max-width:110px}.toolbar{margin-top:3px}.grid-wrap{max-height:56vh}
 .sheet-table tr>:first-child{width:34px}.sheet-table tr>:nth-child(2){left:34px;width:108px}
}


.work-nav{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 22px}
.work-nav button[aria-current=page]{background:#e7efff;border-color:#aebee7;color:#1843a1}
.workspace-group+.workspace-group{margin-top:26px}
.workspace-group h2{margin:0 0 10px;font-size:1.12rem;line-height:1.35}
.workspace-note{margin:0 0 11px;font-size:.89rem;color:var(--muted)}
#partner-note{margin-top:16px}
.workspace-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,245px),1fr));gap:10px}
.workspace-card{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:13px 15px;border:1px solid var(--line);border-radius:9px;background:var(--paper);color:var(--ink);text-decoration:none;text-align:start}
.workspace-card:hover{border-color:#9aafe2;background:#f0f5ff}
.workspace-card strong,.workspace-card small{display:block}
.workspace-card small{margin-top:4px;color:var(--muted);font-size:.86rem;font-weight:400;line-height:1.4}
.workspace-card>[aria-hidden=true]{flex:none;color:var(--blue)}
.workspace-test{width:min(100%,480px)}
.draft-notice{margin:9px 0 0;font-size:.87rem;color:#815312}
@media(max-width:570px){.work-nav{margin-bottom:15px}.workspace-group+.workspace-group{margin-top:19px}.workspace-grid{grid-template-columns:1fr}}

.sheet-view-controls{display:none}
.grid-wrap{max-width:100%;min-width:0;overscroll-behavior-inline:contain}
@media (max-width:1050px) and (orientation:portrait){
 main{padding:clamp(12px,2.7vw,28px)}
 .toolbar{align-items:stretch}
 .toolbar-actions{width:100%;gap:8px}
 .sheet-option{display:grid;gap:3px;flex:1 1 138px;min-width:0}
 .sheet-option input,.sheet-option select{min-width:0;width:100%;min-height:44px;font-size:16px}
 .sheet-option.sheet-search{flex:2 1 218px}
 .toolbar-actions>button,.sheet-view-controls button,#save,.work-nav button{min-height:44px}
 .sheet-view-controls{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 9px}
 .sheet-view-controls button[aria-pressed=true]{background:#e7efff;border-color:#aebee7;color:#1843a1}
 .grid-wrap{max-height:min(57vh,740px);scroll-padding-inline-start:186px}
 .sheet-table tr>:first-child{width:42px}
 .sheet-table tr>:nth-child(2):not([data-column="sku"]){left:auto;box-shadow:none}
 .sheet-table :is(th,td)[data-column="sku"]{position:sticky;left:42px;z-index:1;box-shadow:2px 0 0 #c8d6eb}
 .sheet-table :is(th,td)[data-column="sku"],.shared-sheet .sheet-table :is(th,td)[data-column="sku"]{width:144px}
 .sheet-table td[data-column="sku"]{background:var(--paper)}
 .sheet-table tr[data-selected=true] td[data-column="sku"]{background:#edf4ff}
 .sheet-table thead th[data-column="sku"]{z-index:4}
 .sheet-table tbody button{min-height:46px}
 .sheet-table td input{min-height:48px}
 .compact-sheet .grid-wrap{scroll-padding-inline-start:0}
 .compact-sheet .sheet-table{min-width:572px}
 .shared-sheet.compact-sheet .sheet-table{min-width:660px}
 .compact-sheet .sheet-table [data-column]:not([data-compact-column]),.compact-sheet .sheet-table tfoot{display:none}
 .shared-sheet.compact-sheet .sheet-table :is(th,td)[data-column="sku"]{width:136px}
 .compact-sheet .sheet-table :is(th,td):is([data-column="name"],[data-column="thai"]){width:120px}
 .compact-sheet .sheet-table :is(th,td)[data-column="customerQty"]{width:84px}
 .compact-sheet .sheet-table :is(th,td):is([data-column="qty"],[data-column="purchaseQty"]){width:90px}
 .compact-sheet .sheet-table :is(th,td)[data-column="dispatched"]{width:68px}
 .compact-sheet .sheet-table thead :is(th,small){overflow-wrap:anywhere}
}
