:root {
  --navy: #151435; --ember: #F15A22; --red: #ED1B2F; --amber: #FAA61A; --teal: #389E9E; --purple: #7B3B8E;
  --ink: #1d1c33; --muted: #6a6985; --line: #e5e4ee; --bg: #f5f4f8; --card: #fff;
  --ui: 'Inter', system-ui, sans-serif; --display: 'MuseoModerno', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 var(--ui); color: var(--ink); background: var(--bg); }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(120deg, #151435, #7B3B8E 70%, #F15A22); }
.login form { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 28px; display: grid; gap: 14px; }
.login h1 { font: italic 700 24px var(--display); margin: 0; color: var(--navy); }
.login img { width: 56px; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
@media (max-width: 800px) { .shell { grid-template-columns: 1fr; } nav.side { position: static !important; height: auto !important; } }
nav.side { background: var(--navy); color: #fff; padding: 16px 10px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; }
nav.side .brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
nav.side .brand img { width: 36px; }
nav.side .brand b { font: italic 700 16px var(--display); }
nav.side a { color: #d9d8ea; text-decoration: none; padding: 8px 12px; border-radius: 8px; display: flex; justify-content: space-between; }
nav.side a.active, nav.side a:hover { background: rgba(255,255,255,.1); color: #fff; }
nav.side a .n { background: var(--amber); color: var(--navy); border-radius: 999px; padding: 0 7px; font-weight: 700; font-size: 12px; }
nav.side .who { margin-top: auto; font-size: 12px; color: #aaa9c4; padding: 8px 12px; }
nav.side .who button { background: none; border: 0; color: #fff; text-decoration: underline; padding: 0; cursor: pointer; }

main { padding: 24px; min-width: 0; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 24px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-decoration: none; color: inherit; }
.stat b { display: block; font-size: 28px; }
.stat span { color: var(--muted); }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #faf9fd; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.table-wrap table { border-radius: 12px; }
td img.thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }

.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eceaf4; color: var(--navy); white-space: nowrap; }
.pill.paid, .pill.ready_to_pack, .pill.live { background: #fff1d6; color: #8a5200; }
.pill.in_production { background: #efe1f4; color: var(--purple); }
.pill.packed { background: #dff3f3; color: #1f6e6e; }
.pill.dispatched, .pill.delivered, .pill.closed { background: #e2f4e6; color: #22703a; }
.pill.cancelled, .pill.returned, .pill.expired, .pill.retired, .pill.sold_out { background: #fde4e6; color: #a3121f; }
.pill.draft, .pill.hidden { background: #eceaf4; color: var(--muted); }
.pill.pod { background: #efe1f4; color: var(--purple); }

.btn { border: 0; border-radius: 8px; padding: 8px 14px; background: var(--navy); color: #fff; cursor: pointer; font-weight: 600; }
.btn.ember { background: var(--ember); }
.btn.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn.danger { background: #fff; color: var(--red); border: 1px solid #f3b8bd; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 4px 10px; font-size: 13px; }

label.f { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
label.f small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], select, textarea, input:not([type]) {
  border: 1px solid #cfcde0; border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; }
textarea { min-height: 110px; resize: vertical; }
.form { display: grid; gap: 12px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.err { color: var(--red); font-weight: 600; }
.ok { color: #22703a; font-weight: 600; }
.muted { color: var(--muted); }
.notice { background: #fff8e8; border: 1px solid #f5d9a0; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; }
.notice.staging { margin: 0; border-radius: 0; text-align: center; font-weight: 600; background: #FAA61A; border: 0; color: #151435; }
.lock { background: #f3f2f8; border: 1px dashed #c9c7da; border-radius: 10px; padding: 12px 14px; }

.events { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.events li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.events time { color: var(--muted); margin-right: 8px; }

.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.imgs figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.imgs img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.imgs figcaption { padding: 6px 8px; font-size: 12px; display: grid; gap: 4px; }

.toast { position: fixed; bottom: 16px; right: 16px; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 20; }
.toast.bad { background: var(--red); }

/* Packing slip — the only thing printed. */
.slip { display: none; }
@media print {
  body * { visibility: hidden; }
  .slip, .slip * { visibility: visible; }
  .slip { display: block; position: absolute; inset: 0; padding: 24px; font-size: 14px; }
  .slip .addr { font-size: 18px; border: 2px solid #000; padding: 14px; margin: 16px 0; white-space: pre-line; }
}
.slip-preview { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fff; }
.slip-preview .addr { white-space: pre-line; font-size: 15px; font-weight: 600; margin: 8px 0; }
