:root {
  --bg: #f4f5f7;
  --card: #fff;
  --text: #1d2430;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #0b5cad;
  --accent-dark: #084a8c;
  --good: #0f7b45;
  --bad-bg: #fdecec;
  --bad: #a4161a;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.45; }
main { max-width: 960px; margin: 0 auto; padding: 1rem; display: grid; gap: 1rem; }
main > * { min-width: 0; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
a { color: var(--accent); }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1rem; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.brand span { font-weight: 400; color: var(--muted); margin-left: .35rem; }
.logout { display: flex; align-items: center; gap: .75rem; margin: 0; }
.user { color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.narrow { max-width: 380px; width: 100%; margin: 3rem auto 0; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.nowrap { white-space: nowrap; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; }

.stack { display: grid; gap: .9rem; }
.stack label { display: grid; gap: .3rem; font-weight: 600; }
.inline { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.inline input { flex: 1 1 220px; text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.inline input::placeholder { text-transform: none; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }

input {
  font: inherit; padding: .65rem .8rem; border: 1px solid #c9ced6; border-radius: 8px; background: #fff;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

button, .button {
  font: inherit; font-weight: 600; padding: .65rem 1.1rem; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .button:hover { background: var(--accent-dark); }
button.secondary, .button.secondary { background: #fff; color: var(--accent); }
button.secondary:hover, .button.secondary:hover { background: #eef4fb; }
button.link { background: none; border: none; color: var(--accent); padding: 0; font-weight: 500; }
button.link:hover { text-decoration: underline; background: none; }

.alert { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: .65rem .8rem; margin: .75rem 0 0; }

.total { display: grid; gap: .1rem; margin: 1rem 0; }
.total strong { font-size: 2.25rem; color: var(--good); line-height: 1.15; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.actions form { margin: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.num { text-align: right; white-space: nowrap; }
tfoot td { font-weight: 700; border-bottom: none; }
.history a { text-decoration: none; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: .75rem; }

.small-only { display: none; }

@media (max-width: 560px) {
  .wide-only { display: none; }
  .small-only { display: inline; }
  .per-piece { display: block; }
  .history .num { white-space: normal; }
  th, td { padding: .5rem .3rem; }
  table { font-size: .92rem; }
  th:first-child, td:first-child { padding-left: 0; }
  th:last-child, td:last-child { padding-right: 0; }
  main { padding: .5rem; }
  .card { padding: 1rem; }
  .brand span { display: none; }
  .total strong { font-size: 1.8rem; }
}
