:root {
  --bg: #eee8e0;
  --fg: #4a4e36;
  --text: #2e211a;
  --border: #d8cdc0;
  --panel: #f5f1eb;
  --panel2: #e6ded3;
  --btn-text: #f1eae1;
  --rust: #a8653e;
  --muted: #6d655d;
  --good: #4a4e36;
  --bad: #a3402a;
  --heading: "Abril Fatface", Georgia, serif;
  --body: "Jost", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-weight: 400; font-size: 15px; line-height: 1.55; overflow-x: hidden; }
a { color: var(--fg); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--heading); font-weight: 400; margin: 0 0 .4em; line-height: 1.1; }
h1 { font-size: 34px; }
h2 { font-size: 24px; margin-top: 1.4em; }
h3 { font-size: 19px; margin-top: 1em; }
p { margin: 0 0 .8em; }
.dot { color: var(--rust); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--bad); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.top { background: var(--fg); color: var(--btn-text); }
.top a { color: var(--btn-text); text-decoration: none; }
.top-in { display: flex; align-items: center; gap: 18px; min-height: 58px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.logo { font-family: var(--heading); font-size: 24px; white-space: nowrap; }
.logo .tag { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; opacity: .8; margin-left: 4px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 6px 12px; border-radius: 100px; white-space: nowrap; font-size: 15px; }
.nav a.on, .nav a:hover { background: rgba(241, 234, 225, .16); }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; white-space: nowrap; }
.who form { margin: 0; }
.linkbtn { background: none; border: 1px solid rgba(241, 234, 225, .5); color: var(--btn-text); border-radius: 100px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }

main.wrap { padding-top: 28px; padding-bottom: 70px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head h1 { margin: 0; }

.flash { border-radius: 12px; padding: 10px 14px; margin-bottom: 18px; border: 1px solid var(--border); background: var(--panel); }
.flash.err { border-color: var(--bad); color: var(--bad); }
.flash.ok { border-color: var(--fg); }
.banner { background: var(--rust); color: var(--btn-text); border-radius: 12px; padding: 8px 14px; margin-bottom: 18px; font-size: 14px; }
.banner a { color: var(--btn-text); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 100px; padding: 0 20px; height: 40px; font: inherit; font-size: 15px; border: 1px solid var(--fg); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--fg); color: var(--btn-text); }
.btn-secondary { background: transparent; color: var(--fg); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 14px; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; min-width: 0; }
.card h3 { margin-top: 0; }
.card .big { font-family: var(--heading); font-size: 28px; line-height: 1.1; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 0; }
.kv > * { padding-right: 14px; }
.kv > :nth-child(even) { padding-right: 0; }
.kv > :nth-child(odd) { color: var(--muted); }
.kv > :nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.kv .total { border-top: 1px solid var(--border); padding-top: 4px; font-weight: 500; color: var(--text); }
.pill { display: inline-block; border-radius: 100px; padding: 1px 10px; font-size: 12px; border: 1px solid var(--border); background: var(--panel); white-space: nowrap; }
.pill.held, .pill.needs_check, .pill.lost, .pill.cancelled { border-color: var(--rust); color: var(--rust); }
.pill.dispatched, .pill.actual { border-color: var(--fg); color: var(--fg); }
.pill.refunded, .pill.partially_refunded, .pill.returned { border-color: var(--bad); color: var(--bad); }
.pill.estimated { border-style: dashed; }
.counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.count { display: block; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; text-decoration: none; color: var(--text); }
.count b { display: block; font-family: var(--heading); font-weight: 400; font-size: 26px; }
.count.alert { border-color: var(--rust); }

.tbl { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; background: var(--panel2); }
tr:last-child td { border-bottom: 0; }
td.nowrap, .nowrap { white-space: nowrap; }
tfoot td { font-weight: 500; background: var(--panel2); }

form.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
label { display: block; font-size: 13px; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 15px; color: var(--text); background: #fbf8f4; border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--fg); outline-offset: 0; }
textarea { width: 100%; min-height: 70px; }
.field { margin-bottom: 12px; }
.field input, .field select { width: 100%; }
.form-narrow { max-width: 440px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 140px; min-width: 0; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.actions form { margin: 0; }
.actions .card form + form { margin-top: 10px; }
.inline { display: inline; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; overflow-wrap: anywhere; }
.timeline li:last-child { border-bottom: 0; }
.timeline .meta { color: var(--muted); font-size: 12px; }

.bar { height: 12px; background: var(--panel2); border-radius: 100px; overflow: hidden; border: 1px solid var(--border); }
.bar > span { display: block; height: 100%; background: var(--fg); border-radius: 100px; }
.bar.warn > span { background: var(--rust); }
.bar.over > span { background: var(--bad); }
.chart { width: 100%; height: auto; max-height: 300px; display: block; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

.login { max-width: 400px; margin: 40px auto; }
.secret { font-family: var(--mono); font-size: 20px; letter-spacing: .05em; background: #fbf8f4; border: 1px dashed var(--fg); border-radius: 12px; padding: 14px; overflow-wrap: anywhere; user-select: all; }
.flags span { margin-right: 14px; white-space: nowrap; }

@media (max-width: 700px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  h1 { font-size: 28px; }
  .top-in { gap: 8px 12px; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -6px; }
  .who { margin-left: auto; }
  .card .big { font-size: 24px; }
  th, td { padding: 8px 10px; }
}
