/* Built for a phone held outdoors: large text, strong contrast, big targets. */
:root {
  --green: #1f5d3a;
  --green-dark: #154329;
  --bg: #f4f1e8;
  --card: #ffffff;
  --ink: #17201a;
  --muted: #55605a;
  --line: #d5d0c1;
  --warn-bg: #fff1c9;
  --warn-ink: #5c4300;
  --bad: #a3261d;
  --bad-bg: #fde4e1;
  --ok-bg: #dff1e3;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.splash { padding: 40vh 16px 0; text-align: center; color: var(--muted); }

header.top {
  background: var(--green);
  color: #fff;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  position: sticky;
  top: 0;
  z-index: 5;
}
header.top h1 { margin: 0; font-size: 1.3rem; line-height: 1.2; }
header.top .back { color: #fff; text-decoration: none; font-size: 1.05rem; display: inline-block; padding: 4px 12px 8px 0; }

main { padding: 16px; display: flex; flex-direction: column; gap: 16px; }

h2 { margin: 0 0 8px; font-size: 1.1rem; }
h2.section { margin: 8px 0 -4px; color: var(--muted); font-size: 1rem; text-transform: uppercase; letter-spacing: 0.04em; }
p { margin: 0 0 8px; }
.lead { text-align: center; color: var(--muted); margin: 8px 0 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card.slim { padding: 12px 16px; }
.card.voided { opacity: 0.75; }
details.card > summary, details.field > summary { font-weight: 600; cursor: pointer; padding: 6px 0; min-height: 44px; display: flex; align-items: center; }
details.field { border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px 12px; }
details.field:not([open]) { padding-bottom: 4px; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

.headline { font-size: 1.5rem; font-weight: 700; color: var(--green-dark); margin: 0 0 4px; line-height: 1.25; }

.line { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.line span { color: var(--muted); }
.line span small { display: block; font-size: 0.8rem; }
.line strong { text-align: right; overflow-wrap: anywhere; }
.line.strong strong { color: var(--bad); }

.note { color: var(--muted); font-size: 0.85rem; margin: 0; }
.note.centre { text-align: center; }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: -6px; }

/* ---------- buttons ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 10px 18px;
  border: 2px solid var(--green);
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
}
.btn:active { background: var(--green-dark); }
.btn.big { min-height: 68px; font-size: 1.15rem; }
.btn.secondary { background: #fff; color: var(--green-dark); }
.btn.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
.btn:disabled { opacity: 0.6; }
.link { background: none; border: 0; padding: 10px 6px; color: var(--green-dark); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .chip-title { font-weight: 600; }
.field small { color: var(--muted); font-size: 0.85rem; }
.input {
  width: 100%;
  min-height: 54px;
  padding: 10px 12px;
  border: 2px solid #8b948e;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1.1rem;
  -webkit-appearance: none;
  appearance: none;
}
select.input {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 15px) 50%;
  background-size: 7px 7px;
  background-repeat: no-repeat;
  padding-right: 40px;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: 3px solid #8cc3a2; border-color: var(--green); }
input[type="date"].input { min-width: 0; }

.stepper { display: flex; gap: 10px; align-items: stretch; }
.stepper .input.hours { text-align: center; font-size: 1.6rem; font-weight: 700; min-height: 68px; }
.btn.step { width: 76px; flex: none; min-height: 68px; font-size: 2rem; line-height: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 48px;
  padding: 8px 16px;
  border: 2px solid #8b948e;
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.chip.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.chip-title { margin: 8px 0 6px; }

.check { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 600; }
.check input { width: 28px; height: 28px; accent-color: var(--green); flex: none; }

.file { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.file.retired > span:first-child { color: var(--muted); text-decoration: line-through; }
.person { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.person:first-child { border-top: 0; padding-top: 0; }

.errors { color: var(--bad); font-weight: 600; }
.errors p { margin: 0 0 4px; }

/* ---------- status ---------- */
.status { display: block; padding: 10px 16px; font-size: 0.95rem; font-weight: 600; text-decoration: none; }
.status.warn { background: var(--warn-bg); color: var(--warn-ink); }
.status.bad { background: var(--bad-bg); color: var(--bad); }
.status.demo { background: #e3e8ff; color: #23307a; }
.status.inline { border-radius: 10px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; background: #e9e6da; font-size: 0.8rem; font-weight: 600; align-self: flex-start; }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.ok { background: var(--ok-bg); color: var(--green-dark); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* ---------- history ---------- */
.entry {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
}
.entry-main { min-width: 0; }
.entry-title { font-weight: 600; overflow-wrap: anywhere; }
.entry-amount { font-weight: 700; white-space: nowrap; }
.entry.voided .entry-title, .entry.voided .entry-amount { text-decoration: line-through; color: var(--muted); }

.hist { border-top: 1px solid var(--line); padding: 8px 0; display: flex; flex-direction: column; }
.change { font-size: 0.9rem; overflow-wrap: anywhere; }

/* ---------- bottom tabs ---------- */
nav.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 5;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}
.tab-icon { font-size: 1.4rem; line-height: 1.1; }
.tab.on { color: var(--green-dark); box-shadow: inset 0 3px 0 var(--green); }

/* ---------- pop-ups ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; z-index: 20; }
.modal { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 14px; }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  max-width: 608px;
  margin: 0 auto;
  background: var(--ink);
  color: #fff;
  padding: 14px 16px;
  border-radius: 12px;
  font-weight: 600;
  text-align: center;
  z-index: 30;
}
.toast.bad { background: var(--bad); }
