/* TaskLink v67 — persistent light/dark theme */
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #070d18;
  --surface: #0d1726;
  --surface-soft: #111e31;
  --surface-blue: #10284b;
  --navy-950: #f5f8ff;
  --navy-900: #e7eef9;
  --navy-800: #cbd9ed;
  --navy-700: #aebed4;
  --blue-700: #6fa8ff;
  --blue-600: #4b8df8;
  --blue-500: #3b82f6;
  --blue-100: #214879;
  --blue-50: #0e203b;
  --text: #eaf1fb;
  --text-soft: #b1bfd2;
  --text-muted: #8293aa;
  --line: #1e2d42;
  --line-strong: #304663;
  --success: #42d39a;
  --success-soft: #0d2b24;
  --warning: #f0ad4e;
  --warning-soft: #33240e;
  --danger: #ff7185;
  --danger-soft: #35151d;
  --shadow-sm: 0 8px 26px rgba(0,0,0,.22);
  --shadow-md: 0 18px 52px rgba(0,0,0,.32);
  --shadow-lg: 0 30px 90px rgba(0,0,0,.46);
}

/* Logo variants are exact PNG assets with alpha, not CSS filters. */
.theme-logo-dark { display: none !important; }
html[data-theme="dark"] .theme-logo-light { display: none !important; }
html[data-theme="dark"] .theme-logo-dark { display: block !important; }

