/*
 * HubSpot Import - styles.
 * Order: tokens, base, app bar, layout, buttons, forms, alerts, upload, preview, dialog, security.
 * House rules: 5px corners, no shadows, hairline borders only where they separate content.
 */

/* Tokens ---------------------------------------------------------------------------------------------------- */

:root {
  --bg: #f4f5f7;
  --dots: #d6dae1;
  --surface: #ffffff;
  --surface-muted: #f4f5f7;
  --text: #1a1d23;
  --muted: #6b7280;
  --border: #e2e5ea;
  --border-strong: #c9ced6;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff4ff;
  --language-bg: #f3e8ff;
  --language-fg: #7e22ce;
  --success-bg: #d1fae5;
  --success-fg: #065f46;
  --warning-bg: #fef3c7;
  --warning-fg: #92400e;
  --danger-bg: #fef2f2;
  --danger-fg: #b91c1c;
  --radius: 5px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --dots: #262b34;
    --surface: #181b21;
    --surface-muted: #11141a;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --border: #2a2f38;
    --border-strong: #3a414d;
    --accent: #4f8cff;
    --accent-hover: #6b9fff;
    --accent-soft: #1a2333;
    --language-bg: #2a1f3d;
    --language-fg: #d8b4fe;
    --success-bg: #0f2e22;
    --success-fg: #6ee7b7;
    --warning-bg: #3a2a0c;
    --warning-fg: #fcd34d;
    --danger-bg: #3a1515;
    --danger-fg: #fca5a5;
  }
}

/* Base ------------------------------------------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle, var(--dots) 1px, transparent 1.5px) 0 0 / 18px 18px, var(--bg); /* dotted canvas around the panels */
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }
code { font-family: var(--mono); font-size: .92em; }
a { color: var(--accent); }
.icon { width: 16px; height: 16px; flex: none; }
.truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* App bar --------------------------------------------------------------------------------------------------- */

.appbar { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--border); } /* stays on top while scrolling */
.appbar-inner {
  max-width: 1432px; margin: 0 auto; padding: 0 16px; height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 650; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; color: #fff; background: var(--accent); border-radius: var(--radius); }
.brand-mark .icon { width: 17px; height: 17px; }
.appbar-nav { display: flex; align-items: center; gap: 6px; }
.appbar-nav form { margin: 0; }
.nav-link { /* a link or a button, one look */
  display: inline-flex; align-items: center; gap: 7px; height: 40px; margin: 0; padding: 0 12px; cursor: pointer;
  font: 500 14px/1 var(--font); color: var(--text); text-decoration: none; background: none; border: 0; border-radius: var(--radius);
}
.nav-link:hover { background: var(--surface-muted); }
.nav-link .icon { color: var(--muted); }
@media (max-width: 520px) { /* phones: the app bar shows icons; the words stay for screen readers */
  .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .appbar-nav .nav-link { width: 40px; padding: 0; justify-content: center; }
}

/* Layout ---------------------------------------------------------------------------------------------------- */

.main { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 16px; padding: 16px 16px 32px; } /* one spacing: 16px above, between and beside blocks */
.main > * { width: 100%; max-width: 1400px; min-width: 0; }
.divider-v { align-self: stretch; width: 1px; margin: -16px 0; background: var(--border); flex: none; } /* the full height of its 16px-padded bar */

/* Buttons --------------------------------------------------------------------------------------------------- */

.btn {
  height: 40px; padding: 0 16px; margin: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 500 14px/1 var(--font); color: var(--text); white-space: nowrap; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-muted); border-color: var(--border-strong); }
