/* LB-31 web app styles: mobile-first (5-inch phone, 360 px wide), large tap targets (>= 48 px),
   high contrast, no external fonts or assets. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #111;
  background: #f4f5f2;
}
h1 { font-size: 1.4rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.5rem; }
.small { font-size: 0.85rem; }
.loading { padding: 1rem; color: #555; }
.hint { color: #555; font-size: 0.9rem; margin: 0.25rem 0; }
.hint-warn { color: #8a4b00; }
.field-error { color: #b00020; min-height: 1.2em; font-size: 0.9rem; }

.topbar { background: #14532d; color: #fff; padding: 0.4rem 0.6rem; position: sticky; top: 0; z-index: 5; }
.topbar-row { display: flex; align-items: center; gap: 0.5rem; min-height: 2rem; }
.topbar-row.small { min-height: 1.2rem; justify-content: space-between; }
.brand { font-weight: 700; flex: 1; }
.who { font-size: 0.85rem; opacity: 0.9; }
.nav { display: flex; gap: 0.75rem; padding: 0.2rem 0; overflow-x: auto; }
.nav a { color: #fff; text-decoration: none; padding: 0.4rem 0.2rem; }
.nav a.active { border-bottom: 2px solid #fff; }
.status { font-size: 0.8rem; }
.status-warn, .status-error { color: #ffd27a; font-weight: 600; }
.net-off { color: #ffd27a; font-weight: 600; font-size: 0.8rem; }

.page { padding: 0.6rem; max-width: 720px; margin: 0 auto; padding-bottom: 7rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; min-width: 48px; padding: 0 1rem;
  font: inherit; font-weight: 600; color: #14532d;
  background: #fff; border: 2px solid #14532d; border-radius: 10px;
  text-decoration: none; cursor: pointer; touch-action: manipulation; user-select: none;
}
.btn:disabled, .btn.disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: #14532d; color: #fff; }
.btn-danger { border-color: #b00020; color: #b00020; }
.btn-small { min-height: 40px; min-width: 40px; padding: 0 0.6rem; font-size: 0.9rem; }
.btn-link { border: none; background: none; text-decoration: underline; padding: 0 0.25rem; min-height: 44px; }
.btn-big { width: 100%; min-height: 56px; font-size: 1.05rem; }
.topbar .btn-small { color: #14532d; }

.banner { border-radius: 10px; padding: 0.6rem 0.7rem; margin: 0 0 0.5rem; border-left: 6px solid; background: #fff; }
.banner-info { border-color: #2563eb; }
.banner-success { border-color: #15803d; background: #effbf2; }
.banner-warn { border-color: #d97706; background: #fff8eb; }
.banner-error { border-color: #b00020; background: #fdecee; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.banner ul { margin: 0.3rem 0; padding-left: 1.2rem; }

.daybar { margin-bottom: 0.5rem; }
.daybar-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; flex-wrap: wrap; }
.daybar-date { flex: 1; text-align: center; }
.tag { display: inline-block; margin-left: 0.4rem; font-size: 0.75rem; padding: 0.1rem 0.4rem; border-radius: 6px; background: #dcfce7; }
.tag-warn { background: #fde68a; }
.date-input { font: inherit; min-height: 40px; padding: 0 0.4rem; }
.link { margin-right: 0.5rem; color: #14532d; }

.searchbar { position: sticky; top: var(--topbar-h, 4.6rem); z-index: 4; background: #f4f5f2; padding: 0.3rem 0; }
.search {
  width: 100%; min-height: 56px; font-size: 1.25rem; padding: 0 0.8rem;
  border: 2px solid #14532d; border-radius: 10px; background: #fff;
}
.results { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.3rem; }
.result {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; min-height: 52px; padding: 0 0.7rem;
  font: inherit; text-align: left; background: #fff; border: 1px solid #bbb; border-radius: 10px; cursor: pointer;
}
.result .num, .dish .num { font-weight: 700; min-width: 3.5rem; }
.result .name { flex: 1; }
.result .add { font-weight: 700; color: #14532d; }
.result-none { padding: 0.5rem; color: #8a4b00; }

.lines { margin: 0.5rem 0; }
.empty { color: #666; text-align: center; padding: 1rem 0; }
.dish { background: #fff; border-radius: 10px; padding: 0.5rem 0.6rem; margin-bottom: 0.45rem; border: 1px solid #ddd; }
.dish-head { display: flex; gap: 0.4rem; align-items: baseline; }
.dish-head .name { flex: 1; font-size: 0.95rem; }
.dish-total { font-weight: 700; }
.line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem; padding: 0.25rem 0; }
.line + .line { border-top: 1px dashed #ccc; }
.options { flex: 1 1 100%; display: flex; flex-direction: column; gap: 0.3rem; }
.option-select { font: inherit; min-height: 44px; border-radius: 8px; border: 1px solid #999; background: #fff; }
.stepper { display: flex; align-items: center; gap: 0.3rem; margin-left: auto; }
.step { font-size: 1.5rem; min-width: 52px; min-height: 52px; padding: 0; }
.qty-input { width: 4.2rem; min-height: 52px; font-size: 1.3rem; text-align: center; border: 2px solid #999; border-radius: 10px; }

.menu .cat summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.menu .result { margin-bottom: 0.3rem; }

.footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.6rem calc(0.5rem + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #ccc;
}
.footer-totals { flex: 1; font-weight: 600; }
.footer .reason { flex: 1 1 100%; }
.footer .btn-big { flex: 1 1 100%; }

.card { background: #fff; border-radius: 10px; padding: 0.7rem; margin-bottom: 0.6rem; border: 1px solid #ddd; }
.card summary { font-weight: 600; min-height: 40px; cursor: pointer; }
.big { font-size: 1.15rem; font-weight: 600; }
.confirmed { border-left: 6px solid #15803d; }
.deductions { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.deductions th, .deductions td { padding: 0.35rem 0.2rem; border-bottom: 1px solid #eee; text-align: left; }
.deductions .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.reason { width: 100%; font: inherit; padding: 0.5rem; border: 2px solid #999; border-radius: 10px; }

.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 0.8rem; }
.dialog { background: #fff; border-radius: 12px; padding: 1rem; width: 100%; max-width: 480px; }
.dialog-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; margin-top: 0.8rem; }
.dialog label { display: block; margin-top: 0.5rem; }

.signin .user-list { display: flex; flex-direction: column; gap: 0.6rem; }
.btn-user { width: 100%; min-height: 60px; font-size: 1.15rem; }
.pin-label { display: block; margin-bottom: 0.6rem; }
.pin-input { display: block; width: 100%; min-height: 56px; font-size: 1.6rem; letter-spacing: 0.4rem; text-align: center; border: 2px solid #14532d; border-radius: 10px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-bottom: 0.8rem; }
.key { min-height: 60px; font-size: 1.4rem; }

/* LB-32 owner admin + ledger browser */
.admin-body, .admin-body + *, .page { overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; max-width: 100%; }
.deductions td { overflow-wrap: anywhere; }
.subnav { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; margin-bottom: 0.6rem; }
.subnav a { color: #14532d; padding: 0.35rem 0.1rem; min-height: 40px; display: inline-flex; align-items: center; }
.subnav a.active { font-weight: 700; border-bottom: 2px solid #14532d; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.5rem; margin-bottom: 1rem; }
.tile { min-height: 56px; }
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.list-tools .search { flex: 1 1 100%; min-height: 48px; font-size: 1.05rem; }
.rows { display: flex; flex-direction: column; gap: 0.3rem; }
.row-link { text-decoration: none; color: inherit; flex-wrap: wrap; }
.row-link .n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.plain-list { padding-left: 1.1rem; margin: 0.3rem 0; }
ol.plain-list { padding-left: 1.8rem; }
.plain-list li { margin: 0.25rem 0; }
.plain-list li.current { font-weight: 700; }
.form { display: flex; flex-direction: column; gap: 0.55rem; }
.field-label { display: block; font-weight: 600; font-size: 0.95rem; }
.field-row { display: flex; align-items: center; gap: 0.4rem; }
.field-input { font: inherit; width: 100%; min-height: 44px; padding: 0.3rem 0.5rem; border: 2px solid #999; border-radius: 8px; background: #fff; }
textarea.field-input { min-height: 3.2rem; }
.field-check { width: 28px; height: 28px; flex: none; }
.field-bool .field-label { font-weight: 400; }
.unit { color: #555; min-width: 1.5rem; }
.req { color: #b00020; }
.form-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.children h3 { font-size: 1rem; margin: 0.6rem 0 0.3rem; }
.child-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; padding: 0.35rem 0; border-bottom: 1px dashed #ccc; }
.child-row .form { flex: 1 1 100%; }
.child-summary { flex: 1; display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: baseline; }
.qty { font-variant-numeric: tabular-nums; }
.qty.pending { color: #8a4b00; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { display: inline-flex; align-items: center; gap: 0.25rem; min-height: 40px; padding: 0 0.5rem; border: 1px solid #999; border-radius: 8px; background: #fff; }
.setting h3 { display: flex; align-items: center; gap: 0.4rem; font-size: 1rem; margin: 0 0 0.3rem; word-break: break-all; }
.audit { border-bottom: 1px solid #e3e3e3; padding: 0.45rem 0; }
.audit-head { display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; font-size: 0.9rem; }
.audit-head .who { font-weight: 600; }
.audit-head .name { font-style: italic; }
.audit-changes { margin: 0.2rem 0 0; padding-left: 1.1rem; font-size: 0.9rem; word-break: break-word; }
.audit-changes .col { color: #555; }

/* LB-45 upload receipt page */
.file-input { display: none; }
.upload-actions { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.5rem 0; }
.photos { list-style: none; margin: 0.5rem 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.photo { display: flex; gap: 0.6rem; align-items: flex-start; background: #fff; border: 1px solid #ddd; border-radius: 10px; padding: 0.5rem; }
.photo-refused { border: 2px solid #b00020; }
.thumb { width: 96px; height: 128px; object-fit: cover; border-radius: 6px; background: #eee; flex: none; }
.photo-info { flex: 1; min-width: 0; }
.photo-buttons { display: flex; gap: 0.4rem; margin-top: 0.4rem; flex-wrap: wrap; }
.history { margin: 0.3rem 0; padding-left: 1.1rem; }
.history li { margin-bottom: 0.3rem; }
/* LB-51 count page */
.check { display: flex; align-items: center; gap: 0.4rem; min-height: 44px; }
.check input { width: 1.4rem; height: 1.4rem; }
.editor { padding: 0.4rem 0.2rem 0.2rem; display: flex; flex-direction: column; gap: 0.3rem; }
.weight-label { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.qty-input.weight { width: 9rem; }
.chips:has(> .tag) { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.3rem 0; } /* LB-51 reading tags (scoped: LB-32 .chips keep their own gap) */
.tag-old { background: #e5e7eb; }
.footer-spacer { height: 9rem; }
.deductions.variance { font-size: 0.85rem; }
.deductions.variance td, .deductions.variance th { padding: 0.35rem 0.15rem; }
.deductions.variance .tag { margin-left: 0; display: inline-block; }
/* LB-50 review queue: long receipt wording / item names never widen the page (5-inch phones) */
.review { overflow-wrap: anywhere; }
.review select, .review input[type="text"], .review input[type="date"], .review textarea { width: 100%; max-width: 100%; min-height: 48px; font-size: 1rem; }
.review .result { min-height: 60px; text-decoration: none; color: inherit; }
