:root {
  --bg: #f3f4f6; --card: #fff; --ink: #1c2430; --muted: #66707d; --line: #dfe3e8;
  --brand: #1f2933; --accent: #0b6bcb;
  --new: #6b7280; --prepared: #b7791f; --paid: #0b6bcb; --sent: #1a7f37; --skipped: #9aa1ab; --dup: #c62828;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
code { background: #eef1f4; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; word-break: break-all; }

.top { display: flex; align-items: center; gap: 24px; background: var(--brand); color: #fff; padding: 0 20px; height: 52px; position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; letter-spacing: .2px; }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { color: #cfd6de; text-decoration: none; padding: 7px 14px; border-radius: 6px; }
.top nav a.on, .top nav a:hover { background: #33404d; color: #fff; }
.top .out { color: #cfd6de; text-decoration: none; font-size: 13px; }

main { max-width: 1500px; margin: 0 auto; padding: 18px 20px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
h1 { font-size: 20px; margin: 0 0 12px; } h2 { font-size: 16px; margin: 0 0 12px; } h3 { font-size: 14px; margin: 16px 0 8px; }
.muted { color: var(--muted); } .small { font-size: 12px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; border: 1px solid; }
.flash.ok { background: #e8f5ec; border-color: #b7dfc3; color: #14532d; }
.flash.err { background: #fdecec; border-color: #f3b9b9; color: #7f1d1d; }
.flash.warn { background: #fff6e0; border-color: #f0d48a; color: #6b4a00; }

.btn { display: inline-block; font: inherit; padding: 7px 14px; border-radius: 7px; border: 1px solid #c5ccd4; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #8d98a5; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.pay { background: #1a7f37; border-color: #1a7f37; color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }

.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.chip b { color: var(--muted); font-weight: 600; margin-left: 4px; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; } .chip.on b { color: #cfd6de; }
.sync { display: flex; align-items: center; gap: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; position: sticky; top: 52px; background: var(--bg); padding: 8px 0; z-index: 5; }

table.orders { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.orders th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 9px 10px; background: #fafbfc; border-bottom: 1px solid var(--line); }
table.orders td { padding: 10px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
table.orders tr:last-child td { border-bottom: 0; }
table.orders td.c, table.orders th.c { width: 34px; text-align: center; }
.r { text-align: right !important; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px !important; }
.oid { font-weight: 600; font-variant-numeric: tabular-nums; }
.point { font-weight: 700; letter-spacing: .3px; }
.track { font-variant-numeric: tabular-nums; font-size: 12.5px; margin-top: 3px; word-break: break-all; }
.note { margin-top: 4px; font-size: 12.5px; background: #fff6e0; padding: 3px 6px; border-radius: 4px; }
.errtext { color: #b42318; font-size: 12.5px; margin-top: 4px; max-width: 320px; }
.warntext { color: #92400e; font-size: 12.5px; margin-top: 4px; }
.rowact { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }

tr[class^="st-"] td:first-child { border-left: 5px solid transparent; }
tr.st-new td:first-child { border-left-color: #cfd4da; }
tr.st-preparing td:first-child, tr.st-prepared td:first-child, tr.st-paying td:first-child { border-left-color: #e0a100; }
tr.st-prepared, tr.st-preparing, tr.st-paying { background: #fffbef; }
tr.st-paid td:first-child { border-left-color: var(--paid); } tr.st-paid { background: #f1f7fe; }
tr.st-sent td:first-child { border-left-color: var(--sent); } tr.st-sent { background: #f0f9f2; }
tr.st-skipped td:first-child { border-left-color: var(--skipped); } tr.st-skipped { background: #f4f5f6; color: #7a828c; }
tr.st-dup td:first-child { border-left-color: var(--dup); } tr.st-dup { background: #fff1f1; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: #fff; background: var(--new); }
.b-preparing, .b-prepared, .b-paying { background: #e0a100; color: #3b2a00; }
.b-paid { background: var(--paid); } .b-sent { background: var(--sent); } .b-skipped { background: var(--skipped); } .b-dup { background: var(--dup); }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 4px; background: #eef1f4; color: #3d4753; margin-top: 3px; }
.tag.k-inpost_locker, .tag.k-inpost_courier { background: #fff3c4; color: #5c4400; }
.tag.k-dpd_courier, .tag.k-dpd_pickup { background: #fde2e4; color: #8a1220; }
.tag.k-allegro_wza { background: #ffe6d5; color: #8a3b00; }
.tag.cod { background: #e6e0ff; color: #3b2a8a; }
.legend { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 13px; }
label input, label select, label textarea { display: block; width: 100%; margin-top: 4px; font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid #c5ccd4; border-radius: 7px; background: #fff; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin-top: 3px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.four { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 0 16px; align-items: start; }
.savebar { grid-column: 1 / -1; margin-bottom: 16px; }
.code { font-size: 20px; letter-spacing: 2px; background: #eef1f4; padding: 2px 10px; border-radius: 6px; }

dialog { border: 0; border-radius: 12px; padding: 22px 24px; width: min(520px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(20, 28, 38, .5); }
.dlgact { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

body.login { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.loginbox { width: min(380px, 92vw); }
.loginbox .btn { width: 100%; }

@media (max-width: 900px) {
  table.orders thead { display: none; }
  table.orders, table.orders tbody, table.orders tr, table.orders td { display: block; width: 100%; }
  table.orders td.c { text-align: left; width: 100%; }
  .two, .four { grid-template-columns: 1fr; }
  .settings { grid-template-columns: 1fr; }
}
