:root {
  --canopy: #2a362a;
  --turf: #1f2a1f;
  --leaf: #4f7a3a;
  --leaf-soft: #e3ecd9;
  --gold: #c9a24a;
  --bg: #f3f1ea;
  --card: #ffffff;
  --text: #1d231c;
  --muted: #66705f;
  --line: #d9dccf;
  --danger: #a33a2a;
  --radius: 14px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

/* ---------- Header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--canopy);
  color: #fff;
}
.logo { width: 36px; height: 36px; }
.brand { display: flex; flex-direction: column; line-height: 1.1; flex: 1; }
.brand strong { font-size: 1.15rem; letter-spacing: .02em; }
.brand span { font-size: .8rem; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; }

.qb-pill {
  border: 1px solid rgba(255, 255, 255, .35);
  background: transparent;
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .8rem;
}
.qb-pill::before { content: "●"; margin-right: 6px; color: #999; }
.qb-pill[data-state="on"]::before { color: #7fd36b; }
.qb-pill[data-state="off"]::before { color: #e0a43c; }

/* ---------- Layout ---------- */
main { max-width: 640px; margin: 0 auto; padding: 12px 12px 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 16px;
  margin: 0 0 12px;
  min-width: 0;
}
fieldset.card { padding-top: 6px; }
legend, .card h3 {
  font-weight: 700;
  font-size: 1rem;
  color: var(--canopy);
  margin: 0 0 6px;
}
legend { float: left; width: 100%; padding: 8px 0 4px; }
legend + * { clear: left; }

label { display: block; font-size: .85rem; color: var(--muted); margin-top: 10px; }
label.short { max-width: 200px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row label { min-width: 0; }

input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 12px;
  font: inherit;
  color: var(--text);
  background: #fbfbf8;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 46px;
}
input:focus { outline: 2px solid var(--leaf); outline-offset: 1px; border-color: transparent; }
input[type="checkbox"] { display: inline; width: 22px; min-height: 0; height: 22px; margin: 0 8px 0 0; vertical-align: middle; accent-color: var(--leaf); }
label.check { color: var(--text); font-size: .95rem; margin-top: 14px; }

.hint { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
.sub { display: block; font-size: .85rem; color: var(--muted); margin: 12px 0 6px; }
.center { text-align: center; display: block; margin-left: auto; margin-right: auto; }

/* ---------- Buttons ---------- */
button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 12px 16px;
  min-height: 46px;
  cursor: pointer;
}
button.primary { background: var(--leaf); border-color: var(--leaf); color: #fff; font-weight: 600; }
button.big { width: 100%; padding: 16px; font-size: 1.1rem; margin: 4px 0 8px; }
button.small { min-height: 34px; padding: 6px 12px; font-size: .85rem; }
button.link { background: none; border: 0; color: var(--leaf); text-decoration: underline; min-height: 40px; padding: 8px; }
button:disabled { opacity: .55; }
.actions { display: grid; gap: 10px; }
.card > button:not(.link) { width: 100%; margin-top: 12px; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: .95rem;
  text-align: left;
}
.chip small { display: block; font-size: .7rem; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--leaf-soft); border-color: var(--leaf); color: var(--turf); font-weight: 600; }
.chip[aria-pressed="true"]::before { content: "✓ "; color: var(--leaf); }
.mat-group + .mat-group { margin-top: 4px; }

/* ---------- Customer search ---------- */
.search { position: relative; margin-top: 4px; }
.results {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}
.results li button {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.results li:last-child button { border-bottom: 0; }
.results small, .history small { display: block; color: var(--muted); font-size: .8rem; }
.tag { font-size: .7rem; color: var(--leaf); text-transform: uppercase; letter-spacing: .05em; }

.weather-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.weather-line .hint { margin: 0; }
.warn { color: var(--danger); font-weight: 600; }

/* ---------- Done ---------- */
.done-head h2 { margin: 2px 0 0; }
.saved { margin: 0; color: var(--leaf); font-weight: 700; }
.saved.pending { color: #a8761f; }
.ok { color: var(--leaf); font-weight: 600; }

/* ---------- History ---------- */
.history { list-style: none; margin: 0; padding: 0; }
.history li button {
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  background: #fff;
  border-radius: var(--radius);
}

/* ---------- Bottom tabs ---------- */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--turf);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.tabs button {
  border: 0;
  border-radius: 0;
  background: none;
  color: #c9d2c3;
  min-height: 60px;
  font-size: .9rem;
}
.tabs button[aria-current="page"] { color: #fff; box-shadow: inset 0 3px 0 var(--gold); font-weight: 600; }

.toast {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 20;
  background: var(--turf);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.toast.error { background: var(--danger); }
