:root{--navy:#0b1b2e;--navy2:#13283f;--accent:#ff6b35;--accent2:#ff8a5c;--bg:#f4f6f9;--card:#fff;--ink:#0b1b2e;--muted:#5b6778;--line:#dde3ea;--good:#1f9d55;--warn:#d98a00;--bad:#d33a2c;--r:12px;--shadow:0 1px 2px rgba(11,27,46,.06),0 4px 14px rgba(11,27,46,.06)}
@media (prefers-color-scheme:dark){:root{--bg:#0a1624;--card:#122338;--ink:#eef2f7;--muted:#9fb0c3;--line:#223a55;--shadow:none}}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif}
a{color:var(--accent)}
.top{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:16px;padding:10px 16px;background:var(--navy);color:#fff;border-bottom:3px solid var(--accent)}
.brand{display:flex;align-items:center;gap:10px;color:#fff;text-decoration:none;font-weight:800;font-size:20px;letter-spacing:.3px}
.brand img{border-radius:8px}
.topnav{display:flex;gap:4px;flex:1;overflow-x:auto;scrollbar-width:none}
.topnav a{color:#cfd8e3;text-decoration:none;padding:6px 10px;border-radius:8px;white-space:nowrap;font-size:14px;font-weight:600}
.topnav a.on,.topnav a:hover{background:var(--navy2);color:#fff}
.topright{display:flex;align-items:center;gap:10px}
.lng{display:flex;border:1px solid rgba(255,255,255,.35);border-radius:999px;overflow:hidden}
.lng button{background:none;border:0;color:#fff;padding:6px 11px;font-weight:700;font-size:13px;cursor:pointer;min-height:34px}
.lng button[aria-pressed=true]{background:var(--accent)}
button.link{background:none;border:0;color:#cfd8e3;cursor:pointer;font-size:14px;font-weight:600;min-height:34px}
main{max-width:1100px;margin:0 auto;padding:18px 16px 80px;outline:none}
h1{font-size:24px;margin:4px 0 14px}h2{font-size:18px;margin:18px 0 10px}h3{font-size:15px;margin:12px 0 6px}
.muted{color:var(--muted)}.small{font-size:13px}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:16px;box-shadow:var(--shadow);margin-bottom:14px}
.grid{display:grid;gap:12px;grid-template-columns:repeat(auto-fill,minmax(160px,1fr))}
.tile{display:flex;flex-direction:column;gap:6px;padding:16px;border-radius:var(--r);background:var(--card);border:1px solid var(--line);text-decoration:none;color:var(--ink);box-shadow:var(--shadow);min-height:108px;transition:transform .08s,border-color .15s}
.tile:hover{border-color:var(--accent);transform:translateY(-1px)}
.tile .ic{width:38px;height:38px;border-radius:10px;background:var(--navy);display:grid;place-items:center}
.tile .ic svg{width:20px;height:20px;stroke:var(--accent);fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.tile b{font-size:16px}.tile span{font-size:13px;color:var(--muted)}
.sect{font-size:12px;font-weight:800;letter-spacing:.08em;color:var(--muted);text-transform:uppercase;margin:20px 0 8px}
label{display:block;font-size:13px;font-weight:700;color:var(--muted);margin:10px 0 4px}
input,select,textarea{width:100%;font:inherit;padding:11px 12px;border:1px solid var(--line);border-radius:10px;background:var(--card);color:var(--ink);min-height:44px}
textarea{min-height:120px;font-family:ui-monospace,Menlo,monospace;font-size:13px}
input:focus,select:focus,textarea:focus{outline:2px solid var(--accent);outline-offset:1px;border-color:transparent}
input.scan{font-size:20px;font-weight:700;border:2px solid var(--accent)}
.row{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end}.row>*{flex:1;min-width:140px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;font:inherit;font-weight:800;padding:11px 18px;border-radius:10px;border:0;background:var(--accent);color:#fff;cursor:pointer;min-height:44px;text-decoration:none}
.btn:hover{background:var(--accent2)}.btn[disabled]{opacity:.5;cursor:default}
.btn.ghost{background:none;border:1.5px solid var(--line);color:var(--ink)}.btn.ghost:hover{border-color:var(--accent)}
.btn.navy{background:var(--navy)}.btn.small{padding:6px 12px;min-height:34px;font-size:14px}
.btn.bad{background:var(--bad)}.btn.good{background:var(--good)}
table{width:100%;border-collapse:collapse;font-size:14px}
th{text-align:left;font-size:12px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);padding:8px;border-bottom:2px solid var(--line)}
td{padding:8px;border-bottom:1px solid var(--line);vertical-align:top}
tr.click{cursor:pointer}tr.click:hover td{background:rgba(255,107,53,.06)}
.num{text-align:right;font-variant-numeric:tabular-nums}
.sku{font-family:ui-monospace,Menlo,monospace;font-weight:700}
.chip{display:inline-block;padding:2px 9px;border-radius:999px;font-size:12px;font-weight:800;background:var(--line);color:var(--ink)}
.chip.open{background:#ffe7dc;color:#a33d12}.chip.assigned{background:#e6efff;color:#1e4fa8}.chip.picking{background:#fff3cc;color:#7a5600}.chip.packed{background:#e3f6ea;color:#17633a}.chip.shipped{background:#dfe6ee;color:#334}.chip.cancelled{background:#f6dede;color:#8a1f17}
.bigqty{font-size:40px;font-weight:900;line-height:1}
.stat{display:flex;flex-direction:column;gap:2px}.stat b{font-size:26px}.stat span{font-size:12px;color:var(--muted);font-weight:700;text-transform:uppercase}
.stats{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}
.pimg{width:64px;height:64px;object-fit:contain;border-radius:8px;background:#fff;border:1px solid var(--line)}
.line{display:flex;gap:12px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line)}
.line .grow{flex:1;min-width:0}.line .t{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.binbig{font-family:ui-monospace,Menlo,monospace;font-weight:900;font-size:22px;color:var(--accent);min-width:110px}
.done{opacity:.45}
.banner{padding:12px 14px;border-radius:10px;background:#fff3cc;color:#5c4300;font-weight:600;margin-bottom:12px}
.banner.good{background:#e3f6ea;color:#17633a}.banner.bad{background:#f9e0de;color:#8a1f17}
#toast{position:fixed;left:50%;bottom:22px;transform:translateX(-50%);background:var(--navy);color:#fff;padding:12px 18px;border-radius:10px;font-weight:700;display:none;z-index:20;max-width:92vw;box-shadow:0 6px 24px rgba(0,0,0,.25)}
#toast.bad{background:var(--bad)}
.tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}.tabs button{font:inherit;font-weight:700;border:1.5px solid var(--line);background:var(--card);color:var(--ink);border-radius:999px;padding:6px 14px;cursor:pointer;min-height:36px}
.tabs button.on{background:var(--navy);color:#fff;border-color:var(--navy)}
.split{display:grid;grid-template-columns:1fr 1fr;gap:14px}@media(max-width:760px){.split{grid-template-columns:1fr}.top{flex-wrap:wrap}.topnav{order:3;flex-basis:100%}}
.login{max-width:420px;margin:40px auto}
.slip{background:#fff;color:#000;padding:24px;border:1px solid #ccc;max-width:700px}
@media print{.top,#toast,.noprint{display:none!important}main{padding:0}.card{box-shadow:none;border:0}body{background:#fff}}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip.pending{background:#fff3cc;color:#7a5600}.chip.approved{background:#e3f6ea;color:#17633a}.chip.denied{background:#f6dede;color:#8a1f17}
td input[type=checkbox]{width:22px;height:22px}
.grid2{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:8px 14px}
.fxthumbs{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0}.fxthumbs img{width:96px;height:96px;object-fit:cover;border-radius:10px;border:1px solid var(--line);background:#fff}
.fxthumbs.big img{width:150px;height:150px}.fxrev{display:inline-flex;flex-direction:column;gap:4px;max-width:120px}.fxrev img{width:110px;height:110px}
.note{white-space:pre-wrap}
.fnbars{display:flex;align-items:flex-end;gap:3px;height:180px;overflow-x:auto;padding-bottom:18px}
.fnday{position:relative;flex:1;min-width:14px;max-width:40px;height:100%;display:flex;align-items:flex-end;gap:1px}.fnday span{position:absolute;bottom:-18px;left:0;font-size:10px;color:var(--muted);white-space:nowrap}
.fnrev{flex:1;background:var(--navy);border-radius:3px 3px 0 0;opacity:.75}.fnpro{flex:1;background:var(--good);border-radius:3px 3px 0 0}.fnpro.neg{background:var(--bad)}
.fnkey{display:inline-block;width:10px;height:10px;border-radius:2px;vertical-align:middle}.fnkey.rev{background:var(--navy)}.fnkey.pro{background:var(--good)}
@media (prefers-color-scheme:dark){.fnrev{background:#7fa3c8}}
main.wide{max-width:none;padding-left:12px;padding-right:12px}
/* product catalog like Rithum: the grid fills the window and scrolls inside itself (down and right); titles and filters stay on top,
   the tick box and SKU stay on the left, the pager stays under the grid */
main.wide .grid-wrap{overflow:auto;border:1px solid #e5e5e5;border-radius:8px;background:var(--card,#fff)}
main.wide table.grid-sticky{font-size:13px;border-collapse:separate;border-spacing:0;min-width:100%}
main.wide table.grid-sticky td{padding:4px 6px;vertical-align:top;background:var(--card,#fff)}
main.wide table.grid-sticky th{padding:4px 6px;background:var(--card,#fff)}
main.wide table.grid-sticky thead th{position:sticky;top:0;z-index:3}
main.wide table.grid-sticky thead tr:nth-child(2) th{top:var(--hrow,40px);box-shadow:0 2px 0 #e5e5e5}
main.wide table.grid-sticky th:nth-child(1),main.wide table.grid-sticky td:nth-child(1){position:sticky;left:0;z-index:2}
main.wide table.grid-sticky th:nth-child(4),main.wide table.grid-sticky td:nth-child(4){position:sticky;left:30px;z-index:2;box-shadow:2px 0 0 #e5e5e5}
main.wide table.grid-sticky thead th:nth-child(1),main.wide table.grid-sticky thead th:nth-child(4){z-index:4}
main.wide .grid-pager{padding:8px 0}
main.wide .grid-pager .btn{flex:none;width:auto;min-width:40px}
main.wide .btn.small{flex:none;width:auto}
.row>.btn.small,.row>.chip{flex:none;min-width:0;width:auto}

/* product edit boxes, Rithum style: small grey boxes, as long as their text */
.rrow .rf { padding: 3px 7px; font-size: 14px; line-height: 1.45; min-height: 0; height: auto; border: 1px solid #e3e3e3; border-radius: 3px; background: #f6f6f7; box-shadow: none; flex: none; }
.rrow input.rf { height: 28px; }
.rrow select.rf { height: 30px; background: #fff; border-color: #ccc; }
.rrow textarea.rf { resize: both; font-family: inherit; }
.rrow .rf:focus { background: #fff; border-color: #6d3fd1; outline: none; }
.rrow .rf::placeholder { font-style: italic; color: #999; }
.rrow { min-height: 34px; }

/* catalog grid: cells you can edit in place (Rithum style) */
td.cell-ed { cursor: text; }
td.cell-ed:hover { outline: 1px solid #6d3fd1; outline-offset: -1px; background: #f7f4ff; }

/* product page: "Hide empty fields" hides empty boxes only (they stay on the page) */
.hide-empty .rrow[data-empty="1"] { display: none !important; }

/* Home: Money right now */
.mw .mw-grid { display: grid; grid-template-columns: minmax(280px, 1.3fr) 2fr; gap: 14px; }
@media (max-width: 860px) { .mw .mw-grid { grid-template-columns: 1fr; } }
.mw .mw-hero { border-radius: 14px; padding: 16px 18px 8px; background: #f3f4f6; border: 1px solid #e5e7eb; }
.mw .mw-hero.pos { background: linear-gradient(135deg, #e9f8ef, #d3f1df); border-color: #b7e4c7; }
.mw .mw-hero.neg { background: linear-gradient(135deg, #fdeeee, #f9d9d9); border-color: #f1b8b8; }
.mw .mw-big { font-size: 40px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.15; margin: 2px 0; }
.mw .mw-hero.pos .mw-big { color: #157a42; } .mw .mw-hero.neg .mw-big { color: #c0392b; }
.mw .mw-l { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; font-weight: 700; }
.mw .mw-s { font-size: 12px; color: #6b7280; margin-top: 2px; }
.mw .mw-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.mw .mw-tile { border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px 14px; background: var(--card, #fff); }
.mw .mw-tile .mw-v { font-size: 22px; font-weight: 800; margin-top: 2px; }
.mw .mw-tile.pos .mw-v, .mw .mw-tile.pos .mw-s { color: #157a42; } .mw .mw-tile.neg .mw-v { color: #c0392b; }
.mw b.mw-pos { color: #157a42; } .mw b.mw-neg, .mw .mw-neg { color: #c0392b; } .mw b.mw-zero { color: inherit; }
.mw .mw-more { margin-top: 12px; } .mw .mw-more summary { cursor: pointer; font-weight: 700; }
.mw .mw-panel { position: absolute; z-index: 40; right: 0; top: 100%; margin-top: 4px; background: var(--card, #fff); border: 1px solid var(--line, #ddd); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 8px 12px; min-width: 260px; max-height: 420px; overflow: auto; }
.mw .mw-hero { align-self: start; }
/* wide pages (Product Catalog, Channel inventory…): compact top so the rows get the screen */
main.wide{padding-top:6px}
main.wide h1{font-size:18px;margin:0 0 6px}
main.wide .tabs{gap:4px;margin-bottom:6px}
main.wide .tabs button{padding:4px 12px;font-size:13px;min-height:0;line-height:1.3}
main.wide .card{padding:8px 10px;margin-bottom:8px}
main.wide input,main.wide select,main.wide textarea{min-height:0;padding:4px 7px;font-size:13px;border-radius:6px}
main.wide .btn,main.wide button.btn{min-height:0;padding:5px 10px;font-size:13px}
main.wide .row{gap:6px}
main.wide table.grid-sticky thead tr:first-child th{font-size:10.5px;line-height:1.2;padding:4px 5px}
main.wide table.grid-sticky thead tr:nth-child(2) th{padding:3px 4px}
main.wide table.grid-sticky thead tr:nth-child(2) th input,main.wide table.grid-sticky thead tr:nth-child(2) th select{font-size:11.5px;padding:2px 4px;height:24px}
main.wide table.grid-sticky td{padding:3px 6px;line-height:1.3}
main.wide .grid-pager{padding:4px 0}
main.wide > h1{display:none}
main.wide table.grid-sticky td{white-space:nowrap;max-width:380px;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;padding-top:2px;padding-bottom:2px}
main.wide table.grid-sticky td input[type=checkbox]{margin:0;width:15px;height:15px}
main.wide .card > .tabs{margin-bottom:4px}
main.wide table.grid-sticky td img{width:22px!important;height:22px!important;vertical-align:middle}

/* catalog columns: drag the edge of a title to resize; narrow titles are cut (full name on hover) */
main.wide table.grid-sticky{table-layout:fixed;width:max-content;min-width:0}
main.wide table.grid-sticky thead tr:first-child th{position:sticky;vertical-align:bottom;overflow:hidden}
main.wide table.grid-sticky .th-txt{overflow:hidden;max-height:3.7em;word-break:normal;overflow-wrap:normal;padding-right:4px}
main.wide table.grid-sticky .col-rsz{position:absolute;top:0;right:0;width:7px;height:100%;cursor:col-resize;z-index:5}
main.wide table.grid-sticky .col-rsz:hover,main.wide table.grid-sticky .col-rsz:active{background:rgba(109,63,209,.35)}
main.wide table.grid-sticky thead tr:nth-child(2) th{overflow:hidden}
main.wide table.grid-sticky thead tr:nth-child(2) th select,main.wide table.grid-sticky thead tr:nth-child(2) th input{max-width:100%}

.colset-btns .btn{flex:none;width:auto}
.tabs[hidden]{display:none}
