:root {
  --wood: #6b4423;
  --wood-dark: #4a2f18;
  --cream: #faf6ef;
  --accent: #b5652d;
  --green: #4c7a3d;
  --amber: #c98a1e;
  --red: #b03a2e;
  --gray: #8a8378;
  --ink: #2b2621;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--cream);
  color: var(--ink);
  padding: 16px;
  padding-bottom: 60px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

h1 {
  font-size: 22px;
  margin: 0;
  color: var(--wood-dark);
}

/* `.button` (not `a.button`) on purpose: tool.html's "Upload PDF" is a
   <label> wrapping a hidden file input, so it needs the button look
   without being an <a> or a <button>. */
.button, button {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}

.button.secondary, button.secondary {
  background: var(--gray);
}

.card {
  background: white;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* v1.6: the tool row IS the link now — one tap target, one line, with a
   right-aligned status pill. It used to be a card wrapping an <a>, which
   at 100 tools was 100 cards of padding. */
.tool-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 9px 2px;
  border-bottom: 1px solid #efe9df;
  color: var(--ink);
  text-decoration: none;
}
.tool-row:last-child { border-bottom: none; }
.tool-row .nm { flex: 1; font-weight: 600; font-size: 15px; }
.tool-row .nm em {
  display: block;
  font-style: normal;
  font-weight: 400;
  font-size: 12px;
  color: var(--gray);
}

.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  color: white;
  white-space: nowrap;
}

.badge.in-shop { background: var(--green); }
.badge.in-truck { background: var(--amber); }
.badge.loaned-out { background: #3a6ea5; }
.badge.needs-repair { background: var(--red); }

label {
  display: block;
  font-weight: 600;
  margin: 14px 0 6px;
  font-size: 14px;
}

input, select, textarea {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-family: inherit;
}

textarea { resize: vertical; min-height: 70px; }

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.status-grid button {
  background: white;
  color: var(--ink);
  border: 2px solid #ddd;
  font-size: 14px;
  padding: 12px 6px;
}

.status-grid button.active {
  border-color: var(--accent);
  background: #fdf1e7;
}

.muted { color: var(--gray); font-size: 14px; }
.empty-state { text-align: center; padding: 40px 0; color: var(--gray); }
.saved-msg {
  background: #eaf5e6;
  color: var(--green);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 10px;
  display: none;
}
.error-msg {
  background: #fcebe9;
  color: var(--red);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 10px;
  display: none;
}
footer.hint {
  margin-top: 30px;
  text-align: center;
  font-size: 12px;
  color: var(--gray);
}

/* ---------- v2 additions ---------- */

.owner-badge {
  background: #e9e4da;
  color: var(--ink);
  font-size: 12px;
  padding: 6px 12px;
}
.owner-badge.active { background: #f6d78a; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stat-tile {
  background: white;
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.stat-tile .num { font-size: 22px; font-weight: 800; color: var(--wood-dark); display:block; }
.stat-tile .label { font-size: 12px; color: var(--gray); }
/* "7 of 10" — the total rides along smaller so three tiles still fit
   across a phone at 22px bold. */
.stat-tile .num-sub { font-size: 13px; font-weight: 600; color: var(--gray); }

.estate-box {
  background: #eaf1f8;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  font-size: 14px;
  color: #2c4a66;
}
.estate-box h3 { margin: 0 0 6px; font-size: 15px; }

.condition-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  color: white;
  background: var(--red);
}

.tap-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.tap-menu button {
  font-size: 14px;
  padding: 14px 8px;
}
.tap-menu button.primary { background: var(--green); }
.tap-menu button.secondary-action { background: var(--wood); }

.timer-banner {
  background: #fff4e0;
  border: 1px solid var(--amber);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 14px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}
.photo-slot {
  border: 2px dashed #ddd;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  color: var(--gray);
  position: relative;
}
/* Show the WHOLE photo, not a crop of its middle.
   Until v1.6.1 this was width:100% + max-height:140px + object-fit:cover.
   On a phone the slot is narrow and that looked fine, but on a desktop
   each slot is several hundred pixels wide, so a photo got stretched to
   full width, squashed to 140px tall and centre-cropped — a long skinny
   strip you couldn't identify (Jennifer, 2026-08-04).
   `contain` in a fixed box shows the entire image whichever way up it
   was taken; max-width keeps it a sane size on a wide screen. */
.photo-slot img {
  width: 100%;
  max-width: 320px;
  height: 200px;
  margin: 0 auto 6px;
  border-radius: 8px;
  display: block;
  object-fit: contain;
  background: #f4efe7;
}
.photo-slot input[type=file] { font-size: 12px; }

.history-item {
  border-bottom: 1px solid #eee;
  padding: 8px 0;
  font-size: 14px;
}
.history-item:last-child { border-bottom: none; }

.owner-only {
  opacity: 1;
}
.locked-note {
  font-size: 13px;
  color: var(--gray);
  font-style: italic;
}

.sellkit-output {
  width: 100%;
  min-height: 160px;
  font-family: monospace;
  font-size: 13px;
}

nav.tabbar {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #eee;
  padding: 8px 0;
}
nav.tabbar a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--gray);
  font-size: 13px;
  font-weight: 600;
}
nav.tabbar a.active { color: var(--accent); }


