:root {
  --rb-red: #e41e1e;
  --rb-red-dark: #c41919;
  --rb-red-light: #fee7e7;
  --fg: #1a1a1a;
  --muted: #666;
  --border: #ddd;
  --bg: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.4; }
a { color: var(--rb-red-dark); }
main { padding: 1rem; max-width: 72rem; margin: 0 auto; }

header.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem;
  padding: .5rem 1rem; background: var(--rb-red); color: #fff;
}
header.top a { color: #fff; }
header.top .brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.2rem; text-decoration: none; }
header.top .brand img { display: block; border-radius: 3px; }
header.top nav { display: flex; flex-wrap: wrap; gap: 1rem; }
header.top nav a { text-decoration: none; }
header.top nav a:hover { text-decoration: underline; }
header.top .badge { margin-left: auto; font-size: .95rem; }

table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--border); }
th { background: var(--rb-red-light); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tags code { padding: .1rem .35rem; background: var(--rb-red-light); border-radius: 3px; }

.error { color: var(--rb-red-dark); background: var(--rb-red-light); padding: .6rem .8rem; border-radius: 6px; }

button, .button {
  font: inherit; cursor: pointer; border: 0; border-radius: 6px;
  padding: .5rem 1rem; background: var(--rb-red); color: #fff; text-decoration: none; display: inline-block; text-align: center;
}
button:hover, .button:hover { background: var(--rb-red-dark); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary, .button.secondary { background: #fff; color: var(--rb-red-dark); border: 2px solid var(--rb-red); }
button.link { background: none; color: var(--rb-red-dark); text-decoration: underline; padding: .5rem 0; }
input, select, textarea { font: inherit; padding: .5rem; border: 1px solid var(--border); border-radius: 6px; }

/* Phone variant: single column, big one-handed buttons. */
body.phone main { max-width: 32rem; }
body.phone header.top .badge { margin-left: 0; width: 100%; }
body.phone button, body.phone .button, body.phone input { min-height: 56px; width: 100%; font-size: 1.1rem; }
body.phone button.link { min-height: auto; }
body.phone form { display: flex; flex-direction: column; gap: .75rem; margin: 1rem 0; }
body.phone .logo-lg { display: block; margin: 1rem auto 0; border-radius: 6px; }
body.phone h1 { text-align: center; }
.person.current { background: var(--rb-red-dark); outline: 3px solid var(--fg); outline-offset: 2px; }
.person.current::after { content: " ✓"; }

tr.stale td { background: var(--rb-red-light); }
.bar { display: flex; align-items: center; justify-content: space-between; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.actions .big { display: block; width: 100%; padding: 1rem; margin-bottom: .6rem; font-size: 1.2rem; }
table.fields th { width: 12rem; background: none; }
.manual-entry { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Scanner, phone forms, undo. */
.scan .viewfinder { background: #000; border-radius: 8px; overflow: hidden; }
.scan video { display: block; width: 100%; height: 60vh; object-fit: cover; }
.scan .prompt { font-weight: 700; font-size: 1.2rem; background: var(--rb-red-light); padding: .75rem; border-radius: 6px; }
.scan-status { color: var(--muted); text-align: center; }
.item-form .field label { display: block; font-weight: 600; margin-bottom: .2rem; }
.item-form .field input, .item-form .field select, .item-form .field textarea { width: 100%; max-width: 32rem; }
.item-form fieldset { border: 1px solid var(--border); border-radius: 6px; margin: .5rem 0; }
.item-form label.radio { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; font-size: 1.1rem; }
body.phone .item-form label.radio input { width: auto; min-height: auto; transform: scale(1.4); }
body.phone select, body.phone textarea { width: 100%; font-size: 1.1rem; }
body.phone select { min-height: 56px; }
form.undo { display: flex; align-items: center; gap: .75rem; background: var(--rb-red-light); padding: .5rem .75rem; border-radius: 6px; }
form.undo button { width: auto; }
.print-now { background: var(--rb-red-light); padding: .5rem .75rem; border-radius: 6px; }
[hidden] { display: none !important; }

/* Photos */
.photo-strip { display: flex; gap: .5rem; overflow-x: auto; margin: 1rem 0; }
.photo-strip img { max-height: 120px; width: auto; border-radius: 4px; display: block; }
.photo-status { font-weight: 600; }
.photo-status.error { color: var(--rb-red-dark); }

.badge.overdue { background: var(--rb-red); color: #fff; border-radius: 3px; padding: 0 .4em; font-size: .85em; font-weight: 600; }
.courier-box { border: 1px solid var(--rb-red); background: var(--rb-red-light); border-radius: 6px; padding: .5rem 1rem; margin: 1rem 0; }
.courier-box h2 { margin-top: 0; }
