/* BOSJ Concessions: plain, phone-first styles. */
:root {
  --purple: #4b2a7b;
  --purple-light: #efe9f7;
  --ink: #1d1d22;
  --muted: #62626e;
  --line: #dcdce3;
  --bg: #f7f7fa;
  --ok: #1f7a3a;
  --warn: #9a5b00;
  --warn-bg: #fff4e0;
  --bad: #b3261e;
  --bad-bg: #fdecea;
  --radius: 8px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--purple); }
h1 { font-size: 1.5rem; margin: 0.2rem 0 0.8rem; }
h2 { font-size: 1.2rem; margin: 1.6rem 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 0.4rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Top bar */
.topbar { background: var(--purple); color: #fff; }
.topbar .inner { max-width: 1100px; margin: 0 auto; padding: 0.5rem 1rem; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: center; }
.brand { font-weight: 700; color: #fff; text-decoration: none; margin-right: auto; }
.nav { display: flex; flex-wrap: wrap; gap: 0.1rem 0.9rem; }
.nav a { color: #fff; text-decoration: none; padding: 0.35rem 0; opacity: 0.9; }
.nav a.active, .nav a:hover { opacity: 1; text-decoration: underline; }
.who { font-size: 0.85rem; opacity: 0.9; }
.who a, .who button { color: #fff; }
.who form { display: inline; }
.who button { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }

main { max-width: 1100px; margin: 0 auto; padding: 1rem; }

/* Messages */
.msg { padding: 0.6rem 0.8rem; border-radius: var(--radius); margin-bottom: 0.6rem; background: var(--purple-light); }
.msg.success { background: #e6f4ea; color: var(--ok); }
.msg.error { background: var(--bad-bg); color: var(--bad); }
.msg.warning { background: var(--warn-bg); color: var(--warn); }

/* Cards and boxes */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.warnbox { background: var(--warn-bg); border: 1px solid #f0d3a0; border-radius: var(--radius); padding: 0.7rem 0.9rem; margin: 0.8rem 0; }
.warnbox ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.flag { color: var(--warn); font-weight: 600; }
.bad { color: var(--bad); }
.good { color: var(--ok); }
.tag { display: inline-block; font-size: 0.75rem; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--purple-light); color: var(--purple); vertical-align: middle; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; margin: 0.6rem 0 1rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.8rem; }
.stat .label { font-size: 0.8rem; color: var(--muted); }
.stat .value { font-size: 1.35rem; font-weight: 700; }

/* Tables */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); background: #fafafc; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
tfoot td { font-weight: 700; background: #fafafc; }
tr.group td { background: var(--purple-light); font-weight: 600; }

/* Forms */
label { display: block; font-weight: 600; margin-bottom: 0.2rem; }
input[type=text], input[type=number], input[type=date], input[type=time], input[type=search],
input[type=password], select, textarea {
  width: 100%; padding: 0.55rem 0.6rem; font: inherit; border: 1px solid #b9b9c4; border-radius: 6px; background: #fff;
}
input.narrow { width: 6.5rem; }
input.bad-input { border-color: var(--bad); background: var(--bad-bg); }
textarea { resize: vertical; }
.field { margin-bottom: 0.9rem; }
.field .help { font-size: 0.82rem; color: var(--muted); margin-top: 0.15rem; }
.field .errors, .errorlist { color: var(--bad); font-size: 0.88rem; margin: 0.2rem 0 0; padding-left: 1rem; }
.field.check label { display: flex; gap: 0.5rem; align-items: center; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; margin-bottom: 0.8rem; }
.filters > * { flex: 1 1 140px; }
.filters .actions { flex: 0 0 auto; }

.btn, button.btn {
  display: inline-block; padding: 0.55rem 1rem; font: inherit; font-weight: 600; border-radius: 6px;
  border: 1px solid var(--purple); background: var(--purple); color: #fff; text-decoration: none; cursor: pointer;
}
.btn.secondary { background: #fff; color: var(--purple); }
.btn.small { padding: 0.3rem 0.6rem; font-size: 0.875rem; }
.actions-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.6rem 0 1rem; }
.actions-row form { display: inline; }

/* Shopping list check-off */
.check-btn {
  width: 2.2rem; height: 2.2rem; border-radius: 6px; border: 2px solid var(--purple); background: #fff;
  font-size: 1.2rem; line-height: 1; cursor: pointer; color: var(--ok);
}
.check-btn.on { background: #e6f4ea; border-color: var(--ok); }
tr.done td { color: var(--muted); }
tr.done td .pname { text-decoration: line-through; }

/* Counting */
.count-row { display: flex; gap: 0.6rem; align-items: center; justify-content: space-between; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.count-row .info { flex: 1; }
.count-row input { width: 6rem; font-size: 1.1rem; text-align: right; }
.sticky-save { position: sticky; bottom: 0; background: var(--bg); padding: 0.7rem 0; border-top: 1px solid var(--line); }

/* Recipe formset */
.recipe-table td { padding: 0.35rem; }
.recipe-table input[type=number] { width: 5.5rem; }

ol.steps li { margin-bottom: 0.35rem; }

@media (max-width: 640px) {
  main { padding: 0.7rem; }
  th, td { padding: 0.45rem 0.4rem; }
  .hide-sm { display: none; }
}

@media print {
  .topbar, .no-print, .msg { display: none !important; }
  body { background: #fff; font-size: 12px; }
  main { padding: 0; max-width: none; }
  .table-wrap, .card { border: 0; }
  a { color: inherit; text-decoration: none; }
  h2 { page-break-after: avoid; }
  tr { page-break-inside: avoid; }
}

/* Bar charts (sales reports) */
.bars { width: 100%; }
.bars td { border: 0; padding: 0.25rem 0.4rem; vertical-align: middle; }
.bars td.blabel { width: 1%; white-space: nowrap; font-size: 0.9rem; }
.bars td.bval { width: 1%; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 1.1rem; background: var(--purple); border-radius: 3px; min-width: 2px; }
.bar.light { background: #b9a6d6; }
.bar-stack { position: relative; height: 1.1rem; }
.bar-stack .bar { position: absolute; left: 0; top: 0; }
.legend { font-size: 0.82rem; color: var(--muted); margin: 0.3rem 0; }
.legend span::before { content: ""; display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 2px; margin: 0 0.3rem -0.1rem 0.6rem; background: var(--purple); }
.legend span.light::before { background: #b9a6d6; }
table.matrix td, table.matrix th { white-space: nowrap; }
table.matrix td.zero { color: #c3c3cc; }

/* Banner on the test copy */
.env-banner { background: #ffd43b; color: #1d1d22; text-align: center; font-weight: 700; padding: 0.35rem; letter-spacing: 0.03em; }
@media print { .env-banner { display: none; } }