.btn:focus-visible, .link-button:focus-visible, .nav-link:focus-visible, .brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn .icon { color: var(--muted); }
.btn-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn-primary .icon { color: currentColor; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger-fg); }
.btn-danger:hover { color: var(--danger-fg); background: var(--danger-bg); border-color: var(--danger-fg); }
.btn-block { width: 100%; height: 50px; font-size: 15px; font-weight: 600; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; font-weight: 600; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm { height: 30px; padding: 0 10px; gap: 6px; font-size: 13px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn:disabled { opacity: .6; pointer-events: none; }
.link-button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }

/* Cards and forms ------------------------------------------------------------------------------------------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.card-title { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.card-subtitle { margin-top: 4px; font-size: 14px; color: var(--muted); }
.form { display: grid; gap: 18px; }

.field { display: grid; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { font-size: 13px; font-weight: 600; }
.label-code { font-family: var(--mono); }
.label-hint { margin-left: 6px; font-weight: 400; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); }
.hint-icon { display: flex; align-items: center; gap: 8px; }

input[type=text], input[type=password], textarea {
  width: 100%; padding: 11px 12px; font: inherit; color: var(--text);
  background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s;
}
input[type=text]:focus, input[type=password]:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { font: 13px/1.6 var(--mono); resize: vertical; }

@media (max-width: 520px) {
  .card { padding: 24px 20px; }
  .field-row { grid-template-columns: 1fr; }
}

/* Alerts and notices ---------------------------------------------------------------------------------------- */

.alert { padding: 12px 14px; font-size: 14px; border-radius: var(--radius); }
.alert-error { color: var(--danger-fg); background: var(--danger-bg); }
.alert-warning { color: var(--warning-fg); background: var(--warning-bg); }
.alert-success { color: var(--success-fg); background: var(--success-bg); }

.notice {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.notice-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: none; color: var(--accent); background: var(--accent-soft); border-radius: var(--radius); }
.notice-icon .icon { width: 19px; height: 19px; }
.notice-icon.is-success { color: var(--success-fg); background: var(--success-bg); }
.notice-icon.is-warning { color: var(--warning-fg); background: var(--warning-bg); }
.notice-icon.is-error { color: var(--danger-fg); background: var(--danger-bg); }
.notice-text { flex: 1; display: grid; gap: 1px; min-width: 0; font-size: 13px; color: var(--muted); }
/* One title style everywhere - the notices': 14px semibold in the text colour. */
.notice-text strong, .step-title, .panel-title, .page-title, .setting-text h2, .dialog-head h2, .busy-head strong { font-size: 14px; font-weight: 600; color: var(--text); }
@media (max-width: 520px) { .notice { flex-wrap: wrap; } .notice .btn { width: 100%; } }

/* Upload ---------------------------------------------------------------------------------------------------- */

.upload-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.upload-step { display: grid; grid-template-rows: auto 1fr; gap: 16px; padding: 24px 20px 28px 16px; min-width: 0; }
.upload-step + .upload-step { border-left: 1px solid var(--border); }
.step-title { display: flex; align-items: center; gap: 10px; }
.step-number {
  width: 24px; height: 24px; display: grid; place-items: center; flex: none;
  font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: var(--radius);
}
.upload-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px 16px 16px; border-top: 1px solid var(--border);
}
.upload-footer .alert { flex: 1; }
@media (max-width: 860px) {
  .upload-body { grid-template-columns: 1fr; }
  .upload-step + .upload-step { border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 520px) {
  .upload-footer { flex-direction: column; align-items: stretch; }
}

.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  justify-content: center; min-height: 220px; padding: 30px 16px; border: 2px dashed var(--border); border-radius: var(--radius);
  font-weight: 400; cursor: pointer; transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone:focus-within, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); } /* focus shows on the dashed border, no second outline */
