:root { --pico-font-size: 100%; }
.free-banner { background: #e8f0fe; border-bottom: 1px solid #c3d6fb; color: #10284a; padding: .55rem 2.5rem; text-align: center; font-size: .92rem; position: relative; }
.free-banner a[role=button] { width: auto; margin: 0 0 0 .6rem; padding: .2rem .8rem; font-size: .85rem; display: inline-block; }
.free-banner .x { position: absolute; right: .5rem; top: .35rem; background: none; border: 0; color: inherit; width: auto; margin: 0; padding: 0 .4rem; font-size: 1.2rem; cursor: pointer; }
nav.top { border-bottom: 1px solid var(--pico-muted-border-color); margin-bottom: 1.5rem; }
nav.top .brand { text-decoration: none; color: #231f20; display: inline-flex; align-items: center; }  /* the logo's black */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) nav.top .brand { color: #fff; } }
:root[data-theme="dark"] nav.top .brand { color: #fff; }
nav.top .brand-logo { height: 1.05rem; width: auto; display: block; }
nav.top .nav-toggle { display: none; width: auto; margin: 0; padding: .35rem .6rem; line-height: 0; }
nav.top .nav-toggle svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
nav.top .nav-toggle .cross, nav.top.open .nav-toggle .bars { display: none; }
nav.top.open .nav-toggle .cross { display: inline; }
/* phone: brand + Menu button on one row; the links drop down full width below */
@media (max-width: 767px) {
  nav.top { flex-wrap: wrap; align-items: center; }
  nav.top .nav-toggle { display: block !important; }  /* !important: the button also carries an inline display:none so it never shows on desktop, even with stale CSS */
  nav.top .nav-links { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch;
                       margin: 0 0 .5rem; padding: 0; border-top: 1px solid var(--pico-muted-border-color); }
  nav.top.open .nav-links { display: flex; }
  nav.top .nav-links li { display: block; padding: 0; }
  nav.top .nav-links a:not([role=button]) { display: block; margin: 0; padding: .7rem 0; }
  nav.top .nav-links a[role=button], nav.top .nav-links button { width: 100%; margin: .4rem 0 0; }
}
.messages li { list-style: none; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 1rem; font-size: .8rem;
         background: var(--pico-secondary-background); color: var(--pico-secondary-inverse); }
.badge.ok { background: #1f7a3f; color: #fff; }
.badge.warn { background: #b26a00; color: #fff; }
.badge.bad { background: #a12a2a; color: #fff; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h2 { margin: 0; }
.page-head [role=button] { margin: 0; width: auto; }
.muted { color: var(--pico-muted-color); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.checkbox-row ul, .checkbox-row div { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; padding: 0; }
.checkbox-row li { list-style: none; }
/* form fields (templates/_form.html): help text and errors sit right under their own
   input; the gap comes after the field, so each note clearly belongs to the field above it */
.field { margin-bottom: 1.4rem; }
.field > label > input:not([type=checkbox]):not([type=radio]), .field > label > select, .field > label > textarea { margin-bottom: .3rem; }
.field > small { display: block; }
.field > .errorlist { margin: 0 0 .3rem; }
.field + button, .field + .grid { margin-top: .25rem; }
.errorlist { color: #c62828; padding: 0; }
.errorlist li { list-style: none; }
.table-wrap { overflow-x: auto; }
.photos { display: flex; gap: .5rem; overflow-x: auto; }
.photos img { height: 140px; border-radius: .25rem; }
.chart-box { position: relative; height: 320px; }

/* filter editor */
.filter-editor { margin: .5rem 0 1rem; }
.fe-group { border: 1px solid var(--pico-muted-border-color); border-radius: .5rem; padding: .75rem; margin-bottom: .25rem; }
.fe-group-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.fe-or { text-align: center; color: var(--pico-muted-color); margin: .25rem 0; font-size: .85rem; }
.fe-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; padding: .5rem 0; border-bottom: 1px dashed var(--pico-muted-border-color); }
.fe-row select, .fe-row input { margin: 0; width: auto; padding: .35rem .6rem; font-size: .9rem; height: auto; }
.fe-field { max-width: 16rem; }
.fe-values { display: flex; flex-direction: column; gap: .35rem; flex: 1 1 18rem; min-width: 0; }
.fe-range { display: flex; gap: .4rem; align-items: center; }
.fe-range input { max-width: 10rem; }
.fe-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.fe-chip { background: var(--pico-primary-background); color: var(--pico-primary-inverse); border-radius: 1rem; padding: .1rem .2rem .1rem .6rem; font-size: .85rem; }
.fe-chip button, .fe-x { background: none; border: none; color: inherit; padding: 0 .35rem; margin: 0; width: auto; font-size: 1rem; line-height: 1; cursor: pointer; }
.fe-x { color: var(--pico-muted-color); }
.fe-suggest { display: flex; flex-wrap: wrap; gap: .25rem; max-height: 6.5rem; overflow-y: auto; }
.fe-sugg { background: var(--pico-secondary-background); border: none; color: var(--pico-secondary-inverse); padding: .05rem .5rem; margin: 0; width: auto; font-size: .8rem; border-radius: .3rem; }
.fe-sugg small { opacity: .7; }
.fe-help { flex-basis: 100%; }
.fe-small { width: auto; padding: .3rem .8rem; font-size: .85rem; margin: .4rem .4rem 0 0; }
.fe-actions, .fe-preview { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.fe-preview { margin-top: .75rem; }
.fe-preview select { width: auto; margin: .4rem 0 0; padding: .3rem .6rem; font-size: .85rem; }
.fe-json { font-family: monospace; font-size: .85rem; }
.fe-pricemodel { flex: 1; font-size: .9rem; }
.fe-basis { flex-basis: 100%; }

/* alert page: ready-made alerts, simple form, market panel */
.alert-edit { max-width: 46rem; margin: auto; }
.starter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .5rem; margin-bottom: 1.5rem; }
.starter { display: flex; flex-direction: column; gap: .2rem; padding: .6rem .75rem; border: 1px solid var(--pico-muted-border-color);
           border-radius: .5rem; text-decoration: none; color: inherit; }
.starter:hover { border-color: var(--pico-primary); background: var(--pico-primary-background); color: var(--pico-primary-inverse); }
.starter:hover small { color: inherit; }
.starter-title { font-weight: 600; font-size: .95rem; }
.sf-row { margin-bottom: 1rem; }
.sf-label { display: block; font-weight: 600; margin-bottom: .35rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; margin: 0; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { padding: .45rem 1rem; border: 1px solid var(--pico-muted-border-color); border-radius: 2rem; user-select: none; }
.chip.small span { padding: .25rem .75rem; font-size: .9rem; }
.chip input:checked + span { background: var(--pico-primary-background); color: var(--pico-primary-inverse); border-color: var(--pico-primary-background); }
.chip input:focus-visible + span { outline: 2px solid var(--pico-primary); }
.sf-inline { display: flex; align-items: center; gap: .5rem; }
.sf-inline select, .sf-inline input { margin: 0; width: auto; min-width: 7rem; }
.sf-price input { max-width: 10rem; }
.sf-more { margin: .5rem 0 1rem; }
.market { border: 1px solid var(--pico-muted-border-color); border-radius: .5rem; padding: .9rem 1rem; margin: 1rem 0; transition: opacity .15s; }
.market.updating { opacity: .55; }
.market-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .75rem; }
.market-big { font-size: 1.5rem; font-weight: 700; }
.market-yours { background: var(--pico-secondary-background); color: var(--pico-secondary-inverse); border-radius: .4rem; padding: .5rem .75rem; }
.market-yours small { color: inherit; opacity: .85; }
.histogram { display: flex; align-items: flex-end; gap: 2px; height: 70px; margin-top: .9rem; }
.histogram .bar { flex: 1; background: var(--pico-muted-border-color); min-height: 1px; border-radius: 2px 2px 0 0; }
.histogram .bar.under { background: var(--pico-primary-background); }
.histogram-axis { display: flex; justify-content: space-between; gap: .5rem; color: var(--pico-muted-color); }
.histogram-axis small:nth-child(2) { text-align: center; }
.under-key { color: var(--pico-primary-background); }
.market-list { margin: .6rem 0 0; }
.mode-switch { margin-top: .5rem; }
.empty-state { text-align: center; padding: 2rem 1rem; }
.notice { padding: .75rem 1rem; }
div.notice { border-left: 4px solid #b26a00; background: #fff8e6; color: #3d2800; border-radius: .3rem; margin-bottom: 1rem; }
div.notice.bad { border-color: #a12a2a; background: #fdeeee; color: #4a1010; }
div.notice.info { border-color: #2a62a1; background: #eef4ff; color: #10284a; }
.starter-img { width: 100%; aspect-ratio: 1400 / 850; object-fit: contain; background: #fff; border-radius: .3rem; margin-bottom: .2rem; }

/* ready-made alerts: collapsible, chosen one stays marked */
/* phone: ready-made alerts as compact rows (picture left, text right) instead of tall cards */
@media (max-width: 767px) {
  .starter-grid { grid-template-columns: 1fr; }
  .starter { display: grid; grid-template-columns: 7rem 1fr; column-gap: .75rem; align-items: center; }
  .starter-img { grid-row: 1 / span 2; margin: 0; }
  .starter-title, .starter small { grid-column: 2; }
}
.starters { margin-bottom: 1.25rem; }
.starters > summary { list-style: none; cursor: pointer; padding: .5rem .25rem; }
.starters > summary::-webkit-details-marker { display: none; }
.starters > summary::after { display: none; }  /* "Change" / the heading do the job of Pico's arrow */
.starters-chosen, .starters-closed { display: none; align-items: center; gap: .75rem; }
.starters[data-chosen]:not([open]) .starters-chosen { display: flex; }
.starters:not([data-chosen]):not([open]) .starters-closed { display: inline; color: var(--pico-primary); }
.starters:not([open]) .starters-heading { display: none; }
.starters-chosen { border: 2px solid var(--pico-primary-background); border-radius: .5rem; padding: .35rem .75rem; }
.starters-chosen img { width: 5.5rem; aspect-ratio: 1400 / 850; object-fit: contain; background: #fff; border-radius: .25rem; }
.starters-change { margin-left: auto; color: var(--pico-primary); white-space: nowrap; }
.starter.selected, .starter:has(> input:checked) { border: 2px solid var(--pico-primary-background); box-shadow: 0 0 0 3px var(--pico-primary-focus); }
.free-cards { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.alert-status { font-size: 1.05rem; }
.switch-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.custom-tile { color: var(--pico-muted-color); border-style: dashed; }
.custom-tile svg { background: none; padding: 1rem 1.5rem; }
.progress { height: .6rem; background: var(--pico-muted-border-color); border-radius: .4rem; overflow: hidden; margin: 1rem 0; }
.progress > div { height: 100%; width: 0; background: var(--pico-primary-background); transition-property: width; transition-timing-function: linear; }

/* upgrade page: plans side by side; on phones Pro (the plan on offer) comes first */
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.plan-cards article { margin: 0; }
.plan-cards .plan-pro { border: 2px solid var(--pico-primary-background); }
.plan-price { font-size: 1.8rem; font-weight: 700; margin-bottom: .5rem; }
.ticks, .ticks li { list-style: none; }
.ticks { padding: 0; margin: .5rem 0 1rem; }
.ticks li { padding: .2rem 0 .2rem 1.5rem; position: relative; }
.ticks li::before { content: "\2713"; position: absolute; left: 0; color: #1f7a3f; font-weight: 700; }
.ticks li.no { color: var(--pico-muted-color); }
.ticks li.no::before { content: "\2013"; color: var(--pico-muted-color); }
.ticks li.limit::before { content: "\2022"; color: var(--pico-muted-color); }
@media (max-width: 767px) { .plan-cards .plan-pro { order: -1; } }
.free-cards .starter { cursor: pointer; margin: 0; }
.free-cards .starter > input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.free-cards .starter:has(> input:checked) .starter-title::before { content: "✓ "; color: var(--pico-primary-background); }
.starter.selected .starter-title::before { content: "✓ "; color: var(--pico-primary-background); }
.chip.colour span { display: inline-flex; align-items: center; gap: .4rem; }
.swatch { width: .9rem; height: .9rem; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); display: inline-block; }
.swatch-white { background: #f4f4f4; } .swatch-black { background: #1b1b1b; } .swatch-grey { background: #5b5e63; }
.swatch-silver { background: #b8bcc2; } .swatch-blue { background: #1f4fa3; } .swatch-red { background: #a3121c; }
.fe-sugg em { font-style: normal; opacity: .75; }
.fe-chip-warn { background: #b26a00; }
.fe-warn-note { color: #b26a00; }

/* Stripe card field (orders/_card_element.html) */
.stripe-box { border: 1px solid var(--pico-form-element-border-color); border-radius: var(--pico-border-radius); padding: .8rem .9rem; background: var(--pico-form-element-background-color); margin-bottom: .4rem; }
/* order hold breakdown */
.hold { width: 100%; }
.hold td:last-child { text-align: right; white-space: nowrap; }
.hold tr.total td { font-weight: 700; }
.hold tr.sub td { color: var(--pico-muted-color); font-size: .9rem; }
/* phone: sticky Order bar on the car page (hidden while the Order card's button is visible) */
.order-bar { display: none; }
@media (max-width: 767px) {
  .order-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; gap: .75rem; align-items: center;
               padding: .6rem 1rem; background: var(--pico-background-color); border-top: 1px solid var(--pico-muted-border-color);
               box-shadow: 0 -4px 12px rgba(0,0,0,.08); transition: transform .2s; }
  .order-bar.hidden { transform: translateY(110%); }
  .order-bar .ob-info { flex: 1; min-width: 0; line-height: 1.2; }
  .order-bar .ob-info strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .order-bar [role=button], .order-bar button { width: auto; margin: 0; padding: .55rem 1rem; white-space: nowrap; }
  body.has-order-bar { padding-bottom: 5rem; }
}
.legal-foot { text-align: center; font-size: .8rem; margin: 2rem auto 1rem; }
.legal-foot a { margin: 0 .5rem; color: var(--pico-muted-color); }
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover { text-decoration: underline; }
.sort-hint { opacity: .35; font-weight: normal; }
.account-summary { border-left: 3px solid var(--pico-primary-background); padding: .5rem .9rem; margin-bottom: 1rem; background: var(--pico-card-sectioning-background-color); }
.account-summary p { margin-bottom: .25rem; }

/* counts that open the matching cars */
.matches-link { text-decoration: underline; text-underline-offset: .15em; cursor: pointer; color: inherit; }
.matches-link:hover { color: var(--pico-primary); }
#matches-dialog > article { width: min(60rem, 96vw); max-width: none; }
#matches-dialog .table-wrap { max-height: 60vh; overflow: auto; }

/* automatic order: the list of cars and the add/edit panel */
.accept { display: grid; grid-template-columns: 7rem 1fr auto; gap: .25rem .9rem; align-items: center; padding: .6rem .75rem;
  border: 1px solid var(--pico-muted-border-color); border-radius: .5rem; margin-bottom: .5rem; }
.accept.editing { border: 2px solid var(--pico-primary-background); }
.accept img, .accept .accept-noimg { width: 7rem; aspect-ratio: 1400 / 850; object-fit: contain; background: #fff; border-radius: .3rem; grid-row: span 2; }
.accept .t { font-weight: 600; }
.accept .acts { grid-row: span 2; white-space: nowrap; font-size: .9rem; }
.accept .acts a, .accept .acts form { margin-left: .6rem; }
.accept small { grid-column: 2; }
.link-button, .accept .acts .link-button { background: none; border: 0; padding: 0; margin: 0; width: auto; color: var(--pico-primary); font-size: inherit; cursor: pointer; text-decoration: underline; }
.accept .acts form { display: inline; margin: 0 0 0 .6rem; }
.or-sep { text-align: center; color: var(--pico-muted-color); font-size: .8rem; margin: -.2rem 0 .3rem; }
.empty-list { border: 1px dashed var(--pico-muted-border-color); border-radius: .5rem; padding: 1rem; text-align: center; color: var(--pico-muted-color); }
.car-panel { border: 2px solid var(--pico-primary-background); border-radius: .6rem; padding: 1rem; margin: 1rem 0 1.5rem; }
.when-box { font-size: .92rem; }
.when-box dt { color: var(--pico-muted-color); font-size: .82rem; margin-top: .4rem; }
.when-box dd { margin: 0; }
@media (max-width: 767px) {
  .accept { grid-template-columns: 5.5rem 1fr; }
  .accept img, .accept .accept-noimg { width: 5.5rem; grid-row: span 3; align-self: start; }
  .accept .acts { grid-column: 2; grid-row: auto; }
  .accept .acts > a:first-child { margin-left: 0; }
  .car-panel { padding: .75rem; }
}

/* Pro alerts list: one compact row per alert */
.al-summary { margin: -.25rem 0 .75rem; }
.al-list { border: 1px solid var(--pico-muted-border-color); border-radius: .6rem; overflow: hidden; }
.al-row { display: grid; grid-template-columns: 6.5rem 1fr auto; gap: .2rem .9rem; align-items: center; padding: .6rem .8rem; }
.al-row + .al-row { border-top: 1px solid var(--pico-muted-border-color); }
.al-img img, .al-img svg { width: 6.5rem; aspect-ratio: 1400 / 850; object-fit: contain; background: #fff; border-radius: .3rem; display: block; color: var(--pico-muted-color); }
.al-text { min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.al-name { font-weight: 600; color: inherit; text-decoration: none; line-height: 1.3; }
.al-name:hover { text-decoration: underline; }
.al-sub { font-size: .88rem; color: var(--pico-muted-color); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.al-meta { font-size: .82rem; }
.al-side { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; }
.al-side form { margin: 0; }
.al-side input[role=switch] { margin: 0; }
.al-edit { font-size: .85rem; }
.al-row.off .al-img, .al-row.off .al-text { opacity: .5; }
@media (max-width: 767px) {
  .al-row { grid-template-columns: 4.5rem 1fr auto; column-gap: .6rem; padding: .55rem .6rem; align-items: start; }
  .al-img img, .al-img svg { width: 4.5rem; margin-top: .2rem; }
}
.delete-alert { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--pico-muted-border-color); }
.link-button.danger { color: #b3261e; }

/* dashboard: status tiles and the alert feed */
.db-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .9rem; }
.db-head h2 { margin: 0; }
.db-head .badge { margin: 0; line-height: 1.4; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: 1.6rem; }
.tile { border: 1px solid var(--pico-muted-border-color); border-radius: .6rem; padding: .7rem .85rem; display: flex; flex-direction: column; gap: .15rem; text-decoration: none; color: inherit; }
.tile:hover { border-color: var(--pico-primary); }
.tile .lbl { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pico-muted-color); }
.tile .val { font-weight: 600; }
.tile .act { font-size: .85rem; color: var(--pico-primary); margin-top: auto; padding-top: .2rem; }
.tile.next { border: 2px solid var(--pico-primary-background); }
.tile.dim .val { color: var(--pico-muted-color); font-weight: 500; }
.feed-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .5rem; }
.feed-head h3 { margin: 0; }
.feed { border: 1px solid var(--pico-muted-border-color); border-radius: .6rem; overflow: hidden; }
.fd-row { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: .8rem; align-items: center; padding: .55rem .8rem; color: inherit; text-decoration: none; }
.fd-row + .fd-row { border-top: 1px solid var(--pico-muted-border-color); }
.fd-row:hover { background: var(--pico-card-sectioning-background-color); }
.fd-row img, .fd-icon { width: 5.5rem; aspect-ratio: 1400 / 850; object-fit: contain; background: #fff; border-radius: .3rem; display: flex; align-items: center; justify-content: center; color: #1a7f37; }
.fd-text { min-width: 0; display: flex; flex-direction: column; }
.fd-text strong { font-size: .95rem; line-height: 1.3; }
.fd-text small { color: var(--pico-muted-color); font-size: .84rem; }
.fd-text small.fd-alert { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; }
.fd-when { color: var(--pico-muted-color); font-size: .8rem; white-space: nowrap; align-self: start; padding-top: .15rem; }
.free-note { font-size: .85rem; margin: .6rem 0 0; }
.feed-empty { border: 1px dashed var(--pico-muted-border-color); border-radius: .6rem; padding: 1.2rem; text-align: center; color: var(--pico-muted-color); }
@media (max-width: 767px) {
  .tiles { grid-template-columns: 1fr; gap: 0; border: 1px solid var(--pico-muted-border-color); border-radius: .6rem; overflow: hidden; }
  .tile { border: 0; border-radius: 0; display: grid; grid-template-columns: 4.6rem 1fr auto; column-gap: .5rem; align-items: baseline; padding: .55rem .8rem; }
  .tile.next { border: 2px solid var(--pico-primary-background); }
  .tile + .tile { border-top: 1px solid var(--pico-muted-border-color); }
  .tile .lbl { grid-row: span 2; }
  .tile .val, .tile .sub { grid-column: 2; }
  .tile .act { grid-column: 3; grid-row: 1; margin: 0; padding: 0; white-space: nowrap; }
  .fd-row { grid-template-columns: 4.2rem 1fr; gap: .1rem .65rem; align-items: start; }
  .fd-row img, .fd-icon { width: 4.2rem; grid-row: span 2; margin-top: .15rem; }
  .fd-when { grid-column: 2; padding: 0; }
}
