/* Shared appearance control. Kept last so every section retains its own layout. */
.site-preferences {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
  white-space: nowrap;
}
.site-preferences .theme-toggle { min-height: 44px; }
.site-preferences [hidden] { display: none !important; }
.cookie-preferences-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 9px;
  width: auto;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 5px 13px 5px 5px;
  border: 1px solid #c5d7cf;
  border-radius: 999px;
  background: #f1f7f4;
  color: #173f37;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 7px #173f3710;
  transition: background .2s, border-color .2s, box-shadow .2s, transform .2s;
}
.cookie-preferences-toggle:hover { background: #e7f4ed; border-color: #7fbd9e; box-shadow: 0 5px 14px #173f3720; transform: translateY(-1px); }
.cookie-preferences-toggle:active { transform: translateY(0); box-shadow: 0 1px 4px #173f3718; }
.cookie-preferences-toggle:focus-visible { outline: 3px solid #3aaf8c; outline-offset: 3px; }
.cookie-preferences-icon { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; background: #173f37; color: #fff; }
.cookie-preferences-icon svg { width: 18px; height: 18px; }
.cookie-preferences-label { letter-spacing: .01em; }
@media (max-width: 760px) {
  .cookie-preferences-toggle { padding: 5px; }
  .cookie-preferences-label { display: none; }
  .portal-header { flex-wrap: wrap; }
  .portal-header nav { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .cookie-preferences-toggle { transition: none; }
}
@media (forced-colors: active) {
  .cookie-preferences-toggle { border-color: ButtonText; }
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: auto;
  min-width: 44px;
  min-height: 42px;
  padding: 5px 13px 5px 5px;
  border: 1px solid #c5d7cf;
  border-radius: 999px;
  background: #f1f7f4;
  color: #173f37;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 7px #173f3710;
  transition: background .2s, border-color .2s, box-shadow .2s, transform .2s;
}
.theme-toggle:hover { background: #e7f4ed; border-color: #7fbd9e; box-shadow: 0 5px 14px #173f3720; transform: translateY(-1px); }
.theme-toggle:active { transform: translateY(0); box-shadow: 0 1px 4px #173f3718; }
.theme-toggle:focus-visible { outline: 3px solid #3aaf8c; outline-offset: 3px; }
.theme-toggle-icon { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; background: #173f37; color: #fff; }
.theme-toggle-icon svg { width: 17px; height: 17px; }
.theme-icon-sun { display: none; }
.theme-toggle-label { letter-spacing: .01em; }
.portal-header .theme-toggle { border-color: #b9cec3; color: #173f37; }
.portal-header .theme-toggle:hover { background: #e7f4ed; color: #173f37; }
@media (max-width: 760px) {
  .theme-toggle { padding: 5px; }
  .theme-toggle [data-theme-label] { display: none; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --night-bg: #101820;
  --night-surface: #19252e;
  --night-raised: #21313c;
  --night-line: #344650;
  --night-text: #e9f0f2;
  --night-muted: #afc0c8;
}
html[data-theme="dark"] body:not(.home-page) {
  --accent: #62d7bc;
  --accent2: #90e8d0;
  --soft: #1c3837;
  --hero: #153b38;
  --glow: #c6f17b;
  background: var(--night-bg);
  color: var(--night-text);
}
html[data-theme="dark"] :is(body.theme-car,.card.theme-car) {
  --accent: #9cb8ff;
  --accent2: #b8caff;
  --soft: #253451;
  --hero: #1a2b53;
}
html[data-theme="dark"] body.theme-maquinaria {
  --accent: #f4d798;
  --accent2: #f7dfae;
  --soft: #423722;
  --hero: #3d301f;
  --glow: #f4d798;
}
html[data-theme="dark"] :is(.profile-settings-page,.publication-dashboard-page,.publication-editor-page,.admin-page) {
  background: var(--night-bg);
  color: var(--night-text);
}
html[data-theme="dark"] .admin-page {
  --admin-ink: #e6f1ec;
  --admin-muted: #adc5b9;
  --admin-line: var(--night-line);
  --admin-green: #8ce5c9;
}

/* Main surfaces shared by listings, details, account pages and management. */
html[data-theme="dark"] :is(
  .topbar,.filters,.card,.brand-tag,.detail-info,.property-location,.account-tabs,
  .auth-panel,.account-panel,.public-profile,.membership-notice,.admin-sidebar,
  .profile-identity,.profile-public-link,.catalog-tabs a,.catalog-actions button,
  .gallery-navigation button,.property-rating-card,.publication-photo
) {
  background: var(--night-surface);
  border-color: var(--night-line);
  color: var(--night-text);
}
html[data-theme="dark"] :is(
  .profile-summary,.publish-choices>a,.photo,.no-photo,.gallery-main,
  .gallery-thumbnails a,.switch,.map>.empty,.membership-pending,
  .catalog-note,.catalog-state,.catalog-table th,.profile-photo-preview
) {
  background: var(--night-raised);
  border-color: var(--night-line);
  color: var(--night-text);
}
html[data-theme="dark"] :is(
  .topbar,.account-tabs,.card,.detail-info,.account-panel,.auth-panel,.public-profile,
  .property-location,.profile-identity,.admin-sidebar,.membership-notice,
  .publication-section,.publication-photo,.profile-photo-editor
) { border-color: var(--night-line); }
html[data-theme="dark"] :is(input,select,textarea,.account-field input,.account-field select,
  .account-field textarea,.catalog-filters input,.catalog-filters select,
  .membership-order-filter select) {
  background: #17232c;
  border-color: #465862;
  color: var(--night-text);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #9cb0bb; }
html[data-theme="dark"] :is(.segments span,.type-grid span,.chips span,.switch button.active,
  .logout-button,.gallery-navigation button) {
  background: var(--night-surface);
  border-color: var(--night-line);
  color: var(--night-text);
}
html[data-theme="dark"] :is(.segments input:checked+span,.type-grid input:checked+span,
  .chips input:checked+span,.topbar nav a:hover,.topbar nav a.current,
  .account-tabs a:hover,.account-tabs a[aria-current="page"],.catalog-tabs a:hover,
  .catalog-tabs a[aria-current="page"],.admin-nav a:hover,.admin-nav a[aria-current="page"])
{ background: var(--soft); color: var(--accent2); border-color: var(--accent); }
html[data-theme="dark"] .topbar nav a { color: #c5d3d9; }
html[data-theme="dark"] .topbar nav a:last-child { border-color: var(--night-line); }
html[data-theme="dark"] .topbar nav .theme-toggle { color: var(--night-text); border-color: #49616b; }
html[data-theme="dark"] .primary { color: #10221f; }
html[data-theme="dark"] .theme-car .primary { color: #152239; }

/* Text that is explicitly muted in section styles needs a lighter night value. */
html[data-theme="dark"] :is(
  .brand small,.filters p,.content-head p,.card-body p,.detail-info p,.muted,
  .empty,.no-photo,.clear,.check,.gallery-navigation,.property-location-heading p,
  .property-location-status,.property-location-unavailable,.account-tabs a,
  .auth-panel>p,.auth-switch,.field-help,.profile-summary p,.account-heading p,
  .publish-choices p,.public-profile p,.membership-heading p,.membership-history>p,
  .membership-notice,.broker-directory-heading p,.admin-nav-label,.admin-nav a,
  .admin-sidebar-note,.profile-page-heading p,.profile-eyebrow,.profile-photo-status,
  .publication-section-help,.publication-section legend span,.publication-photo-caption,
  .publication-upload-status,.catalog-results,.catalog-pagination,.catalog-table small,
  .membership-order-heading small,.membership-order-heading p,.membership-order-meta
) { color: var(--night-muted); }
html[data-theme="dark"] :is(.card-body strong,.price,.badge,.publish-choices h2,
  .broker-back,.account-quick-links,.catalog-results strong,.catalog-table td>strong,
  .membership-notice strong,.profile-page-heading h1>span) { color: var(--accent2); }
html[data-theme="dark"] .badge { background: var(--soft); }
html[data-theme="dark"] :is(.card-cta,.profile-summary hr,.membership-order,
  .catalog-table td,.catalog-filters,.profile-photo-editor) { border-color: var(--night-line); }
html[data-theme="dark"] :is(.form-errors,.membership-admin-warning,.uf-notice) {
  background: #3b3026;
  border-color: #665035;
  color: #ffe4ae;
}
html[data-theme="dark"] .membership-test-notice { color: #f2ce8c; }
html[data-theme="dark"] .account-messages p { background: #1a3a35; border-color: #3b7668; color: #d7f5ea; }

/* Additional panels in the account and administration views. */
html[data-theme="dark"] :is(
  .admin-card,.admin-panel,.admin-stat,.admin-form,.admin-table-wrap,.admin-filters,
  .profile-card,.profile-panel,.profile-section,.profile-details,.profile-form,
  .publication-card,.publication-panel,.publication-editor-card,.membership-card,
  .membership-history,.membership-plan,.broker-card,.broker-profile-card,
  .property-review,.property-review-form,.property-review-summary,.vehicle-video
) { background: var(--night-surface); border-color: var(--night-line); color: var(--night-text); }
html[data-theme="dark"] :is(.catalog-table th,.admin-table th) { background: var(--night-raised); color: var(--night-muted); }
html[data-theme="dark"] :is(.admin-table td,.admin-footer,.admin-nav,.admin-sidebar-note) { border-color: var(--night-line); }
html[data-theme="dark"] :is(.admin-nav a,.catalog-tabs a,.catalog-actions button) { color: var(--night-text); }
html[data-theme="dark"] .admin-nav a[aria-current="page"] { color: var(--accent2); }
html[data-theme="dark"] .profile-public-link { color: var(--accent2); }
html[data-theme="dark"] .theme-toggle { background: #22343d; border-color: #49616b; color: var(--night-text, #e9f0f2); box-shadow: 0 2px 8px #0002; }
html[data-theme="dark"] .theme-toggle:hover { background: #2a4149; border-color: #86d7bb; color: #fff; box-shadow: 0 5px 14px #0004; }
html[data-theme="dark"] .theme-toggle-icon { background: #c6f17b; color: #18362f; }
html[data-theme="dark"] .cookie-preferences-toggle { background: #22343d; border-color: #49616b; color: var(--night-text, #e9f0f2); box-shadow: 0 2px 8px #0002; }
html[data-theme="dark"] .cookie-preferences-toggle:hover { background: #2a4149; border-color: #86d7bb; color: #fff; box-shadow: 0 5px 14px #0004; }
html[data-theme="dark"] .cookie-preferences-icon { background: #c6f17b; color: #18362f; }
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }

/* Profile editor has its own component palette. */
html[data-theme="dark"] :is(.profile-editor,.profile-shortcuts,.profile-savebar,
  .profile-upload-button,.profile-tip,.profile-section-icon,.profile-shortcut-icon) {
  background: var(--night-surface);
  border-color: var(--night-line);
  color: var(--night-text);
}
html[data-theme="dark"] :is(.profile-savebar,.profile-section,.profile-shortcut) {
  border-color: var(--night-line);
}
html[data-theme="dark"] :is(.profile-field input,.profile-field select,.profile-field textarea,
  .profile-field input:focus,.profile-field select:focus,.profile-field textarea:focus) {
  background: #17232c;
  border-color: #465862;
  color: var(--night-text);
}
html[data-theme="dark"] :is(.profile-section-heading p,.profile-field-caption .field-help,
  .profile-bio-count,.profile-save-state,.profile-shortcuts small,.profile-tip p,
  .profile-tip-signature,.profile-visibility-note p,.profile-identity-text p,
  .profile-photo-actions>p,.profile-remove-photo) { color: var(--night-muted); }
html[data-theme="dark"] :is(.profile-section-heading h2,.profile-field>label,
  .profile-shortcuts strong,.profile-tip h2,.profile-identity-text .profile-person) {
  color: var(--night-text);
}
html[data-theme="dark"] .profile-tip .profile-eyebrow { color: var(--accent2); }
html[data-theme="dark"] .profile-tip-icon { background: var(--night-raised); border-color: var(--night-line); color: var(--accent2); }
html[data-theme="dark"] .profile-settings-page .profile-photo-preview { border-color: var(--night-surface); }
html[data-theme="dark"] .profile-upload-button:hover { background: var(--night-raised); }

/* Dashboard, tables and edit forms in administration. */
html[data-theme="dark"] :is(.admin-stat-card,.admin-private-label,.admin-user-summary,
  .admin-button-secondary,.admin-table tbody tr) {
  background: var(--night-surface);
  border-color: var(--night-line);
  color: var(--night-text);
}
html[data-theme="dark"] :is(.admin-stat-label,.admin-stat-detail,.admin-stat-detail>span:first-child,
  .admin-stat-link,.admin-card-heading>a,.admin-user-summary>p,.admin-user-summary dt,
  .admin-user-summary dd,.admin-summary-note,.admin-sidebar-note a,.admin-footer a,
  .admin-private-label,.admin-record div>span,.admin-record div>small,
  .admin-table td[data-label]::before) { color: var(--night-muted); }
html[data-theme="dark"] :is(.admin-stat-number,.admin-section-intro h2,.admin-heading h1,
  .admin-card-heading h2,.admin-record strong) { color: var(--night-text); }
html[data-theme="dark"] :is(.admin-icon-tile,.admin-list-icon,.admin-results-heading h2>span,
  .admin-count-pill,.admin-plan-badge,.admin-status,.admin-user-avatar,
  .admin-empty-icon) { background: var(--night-raised); color: var(--night-muted); }
html[data-theme="dark"] .admin-icon-blue { background: #253451!important; color: #b8caff!important; }
html[data-theme="dark"] :is(.admin-stat-link,.admin-card-heading,.admin-table th,
  .admin-table td,.admin-user-summary .admin-summary-note) { border-color: var(--night-line); }
html[data-theme="dark"] :is(.admin-filters input,.admin-filters select,
  .admin-user-form .account-field input,.admin-user-form .account-field select) {
  background: #17232c;
  border-color: #465862;
  color: var(--night-text);
}
html[data-theme="dark"] .admin-table tbody tr:hover { background: var(--night-raised); }
html[data-theme="dark"] .admin-row-actions .admin-edit-link { color: var(--accent2); }
@media (max-width: 640px) {
  html[data-theme="dark"] .admin-table .admin-row-actions>a,
  html[data-theme="dark"] .admin-table .admin-row-actions button {
    background: var(--night-raised);
    border-color: var(--night-line);
    color: var(--night-text);
  }
}

/* Membership cards and payment status surfaces. */
html[data-theme="dark"] :is(.membership-table-wrap,.membership-terms,.membership-addon,
  .membership-subscription,.membership-change,.membership-secondary) {
  background: var(--night-surface);
  border-color: var(--night-line);
  color: var(--night-text);
}
html[data-theme="dark"] :is(.membership-card .membership-price,.membership-block-label) { color: var(--night-text); }
html[data-theme="dark"] :is(.membership-card>p,.membership-card-note,.membership-price small,
  .membership-addon small,.membership-calculator-help,.membership-terms ul,
  .membership-history td small,.membership-subscription p,.membership-empty,
  .membership-pending small,.membership-pending .membership-payment-message) {
  color: var(--night-muted);
}
html[data-theme="dark"] .membership-history th { background: var(--night-raised); color: var(--night-muted); }
html[data-theme="dark"] .membership-empty { border-color: var(--night-line); }
html[data-theme="dark"] .membership-block-input { background: #17232c; border-color: #465862; color: var(--night-text); }

/* Shared account controls also appear in catalogue and detail headers. */
html[data-theme="dark"] .topbar nav .account-profile-link,
html[data-theme="dark"] .topbar nav .account-profile-control .account-profile-link {
  background: var(--night-raised);
  border-color: #4a606c;
  color: var(--night-text);
  box-shadow: none;
}
html[data-theme="dark"] .topbar nav .account-profile-control .account-profile-link:hover,
html[data-theme="dark"] .topbar nav .account-profile-toggle[aria-expanded="true"] {
  background: #2a414a;
  border-color: var(--accent);
  color: var(--night-text);
  box-shadow: 0 0 0 3px #62d7bc18;
}
html[data-theme="dark"] .account-profile-brand { color: #10221f; }
html[data-theme="dark"] .account-profile-control .account-profile-avatar {
  border-color: var(--night-raised);
  box-shadow: 0 0 0 1px #4a606c;
}
html[data-theme="dark"] .account-profile-card {
  background: var(--night-raised);
  border-color: #4a606c;
  color: var(--night-text);
  box-shadow: 0 18px 44px #0006;
}
html[data-theme="dark"] :is(.account-profile-card-label,.account-profile-card-name) { color: var(--night-text); }
html[data-theme="dark"] .account-profile-email { color: var(--night-muted); }
html[data-theme="dark"] :is(.publication-dashboard-page,.profile-settings-page,.publication-editor-page) .account-tabs a[aria-current="page"] {
  box-shadow: inset 0 -2px var(--accent);
}
html[data-theme="dark"] .topbar nav .account-profile-card :is(.account-profile-manage,.account-profile-signout) {
  border-color: #4a606c;
  color: var(--night-text);
}
html[data-theme="dark"] .topbar nav .account-profile-card :is(.account-profile-manage,.account-profile-signout):hover {
  color: var(--accent2);
}
html[data-theme="dark"] .account-messages p {
  background: #1c3c33;
  border-color: #3b6a58;
  color: #b8ecd1;
}
html[data-theme="dark"] .form-errors {
  background: #3b2530;
  color: #ffc3d1;
}

/* Publisher labels and price details keep their contrast on all listing cards. */
html[data-theme="dark"] .listing-publisher--detail { background: var(--night-raised); border-color: var(--night-line); }
html[data-theme="dark"] .listing-publisher-copy strong,
html[data-theme="dark"] .card-body .listing-publisher .listing-publisher-copy strong { color: var(--night-text); }
html[data-theme="dark"] :is(.listing-publisher-copy small,.listing-publisher-copy .listing-publisher-person,
  .property-price-secondary,.property-price-date) { color: var(--night-muted); }

/* Payment actions and status chips use the same dark palette as the account. */
html[data-theme="dark"] .membership-primary { color: #10221f; }
html[data-theme="dark"] .membership-card-featured { border-color: var(--accent); }
html[data-theme="dark"] .membership-history td { border-color: var(--night-line); }
html[data-theme="dark"] .membership-status { background: #293a47; color: #c7d7df; }
html[data-theme="dark"] .membership-status:is(.status-confirmado,.status-activa) { background: #1d3c33; color: #a4e8c3; }
html[data-theme="dark"] .membership-status:is(.status-pendiente,.status-revision,.status-pausada) { background: #3e3320; color: #f5d69a; }

/* The landing page is already cinematic; its light setting offers a light frame. */
html[data-theme="light"] .home-page { background: #f5f6f3; color: #1d2b27; }
html[data-theme="light"] .home-page .portal-brand span,
html[data-theme="light"] .home-page .portal-footer { color: #55665e; }
html[data-theme="light"] .home-page .portal-header .publish-link,
html[data-theme="light"] .home-page .portal-header .theme-toggle { border-color: #b9cec3; }
html[data-theme="light"] .home-page .category { color: white; }
html[data-theme="light"] .home-page .portal-title { background: #fff; color: #1d2b27; }
html[data-theme="dark"] .home-page { background: #171b1b; color: #fff; }
@media (max-width: 1100px) {
  html[data-theme="light"] .home-page .portal-title { background: #e6eee8; }
}