/* ---------- The shared close-out screen (v1.5) ----------
   ONE component, two doors: the normal tap-out and the ran-long
   prompt. Full-screen on a phone, because it appears at the moment
   someone is walking out of the shop with gloves half off. */
.closeout-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 38, 33, .55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  z-index: 100;
}
.closeout-card {
  background: var(--cream);
  border-radius: 10px;
  padding: 18px;
  width: 100%;
  max-width: 460px;
  margin: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.closeout-card h3 { margin-top: 0; }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.chip {
  width: auto;
  margin: 0;
  padding: 8px 12px;
  font-size: 14px;
  background: white;
  color: var(--ink);
  border: 1px solid #ddd6c9;
  border-radius: 999px;
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.closeout-times {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.closeout-times > div { flex: 1; min-width: 140px; }
.closeout-times span { display: block; font-size: 13px; }

/* Explicit clock fields (v1.8.1). The native datetime widget leaves
   AM/PM display up to the browser, and both Android's and desktop
   Chrome's can show "03:51" with no marker — so the meridiem lives
   IN the control, as a toggle, where it can't be missed. */
.clock-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.clock-row input[type="date"] { flex: 1 1 100%; width: 100%; }
.clock-row select.clock-part { width: auto; flex: 0 0 auto; padding: 10px 8px; }
.clock-colon { font-weight: 700; color: var(--gray); }
.clock-ampm { flex: 0 0 auto; }
.clock-ampm .seg-btn { min-width: 46px; }

.closeout-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.closeout-actions button { width: auto; flex: 1; min-width: 130px; }

/* The printed QR: white padding around it is part of the code —
   scanners need the quiet zone, so never crop it tight. */
#qrCode svg, #qrWrap svg {
  max-width: 100%;
  height: auto;
  background: white;
  border-radius: 6px;
}

/* ============================================================
   v1.6a — the compact dashboard
   Status line, one-open-at-a-time drawers, and a tool list that
   scrolls inside itself so the drawers below never scroll away.
   ============================================================ */

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- the ＋ Add split button ---- */
.add-wrap { position: relative; }
.add-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  background: white; border-radius: 12px; padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.16); min-width: 170px;
}
.add-menu a, .add-menu button {
  display: block; width: 100%; text-align: left;
  background: none; color: var(--ink); border: 0;
  padding: 12px 12px; border-radius: 8px;
  font-size: 15px; font-weight: 600; text-decoration: none;
  min-height: 44px;
}
.add-menu a:hover, .add-menu button:hover { background: var(--cream); }

