:root {
  --canvas: #f1f1f1; --card: #ffffff; --ink: #303030; --muted: #616161; --faint: #8a8a8a;
  --line: #e3e3e3; --top: #1a1a1a; --nav: #ebebeb; --nav-active: #fafafa; --brand: #b4521a;
  --btn: #303030; --link: #005bd3; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--canvas); }
body { font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; color: var(--ink); }
a { color: var(--link); }
button { font: inherit; }
.boot { padding: 40px; color: var(--muted); }

.top { height: 56px; background: var(--top); color: #e3e3e3; display: flex; align-items: center; gap: 16px; padding: 0 16px; position: sticky; top: 0; z-index: 3; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 650; color: #fff; min-width: 200px; text-decoration: none; }
.logo .mark { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; font-weight: 700; color: #fff; }
.search { flex: 1; max-width: 560px; margin: 0 auto; }
.search input { width: 100%; background: #303030; border: 1px solid #4a4a4a; border-radius: 10px; padding: 7px 12px; color: #f1f1f1; font: inherit; }
.search input::placeholder { color: #b5b5b5; }
.user { display: flex; align-items: center; gap: 10px; min-width: 200px; justify-content: flex-end; }
.avatar { width: 28px; height: 28px; border-radius: 8px; background: #2c6ecb; color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 12px; }
.linkbtn { background: none; border: 0; color: #b5b5b5; cursor: pointer; padding: 4px; }
.linkbtn:hover { color: #fff; }

.shell { display: flex; min-height: calc(100vh - 56px); }
.nav { width: 220px; background: var(--nav); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-radius: 8px; color: #303030; text-decoration: none; font-weight: 550; }
.nav a.on { background: var(--nav-active); box-shadow: 0 1px 0 rgba(0,0,0,.06); }
.nav .spacer { flex: 1; }
.nav .small { font-weight: 450; color: var(--muted); }
main { flex: 1; padding: 24px 32px; min-width: 0; max-width: 1400px; }

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; font-weight: 650; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { font-weight: 600; padding: 6px 12px; border-radius: 8px; border: 0; cursor: pointer; background: #fff; color: #303030; box-shadow: 0 0 0 1px #d4d4d4 inset, 0 1px 0 rgba(0,0,0,.05); text-decoration: none; display: inline-block; white-space: nowrap; }
.btn.primary { background: var(--btn); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn[disabled] { opacity: .5; cursor: default; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 0 rgba(0,0,0,.07), 0 0 0 1px rgba(0,0,0,.05); margin-bottom: 16px; overflow: hidden; }
.pad { padding: 16px; }
.card h2 { font-size: 14px; margin: 0 0 12px; font-weight: 650; }

.tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); align-items: center; overflow-x: auto; }
.tabs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 550; text-decoration: none; white-space: nowrap; }
.tabs a.on { background: #ebebeb; color: #303030; }
.tabs input { margin-left: auto; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; min-width: 220px; font: inherit; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; color: var(--muted); background: #f7f7f7; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12px; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.idx td { white-space: nowrap; }
tr.row { cursor: pointer; }
tr.row:hover td { background: #fafafa; }
td.num a { font-weight: 650; color: inherit; text-decoration: none; }
.foot { padding: 10px 12px; color: var(--faint); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 550; white-space: nowrap; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.b-new { background: #ffef9d; color: #4f4700; }
.b-received { background: #e0f0ff; color: #00527c; }
.b-in_production { background: #ffd6a4; color: #5e4200; }
.b-shipped { background: #cdfee1; color: #0c5132; }
.b-problem { background: #fedad9; color: #8e0b21; }
.b-active { background: #e3e3e3; color: #303030; }
.b-cancelled { background: #fedad9; color: #8e0b21; }
.b-plain { background: #f1f1f1; color: #616161; }

.crumb { color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.sub { color: var(--muted); margin: -8px 0 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.cols > * { min-width: 0; }
.banner { padding: 12px 16px; background: #fedad9; color: #8e0b21; border-radius: 10px; margin-bottom: 16px; font-weight: 550; }
.line-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.line-head h3 { margin: 0; font-size: 14px; }
.meta { color: var(--muted); }
.qty { text-align: right; }
.qty b { font-size: 15px; display: block; }
.thumbs { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.thumb { width: 140px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fafafa; text-align: center; text-decoration: none; color: inherit; }
.thumb img { width: 100%; height: 160px; object-fit: cover; display: block; background: #f4f4f4; }
.thumb.print img { object-fit: contain; background: #fff; padding: 8px; }
.thumb .missing { height: 160px; display: grid; place-items: center; padding: 12px; color: #8e0b21; background: #fff4f4; font-size: 12px; }
.thumb span { display: block; padding: 6px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.sku { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; background: #f4f4f4; padding: 6px 8px; border-radius: 6px; display: inline-block; word-break: break-all; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.hint { color: var(--faint); font-size: 12px; }
.placements td { white-space: nowrap; }
.placements td .hint { white-space: normal; }
.seg { display: inline-flex; border-radius: 8px; box-shadow: 0 0 0 1px #d4d4d4 inset; overflow: hidden; }
.seg button { font-weight: 550; border: 0; background: #fff; padding: 6px 10px; border-left: 1px solid #e3e3e3; cursor: pointer; white-space: nowrap; }
.seg button:first-child { border-left: 0; }
.seg button.on { background: #303030; color: #fff; }
.note-box { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.note-box textarea { flex: 1; min-width: 240px; min-height: 60px; font: inherit; padding: 8px; border-radius: 8px; border: 1px solid #8a8a8a; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: #8a8a8a; }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 15px; bottom: 0; width: 2px; background: #e3e3e3; }
.timeline li:last-child::after { display: none; }
.timeline small { color: var(--faint); display: block; }
.error { color: #8e0b21; margin: 8px 0 0; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login { width: 380px; max-width: 100%; background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 1px 0 rgba(0,0,0,.07), 0 0 0 1px rgba(0,0,0,.05); }
.login .logo { color: #303030; margin-bottom: 20px; min-width: 0; }
.login h1 { font-size: 20px; margin: 0 0 6px; }
.login p { color: var(--muted); margin: 0 0 18px; }
.login label { font-weight: 600; display: block; }
.field { display: block; width: 100%; font: inherit; padding: 9px 12px; border-radius: 8px; border: 1px solid #8a8a8a; margin: 6px 0 14px; }
.code { letter-spacing: 10px; font-size: 22px; text-align: center; font-weight: 650; }
.login .btn { width: 100%; padding: 9px; }
.form-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.form-row input[type=date] { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid #8a8a8a; }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; }

@media (max-width: 1200px) { .cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .nav { display: none; } main { padding: 16px; } .search, .user span { display: none; } .logo { min-width: 0; } }
