/* Quakeship Auto. Colours and type come from /styles.css, and buttons, fields and notices from /pages.css
   (both loaded first); this file lays out the app. */

body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.01em; margin: 0; }
h1 { font-size: clamp(1.6rem, 5vw, 2.1rem); line-height: 1.15; }
h2 { font-size: 1.12rem; }
h3 { font-size: .98rem; }
p { margin: 0; line-height: 1.5; }
small { color: var(--ink-soft); }
.muted { color: var(--ink-soft); font-weight: 500; }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { font: 700 .72rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--vermilion-deep); }
[hidden] { display: none !important; }

/* Top bar and bottom tabs */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px max(16px, calc((100% - 960px) / 2));
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.bar-brand { display: inline-flex; align-items: center; gap: 10px; font: 700 1.2rem var(--display); }
.bar-brand img { width: 30px; height: 30px; }
.bar-nav { display: flex; align-items: center; gap: 6px; }
.bar-nav a { padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: .92rem; }
.bar-nav a[aria-current] { background: var(--paper-deep); }
.bar-nav .bar-new { background: var(--ink); color: var(--paper); }
.bar-nav .bar-me { padding: 0; }
/* Header icons: Files (for people with agents, whose bottom tab is Agents) and the bell: To do, with a red dot while
   something is waiting */
