/* Jay's Shop: same brand as jaysservicecenter.com (navy ink, electric blue, chrome), tuned for all-day use under shop lights. */
:root {
  --ink: #0b1a2e; --ink-soft: #3c4a5e; --ink-faint: #6b7788;
  --blue: #1e88f0; --blue-bright: #3aa0ff; --blue-deep: #0b56cc; --blue-wash: #e8f2fe;
  --paper: #f3f5f8; --white: #fff; --line: #d7dde6; --line-soft: #e7ebf1;
  --red: #c9302c; --red-wash: #fdecec; --amber: #a86400; --amber-wash: #fff4e0; --green: #17803d; --green-wash: #e6f6ec;
  --radius: 10px; --display: "Barlow Condensed", "Arial Narrow", sans-serif; --body: "Barlow", system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(11,26,46,.06), 0 6px 18px -10px rgba(11,26,46,.25);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body.signed-out .mainnav, body.signed-out .search { visibility: hidden; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--body); }
a { color: var(--blue-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { font-family: var(--display); line-height: 1.05; margin: 0; }
h1 { font-size: clamp(30px, 3.2vw, 40px); font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: .01em; }
h2 { font-size: 22px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
h3 { font-size: 18px; font-weight: 700; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 8px 22px;
  background: radial-gradient(120% 140% at 0% 0%, #13305a 0%, var(--ink) 55%); color: #fff;
  box-shadow: 0 2px 0 rgba(58,160,255,.55), 0 10px 24px -14px rgba(0,0,0,.6);
}
.brand img { display: block; width: 132px; height: auto; filter: drop-shadow(0 2px 6px rgba(58,160,255,.35)); }
.mainnav { display: flex; gap: 2px; }
.mainnav a {
  color: #cfe3ff; text-decoration: none; font: 700 17px var(--display); letter-spacing: .06em; text-transform: uppercase;
  padding: 10px 14px; border-radius: 8px; min-height: 44px; display: flex; align-items: center;
}
.mainnav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.mainnav a[aria-current="page"] { color: #fff; background: rgba(58,160,255,.18); box-shadow: inset 0 -3px 0 var(--blue-bright); }
.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search input {
  width: 100%; height: 46px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08);
  color: #fff; padding: 0 44px 0 16px; font-size: 17px;
}
.search input::placeholder { color: #9fb6d4; }
.search input:focus { outline: none; background: #fff; color: var(--ink); border-color: var(--blue-bright); box-shadow: 0 0 0 3px rgba(58,160,255,.4); }
.search input:focus::placeholder { color: var(--ink-faint); }
.search kbd { position: absolute; right: 12px; top: 12px; font: 600 13px var(--body); color: #9fb6d4; border: 1px solid rgba(255,255,255,.25); border-radius: 5px; padding: 0 7px; }
.search input:focus + kbd { display: none; }
.who { background: none; border: 1px solid rgba(255,255,255,.2); color: #cfe3ff; border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.who:hover { color: #fff; border-color: rgba(255,255,255,.4); }

/* ---------- Page ---------- */
main { max-width: 1320px; margin: 0 auto; padding: 26px 22px 80px; outline: none; }
.loading { color: var(--ink-faint); }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.pagehead .sub { margin: 6px 0 0; color: var(--ink-soft); }
.crumbs { font-size: 14px; margin-bottom: 6px; color: var(--ink-faint); }
.crumbs a { color: var(--ink-soft); }
.grid { display: grid; gap: 18px; align-items: start; }
.cols-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cols-side { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); }
@media (max-width: 960px) { .cols-2, .cols-side { grid-template-columns: 1fr; } }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card > h2 { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 16px 20px 0; }
.muted { color: var(--ink-faint); }
.small { font-size: 14px; }
.empty { padding: 26px; text-align: center; color: var(--ink-faint); }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(180deg, var(--blue-bright), var(--blue-deep)); }
.stat.warn::before { background: linear-gradient(180deg, #ffb020, #d97a00); }
.stat .n { font: 800 38px/1 var(--display); letter-spacing: .01em; }
.stat .l { margin-top: 6px; font: 700 14px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.stat .h { margin-top: 4px; font-size: 14px; color: var(--ink-faint); }
a.stat:hover { border-color: var(--blue-bright); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--white); color: var(--ink); font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--blue); color: var(--blue-deep); }
.btn.primary { background: linear-gradient(180deg, #3aa0ff 0%, #1e7fe6 55%, #0b56cc 100%); border-color: #0b56cc; color: #fff; box-shadow: 0 6px 14px -8px rgba(11,86,204,.8); }
.btn.primary:hover { filter: brightness(1.06); color: #fff; }
.btn.danger { color: var(--red); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(58,160,255,.6); outline-offset: 2px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--line-soft); color: var(--ink-soft); white-space: nowrap; }
.chip.ok { background: var(--green-wash); color: var(--green); }
.chip.bad { background: var(--red-wash); color: var(--red); }
.chip.warn { background: var(--amber-wash); color: var(--amber); }
.chip.blue { background: var(--blue-wash); color: var(--blue-deep); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 700 13px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfd; position: sticky; top: 0; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--blue-wash); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }

/* Results list */
.results { display: grid; gap: 10px; }
.result { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; align-items: center; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.result:hover, .result:focus-visible { border-color: var(--blue-bright); background: #fbfdff; }
.result .nm { font-weight: 700; font-size: 18px; }
@media (max-width: 760px) { .result { grid-template-columns: 1fr; gap: 4px; } }

/* Forms */
.form { display: grid; gap: 14px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
label.f { display: grid; gap: 5px; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
label.f input, label.f select, label.f textarea {
  width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; background: #fff; color: var(--ink); font-size: 16px; font-weight: 400;
}
label.f textarea { min-height: 90px; resize: vertical; }
label.f input:focus, label.f select:focus, label.f textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(58,160,255,.25); }
.hint { font-size: 13px; color: var(--ink-faint); font-weight: 400; }
.err { color: var(--red); font-weight: 600; }
.phones { display: grid; gap: 8px; }
.phone-row { display: grid; grid-template-columns: 1fr 120px 40px; gap: 8px; }

/* Detail lists */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.facts dt { color: var(--ink-faint); font-size: 14px; }
dl.facts dd { margin: 0; font-weight: 600; }

/* Vehicle tiles */
.cars { display: grid; gap: 10px; }
.car { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; text-decoration: none; color: inherit; }
.car:hover { border-color: var(--blue-bright); background: #fbfdff; }
.car .t { font-weight: 700; }
.car.inactive { opacity: .6; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--line-soft); }
.timeline li:first-child { border-top: 0; }
.timeline .d { font-weight: 700; }
.timeline .jobs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.timeline .job { background: var(--paper); border: 1px solid var(--line-soft); border-radius: 6px; padding: 2px 8px; font-size: 14px; }
.timeline .job.declined { background: var(--amber-wash); border-color: #f3d9a4; color: var(--amber); }
@media (max-width: 640px) { .timeline li { grid-template-columns: 1fr; gap: 4px; } }

/* Mileage chart */
.spark { width: 100%; height: 110px; display: block; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; transition: .25s; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.6); z-index: 50; max-width: min(92vw, 560px); pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--red); }

/* Sign-in */
.signin { max-width: 440px; margin: 7vh auto 0; }
.signin .card { padding: 30px; }
.signin h1 { margin-bottom: 8px; }

/* Notice boxes */
.notice { border-radius: 9px; padding: 12px 16px; background: var(--blue-wash); border: 1px solid #c5dcfb; }
.notice.warn { background: var(--amber-wash); border-color: #f3d9a4; }
.notice.bad { background: var(--red-wash); border-color: #f4c2c0; }
.notice.ok { background: var(--green-wash); border-color: #b9e3c7; }

/* Reminder list */
.rem-check { width: 22px; height: 22px; accent-color: var(--blue); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); background: #fafbfd; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 9px 14px; cursor: pointer; font-weight: 700; min-height: 42px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 8px 14px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .mainnav { overflow-x: auto; }
  .brand img { width: 110px; }
}

/* ---------- Postcards: 4 per letter sheet (each 4.25 × 5.5 in), on-screen preview + print ---------- */
#print { display: none; }
.sheets { display: grid; gap: 28px; justify-content: center; }
.sheet { width: 8.5in; height: 11in; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; background: #fff; box-shadow: 0 12px 40px -18px rgba(11,26,46,.45); border: 1px solid var(--line); }
.pc { border: 1px dashed #c3cad4; padding: .35in .35in .4in; display: grid; grid-template-rows: auto 1fr auto; color: #111; font: 11.5pt/1.35 Arial, Helvetica, sans-serif; overflow: hidden; }
.pc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; border-bottom: 2.5pt solid #1e88f0; padding-bottom: 8px; }
.pc-brand { font: 900 italic 15pt/1 var(--display); text-transform: uppercase; letter-spacing: .03em; color: #0b1a2e; }
.pc-from { font-size: 7.5pt; color: #333; line-height: 1.3; margin-top: 3px; }
.pc-stamp { width: .8in; height: .9in; flex: none; border: 1px dashed #9aa5b3; display: grid; place-items: center; text-align: center; font-size: 7pt; line-height: 1.2; color: #8a94a3; text-transform: uppercase; letter-spacing: .06em; }
.pc-msg { padding-top: 12px; }
.pc-msg p { margin: 0 0 7px; }
.pc-phone { font: 800 15pt var(--display); color: #0b56cc; letter-spacing: .02em; }
.pc-to { justify-self: end; min-width: 2.4in; font-size: 11pt; line-height: 1.3; padding-top: 8px; border-top: 1px solid #ddd; }
@media (max-width: 900px) { .sheets { zoom: .5; } }
@media print {
  @page { size: letter; margin: 0; }
  body { background: #fff; }
  body.pc-mode > *:not(main), body.pc-mode .noprint { display: none !important; }
  body.pc-mode main { padding: 0; max-width: none; }
  body.pc-mode .sheets { display: block; zoom: 1; }
  body.pc-mode .sheet { box-shadow: none; border: 0; page-break-after: always; break-after: page; }
  body.pc-mode .pc-top, body.pc-mode .pc-phone { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Invoice: on-screen paper preview + print ---------- */
.paper { background: #fff; width: min(100%, 8.5in); margin: 0 auto; padding: .5in .55in; box-shadow: 0 12px 40px -18px rgba(11,26,46,.45); border: 1px solid var(--line); color: #111; font-size: 13.5px; line-height: 1.4; }
.inv-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; background: var(--ink); color: #dfe9f7; margin: -.5in -.55in 0; padding: 16px .55in; border-bottom: 3px solid var(--blue-bright); }
.inv-logo { width: 150px; height: auto; display: block; }
.inv-shop { text-align: right; font-size: 12.5px; line-height: 1.45; }
.inv-shop b { color: #fff; font: 800 italic 18px var(--display); letter-spacing: .04em; text-transform: uppercase; }
.inv-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 18px 0 12px; border-bottom: 1px solid #cfd6df; }
.inv-title h1 { font-size: 30px; color: var(--ink); }
.inv-title h1 span { color: var(--blue-deep); }
.inv-title dl { display: grid; grid-template-columns: auto auto; gap: 2px 14px; margin: 0; font-size: 12.5px; }
.inv-title dt { color: #5b6676; text-align: right; } .inv-title dd { margin: 0; font-weight: 700; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 14px 0; border-bottom: 1px solid #cfd6df; }
.paper h2 { font: 700 12px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--blue-deep); margin: 0 0 4px; }
.paper p { margin: 0; }
.inv-block { padding: 12px 0; border-bottom: 1px solid #e3e7ed; }
.inv-lines { margin-top: 12px; }
.inv-lines th { background: #eef3fa; color: var(--ink); font-size: 11.5px; position: static; border-bottom: 2px solid var(--ink); }
.inv-lines td { padding: 6px 10px; border-bottom: 0; }
.inv-lines tr.job td { border-top: 1px solid #e3e7ed; padding-top: 9px; }
.inv-lines tr.part td { color: #333; font-size: 12.5px; padding-left: 26px; }
.inv-lines tr.part td.num { padding-left: 10px; }
.inv-lines .desc { font-size: 12.5px; color: #444; white-space: pre-wrap; }
.inv-lines .pn { color: #6b7788; font-size: 11.5px; }
.inv-lines .ptype { font-size: 10.5px; border: 1px solid #c8d0db; border-radius: 4px; padding: 0 4px; color: #4a5566; }
.inv-bottom { display: grid; grid-template-columns: 1fr 250px; gap: 26px; margin-top: 16px; padding-top: 14px; border-top: 2px solid var(--ink); }
.inv-notes p { margin-bottom: 8px; } .inv-notes .fine { font-size: 11px; color: #555; }
.sign { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-top: 26px; }
.sign span { border-top: 1px solid #333; padding-top: 3px; font-size: 11px; color: #555; }
.inv-totals td { padding: 4px 0; border: 0; }
.inv-totals tr.strong td { font-weight: 800; font-size: 16px; border-top: 1px solid #333; padding-top: 7px; }
.inv-foot { margin-top: 22px; text-align: center; font: 700 italic 14px var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--blue-deep); }
@media (max-width: 700px) { .inv-parties, .inv-bottom { grid-template-columns: 1fr; } .paper { padding: 20px; } .inv-head { margin: -20px -20px 0; padding: 14px 20px; } }
@media print {
  body.invoice-mode > *:not(main), body.invoice-mode .noprint, body.invoice-mode #print { display: none !important; }
  body.invoice-mode main { padding: 0; max-width: none; }
  body.invoice-mode .paper { box-shadow: none; border: 0; width: auto; padding: .45in .5in; }
  body.invoice-mode .inv-head { margin: -.45in -.5in 0; padding: 14px .5in; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.invoice-mode .inv-lines th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 0; }
}
