*{box-sizing:border-box}
:root{--brand:#1f4fd8;--bg:#f5f6f8;--ink:#1b1f27;--mut:#545b68;--line:#e2e5ea}
body{margin:0;font:15px/1.5 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;color:var(--ink);background:var(--bg)}
a{color:var(--brand)}h1{font-size:1.6rem;margin:.2em 0 .6em}h2{font-size:1.1rem;margin:.2em 0 .6em}
.muted{color:var(--mut)}.wrap,.in{max-width:1100px;margin:0 auto;padding:16px}
.top{display:flex;gap:20px;align-items:center;background:#fff;border-bottom:1px solid var(--line);padding:10px 16px;flex-wrap:wrap}
.top nav{display:flex;gap:14px;flex:1;flex-wrap:wrap}.top a{text-decoration:none}.brand{font-weight:700;color:var(--brand)}
.who{display:flex;gap:10px;align-items:center}
.card{background:#fff;border:1px solid var(--line);border-radius:10px;padding:18px;margin:0 0 16px}
.narrow{max-width:520px}.plain{display:grid;place-items:center;min-height:100vh;padding:16px}.plain .card{width:100%;max-width:960px}.plain .narrow{max-width:420px}
.stack{display:flex;flex-direction:column;gap:12px}.row{display:flex;gap:10px;align-items:flex-end;flex-wrap:wrap;margin-bottom:12px}.grow{flex:1}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:12px}
label{display:flex;flex-direction:column;gap:4px;font-weight:600;font-size:.9rem}label.check{flex-direction:row;align-items:center;font-weight:400;gap:8px}
input,select,textarea{font:inherit;padding:8px 10px;border:1px solid #cfd4db;border-radius:7px;background:#fff;width:100%}
input[type=checkbox]{width:auto}input[type=color]{padding:2px;height:38px}.row input,.row select{width:auto}
.btn,button.btn{display:inline-block;font:inherit;padding:8px 14px;border:1px solid #cfd4db;border-radius:7px;background:#fff;color:var(--ink);cursor:pointer;text-decoration:none}
.btn.primary{background:var(--brand);border-color:var(--brand);color:#fff}.btn.danger{color:#b42318;border-color:#f1b5ae}
button.link{background:none;border:0;color:var(--brand);cursor:pointer;font:inherit;padding:0}
form.inline{display:inline}
table{width:100%;border-collapse:collapse;background:#fff;border:1px solid var(--line);border-radius:10px;overflow:hidden;margin-bottom:16px}
th,td{text-align:left;padding:9px 12px;border-bottom:1px solid var(--line);vertical-align:top}th{background:#fafbfc;font-size:.8rem;text-transform:uppercase;letter-spacing:.03em;color:var(--mut)}
td.actions{white-space:nowrap}.privs td:first-child{width:60%}
.flash{padding:10px 14px;border-radius:8px;margin-bottom:14px}.flash.ok{background:#e6f6ec;color:#146c2e}.flash.err{background:#fde8e6;color:#9b1c10}
.pill{padding:2px 9px;border-radius:99px;font-size:.78rem;background:#eef0f3}.pill.active{background:#e6f6ec;color:#146c2e}.pill.suspended{background:#fff4d6;color:#8a5a00}
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin-bottom:18px}
.stat{background:#fff;border:1px solid var(--line);border-radius:10px;padding:14px}.stat b{display:block;font-size:1.8rem}.stat span{color:var(--mut)}
.thumb{width:64px;height:44px;object-fit:cover;border-radius:5px}
.photos{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:12px}.photos figure{margin:0;width:150px}.photos img{width:150px;height:100px;object-fit:cover;border-radius:7px}
details{margin:6px 0}summary{cursor:pointer;font-weight:600}
/* public dealer site */
body.dealer{background:#fff}.hero{background:var(--brand);color:#fff}.hero .in{display:flex;justify-content:space-between;align-items:center}
.hero .brand,.hero a{color:#fff;font-size:1.4rem;text-decoration:none}.hero .tag{max-width:1100px;margin:0 auto;padding:0 16px 18px;font-size:1.05rem;opacity:.95}
.filters{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0}.filters input,.filters select{width:auto}
.cars{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:16px}
.car{display:block;text-decoration:none;color:inherit;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:#fff}.car:hover{box-shadow:0 4px 14px rgba(0,0,0,.08)}
.car img,.noimg{width:100%;aspect-ratio:4/3;object-fit:cover;display:grid;place-items:center;background:#eef0f3;color:var(--mut)}
.car .meta{padding:10px 12px;display:flex;flex-direction:column;gap:2px}.price{font-weight:700;color:var(--brand);font-size:1.15rem}.price.big{font-size:1.8rem;margin:0}
.pager{display:flex;gap:6px;margin:18px 0}.pager a{padding:6px 11px;border:1px solid var(--line);border-radius:6px;text-decoration:none}.pager a.on{background:var(--brand);color:#fff}
.detail{display:grid;grid-template-columns:1.3fr 1fr;gap:24px}.gallery img{width:100%;border-radius:10px;margin-bottom:10px}.noimg.big{aspect-ratio:4/3;border-radius:10px}
.spec th{width:35%;text-transform:none;letter-spacing:0;font-size:.9rem}h1 small{font-weight:400;color:var(--mut);font-size:1rem}
.foot{display:grid;grid-template-columns:1fr 1fr;gap:20px;border-top:1px solid var(--line);margin-top:30px;color:var(--mut)}
@media(max-width:760px){.detail,.foot{grid-template-columns:1fr}}
.langs select{width:auto;padding:4px 8px;margin-inline-start:12px}
[dir=rtl] th,[dir=rtl] td{text-align:right}
fieldset{border:1px solid var(--line);border-radius:8px;padding:10px 14px;display:flex;flex-direction:column;gap:6px}legend{font-weight:600;font-size:.9rem}
.cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;align-items:start}
.board{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(210px,1fr);gap:12px;overflow-x:auto}.col{background:#eef0f3;border-radius:10px;padding:10px;min-height:120px}.col h3{margin:.1em 0 .6em;font-size:.9rem}
.dealcard{background:#fff;border:1px solid var(--line);border-radius:8px;padding:8px 10px;margin-bottom:8px;font-size:.9rem}
.chat{display:flex;flex-direction:column;gap:8px;margin-bottom:12px}.bubble{max-width:75%;padding:8px 12px;border-radius:12px;background:#fff;border:1px solid var(--line)}.bubble.out{align-self:flex-end;background:#e7efff}
.unread{font-weight:700}
.subnav{display:flex;gap:16px;margin:0 0 14px}.subnav a{text-decoration:none;font-weight:600}
.checklist{list-style:none;padding:0;margin:.5rem 0 0}.checklist li{padding:.25rem 0}
.badge{background:#c0392b;color:#fff;border-radius:9px;padding:0 6px;font-size:11px;margin-left:2px}
.sitenav{display:flex;gap:16px;flex-wrap:wrap;padding:10px 0;font-weight:600}
.carwrap{display:flex;flex-direction:column}.carwrap .car{flex:1}.cmpl{padding:4px 2px;font-size:13px}
.ckb{position:fixed;bottom:0;left:0;right:0;background:#222;color:#fff;padding:12px 16px;display:flex;gap:12px;align-items:center;justify-content:center;z-index:50}.ckb[hidden]{display:none}.ckb a{color:#9cf}
.cmp-table td,.cmp-table th{vertical-align:top;padding:6px 10px;border-bottom:1px solid #ddd}
.wafab{position:fixed;right:16px;bottom:64px;background:#25d366;color:#fff;border-radius:24px;padding:10px 16px;font-weight:600;text-decoration:none;box-shadow:0 2px 8px rgba(0,0,0,.25);z-index:40}
@media print{.noprint,nav,header,footer{display:none!important}.card{border:0;box-shadow:none}}
.abban{display:flex;gap:1rem;align-items:center;justify-content:space-between;flex-wrap:wrap;margin:.75rem auto;padding:.85rem 1rem;border-radius:10px;background:color-mix(in srgb,var(--brand) 12%,#fff);border:1px solid color-mix(in srgb,var(--brand) 30%,#fff)}
.abban p{margin:.2rem 0 0;font-size:.95rem}
.abban .btn{white-space:nowrap}
.revw .revscore{font-size:1.1rem;display:flex;gap:.5rem;align-items:baseline;flex-wrap:wrap}
.revw .revscore strong{font-size:1.6rem}
.revw .stars{color:#e0a106;letter-spacing:1px}
.revw .rev{border-top:1px solid #e6e6e6;padding:.6rem 0}
.revw .revhead{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap}
.revw .avi{display:inline-flex;width:1.9rem;height:1.9rem;border-radius:50%;background:color-mix(in srgb,var(--brand) 20%,#fff);align-items:center;justify-content:center;font-size:.8rem;font-weight:600}
.revw .small{font-size:.85rem}
td.warn{color:#9a2a1f;font-weight:600}
pre.code{background:#f5f5f5;border:1px solid #e0e0e0;border-radius:6px;padding:.6rem;overflow-x:auto;font-size:.9rem;word-break:break-all;white-space:pre-wrap}
p.big{font-size:1.5rem;margin:.3rem 0}
p.big .muted{font-size:1rem}
.warn{color:#9a2a1f;font-weight:600}

/* ---- website templates -------------------------------------------------------
   Only the public dealer site is themed; the staff application and the admin
   console keep their own look so the tools stay familiar whatever a site
   looks like. Every value below comes from Themes::active(). */
body.dealer{background:var(--bg,#fff);color:var(--ink,#17202e);font-family:var(--font-body,system-ui,sans-serif)}
body.dealer h1,body.dealer h2,body.dealer h3,body.dealer .brand{font-family:var(--font-head,inherit)}
body.dealer .hero{background:var(--head-bg,var(--brand));color:var(--head-ink,#fff)}
body.dealer .hero a,body.dealer .hero .brand{color:var(--head-ink,#fff)}
body.dealer .hero .tag{color:var(--head-ink,#fff);opacity:.85}
body.dealer .card,body.dealer .vcard{background:var(--surface,#f6f7f9);border:1px solid var(--line,#d8dde5);border-radius:var(--radius,8px);box-shadow:var(--shadow,none)}
body.dealer .btn{border-radius:var(--radius,8px)}
body.dealer .btn.primary{background:var(--brand);border-color:var(--brand);color:var(--head-ink,#fff)}
body.dealer .sitenav{border-bottom:1px solid var(--line,#d8dde5)}
body.dealer .sitenav a{color:var(--ink,#17202e)}
body.dealer .sitenav a:hover{color:var(--accent,var(--brand))}
body.dealer .price,body.dealer .vprice{color:var(--accent,var(--brand))}
body.dealer .foot{border-top:1px solid var(--line,#d8dde5)}
body.dealer img{border-radius:var(--radius,8px)}
body.dealer .brand img{border-radius:0}

/* Classic Franchise: tight rows, square photos, underlined nav */
body.th-classic .sitenav a{text-transform:uppercase;letter-spacing:.04em;font-size:.88rem}
body.th-classic h1,body.th-classic h2{letter-spacing:-.01em}
body.th-classic .hero{padding-bottom:.6rem}

/* Showroom: generous spacing, photo-led, quiet type */
body.th-showroom .hero{padding:2.4rem 0 1.6rem;border-bottom:1px solid var(--line)}
body.th-showroom .card,body.th-showroom .vcard{background:#fff}
body.th-showroom h1{font-weight:300;font-size:2.1rem}
body.th-showroom .sitenav a{letter-spacing:.06em;font-size:.85rem;text-transform:uppercase}

/* Value Lot: loud, dense, price shouting */
body.th-lot .hero{padding:.9rem 0}
body.th-lot .brand{text-transform:uppercase;letter-spacing:-.02em}
body.th-lot .price,body.th-lot .vprice{font-weight:900;font-size:1.35em;background:var(--accent);color:#000;padding:0 .35rem;display:inline-block}
body.th-lot .sitenav{background:var(--accent)}
body.th-lot .sitenav a{font-weight:700;text-transform:uppercase}
body.th-lot .btn.primary{color:#000;background:var(--accent);border-color:#000;font-weight:800}

/* Boutique: paper, serif, rules instead of boxes */
body.th-boutique .card,body.th-boutique .vcard{background:transparent;border:0;border-top:1px solid var(--line);border-radius:0}
body.th-boutique .hero{border-bottom:2px solid var(--ink);padding-bottom:.8rem}
body.th-boutique h1,body.th-boutique h2{font-weight:400}
body.th-boutique .sitenav a{font-style:italic}

/* Metro: flat, rounded, one accent */
body.th-metro .card,body.th-metro .vcard{background:#fff}
body.th-metro .sitenav{background:var(--surface);border-radius:var(--radius);padding:.4rem .6rem}

/* Truck & Trail: heavy, squared, industrial */
body.th-trail .brand{text-transform:uppercase;font-weight:800;letter-spacing:.02em}
body.th-trail .hero{border-bottom:4px solid var(--accent)}
body.th-trail .btn.primary{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:700;text-transform:uppercase;letter-spacing:.03em}
body.th-trail .sitenav a{text-transform:uppercase;font-weight:700;font-size:.88rem}

/* the template picker in the staff application */
.tpl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:1rem}
.tpl{border:2px solid #e0e0e0;border-radius:10px;overflow:hidden;background:#fff}
.tpl.on{border-color:#1f4fd8;box-shadow:0 0 0 3px rgba(31,79,216,.15)}
.tpl .sw{height:92px;display:flex;flex-direction:column}
.tpl .sw .h{height:34px;display:flex;align-items:center;padding:0 .5rem;font-weight:700;font-size:.8rem}
.tpl .sw .b{flex:1;display:flex;gap:.3rem;align-items:center;padding:.4rem .5rem}
.tpl .sw .chip{height:26px;flex:1;border-radius:3px}
.tpl .sw .pill{font-size:.7rem;padding:.1rem .4rem;font-weight:700}
.tpl .meta{padding:.6rem}
.tpl .meta h3{margin:0 0 .25rem;font-size:1rem}
.tpl .meta p{margin:0 0 .5rem;font-size:.85rem;color:#555}
.featgrp{border:1px solid #e3e3e3;border-radius:8px;padding:.5rem .7rem;margin:.5rem 0}
.featgrp legend{font-weight:600;font-size:.9rem;padding:0 .3rem}
.featgrp label.check{display:inline-flex;align-items:center;gap:.3rem;margin:.15rem .8rem .15rem 0;font-size:.9rem}
body.dealer .feats{display:flex;flex-wrap:wrap;gap:.4rem;margin:.3rem 0 .8rem}
body.dealer .feats li{list-style:none;background:var(--surface,#f3f4f6);border:1px solid var(--line,#e5e7eb);border-radius:var(--radius,6px);padding:.15rem .55rem;font-size:.9rem}
body.dealer .featgroup h3{font-size:.95rem;margin:.6rem 0 .2rem}
.facts{margin:.5rem 0 0;padding-left:1.1rem;display:grid;gap:.25rem}
ul.shots{list-style:none;margin:.75rem 0 0;padding:0;display:grid;gap:.4rem;max-width:620px}
ul.shots li{display:flex;align-items:center;gap:.6rem}
ul.shots li.done span{opacity:.6;text-decoration:line-through}
ul.shots form{margin:0}
ul.shots .btn{min-width:2.6rem;padding:.25rem .5rem;line-height:1.2}
.stack label.check.pick{display:flex;align-items:flex-start;gap:.6rem;font-size:1rem;margin:.1rem 0}
.stack label.check.pick span{line-height:1.4}
.stack label.check.pick input{flex:0 0 auto;width:auto;margin-top:.25rem}
.checks{display:flex;flex-wrap:wrap;gap:.25rem 1rem;max-height:14rem;overflow:auto;margin:.5rem 0;padding:.5rem;border:1px solid var(--line,#e5e7eb);border-radius:6px}
.scores{gap:.35rem;flex-wrap:wrap}
.scores .btn{min-width:2.4rem;padding:.3rem .55rem}
.prose{white-space:normal;line-height:1.6;max-width:70ch}
.photos figure{position:relative}
.blurmark{position:absolute;border:2px solid #ef4444;background:rgba(239,68,68,.18);pointer-events:none}
details.blurbox{margin-top:.5rem}
details.blurbox summary{cursor:pointer;font-size:.9rem}
details.blurbox .row label{font-size:.85rem}
details.blurbox input[type=number]{width:5rem}
ul.marks{list-style:none;margin:.5rem 0 1.5rem;padding:0;display:grid;gap:.4rem;max-width:62ch}
ul.marks li{padding:.5rem .75rem;border-left:3px solid #f59e0b;background:#fffbeb}
fieldset.step{border:1px solid var(--line,#e5e7eb);border-radius:8px;padding:.75rem 1rem;margin:.5rem 0}
fieldset.step legend{font-size:.85rem;color:#545b68;padding:0 .4rem}
tr.late td{background:#fff1f2}
.pill.warn{background:#fef3c7;color:#92400e}

/* ---- phone width -----------------------------------------------------------
   Found by a Playwright pass over 46 pages at 375px (see docs/SECURITY.md's
   sibling, the audit notes in the commit): wide tables, the CRM section strip
   and a few form rows pushed the whole page sideways. The page itself should
   never scroll sideways; a table that is wider than a phone scrolls inside
   itself instead, which is the pattern GitHub uses for Markdown tables. */
.subnav{flex-wrap:wrap;row-gap:6px}
@media (max-width:760px){
  .subnav{flex-wrap:nowrap;overflow-x:auto;white-space:nowrap;padding-bottom:6px;scrollbar-width:thin;-webkit-overflow-scrolling:touch}
  table{display:block;width:max-content;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .row > label,.row > input,.row > select{min-width:0;max-width:100%}
  .row input,.row select{max-width:100%}
  label{min-width:0;max-width:100%}
  main{overflow-wrap:anywhere}
  /* ...but not inside a table: it scrolls sideways on its own, so breaking "NAME" into "NA ME" to
     save width only makes it unreadable */
  main th,main td{overflow-wrap:normal;word-break:normal}
  main td{max-width:22rem}
  pre,code{white-space:pre-wrap;word-break:break-word}
}
.homeh1{font-size:1.45rem;margin:4px 0 14px;letter-spacing:-.01em}
/* the workspace menu folds away at phone width (see layout_app.php) */
.navt{position:absolute;opacity:0;width:1px;height:1px;pointer-events:none}
.navbtn{display:none}
@media (max-width:760px){
  .top{gap:10px}
  .navbtn{display:inline-block;margin-left:auto;border:1px solid var(--line);border-radius:7px;padding:6px 12px;font-weight:600;cursor:pointer;background:#fff}
  .top nav{display:none;flex-basis:100%;flex-direction:column;gap:2px}
  .top nav a{padding:8px 2px;border-bottom:1px solid var(--line)}
  .navt:checked ~ nav{display:flex}
  .navt:focus-visible + .navbtn{outline:3px solid var(--brand);outline-offset:2px}
}

/* Skip link: hidden until it receives keyboard focus */
.skip{position:absolute;left:-9999px;top:0}
.skip:focus{left:1rem;top:1rem;background:#111;color:#fff;padding:.6rem 1rem;z-index:100;border-radius:4px}
main:focus{outline:none}
.footlinks{flex-basis:100%;font-size:.9rem}
.footlinks a{color:inherit}
/* Brand colour as text on dealership sites: readable even when the chosen colour is light */
.dealer main a:not([class]){color:var(--brand-ink,var(--brand))}
body.dealer:not(.th-lot) .price,body.dealer:not(.th-lot) .vprice{color:var(--accent-ink,var(--accent,var(--brand)))}