.bar-nav .bar-icon { position: relative; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; color: var(--ink); }
.bell-dot { position: absolute; top: 7px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--vermilion); box-shadow: 0 0 0 2px var(--paper); }
/* A thin bar along the top while a page loads for the first time */
body.loading .bar::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 30%; height: 2px; background: var(--vermilion); animation: loading 1s ease-in-out infinite; }
@keyframes loading { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.tabs { display: none; }

@media (max-width: 720px) {
  .bar-nav a:not(.bar-me):not(.bar-icon) { display: none; }
  .tabs {
    position: fixed; inset: auto 0 0; z-index: 20;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tabs a { display: grid; justify-items: center; gap: 2px; padding: 4px 0; font-size: .7rem; font-weight: 600; color: var(--ink-soft); }
  .tabs a[aria-current] { color: var(--ink); }
  .tab-icon { width: 24px; height: 24px; }
  .tab-new .tab-icon { width: 40px; height: 26px; border-radius: 999px; background: var(--ink); color: var(--paper); display: grid; place-items: center; }
}
@media (min-width: 721px) { body { padding-bottom: 40px; } }

.app { width: min(100% - 32px, 960px); margin: 0 auto; padding: 20px 0 32px; display: grid; gap: 22px; }
.app > *, .section > *, .docs > *, .stack > *, .next > *, .doc-file > span { min-width: 0; }
.loading { color: var(--ink-soft); }

/* Building blocks */
.card { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.stack { display: grid; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form { gap: 16px; }
.form.card h2 { margin-top: 4px; }
.section { display: grid; gap: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: .8rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
/* A customer's cars, one group per role: Selling, Buying. */
.car-group { display: grid; gap: 8px; }
.car-group + .car-group { margin-top: 6px; }
.empty { padding: 16px; border: 1px dashed var(--line); border-radius: 14px; color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: .82rem; }
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-head > .button { margin-left: auto; }
.hello { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-link { font-size: .9rem; }
.button.car-action { height: 36px; padding: 0 14px; }
.link-button { padding: 4px 0; border: 0; background: none; color: var(--ink); font-weight: 600; font-size: .86rem; border-bottom: 1px solid var(--vermilion); cursor: pointer; justify-self: start; }
.danger-text { color: var(--vermilion-deep); }
.icon-button { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 999px; font-weight: 600; font-size: .84rem; background: var(--surface); }
.icon-button:hover { border-color: var(--ink); }

select, textarea, input:not([type]), input[type="number"], input[type="date"], input[type="tel"], input[type="search"] {
  width: 100%; min-height: 50px; padding: 0 14px; border: 1.5px solid rgba(14, 59, 67, .24); border-radius: 12px;
  background: var(--surface); color: var(--ink); font-size: 1rem;
}
textarea { padding: 12px 14px; resize: vertical; min-height: 64px; }
select:focus, textarea:focus, input:not([type]):focus, input[type="search"]:focus, input[type="date"]:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 4px rgba(14, 59, 67, .12); }
.search-input.big { min-height: 56px; font-size: 1.05rem; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: .92rem; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 50; transform: translateX(-50%);
  max-width: min(92vw, 420px); padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--paper); font-weight: 600; font-size: .9rem;
  box-shadow: 0 10px 30px rgba(10, 44, 50, .25);
}
.banner { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--ink); color: var(--paper); font-weight: 600; }

/* Logos, avatars, plates, pills */
.logo { flex: none; border-radius: 10px; object-fit: contain; background: var(--surface); border: 1px solid var(--line); }
.logo-sm { width: 36px; height: 36px; border-radius: 9px; }
.logo-md { width: 44px; height: 44px; }
.logo-lg { width: 56px; height: 56px; border-radius: 14px; }
.logo-xl { width: 72px; height: 72px; border-radius: 18px; }
.logo-mono, .logo-self { display: grid; place-items: center; font: 700 .95rem var(--display); color: var(--paper); border: 0; }
.logo-lg.logo-mono, .logo-xl.logo-mono { font-size: 1.3rem; }
.logo-self { background: var(--paper-deep); color: var(--ink-soft); }
.avatar { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; font: 700 .85rem var(--display); color: var(--paper); }
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.tone-0 { background: var(--ink); }
.tone-1 { background: var(--vermilion-deep); }
.tone-2 { background: var(--ink-soft); }
.tone-3 { background: var(--ramp-4); }
.tone-4 { background: var(--ink-deep); }
.plate {
  flex: none; display: inline-block; padding: 2px 7px; border: 1.5px solid var(--ink); border-radius: 6px; background: var(--surface);
  font: 700 .8rem var(--mono); letter-spacing: .04em; white-space: nowrap;
}
.plate-none { border-style: dashed; color: var(--ink-soft); font-weight: 500; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font: 700 .7rem var(--mono); letter-spacing: .03em; white-space: nowrap; background: var(--paper-deep); }
.pill-stage.s-0 { background: var(--amber); }
.pill-stage.s-1, .pill-stage.s-2, .pill-stage.s-3, .pill-stage.s-4 { background: var(--ramp-2); }
.pill-stage.s-5 { background: var(--ramp-4); color: var(--surface); }
.pill-stage.s-6, .pill-stage.s-7, .pill-stage.s-8, .pill-stage.s-9 { background: var(--ink); color: var(--paper); }
.pill-done { background: var(--ink-deep); color: var(--paper); }
.pill-dropped { background: transparent; border: 1px solid var(--ink-soft); color: var(--ink-soft); }

/* Car rows */
.cars { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden; }
.car { display: flex; align-items: center; gap: 8px; padding-right: 12px; }
.car + .car { border-top: 1px solid var(--line); }
.car-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 11px 4px 11px 14px; }
.car-link:hover .car-name { text-decoration: underline; text-decoration-color: var(--vermilion); }
.car-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.car-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.car-name { font-weight: 600; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.car-sub { min-width: 0; }
.car-sub, .car-last { font-size: .84rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.car-last { font-size: .8rem; }
.car-side { display: grid; justify-items: end; gap: 6px; flex: none; }
.car-time { font-size: .74rem; color: var(--ink-soft); }

/* Businesses and people */
.businesses { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.businesses.wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.business { display: grid; justify-items: start; gap: 8px; height: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.business:hover { border-color: var(--ink); }
.business-name { font: 700 1rem var(--display); }
.business-meta { font-size: .8rem; color: var(--ink-soft); }
.people { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.person + .person { border-top: 1px solid var(--line); }
.tree .person { padding-left: calc(14px + var(--depth, 0) * 26px); }
.person-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.person-name { font-weight: 600; }
.person-sub { font-size: .8rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; }
.person-count { font-size: .8rem; color: var(--ink-soft); white-space: nowrap; }
.menu summary { cursor: pointer; font-size: .84rem; font-weight: 600; list-style: none; border-bottom: 1px solid var(--vermilion); }
.menu[open] .menu-body { position: absolute; right: 16px; z-index: 5; display: grid; gap: 10px; width: 240px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 10px 30px rgba(10, 44, 50, .15); }

/* New car */
.choices { display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; font-weight: 600; }
.choice.on { border-color: var(--ink); background: var(--paper); }
.choice input { accent-color: var(--ink); }
.opt { display: inline-flex; align-items: center; gap: 10px; }
.logo-picks { display: flex; flex-wrap: wrap; gap: 10px; }
.logo-pick { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border: 1.5px solid var(--line); border-radius: 16px; background: var(--surface); font-weight: 600; cursor: pointer; }
.logo-pick.on { border-color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); background: var(--paper); }
.picker { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pick { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: var(--paper); text-align: left; cursor: pointer; }
.pick small, .picked small { display: block; }
.picked { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--paper); }
.picked > span { flex: 1; }

/* Car page */
.car-head { display: grid; gap: 10px; }
.car-head-top { display: flex; align-items: center; gap: 10px; }
.car-head .plate { font-size: 1rem; padding: 4px 10px; }
.car-head-sub { color: var(--ink-soft); }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.who-item { display: inline-flex; align-items: center; gap: 10px; }
.who-item small, .who-item strong { display: block; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.assign select { min-height: 42px; border-radius: 999px; font-weight: 600; font-size: .9rem; width: auto; }
.stepper { list-style: none; margin: 0; padding: 4px 0 2px; display: flex; overflow-x: auto; scrollbar-width: none; }
.stepper li { flex: 1 0 64px; display: grid; justify-items: center; gap: 6px; position: relative; font-size: .7rem; color: var(--ink-soft); }
.stepper li::before { content: ""; position: absolute; top: 6px; left: -50%; right: 50%; height: 2px; background: var(--line); }
.stepper li:first-child::before { display: none; }
.stepper li.done::before, .stepper li.now::before { background: var(--ink); }
.dot { position: relative; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: var(--paper); }
.stepper .done .dot { background: var(--ink); border-color: var(--ink); }
.stepper .now .dot { border-color: var(--vermilion); background: var(--amber); box-shadow: 0 0 0 4px rgba(242, 179, 61, .3); }
.stepper .now { color: var(--ink); font-weight: 700; }
.step-label { white-space: nowrap; }
.next { display: grid; gap: 12px; border-color: var(--ink); }
.send { display: grid; gap: 14px; border-color: var(--ink); }
.drop { border-top: 1px solid var(--line); padding-top: 10px; }
.drop .field { flex: 1 1 200px; }
.emi { font-weight: 600; color: var(--ink); }
.details { display: grid; gap: 10px; }
.detail { padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); display: grid; gap: 10px; }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
dl { margin: 0; display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 6px 16px; font-size: .92rem; }
dt { color: var(--ink-soft); }
dd { margin: 0; font-weight: 600; }

.docs { display: grid; gap: 12px; }
.doc-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.doc-checks li { padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.doc-checks .have { background: var(--ink); color: var(--paper); }
.doc-checks .missing { border: 1px dashed var(--ink-soft); color: var(--ink-soft); }
.doc-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.doc-list li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.doc-list li + li { border-top: 1px solid var(--line); }
.doc-file { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.doc-file strong, .doc-file small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-type { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--paper-deep); font: 700 .66rem var(--mono); }
.upload { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.upload .field { flex: 1 1 200px; }
.file-button { position: relative; cursor: pointer; }

.note-form { display: grid; gap: 8px; margin-bottom: 8px; }
.note-form .button { justify-self: start; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); display: grid; gap: 14px; }
.ev { position: relative; display: grid; gap: 2px; }
.ev::before { content: ""; position: absolute; left: -24px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--paper-deep); border: 2px solid var(--ink-soft); }
.ev-stage::before, .ev-sent::before, .ev-received::before { background: var(--amber); border-color: var(--vermilion); }
.ev-note .ev-text { padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; }
.ev-text { font-size: .92rem; }
.ev-meta { font-size: .76rem; color: var(--ink-soft); }

/* Business page */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--paper-deep); justify-self: start; }
.seg a { flex: 1 1 auto; padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: .9rem; text-align: center; white-space: nowrap; }
.seg a.on { background: var(--surface); box-shadow: 0 1px 3px rgba(10, 44, 50, .12); }
/* Chips wrap onto more lines rather than scrolling sideways out of sight: every option stays visible. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { flex: none; padding: 7px 13px; border: 1.5px solid var(--line); border-radius: 999px; font-weight: 600; font-size: .84rem; background: var(--surface); }
.chip.on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.logo-set { display: flex; align-items: center; gap: 18px; }
.logo-set > div { display: grid; gap: 8px; justify-items: start; }

/* Inbox */
.inbox { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.inbox-item { display: grid; grid-template-columns: 88px 1fr; gap: 14px; align-items: start; }
.thumb { display: grid; place-items: center; width: 88px; height: 110px; border-radius: 12px; overflow: hidden; background: var(--paper-deep); font: 700 .8rem var(--mono); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 520px) {
  .card { padding: 16px; }
  .car-link { padding-left: 12px; gap: 10px; }
  .car-side .pill { font-size: .66rem; }
  .inbox-item { grid-template-columns: 1fr; }
  dl { grid-template-columns: 1fr 1fr; }
}

/* Car photos */
/* A car's photos: one fixed-height strip that swipes, one photo at a time */
.carousel { position: relative; border-radius: 16px; overflow: hidden; background: var(--paper-deep); }
.carousel-track { list-style: none; margin: 0; padding: 0; display: flex; height: clamp(200px, 58vw, 360px); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.carousel-track::-webkit-scrollbar { display: none; }
.slide { position: relative; flex: 0 0 100%; scroll-snap-align: center; }
.slide-link { display: grid; place-items: center; width: 100%; height: 100%; font: 700 .8rem var(--mono); }
.slide-link img { width: 100%; height: 100%; object-fit: cover; }
.slide .photo-remove { top: 10px; right: 10px; }
.carousel-count { position: absolute; left: 10px; bottom: 10px; padding: 3px 9px; border-radius: 999px; background: rgba(10, 44, 50, .7); color: var(--paper); font: 600 .76rem var(--mono); }
.carousel-arrow { position: absolute; top: 50%; translate: 0 -50%; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .85); color: var(--ink); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.carousel-arrow.prev { left: 8px; }
.carousel-arrow.next { right: 8px; }
.photos { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.photos li { position: relative; }
.photo { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--paper-deep); font: 700 .74rem var(--mono); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-remove { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 1rem; line-height: 1; cursor: pointer; }
.photos-public { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.section-head .menu { position: relative; }
.section-head .menu[open] .menu-body { right: 0; top: 28px; width: min(300px, 80vw); }

/* Follow-ups, duplicates and team-only information */
.car-due { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.car-due.due { color: var(--vermilion-deep); }
.card.warn { border-color: var(--amber); display: grid; gap: 10px; }
.followup { display: grid; gap: 6px; }
.team-only { margin-left: 6px; padding: 1px 6px; border-radius: 999px; font: 700 .62rem var(--mono); letter-spacing: .04em; text-transform: uppercase; background: var(--paper-deep); color: var(--ink-soft); vertical-align: middle; }
.ev-internal .ev-text { border-style: dashed; border-color: var(--ink-soft); }

/* Reports */
.report-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.report-head .field { min-width: 200px; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { display: grid; gap: 2px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.tile-label { font: 700 .68rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.tile-value { font: 700 1.5rem var(--display); }
.tile-sub { font-size: .8rem; color: var(--ink-soft); }
.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.funnel-row { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 10px; font-size: .88rem; }
.funnel-label { font-weight: 600; }
.funnel-bar { height: 10px; border-radius: 999px; background: var(--paper-deep); overflow: hidden; }
.funnel-bar span { display: block; height: 100%; border-radius: inherit; background: var(--vermilion); }
.funnel-count { color: var(--ink-soft); white-space: nowrap; min-width: 4ch; text-align: right; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.report { width: 100%; border-collapse: collapse; font-size: .88rem; }
.report th, .report td { padding: 10px 12px; text-align: left; white-space: nowrap; }
.report thead th { font: 700 .68rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.report tbody tr { border-top: 1px solid var(--line); }
.report tbody th { font-weight: 600; }

/* Key facts on a car */
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 0; }
.facts div { padding: 6px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.facts dt { font: 700 .62rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.facts dd { margin: 0; font-weight: 600; }

/* Where the file is, and its Update button */
.card.now { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.card.now > div { display: grid; gap: 4px; }
.fab {
  position: fixed; right: max(16px, calc((100% - 960px) / 2)); bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 15;
  padding: 14px 22px; border: 0; border-radius: 999px; background: var(--ink); color: var(--paper);
  font-weight: 700; box-shadow: 0 8px 24px rgba(14, 59, 67, .28); cursor: pointer;
}
@media (max-width: 720px) { .fab { bottom: calc(84px + env(safe-area-inset-bottom)); } }

/* The Update panel: a sheet from the bottom on phones, a dialog on wider screens. The title and the Save and Cancel
   buttons stay put and only the middle scrolls. */
.sheet {
  width: min(640px, 100% - 32px); max-height: min(88dvh, 900px); padding: 0; border: 1px solid var(--line); border-radius: 20px;
  background: var(--paper); color: var(--ink); overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; }
.sheet::backdrop { background: rgba(14, 30, 34, .45); }
.sheet-form { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.sheet-head { flex: none; display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px; display: grid; gap: 14px; align-content: start; }
.sheet textarea { width: 100%; }
.sheet-actions { flex: none; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); }
@media (max-width: 720px) {
  .sheet { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0; }
}

/* A business's cars: search and person filter */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters .search-input { flex: 1 1 260px; }
.filters .field { flex: 0 1 240px; }

/* Setup checklist and join link */
.setup { display: grid; gap: 10px; border-color: var(--amber); }
.setup-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.setup-steps li { display: grid; gap: 2px; }
.setup-steps { list-style: none; padding-left: 0; }
.setup-steps li.done { color: var(--ink-soft); font-size: .9rem; }
.link-box { padding: 10px 12px; border-radius: 10px; background: var(--paper-deep); font-size: .8rem; overflow-wrap: anywhere; }
.join { justify-items: center; text-align: center; max-width: 460px; margin: 24px auto; }
a.tile { color: inherit; text-decoration: none; }
a.tile:hover { border-color: var(--ink-soft); }
.tiles > li { display: grid; }
@media (max-width: 720px) { .toast { bottom: calc(150px + env(safe-area-inset-bottom)); } }

/* Sort shared files, and files waiting for approval */
.car-picks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.car-pick { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; }
.car-pick.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.car-pick input { accent-color: var(--ink); }
.car-pick .car-main { flex: 1; min-width: 0; }
.file-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.file-card { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.file-card.off { opacity: .55; }
.file-thumb { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 12px; overflow: hidden; background: var(--paper-deep); font: 700 .8rem var(--mono); color: var(--ink-soft); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-meta { display: grid; gap: 6px; min-width: 0; align-content: start; }
.file-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sorter-actions { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); padding: 12px 0; background: linear-gradient(transparent, var(--paper) 30%); }
@media (min-width: 721px) { .sorter-actions { bottom: 0; } }
#approve, #due, #pickup, #send { scroll-margin-top: 80px; }

/* Simple means less on screen, not bigger: one main action, and quiet folded sections for everything else. */
.big-action { justify-content: center; }
.person.faded { opacity: .55; }
.fold { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.fold > summary { list-style: none; display: grid; grid-template-columns: 1fr auto; column-gap: 12px; row-gap: 2px; align-items: center; padding: 16px 18px; cursor: pointer; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: "▾"; grid-column: 2; grid-row: 1 / span 2; font-size: 1.5rem; line-height: 1; color: var(--ink-soft); transition: transform .15s; }
.fold[open] > summary::after { transform: rotate(180deg); }
.fold-title { grid-column: 1; font: 700 1.05rem var(--display); }
.fold-sum { grid-column: 1; font-size: .88rem; color: var(--ink-soft); }
.fold-body { padding: 0 18px 18px; display: grid; gap: 14px; }
.form .fold { background: var(--paper); }
.person-picker { display: grid; gap: 8px; }

/* Car cards on phones: nothing cut off or squeezed. The name gets its own line, details wrap, and the card's one
   button sits full width underneath. */
@media (max-width: 560px) {
  .car { flex-wrap: wrap; padding-right: 0; }
  .car-link { flex: 1 1 100%; align-items: flex-start; padding-right: 14px; }
  .car-name, .car-sub, .car-last, .car-due { white-space: normal; }
  .car-top { flex-wrap: wrap; row-gap: 4px; }
  .car-side { align-self: flex-start; }
  .car-time { display: none; }
  .car > .car-action { flex: 1 1 100%; margin: -2px 14px 14px; }
}
/* Call and WhatsApp as round icons beside a person, on one line even on narrow phones (the name and details shorten) */
.call-row { display: inline-flex; gap: 8px; flex: none; }
.round-button { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1.5px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); }
.round-button svg { width: 18px; height: 18px; }
/* A row with Call and WhatsApp is cozier, so the whole name shows (on two lines if it must); its details shorten */
.person:has(> .call-row) { gap: 8px; padding: 10px 10px 10px 12px; }
.person:has(> .call-row) .round-button { width: 34px; height: 34px; }
.person:has(> .call-row) .call-row { gap: 6px; }
.person-main > .person-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-main > .person-name { overflow-wrap: anywhere; line-height: 1.25; }
.person-menu summary { display: grid; place-items: center; width: 22px; height: 34px; border: 0; color: var(--ink-soft); }
.person-menu summary::-webkit-details-marker { display: none; }
/* The last row of a car's People: Add customer, opening the name and mobile in place */
.add-person { display: block; }
.add-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 0; border: 0; background: none; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.add-avatar { background: var(--paper-deep); color: var(--ink); font-size: 1.2rem; }

/* Section tabs share the width on phones and shrink to fit, down to the narrowest screens. */
@media (max-width: 560px) {
  .seg { justify-self: stretch; }
  .seg a { flex: 1 1 0; min-width: 0; padding: 8px 4px; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; }
}
/* The step tracker on phones: the steps top to bottom, each a dot and its name, instead of a sideways strip. */
@media (max-width: 560px) {
  .stepper { flex-direction: column; overflow: visible; padding: 0; }
  .stepper li { flex: none; display: flex; align-items: center; gap: 12px; padding: 6px 0; font-size: .92rem; }
  .stepper li::before { display: none; }
  .step-label { white-space: normal; }
}
/* Two fields side by side on every screen, phones included (year and kilometres; engine and chassis numbers). */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair .field, .pair input { min-width: 0; }

/* The Update panel's step choices: chips, with "Other step" as a chip-shaped picker. */
.step-chips select { width: auto; height: auto; min-height: 0; padding: 7px 13px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 600; font-size: .84rem; color: var(--ink); }
.sheet textarea { min-height: 0; }

/* The business a new car is added to */
.for-line { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.stack.tight { gap: 8px; }
/* Your phone number on the You page: icon, number, Edit, all on one line */
.phone-line { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.phone-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--paper-deep); color: var(--ink); }
.phone-number { flex: 1; min-width: 0; font-weight: 600; letter-spacing: .02em; }
.phone-line input { flex: 1; min-width: 0; }
.phone-line .notice { flex-basis: 100%; }
.phone-line:has(.notice) { flex-wrap: wrap; }
a.tile.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
@media (max-width: 560px) {
  .platform-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .platform-tiles .tile { padding: 10px 12px; }
  .platform-tiles .tile-value { font-size: 1.25rem; }
}
/* Agents: the latest things agents did, one line each */
.feed { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden; }
.feed li + li { border-top: 1px solid var(--line); }
.feed-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; color: inherit; text-decoration: none; }
.feed-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.feed-text { font-size: .92rem; overflow-wrap: anywhere; }
.feed-sub { font-size: .8rem; color: var(--ink-soft); }
/* The car page's Update button: a small round button floating at the bottom right */
.fab-icon { display: grid; place-items: center; width: 52px; height: 52px; padding: 0; }
.fab-icon svg { width: 22px; height: 22px; }
/* "Handled by: Nobody yet [Me]" under a business's car */
.handled { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.handled .button { margin-left: auto; }
.app:has(.fab) { padding-bottom: 96px; }
/* Notes on a car: small and close together. The add box grows as you type. */
.note-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.note-add textarea { flex: 1; min-width: 0; min-height: 0; padding: 9px 12px; resize: none; overflow: hidden; line-height: 1.4; }
.note-add .check { flex-basis: 100%; font-size: .82rem; }
.notes { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.note { padding: 9px 12px; display: grid; gap: 2px; }
.note + .note { border-top: 1px solid var(--line); }
.note-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: .76rem; color: var(--ink-soft); }
.note-meta strong { color: var(--ink); font-size: .8rem; }
.note-text { margin: 0; font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-team { background: var(--paper); }
/* A placeholder on the team list: added before they have an account */
.person.placeholder .avatar { opacity: .55; }
.onboard { margin-top: 4px; }
/* Money in: the agent's list, and the amount on the car for someone who put money in */
.money-total { text-align: right; font-size: .9rem; }
.money-mine { display: grid; gap: 2px; }
/* Add a car or customer: Save floats at the bottom of the screen, always in view (above the tab bar on phones), with
   room left under the form so it never covers the last box; picked photos show as small thumbnails */
.sticky-save { position: fixed; inset: auto 0 0; z-index: 15; width: min(100% - 32px, 960px); margin: 0 auto; padding: 18px 0 14px; background: linear-gradient(transparent, var(--paper) 30%); }
.form:has(> .sticky-save) { padding-bottom: 72px; }
@media (max-width: 720px) { .sticky-save { bottom: calc(62px + env(safe-area-inset-bottom)); padding-bottom: 10px; } }
/* Add a car: Contacts (Android's contact picker) on the right of the Customer label */
.contact-row { align-items: center; }
.contact-pick { gap: 6px; height: 34px; cursor: pointer; }
.contact-pick svg { width: 18px; height: 18px; }
.shots { display: flex; flex-wrap: wrap; gap: 6px; }
.shot { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
/* Share with bank: the panel, the links already sent, and the page a bank opens */
.bank-share { display: grid; gap: 10px; }
.doc-links, .doc-downloads { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.doc-links li, .doc-downloads li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.doc-links li + li, .doc-downloads li + li { border-top: 1px solid var(--line); }
.doc-dl-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.doc-dl-main small { color: var(--ink-soft); font-size: .8rem; overflow-wrap: anywhere; }
/* The public catalogue: a card per car, photo first */
.catalog { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.catalog-car { display: grid; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; color: inherit; text-decoration: none; }
.catalog-car img, .catalog-nophoto { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--paper-deep); }
.catalog-nophoto { display: grid; place-items: center; color: var(--ink-soft); font-size: .85rem; }
.catalog-main { display: grid; gap: 2px; padding: 10px 12px 12px; }
.catalog-main small { color: var(--ink-soft); }
.catalog-price { font: 700 1.1rem var(--display); }
.bank-row select { width: auto; height: auto; min-height: 0; padding: 4px 8px; font-size: .84rem; }
.bank-row { gap: 8px; font-size: .86rem; }
/* Updates under the bell: new ones marked with a dot until To do has been opened */
.notice-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: transparent; }
.feed-item.unread .notice-dot { background: var(--vermilion); }
.feed-item.unread .feed-text { font-weight: 600; }

/* The Add menu, from "+": what to add. A sheet from the bottom on phones, a small dialog on computers. */
.add-items { list-style: none; margin: 0; padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); display: grid; gap: 2px; }
.add-item { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 14px; color: var(--ink); text-decoration: none; }
.add-item:hover, .add-item:focus-visible { background: var(--surface); }
.add-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
@media (min-width: 721px) { .add-menu { width: min(420px, 100% - 32px); } }
.person > .grow { flex: 1 1 100%; }

/* The two main buttons on a car or a customer: Update and Share (or Call, WhatsApp and Share). */
.car-actions { display: flex; gap: 10px; }
.car-actions > * { flex: 1 1 0; min-width: 0; text-align: center; }
/* A customer's Call, WhatsApp and Share: small, with icons, sharing one row even on a narrow phone */
.contact-actions { gap: 8px; }
.contact-actions > .button { flex: 1 1 auto; gap: 6px; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 360px) { .contact-actions > .button { gap: 4px; padding: 0 8px; font-size: .8rem; } .contact-actions svg { width: 15px; height: 15px; } }
/* Adding a mobile in place: on the customer's page, or under a person on a car */
.phone-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; flex: 1 1 100%; }
.phone-form > .notice { flex: 1 1 100%; }
.phone-form input { flex: 1 1 auto; min-width: 0; }
.person:has(> .phone-form) { flex-wrap: wrap; }
.person > .phone-form { padding-left: 38px; }
.contact-actions svg { flex: none; width: 17px; height: 17px; }
.form-actions { gap: 14px; }
@media (min-width: 721px) { .car-actions { max-width: 480px; } }
.button.danger { background: var(--vermilion-deep); border-color: var(--vermilion-deep); color: var(--paper); }

/* Picking cars: the title with a search beside it, and a short list (about four cars) that scrolls. */
.chooser-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chooser-head > :first-child { flex: none; white-space: nowrap; }
.chooser-head .search-input { flex: 1 1 auto; max-width: 260px; min-width: 0; min-height: 40px; }
.car-picks-short { max-height: 300px; overflow-y: auto; padding-right: 2px; } /* No overscroll containment: at its ends the swipe moves the page. */
/* A search icon beside a section title, opening to a box. */
.title-search { display: flex; align-items: center; gap: 6px; justify-content: flex-end; flex: 1 1 auto; min-width: 0; }
.title-search .search-input { flex: 1 1 auto; max-width: 260px; min-width: 0; min-height: 38px; }
.icon-only { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 999px; background: none; color: var(--ink-soft); font-size: 1.3rem; cursor: pointer; }
.icon-only:hover { background: var(--surface); color: var(--ink); }

/* A car in a list: the car icon, and the business's logo as a small badge in its bottom-right corner. */
.car-mark { position: relative; flex: none; display: inline-grid; }
.car-mark .logo-xs { position: absolute; right: -7px; bottom: -7px; width: 18px; height: 18px; border-radius: 5px; box-shadow: 0 0 0 2px var(--surface); }
.car-mark .logo-xs.logo-mono { font-size: .5rem; }
.title-search input::-webkit-search-cancel-button { display: none; } /* The × beside it closes the search. */
