/* Design system for the CRM. Page-specific styles live in their own css files and only use these tokens. */
/* Colours of Cars Import UK (carsimport.co.uk, 05/11/2026): navy #002e4f, red #9d0208, text #272727.
   Red is the one accent: the main action and the "needs you" counts. Navy is the side menu and the deal reference. */
:root {
  --bg: #f1f3f6;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --line: #d8dde4;
  --line-soft: #e7eaef;
  --text: #272727;
  --muted: #5d6673;
  --faint: #8b94a0;
  --accent: #9d0208;       /* Cars Import UK red */
  --accent-hover: #b4060e;
  --accent-ink: #ffffff;
  --plate: #002e4f;        /* deal reference chip: Cars Import UK navy */
  --plate-ink: #ffffff;
  --ink: #002e4f;          /* selected tabs and chips */
  --chrome: #002e4f;       /* side menu, phone tab bar, compose window bar */
  --focus: #1f6fc4;
  --good: #1c7a4c; --good-bg: #e3f3ea;
  --warn: #a8600c; --warn-bg: #fbeed9;
  --bad: #c2271f;  --bad-bg: #fbe6e4;
  --info: #1f5f99; --info-bg: #e3edf8;
  --shadow: 0 1px 2px rgba(0, 46, 79, .06), 0 4px 14px rgba(0, 46, 79, .05);
  --shadow-pop: 0 10px 40px rgba(0, 46, 79, .22);
  --r-card: 10px; --r-ctl: 8px; --r-chip: 6px;
  --font: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --side: 236px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #08131d; --surface: #0e1d2b; --surface-2: #132536; --line: #24394d; --line-soft: #1a2d3f;
    --text: #e9eef3; --muted: #9eaebe; --faint: #6c7f92; --ink: #dfe8f1; --focus: #6aa8ff; --chrome: #031524;
    --accent: #c0141c; --accent-hover: #d61e27; --accent-ink: #ffffff; --plate: #1d4e78; --plate-ink: #ffffff;
    --good: #55c58a; --good-bg: #12321f; --warn: #e9a04a; --warn-bg: #36270f; --bad: #ff8a80; --bad-bg: #3a1717; --info: #7fb4ee; --info-bg: #13283d;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-pop: 0 10px 40px rgba(0,0,0,.6); }
}
:root[data-theme="dark"] { --bg: #08131d; --surface: #0e1d2b; --surface-2: #132536; --line: #24394d; --line-soft: #1a2d3f;
  --text: #e9eef3; --muted: #9eaebe; --faint: #6c7f92; --ink: #dfe8f1; --focus: #6aa8ff; --chrome: #031524;
  --accent: #c0141c; --accent-hover: #d61e27; --accent-ink: #ffffff; --plate: #1d4e78; --plate-ink: #ffffff;
  --good: #55c58a; --good-bg: #12321f; --warn: #e9a04a; --warn-bg: #36270f; --bad: #ff8a80; --bad-bg: #3a1717; --info: #7fb4ee; --info-bg: #13283d;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-pop: 0 10px 40px rgba(0,0,0,.6); }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
#app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--chrome); color: #dfe6ec; padding: 16px 12px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .side { border-right: 1px solid var(--line-soft); } }
:root[data-theme="dark"] .side { border-right: 1px solid var(--line-soft); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: #fff; }
.brand .mark { width: 26px; height: 18px; border-radius: 3px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 10px; font-weight: 800; letter-spacing: .06em; border: 1.5px solid #00000030; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #c4d0da; text-decoration: none; font-weight: 520; border: 0; background: none; text-align: left; cursor: pointer; width: 100%; }
.nav-item:hover { background: #ffffff12; color: #fff; }
.nav-item.on { background: #ffffff1f; color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-item .count { margin-left: auto; }
.side-label { font-size: 12px; color: #8396a6; padding: 0 10px; margin-bottom: 2px; }
.biz-list { display: flex; flex-direction: column; gap: 2px; }
.biz-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: #c4d0da; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.biz-item:hover { background: #ffffff12; color: #fff; }
.biz-item.on { background: #ffffff1f; color: #fff; }
.biz-item .n { margin-left: auto; font-size: 12px; color: #8ea0af; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--c, var(--faint)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); } /* the thin edge keeps the yellow Motorbike dot visible on white */
.side-foot { margin-top: auto; font-size: 12px; color: #8396a6; padding: 0 10px; display: flex; flex-direction: column; gap: 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line-soft); }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; padding: 9px 12px 9px 36px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-pop); max-height: 60vh; overflow: auto; z-index: 40; }
.search-results .sr-head { padding: 8px 12px 4px; font-size: 12px; color: var(--muted); }
.search-results button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 8px 12px; background: none; border: 0; text-align: left; cursor: pointer; }
.search-results button:hover, .search-results button:focus { background: var(--surface-2); }
.page { padding: 22px 24px 80px; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.page-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 560; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-icon { padding: 7px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.input, .select, .textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); }
.textarea { min-height: 76px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.field { display: flex; flex-direction: column; gap: 4px; }
/* password boxes with the show / hide button */
.pw-wrap { position: relative; display: flex; width: 100%; }
.pw-wrap > .input { flex: 1; min-width: 0; padding-right: 46px; }
.pw-wrap > input::-ms-reveal { display: none; }
.pw-eye { position: absolute; top: 1px; bottom: 1px; right: 1px; width: 42px; display: grid; place-items: center; border: 0; border-radius: var(--r-ctl); background: none; color: var(--muted); cursor: pointer; }
.pw-eye:hover { color: var(--text); }
.pw-eye:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.pw-eye svg { width: 19px; height: 19px; }
.ml-locked-form .pw-wrap { flex: 1; min-width: 0; }
.field > label, .label { font-size: 12.5px; color: var(--muted); font-weight: 520; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 2px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 560; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.check { display: inline-flex; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--faint); align-items: center; justify-content: center; background: var(--surface); cursor: pointer; flex: none; padding: 0; }
.check.on { background: var(--good); border-color: var(--good); color: #fff; }
.check svg { width: 12px; height: 12px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-card); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.card-head .hint { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r-chip); background: var(--surface-2); border: 1px solid var(--line-soft); font-size: 12.5px; font-weight: 520; color: var(--muted); white-space: nowrap; }
.chip.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chip.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
/* a deal reference rendered like a UK number plate: it is the real reference, e.g. CL 0042 */
.plate { display: inline-block; white-space: nowrap; flex: none; background: var(--plate); color: var(--plate-ink); font-weight: 750; font-size: 12px; letter-spacing: .08em; padding: 1px 7px; border-radius: 4px; border: 1.5px solid #00000030; text-transform: uppercase; line-height: 1.5; }
.plate.count { background: var(--accent); color: var(--accent-ink); border-color: transparent; min-width: 22px; text-align: center; padding: 0 6px; letter-spacing: 0; font-size: 12px; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 560; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.table th.right, .table td.right { text-align: right; }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 4px; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line-soft), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: 6px; min-height: 14px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 18, 25, .45); z-index: 60; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(max(640px, 75vw), 100vw); /* 3/4 of the screen (Greg, 05/11/2026) */ background: var(--bg); z-index: 61; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; animation: slidein .16s ease-out; }
@keyframes slidein { from { transform: translateX(24px); opacity: .6; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--surface); border-bottom: 1px solid var(--line-soft); }
.drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 18px 40px; }
.modal { position: fixed; z-index: 86; left: 50%; top: 8vh; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); max-height: 84vh; overflow: auto; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-pop); }
.modal-head { padding: 16px 18px 0; }
.modal-body { padding: 14px 18px; }
.modal-foot { padding: 12px 18px 16px; display: flex; gap: 8px; justify-content: flex-end; }
.menu { position: fixed; z-index: 88; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 4px; min-width: 190px; max-height: 60vh; overflow: auto; }
.menu button { display: flex; width: 100%; padding: 8px 10px; background: none; border: 0; border-radius: 6px; cursor: pointer; text-align: left; gap: 8px; align-items: center; }
.menu button:hover { background: var(--surface-2); }
.menu .danger { color: var(--bad); }
.menu button > svg { width: 16px; height: 16px; flex: none; }
.menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 0; }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 95; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--chrome); color: #fff; border: 1px solid #ffffff22; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-pop); pointer-events: auto; animation: slidein .16s ease-out; max-width: min(520px, 92vw); }
.toast.bad { background: var(--bad); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.login-remember { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.login-remember input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--accent, #9d0208); }
.login-remember span { display: grid; gap: 2px; line-height: 1.35; }
.login-remember .muted { font-size: 12.5px; }

/* ---------- mobile ---------- */
.tabbar { display: none; }
.biz-strip { display: none; }
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .page { padding: 16px 14px 96px; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--chrome); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid #ffffff1a; justify-content: space-around; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: #b7c4cf; text-decoration: none; font-size: 11.5px; padding: 4px 8px; border-radius: 8px; position: relative; flex: 1; }
  .tabbar a.on { color: #fff; background: #ffffff1c; }
  .tabbar svg { width: 20px; height: 20px; }
  .tabbar .plate { position: absolute; top: -3px; right: 6%; }
  .biz-strip { display: flex; gap: 6px; overflow-x: auto; padding: 8px 14px 0; scrollbar-width: none; }
  .biz-strip button { flex: none; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 540; }
  .biz-strip button.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
  .form-grid { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
  .modal { top: 4vh; }
  .hide-mobile { display: none !important; }
  .menu button { min-height: 42px; }
  .btn-sm { min-height: 36px; }
}
/* on the dark sidebar a light edge keeps the dark brand dots (Cars Import UK red, Motorhome blue) visible */
.side .dot { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .75); }

/* pop-ups in the top right corner: new email, form signed (Greg, 07/11/2026) */
.nt-stack { position: fixed; top: 14px; right: 14px; z-index: 96; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 28px)); pointer-events: none; }
.nt { position: relative; display: flex; align-items: flex-start; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); pointer-events: auto; animation: ntin .18s ease-out; }
@keyframes ntin { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.nt-main { display: flex; gap: 10px; align-items: flex-start; flex: 1; min-width: 0; padding: 12px 8px 12px 12px; border: 0; background: none; color: inherit; text-align: left; font: inherit; cursor: pointer; border-radius: 12px; }
.nt-ic { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.nt-ic svg { width: 17px; height: 17px; }
.nt-form .nt-ic { background: color-mix(in srgb, var(--good) 16%, var(--surface)); color: var(--good); }
.nt-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.nt-ask .nt-txt { padding: 12px 14px; }
.nt-top { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.nt-when { margin-left: auto; }
.nt-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-body { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.nt-acts { display: flex; gap: 6px; margin-top: 8px; }
.nt-x { flex: none; display: grid; place-items: center; width: 30px; height: 30px; margin: 6px 6px 0 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--faint); cursor: pointer; }
.nt-x:hover { background: var(--surface-2); color: var(--text); }
.nt-x svg { width: 15px; height: 15px; }
@media (max-width: 860px) { .nt-stack { top: 10px; right: 10px; } }
