/* Operator portal styles: hand-written, no framework. Mobile first (375 px). */
:root {
  --accent: #0b6e4f;
  --accent-ink: #fff;
  --ink: #1d2327;
  --muted: #5f6b73;
  --line: #d9dee2;
  --bg: #f5f7f8;
  --ok: #e3f4ea;
  --error: #fbe4e4;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.45; }
a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  padding: .5rem 1rem; background: var(--accent); color: var(--accent-ink);
}
.top a, .top .link { color: var(--accent-ink); }
.brand { font-weight: 700; text-decoration: none; }
.top nav { order: 3; flex-basis: 100%; overflow-x: auto; }
.top nav ul { display: flex; gap: .25rem; margin: 0; padding: 0; list-style: none; white-space: nowrap; }
.top nav a { display: block; padding: .4rem .6rem; border-radius: 4px; text-decoration: none; }
.top nav a[aria-current="page"], .top nav a:hover { background: rgba(255, 255, 255, .18); }
.signout { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.who { opacity: .85; font-size: .9rem; }

main { padding: 1rem; max-width: 72rem; margin: 0 auto; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1rem; }
.narrow { max-width: 24rem; margin: 2rem auto; }

.flash { padding: .6rem .8rem; border-radius: 4px; border: 1px solid var(--line); }
.flash-ok { background: var(--ok); }
.flash-error { background: var(--error); }

form label { display: block; margin-bottom: .8rem; font-weight: 600; }
input, select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem; font: inherit;
  border: 1px solid var(--line); border-radius: 4px; background: #fff;
}
button {
  font: inherit; padding: .55rem 1rem; border: 0; border-radius: 4px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
button.link { background: none; padding: 0; text-decoration: underline; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: .5rem; border-bottom: 1px solid var(--line); text-align: left; }
.table-wrap { overflow-x: auto; }
th.num, td.num { text-align: right; }

h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.cards { display: grid; gap: 1rem; }
ul.plain { margin: 0; padding-left: 1.1rem; }

@media (min-width: 900px) {
  .top nav { order: 0; flex-basis: auto; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  .top, .flash { display: none; }
  main { padding: 0; max-width: none; }
}

/* Catalog pages (US-023) */
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: 0 0 1rem; }
a.button {
  display: inline-block; padding: .55rem 1rem; border-radius: 4px;
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
}
button.secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.filters { display: grid; gap: 0 1rem; }
.field-error { color: #9b1c1c; margin: -.5rem 0 .8rem; }
input[aria-invalid="true"] { border-color: #9b1c1c; }
fieldset { border: 1px solid var(--line); border-radius: 4px; margin: 0 0 .8rem; padding: .5rem .8rem .8rem; }
#barcodes input { margin-bottom: .4rem; }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
label.check input { width: auto; margin: 0; }
form.inline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
form.inline label { margin-bottom: 0; }
form.inline input { width: auto; }
.danger-zone { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.card + .card { margin-top: 1rem; }
@media (min-width: 900px) {
  .filters { grid-template-columns: 2fr 1fr 1fr; }
}

/* Markets pages (US-024) */
.hint { color: var(--muted); margin: -.5rem 0 .8rem; font-size: .9rem; }
input[type="color"] { width: 4rem; height: 2.5rem; padding: .15rem; }
table.inventory input { width: 7rem; margin: 0; }
table.inventory td.status { min-width: 6rem; color: var(--muted); }
table.inventory .field-error { margin: 0; }

/* Kiosks (US-025) */
.muted { color: var(--muted); }
form.inline label { margin-bottom: .4rem; }
.status { font-weight: 600; }
.status-Online { color: var(--accent); }
.status-Offline, .status-Revoked { color: #9b1c1c; }
button.danger { background: #9b1c1c; }
.enrolment-code {
  font: 700 clamp(2.2rem, 10vw, 3.5rem)/1.1 ui-monospace, "SFMono-Regular", Menlo, monospace;
  letter-spacing: .12em; text-align: center; margin: 1rem 0; padding: .75rem;
  border: 2px dashed var(--line); border-radius: 6px; word-break: break-all;
}

/* Promotions (US-026) */
.days { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-bottom: .8rem; }
.preview-line { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.preview-line label:last-child input { width: 5rem; }
#preview table { margin-top: .8rem; }

/* Market accounts (US-027) */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.balance { margin: 0 0 1rem; font-size: 1.1rem; }
td.debit { color: #9b1c1c; }
.wide-narrow { max-width: 36rem; }
.consumer-picks { max-height: 18rem; overflow-y: auto; padding-left: 1.5rem; }
@media (min-width: 900px) {
  .consumer-filters { grid-template-columns: 2fr 1fr; }
}
.badge-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(54mm, 1fr)); gap: 4mm; }
.badge-card {
  border: 1px dashed var(--muted); border-radius: 3mm; padding: 4mm; background: #fff;
  text-align: center; break-inside: avoid;
}
.badge-qr svg { width: 40mm; height: 40mm; }
.badge-name { margin: 2mm 0 0; font-weight: 700; overflow-wrap: anywhere; }
@media print {
  .no-print { display: none; }
  .badge-sheet { grid-template-columns: repeat(3, 1fr); }
}

/* Sales, Reports, Alerts (US-028) */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0 0 1rem; }
dl.facts dt { font-weight: 600; }
dl.facts dd { margin: 0; }
.mismatch { color: #9b1c1c; }
tfoot th { text-align: left; }
@media (min-width: 900px) {
  .sale-filters, .report-filters { grid-template-columns: repeat(5, 1fr); align-items: end; }
}

/* Driver pages: Pick list, Restock, Count (US-029) */
ul.market-picks { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
ul.market-picks li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; align-items: center; }
ul.market-picks .actions { margin: 0; }
#visit-days select { width: auto; }
#visit-days button { margin-bottom: .4rem; }
.pick-list td.pick, #pick-total { font-weight: 700; font-size: 1.1rem; }
.pick-list tr.nothing { color: var(--muted); }
.print-only { display: none; }
ul.stock-rows { list-style: none; margin: 0 0 1rem; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.stock-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem; gap: .25rem .75rem; align-items: center;
  padding: .6rem .75rem; border-bottom: 1px solid var(--line);
}
.stock-row:last-child { border-bottom: 0; }
.stock-row label { margin: 0; font-weight: 400; }
.stock-row .name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.stock-row .meta { display: block; color: var(--muted); font-size: .85rem; }
.stock-row input { margin: 0; font-size: 1.5rem; min-height: 3rem; text-align: right; padding: .3rem .5rem; }
.stock-row .field-error { grid-column: 1 / -1; margin: 0; }
.submit-bar { position: sticky; bottom: 0; padding: .75rem 0; background: var(--bg); }
.submit-bar button { width: 100%; min-height: 3.25rem; font-size: 1.15rem; font-weight: 600; }
@media (min-width: 900px) {
  .submit-bar button { width: auto; }
}
@media print {
  form.no-print { display: none; }
  body, main { background: #fff; }
  .pick-list { font-size: 10pt; }
  .pick-list th, .pick-list td { padding: 2pt 4pt; border-bottom: 1px solid #999; }
  .pick-list tr { break-inside: avoid; }
  .pick-list th.print-only, .pick-list td.print-only { display: table-cell; width: 3em; }
  .pick-list td.tick { border: 1px solid #999; }
}
