:root { --orange: #F89422; --ink: #1f2328; --mute: #667085; --line: #e3e5e8; --bg: #f6f6f4; --card: #fff; --red: #c62828; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.4 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
[hidden] { display: none !important; }
.mark { font: 700 26px Georgia, "Times New Roman", serif; margin: 0; letter-spacing: -0.01em; }
.mark span { color: var(--orange); }
.mark { display: flex; align-items: center; gap: 8px; }
.card .mark { justify-content: flex-start; }
button { font: inherit; padding: 7px 12px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; color: var(--ink); }
button:hover { border-color: #b9bdc4; }
button.primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 700; }
button.primary:hover { filter: brightness(0.95); }
button.big { font-size: 18px; padding: 11px 22px; }
button:disabled { opacity: 0.5; cursor: default; }
input, textarea { font: inherit; padding: 8px 10px; border: 1px solid #c9cdd3; border-radius: 6px; width: 100%; background: #fff; color: var(--ink); }
input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
label { display: block; font-size: 13px; color: var(--mute); margin-bottom: 10px; }
label input, label textarea { margin-top: 4px; color: var(--ink); }
.err { color: var(--red); min-height: 1.3em; margin: 8px 0 0; font-size: 14px; }

#login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--orange); border-radius: 8px; padding: 26px; width: 100%; max-width: 360px; }
.sub { color: var(--mute); margin: 2px 0 18px; }

header { display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: #fff; flex-wrap: wrap; }
.grow { flex: 1; }
.rule { height: 3px; background: var(--orange); }
#who { color: var(--mute); font-size: 13px; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: #eef6ee; color: #256029; white-space: nowrap; }
.pill.bad { background: #fdecea; color: var(--red); font-weight: 700; }
.pill.wait { background: #fff4e0; color: #8a5300; }
body:not(.admin) .adminonly { display: none; }

main { padding: 14px 18px 40px; max-width: 1280px; margin: 0 auto; }
.searchrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
#q { flex: 1 1 380px; font-size: 18px; padding: 11px 14px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { padding: 5px 10px; font-size: 13px; border-radius: 99px; }
.filters button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.count { color: var(--mute); font-size: 13px; margin: 10px 2px 6px; }
.tablewrap { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--mute); padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #eef0f2; vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #fff8ef; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.num.zero { color: #b0b5bd; }
.sku { font-weight: 600; word-break: break-all; }
.ids { font: 12px ui-monospace, Menlo, Consolas, monospace; color: var(--mute); }
.t1 { font-weight: 600; }
.t2 { font-size: 12px; color: var(--mute); max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tagshort { font-size: 10px; font-weight: 700; color: #256029; background: #eef6ee; border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px; }
.noteline { font-size: 12px; color: #8a5300; }
.empty { text-align: center; color: var(--mute); padding: 34px 10px; }
.empty button { margin-top: 10px; }
.pager { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 14px; color: var(--mute); font-size: 13px; }

/* Flags: big enough to read from a step back at a packing table. */
.flag { display: inline-block; font-weight: 800; font-size: 13px; letter-spacing: 0.03em; padding: 3px 8px; border-radius: 5px; color: #fff; margin: 1px 3px 1px 0; white-space: nowrap; }
.f-2PK { background: #1565c0; } .f-3PK { background: #6a1b9a; } .f-TRANS { background: #00796b; }
.f-HAZ { background: #c62828; } .f-OS { background: #e65100; } .f-EXP { background: #455a64; }
.flagbtn { font-weight: 800; font-size: 15px; padding: 9px 14px; border: 2px solid #c9cdd3; background: #fff; color: #98a0ab; border-radius: 7px; }
.flagbtn.on { color: #fff; border-color: transparent; }
.flagrow { display: flex; gap: 8px; flex-wrap: wrap; }
.flaghelp { font-size: 12px; color: var(--mute); margin: 6px 0 0; }

dialog { border: 0; border-radius: 10px; padding: 0; width: min(880px, 96vw); max-height: 94vh; box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--ink); }
dialog::backdrop { background: rgba(20, 22, 26, .5); }
#dlgBody { padding: 20px 22px 22px; }
.dhead { display: flex; gap: 12px; align-items: flex-start; border-bottom: 3px solid var(--orange); padding-bottom: 10px; margin-bottom: 14px; }
.dhead h2 { font: 700 20px Georgia, serif; margin: 0; word-break: break-all; }
.dhead .x { margin-left: auto; border: 0; font-size: 22px; line-height: 1; padding: 2px 8px; }
.dgrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; }
@media (max-width: 760px) { .dgrid { grid-template-columns: 1fr; } }
.sec { margin-bottom: 16px; }
.sec h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mute); margin: 0 0 6px; }
.full { font-size: 13px; color: var(--mute); }
.cc { font-size: 12px; color: var(--mute); float: right; }
.cc.over { color: var(--red); font-weight: 700; }
.inline { display: flex; gap: 8px; }
.inline button { white-space: nowrap; }
.prep { font-size: 13px; color: #8a5300; background: #fff4e0; border-radius: 6px; padding: 7px 10px; }
.stock { display: flex; gap: 16px; font-size: 13px; color: var(--mute); flex-wrap: wrap; }
.stock b { color: var(--ink); font-size: 16px; display: block; }
.prevbox { background: #e9eaec; border-radius: 8px; padding: 14px; display: grid; place-items: center; }
.prevbox .zoom { zoom: 1.25; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.prevcap { font-size: 12px; color: var(--mute); text-align: center; margin: 6px 0 14px; }
.printrow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.printrow label { margin: 0; }
#pQty { font-size: 22px; font-weight: 700; text-align: center; }
.printbtn { width: 100%; margin-top: 12px; }
.bigflags { margin-bottom: 10px; }
.bigflags .flag { font-size: 20px; padding: 6px 12px; }
.adminrow { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.logtabs { display: flex; gap: 6px; margin-bottom: 10px; }
.logtabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.logwrap { max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.logwrap td, .logwrap th { font-size: 13px; padding: 6px 9px; }
.logwrap tbody tr { cursor: default; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; z-index: 50; }
#toast.show { opacity: 1; }
#toast.bad { background: var(--red); }

.keys { color: #98a0ab; font-size: 12px; margin: -2px 2px 8px; }
tbody tr.sel { background: #fff1de; box-shadow: inset 4px 0 0 var(--orange); }
.flag.z, .flagbtn.z { cursor: default; }
.flagbtn.z::after { content: " 🔒"; font-size: 11px; }
.translabel { font-weight: 700; color: #fff; background: #00796b; border-radius: 6px; padding: 8px 10px; margin-bottom: 10px; }
.nofn { background: #fdecea; color: var(--red); border-radius: 6px; padding: 10px; margin-bottom: 10px; font-weight: 600; }
.nofn button { margin-top: 8px; }
.suggest { font-size: 12px; margin-top: 6px; color: var(--mute); }
.suggest button { font-size: 12px; padding: 3px 8px; }
mark { background: #ffe2b8; color: inherit; border-radius: 2px; padding: 0 1px; }

img.bt { display: block; }
header .sep { width: 1px; height: 30px; background: var(--line); }
.card img.bt { margin: 0 0 14px -6px; }

.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tabs button { border: 0; background: none; padding: 8px 12px; border-radius: 6px; font-weight: 600; color: var(--mute); }
.tabs button.on { background: #fff1de; color: var(--ink); }
.copy { font-size: 11px; padding: 1px 7px; margin-left: 6px; border-radius: 4px; color: var(--mute); vertical-align: 1px; }
.copy:hover { color: var(--ink); }
.fn { font: 600 14px ui-monospace, Menlo, Consolas, monospace; white-space: nowrap; }
#recent tbody tr, #changes tbody tr { cursor: default; }
#recent td { white-space: nowrap; }
#recent td.wrap { white-space: normal; }
#changes td { font-size: 14px; }
#list td:nth-child(3) { min-width: 250px; }
#list td:nth-child(2) { white-space: nowrap; }
.sku { word-break: normal; overflow-wrap: anywhere; }
.ids { white-space: nowrap; }
#list .t1 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#list td { padding: 7px 10px; }

/* The colored "on" state has to out-rank .flagbtn's white background. */
.flagbtn.on.f-2PK { background: #1565c0; } .flagbtn.on.f-3PK { background: #6a1b9a; } .flagbtn.on.f-TRANS { background: #00796b; }
.flagbtn.on.f-HAZ { background: #c62828; } .flagbtn.on.f-OS { background: #e65100; } .flagbtn.on.f-EXP { background: #455a64; }
.inline input { flex: 1; min-width: 0; }
.cc { float: none; display: block; margin-top: 5px; }

td.ph { width: 60px; padding-right: 0 !important; }
.thumb { width: 52px; height: 52px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; display: block; }
.thumb.none { background: #f1f2f4; }
a.amz { color: inherit; text-decoration: none; border-bottom: 1px dotted #98a0ab; }
a.amz:hover { color: #0b63ce; border-color: #0b63ce; }
.photo { display: grid; place-items: center; height: 190px; background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.photo img { max-width: 100%; max-height: 188px; object-fit: contain; display: block; }
.photo.none { color: #98a0ab; font-size: 13px; background: #f6f6f4; height: 90px; }
.amzbtn { display: block; text-align: center; padding: 8px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: #0b63ce; font-weight: 600; margin-bottom: 12px; background: #fff; }
.amzbtn:hover { border-color: #0b63ce; }
dialog { width: min(940px, 96vw); }
#dlgBody { max-height: 94vh; overflow-y: auto; }
.dgrid { grid-template-columns: minmax(0, 1fr) 320px; }
@media (max-width: 760px) { .dgrid { grid-template-columns: 1fr; } }

.prepbtn { font-weight: 600; font-size: 14px; padding: 7px 12px; border: 2px solid #c9cdd3; background: #fff; color: #7a828e; border-radius: 7px; }
.prepbtn.on { background: #fff4e0; border-color: #e0962a; color: #7a4a00; }
.prepchip { display: inline-block; font-size: 11px; font-weight: 600; color: #7a4a00; background: #fff4e0; border: 1px solid #f0cf96; border-radius: 4px; padding: 1px 6px; margin: 3px 3px 0 0; white-space: nowrap; }
.preprow { max-width: 210px; white-space: normal; }
.suggest b { color: var(--ink); }
