/* Bid app. Built for a phone held in one hand, outdoors: large type, large buttons, strong contrast. */

:root {
  --paper: #f3f1ec;
  --card: #ffffff;
  --ink: #1b2326;
  --muted: #56636a;
  --rule: #d9d5cb;
  --bar: #1f2a2e;
  --bar-ink: #f4f1ea;
  --accent-bg: #b8440b;
  --accent-text: #a33c09;
  --focus: #f3b48c;

  --ok: #166b36;       --ok-soft: #daf3e2;
  --wait: #8a4b00;     --wait-soft: #fcefcc;
  --info: #1c47c4;     --info-soft: #e0e9fd;
  --bad: #a8221a;      --bad-soft: #fde6e2;
  --paid: #48525c;     --paid-soft: #e6e9ed;
  --draft: #5b41ad;    --draft-soft: #ece7fb;
  --queued: #075f8f;   --queued-soft: #dcf0fa;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 28, 32, .06), 0 2px 8px rgba(20, 28, 32, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14191b;
    --card: #1e2528;
    --ink: #edeae3;
    --muted: #a5afb3;
    --rule: #363f43;
    --bar: #0e1315;
    --bar-ink: #f4f1ea;
    --accent-text: #f29a66;
    --focus: #8f4a22;

    --ok: #6ed596;       --ok-soft: #173a26;
    --wait: #f3b755;     --wait-soft: #3f2f0e;
    --info: #96b4ff;     --info-soft: #1b2a52;
    --bad: #ff9084;      --bad-soft: #4a1c18;
    --paid: #b7bec6;     --paid-soft: #2b3237;
    --draft: #bba8f6;    --draft-soft: #2e2551;
    --queued: #7cc8ee;   --queued-soft: #10344a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.42 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

.app { max-width: 640px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
.boot { padding: 48px 16px; text-align: center; color: var(--muted); }
.gone { display: none !important; }
.offscreen { position: fixed; left: -9999px; top: 0; }

a { color: var(--accent-text); }
h1, h2, h3, p { margin: 0; }

/* ---------------------------------------------------------------- top bar */

.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px 14px;
  background: var(--bar); color: var(--bar-ink);
}
.bar-title { flex: 1; min-width: 0; font-size: 19px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.bar-btn { flex: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: inherit; border-radius: 10px; margin-left: -8px; }
.bar-title + .pill { margin-left: 4px; }
.pill + .bar-btn { margin-left: 0; margin-right: -4px; }

.pill {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 6px 12px; border-radius: 999px;
  font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap;
  background: rgba(255, 255, 255, .13); color: #fff;
}
.pill-ok { color: #a9ecc0; }
.pill-wait { background: #f6c75a; color: #33230a; }
.pill-busy { background: #8ec9ee; color: #06283b; }
.pill-bad { background: #f08a7e; color: #3b0b07; }
.pill-off { background: rgba(255, 255, 255, .2); color: #fff; }

.practice { background: #4a3a8c; color: #fff; font-size: 14px; font-weight: 600; text-align: center; padding: 6px 14px; }

.update {
  position: fixed; left: 0; right: 0; top: 0; z-index: 70;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px; background: var(--accent-bg); color: #fff; font-weight: 650;
}
.update .btn { min-height: 40px; }

main { padding: 14px 14px 8px; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 10px 16px;
  border: 1.5px solid var(--rule); border-radius: 10px;
  background: var(--card); color: var(--ink);
  font: inherit; font-weight: 650; text-decoration: none; text-align: center; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; }
.btn.primary { background: var(--accent-bg); border-color: var(--accent-bg); color: #fff; }
.btn.danger { background: #a8221a; border-color: #a8221a; color: #fff; }
.btn.danger-text { background: transparent; border-color: transparent; color: var(--bad); }
.btn.big { min-height: 58px; font-size: 19px; font-weight: 750; }
.btn.wide { width: 100%; }

.link { background: none; border: 0; padding: 6px 4px; min-height: 36px; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

.fab {
  position: fixed; z-index: 15; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 210px; height: 60px; padding: 0 26px;
  border: 0; border-radius: 999px; background: var(--accent-bg); color: #fff;
  font: inherit; font-size: 19px; font-weight: 750; cursor: pointer;
  box-shadow: 0 6px 18px rgba(120, 44, 6, .35), 0 2px 4px rgba(0, 0, 0, .18);
}
.fab:active { transform: translateX(-50%) translateY(1px); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------------------------------------------------------------- home list */

.filter { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.filter label { color: var(--muted); font-weight: 650; }
.filter select { flex: 1; }

.group { margin-top: 20px; }
.group > h2, .group > summary {
  display: flex; align-items: center; gap: 8px;
  margin: 0 2px 8px; font-size: 15px; font-weight: 750; color: var(--muted);
}
.group > summary { list-style: none; cursor: pointer; min-height: 44px; margin-bottom: 0; }
.group > summary::-webkit-details-marker { display: none; }
.group > summary::after { content: ""; width: 9px; height: 9px; margin-left: auto; margin-right: 6px; border-right: 2.5px solid var(--muted); border-bottom: 2.5px solid var(--muted); transform: rotate(45deg) translateY(-3px); }
.group[open] > summary::after { transform: rotate(-135deg) translateX(-3px); }
.group[open] > summary { margin-bottom: 8px; }
.group-sum { margin-left: auto; color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.group > summary .group-sum { margin-left: 0; }
.count { min-width: 24px; padding: 1px 8px; border-radius: 999px; background: var(--rule); color: var(--ink); font-size: 13px; font-weight: 750; text-align: center; }

.st-draft { --st: var(--draft); }
.st-queued { --st: var(--queued); }
.st-waiting { --st: var(--wait); }
.st-approved { --st: var(--info); }
.st-done { --st: var(--ok); }
.st-paid { --st: var(--paid); }
.st-closed { --st: var(--bad); }

.card {
  display: block; margin-bottom: 10px; padding: 12px 14px 12px 12px;
  background: var(--card); color: inherit; text-decoration: none;
  border: 1px solid var(--rule); border-left: 6px solid var(--st, var(--rule)); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.st-draft.card { border-style: dashed; border-left-style: solid; }
.card-top { display: flex; align-items: baseline; gap: 8px; }
.card-q { flex: none; font-weight: 800; font-variant-numeric: tabular-nums; }
.card-where { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-amt { flex: none; font-weight: 800; font-variant-numeric: tabular-nums; }
.card-detail { margin: 6px 0 9px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }

.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13.5px; font-weight: 750; }
.chip-draft { background: var(--draft-soft); color: var(--draft); }
.chip-queued { background: var(--queued-soft); color: var(--queued); }
.chip-waiting { background: var(--wait-soft); color: var(--wait); }
.chip-approved { background: var(--info-soft); color: var(--info); }
.chip-done { background: var(--ok-soft); color: var(--ok); }
.chip-paid { background: var(--paid-soft); color: var(--paid); }
.chip-closed { background: var(--bad-soft); color: var(--bad); }
.meta { color: var(--muted); font-size: 14px; }
.meta-bad { color: var(--bad); font-weight: 700; }

.empty { padding: 56px 16px 24px; text-align: center; }
.empty p { margin-bottom: 10px; }

.hint { margin: 6px 2px; color: var(--muted); font-size: 14.5px; }
.error { margin: 6px 2px; color: var(--bad); font-size: 15px; font-weight: 700; }

.notice { margin: 12px 0; padding: 10px 12px; border-left: 4px solid var(--info); border-radius: 8px; background: var(--info-soft); font-size: 15.5px; overflow-wrap: anywhere; }
.notice-warn { border-left-color: var(--wait); background: var(--wait-soft); }
.notice-bad { border-left-color: var(--bad); background: var(--bad-soft); }

/* ---------------------------------------------------------------- forms */

.field { display: block; margin-top: 18px; }
.field > span { display: block; margin: 0 2px 6px; font-weight: 700; }
input[type="text"], input[type="date"], select, textarea {
  width: 100%; min-height: 52px; padding: 12px;
  border: 1.5px solid var(--rule); border-radius: 10px;
  background: var(--card); color: var(--ink);
  font: inherit; font-size: 17px;
}
textarea { display: block; resize: none; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--accent-bg); }
::placeholder { color: var(--muted); opacity: .75; }

.money { position: relative; display: block; }
.money-sign { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-weight: 800; font-size: 20px; color: var(--muted); pointer-events: none; }
.money input { padding-left: 34px; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

.chips { display: flex; gap: 8px; margin: 8px -14px 0; padding: 0 14px 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.pick { flex: none; min-height: 42px; padding: 8px 14px; border: 1.5px solid var(--rule); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: 15.5px; font-weight: 600; cursor: pointer; }
.pick.on { background: var(--ink); border-color: var(--ink); color: var(--card); }

.actions { display: grid; gap: 10px; margin: 22px 0 8px; }
.home .btn.wide, .panel .btn.wide { margin-top: 10px; }

.check { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 650; }
.check input { width: 24px; height: 24px; accent-color: var(--accent-bg); }

/* ---------------------------------------------------------------- pictures */

.pics { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--rule); }
.pics-head { display: flex; align-items: center; gap: 8px; }
.pics-head h3 { font-size: 17px; font-weight: 750; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 2px; }
.thumb { position: relative; aspect-ratio: 1 / 1; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--rule); cursor: pointer; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb img:not([src]) { visibility: hidden; }
.tag { position: absolute; right: 5px; bottom: 5px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.tag-ok { background: #166b36; }
.tag-wait { background: #8a4b00; }
.tag-bad { background: #a8221a; }
.pics-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.pics-buttons .btn { flex-direction: column; gap: 4px; min-height: 68px; padding: 10px 6px; font-size: 15.5px; }
.preview { display: block; width: 100%; max-height: 62vh; object-fit: contain; border-radius: 10px; background: #000; }

/* ---------------------------------------------------------------- one bid */

.sheet { padding: 14px; background: var(--card); border: 1px solid var(--rule); border-top: 6px solid var(--st, var(--rule)); border-radius: var(--radius); box-shadow: var(--shadow); }
.sheet-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-where { font-size: 19px; font-weight: 750; overflow-wrap: anywhere; }
.sheet-cat { color: var(--muted); }
.sheet-amt { flex: none; font-size: 27px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.sheet-detail { margin: 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.sheet-mat { margin-top: 10px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.sheet-mat span { font-weight: 750; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 16px 0 0; padding: 12px 0 0; border-top: 1px solid var(--rule); list-style: none; }
.step { color: var(--muted); font-size: 13px; text-align: center; }
.step-dot { width: 28px; height: 28px; margin: 0 auto 4px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--rule); border-radius: 50%; color: #fff; }
.step-on .step-dot { background: #166b36; border-color: #166b36; }
.step-on { color: var(--ink); }
.step-name { display: block; font-weight: 700; }
.step-date { display: block; font-variant-numeric: tabular-nums; }
div.steps { display: block; }
.step-bad { color: var(--bad); font-size: 15.5px; font-weight: 700; text-align: left; }

.drive { margin: 20px 2px 0; color: var(--muted); font-size: 14.5px; }

/* ---------------------------------------------------------------- sending, settings, setup */

.big { margin-bottom: 14px; padding: 16px; background: var(--card); border: 1px solid var(--rule); border-left: 6px solid var(--paid); border-radius: var(--radius); }
.big-ok { border-left-color: var(--ok); }
.big-wait, .big-off { border-left-color: var(--wait); }
.big-busy { border-left-color: var(--queued); }
.big-bad { border-left-color: var(--bad); }
.big-title { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.big-sub { margin-top: 6px; color: var(--muted); font-size: 15px; }

.op { margin-bottom: 8px; padding: 12px 14px; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; }
.op-bad { border-left: 6px solid var(--bad); }
.op-text { font-weight: 650; overflow-wrap: anywhere; }
.op-error { margin-top: 4px; color: var(--bad); font-size: 15px; }
.op-buttons { display: flex; gap: 10px; margin-top: 10px; }
.op-buttons .btn { min-height: 44px; }

.panel { margin-bottom: 14px; padding: 16px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); }
.panel h2 { font-size: 18px; font-weight: 750; }
.panel .field { margin-top: 12px; }

.setup { padding: 22px 16px; }
.setup .btn { margin-top: 16px; }
.or { display: flex; align-items: center; gap: 12px; margin: 22px 0 6px; color: var(--muted); font-weight: 650; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* ---------------------------------------------------------------- questions and short messages */

.veil { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); background: rgba(12, 17, 19, .58); }
.dialog { width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; padding: 18px; background: var(--card); border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
.dialog h2 { margin-bottom: 8px; font-size: 20px; font-weight: 800; }
.dialog-body p { margin-bottom: 8px; }
.dialog-buttons { display: grid; gap: 10px; margin-top: 16px; }
.points { margin: 4px 0; padding-left: 20px; }
.points li { margin-bottom: 8px; }
.copy { margin: 0; padding: 10px; border-radius: 8px; background: var(--paper); font: 14px/1.4 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (min-width: 560px) { .veil { align-items: center; } }

/* Short messages sit under the top bar, clear of the buttons at the bottom of the screen. */
#toasts { position: fixed; z-index: 60; left: 0; right: 0; top: calc(68px + env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { max-width: 90%; padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 15px; font-weight: 650; text-align: center; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); transition: opacity .4s; }
.toast-bad { background: #a8221a; color: #fff; }
.toast-out { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
  .btn:active, .fab:active { transform: none; }
  .fab:active { transform: translateX(-50%); }
}
