:root {
  --bg: #0e0f12; --bg2: #15171c; --surface: #1b1e25; --surface2: #232733;
  --line: #2c313c; --text: #f4f5f7; --muted: #8b929e; --red: #e0322b;
  --red-dim: #7a1f1b; --amber: #f0a020; --green: #2fb36b; --shadow: 0 6px 20px rgba(0,0,0,0.45);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding-bottom: 132px; }
.head-font { font-family: "Barlow Condensed", "Arial Narrow", sans-serif; text-transform: uppercase; letter-spacing: .05em; }

header { position: sticky; top: 0; z-index: 30; background: linear-gradient(180deg,#15171c,#0e0f12);
  border-bottom: 2px solid var(--red); padding: 12px 14px 8px; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 11px; }
.badge { font-family: "Barlow Condensed",sans-serif; font-weight: 700; background: var(--red); color: #fff;
  font-size: 24px; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
.brand h1 { font-family: "Barlow Condensed",sans-serif; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; margin: 0; font-size: 23px; }
.brand h1 small { display: block; font-size: 11px; color: var(--muted); letter-spacing: .16em; font-weight: 500; }
.monthbar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.monthbar input[type=month] { background: var(--surface); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 8px 10px; font-size: 15px; }
.tabs { display: flex; gap: 4px; margin-top: 10px; background: var(--surface); padding: 4px; border-radius: 11px; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-family: "Barlow Condensed",sans-serif; text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
  font-size: 15px; padding: 9px 2px; border-radius: 8px; }
.tabs button.active { background: var(--red); color: #fff; }

main { padding: 12px; max-width: 860px; margin: 0 auto; }
.sub { display: flex; gap: 6px; margin-bottom: 12px; }
.sub button { flex: 1; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 9px; padding: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.sub button.active { background: var(--surface2); color: var(--text); border-color: var(--red); }
.daypick { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 8px 12px; }
.daypick .d { font-family: "Barlow Condensed",sans-serif; font-size: 22px; }
.daypick button { background: var(--surface2); border: 1px solid var(--line); color: var(--text); border-radius: 8px;
  width: 40px; height: 40px; font-size: 20px; cursor: pointer; }

.btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 9px;
  padding: 9px 12px; font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); }

/* person rows (day view) */
.person { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 12px; margin-bottom: 7px; }
.person .nm { flex: 1; }
.person .nm small { color: var(--muted); margin-left: 6px; font-size: 12px; }
.steps { display: flex; gap: 5px; }
.steps button { width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg2);
  color: var(--muted); font-size: 16px; font-weight: 700; cursor: pointer; }
.steps button.on { background: var(--red); border-color: var(--red); color: #fff; }

/* grid view */
.gridwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.grid { border-collapse: collapse; font-size: 12px; min-width: 100%; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 4px 6px; text-align: center; white-space: nowrap; }
table.grid th.nm, table.grid td.nm { position: sticky; left: 0; background: var(--surface); text-align: left; z-index: 2; }
table.grid thead th { background: var(--surface2); position: sticky; top: 0; }
table.grid td.c { cursor: pointer; min-width: 26px; }
table.grid td.c.v { background: #221a1a; color: var(--red); font-weight: 700; }
table.grid td.tot { font-weight: 700; color: var(--amber); }
table.grid tr.hl td { background: #4a3a1a !important; }
table.grid tr.hl td.nm { color: #fff; background: #4a3a1a !important; }

/* generic data table (visitors/expend/spoilage) */
.rows { display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; }
.card .f { display: flex; gap: 8px; margin-bottom: 6px; }
.card label { flex: 1 1 0; min-width: 0; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.card input, .card select { background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  border-radius: 7px; padding: 8px; font-size: 14px; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.card input[type=date] { -webkit-appearance: none; appearance: none; }
.card .del { align-self: flex-end; }
.paynp { display: flex; gap: 8px; }
.tag { font-size: 12px; color: var(--muted); }

.section-title { font-family: "Barlow Condensed",sans-serif; text-transform: uppercase; letter-spacing: .05em;
  font-size: 18px; color: #cfd4dd; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin: 18px 0 10px; }

/* AO51 summary */
.kv { display: flex; justify-content: space-between; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.kv .k { color: var(--muted); } .kv .v { font-weight: 600; }
.kv.big .v { color: var(--amber); font-size: 18px; }
.inp-inline { width: 120px; background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  border-radius: 7px; padding: 6px 8px; font-size: 14px; text-align: right; }

.fab { position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 14px calc(30px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, var(--bg) 72%, transparent); display: flex; gap: 10px; max-width: 860px; margin: 0 auto; z-index: 25; }
.clearbtn { width: 100%; border: 1px solid var(--red-dim); background: transparent; color: #ffb4b0;
  border-radius: 10px; padding: 11px; font-size: 14px; cursor: pointer; margin-top: 22px; }
.fab .btn { flex: 1; justify-content: center; padding: 13px; font-size: 15px; }
.toast { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); background: var(--surface2);
  border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: var(--shadow); opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 40; }
.toast.show { opacity: 1; }
.muted { color: var(--muted); font-size: 13px; }
.addrow { width: 100%; border: 1px dashed var(--line); background: transparent; color: var(--muted);
  border-radius: 10px; padding: 11px; font-size: 14px; cursor: pointer; }

/* ---------------- PRINT (official forms) ---------------- */
#print { display: none; }
@media screen { #print { display: none !important; } }
@media print {
  @page { size: letter; margin: 0.4in; }
  body { background: #fff; color: #000; padding: 0; }
  body > header, body > main, body > .fab, body > .toast { display: none !important; }
  #print { display: block !important; }
  .pform { font-family: Arial, Helvetica, sans-serif; color: #000; page-break-after: always; }
  .pform:last-child { page-break-after: auto; }
  .pform.landscape { } /* AO201 prints wide; user picks landscape in print dialog */
  .ptitle { text-align: center; font-size: 12px; font-weight: bold; white-space: pre-line; line-height: 1.25; margin-bottom: 6px; }
  .phead { display: flex; justify-content: space-between; font-size: 11px; margin: 4px 0; }
  table.pt { border-collapse: collapse; width: 100%; font-size: 10px; }
  table.pt th, table.pt td { border: 1px solid #000; padding: 2px 4px; }
  table.pt th { background: #eee; }
  .pt .ctr { text-align: center; } .pt .r { text-align: right; }
  .psec { font-weight: bold; font-size: 11px; margin: 8px 0 3px; }
  .pmeals td { font-size: 10px; }
}