.dropzone .icon { width: 36px; height: 36px; color: var(--accent); }
.dropzone strong { font-size: 15px; }
.dropzone span { font-size: 13px; color: var(--muted); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.utm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-wide { grid-column: 1 / -1; }
@media (max-width: 520px) { .utm-grid { grid-template-columns: 1fr; } }

/* Preview: header and summary ------------------------------------------------------------------------------- */

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: clip; } /* clip: never scrolled sideways, not even by focus or scrollIntoView */
.panel-header {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px;
  padding: 16px 20px 16px 16px; border-bottom: 1px solid var(--border);
}
.panel-heading { display: flex; align-items: center; gap: 16px; min-width: 0; }
.panel-titles { display: grid; gap: 2px; min-width: 0; }
.panel-subtitle { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--muted); } /* one line: a long file name gets an ellipsis (a sentence still wraps) */
.panel-subtitle .truncate { max-width: 60ch; }
.panel-subtitle .truncate:first-of-type { flex-shrink: 100; } /* the file name gives way, the UTM ID stays whole */
.panel-subtitle .icon { width: 14px; height: 14px; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
/* Tablet and phone: the buttons get their own row under the title, divided by a line across the whole panel. */
@media (max-width: 1100px) {
  .panel-actions { flex: 1 0 calc(100% + 36px); margin: 2px -20px -16px -16px; padding: 16px 20px 16px 16px; border-top: 1px solid var(--border); }
}
@media (max-width: 640px) { .panel-actions .btn { flex: 1 1 auto; } } /* buttons share the width */

/* Outcome of the last test run or import: a solid band in the outcome's colour on top of the blue one, in its style -
   white text, the counters as its four columns with the same dividers. Problems or the request under the text. */
.result { --band: var(--accent); display: grid; color: #fff; background: var(--band); }
.result + .result { border-top: 1px solid rgba(255, 255, 255, .18); }
.result.is-success { --band: #047857; }
.result.is-info { --band: #1e40af; }
.result.is-warning { --band: #b45309; }
.result.is-error { --band: #dc2626; }
.result .notice-icon { color: #fff; background: rgba(255, 255, 255, .16); }
.result .notice-text { color: rgba(255, 255, 255, .82); }
.result .notice-text strong { font-size: 16px; font-weight: 650; letter-spacing: -.01em; color: #fff; }
.result-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px 16px 16px; }
.result-head .notice-text span { overflow-wrap: anywhere; }
.result-close { width: 36px; height: 36px; display: grid; place-items: center; flex: none; margin: -4px -8px -4px 0; color: #fff; background: none; border: 0; border-radius: var(--radius); opacity: .8; cursor: pointer; transition: opacity .15s, background-color .15s; }
.result-close:hover { opacity: 1; background: rgba(255, 255, 255, .14); }
.result-close .icon { width: 18px; height: 18px; }
.result-warning { font-weight: 600; color: #fff; }
.result-list, .result-request { margin: 0 20px 16px 68px; } /* under the text */
.result-list { padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.result-request summary { width: fit-content; font-size: 13px; text-decoration: underline; cursor: pointer; }
.result-request pre {
  margin: 10px 0 0; max-height: 360px; overflow: auto; padding: 12px 14px;
  font: 12px/1.5 var(--mono); background: rgba(0, 0, 0, .22); border-radius: var(--radius);
}
/* The counters line up with the blue band's columns: a big figure over its label. */
.result-counters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-top: 1px solid rgba(255, 255, 255, .18); }
.result-counters div { display: flex; flex-direction: column-reverse; gap: 2px; min-width: 0; padding: 14px 20px 14px 16px; }
.result-counters div + div { border-left: 1px solid rgba(255, 255, 255, .18); } /* at most four: one row */
.result-counters dt { font-size: 12px; color: rgba(255, 255, 255, .82); }
.result-counters dd { margin: 0; font-size: 22px; font-weight: 650; line-height: 1.2; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .result-counters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-counters div:nth-child(odd) { border-left: 0; }
  .result-counters div:nth-child(n + 3) { border-top: 1px solid rgba(255, 255, 255, .18); }
  .result-counters div:last-child:nth-child(odd) { grid-column: 1 / -1; } /* an odd last one spans the row, as in the blue band */
}
@media (max-width: 520px) { /* phones: the counters below each other, figure and label on one line */
  .result-counters { grid-template-columns: minmax(0, 1fr); }
  .result-counters div { flex-direction: row-reverse; justify-content: flex-end; align-items: baseline; gap: 10px; padding: 10px 20px 10px 16px; }
  .result-counters div + div { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .18); }
  .result-counters dd { font-size: 18px; }
  .result .notice-text strong { font-size: 14px; }
  .result-list, .result-request { margin-left: 16px; }
  .result-head { flex-wrap: wrap; }
  .result-head > .btn { width: 100%; }
}

/* Column titles in the button blue: what each of the four columns below holds, its figures in the note. */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); color: #fff; background: var(--accent); }
.kpi { display: grid; align-content: start; gap: 3px; padding: 16px 20px 16px 16px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid rgba(255, 255, 255, .18); }
.kpi-title { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
@media (max-width: 520px) { .kpi-title { font-size: 14px; } }
.kpi-note { font-size: 12px; color: rgba(255, 255, 255, .8); }
@media (max-width: 1100px) { /* tablets: three columns, the photos are in the opened account */
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { display: none; }
}
@media (max-width: 760px) { /* two columns, like the rows: language and cars under the account, the company beside both */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2) { grid-row: span 2; }
  .kpi:nth-child(3) { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .18); }
}
@media (max-width: 520px) { /* phones: one column */
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .kpi:nth-child(2) { grid-row: auto; }
  .kpi + .kpi { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .18); }
}

/* Preview: company rows ------------------------------------------------------------------------------------- */

.company + .company { border-top: 1px solid var(--border); }
/* One row per account in the four columns of the figures on top - account, HubSpot company, language and cars,
   thumbnails - with the same dividers and insets, so every column starts exactly under its figure's text. */
.company summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); cursor: pointer; list-style: none; }
.quarter { display: flex; align-items: center; gap: 16px; min-width: 0; padding: 16px 20px 16px 16px; }
.quarter + .quarter { border-left: 1px solid var(--border); }
.company summary::-webkit-details-marker { display: none; }
.company summary:focus { outline: none; }
.chevron { flex: none; width: 24px; height: 24px; display: grid; place-items: center; }
.chevron::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .15s;
}
.company[open] .chevron::before { transform: rotate(45deg); }
/* Account and HubSpot company: the value, with a small caption under it. */
.cell { flex: 1; display: grid; min-width: 0; line-height: 1.35; }
.cell-main, .cell-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-main { font-size: 14px; font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--muted); }
.cell-none { font-weight: 500; color: var(--muted); }
.quarter.tags { gap: 8px; }
.tag { padding: 2px 8px; font-size: 12px; white-space: nowrap; border-radius: var(--radius); }
.tag-cars { color: var(--accent); background: var(--accent-soft); }
.tag-language { color: var(--language-fg); background: var(--language-bg); }
.quarter.thumbs { gap: 6px; }
.thumbs img { width: calc((100% - 30px) / 6); max-width: 56px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); } /* six always fit */
@media (max-width: 1100px) { /* like the titles: three columns */
  .company summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quarter.thumbs { display: none; }
}
@media (max-width: 760px) { /* two columns: language and cars under the account, the company beside both */
  .company summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quarter:first-child { padding-bottom: 8px; }
  .quarter:nth-child(2) { grid-row: span 2; align-items: flex-start; } /* so its divider runs the full height */
  .quarter.tags { padding: 0 20px 16px 56px; border-left: 0; } /* under the account's text, past the chevron */
}
@media (max-width: 520px) { /* phones: one column - the company and the tags under the account's text */
  .company summary { grid-template-columns: minmax(0, 1fr); }
  .quarter:nth-child(2) { grid-row: auto; padding: 0 20px 8px 56px; border-left: 0; }
}

