/* AutoPart — phone-first, outdoor-readable. */
:root {
  --ink: #16212e;
  --ink-2: #44505e;
  --muted: #6b7682;
  --line: #d9dcd6;
  --bg: #f3f4f1;
  --card: #ffffff;
  --amber: #f2a516;
  --amber-ink: #6b4500;
  --amber-bg: #fdf0d3;
  --green: #1d7a46;
  --green-bg: #dcf1e4;
  --red: #b42318;
  --red-bg: #fde4e1;
  --blue: #1f5fae;
  --blue-bg: #dde9f8;
  --grey-bg: #e7e9e4;
  --r: 12px;
  --tap: 52px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
body.has-rb { padding-bottom: 90px; }
a { color: var(--blue); }
h1 { font-size: 1.35rem; margin: .4rem 0 .6rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .5rem; }
h2 small { font-weight: 400; color: var(--muted); font-size: .8rem; }
p { margin: .4rem 0; }
code { background: var(--grey-bg); padding: 1px 4px; border-radius: 4px; }
.muted { color: var(--muted); }
.small, small { font-size: .82rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .02em; }
.error { color: var(--red); }

/* top bar */
#topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
}
#topbar .home { text-decoration: none; }
.logo { display: block; width: 36px; height: 36px; border-radius: 8px; }
#tb-title { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tb-menu { background: none; border: 0; color: #fff; font-size: 1.5rem; width: 44px; height: 44px; }
.qbadge { background: var(--blue); color: #fff; border: 0; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .9rem; }
.qbadge.warn { background: var(--amber); color: var(--ink); }

main { max-width: 720px; margin: 0 auto; padding: 14px 16px 40px; }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 18px; border-radius: var(--r); border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger.ghost { color: var(--red); background: transparent; border-color: var(--red); }
.btn.big { min-height: 62px; font-size: 1.08rem; }
.btn.small { min-height: 40px; padding: 0 12px; }
.btn.wide { display: flex; width: 100%; margin: 10px 0; }
.btn:disabled { opacity: .45; }
.btn:active { transform: translateY(1px); }
.link { background: none; border: 0; color: var(--blue); font: inherit; padding: 6px 0; cursor: pointer; text-decoration: underline; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.row-btns .btn { flex: 1 1 140px; }
.btn-pair { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 8px; }

/* cards & lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 10px 0; }
.card.narrow { max-width: 420px; margin: 30px auto; }
.card.found { border-left: 5px solid var(--amber); }
.card.found dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0; }
.card.found dt { color: var(--muted); }
.card.found dd { margin: 0; word-break: break-all; }
.card.error { border-color: var(--red); }
.closed-note { background: var(--grey-bg); }
.list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.item {
  display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 10px 12px; color: var(--ink); text-decoration: none; text-align: left; font: inherit; width: 100%; cursor: pointer;
}
.item > div:first-child, .item .mid { flex: 1; min-width: 0; }
.item small { display: block; color: var(--muted); }
.item .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.thumb { width: 60px; height: 60px; border-radius: 8px; background: var(--grey-bg); flex-shrink: 0; display: grid; place-items: center; overflow: hidden; font-size: 1.4rem; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.amber { background: var(--amber-bg); color: var(--amber-ink); }
.pill.grey { background: var(--grey-bg); color: var(--ink-2); }
.pill.blue { background: var(--blue-bg); color: var(--blue); }
.offline { background: var(--amber-bg); color: var(--amber-ink); padding: 8px 12px; border-radius: var(--r); margin-bottom: 10px; font-size: .9rem; }
.offline.blue { background: var(--blue-bg); color: var(--blue); }

/* inputs */
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font: inherit; font-size: 16px;
}
textarea { min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(242, 165, 22, .45); border-color: var(--amber); }
input.big { font-size: 1.2rem; }
.search { margin: 10px 0; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .92rem; }
.form label small { font-weight: 400; }
.form label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
.form label.check input { width: 24px; min-height: 24px; height: 24px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field .lbl { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.combo { display: flex; gap: 8px; }
.combo input { flex: 1; }
.money { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; }
.money span { padding: 0 4px 0 12px; font-weight: 700; color: var(--muted); }
.money input { border: 0; outline: none; }
.money:focus-within { outline: 3px solid rgba(242, 165, 22, .45); border-color: var(--amber); }
.stepper { display: flex; }
.stepper button { width: 52px; border: 1.5px solid var(--line); background: var(--grey-bg); font-size: 1.4rem; font-weight: 700; color: var(--ink); }
.stepper button:first-child { border-radius: 10px 0 0 10px; }
.stepper button:last-child { border-radius: 0 10px 10px 0; }
.stepper input { border-radius: 0; text-align: center; border-left: 0; border-right: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 46px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-weight: 600; color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.suggest { display: flex; flex-direction: column; gap: 4px; margin-top: -6px; }
.suggest:empty { display: none; }
.suggest button { text-align: left; min-height: 46px; padding: 6px 12px; border: 1px solid var(--line); background: #fff; border-radius: 10px; font: inherit; color: var(--ink); display: flex; justify-content: space-between; align-items: center; }
.suggest button small { color: var(--muted); }
.suggest .free { background: var(--amber-bg); border-color: var(--amber); }

/* tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 8px 0; scrollbar-width: none; }
.tabs button { flex: 1 0 auto; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-weight: 600; color: var(--ink); white-space: nowrap; }
.tabs button span { color: var(--muted); font-weight: 400; margin-left: 2px; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs button.on span { color: #c8ced6; }

/* login */
.login { max-width: 380px; margin: 4vh auto 0; text-align: center; }
.brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; }
.brand .logo { width: 96px; height: 96px; border-radius: 20px; }
.brand h1 { margin: 0; font-size: 1.8rem; }
.names { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 22px; }
.btn.name { flex-direction: column; min-height: 64px; font-size: 1.1rem; }
.btn.name small { font-weight: 400; color: var(--muted); }
.login .form { text-align: left; }
.dots { display: flex; justify-content: center; gap: 12px; margin: 18px 0; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.dots i.on { background: var(--ink); }
.dots i:nth-child(n+5) { border-style: dashed; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key { min-height: 66px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; font-size: 1.5rem; font-weight: 600; color: var(--ink); }
.key.ok { background: var(--ink); color: #fff; font-size: 1.1rem; }

/* admin tiles */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.tile b { display: block; font-size: 1.35rem; }
.tile span { color: var(--muted); font-size: .85rem; }
.tile.warn b { color: var(--amber-ink); }
@media (min-width: 600px) { .tiles { grid-template-columns: repeat(3, 1fr); } }

/* new vehicle */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 14px; min-height: 120px; border-radius: var(--r); border: 1.5px solid var(--line); background: #fff; font: inherit; text-align: left; color: var(--ink); }
.choice span { font-size: 1.6rem; line-height: 1; font-weight: 800; color: var(--amber-ink); }
.choice b { font-size: 1.02rem; }
.choice small { color: var(--muted); }
.choice:first-child { background: var(--ink); color: #fff; border-color: var(--ink); }
.choice:first-child span { color: var(--amber); }
.choice:first-child small { color: #c8ced6; }
.wiz h2 { margin-top: .8rem; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.crumb { border: 0; background: var(--amber-bg); color: var(--amber-ink); border-radius: 999px; padding: 6px 10px; font: inherit; font-size: .85rem; font-weight: 600; }
.opts { display: flex; flex-direction: column; gap: 6px; }
.opts.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.opt { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: var(--tap); padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-weight: 600; text-align: left; color: var(--ink); }
.opt small { font-weight: 400; color: var(--muted); }
.opt.hot { border-color: var(--amber); background: var(--amber-bg); }
.opt.hot span::before { content: "★ "; color: var(--amber-ink); }

/* vehicle screen */
.vhead { margin-bottom: 8px; }
.vphotos { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 8px; padding: 0 16px; }
.vphotos img { height: 110px; border-radius: 10px; flex-shrink: 0; }
.addph { flex-shrink: 0; height: 110px; min-width: 110px; border: 2px dashed var(--line); border-radius: 10px; background: #fff; font: inherit; font-weight: 600; color: var(--ink-2); }
.meta { color: var(--ink-2); margin-top: 2px; }
.status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 8px; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; color: var(--muted); font-size: .9rem; }
.item.part { padding: 0; gap: 0; }
.item.part .pbody { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 10px 12px; color: inherit; text-decoration: none; }
.item.part .oe { color: var(--blue); }
.item.part.off { opacity: .45; background: var(--red-bg); border-color: var(--red); }
.item.part.off b { text-decoration: line-through; }
.tick { display: grid; place-items: center; width: 54px; align-self: stretch; border-right: 1px solid var(--line); cursor: pointer; }
.tick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tick span { width: 28px; height: 28px; border-radius: 7px; border: 2px solid var(--ink-2); display: grid; place-items: center; background: #fff; }
.tick input:checked + span { background: var(--green); border-color: var(--green); }
.tick input:checked + span::after { content: "✓"; color: #fff; font-weight: 800; }
.tick input:focus-visible + span { outline: 3px solid rgba(242, 165, 22, .6); }
.removebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.removebar span { flex: 1; font-weight: 600; }
.removebar .ghost { color: #fff; border-color: #5b6673; }

/* part form */
.shots { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.shot { position: relative; width: 120px; height: 120px; flex-shrink: 0; border-radius: 10px; overflow: hidden; background: var(--grey-bg); }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot button { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(22, 33, 46, .8); color: #fff; font-weight: 700; }
.shot.add { border: 2px dashed var(--ink-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font: inherit; font-size: 1.8rem; color: var(--ink); background: #fff; }
.shot.add span { font-size: .85rem; font-weight: 600; }
.shot.add:only-child { width: 100%; height: 150px; background: var(--amber-bg); border-color: var(--amber); }

/* sheets */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(10, 16, 24, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.sheet-body { padding: 18px 16px 8px; overflow-y: auto; }
.sheet-body h2 { margin-top: 0; }
.sheet-btns { display: flex; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--line); }
.sheet-btns .btn { flex: 1; }
.menu-who { margin-bottom: 10px; }
.menu-who span { display: block; color: var(--muted); }
.menu { display: flex; flex-direction: column; }
.menu a { padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; }
.browse details { border-bottom: 1px solid var(--line); }
.browse summary { padding: 14px 4px; font-weight: 700; cursor: pointer; }
.browse .opt { width: 100%; margin-bottom: 6px; }
.big-photo { width: 100%; border-radius: 10px; }

/* search results */
.result .rphotos { display: flex; gap: 6px; overflow-x: auto; margin: -4px -4px 10px; }
.result .rphotos img { height: 130px; border-radius: 8px; cursor: zoom-in; }
.nophoto { color: var(--muted); font-size: .85rem; }
.rtop { display: flex; justify-content: space-between; gap: 10px; }
.price { font-weight: 800; white-space: nowrap; }
.rfoot { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: .88rem; }

/* import */
.scrollx { overflow-x: auto; margin: 10px 0; }
table { border-collapse: collapse; font-size: .82rem; }
th, td { border: 1px solid var(--line); padding: 4px 6px; white-space: nowrap; text-align: left; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 200%); visibility: hidden; z-index: 70; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; max-width: calc(100vw - 32px); transition: transform .2s; pointer-events: none; }
#toast.show { transform: translate(-50%, 0); visibility: visible; }
#toast.bad { background: var(--red); }
body.has-rb #toast { bottom: 96px; }
.labels { display: flex; gap: 8px; margin-top: 8px; }
.labels:empty { display: none; }
.shot.sm { width: 84px; height: 84px; }
.yphoto { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 170px; margin: 10px 0 14px; border: 2px dashed var(--amber); background: var(--amber-bg); border-radius: var(--r); overflow: hidden; cursor: pointer; text-align: center; padding: 10px; }
.yphoto span { font-size: 2.2rem; }
.yphoto img { max-width: 100%; max-height: 220px; border-radius: 8px; }
.yphoto.busy { opacity: .6; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
label.check { display: flex; flex-direction: row; align-items: center; gap: 10px; font-weight: 400; margin: 8px 0; }
label.check input { width: 24px; min-height: 24px; height: 24px; flex-shrink: 0; }
.sheet .big-photo { max-height: 40vh; object-fit: cover; }

/* brand */
.brand { flex-direction: column; gap: 10px; }
.tagline { font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-size: .85rem; }
.hero { display: flex; align-items: center; gap: 14px; margin: 4px 0 14px; }
.hero img { width: 68px; height: 68px; border-radius: 15px; flex-shrink: 0; }
.hero .hi { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.wa { background: #1fa855; border-color: #1fa855; color: #fff; }
.ok-line { color: var(--green); font-weight: 700; margin: 0 0 6px; }

.uname-msg { margin-top: -6px; min-height: 1.2em; }
.uname-msg.good { color: var(--green); font-weight: 600; }
.uname-msg.error { color: var(--red); font-weight: 600; }
.sheet h3.sub { margin: 10px 0 0; font-size: 1rem; border-top: 1px solid var(--line); padding-top: 12px; }
.btn.wa.wide { margin: 4px 0 12px; }
body:has(.sheet-wrap) #toast { top: calc(14px + env(safe-area-inset-top)); bottom: auto; z-index: 80; }

/* WhatsApp chat button */
#wafab { position: fixed; right: 14px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 40; display: flex; align-items: center; gap: 6px;
  background: #1fa855; color: #fff; text-decoration: none; font-weight: 700; padding: 10px 14px 10px 10px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
#wafab svg { display: block; }
body.has-rb #wafab { bottom: calc(86px + env(safe-area-inset-bottom)); }
main { padding-bottom: 90px; }
.sheet-wrap ~ #wafab, body:has(.sheet-wrap) #wafab, body:has(.scanner) #wafab { display: none; }
.warnbox { display: block; text-decoration: none; color: var(--amber-ink); background: var(--amber-bg); border-color: var(--amber); }
.warnbox span { display: block; font-size: .9rem; margin-top: 2px; }
#helpl .item { align-items: flex-start; }
#helpl .row-btns { margin: 8px 0 0; }
#helpl .row-btns .btn { flex: 0 0 auto; }
.login #forgot { margin-top: 14px; }
.updt { color: var(--blue) !important; font-weight: 600; }

.joincard { display: block; margin-top: 22px; text-decoration: none; color: var(--ink); border-left: 5px solid var(--amber); text-align: left; }
.joincard span { display: block; color: var(--blue); font-weight: 600; margin-top: 2px; }
.join { text-align: left; } .join .brand { align-items: center; }
.join h1 { text-align: center; }
.ticks { padding-left: 0; list-style: none; margin: 10px 0 16px; }
.ticks li { padding-left: 26px; position: relative; margin: 8px 0; }
.ticks li::before { content: "✓"; position: absolute; left: 4px; color: var(--green); font-weight: 800; }
.terms li { margin: 10px 0; }
#appl .item { align-items: flex-start; } #appl .row-btns { margin: 8px 0 0; } #appl .row-btns .btn { flex: 0 0 auto; }

.fits { color: var(--ink-2) !important; }
.fitlist { font-size: .9rem; margin: 2px 0; }
.chip.sm { min-height: 0; padding: 2px 8px; font-size: .78rem; display: inline-block; margin: 2px 2px 0 0; border-radius: 999px; background: var(--grey-bg); }
td span.error { font-weight: 600; }

.suggest.ta { margin-top: 4px; }
.suggest.ta button { width: 100%; }
.suggest.ta b { color: var(--blue); }