/* Tiny day/night switch: visible enough to discover, quiet enough not to compete. */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 48px;
  min-width: 48px;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
}
.theme-toggle-track {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 42px;
  height: 24px;
  padding: 0 4px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-muted);
  transition: background .2s ease,border-color .2s ease,color .2s ease;
}
.theme-toggle .icon { width: 12px; height: 12px; z-index: 1; pointer-events: none; }
.theme-icon-sun { justify-self: start; }
.theme-icon-moon { justify-self: end; }
.theme-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 7px rgba(3,22,51,.22);
  transition: transform .2s ease,background .2s ease;
}
html[data-theme="dark"] .theme-toggle-track { background: #15233a; border-color: #355071; color: #d8e6fb; }
html[data-theme="dark"] .theme-toggle-knob { transform: translateX(18px); background: #6fa8ff; }
.theme-toggle:hover .theme-toggle-track { border-color: var(--blue-500); }

/* New transparent/cropped logos need no artificial white crop canvas. */
.brand-button { background: transparent !important; }
.brand-crop { display: flex; align-items: center; overflow: visible; }
.brand-crop img { position: static !important; width: 168px !important; height: auto; max-width: 100%; }
.onboarding-logo { height: auto !important; margin: 0 0 8px !important; overflow: visible !important; }
.onboarding-logo img { position: static !important; width: 100%; height: auto; }
.hero-brand-mark { height: auto !important; margin: 0 auto 4px !important; overflow: visible !important; }
.hero-brand-mark img { position: static !important; width: 100%; height: auto; }

/* Dark theme core surfaces. */
html[data-theme="dark"] body,
html[data-theme="dark"] .onboarding { background: var(--canvas); }
html[data-theme="dark"] .onboarding::before { background: rgba(35, 83, 148, .18); }
html[data-theme="dark"] .onboarding::after { background: rgba(17, 51, 93, .20); }
html[data-theme="dark"] .topbar {
  border-bottom-color: rgba(48,70,99,.72);
  background: rgba(7,13,24,.94);
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
}
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .registration-card,
html[data-theme="dark"] .hero,
html[data-theme="dark"] .hero-search,
html[data-theme="dark"] .hero-callout,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .market-card,
html[data-theme="dark"] .order-card,
html[data-theme="dark"] .transaction-row,
html[data-theme="dark"] .ticket-card,
html[data-theme="dark"] .admin-card,
html[data-theme="dark"] .balance-card:not(.is-primary),
html[data-theme="dark"] .review-card,
html[data-theme="dark"] .settings-profile-card,
html[data-theme="dark"] .settings-form-card,
html[data-theme="dark"] .support-action,
html[data-theme="dark"] .drawer,
html[data-theme="dark"] .panel-header,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .legal-choice,
html[data-theme="dark"] .chat-list,
html[data-theme="dark"] .chat-row,
html[data-theme="dark"] .detail-section,
html[data-theme="dark"] .admin-user-card,
html[data-theme="dark"] .admin-chat-row,
html[data-theme="dark"] .order-detail-grid article,
html[data-theme="dark"] .portfolio-media-item,
html[data-theme="dark"] .promotion-option,
html[data-theme="dark"] .promotion-picker,
html[data-theme="dark"] .account-security-card,
html[data-theme="dark"] .admin-mfa-grid article,
html[data-theme="dark"] .crypto-history-card,
html[data-theme="dark"] .crypto-wallet,
html[data-theme="dark"] .crypto-panel input:not([type=checkbox]):not([type=radio]),
html[data-theme="dark"] .crypto-panel textarea,
html[data-theme="dark"] .crypto-panel select {
  background: var(--surface) !important;
  border-color: var(--line) !important;
  color: var(--text) !important;
}
html[data-theme="dark"] .compact-control,
html[data-theme="dark"] .balance-chip,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .profile-trigger,
html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .status-completed,
html[data-theme="dark"] .status-resolved,
html[data-theme="dark"] .trust-chip,
html[data-theme="dark"] .category-button,
html[data-theme="dark"] .filter-button,
html[data-theme="dark"] .pagination .button,
html[data-theme="dark"] .recovery-code-grid code {
  background: var(--surface) !important;
  border-color: var(--line) !important;
  color: var(--text) !important;
}
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: #0a1423;
  border-color: var(--line-strong);
  color: var(--text);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #6f829d; }
html[data-theme="dark"] input:hover,
html[data-theme="dark"] textarea:hover,
html[data-theme="dark"] select:hover { border-color: #46658c; }
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:focus { border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(59,130,246,.17); }
html[data-theme="dark"] .mobile-nav {
  border-color: rgba(48,70,99,.92);
  background: rgba(10,20,35,.96);
  box-shadow: 0 14px 42px rgba(0,0,0,.42);
}
html[data-theme="dark"] .mobile-link.is-active { background: var(--surface-blue); color: #8ab6ff; }
html[data-theme="dark"] .overlay,
html[data-theme="dark"] .modal::backdrop { background: rgba(0,0,0,.62); }
html[data-theme="dark"] .mfa-qr { background: #fff !important; border-color: #d6dfec !important; }
html[data-theme="dark"] .chat-row:hover,
html[data-theme="dark"] .chat-row.is-active,
html[data-theme="dark"] .sidebar-link:hover,
html[data-theme="dark"] .desktop-shortcuts button:hover,
html[data-theme="dark"] .desktop-shortcuts button.is-active,
html[data-theme="dark"] .legal-choice:hover { background: var(--surface-soft) !important; }
html[data-theme="dark"] .sidebar-link.is-active,
html[data-theme="dark"] .category-button.is-active { background: var(--surface-blue) !important; color: #8ab6ff !important; }
html[data-theme="dark"] .notice { background: #0f2038; border-color: #284b75; }
html[data-theme="dark"] .notice.is-warning {
  background: #38270d;
  border-color: #8a601e;
  color: #ffd98a;
}
html[data-theme="dark"] .notice.is-warning > span { color: #ffd98a; }
html[data-theme="dark"] .support-identity {
  background: #38270d;
  border-color: #8a601e;
  color: #ffd98a;
}
html[data-theme="dark"] .notice.is-danger { background: var(--danger-soft); border-color: #703043; }
html[data-theme="dark"] .button-primary { color: #fff; }
html[data-theme="dark"] .balance-card.is-primary { background: linear-gradient(145deg,#0f3e7a,#0b2851); border-color: #285a96; }
html[data-theme="dark"] .crypto-method:has(input:checked) { background: #0d2446 !important; border-color: #3979cf !important; }
html[data-theme="dark"] .crypto-amount-steppers button { background: #102343 !important; border-color: #2b4b74 !important; color: #7eb0ff !important; }
html[data-theme="dark"] .telegram-connect-card .tg-state { background: #10233f; color: #9dc2ff; }
html[data-theme="dark"] .telegram-connect-card .tg-state.is-connected { background: #0c2a22; color: #73deb7; }
html[data-theme="dark"] .cookie-banner { background: rgba(13,23,38,.98); border-color: var(--line); box-shadow: var(--shadow-lg); }
html[data-theme="dark"] hr { border-color: var(--line) !important; }
html[data-theme="dark"] ::selection { background: #245da6; color: #fff; }

/* Auth controls are grouped on the top-right and remain usable on phones. */
.onboarding-controls {
  position: absolute;
  top: max(20px,var(--safe-top));
  right: max(22px,var(--safe-right));
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
}
.onboarding-controls .onboarding-language { position: static; }

/* 2FA can be deferred, but the safety consequence is explicit. */
.mfa-skip-block { display: grid; gap: 8px; margin-top: 14px; text-align: center; }
.mfa-skip-block .button { width: 100%; }
.mfa-skip-note { margin: 0; color: var(--text-muted); font-size: .84rem; line-height: 1.45; }

@media (max-width: 760px) {
  .brand-crop img { width: 142px !important; }
  .theme-toggle { width: 42px; min-width: 42px; }
  .onboarding-controls { top: max(12px,var(--safe-top)); right: max(12px,var(--safe-right)); gap: 5px; }
  .onboarding-controls .compact-control { min-width: 64px; }
}

/* v64 full dark-surface pass: neutral panels that historically used --white/#fff. */
html[data-theme="dark"] .search-panel,
html[data-theme="dark"] .messages-shell,
html[data-theme="dark"] .conversation-header,
html[data-theme="dark"] .message:not(.is-own),
html[data-theme="dark"] .message-composer,
html[data-theme="dark"] .profile-header,
html[data-theme="dark"] .rating-card,
html[data-theme="dark"] .admin-stat,
html[data-theme="dark"] .admin-tab,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .rate-source,
html[data-theme="dark"] .message-format-toolbar button,
html[data-theme="dark"] .attachment-button,
html[data-theme="dark"] .file-limits-hint,
html[data-theme="dark"] .file-message-actions button,
html[data-theme="dark"] .file-preview-fallback-icon,
html[data-theme="dark"] .support-message,
html[data-theme="dark"] .notification-list button,
html[data-theme="dark"] .translator-editor,
html[data-theme="dark"] .translator-result,
html[data-theme="dark"] .review-deadline,
html[data-theme="dark"] .profile-review-tab,
html[data-theme="dark"] .service-media-drop,
html[data-theme="dark"] .service-media-counters span,
html[data-theme="dark"] .service-media-draft-item,
html[data-theme="dark"] .service-media-gallery-item,
html[data-theme="dark"] .delivery-result-card,
html[data-theme="dark"] .delivery-drive-link,
html[data-theme="dark"] .portfolio-card,
html[data-theme="dark"] .commission-preview > span,
html[data-theme="dark"] .revision-metrics > span,
html[data-theme="dark"] .refund-section,
html[data-theme="dark"] .refund-status-card,
html[data-theme="dark"] .custom-select-trigger,
html[data-theme="dark"] .custom-select-menu,
html[data-theme="dark"] .tasklink-date-trigger,
html[data-theme="dark"] .tasklink-date-picker,
html[data-theme="dark"] .message-editor,
html[data-theme="dark"] .listing-active-control,
html[data-theme="dark"] .legal-library-item,
html[data-theme="dark"] .xp-orbit,
html[data-theme="dark"] .xp-metrics article,
html[data-theme="dark"] .xp-levels article,
html[data-theme="dark"] .certificate-card,
html[data-theme="dark"] .tasklink-file-picker,
html[data-theme="dark"] .admin-activity-row,
html[data-theme="dark"] .admin-note,
html[data-theme="dark"] .admin-evidence-list article,
html[data-theme="dark"] .admin-evidence-messages article,
html[data-theme="dark"] .admin-evidence-file {
  background: var(--surface) !important;
  border-color: var(--line) !important;
  color: var(--text) !important;
}
html[data-theme="dark"] .custom-select-option:hover,
html[data-theme="dark"] .custom-select-option.is-active,
html[data-theme="dark"] .tasklink-date-picker button:hover {
  background: var(--surface-soft) !important;
}
html[data-theme="dark"] .promotion-option,
html[data-theme="dark"] .promotion-picker,
html[data-theme="dark"] .xp-breakdown-grid > span,
html[data-theme="dark"] .xp-review-rules span,
html[data-theme="dark"] .rank-formula {
  background-color: var(--surface) !important;
  border-color: var(--line) !important;
  color: var(--text) !important;
}
html[data-theme="dark"] .portfolio-media-item { background: var(--surface-soft) !important; }
html[data-theme="dark"] .message.is-own { background: #123b74 !important; color: #f5f8ff !important; }
html[data-theme="dark"] .status-pill,
html[data-theme="dark"] .badge,
html[data-theme="dark"] .chip { border-color: rgba(126,176,255,.22); }
html[data-theme="dark"] a { text-underline-offset: 3px; }
html[data-theme="dark"] * { scrollbar-color: #304663 #0a1423; }
html[data-theme="dark"] .telegram-connect-card .tg-logo,
html[data-theme="dark"] .telegram-registration-prompt .tg-prompt-icon { background:#102742; color:#55baf0; }
html[data-theme="dark"] .crypto-wallet-delete:hover { background:#13243a; color:#7eb0ff; }

/* v67 — complete dark-theme surface audit.
   Keep genuine white only where it carries information (QR codes/media), and
   darken every application canvas/control that previously leaked a light-only
   hard-coded background. */
html[data-theme="dark"] .workspace,
html[data-theme="dark"] .workspace-layout,
html[data-theme="dark"] .view,
html[data-theme="dark"] .page-shell,
html[data-theme="dark"] .translator-page,
html[data-theme="dark"] .messages-feed,
html[data-theme="dark"] .conversation,
html[data-theme="dark"] .chat-placeholder {
  background: var(--canvas) !important;
  color: var(--text) !important;
}
html[data-theme="dark"] .conversation {
  border-color: var(--line) !important;
}
html[data-theme="dark"] .message.is-mine {
  background: #143f78 !important;
  border-color: #2f619d !important;
  color: #f5f8ff !important;
}
html[data-theme="dark"] .message.is-system {
  background: #101d2f !important;
  border-color: #273b57 !important;
  color: var(--text) !important;
}
html[data-theme="dark"] .message.is-system p,
html[data-theme="dark"] .message.is-mine p { color: inherit !important; }
html[data-theme="dark"] .translation-result-text {
  background: #0b1930 !important;
  border-color: #263d5d !important;
  color: #e8f0fb !important;
}
html[data-theme="dark"] .translator-result.is-empty .state-icon,
html[data-theme="dark"] .review-edit-heading .state-icon,
html[data-theme="dark"] .order-media-icon,
html[data-theme="dark"] .certificate-icon,
html[data-theme="dark"] .legal-library-icon,
html[data-theme="dark"] .cookie-banner-icon {
  background: #10233d !important;
  color: #7eb0ff !important;
}
html[data-theme="dark"] .input-prefix,
html[data-theme="dark"] .support-thread,
html[data-theme="dark"] .order-delivery-section,
html[data-theme="dark"] .revision-offer-card,
html[data-theme="dark"] .tip-section,
html[data-theme="dark"] .certificate-proof,
html[data-theme="dark"] .xp-breakdown,
html[data-theme="dark"] .rank-factor-grid span,
html[data-theme="dark"] .rating-choice span,
html[data-theme="dark"] [data-review-window].is-expired {
  background: var(--surface) !important;
  border-color: var(--line) !important;
  color: var(--text) !important;
}
html[data-theme="dark"] .success-score-hero,
html[data-theme="dark"] .success-score-card:hover,
html[data-theme="dark"] .success-mini,
html[data-theme="dark"] .notice.notice-success,
html[data-theme="dark"] .tip-section.is-sent {
  background: #0d2a24 !important;
  border-color: #245443 !important;
  color: #8be1c2 !important;
}
html[data-theme="dark"] .promotion-pill.is-bump,
html[data-theme="dark"] .promotion-theme.is-gold,
html[data-theme="dark"] .promotion-theme.is-sand {
  background: #322711 !important;
  border-color: #6c5420 !important;
  color: #f2c766 !important;
}
html[data-theme="dark"] .promotion-theme.is-coral {
  background: #351d20 !important;
  border-color: #6f3a41 !important;
  color: #ff9aa6 !important;
}
html[data-theme="dark"] .market-card.is-inactive {
  background: #0c1421 !important;
  border-color: #263448 !important;
}
html[data-theme="dark"] .xp-scale,
html[data-theme="dark"] .xp-levels article.is-current {
  background: #102443 !important;
  border-color: #315d92 !important;
}
html[data-theme="dark"] .listing-active-track::after { background: #e9f1fb !important; }
html[data-theme="dark"] .file-preview-stage.is-text { background: #09121f !important; }
html[data-theme="dark"] .file-preview-stage iframe,
html[data-theme="dark"] .certificate-review-image img { background: #fff !important; }
html[data-theme="dark"] .service-media-drop:hover { background: #10213a !important; }

/* TaskLink validation popover must be readable in dark mode too. */
html[data-theme="dark"] .validation-popover {
  background: #101b2c !important;
  border-color: #304866 !important;
  color: #f4f8ff !important;
  box-shadow: 0 18px 50px rgba(0,0,0,.46), 0 3px 12px rgba(0,0,0,.26) !important;
}
html[data-theme="dark"] .validation-popover-message { color: #f4f8ff !important; }
html[data-theme="dark"] .validation-popover-arrow {
  background: #101b2c !important;
  border-color: #304866 !important;
}

/* Native autofill can otherwise flash a white rectangle in the dark UI. */
html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #0a1423 inset;
  caret-color: var(--text);
}

/* v67 — final contrast pass for score, status, finance and compact modal surfaces. */
html[data-theme="dark"] .xp-hero {
  background: linear-gradient(145deg, #102440, #0c1a2e) !important;
  border-color: #29496f !important;
  color: var(--text) !important;
}
html[data-theme="dark"] .xp-hero small,
html[data-theme="dark"] .xp-hero em { color: #9fb0c7 !important; }
html[data-theme="dark"] .xp-orbit {
  background: #091525 !important;
  border-color: #365a86 !important;
  color: #8ab6ff !important;
  box-shadow: 0 14px 34px rgba(0,0,0,.30) !important;
}
html[data-theme="dark"] .xp-progress > div,
html[data-theme="dark"] .xp-scale-track,
html[data-theme="dark"] .rating-card-progress { background: #17283f !important; }
html[data-theme="dark"] .success-score-card:hover {
  background: #112139 !important;
  border-color: #3b618d !important;
}
html[data-theme="dark"] .commission-preview .is-net,
html[data-theme="dark"] .delivery-result-note {
  background: #0d2a24 !important;
  border-color: #245443 !important;
  color: #9be6ca !important;
}
html[data-theme="dark"] .portfolio-cover,
html[data-theme="dark"] .portfolio-media-item img,
html[data-theme="dark"] .portfolio-media-item > button > span:first-child {
  background: #091525 !important;
}
html[data-theme="dark"] .rating-choice input[value="1"]:checked + span {
  background: #35151d !important;
  border-color: #a64556 !important;
  color: #ff9aaa !important;
}
html[data-theme="dark"] .rating-choice input[value="2"]:checked + span {
  background: #38200f !important;
  border-color: #9a5626 !important;
  color: #ffad72 !important;
}
html[data-theme="dark"] .rating-choice input[value="3"]:checked + span {
  background: #332a11 !important;
  border-color: #8e762a !important;
  color: #f0ca55 !important;
}
html[data-theme="dark"] .telegram-registration-prompt > p { color: var(--text-soft) !important; }
html[data-theme="dark"] .telegram-registration-prompt [data-tg-reg-state] { color: #8ab6ff !important; }

/* v71 — dark-theme contrast and paid-highlight consistency audit. */
html[data-theme="dark"] .order-card {
  background: #0d1726 !important;
  border-color: #21334a !important;
  color: #eaf1fb !important;
}
html[data-theme="dark"] .order-card h3,
html[data-theme="dark"] .order-card .order-title-link,
html[data-theme="dark"] .order-card .price {
  color: #f4f8ff !important;
}
html[data-theme="dark"] .order-card p,
html[data-theme="dark"] .order-card .order-people {
  color: #aebed4 !important;
}
html[data-theme="dark"] .order-card .mini-tag {
  background: #14243a !important;
  border-color: #2d4565 !important;
  color: #c9d8ec !important;
}

html[data-theme="dark"] .translator-teaser {
  background: linear-gradient(105deg, #0f1d31 0%, #0d1726 62%) !important;
  border-color: #29486d !important;
  color: #eaf1fb !important;
  box-shadow: 0 12px 30px rgba(0,0,0,.24) !important;
}
html[data-theme="dark"] .translator-teaser:hover {
  border-color: #4b8df8 !important;
  background: linear-gradient(105deg, #122744 0%, #0f1c2e 62%) !important;
}
html[data-theme="dark"] .translator-teaser strong { color: #f4f8ff !important; }
html[data-theme="dark"] .translator-teaser small { color: #9fb0c7 !important; }
html[data-theme="dark"] .translator-teaser .text-link { color: #7eb0ff !important; }

/* All five review choices use the same dark base and each selected state keeps
   a readable semantic accent. Previously only 1–3 had dark-mode overrides. */
html[data-theme="dark"] .rating-choice span {
  background: #0d1726 !important;
  border-color: #2c415e !important;
  color: #c8d5e7 !important;
}
html[data-theme="dark"] .rating-choice label:hover span {
  background: #122138 !important;
  border-color: #41648d !important;
}
html[data-theme="dark"] .rating-choice input[value="4"]:checked + span {
  background: #1b2c16 !important;
  border-color: #689a2c !important;
  color: #b8df76 !important;
  box-shadow: 0 0 0 1px #689a2c !important;
}
html[data-theme="dark"] .rating-choice input[value="5"]:checked + span {
  background: #0d2b20 !important;
  border-color: #2b8c5e !important;
  color: #7ad9aa !important;
  box-shadow: 0 0 0 1px #2b8c5e !important;
}

/* Promotion picker: all theme swatches must remain legible on a dark canvas. */
html[data-theme="dark"] .promotion-theme.is-blue {
  background: #102d50 !important;
  border-color: #315f91 !important;
  color: #8fc0ff !important;
}
html[data-theme="dark"] .promotion-theme.is-mint {
  background: #0e2c27 !important;
  border-color: #2d695d !important;
  color: #8fe2ce !important;
}
html[data-theme="dark"] .promotion-pill.is-premium {
  background: #102c51 !important;
  color: #8fc0ff !important;
}
html[data-theme="dark"] .promotion-pill.is-highlight {
  background: #0e2c27 !important;
  color: #8fe2ce !important;
}

/* Paid listing highlights stay visibly different from organic cards in dark mode
   without turning into light-theme islands or reducing text contrast. */
html[data-theme="dark"] .market-card.is-promoted-premium {
  background: #0e1929 !important;
  border-color: #356ba9 !important;
  box-shadow: 0 12px 34px rgba(15,109,245,.14) !important;
}
html[data-theme="dark"] .market-card.is-highlight-blue {
  background: linear-gradient(0deg, rgba(32,91,151,.23), rgba(32,91,151,.23)), #0d1726 !important;
  border-color: #315f91 !important;
}
html[data-theme="dark"] .market-card.is-highlight-coral {
  background: linear-gradient(0deg, rgba(126,54,65,.22), rgba(126,54,65,.22)), #0d1726 !important;
  border-color: #75424b !important;
}
html[data-theme="dark"] .market-card.is-highlight-gold,
html[data-theme="dark"] .market-card.is-highlight-sand {
  background: linear-gradient(0deg, rgba(126,91,24,.22), rgba(126,91,24,.22)), #0d1726 !important;
  border-color: #735c28 !important;
  box-shadow: 0 12px 32px rgba(175,122,0,.10) !important;
}
html[data-theme="dark"] .market-card.is-highlight-mint {
  background: linear-gradient(0deg, rgba(26,102,88,.22), rgba(26,102,88,.22)), #0d1726 !important;
  border-color: #326f63 !important;
  box-shadow: 0 12px 32px rgba(11,130,109,.09) !important;
}
html[data-theme="dark"] .market-card:is(.is-promoted-premium,.is-highlight-blue,.is-highlight-coral,.is-highlight-gold,.is-highlight-sand,.is-highlight-mint) h3,
html[data-theme="dark"] .market-card:is(.is-promoted-premium,.is-highlight-blue,.is-highlight-coral,.is-highlight-gold,.is-highlight-sand,.is-highlight-mint) .price,
html[data-theme="dark"] .market-card:is(.is-promoted-premium,.is-highlight-blue,.is-highlight-coral,.is-highlight-gold,.is-highlight-sand,.is-highlight-mint) strong {
  color: #f4f8ff !important;
}
html[data-theme="dark"] .market-card:is(.is-promoted-premium,.is-highlight-blue,.is-highlight-coral,.is-highlight-gold,.is-highlight-sand,.is-highlight-mint) p,
html[data-theme="dark"] .market-card:is(.is-promoted-premium,.is-highlight-blue,.is-highlight-coral,.is-highlight-gold,.is-highlight-sand,.is-highlight-mint) small {
  color: #aebed4 !important;
}

/* v72 — dark-theme action contrast: keep brand blue while preserving readable white labels. */
html[data-theme="dark"] .button-primary {
  border-color: #2563eb;
  background: #2563eb;
}
html[data-theme="dark"] .button-primary:hover:not(:disabled) {
  border-color: #1d4ed8;
  background: #1d4ed8;
}

/* v74 clean — keep the new Back/filter controls consistent in dark mode. */
html[data-theme="dark"] .panel-back-button {
  background: var(--surface) !important;
  border-color: var(--line) !important;
  color: var(--text) !important;
}
html[data-theme="dark"] .panel-back-button:hover:not(:disabled) {
  background: var(--surface-strong, #132238) !important;
  border-color: var(--line-strong) !important;
}
html[data-theme="dark"] .filter-button.is-active,
html[data-theme="dark"] .filter-button[aria-pressed="true"] {
  background: var(--blue-600) !important;
  border-color: var(--blue-600) !important;
  color: #fff !important;
}

/* v87 — final dark-theme hardening.
   Order cards use semantic tokens in components.css as the primary fix; these
   high-specificity rules also protect already-rendered cards during theme flips
   and cover a few remaining light-only status/help accents. */
html[data-theme="dark"] body .order-card {
  background: #0d1726 !important;
  border-color: #21334a !important;
  color: #eaf1fb !important;
  box-shadow: none;
}
html[data-theme="dark"] body .order-card .order-title-link {
  background: transparent !important;
  color: #f4f8ff !important;
}
html[data-theme="dark"] body .order-card h3,
html[data-theme="dark"] body .order-card .price { color: #f4f8ff !important; }
html[data-theme="dark"] body .order-card p,
html[data-theme="dark"] body .order-card .order-people { color: #aebed4 !important; }
html[data-theme="dark"] .notice-warning,
html[data-theme="dark"] .notice.notice-warning {
  background: #38270d !important;
  border-color: #8a601e !important;
  color: #ffd98a !important;
}
html[data-theme="dark"] .notice-warning > span,
html[data-theme="dark"] .notice.notice-warning > span { color: #ffd98a !important; }
html[data-theme="dark"] .notice-danger,
html[data-theme="dark"] .notice.notice-danger {
  background: #35151d !important;
  border-color: #703043 !important;
  color: #ff9aaa !important;
}
html[data-theme="dark"] .source-ai {
  background: #27223b !important;
  color: #c9b8ff !important;
}
html[data-theme="dark"] .revision-heading .state-icon,
html[data-theme="dark"] .tip-icon,
html[data-theme="dark"] .tip-modal-icon {
  background: #172641 !important;
  color: #9fc1ff !important;
}
html[data-theme="dark"] .trusted-link-field.is-valid .trusted-link-status {
  background: #0d2a24 !important;
  color: #8be1c2 !important;
}



/* v97 — selected controls stay unmistakable in dark mode. */
html[data-theme="dark"] .admin-tab.is-active,
html[data-theme="dark"] .profile-review-tab.is-active,
html[data-theme="dark"] .message-format-toolbar button.is-active,
html[data-theme="dark"] .mobile-secondary-link.is-active {
  background: #2563eb !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
}

/* The light theme uses --navy-950 as a dark hero background, while dark mode
   intentionally flips that text token. Pin this semantic hero surface to a
   genuinely dark canvas so white title/price text can never disappear. */
html[data-theme="dark"] .order-detail-hero {
  background: #10213a !important;
  border: 1px solid #28415f;
  color: #f4f8ff !important;
}
html[data-theme="dark"] .order-detail-hero h2,
html[data-theme="dark"] .order-detail-hero .detail-price {
  color: #f4f8ff !important;
}
