:root {
  --navy: #112F56;
  --ink: #1d2733;
  --muted: #5b6675;
  --line: #d9e0e8;
  --bg: #f4f6f9;
  --ok: #2E7D32;
  --warn: #B45309;
  --danger: #B42318;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: #0b5cad; }
h1 { font-size: 1.6rem; margin: 0 0 .6rem; color: var(--navy); }
h2 { font-size: 1.2rem; margin: 1.4rem 0 .6rem; color: var(--navy); }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }

/* Header */
.topbar { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; flex-wrap: wrap; }
.topbar .brand { font-weight: 800; font-size: 1.1rem; color: #fff; text-decoration: none; margin-right: .5rem; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.topbar nav a { color: #fff; text-decoration: none; padding: .5rem .75rem; border-radius: 6px; font-weight: 600; }
.topbar nav a:hover, .topbar nav a.active { background: rgba(255,255,255,.15); }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: .9rem; opacity: .9; }
.topbar form { display: inline; }
.topbar button.link { background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; font: inherit; }
.btn-book { background: #FFD54A; color: var(--navy) !important; }
.btn-book:hover { background: #ffe07a !important; }

/* Business switcher */
.switcher { display: flex; gap: .4rem; flex-wrap: wrap; padding: .6rem 1rem; background: #fff; border-bottom: 1px solid var(--line); }
.switcher a { text-decoration: none; padding: .35rem .8rem; border-radius: 999px; border: 2px solid var(--line); color: var(--ink); font-weight: 600; font-size: .9rem; }
.switcher a.on { border-color: currentColor; }
.chip { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-weight: 700; font-size: .8rem; white-space: nowrap; }

/* Big business banner – the thing staff can't miss */
.banner { padding: .9rem 1.1rem; border-radius: var(--radius); font-weight: 800; font-size: 1.25rem; letter-spacing: .02em; margin: 0 0 1rem; }
.banner small { display: block; font-weight: 600; font-size: .9rem; letter-spacing: 0; opacity: .95; margin-top: .2rem; }

main { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; text-decoration: none; color: var(--ink); display: block; }
.stat b { display: block; font-size: 1.8rem; color: var(--navy); }
.stat span { color: var(--muted); font-size: .9rem; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfc; }
tr:hover td { background: #fafcff; }
.ref { font-weight: 800; font-family: ui-monospace, Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Forms */
label { display: block; font-weight: 600; margin: .5rem 0 .2rem; font-size: .92rem; }
input:not([type]), input[type=date], input[type=month], input[type=text], input[type=email], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: .55rem .65rem; border: 1px solid #b8c3d0; border-radius: 6px; font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 3px solid #9cc3ef; border-color: #1F6FB2; }
.field { margin-bottom: .4rem; }
.field .help { color: var(--muted); font-size: .8rem; }
.errorlist { color: var(--danger); margin: .2rem 0; padding-left: 1rem; font-size: .88rem; }
.checkbox label { display: flex; gap: .5rem; align-items: center; font-weight: 600; }
.checkbox input { width: 1.2rem; height: 1.2rem; }
.row { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.btn { display: inline-block; border: 0; border-radius: 6px; padding: .7rem 1.1rem; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; background: var(--navy); color: #fff; }
.btn:hover { filter: brightness(1.12); }
.btn.secondary { background: #fff; color: var(--navy); border: 2px solid var(--navy); }
.btn.big { padding: .95rem 1.5rem; font-size: 1.1rem; }
.btn.small { padding: .4rem .7rem; font-size: .85rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }

.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .7rem 1rem; border-radius: 6px; background: #e8f5e9; border: 1px solid #b7dfba; margin-bottom: .4rem; font-weight: 600; }
.messages li.error { background: #fdecea; border-color: #f5c2bd; }
.alert { padding: .8rem 1rem; border-radius: 6px; background: #fdecea; border: 1px solid #f5c2bd; font-weight: 600; margin-bottom: 1rem; }
.note { padding: .7rem 1rem; border-radius: 6px; background: #fff8e1; border: 1px solid #f3dc8b; margin-bottom: 1rem; }

.device-card { border: 2px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; background: #fff; position: relative; }
.device-card h3 { margin-top: 0; }
.device-card .remove { position: absolute; top: .6rem; right: .6rem; }
.lookup-results { border: 1px solid var(--line); border-radius: 6px; margin-top: .3rem; background: #fff; }
.lookup-results button { display: flex; width: 100%; justify-content: space-between; gap: .5rem; padding: .5rem .7rem; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left; font: inherit; }
.lookup-results button:hover { background: #f2f7fd; }
.lookup-results button.add-model { color: var(--navy, #112F56); font-weight: 600; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 3px solid var(--line); padding: .3rem 0 .6rem .8rem; }
.timeline .when { color: var(--muted); font-size: .8rem; }

.status { display: inline-block; padding: .15rem .55rem; border-radius: 4px; background: #eef2f7; font-weight: 700; font-size: .8rem; }
.status.ready { background: #e8f5e9; color: #1b5e20; }
.status.awaiting_parts, .status.awaiting_approval { background: #fff3e0; color: #8a4b00; }
.status.collected, .status.cancelled { background: #eceff1; color: #546e7a; }

.login-box { max-width: 380px; margin: 4rem auto; }

@media print {
  .topbar, .switcher, .no-print { display: none !important; }
  body { background: #fff; }
}

label.check { display: flex; gap: .5rem; align-items: center; font-weight: 600; }
label.check input { width: 1.2rem; height: 1.2rem; }
.btn.whatsapp { background: #128C7E; border-color: #128C7E; color: #fff; }
blockquote.note { margin: .4rem 0 .8rem; }

.repair-line { font-weight: 600; color: #1d2b3a; margin-top: .15rem; }
.repair-headline { font-size: 1.25rem; font-weight: 700; margin: .2rem 0 .6rem; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; vertical-align: middle; }
.tag.online { background: #e8f0fe; color: #1a56c4; border: 1px solid #b9cdfa; }

/* Stage 2: money, stock, follow-ups */
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.title-row h1 { margin: 0; }
.tag.warn { background: #fff3e0; color: #8a4b00; border: 1px solid #f3c98b; }
.tag.ok { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.btn.danger { background: var(--danger); }
.danger-link { color: var(--danger); }
.link-btn { background: none; border: 0; color: #0b5cad; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
table.money td:first-child { width: 40%; color: var(--muted); }
details.take { margin-top: .8rem; border: 1px solid var(--line); border-radius: 6px; padding: .5rem .8rem; }
details.take summary { cursor: pointer; font-weight: 700; }
.money-sum { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: .8rem 0; padding: .7rem 1rem; background: #f4f8fc; border-radius: 6px; }
.money-sum b { font-size: 1.15rem; }
.money-sum .due b { font-size: 1.4rem; color: var(--navy); }
.lines input { margin: 0; }
label.outcome { display: flex; gap: .7rem; align-items: flex-start; border: 2px solid var(--line); border-radius: 8px; padding: .7rem .9rem; margin: .5rem 0; cursor: pointer; font-weight: 400; }
label.outcome:has(input:checked) { border-color: var(--navy); background: #f2f7fd; }
label.outcome input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; }
.field ul { list-style: none; padding: 0; margin: .2rem 0; display: flex; gap: 1rem; flex-wrap: wrap; }
.field ul label { display: flex; gap: .4rem; align-items: center; font-weight: 600; margin: 0; }
.scanbox input { font-size: 1.15rem; padding: .7rem .8rem; }
.found { padding: .7rem 1rem; background: #e8f5e9; border: 1px solid #b7dfba; border-radius: 6px; margin-bottom: .6rem; }
form.match { display: flex; gap: .6rem; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--line); }
form.match span { flex: 1; }
.period { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.period select { width: auto; }
.vat { margin-top: 1rem; padding: .7rem 1rem; border-radius: 6px; background: #f1f8f2; border: 1px solid #b7dfba; }
.vat.warn { background: #fff8e1; border-color: #f3dc8b; }
.vat.danger { background: #fdecea; border-color: #f5c2bd; }
.vat .bar { height: 10px; background: #fff; border: 1px solid var(--line); border-radius: 5px; margin: .4rem 0; overflow: hidden; }
.vat .bar span { display: block; height: 100%; background: var(--ok); }
.vat.warn .bar span { background: var(--warn); }
.vat.danger .bar span { background: var(--danger); }
.followup-note { display: block; text-decoration: none; color: var(--ink); }
.print-now { border-width: 2px; }
.topbar a.who { color: #fff; text-decoration: none; }
ol.steps li { margin-bottom: .3rem; }
.part-row { grid-template-columns: 1fr 7rem; }

/* Signatures */
#sig { display: block; width: 100%; max-width: 500px; aspect-ratio: 500 / 150; border: 2px solid #333; border-radius: 6px; background: #fff; margin: .75rem 0; cursor: crosshair; }
.sign-terms { max-height: 40vh; overflow: auto; }
.note.ok { border-color: #2e7d32; background: #eef7ee; }
.sig-shown { border-top: 1px solid #eee; padding-top: .5rem; margin-top: .5rem; }
.sig-shown img { display: block; border: 1px solid #ddd; border-radius: 4px; background: #fff; max-width: 100%; height: auto; }

/* Sign-in with PIN */
.pin-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .5rem; margin: .75rem 0; }
.pin-person { display: block; cursor: pointer; }
.pin-person input { position: absolute; opacity: 0; }
.pin-person span { display: block; padding: .9rem .6rem; border: 2px solid #ccd; border-radius: 8px; text-align: center; font-weight: 600; background: #fff; }
.pin-person input:checked + span { border-color: #1F6FB2; background: #e8f1fa; }
.pin-person input:focus-visible + span { outline: 3px solid #1F6FB2; }
.pin-input { font-size: 2rem; letter-spacing: .6em; text-align: center; max-width: 12rem; }
.staff-row { border-top: 1px solid #eee; padding: .6rem 0; }
.staff-row .actions form { display: inline; }
.tag.danger { background: #fdecea; color: #b3261e; }

/* Condition photos */
.photo-controls { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.photo-controls .field { min-width: 12rem; }
#cam { width: 100%; max-width: 960px; background: #111; border-radius: 6px; display: block; margin: .5rem 0; }
#cam.flash { outline: 6px solid #fff; filter: brightness(1.6); }
.photo-grid { display: flex; flex-wrap: wrap; gap: .6rem; }
.photo-grid figure { margin: 0; width: 160px; }
.photo-grid img { width: 160px; height: 120px; object-fit: cover; border-radius: 4px; border: 1px solid #ccc; display: block; }
.photo-grid form { display: inline; }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }

/* Passcode on the ticket: hidden until pressed, so customers at the counter don't see it */
details.passcode { margin: .4rem 0; font-size: .9rem; }
details.passcode code { font-size: 1.15rem; padding: .1rem .4rem; background: #fff3c4; border-radius: 3px; }
.warn-text { color: #a14b00; font-weight: 600; }
input.masked { -webkit-text-security: disc; }
input.masked:focus { -webkit-text-security: none; }

/* Booking-in checklist: tick boxes in columns */
.checklist ul, .checklist div[id] { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .2rem 1rem; list-style: none; padding: 0; margin: .3rem 0; }
.checklist label { font-weight: normal; }

/* Stock: "have we got it?" messages, lookup box, dashboard top 20 */
.stock-msg { padding: .45rem .7rem; border-radius: 6px; margin: .4rem 0; font-weight: 600; border: 1px solid #ccd; background: #f6f7f9; }
.stock-msg.in { background: #eaf6ec; border-color: #2e7d32; color: #1b5e20; }
.stock-msg.out { background: #fff4e5; border-color: #e07b00; color: #8a4b00; }
.stock-lookup { margin: 0 0 1rem; }
.stock-lookup input { max-width: 28rem; }
.stock-lookup td.in strong { color: #1b5e20; }
.stock-lookup td.out { color: #999; }
.stock-top table { width: 100%; }
tr.row-alert td { background: #fff4e5; }

/* Loan phones */
.loan-out { border: 2px solid #e07b00; background: #fff8ef; }
.loan-out input[type=text], .loan-out input:not([type]) { max-width: 24rem; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline-form input { max-width: 20rem; }

/* Who is signed in: big enough to notice, with a one-press switch on shop PCs */
.topbar .me { display: flex; align-items: center; gap: .5rem; margin-left: .6rem; }
.topbar .me-name { background: #fff; color: #05285E; font-weight: 700; font-size: 1.05rem; padding: .35rem .8rem; border-radius: 999px; white-space: nowrap; }
.topbar .me-name::before { content: "\1F464  "; }
.topbar .me-switch { background: #14B0D9; color: #fff; border: 0; font: inherit; font-weight: 700; font-size: .95rem; padding: .45rem .8rem; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.topbar .me-switch:hover { background: #0e97bb; }
@media print { .topbar .me { display: none; } }

/* Running costs and break-even */
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin: 1rem 0 .5rem; }
.tabs a { padding: .45rem .9rem; border-radius: 6px 6px 0 0; border: 1px solid #ccd; border-bottom: 0; background: #eef0f4; text-decoration: none; color: inherit; font-weight: 600; }
.tabs a.active { background: #fff; }
.table-scroll { overflow-x: auto; }
/* Column headings (with the business colours) stay at the top of the screen while scrolling a long list */
table.sticky-head thead th { position: sticky; top: 0; z-index: 2; background: #fafbfc; box-shadow: 0 1px 0 var(--line), 0 2px 4px rgba(0,0,0,.06); }
table.costs { width: 100%; }
table.costs input, table.costs select { width: 100%; min-width: 6rem; }
table.costs td.amt input { max-width: 8rem; }
table.costs tr.group th { text-align: left; padding-top: .8rem; font-size: .85rem; color: #556; border-bottom: 1px solid #dde; }
.meter { height: 6px; background: #e5e7ec; border-radius: 3px; margin: .25rem 0 .1rem; max-width: 9rem; }
.meter span { display: block; height: 100%; background: #e39b1b; border-radius: 3px; }
.meter span.ok { background: #2e7d32; }

/* Customer pages: track my repair, review emails */
.public-page { max-width: 34rem; margin: 1.5rem auto; }
.track-steps { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; gap: .3rem; }
.track-steps li { flex: 1; text-align: center; font-size: .8rem; color: #889; }
.track-steps li span { display: block; height: 8px; border-radius: 4px; background: #e2e5ea; margin-bottom: .35rem; }
.track-steps li.done span { background: #2e7d32; }
.track-steps li.now span { background: #2e7d32; box-shadow: 0 0 0 3px #c8e6c9; }
.track-steps li.now { color: #1b5e20; font-weight: 700; }
.track-words { font-size: 1.1rem; margin: 0; }

/* Booking in: quick picks and straight-to-repair search results */
.quick { margin: .2rem 0 .5rem; }
.quick-groups, .quick-kinds { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .35rem; }
.qchip { border: 1px solid #c9cfdb; background: #fff; border-radius: 999px; padding: .35rem .8rem; font: inherit; font-size: .9rem; cursor: pointer; }
.qchip.group { font-weight: 700; }
.qchip.on { background: #05285e; border-color: #05285e; color: #fff; }
.lookup-results .repair-hit { background: #eef7ee; }
.js-repair-hint { color: #a14b00; margin: -.2rem 0 .4rem; }

/* Booking in: condition checks as tap buttons ("Not checked" is the hidden starting value) */
.taps .field > div[id] { display: flex; flex-wrap: wrap; gap: .3rem; }
.taps .field > div[id] > div { margin: 0; }
.taps .field > div[id] label { display: inline-block; border: 1px solid #c9cfdb; background: #fff; border-radius: 6px;
  padding: .4rem .7rem; cursor: pointer; font-weight: 500; margin: 0; }
.taps .field > div[id] input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.taps .field > div[id] label:has(input:checked) { background: #05285e; border-color: #05285e; color: #fff; }
.taps .field > div[id] label:has(input:focus-visible) { outline: 2px solid #4a90d9; outline-offset: 1px; }
.taps .field > div[id] label:has(input[value="not_checked"]) { display: none; }
.taps .field > label { font-weight: 600; }
.device-card.is-phone .phone-skip { display: none; }
.tag.photos { background: #fff3c4; color: #6b4a00; text-decoration: none; }
.photos-due { border-left: 4px solid #e3a21a; }

/* Ready by: promised time against the clock */
.ready-by { font-size: .82rem; color: #445; margin-top: .15rem; }
.ready-by.soon { color: #a14b00; font-weight: 700; }
.ready-by.late { color: #b00020; font-weight: 700; }
tr.late td { background: #fdecee; }
tr.soon td { background: #fff6e6; }
.warranty.covered { border-left: 4px solid #2e7d32; }
.warranty.expired { border-left: 4px solid #b00020; }
.order-group { margin-bottom: 1rem; }
.warranty-hint { margin: -.2rem 0 .4rem; }
.glass-offer { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

/* Sent messages */
.msg-row { border-bottom: 1px solid #e6e9ef; }
.msg-row:last-child { border-bottom: 0; }
.msg-row > summary { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; padding: .6rem .9rem; cursor: pointer; font-size: .92rem; }
.msg-row[open] > summary { background: #f4f7fb; }
.msg-row.row-alert > summary { background: #fff4e5; }
.msg-when { font-weight: 600; min-width: 3rem; }
.msg-ticket { min-width: 12rem; }
.msg-what { flex: 1 1 14rem; color: #333; }
.msg-result.sent, .msg-result.opened { color: #1b7f3b; font-weight: 600; }
.msg-result.failed { color: #b3261e; font-weight: 600; }
.msg-result.skipped { color: #777; }
.msg-body { padding: .3rem .9rem .9rem; }
.stat-alert { border-top: 6px solid #b3261e; }

/* Price calculator */
.pc-cost { font-size: 1.1rem; margin: .4rem 0; }
.pc-table tr.pc-on td { background: #eefaf1; font-weight: 600; }
.pc-picked { margin-top: .6rem; }
.logo-preview { max-width: 100%; max-height: 110px; }
