:root {
  --accent: #9e1c1c;
  --accent-dark: #7c1414;
  --ink: #1e1e1e;
  --muted: #666;
  --line: #ddd;
  --bg: #f4f3f0;
  --card: #fff;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.4;
}
.bar {
  background: var(--accent);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
}
.brand { font-weight: 800; letter-spacing: .12em; font-size: 20px; }
.sub { opacity: .85; font-size: 14px; }
main { max-width: 560px; margin: 0 auto; padding: 16px 14px 40px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; color: #333; }
.card > label:first-child { margin-top: 0; }
input[type=text], input[type=email], input[type=date] {
  width: 100%;
  font-size: 17px; /* >=16px prevents iOS zoom on focus */
  padding: 12px;
  border: 1px solid #c9c7c2;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 48px;
  -webkit-appearance: none;
  appearance: none;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.money { display: flex; align-items: center; gap: 8px; }
.money span { font-weight: 700; font-size: 18px; color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.photo-row { display: flex; gap: 10px; }
.photo-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  margin: 0;
  min-height: 88px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.photo-btn.alt { border-color: #999; color: #444; }
.photo-btn .icon { font-size: 26px; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 12px; }
.tile { position: relative; aspect-ratio: 3/4; border-radius: 8px; overflow: hidden; background: #eee; border: 1px solid var(--line); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .doc { display: flex; align-items: center; justify-content: center; height: 100%; font-weight: 800; color: var(--muted); }
.tile .cap { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; text-align: center; padding: 2px; }
.tile .remove {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 18px; line-height: 28px; padding: 0; cursor: pointer;
}
.primary, .secondary {
  display: block; width: 100%; text-align: center; text-decoration: none;
  font-size: 18px; font-weight: 700; padding: 15px; border-radius: var(--radius); border: 0; cursor: pointer;
}
.primary { background: var(--accent); color: #fff; }
.primary:active { background: var(--accent-dark); }
.primary:disabled { opacity: .6; }
.secondary { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.alert { background: #fdecec; border: 1px solid #f2b8b8; color: #7c1414; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; font-size: 15px; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.done h1 { margin: 0 0 10px; font-size: 24px; color: #1f6f2e; }
.done dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; }
.done dt { color: var(--muted); font-size: 14px; }
.done dd { margin: 0; font-weight: 600; }
.ok { color: #1f6f2e; }
.warn { color: #8a5a00; }
.file { color: var(--muted); font-size: 12px; word-break: break-all; }

/* ---- upload / review / done ---- */
main.wide { max-width: 1040px; }
.step { font-size: 18px; margin: 0 0 12px; }
.card .secondary { margin-top: 10px; }
.note { background: #fff7e0; border: 1px solid #ecd48c; color: #6b5200; border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.note p { margin: 4px 0; }
.working { text-align: center; padding: 30px 16px; }
.working p { margin: 12px 0 0; font-weight: 600; }
.spinner { width: 42px; height: 42px; margin: 0 auto; border: 4px solid #e5d4d4; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.review { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
.receipt-view { padding: 10px; text-align: center; }
.receipt-view img { display: block; width: 100%; max-height: 46vh; object-fit: contain; border-radius: 6px; background: #eee; }
@media (min-width: 820px) {
  .review { grid-template-columns: 1.1fr 1fr; }
  .receipt-view { position: sticky; top: 12px; }
  .receipt-view img { max-height: calc(100vh - 90px); }
}

/* ---- searchable GL picker ---- */
.combo { position: relative; }
.combo-input {
  width: 100%; font-size: 17px; padding: 12px; min-height: 48px; border: 1px solid #c9c7c2; border-radius: 8px;
  background: #fff; color: var(--ink); -webkit-appearance: none; appearance: none;
}
.combo-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.combo.chosen .combo-input { font-weight: 700; background: #f6fbf6; border-color: #9cc59f; }
.combo-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px 0; list-style: none;
  max-height: 50vh; overflow-y: auto; background: #fff; border: 1px solid #c9c7c2; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15); -webkit-overflow-scrolling: touch;
}
.combo-opt { padding: 10px 12px; cursor: pointer; font-size: 15px; border-bottom: 1px solid #f0efec; }
.combo-opt b { display: inline-block; min-width: 3.2em; color: var(--accent); }
.combo-opt.active, .combo-opt:hover { background: #f6eaea; }
.combo-sub { color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-group { padding: 8px 12px 4px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: #faf9f7; }
.combo-empty { padding: 12px; color: var(--muted); }
select { width: 100%; font-size: 17px; padding: 12px; min-height: 48px; border-radius: 8px; border: 1px solid #c9c7c2; background: #fff; }
.review > * { min-width: 0; }