/* Sections when some accounts are not in HubSpot: icon, title and note, then the rows. */
.company-group + .company-group { border-top: 1px solid var(--border); }
.group-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px 16px 16px; border-bottom: 1px solid var(--border); }

/* Preview: an opened account - its cars one under another, divided by hairlines, in the same four columns: the
   photo (full height) under the account, headline, PNO and last update under the next three, details and links
   across those three. Values sit under plain labels; the HubSpot property name shows on hover. */

.company-body { border-top: 1px solid var(--border); }
.car { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.car + .car { border-top: 1px solid var(--border); }
.car-photo { position: relative; min-height: 220px; margin: 16px 20px 16px 16px; overflow: hidden; background: var(--surface-muted); border-radius: var(--radius); }
.car-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
/* The photo opens the lightbox: a slight zoom and an expand mark on hover (always shown on touch screens). */
.car-photo, .thumbs img { cursor: zoom-in; }
.car-photo:hover img { transform: scale(1.04); }
.car-photo-zoom { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; display: grid; place-items: center; color: #fff; background: rgba(17, 24, 39, .72); border-radius: var(--radius); opacity: 0; transition: opacity .2s; }
.car-photo:is(:hover, :focus-visible) .car-photo-zoom { opacity: 1; }
.badge { position: absolute; top: 8px; left: 8px; padding: 3px 9px; font-size: 12px; font-weight: 600; color: #fff; background: rgba(17, 24, 39, .72); border-radius: var(--radius); }

.properties {
  grid-column: 2 / -1; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px; background: var(--border); border-left: 1px solid var(--border); /* the 1px gaps are the table lines */
}
.properties div { min-width: 0; padding: 16px 20px 16px 16px; background: var(--surface); } /* a column's insets, as in the rows above */
.properties .wide { grid-column: 1 / -1; }
.properties dt { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.properties dd { margin: 5px 0 0; font-size: 14px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.prop-url dd { display: flex; align-items: center; gap: 12px; padding: 5px 5px 5px 12px; background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius); } /* the links, as fields */
.prop-url dd span { flex: 1; min-width: 0; }
/* "Open" shows on hover (or keyboard focus); always on touch screens, which have no hover. */
.prop-url .btn-sm { opacity: 0; background: var(--surface); transition: opacity .15s, border-color .15s; }
.prop-url dd:is(:hover, :focus-within) .btn-sm { opacity: 1; }
@media (hover: none) { .prop-url .btn-sm, .car-photo-zoom { opacity: 1; } }
@media (max-width: 520px) { /* phones: the Open button under the link */
  .prop-url dd { flex-direction: column; align-items: flex-start; gap: 10px; padding: 10px 12px; }
  .prop-url .btn-sm { opacity: 1; }
}

@media (max-width: 1100px) { /* three columns: headline across, PNO and last update under the other two */
  .car { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .properties { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .properties .prop-title { grid-column: 1 / -1; }
}
@media (max-width: 760px) { /* photo on top, values in two columns */
  .car { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px; }
  .car-photo { margin: 0; min-height: 0; aspect-ratio: 16 / 9; }
  .properties { grid-column: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; background: none; border-left: 0; }
  .properties div { padding: 0; background: none; }
  .properties .prop-title { grid-column: 1 / -1; }
}
@media (max-width: 520px) { /* phones: the values below each other too */
  .properties { grid-template-columns: minmax(0, 1fr); }
}

/* Confirmation dialog (opened and closed by the buttons' command attributes, no script) ----------------------- */

.dialog { width: min(520px, calc(100% - 32px)); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.dialog::backdrop { background: rgba(15, 17, 21, .5); }
/* Icon and title on one line, the text below across the full width. */
.dialog-body { display: grid; gap: 14px; padding: 24px 24px 0; }
.dialog-head { display: flex; align-items: center; gap: 14px; }
.dialog-text { display: grid; gap: 8px; }
.dialog-text p { font-size: 14px; color: var(--muted); }
.dialog-text strong { font-weight: 600; color: var(--text); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin: 8px -24px 0; padding: 16px 24px; border-top: 1px solid var(--border); }

/* Photo lightbox: an account's car photos, full screen. A native modal dialog (Esc closes); the arrows, arrow keys,
   swipes and the strip browse; a click beside the photo closes. ------------------------------------------------ */

html:has(.lightbox[open]) { overflow: hidden; } /* the page does not scroll behind it (no gutter: it would leave a strip uncovered) */
.lightbox {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  color: #fff; background: rgba(10, 12, 16, .96); backdrop-filter: blur(10px);
  opacity: 0; transition: opacity .2s, display .2s allow-discrete, overlay .2s allow-discrete;
}
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; opacity: 1; }
@starting-style { .lightbox[open] { opacity: 0; } }
.lightbox::backdrop { background: transparent; }
.lightbox :focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lightbox-bar { display: flex; align-items: center; gap: 6px; padding: 12px 12px 12px 24px; }
.lightbox-caption { flex: 1; display: grid; gap: 2px; min-width: 0; }
.lightbox-caption strong { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-caption span { font-size: 13px; color: rgba(255, 255, 255, .6); }
.lightbox-count { margin-right: 10px; font: 600 12px/1 var(--mono); color: rgba(255, 255, 255, .6); font-variant-numeric: tabular-nums; }
.lightbox-btn { width: 40px; height: 40px; display: grid; place-items: center; flex: none; color: #fff; background: none; border: 0; border-radius: var(--radius); cursor: pointer; transition: background-color .15s; }
.lightbox-btn:hover { background: rgba(255, 255, 255, .12); }
.lightbox-btn .icon { width: 20px; height: 20px; }
.lightbox-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 8px 96px; touch-action: pan-y pinch-zoom; user-select: none; }
.lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius); box-shadow: 0 30px 90px rgba(0, 0, 0, .6); transition: opacity .3s, transform .3s; }
.lightbox-stage[data-state="loading"] img { opacity: 0; transform: scale(.98); transition: none; }
.lightbox-stage[data-state="failed"] img { display: none; }
.lightbox-stage::after { content: ""; position: absolute; width: 34px; height: 34px; border: 2px solid rgba(255, 255, 255, .2); border-top-color: #fff; border-radius: 50%; opacity: 0; pointer-events: none; animation: busy-spin .7s linear infinite; }
.lightbox-stage[data-state="loading"]::after { opacity: 1; transition: opacity .2s .15s; } /* only for a slow photo */
.lightbox-failed { display: none; font-size: 14px; color: rgba(255, 255, 255, .7); }
.lightbox-stage[data-state="failed"] .lightbox-failed { display: block; }
.lightbox-nav { position: absolute; top: 50%; width: 52px; height: 52px; margin-top: -26px; display: grid; place-items: center; color: #fff; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); border-radius: 50%; cursor: pointer; transition: background-color .15s, border-color .15s; }
.lightbox-nav:hover { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .3); }
.lightbox-nav .icon { width: 24px; height: 24px; }
.lightbox-nav.is-prev { left: 22px; }
.lightbox-nav.is-next { right: 22px; }
.lightbox-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 14px 16px 24px; }
.lightbox-strip button { width: 76px; aspect-ratio: 3 / 2; padding: 0; overflow: hidden; background: rgba(255, 255, 255, .06); border: 0; border-radius: var(--radius); outline: 2px solid transparent; outline-offset: 2px; opacity: .45; cursor: pointer; transition: opacity .15s, outline-color .15s; }
.lightbox-strip button:hover { opacity: .85; }
.lightbox-strip button[aria-current="true"] { opacity: 1; outline-color: #fff; }
.lightbox-strip img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lightbox[data-single] :is(.lightbox-nav, .lightbox-strip, .lightbox-count) { display: none; }
@media (max-width: 760px) {
  .lightbox-bar { padding-left: 16px; }
  .lightbox-stage { padding: 0 12px; }
  .lightbox-nav { display: none; } /* swipe instead */
  .lightbox-strip { gap: 8px; }
  .lightbox-strip button { width: 46px; } /* six fit on a phone */
}

/* Working view while the server processes a form: data flowing from the file through the app to HubSpot, the
   server's stages and a clock. The blue grid is the sign-in screen's. --------------------------------------------- */

.busy {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; max-width: none; /* not capped like the page blocks */
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(4px);
}
.busy[hidden] { display: none; }
.busy-card { width: min(460px, 100%); overflow: clip; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

.busy-visual {
  position: relative; display: flex; align-items: center; height: 136px; padding: 0 40px; overflow: hidden; color: #fff;
  background:
    linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--accent);
  animation: busy-grid 3s linear infinite;
}
.busy-scan { position: absolute; inset: 0 0 auto; height: 45%; background: linear-gradient(transparent, rgba(255, 255, 255, .14), transparent); animation: busy-scan 2.6s ease-in-out infinite; }
.busy-node { position: relative; display: grid; place-items: center; flex: none; width: 46px; height: 46px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .3); border-radius: var(--radius); }
.busy-node .icon { width: 20px; height: 20px; }
.busy-node-core { width: 58px; height: 58px; color: var(--accent); background: #fff; border-color: #fff; }
.busy-node-core .icon { width: 26px; height: 26px; }
.busy-node-core::after { content: ""; position: absolute; inset: -1px; border: 1px solid #fff; border-radius: var(--radius); animation: busy-ping 1.6s ease-out infinite; }
.busy-link { position: relative; flex: 1; height: 2px; margin: 0 12px; background: rgba(255, 255, 255, .25); }
.busy-link i { position: absolute; top: -2px; left: 0; width: 6px; height: 6px; background: #fff; border-radius: 1px; opacity: 0; animation: busy-packet 1.5s linear infinite; }
.busy-link i:nth-child(2) { animation-delay: .5s; }
.busy-link i:nth-child(3) { animation-delay: 1s; }

.busy-body { display: grid; gap: 16px; padding: 20px 24px 22px; }
.busy-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.busy-clock { font: 600 12px/1 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.busy-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; font: 13px/1.4 var(--mono); color: var(--muted); }
/* Stage markers: an empty ring, a spinning blue ring, a blue disc with a white tick - or a red disc with a white
   cross when the stage failed. The tick and cross are icons, centred in the disc. */
.busy-steps li { display: flex; align-items: center; gap: 10px; transition: color .2s; }
.busy-steps li[data-state="active"], .busy-steps li[data-state="done"] { color: var(--text); }
.busy-steps li[data-state="failed"] { color: var(--danger-fg); }
.busy-mark { flex: none; display: grid; place-items: center; width: 18px; height: 18px; color: #fff; border: 2px solid var(--border-strong); border-radius: 50%; transition: background-color .2s, border-color .2s; }
.busy-mark .icon { grid-area: 1 / 1; width: 10px; height: 10px; stroke-width: 3.5; opacity: 0; }
[data-state="active"] > .busy-mark { border-color: var(--accent) var(--accent) var(--accent) transparent; animation: busy-spin .7s linear infinite; }
[data-state="done"] > .busy-mark { background: var(--accent); border-color: var(--accent); }
[data-state="failed"] > .busy-mark { background: var(--danger-fg); border-color: var(--danger-fg); }
[data-state="done"] > .busy-mark .icon:first-child, [data-state="failed"] > .busy-mark .icon:last-child { opacity: 1; }
.busy-bar { position: relative; height: 3px; overflow: hidden; background: var(--accent-soft); border-radius: 2px; }
.busy-bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 35%; background: var(--accent); animation: busy-bar 1.3s ease-in-out infinite; }
.busy-note { font-size: 12px; color: var(--muted); }
.busy-card:focus { outline: none; }

/* Finished: the pipeline stands still (complete when it went well), the bar fills, the outcome waits for a click. */
.busy-end { display: none; flex-direction: column; gap: 14px; } /* the outcome, then the button across the card */
.busy-end [hidden] { display: none; }
.busy-summary { font-size: 13px; color: var(--muted); }
.busy:is([data-state="done"], [data-state="failed"]) .busy-end { display: flex; }
.busy:is([data-state="done"], [data-state="failed"]) .busy-note,
.busy:is([data-state="done"], [data-state="failed"]) .busy-scan,
.busy:is([data-state="done"], [data-state="failed"]) .busy-link i { display: none; }
.busy:is([data-state="done"], [data-state="failed"]) .busy-visual { animation: none; }
.busy:is([data-state="done"], [data-state="failed"]) .busy-node-core::after { animation: none; opacity: 0; }
.busy[data-state="done"] .busy-link { background: #fff; }
.busy:is([data-state="done"], [data-state="failed"]) .busy-bar::before { width: 100%; animation: none; } /* always blue */
/* The outcome's colour in the title: green when it worked, amber when some rows failed - seen at a glance. */
.busy[data-state="done"][data-tone="success"] [data-title] { color: var(--success-fg); }
.busy[data-state="done"][data-tone="warning"] [data-title] { color: var(--warning-fg); }

@keyframes busy-grid { to { background-position: 24px 24px, 24px 24px, 0 0; } }
@keyframes busy-scan { from { transform: translateY(-100%); } to { transform: translateY(230%); } }
@keyframes busy-ping { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.55); } }
@keyframes busy-packet { 0% { left: 0; opacity: 0; } 15%, 85% { opacity: 1; } 100% { left: calc(100% - 6px); opacity: 0; } }
@keyframes busy-spin { to { transform: rotate(360deg); } }
@keyframes busy-bar { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@media (prefers-reduced-motion: reduce) {
  .busy-visual, .busy-visual *, .busy-visual *::after, .busy-mark, .busy-bar::before { animation: none; }
  .lightbox, .lightbox-stage img, .car-photo img { transition: none; }
}

/* Security page --------------------------------------------------------------------------------------------- */

.page-head {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px 16px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } /* cards stretch to equal height */
@media (max-width: 960px) { .settings-grid { grid-template-columns: 1fr; } }
.setting { display: flex; flex-direction: column; gap: 20px; padding: 24px; }
/* Steps on top, actions pinned to the bottom, so the button rows of both cards line up. */
.setting-body { flex: 1; display: flex; flex-direction: column; gap: 18px; }
.setting-actions { margin-top: auto; display: grid; gap: 18px; }
.field-fill { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.field-fill textarea { flex: 1; min-height: 140px; }
.setting-head { display: flex; align-items: flex-start; gap: 14px; }
.setting-text { flex: 1; min-width: 0; }
.setting-text p { margin-top: 2px; font-size: 14px; color: var(--muted); }
.status { flex: none; padding: 3px 10px; font-size: 12px; font-weight: 600; border-radius: var(--radius); }
.status-on { color: var(--success-fg); background: var(--success-bg); }
.status-off { color: var(--muted); background: var(--surface-muted); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 14px; font-size: 14px; }
.steps li::marker { color: var(--muted); }
.enrol { margin-top: 12px; display: flex; align-items: center; gap: 20px; }
.enrol-manual { flex: 1; min-width: 0; display: grid; gap: 8px; }
.qr-frame { flex: none; width: 176px; padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.qr { display: block; width: 100%; height: auto; }
/* The setup key on one line - its font as large as the width allows, up to 14px (39 characters of at most .66em
   each) - and Copy under it. A card too narrow for the QR code beside the key gets the code above it. */
.secret { container-type: inline-size; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.secret code { align-self: stretch; overflow-x: auto; padding: 10px 12px; font-size: min(14px, calc((100cqi - 24px) / 26.5)); letter-spacing: .06em; white-space: nowrap; background: var(--surface-muted); border-radius: var(--radius); }
.setting-body { container-type: inline-size; }
@container (max-width: 580px) {
  .enrol { flex-direction: column; align-items: stretch; }
  .qr-frame { align-self: center; }
}
@media (max-width: 520px) { /* phones: everything below each other */
  /* The back button and the title on one line, the description under a line across the box. */
  .page-head { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 0 16px; padding: 0; }
  .page-head .panel-titles { display: contents; }
  .page-head .btn-icon { margin: 12px 0 12px 16px; }
  .page-head .divider-v { margin: 0; }
  .page-head .panel-subtitle { grid-column: 1 / -1; padding: 12px 20px 16px 16px; border-top: 1px solid var(--border); }
  /* Icon, title and status on one line, the description under them. */
  .setting-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 14px; }
  .setting-text { display: contents; }
  .setting-head > *, .setting-text h2 { grid-row: 1; }
  .setting-text p { grid-row: 2; grid-column: 1 / -1; margin: 0; }
  .setting-actions .btn { width: 100%; }
}

/* Sign-in screen: brand panel (CSS only) beside the form -------------------------------------------------- */

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }

.auth-visual {
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: 48px 56px; color: #fff; overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px) 0 0 / 36px 36px,
    linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px) 0 0 / 36px 36px,
    var(--accent);
}
.brand-inverse { color: #fff; }
.brand-inverse .brand-mark { background: rgba(255, 255, 255, .16); }
.auth-pitch { max-width: 470px; }
.auth-pitch h2 { font-size: 32px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.auth-pitch p { margin-top: 14px; font-size: 16px; color: rgba(255, 255, 255, .82); }

/* A stylised glimpse of the preview list - decoration only (aria-hidden on the panel). */
.auth-mock { max-width: 520px; display: grid; gap: 8px; }
.auth-mock-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-size: 13px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); border-radius: var(--radius);
}
.auth-mock-id { min-width: 132px; white-space: nowrap; }
.auth-mock-tag { padding: 1px 8px; font-size: 12px; white-space: nowrap; background: rgba(255, 255, 255, .16); border-radius: var(--radius); }
.auth-mock-thumbs { margin-left: auto; display: flex; gap: 6px; }
.auth-mock-thumbs i { display: block; width: 40px; height: 27px; background: rgba(255, 255, 255, .22); border-radius: var(--radius); }

.auth-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; font-size: 14px; color: rgba(255, 255, 255, .88); }
.auth-points li { display: flex; align-items: center; gap: 10px; }

.auth-panel { display: grid; place-items: center; padding: 48px 24px; }
.auth-form { width: 100%; max-width: 380px; }
.auth-form .card-title { font-size: 26px; }
.auth-brand-small { display: none; }
.auth-foot { font-size: 12px; text-align: center; color: var(--muted); }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { place-items: start center; padding-top: 48px; }
  .auth-brand-small { display: inline-flex; margin-bottom: 12px; }
}
