/* GMF Order Portal — shared styles. Mobile-first, no framework. */

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1a1a1a;
  background: #f5f5f4;
}
main { max-width: 640px; margin: 0 auto; padding: 0.75rem 0.75rem 6rem; }
h1 { font-size: 1.4rem; margin: 0.75rem 0 0.5rem; }
h2 { font-size: 1.15rem; margin: 0.75rem 0 0.4rem; }

/* Views are toggled via the hidden attribute; !important beats any display rule */
[hidden] { display: none !important; }
.view { display: block; }

header { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; padding: 0.5rem 0.75rem; background: #fff; border-bottom: 1px solid #ddd; }
header nav { display: flex; gap: 0.4rem; margin-left: auto; }

/* Item rows — used on divs AND buttons (history/warehouse lists), so reset button chrome */
.row { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.6rem 0.5rem; background: #fff; border: 0; border-bottom: 1px solid #e2e2e0; font: inherit; text-align: left; color: inherit; }
.row.pinned { border-left: 4px solid #b45309; }
.row.wide { justify-content: space-between; cursor: pointer; }
.row:disabled { opacity: 0.5; cursor: default; }
.row small { display: block; color: #555; }
.big, .row.big { font-size: 1.2rem; padding: 0.9rem 0.6rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.qty { min-width: 2ch; text-align: center; font-weight: 700; font-size: 1.1rem; }

.btn { font: inherit; font-size: 1rem; padding: 0.5rem 0.9rem; border: 1px solid #bbb; border-radius: 6px; background: #fff; color: #1a1a1a; cursor: pointer; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: #166534; border-color: #166534; color: #fff; font-weight: 600; }

/* Status badges: PAID / partial / conn state */
.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; background: #e5e7eb; font-size: 0.8rem; font-weight: 600; vertical-align: middle; }

.banner { background: #fef3c7; border: 1px solid #f3d47a; border-radius: 6px; padding: 0.5rem 0.75rem; }
[role="alert"] { color: #b91c1c; min-height: 1.2em; }

/* Sticky bottom total bar */
.totalbar { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.6rem 0.75rem; padding-bottom: calc(0.6rem + env(safe-area-inset-bottom)); background: #fff; border-top: 2px solid #1a1a1a; }
.totalbar #order-total { font-size: 1.3rem; font-weight: 700; }

/* Forms — 16px+ prevents iOS zoom-on-focus; checkboxes/radios keep native sizing */
input:not([type="checkbox"]):not([type="radio"]), textarea, select { font: inherit; font-size: 16px; width: 100%; padding: 0.55rem; margin: 0.25rem 0; border: 1px solid #bbb; border-radius: 6px; background: #fff; }
textarea { min-height: 3.5rem; }

/* Tables: invoice detail, statement grid, warehouse order sheet */
table { border-collapse: collapse; width: 100%; background: #fff; margin: 0.5rem 0; }
th, td { border: 1px solid #ccc; padding: 0.35rem 0.5rem; text-align: left; }
th { background: #f0f0ee; }
tfoot td { font-weight: 700; }
.sheet-table td, .sheet-table th { padding: 0.6rem; }
.qty-big { font-size: 1.5rem; font-weight: 700; text-align: center; }
.table-scroll { overflow-x: auto; }

/* Print: statements and order sheets come out black on white with real borders */
@media print {
  .no-print { display: none !important; }
  .btn, .totalbar, .banner { display: none; } /* default-deny screen chrome */
  body { background: #fff; color: #000; }
  main { max-width: none; padding: 0; }
  .statement, .sheet-table { color: #000; }
  .statement { font-size: 12px; } /* a 9-visit month still fits portrait letter */
  .statement th, .statement td, .sheet-table th, .sheet-table td,
  .table-scroll table th, .table-scroll table td { border: 1px solid #000; }
  th { background: #fff; }
  .row { border-bottom: 1px solid #000; }
}
