/* ==== AIBuy site-wide polish v3 (Grok Bot 2026-11-03). Visual-only overrides; layout, markup and behaviour untouched.
   `:root:not(#_v3)` lifts specificity above the existing layered rules without !important. Detection pages keep their own v2 styling. ==== */
:root:not(#_v3) {
  --v3-r: 14px; --v3-r-sm: 10px;
  --v3-line: var(--ui-line, #d7e1da);
  --v3-accent: var(--ui-accent, #2e6b50);
  --v3-primary: var(--ui-primary, #2e6b50);
  --v3-soft: var(--ui-accent-soft, #e3efe7);
  --v3-surface: var(--ui-surface, #fff);
  --v3-shadow: 0 1px 2px rgba(22, 52, 37, .05), 0 10px 28px -18px rgba(22, 52, 37, .28);
  --v3-shadow-hover: 0 2px 4px rgba(22, 52, 37, .06), 0 16px 34px -18px rgba(22, 52, 37, .38);
  --v3-ring: 0 0 0 4px color-mix(in srgb, var(--v3-accent) 16%, transparent);
}
:root:not(#_v3)[data-theme="dark"] { --v3-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 28px -20px rgba(0,0,0,.75); --v3-shadow-hover: 0 1px 0 rgba(255,255,255,.04) inset, 0 16px 34px -18px rgba(0,0,0,.85); }

/* ---------- Header (shared) ---------- */
:root:not(#_v3) .directory-topbar { backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: saturate(1.2) blur(10px); }
:root:not(#_v3) .directory-topbar .main-nav .directory-nav-tab { border-radius: 9px; transition: color .15s, background-color .15s; }
:root:not(#_v3) .directory-topbar .main-nav .directory-nav-tab:hover:not(.active) { background-color: color-mix(in srgb, var(--v3-accent) 7%, transparent); }
:root:not(#_v3) .directory-topbar .main-nav .directory-nav-tab.active { font-weight: 650; }
:root:not(#_v3) .directory-topbar :is(.header-save, .theme-toggle, .account-link) { border-radius: 999px; transition: color .15s, background-color .15s; }
:root:not(#_v3) .directory-topbar :is(.header-save, .theme-toggle, .account-link):hover { background-color: color-mix(in srgb, var(--v3-accent) 8%, transparent); color: var(--v3-accent); }
:root:not(#_v3) .app-shell :is(a, button, select, summary, input[type=checkbox], input[type=radio]):focus-visible { outline: 2px solid var(--ui-focus, var(--v3-accent)); outline-offset: 2px; }

/* ---------- Footer (shared) ---------- */
:root:not(#_v3) .site-footer .footer-links a { border-radius: 6px; padding: 2px 6px; transition: color .15s, background-color .15s; }
:root:not(#_v3) .site-footer .footer-links a:hover { color: var(--v3-accent); background-color: color-mix(in srgb, var(--v3-accent) 8%, transparent); }

/* ---------- AI 工具 directory (/?view=tools) ---------- */
:root:not(#_v3) .directory-home-shell .directory-sidebar { border-radius: 16px; box-shadow: var(--v3-shadow); }
:root:not(#_v3) .directory-home-shell .directory-side-item { border-radius: var(--v3-r-sm); transition: background-color .15s, color .15s; }
:root:not(#_v3) .directory-home-shell .directory-side-item:hover:not(.active) { background-color: color-mix(in srgb, var(--v3-accent) 6%, transparent); }
:root:not(#_v3) .directory-home-shell .directory-side-item b { border-radius: 999px; min-width: 22px; text-align: center; }
:root:not(#_v3) .directory-sidebar-heading .directory-submit-link { border-radius: 999px; }
:root:not(#_v3) .directory-home-shell .directory-tools-search .directory-search-form.directory-header-search { border-radius: 14px; box-shadow: var(--v3-shadow); transition: box-shadow .15s, border-color .15s; }
:root:not(#_v3) .directory-home-shell .directory-tools-search .directory-search-form.directory-header-search:focus-within { box-shadow: var(--v3-ring), var(--v3-shadow); }
:root:not(#_v3) .directory-search-form .directory-search-submit { border-radius: 10px; font-weight: 600; }
:root:not(#_v3) .directory-home-shell .directory-card { border-radius: var(--v3-r); box-shadow: var(--v3-shadow); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
:root:not(#_v3) .directory-home-shell .directory-card:hover { transform: translateY(-2px); box-shadow: var(--v3-shadow-hover); border-color: color-mix(in srgb, var(--v3-accent) 38%, var(--v3-line)); }
:root:not(#_v3) .directory-home-shell .directory-card .directory-logo { border-radius: 12px; }
:root:not(#_v3) .directory-home-shell .directory-card-title strong, :root:not(#_v3) .directory-home-shell .directory-card-title h3 { letter-spacing: -.2px; }
:root:not(#_v3) .directory-home-shell .directory-card-divider { opacity: .7; }
:root:not(#_v3) .directory-home-shell .directory-card-action { border-radius: 6px; transition: color .15s; }
:root:not(#_v3) .directory-home-shell .directory-favorite { border-radius: 999px; transition: background-color .15s, color .15s; }
:root:not(#_v3) .directory-home-shell .directory-favorite:hover { background-color: color-mix(in srgb, var(--v3-accent) 9%, transparent); color: var(--v3-accent); }
:root:not(#_v3) .directory-home-shell .directory-section-heading { padding-bottom: 4px; }
:root:not(#_v3) .directory-home-shell .directory-sorter button { border-radius: 8px; }

/* ---------- AI 低价资源库 (/?view=deals) ---------- */
:root:not(#_v3) .directory-workspace-deals :is(.price-category-option, .price-spec-option) { border-radius: var(--v3-r-sm); transition: background-color .15s, color .15s; }
:root:not(#_v3) .directory-workspace-deals :is(.price-category-option, .price-spec-option):hover:not([aria-pressed="true"]) { background-color: color-mix(in srgb, var(--v3-accent) 6%, transparent); }
:root:not(#_v3) .directory-workspace-deals :is(.price-category-option, .price-spec-option)[aria-pressed="true"] { box-shadow: inset 3px 0 0 var(--v3-accent); }
:root:not(#_v3) .directory-workspace-deals .price-count { font-variant-numeric: tabular-nums; }

/* ---------- AI 资源对接 + 交易避坑 (/?view=matching, /matching/N, /?view=risk, /risk) ---------- */
:root:not(#_v3) :is(.match-rail-section button, .match-category-trigger, .match-mine-link, .risk-rail-item) { border-radius: var(--v3-r-sm); transition: background-color .15s, color .15s; }
:root:not(#_v3) :is(.match-rail-section button, .match-category-trigger, .match-mine-link, .risk-rail-item):hover:not(.active) { background-color: color-mix(in srgb, var(--v3-accent) 6%, transparent); }
:root:not(#_v3) :is(.match-item, .risk-item) { transition: background-color .15s, box-shadow .15s; }
:root:not(#_v3) :is(.match-item, .risk-item):hover:not(.selected) { background-color: color-mix(in srgb, var(--v3-accent) 4%, var(--v3-surface)); }
:root:not(#_v3) :is(.match-item, .risk-item).selected { box-shadow: inset 3px 0 0 var(--v3-accent); }
:root:not(#_v3) .match-item-avatar { box-shadow: 0 0 0 2px var(--v3-surface), 0 0 0 3px color-mix(in srgb, var(--v3-accent) 18%, var(--v3-line)); border-radius: 50%; }
:root:not(#_v3) .match-item-classification { border-radius: 6px; }
:root:not(#_v3) .match-toolbar :is(input:not([type=search]), select) { border-radius: 10px; transition: box-shadow .15s, border-color .15s; }
:root:not(#_v3) .match-toolbar :is(input:not([type=search]), select):focus { box-shadow: var(--v3-ring); }
:root:not(#_v3) .match-toolbar button, :root:not(#_v3) .risk-toolbar button { border-radius: 10px; }
:root:not(#_v3) .match-list-heading strong, :root:not(#_v3) .risk-list-heading strong { letter-spacing: -.2px; }
:root:not(#_v3) .match-result-count { font-variant-numeric: tabular-nums; }
:root:not(#_v3) .match-pagination :is(a, button) { border-radius: 8px; }
:root:not(#_v3) .match-detail-placeholder { opacity: .9; }

/* ---------- Auth pages (/login, /register, /reset-password, and login-gated pages) ---------- */
:root:not(#_v3) .auth-split .auth-promo { border-radius: 22px; }
:root:not(#_v3) .auth-split .auth-form-panel .auth-form-heading h1 { letter-spacing: -.5px; }
:root:not(#_v3) .auth-split .auth-form-eyebrow { letter-spacing: .5px; }
:root:not(#_v3) .auth-split .account-auth-fields :is(input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input:not([type]), select) { border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
:root:not(#_v3) .auth-split .account-auth-fields :is(input, select):focus { border-color: var(--ui-focus, var(--v3-accent)); box-shadow: var(--v3-ring); outline: none; }
:root:not(#_v3) .auth-split .button.dark.auth-submit { border-radius: 12px; font-weight: 650; letter-spacing: .3px; box-shadow: 0 10px 22px -14px color-mix(in srgb, var(--v3-primary) 90%, transparent); transition: background-color .15s, transform .15s, box-shadow .15s; }
:root:not(#_v3) .auth-split .button.dark.auth-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 26px -14px color-mix(in srgb, var(--v3-primary) 95%, transparent); }
:root:not(#_v3) .auth-split .auth-password-toggle { border-radius: 8px; }
:root:not(#_v3) .auth-split .account-auth-switch a { text-underline-offset: 3px; }
:root:not(#_v3) .auth-split .auth-email-provider { border-radius: 999px; }

/* ---------- Account / appeal / contact-assistance / messages / profile (logged-in pages) ---------- */
:root:not(#_v3) :is(.account-page, .account-appeal-page) :is(section, .account-card, .account-panel) { border-radius: var(--v3-r); }
:root:not(#_v3) :is(.account-page, .account-appeal-page) .button { border-radius: 10px; }
:root:not(#_v3) .account-appeal-error { border-radius: 12px; }
:root:not(#_v3) .account-nav button { border-radius: var(--v3-r-sm); }

/* ---------- About (/about) ---------- */
:root:not(#_v3) .company-about .company-button { border-radius: 12px; transition: transform .15s, box-shadow .15s, background-color .15s; }
:root:not(#_v3) .company-about .company-button:hover { transform: translateY(-1px); box-shadow: var(--v3-shadow-hover); }
:root:not(#_v3) .company-about :is(.company-offering-item, .company-node) { border-radius: 16px; transition: box-shadow .18s, transform .18s; }
:root:not(#_v3) .company-about .company-offering-item:hover { box-shadow: var(--v3-shadow-hover); transform: translateY(-2px); }

/* ---------- Mobile nav (shared) ---------- */
:root:not(#_v3) .mobile-navigation { box-shadow: 0 12px 30px -12px rgba(22, 52, 37, .35); }

/* v4 note: deals right-side v3 rules removed (compact table below) */
/* v3 extras: card-framed auth form, softer deals header */
:root:not(#_v3) .auth-split .auth-form-panel .account-auth-fields { padding: 30px 30px 26px; border: 1px solid color-mix(in srgb, var(--ui-text, #23392d) 8%, var(--v3-line)); border-radius: 20px; background: var(--v3-surface); box-shadow: var(--v3-shadow); }
@media (max-width: 640px) { :root:not(#_v3) .auth-split .auth-form-panel .account-auth-fields { padding: 22px 18px 20px; border-radius: 16px; } }

@media (prefers-reduced-motion: reduce) {
  :root:not(#_v3) .app-shell * { transition: none !important; }
  :root:not(#_v3) .app-shell :is(.directory-card, .auth-submit, .company-button, .company-offering-item):hover { transform: none !important; }
}

/* ================= v4 (Grok Bot) ================= */
/* 1) 低价资源库 right side: compact, horizontal, dense rows for price comparison */
:root:not(#_v3) .directory-workspace-deals .price-quotes-heading { padding: 6px 12px; margin-bottom: 6px; }
:root:not(#_v3) .directory-workspace-deals .price-quotes-heading h2 { font-size: 16px; line-height: 1.35; }
:root:not(#_v3) .directory-workspace-deals .price-quotes-kicker { font-size: 11px; line-height: 1.4; }
:root:not(#_v3) .directory-workspace-deals .price-quote-count { font-size: 18px; line-height: 1.1; }
:root:not(#_v3) .directory-workspace-deals .price-offer-table-head { min-height: 32px; padding-top: 4px; padding-bottom: 4px; }
:root:not(#_v3) .directory-workspace-deals .price-offer-row { min-height: 0; padding: 5px 10px; transition: background-color .12s; }
:root:not(#_v3) .directory-workspace-deals .price-offer-row:hover { background-color: color-mix(in srgb, var(--v3-accent) 4%, transparent); }
:root:not(#_v3) .directory-workspace-deals .price-offer-product h3 { font-size: 13.5px; line-height: 18px; }
:root:not(#_v3) .directory-workspace-deals .price-offer-product p { font-size: 12px; line-height: 16px; margin-top: 1px; }
:root:not(#_v3) .directory-workspace-deals .price-offer-price { flex-direction: row; align-items: baseline; gap: 3px; }
:root:not(#_v3) .directory-workspace-deals .price-offer-price strong { font-size: 18px; line-height: 22px; letter-spacing: -.2px; font-variant-numeric: tabular-nums; }
:root:not(#_v3) .directory-workspace-deals .price-offer-price span { font-size: 11px; line-height: 1; }
:root:not(#_v3) .directory-workspace-deals .price-offer-stock { font-size: 12px; padding: 1px 7px; line-height: 18px; }
:root:not(#_v3) .directory-workspace-deals .price-offer-action a { min-height: 26px; padding-top: 0; padding-bottom: 0; }
@media (max-width: 760px) {
  :root:not(#_v3) .directory-workspace-deals .price-offer-row { grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 0; min-height: 0; align-items: center; }
  :root:not(#_v3) .directory-workspace-deals .price-offer-row > .price-offer-product { grid-column: 1 / 4; grid-row: 1; }
  :root:not(#_v3) .directory-workspace-deals .price-offer-row > .price-offer-price { grid-column: 4; grid-row: 1; justify-content: flex-end; align-self: start; }
  :root:not(#_v3) .directory-workspace-deals .price-offer-row > .price-offer-stock { grid-column: 1; grid-row: 2; justify-self: start; }
  :root:not(#_v3) .directory-workspace-deals .price-offer-row > .price-offer-update { grid-column: 2; grid-row: 2; }
  :root:not(#_v3) .directory-workspace-deals .price-offer-row > .price-offer-action { grid-column: 4; grid-row: 2; justify-self: end; }
  :root:not(#_v3) .directory-workspace-deals .price-offer-product p { -webkit-line-clamp: 2; line-clamp: 2; }
  :root:not(#_v3) .directory-workspace-deals .price-offer-price strong { font-size: 19px; }
  :root:not(#_v3) .directory-workspace-deals .price-offer-action a { min-height: 30px; padding-left: 10px; padding-right: 10px; }
  :root:not(#_v3) .directory-workspace-deals .price-quotes-heading { padding: 8px 12px; }
}

/* 2) Search boxes: one clean focus ring on the wrapper, none on the inner input */
:root:not(#_v3) :is(form[role=search], .match-search, .risk-search, .directory-search-form) input,
:root:not(#_v3) :is(form[role=search], .match-search, .risk-search, .directory-search-form) input:focus,
:root:not(#_v3) :is(form[role=search], .match-search, .risk-search, .directory-search-form) input:focus-visible { outline: none !important; box-shadow: none !important; border-radius: 0; background-clip: padding-box; }
:root:not(#_v3) input[type=search]::-webkit-search-cancel-button,
:root:not(#_v3) input[type=search]::-webkit-search-decoration,
:root:not(#_v3) input[type=search]::-webkit-search-results-button,
:root:not(#_v3) input[type=search]::-webkit-search-results-decoration { -webkit-appearance: none; appearance: none; display: none; }
:root:not(#_v3) :is(.match-search, .risk-search, .directory-search-form):focus-within { outline: none; border-color: var(--ui-focus, var(--v3-accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--v3-accent) 16%, transparent); }
:root:not(#_v3) .directory-home-shell .directory-tools-search .directory-search-form.directory-header-search:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--v3-accent) 16%, transparent), var(--v3-shadow); }
/* standalone text inputs (detection tools, forms): border + soft ring only, no extra outline */
:root:not(#_v3) .app-shell :is(input:not([type=checkbox]):not([type=radio]):not([type=range]), textarea):focus-visible { outline: none; border-color: var(--ui-focus, var(--v3-accent)); box-shadow: var(--v3-ring); }
