/* Postgility (Cloudflare edition) — previous-dashboard look:
   dark navy band, white cards, one shared period control. */
:root {
  --navy: #10243e;
  --navy2: #1b3a5f;
  --ink: #1c2530;
  --muted: #6b7684;
  --line: #dde3ea;
  --bg: #f2f4f7;
  --card: #ffffff;
  --green: #157347;
  --red: #b02a37;
  --amber: #b8860b;
  --accent: #0b5cad;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 12px; }
button:hover { border-color: #b9c4d0; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { background: var(--red); border-color: var(--red); color: #fff; }
button.small { padding: 3px 9px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
a { color: var(--accent); }

header.band { background: var(--navy); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 20; }
header.band .row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
header.band h1 { font-size: 19px; margin: 0; letter-spacing: .2px; }
header.band .store { color: #b9c9dd; font-size: 13px; }
header.band .spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; background: var(--navy2); color: #dbe6f2; border: 1px solid #33507a; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #8a97a5; }
.pill.ok .dot { background: #2ecc71; }
.pill.bad .dot { background: #e74c3c; }
header.band button { background: var(--navy2); color: #eaf1f8; border-color: #33507a; }
header.band button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

main { max-width: 1180px; margin: 0 auto; padding: 14px 14px 60px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 12px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 120px; }
.card h3 { margin: 0 0 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.card .big { font-size: 27px; font-weight: 650; }
.card.sales .big { font-size: 32px; }
.card .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.periodbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0 2px; }
.periodbar .lbl { color: var(--muted); font-size: 13px; margin-right: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: #fff; padding: 5px 11px; }
.seg button.on { background: var(--navy); color: #fff; }
.trend { width: 100%; border-collapse: collapse; }
.trend td, .trend th { padding: 3px 6px; text-align: right; font-size: 13px; }
.trend th:first-child, .trend td:first-child { text-align: left; }
.up { color: var(--green); } .down { color: var(--red); }

nav.tabs { display: flex; gap: 4px; margin: 16px 0 0; border-bottom: 2px solid var(--navy); flex-wrap: wrap; }
nav.tabs button { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px 8px 0 0; font-weight: 550; color: var(--navy); }
nav.tabs button.on { background: var(--navy); color: #fff; }
nav.tabs .count { background: #e7edf4; border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 5px; }
nav.tabs button.on .count { background: var(--navy2); }

section.panel { background: var(--card); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; padding: 12px 14px; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .4px; }
table.list td.num, table.list th.num { text-align: right; }
tr.clickable { cursor: pointer; } tr.clickable:hover { background: #f6f9fc; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #eef2f6; border: 1px solid var(--line); margin: 1px 2px 1px 0; white-space: nowrap; }
.tag.swipe-matched { background: #e6f4ea; border-color: #bfe3cc; }
.tag.swipe-amount_differs, .tag.swipe-no_match { background: #fdecec; border-color: #f3c2c2; }
.tag.posted { background: #e6f4ea; }
.keptout { background: #fff8e6; border: 1px solid #ecd9a0; border-radius: 8px; padding: 10px 12px; margin-top: 14px; }
.keptout h4 { margin: 0 0 6px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar .spacer { flex: 1; }

.detail h2 { margin: 4px 0 2px; }
.detail .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.detail .box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.detail .box h4 { margin: 0 0 8px; }
.events { max-height: 260px; overflow: auto; font-size: 13px; }
.events div { padding: 3px 0; border-bottom: 1px dashed var(--line); }

#login { position: fixed; inset: 0; background: var(--navy); display: flex; align-items: center; justify-content: center; z-index: 50; }
#login .box { background: #fff; border-radius: 12px; padding: 26px 28px; width: 320px; }
#login h1 { margin: 0 0 4px; font-size: 21px; }
#login input { width: 100%; margin: 10px 0; }
#login button { width: 100%; }
.hidden { display: none !important; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60; max-width: 90vw; box-shadow: 0 4px 18px rgba(0,0,0,.25); }
.toast.error { background: var(--red); }
details.cashout { margin-top: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
details.cashout summary { font-weight: 600; cursor: pointer; }
.flag { background: #fdecec; border: 1px solid #f3c2c2; border-radius: 8px; padding: 8px 12px; margin: 8px 0; }

/* Record payment form: tender rows + Swipe charge candidates */
.payrow { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.paycand { margin-top: 2px; }
.cand { display: block; font-size: 13px; padding: 2px 0; cursor: pointer; }
#disc-recent { margin-top: 6px; }

/* Discrepancies report */
.report-head { margin-bottom: 10px; }
.report-head .report-store { font-size: 17px; font-weight: 700; }
.report-head h2 { margin: 2px 0; font-size: 19px; }
.report-totals { margin-top: 10px; font-weight: 650; }

/* Print: clean black-and-white report on letter paper — app chrome
   hidden, only the report area prints. */
@media print {
  header.band, .periodbar, .cards, #flags-box, nav.tabs, details.cashout,
  .toast, #login, .no-print { display: none !important; }
  body { background: #fff; }
  main { max-width: none; margin: 0; padding: 0; }
  section.panel { border: 0; padding: 0; }
  table.list th, table.list td { border-bottom: 1px solid #000; }
  * { color: #000 !important; background: #fff !important; }
}