/* ---- status line ---- */
.statusbar {
  background: var(--wood-dark); color: white;
  border-radius: 12px; padding: 10px 12px; margin-bottom: 10px;
}
.statusbar.idle { background: var(--gray); }
.status-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.status-row + .status-row { margin-top: 8px; }
.status-row .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #8fd07a; flex: none;
}
.statusbar.idle .dot { background: #ded8cd; }
.status-row .grow { flex: 1; }
.status-sub {
  font-size: 12px; color: #ded4c6;
  border-top: 1px solid rgba(255,255,255,.18);
  margin-top: 8px; padding-top: 7px;
}
.statusbar .mini {
  width: auto; margin: 0; background: rgba(255,255,255,.18);
  color: white; font-size: 13px; font-weight: 600;
  padding: 8px 12px; border-radius: 8px; min-height: 40px;
}

/* ---- chips ---- */
.chip-n {
  display: inline-block; margin-left: 2px; padding: 0 6px;
  border-radius: 999px; background: rgba(0,0,0,.08);
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.chip.active .chip-n { background: rgba(255,255,255,.25); }
.chip.warn { border-color: var(--amber); color: #7d560d; }

/* ---- drawers ---- */
.drawer {
  background: white; border-radius: 12px; margin-bottom: 8px;
  overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
/* The header carries its own warm tint. It used to be `background: none`
   on a white drawer, which made the header and the body the same white —
   so an open drawer read as one undifferentiated block and you couldn't
   see where the header ended. The open state goes a shade deeper again,
   so which drawer is open is obvious at a glance rather than only from
   the caret. */
.drawer-head {
  width: 100%; margin: 0; color: var(--wood-dark);
  background: #f1e9dd;
  border: 0; border-radius: 0; text-align: left;
  display: flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 0 14px;
  font-size: 15px; font-weight: 700;
  border-bottom: 1px solid #e3d8c7;
}
.drawer:not(.open) .drawer-head { border-bottom: 0; }
.drawer.open .drawer-head {
  background: var(--wood-dark);
  color: #fff;
  border-bottom-color: var(--wood-dark);
}
.drawer.open .drawer-head .drawer-count,
.drawer.open .drawer-head .caret { color: #ded4c6; }
.drawer-head:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.drawer-title { flex: none; }
.drawer-count {
  color: var(--gray); font-weight: 500; font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.drawer-head .caret { margin-left: auto; color: var(--gray); font-size: 13px; }
.drawer.open .drawer-head .caret { transform: rotate(180deg); }
.drawer-body { padding: 12px 14px 14px; }

/* ---- tool-list controls ---- */
.control-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.control-label {
  font-size: 12px; color: var(--gray); text-transform: uppercase;
  letter-spacing: .06em; flex: none; min-width: 48px;
}
.seg { display: flex; gap: 3px; background: #f2ece2; border-radius: 9px; padding: 3px; flex: 1; }
.seg-btn {
  flex: 1; width: auto; margin: 0; min-height: 38px;
  background: none; color: var(--gray);
  font-size: 13px; font-weight: 600; padding: 6px 4px; border-radius: 7px;
}
.seg-btn.sel { background: white; color: var(--wood-dark); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* The cap is the point: however many tools exist, Places / Time & Money /
   Buy & Sell / Shop settings stay on screen. */
.scrollbox { max-height: 58vh; overflow-y: auto; }

.group-head {
  position: sticky; top: 0; background: white; z-index: 1;
  font-size: 12px; color: var(--gray);
  text-transform: uppercase; letter-spacing: .08em;
  padding: 10px 0 5px; border-bottom: 1px solid #efe9df;
}

/* ---- status pills ---- */
.pill {
  font-size: 12px; font-weight: 700; padding: 4px 9px;
  border-radius: 999px; white-space: nowrap; flex: none;
}
.p-ok       { background: #e8f0e4; color: var(--green); }
.p-untag    { background: #fbf0d8; color: #7d560d; }
.p-loan     { background: #eceaf5; color: #4b4478; }
.p-issue    { background: #f7e3df; color: var(--red); }
.p-inactive { background: #eeeae4; color: var(--gray); }

/* ---- places & projects ---- */
.place-row, .proj-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #efe9df; min-height: 48px;
}
.place-row:last-child, .proj-row:last-child { border-bottom: none; }
.place-row .nm { flex: 1; font-weight: 600; font-size: 15px; }
.place-row .nm em {
  display: block; font-style: normal; font-weight: 400;
  font-size: 12px; color: var(--gray);
}
.place-row button { width: auto; margin: 0; font-size: 14px; padding: 9px 13px; min-height: 42px; }
.proj-row strong { flex: 1; font-size: 15px; }
.proj-row span { color: var(--gray); font-size: 13px; font-variant-numeric: tabular-nums; }

.sub-head {
  margin: 18px 0 6px; font-size: 13px; color: var(--wood-dark);
  text-transform: uppercase; letter-spacing: .06em;
}
.drawer-body .sub-head:first-child { margin-top: 0; }

/* Download buttons wrap rather than squeezing four onto one phone line. */
.dl-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.dl-row button { width: auto; margin: 0; font-size: 14px; padding: 10px 14px; min-height: 44px; }

/* Disclosure toggles ("Value details", "Not in the shop?") read as a
   quiet control, not a primary action competing with Save. */
.disclosure {
  width: auto; margin: 14px 0 0; background: none;
  color: var(--wood); border: 1.5px solid #ddd6c9;
  font-size: 14px; padding: 10px 14px; min-height: 44px;
}
