:root {
  /* Black and gold, the same in light and dark mode. Green, red and orange keep their meaning. */
  color-scheme: dark;
  --bg: #0a0a0a; --panel: #171717; --text: #f5efe0; --muted: #b5ab92; --line: #3b3421;
  --accent: #d4af37; --on-accent: #0a0a0a;
  --ok: #56d364; --ok-bg: #12301c; --warn: #ff9f43; --warn-bg: #33200a; --bad: #ff7b72; --bad-bg: #3a1614;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.4 -apple-system, system-ui, "Segoe UI", sans-serif;
}
.bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.bar h1 { margin: 0; font-size: 20px; flex: 1; color: var(--accent); }
main { max-width: 560px; margin: 0 auto; padding: 14px 16px calc(env(safe-area-inset-bottom) + 32px); }
h2 { margin: 18px 0 8px; font-size: 15px; color: var(--muted); font-weight: 600; }
.card h2 { margin: 0; }
.card h2.name { font-size: 22px; color: var(--text); }
p { margin: 0; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 10px;
}
.card.center { align-items: center; padding: 40px 14px; }
.warnbox { background: var(--warn-bg); border-color: var(--warn); }

label, .field > span { font-size: 14px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 4px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 17px; color: var(--text); min-height: 40px; }
.check input { width: 22px; height: 22px; }
input:not([type="checkbox"]), select, textarea {
  font: inherit; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); width: 100%;
}
button, label.button {
  font: inherit; font-weight: 600; padding: 12px 14px; border-radius: 10px; border: 0;
  background: var(--accent); color: var(--on-accent); min-height: 48px; text-align: center; display: block; width: 100%;
}
label.button { font-size: 17px; line-height: 24px; cursor: pointer; }
button.secondary, label.button.secondary { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
button.yes { background: var(--ok); color: var(--panel); }
button.no { background: var(--bad); color: var(--panel); }
button.link, a.link {
  background: none; color: var(--accent); font-weight: 400; min-height: 0; padding: 8px 0; width: auto;
  text-align: left; border: 0; text-decoration: underline; font-size: 15px;
}
button.back { background: none; color: var(--accent); width: auto; min-height: 0; padding: 6px 4px; font-weight: 400; }
.actions { display: flex; gap: 10px; margin-bottom: 12px; }
.card .actions { margin-bottom: 0; }
.actions > * { flex: 1; }

.pill { font-size: 13px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--warn); }
.pill.live { color: var(--ok); }
.error { color: var(--bad); min-height: 1.2em; }
.error:empty { display: none; }
.warn { color: var(--warn); font-size: 15px; }
.hint, .empty { color: var(--muted); font-size: 15px; }
.empty { text-align: center; padding: 28px 0; }
.toast { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.big { font-size: 24px; font-weight: 700; }

/* list rows */
.row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
}
.row-main, .row-side { display: flex; flex-direction: column; min-width: 0; }
.row-main { flex: 1; }
.row-main span, .row-side span:last-child { font-size: 14px; color: var(--muted); }
.row-main strong, .row-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { align-items: flex-end; flex-shrink: 0; text-align: right; }
.state { font-size: 15px; font-weight: 600; }
.state.todo { color: var(--accent); }
.state.wait, .state.muted { color: var(--muted); }
.state.waiting { color: var(--warn); }
.state.yes, .state.done { color: var(--ok); }
.state.no { color: var(--bad); }
.footer { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 20px; color: var(--muted); font-size: 15px; }

/* scan and forms */
.choice { text-align: left; background: var(--bg); color: var(--text); border: 1px solid var(--line); font-weight: 400; }
.choice strong { display: block; }
.choice span, .picked span { font-size: 14px; color: var(--muted); display: block; }
.picked { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.segs { display: flex; gap: 6px; }
.seg { flex: 1; background: var(--bg); color: var(--text); border: 1px solid var(--line); padding: 10px 0; }
.seg.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.photo-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; }
.photo-row span { font-size: 16px; color: var(--text); }
label.button.small { width: auto; min-height: 40px; padding: 8px 14px; font-size: 15px; line-height: 22px; }

/* one request */
.photo { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 12px; display: block; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.facts div { display: flex; flex-direction: column; }
.facts span { font-size: 14px; color: var(--muted); }
.note { background: var(--bg); border-radius: 10px; padding: 10px 12px; overflow-wrap: anywhere; }
.banner { border-radius: 14px; padding: 14px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 2px; border: 1px solid; }
.banner span:last-child { font-size: 14px; }
.banner.yes { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.banner.no { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { width: auto; min-height: 36px; padding: 6px 12px; border-radius: 999px; background: var(--bg); color: var(--text); border: 1px solid var(--line); font-weight: 400; font-size: 15px; }
.chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.summary { display: flex; flex-direction: column; }
.summary span:last-child { font-size: 14px; color: var(--muted); }
.sales { list-style: none; margin: 0; padding: 0; }
.sales li { padding: 8px 0; border-top: 1px solid var(--line); }
.sales a { color: inherit; text-decoration: none; display: block; }
.sales .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.sales .top span { font-size: 14px; color: var(--muted); text-align: right; }
.sales .title { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }

/* lots */
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.inline button { width: auto; flex-shrink: 0; }
.gain { color: var(--ok); }
.loss { color: var(--bad); }
