/* Theme is applied in the document head, before the first painted frame. */
:root {
  --surface: #fff;
  --surface-raised: #fff;
  --surface-soft: #f0eee9;
  --surface-input: #fff;
  --theme-focus: #916151;
}
html[data-theme="dark"] {
  --paper: #090909;
  --white: #141414;
  --ink: #f4f4f5;
  --muted: #a3a3a3;
  --line: #303030;
  --wine: #d8a0ad;
  --wine-dark: #a35164;
  --soft: #202020;
  --gold: #d5b78c;
  --surface: rgba(20, 20, 20, .96);
  --surface-raised: #181818;
  --surface-soft: #1c1c1c;
  --surface-input: #101010;
  --theme-focus: #e2bd8b;
  color-scheme: dark;
}
html[data-theme="light"] { color-scheme: light; }
/* Frame the supplied transparent artwork without a badge or duplicate wordmark. */
.brand-icon { position: relative; flex-shrink: 0; width: 94px; height: 51.57px; overflow: hidden; background: transparent; border-radius: 0; }
.brand-icon img { position: absolute; max-width: none; width: 177.714286%; height: 210.625%; left: -40%; top: -58.333333%; object-fit: fill; }
.site-footer .brand-icon { width: 115px; height: 63.09px; }
body { isolation: isolate; }
#main, #page-home, #page-view { background: transparent; }
#main, .site-footer { position: relative; z-index: 1; }
.theme-toggle {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  transition: background .18s, border-color .18s, transform .18s;
}
.theme-toggle svg { width: 18px; height: 18px; }
.header-language { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.header-language>svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.header-language-label { display: none; }
.site-header .language-shortcut {
  display: block;
  width: 96px;
  min-height: 36px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-input);
  color: var(--ink);
  font: 11px var(--sans);
  letter-spacing: 0;
  cursor: pointer;
}
.site-header .language-shortcut:disabled { opacity: .65; cursor: progress; }
.theme-toggle:hover { background: var(--soft); border-color: var(--muted); transform: rotate(12deg); }
.theme-toggle:focus-visible, :is(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--theme-focus);
  outline-offset: 4px;
}
html[data-theme="dark"] .theme-toggle { color: var(--gold); }
html[data-theme="dark"] ::selection { background: #79505b; color: #fff; }
html[data-theme="dark"] .announcement { background: #111111; color: #c4c4c4; }
html[data-theme="dark"] .status-dot { background: var(--gold); }
html[data-theme="dark"] .hero-stage { background: #141414; }
html[data-theme="dark"] .hero-stage:before { background: linear-gradient(90deg, #090909 0%, #090909f5 25%, #0909099c 43%, #09090905 75%); }
html[data-theme="dark"][dir="rtl"] .hero-stage:before { background: linear-gradient(270deg, #090909 0%, #090909f5 25%, #0909099c 43%, #09090905 75%); }
html[data-theme="dark"] .hero-stage:after { background: linear-gradient(0deg, #09090950, transparent 50%); }
html[data-theme="dark"] .hero-copy p { color: #e1e1e1b8; }
html[data-theme="dark"] .site-header { background: rgba(9, 9, 9, .96); border-bottom-color: #303030a6; }
html[data-theme="dark"] .brand-period { color: var(--gold); }
html[data-theme="dark"] .button-primary { background: #8d3f52; color: #fff; }
html[data-theme="dark"] .button-primary:hover { background: #a45164; box-shadow: 0 6px 24px #0003; }
html[data-theme="dark"] .button-white { background: #f2eee4; color: #262626; }
html[data-theme="dark"] :is(.counter, .skip-link) { background: #8d3f52; color: #fff; }
html[data-theme="dark"] :is(.upload-preview button, .upload-preview .photo-controls button.remove-photo) { background: #8d3f52; color: #fff; }
html[data-theme="dark"] .search-panel { background: var(--surface); border-color: var(--line); box-shadow: 0 18px 45px #0003; }
html[data-theme="dark"] :is(.popular-searches button, .brand-tile span, .card-specs, .field>label, .range-field legend, .checkbox-field) { color: #bdbdbd; }
html[data-theme="dark"] .popular-searches i { color: #6b6b6b; }
html[data-theme="dark"] :is(.popular-searches button, .card-bottom, .editorial-note a, .site-footer, .footer-bottom, .seller-guide li, .seller-ad-actions a, .seller-ad-actions button, .seller-plan>a, .photo-suggestion, .admin-record-actions) { border-color: var(--line); }
html[data-theme="dark"] .brand-tile { opacity: .82; }
html[data-theme="dark"] .brand-tile:hover { opacity: 1; }
html[data-theme="dark"] :is(.brand-tile img, .make-select>img, .make-option img, .vehicle-logo-options img) { filter: grayscale(1) invert(.88); }
html[data-theme="dark"] :is(.car-card, .showroom-card, .plate-card, .filter-panel, .account-sidebar, .account-panel, .stat-card, .sell-form, .seller-plan, .admin-sidebar, .admin-stat, .admin-record, .admin-login, .admin-content-card, .admin-photo-item, .language-option, .make-option, .vehicle-logo-options button) { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] :is(.car-card, .showroom-card):hover { box-shadow: 0 12px 28px #0004; }
html[data-theme="dark"] :is(.card-image, .detail-gallery, .detail-main-photo, .admin-record-image) { background: #202020; }
html[data-theme="dark"] .card-save { background: #141414e8; color: #e5e5e5; }
html[data-theme="dark"] .card-save.saved { color: var(--wine); }
html[data-theme="dark"] .card-save:hover { background: #242424; }
html[data-theme="dark"] .badge-featured { background: #e8d4ac; color: #46371f; }
html[data-theme="dark"] .badge-new { background: #d7e3d3; color: #334632; }
html[data-theme="dark"] :is(.card-specs svg, .detail-spec svg) { color: #a3a3a3; }
html[data-theme="dark"] .sell-banner { background: #1c1c1c; }
html[data-theme="dark"] .sell-banner-copy { background: #713345; }
html[data-theme="dark"] .showroom-mark { background: #282828; color: #ddd3bb; }
html[data-theme="dark"] .showroom-card:nth-child(2n) .showroom-mark { background: #303030; color: #d0d0d0; }
html[data-theme="dark"] .showroom-card:nth-child(3n) .showroom-mark { background: #48343a; color: #e4b5bc; }
html[data-theme="dark"] .showroom-join { background: #171717; border-color: #3b3b3b; }
html[data-theme="dark"] .verified { color: #9dc6a6; }
html[data-theme="dark"] .showroom-arrow { color: #bdbdbd; }
html[data-theme="dark"] .site-footer { background: rgba(12, 12, 12, .96); }
html[data-theme="dark"] :is(.footer-top p, .footer-links>div>span, .footer-bottom) { color: #a3a3a3; }
html[data-theme="dark"] :is(.footer-links a, .footer-links button) { color: #d4d4d4; }
html[data-theme="dark"] :is(.footer-links a, .footer-links button):hover { color: var(--gold); }
html[data-theme="dark"] :is(.field input, .field select, .field textarea, .directory-toolbar input, .directory-toolbar select, .home-city-selector, .home-browse-toolbar input, .home-browse-toolbar select, .mobile-filter-toggle, .make-select, .admin-filter input, .admin-filter select, .message-compose input, .message-compose textarea) { background: var(--surface-input); border-color: #383838; color: var(--ink); }
html[data-theme="dark"] :is(input, textarea)::placeholder { color: #8c8c8c; }
html[data-theme="dark"] :is(input, select, textarea) { accent-color: #c58a9b; }
html[data-theme="dark"] option { background: #141414; color: var(--ink); }
html[data-theme="dark"] .filter-chip { background: #3d2e35; color: #edbcc9; }
html[data-theme="dark"] .empty-state { background: #14141499; border-color: #383838; }
html[data-theme="dark"] .empty-state .empty-icon { color: var(--gold); }
html[data-theme="dark"] :is(.business-head, .saved-intro, .seller-guide, .admin-operation, .cb-report-listing) { background: #1c1c1c; border-color: var(--line); color: #c4c4c4; }
html[data-theme="dark"] .plate-visual { background: #1c1c1c; }
/* Number plates retain their real, printed appearance in either theme. */
html[data-theme="dark"] :is(.number-plate, .mini-number-plate) { color: #302d27; }
html[data-theme="dark"] .modal { background: #141414; color: var(--ink); box-shadow: 0 40px 120px #0008; }
html[data-theme="dark"] .modal::backdrop { background: #000000c9; backdrop-filter: blur(5px); }
html[data-theme="dark"] .modal-close { background: #242424ef; color: var(--ink); }
html[data-theme="dark"] .modal-close:hover { background: #333333; }
html[data-theme="dark"] :is(.auth-note, .notification-item small) { color: #a3a3a3; }
html[data-theme="dark"] .form-error { color: #f4b6bb; background: #42262f; border-color: #784150; }
html[data-theme="dark"] .form-success { color: #b9dbb6; background: #243d2b; border-color: #46654b; }
html[data-theme="dark"] .seller-avatar { background: #303030; color: #e0d4ba; }
html[data-theme="dark"] :is(.detail-description p, .info-copy) { color: #bdbdbd; }
html[data-theme="dark"] .detail-features span { background: #262626; color: #d4d4d4; }
html[data-theme="dark"] .compare-tray { background: #202020; border: 1px solid #404040; }
html[data-theme="dark"] .compare-tray .button { color: #262626; }
html[data-theme="dark"] .lightbox-retry { background: #f2eee4; color: #262626; }
html[data-theme="dark"] .comparison-page .compare-table { background: var(--surface); }
html[data-theme="dark"] .toast { background: #262626; border: 1px solid #454545; }
html[data-theme="dark"] :is(.account-sidebar a.active, .admin-sidebar a.active, .conversation-button.active, .language-option.active, .product-option:has(input:checked)) { background: #3b2e35; color: #eab6c4; border-color: #b37789; }
html[data-theme="dark"] :is(.workspace-links a:hover, .workspace-links button:hover, .admin-sidebar>a:hover, .make-option:hover) { background: #262626; color: var(--ink); }
html[data-theme="dark"] .workspace-menu-panel { background: #00000080; }
html[data-theme="dark"] .workspace-menu-panel>section { background: #141414; box-shadow: -20px 0 60px #0005; }
html[data-theme="dark"] .status-badge { background: #4a3c28; color: #e4c89c; }
html[data-theme="dark"] .status-approved { background: #2c4430; color: #bad7ad; }
html[data-theme="dark"] :is(.status-rejected, .status-expired) { background: #4a2d35; color: #e4acb5; }
html[data-theme="dark"] .account-wallet { background: linear-gradient(130deg, #262626, #181818); }
html[data-theme="dark"] .upload-zone { background: #141414; border-color: #545454; }
html[data-theme="dark"] .upload-zone svg { color: var(--gold); }
html[data-theme="dark"] .form-section-title>span { border-color: #72694e; color: #d8bd8e; }
html[data-theme="dark"] .product-option { border-color: var(--line); }
html[data-theme="dark"] :is(.pending-note, .admin-pending-label) { background: #423a25; color: #e4c88e; border-color: #675a36; }
html[data-theme="dark"] .messages-layout { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .conversation-list { background: #141414; }
html[data-theme="dark"] .thread-messages { background: #0c0c0c; }
html[data-theme="dark"] .message-bubble { background: #202020; border-color: #383838; }
html[data-theme="dark"] .message-bubble.mine { background: #47343d; border-color: #6a4755; }
html[data-theme="dark"] .message-compose { background: #141414; }
html[data-theme="dark"] :is(.message-bubble small, .conversation-button small, .seller-request small, .seller-type-label, .seller-ad-facts, .photo-analysis-note, .admin-analysis-status, .admin-message small, .admin-notification small, .admin-permission-note) { color: #b3b3b3; }
html[data-theme="dark"] :is(.seller-delete, .wallet-debit, .admin-action-danger, .admin-record-actions .admin-action-danger, .admin-photo-actions button:last-child, .admin-faq-entry>button, .admin-expire-note) { color: #eca7ad; }
html[data-theme="dark"] .wallet-credit { color: #acd0a0; }
html[data-theme="dark"] .photo-analysis-panel { background: #1c1c1c; border-color: #3b3b3b; }
html[data-theme="dark"] :is(.admin-metadata, .admin-readonly) { background: #202020; color: #c4c4c4; }
html[data-theme="dark"] .admin-readonly strong { color: #e5e5e5; }
html[data-theme="dark"] .admin-photo-actions button { background: #292929; }
html[data-theme="dark"] .admin-photo-upload { background: #181818; border-color: #4b4b4b; color: #cccccc; }
html[data-theme="dark"] .admin-message-list { background: #101010; }
html[data-theme="dark"] .admin-message { background: #202020; border-color: #383838; }
html[data-theme="dark"] .admin-message.mine { background: #42333a; }
html[data-theme="dark"] .admin-suggestion { background: #1c1c1c; border-color: var(--line); }

/* Keep every primary header action reachable, including on a 320px screen. */
@media (max-width: 1200px) {
  .site-header .nav-actions { gap: 10px; }
  .nav-shell { gap: 24px; }
}
@media (max-width: 700px) {
  html[data-theme="dark"] .hero-stage:before, html[data-theme="dark"][dir="rtl"] .hero-stage:before { background: linear-gradient(180deg, #090909eb 0%, #09090996 35%, #0909091a 72%); }
  html[data-theme="dark"] .hero-stage:after { background: linear-gradient(0deg, #090909bb, transparent 58%); }
  .theme-toggle { flex-basis: 30px; width: 30px; height: 32px; }
  .theme-toggle svg { width: 17px; height: 17px; }
  .site-header .language-shortcut { font-size: 16px; }
  .site-header .nav-actions { gap: 6px; }
}
@media (max-width: 540px) {
  .nav-sell { display: none; }
  .site-header .nav-shell { height: auto; min-height: 72px; flex-wrap: wrap; gap: 8px; padding-block: 11px; }
  .site-header .nav-actions { display: contents; }
  .site-header .brand { margin-inline-end: auto; }
  .site-header .header-language { order: 10; flex-basis: 100%; border-top: 1px solid var(--line); padding-top: 8px; font-size: 10px; }
  .header-language-label { display: inline; }
  .site-header .language-shortcut { width: 125px; min-height: 32px; margin-inline-start: auto; padding-block: 5px; }
}
@media (max-width: 360px) {
  html[dir] .site-header .brand { font-size: 20px; gap: 5px; }
  .site-header .brand-icon { width: 84px; height: 46.08px; }
  .site-header .nav-actions { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { .theme-toggle { transition: none; } .theme-toggle:hover { transform: none; } }
