:root {
    color-scheme: light;
    --site-font-sans: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --site-bg: #faf7f2;
    --site-surface: #ffffff;
    --site-surface-soft: #f5efe7;
    --site-surface-raised: #ffffff;
    --site-text: #29231f;
    --site-text-soft: #675f58;
    --site-text-faint: #91877e;
    --site-border: #e8dfd5;
    --site-primary: #b85c38;
    --site-primary-hover: #97472a;
    --site-primary-soft: #f8e6dc;
    --site-success: #27845a;
    --site-danger: #b8554f;
    --site-shadow: 0 14px 40px rgba(69, 50, 37, .08);
    --site-shadow-soft: 0 5px 18px rgba(69, 50, 37, .06);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --site-bg: #0f141b;
    --site-surface: #171d26;
    --site-surface-soft: #202833;
    --site-surface-raised: #1b222c;
    --site-text: #f1ece6;
    --site-text-soft: #b8b0a8;
    --site-text-faint: #8e969f;
    --site-border: #303946;
    --site-primary: #e58a61;
    --site-primary-hover: #f09a73;
    --site-primary-soft: #3a2924;
    --site-success: #56ba88;
    --site-danger: #dc7770;
    --site-shadow: 0 16px 44px rgba(0, 0, 0, .30);
    --site-shadow-soft: 0 6px 20px rgba(0, 0, 0, .22);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
}

body.site-body {
    min-height: 100vh;
    margin: 0;
    background: var(--site-bg);
    color: var(--site-text);
    font-family: var(--site-font-sans);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color .2s ease, color .2s ease;
}

.site-body button,
.site-body input,
.site-body select,
.site-body textarea {
    font-family: inherit;
}

.site-body h1,
.site-body h2,
.site-body h3,
.site-body h4 {
    font-family: var(--site-font-sans);
    letter-spacing: -.02em;
}

.site-shell {
    width: min(1280px, 100%);
    margin-right: auto;
    margin-left: auto;
}

.site-header {
    border-color: color-mix(in srgb, var(--site-border) 82%, transparent) !important;
    background: color-mix(in srgb, var(--site-surface) 94%, transparent) !important;
    box-shadow: 0 1px 0 rgba(69, 50, 37, .03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.site-header .site-header-row {
    min-height: 64px;
    gap: 18px !important;
}

.site-header .site-brand-wrap,
.site-header .site-logo-safe {
    height: 58px;
    max-width: 68px;
}

.site-header .site-logo-safe img {
    width: auto !important;
    height: 56px !important;
    max-width: 68px !important;
    max-height: 56px !important;
}

.site-header .site-desktop-nav {
    flex: 1 1 auto;
    justify-content: center;
    gap: clamp(12px, 1.3vw, 20px) !important;
    margin-left: 8px !important;
    color: var(--site-text-soft);
    white-space: nowrap;
}

.site-header .site-desktop-nav a {
    position: relative;
    padding: 21px 0;
    color: inherit;
    font-weight: 700;
    transition: color .18s ease;
}

.site-header .site-desktop-nav a:hover {
    color: var(--site-primary);
    text-decoration: none;
}

.site-header .site-desktop-nav a::after {
    position: absolute;
    right: 0;
    bottom: 12px;
    left: 0;
    height: 2px;
    border-radius: 999px;
    background: var(--site-primary);
    content: "";
    opacity: 0;
    transform: scaleX(.35);
    transition: opacity .18s ease, transform .18s ease;
}

.site-header .site-desktop-nav a:hover::after {
    opacity: 1;
    transform: scaleX(1);
}

.site-header .site-desktop-nav a.bg-indigo-600 {
    padding: 10px 14px;
    border-radius: 11px;
    background: var(--site-primary) !important;
    color: #fff !important;
    box-shadow: 0 7px 18px color-mix(in srgb, var(--site-primary) 22%, transparent);
}

.site-header .site-desktop-nav a.bg-indigo-600:hover {
    background: var(--site-primary-hover) !important;
}

.site-header .site-desktop-nav a.bg-indigo-600::after {
    display: none;
}

.site-header-search {
    position: relative;
    display: flex;
    flex: 0 1 220px;
    align-items: center;
    min-width: 170px;
}

.site-header-search svg {
    position: absolute;
    left: 13px;
    width: 18px;
    height: 18px;
    color: var(--site-text-faint);
    pointer-events: none;
}

.site-header-search input {
    width: 100%;
    height: 42px;
    padding: 0 14px 0 40px;
    border: 1px solid var(--site-border);
    border-radius: 999px;
    outline: none;
    background: var(--site-surface-soft);
    color: var(--site-text);
    font-size: 13px;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.site-header-search input::placeholder,
.site-mobile-search input::placeholder {
    color: var(--site-text-faint);
}

.site-header-search input:focus {
    border-color: var(--site-primary);
    background: var(--site-surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--site-primary) 16%, transparent);
}

.theme-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--site-border);
    border-radius: 999px;
    background: var(--site-surface-soft);
    color: var(--site-text);
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}

.theme-toggle:hover {
    border-color: var(--site-primary);
    background: var(--site-primary-soft);
    color: var(--site-primary);
    transform: translateY(-1px);
}

.theme-icon {
    width: 20px;
    height: 20px;
}

.theme-icon-moon {
    display: none;
}

html[data-theme="dark"] .theme-icon-sun {
    display: none;
}

html[data-theme="dark"] .theme-icon-moon {
    display: block;
}

.site-mobile-toggle {
    border-color: var(--site-border) !important;
    background: var(--site-surface-soft);
    color: var(--site-text);
}

.site-mobile-menu {
    border-color: var(--site-border) !important;
    color: var(--site-text);
}

.site-mobile-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 12px;
}

.site-mobile-search input {
    min-width: 0;
    height: 44px;
    border: 1px solid var(--site-border);
    border-radius: 12px;
    background: var(--site-surface-soft);
    color: var(--site-text);
}

.site-mobile-search button {
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    background: var(--site-primary);
    color: #fff;
    font-weight: 800;
}

.site-main {
    min-height: 60vh;
}

.site-footer {
    border-color: var(--site-border) !important;
    background: var(--site-surface) !important;
    color: var(--site-text);
}

.site-footer .site-logo-safe img {
    filter: none;
}

/* Dark mode fallback cho các view frontend cũ đang dùng utility màu cố định. */
html[data-theme="dark"] .bg-white {
    background-color: var(--site-surface) !important;
}

html[data-theme="dark"] .bg-gray-50,
html[data-theme="dark"] .bg-gray-100 {
    background-color: var(--site-surface-soft) !important;
}

html[data-theme="dark"] .bg-gray-200 {
    background-color: #2a3340 !important;
}

html[data-theme="dark"] .text-gray-900,
html[data-theme="dark"] .text-gray-800,
html[data-theme="dark"] .text-gray-700 {
    color: var(--site-text) !important;
}

html[data-theme="dark"] .text-gray-600,
html[data-theme="dark"] .text-gray-500,
html[data-theme="dark"] .text-gray-400 {
    color: var(--site-text-soft) !important;
}

html[data-theme="dark"] .border,
html[data-theme="dark"] .border-b,
html[data-theme="dark"] .border-t,
html[data-theme="dark"] .border-gray-100,
html[data-theme="dark"] .border-gray-200,
html[data-theme="dark"] .border-gray-300 {
    border-color: var(--site-border) !important;
}

html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    border-color: var(--site-border);
    background-color: var(--site-surface-soft);
    color: var(--site-text);
}

html[data-theme="dark"] .fx-card,
html[data-theme="dark"] .fx-section,
html[data-theme="dark"] .fx-list-item,
html[data-theme="dark"] .fx-story-card,
html[data-theme="dark"] .reader-card {
    border-color: var(--site-border) !important;
    background: var(--site-surface) !important;
    color: var(--site-text) !important;
}

html[data-theme="dark"] .fx-title,
html[data-theme="dark"] .fx-list-title,
html[data-theme="dark"] .fx-story-title {
    color: var(--site-text);
}

html[data-theme="dark"] .fx-subtitle,
html[data-theme="dark"] .fx-muted,
html[data-theme="dark"] .fx-list-desc,
html[data-theme="dark"] .fx-story-meta {
    color: var(--site-text-soft);
}

/* =========================================================
   SHARED TYPOGRAPHY + COMPONENT THEME
========================================================= */

.fx-title,
.fx-author-account-title,
.author-card-title,
.story-index-title,
.author-topbar h1,
.fx-account-name {
    color: var(--site-text);
    font-family: var(--site-font-sans);
    font-weight: 800;
    letter-spacing: -.025em;
}

.fx-title {
    font-size: clamp(22px, 2.2vw, 28px);
}

.fx-author-account-title,
.author-card-title {
    font-size: clamp(21px, 2vw, 27px);
}

.fx-subtitle,
.fx-author-account-desc,
.author-card-desc,
.story-index-desc {
    color: var(--site-text-soft);
    font-size: 14px;
    line-height: 1.65;
}

.story-index-kicker,
.author-eyebrow,
.fx-author-account-kicker {
    color: var(--site-primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
}

.fx-btn,
.fx-account-action-btn,
.fx-author-account-btn,
.author-btn,
.author-tab,
.story-filter-btn {
    font-size: 13px;
    font-weight: 800;
}

.fx-btn-primary,
.fx-author-account-btn-primary,
.author-btn-primary,
.author-tab-primary,
.story-filter-btn-primary {
    border-color: var(--site-primary);
    background: var(--site-primary);
    color: #fff;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--site-primary) 22%, transparent);
}

.fx-btn-primary:hover,
.fx-author-account-btn-primary:hover,
.author-btn-primary:hover,
.author-tab-primary:hover,
.story-filter-btn-primary:hover {
    border-color: var(--site-primary-hover);
    background: var(--site-primary-hover);
    color: #fff;
}

.fx-account-action-btn {
    background: var(--site-primary);
    color: #fff;
}

.fx-account-action-btn:hover {
    background: var(--site-primary-hover);
}

.fx-btn-danger {
    background: var(--site-danger);
    color: #fff;
}

.fx-btn-danger:hover {
    background: color-mix(in srgb, var(--site-danger) 82%, #000);
}

.fx-link,
.author-link,
.story-public-latest {
    color: var(--site-primary);
}

.fx-card,
.fx-section,
.fx-list-item,
.fx-story-card,
.fx-author-account-card,
.story-filter-shell,
.story-category-box,
.story-category-dropdown,
.story-public-card,
.story-public-empty,
.author-topbar,
.author-card,
.author-row,
.author-story-row,
.author-stat-box,
.author-empty,
.author-current-cover {
    border-color: var(--site-border);
    background-color: var(--site-surface);
    color: var(--site-text);
}

.fx-author-account-icon,
.author-stat-icon,
.story-category-tag {
    border-color: color-mix(in srgb, var(--site-primary) 25%, var(--site-border));
    background: var(--site-primary-soft);
    color: var(--site-primary);
}

.fx-account-menu,
.fx-menu-item,
.author-btn-soft,
.story-filter-btn-soft {
    border-color: var(--site-border);
    background: var(--site-surface-soft);
    color: var(--site-text);
}

.fx-menu-item:hover,
.author-btn-soft:hover,
.story-filter-btn-soft:hover {
    background: color-mix(in srgb, var(--site-primary-soft) 75%, var(--site-surface));
    color: var(--site-primary);
}

.fx-menu-item.active {
    border-color: color-mix(in srgb, var(--site-primary) 32%, var(--site-border));
    background: var(--site-primary-soft);
    color: var(--site-primary);
}

.story-filter-label,
.story-public-title,
.author-topbar h1,
.author-row-main h3,
.author-story-info h3,
.author-stat-box strong,
.author-current-cover strong,
.author-empty strong,
.fx-author-account-title {
    color: var(--site-text);
}

.story-filter-input,
.story-filter-select,
.story-category-search,
.author-field input,
.author-field select,
.author-field textarea {
    border-color: var(--site-border);
    background: var(--site-surface-soft);
    color: var(--site-text);
}

.story-filter-input:focus,
.story-filter-select:focus,
.author-field input:focus,
.author-field select:focus,
.author-field textarea:focus {
    border-color: var(--site-primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--site-primary) 13%, transparent);
}

.story-category-option {
    color: var(--site-text);
}

.story-category-option:hover,
.story-category-option.is-selected {
    background: var(--site-primary-soft);
    color: var(--site-primary);
}

.story-public-author,
.story-public-meta-row,
.author-topbar p:not(.author-eyebrow),
.author-row-main p,
.author-meta,
.author-stat-box p,
.author-current-cover p,
.story-filter-selected-note {
    color: var(--site-text-soft);
}

.author-topbar {
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--site-primary) 12%, transparent), transparent 34%),
        linear-gradient(135deg, var(--site-surface) 0%, var(--site-surface-soft) 100%);
}

.author-stat-box {
    background: linear-gradient(180deg, var(--site-surface-soft) 0%, var(--site-surface) 100%);
}

.author-row:hover,
.author-story-row:hover {
    border-color: color-mix(in srgb, var(--site-primary) 30%, var(--site-border));
    background: var(--site-surface-soft);
}

.author-tab {
    border-color: var(--site-border);
    background: var(--site-surface);
    color: var(--site-text-soft);
}

.author-tab:hover {
    border-color: color-mix(in srgb, var(--site-primary) 35%, var(--site-border));
    color: var(--site-primary);
}

.author-tab.is-active {
    border-color: var(--site-success);
    background: var(--site-success);
    color: #fff;
}

/* =========================================================
   DARK MODE: LEGACY VIEWS + INLINE COLORS
========================================================= */

html[data-theme="dark"] .site-main [style*="background:#ffffff"],
html[data-theme="dark"] .site-main [style*="background: #ffffff"],
html[data-theme="dark"] .site-main [style*="background:#fff"],
html[data-theme="dark"] .site-main [style*="background: #fff"] {
    background-color: var(--site-surface) !important;
}

html[data-theme="dark"] .site-main [style*="background:#f9fafb"],
html[data-theme="dark"] .site-main [style*="background:#f8fafc"],
html[data-theme="dark"] .site-main [style*="background:#f3f4f6"],
html[data-theme="dark"] .site-main [style*="background:#eef2ff"] {
    background-color: var(--site-surface-soft) !important;
}

html[data-theme="dark"] .site-main [style*="color:#111827"],
html[data-theme="dark"] .site-main [style*="color: #111827"],
html[data-theme="dark"] .site-main [style*="color:#0f172a"],
html[data-theme="dark"] .site-main [style*="color:#334155"],
html[data-theme="dark"] .site-main [style*="color:#374151"] {
    color: var(--site-text) !important;
}

html[data-theme="dark"] .site-main [style*="color:#4b5563"],
html[data-theme="dark"] .site-main [style*="color:#6b7280"],
html[data-theme="dark"] .site-main [style*="color:#64748b"] {
    color: var(--site-text-soft) !important;
}

html[data-theme="dark"] .site-main [style*="border:1px solid #e5e7eb"],
html[data-theme="dark"] .site-main [style*="border: 1px solid #e5e7eb"],
html[data-theme="dark"] .site-main [style*="border-bottom:1px solid #e5e7eb"],
html[data-theme="dark"] .site-main [style*="border-bottom:1px solid #f3f4f6"] {
    border-color: var(--site-border) !important;
}

html[data-theme="dark"] .story-index-title,
html[data-theme="dark"] .story-filter-label,
html[data-theme="dark"] .story-public-title,
html[data-theme="dark"] .author-topbar h1,
html[data-theme="dark"] .author-card-title,
html[data-theme="dark"] .author-row-main h3,
html[data-theme="dark"] .author-story-info h3,
html[data-theme="dark"] .author-stat-box strong,
html[data-theme="dark"] .fx-author-account-title {
    color: var(--site-text) !important;
}

html[data-theme="dark"] .story-filter-shell,
html[data-theme="dark"] .story-category-box,
html[data-theme="dark"] .story-category-dropdown,
html[data-theme="dark"] .story-public-card,
html[data-theme="dark"] .story-public-empty,
html[data-theme="dark"] .author-card,
html[data-theme="dark"] .author-row,
html[data-theme="dark"] .author-story-row,
html[data-theme="dark"] .fx-author-account-card {
    border-color: var(--site-border) !important;
    background: var(--site-surface) !important;
    color: var(--site-text) !important;
}

html[data-theme="dark"] .story-public-body,
html[data-theme="dark"] .fx-account-menu {
    background: var(--site-surface) !important;
}

html[data-theme="dark"] .page-donations-index table,
html[data-theme="dark"] .page-donations-index tbody,
html[data-theme="dark"] .page-donations-index tr,
html[data-theme="dark"] .page-donations-index td {
    border-color: var(--site-border) !important;
    background-color: var(--site-surface) !important;
    color: var(--site-text) !important;
}

html[data-theme="dark"] .page-donations-index thead,
html[data-theme="dark"] .page-donations-index thead tr,
html[data-theme="dark"] .page-donations-index th {
    border-color: var(--site-border) !important;
    background-color: var(--site-surface-soft) !important;
    color: var(--site-text-soft) !important;
}

html[data-theme="dark"] .page-donations-index [style*="color:#16a34a"] {
    color: var(--site-success) !important;
}

.page-donations-index [style*="color:#4f46e5"] {
    color: var(--site-primary) !important;
}

.page-donations-index #donationModal [style*="background:#4f46e5"] {
    background: var(--site-primary) !important;
}

.site-main .text-indigo-600 {
    color: var(--site-primary) !important;
}

.site-main .bg-indigo-600 {
    background-color: var(--site-primary) !important;
}

.site-main .bg-indigo-600:hover,
.site-main .hover\:bg-indigo-700:hover {
    background-color: var(--site-primary-hover) !important;
}

html[data-theme="dark"] .page-donations-index .donation-main-layout > div:nth-child(2),
html[data-theme="dark"] .donation-recent-card,
html[data-theme="dark"] .donation-recent-empty {
    border-color: var(--site-border) !important;
    background: var(--site-surface-soft) !important;
    color: var(--site-text) !important;
}

html[data-theme="dark"] .donation-recent-name,
html[data-theme="dark"] .donation-recent-row strong {
    color: var(--site-text) !important;
}

html[data-theme="dark"] #authorRequestModal > div,
html[data-theme="dark"] #profileModal > div,
html[data-theme="dark"] #passwordModal > div,
html[data-theme="dark"] #donationModal > div,
html[data-theme="dark"] #donationSuccessModal > div {
    border: 1px solid var(--site-border);
    background: var(--site-surface) !important;
    color: var(--site-text);
}

html[data-theme="dark"] .fx-author-account-badge-purple {
    background: #352b4b;
    color: #c9b6ff;
}

html[data-theme="dark"] .fx-author-account-badge-yellow {
    background: #40351e;
    color: #f3cf7a;
}

html[data-theme="dark"] .fx-author-account-badge-green,
html[data-theme="dark"] .author-badge.is-public {
    background: #19382b;
    color: #81d8aa;
}

html[data-theme="dark"] .author-badge.is-hidden {
    background: var(--site-surface-soft);
    color: var(--site-text-soft);
}

html[data-theme="dark"] .fx-author-account-alert,
html[data-theme="dark"] .author-alert-danger {
    border-color: #63323a;
    background: #352127;
    color: #f4a4af;
}

html[data-theme="dark"] .author-alert-success {
    border-color: #265b43;
    background: #183428;
    color: #8bd8ad;
}

/* =========================================================
   AFFILIATE PAGE
========================================================= */

.aff-page {
    color: var(--site-text);
    font-family: var(--site-font-sans);
}

.aff-hero {
    border-color: color-mix(in srgb, var(--site-primary) 42%, var(--site-border));
    background:
        radial-gradient(circle at 88% 12%, rgba(255, 255, 255, .12), transparent 28%),
        linear-gradient(135deg, #251d19 0%, #6f3f2d 58%, #b85c38 100%);
    box-shadow: 0 18px 44px color-mix(in srgb, var(--site-primary) 18%, transparent);
}

.aff-title {
    font-family: var(--site-font-sans);
    font-size: clamp(29px, 3vw, 36px);
    font-weight: 800;
    letter-spacing: -.025em;
}

.aff-kicker {
    font-size: 12px;
    font-weight: 800;
}

.aff-desc {
    font-size: 14px;
    line-height: 1.7;
}

.aff-status-pill {
    font-size: 13px;
    font-weight: 800;
}

.aff-card,
.aff-link-card,
.aff-story-item,
.aff-empty,
.aff-click-detail {
    border-color: var(--site-border);
    background: var(--site-surface);
    color: var(--site-text);
}

.aff-card-title,
.aff-chart-title,
.aff-check-title,
.aff-link-title,
.aff-story-title {
    color: var(--site-text);
    font-family: var(--site-font-sans);
    font-weight: 800;
    letter-spacing: -.015em;
}

.aff-card-title {
    font-size: clamp(20px, 2vw, 24px);
}

.aff-chart-title {
    font-size: 20px;
}

.aff-card-subtitle,
.aff-chart-desc,
.aff-check-desc,
.aff-link-meta,
.aff-story-meta,
.aff-field-help {
    color: var(--site-text-soft);
    font-size: 13px;
    line-height: 1.6;
}

.aff-check-item,
.aff-stat-card,
.aff-chart-summary-card,
.aff-link-edit {
    border-color: var(--site-border);
    background: var(--site-surface-soft);
    color: var(--site-text);
}

.aff-check-icon,
.aff-link-thumb,
.aff-story-thumb {
    border-color: var(--site-border);
    background: var(--site-surface);
}

.aff-stat-label,
.aff-chart-summary-card span {
    color: var(--site-text-soft);
    font-size: 12px;
    font-weight: 700;
}

.aff-stat-value,
.aff-chart-summary-card strong {
    color: var(--site-text);
    font-weight: 800;
}

.aff-stat-value {
    font-size: 27px;
}

.aff-field label,
.aff-switch {
    color: var(--site-text);
    font-size: 13px;
    font-weight: 700;
}

.aff-field input,
.aff-field textarea,
.aff-story-search {
    border-color: var(--site-border);
    background: var(--site-surface-soft);
    color: var(--site-text);
}

.aff-field input:focus,
.aff-field textarea:focus,
.aff-story-search:focus {
    border-color: var(--site-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--site-primary) 15%, transparent);
}

.aff-btn {
    font-size: 13px;
    font-weight: 800;
}

.aff-btn.is-primary {
    background: var(--site-primary);
    color: #fff;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--site-primary) 20%, transparent);
}

.aff-btn.is-primary:hover {
    background: var(--site-primary-hover);
    color: #fff;
}

.aff-btn.is-soft {
    border-color: var(--site-border);
    background: var(--site-surface-soft);
    color: var(--site-text);
}

.aff-btn.is-soft:hover {
    background: var(--site-primary-soft);
    color: var(--site-primary);
}

.aff-btn.is-danger {
    border-color: color-mix(in srgb, var(--site-danger) 34%, var(--site-border));
    background: color-mix(in srgb, var(--site-danger) 14%, var(--site-surface));
    color: var(--site-danger);
}

.aff-btn.is-danger:hover {
    background: color-mix(in srgb, var(--site-danger) 22%, var(--site-surface));
    color: var(--site-danger);
}

.aff-empty {
    color: var(--site-text-soft);
}

.aff-range-chip {
    border-color: color-mix(in srgb, var(--site-primary) 25%, var(--site-border));
    background: var(--site-primary-soft);
    color: var(--site-primary);
    font-size: 12px;
    font-weight: 800;
}

.aff-range-chip:hover {
    border-color: var(--site-primary);
    background: color-mix(in srgb, var(--site-primary-soft) 72%, var(--site-surface));
    color: var(--site-primary-hover);
}

.aff-link-edit summary,
.aff-click-detail summary {
    color: var(--site-primary);
    font-weight: 800;
}

.aff-chart-panel,
.aff-link-edit,
.aff-click-table-wrap {
    border-color: var(--site-border);
}

.aff-line-chart {
    border-color: var(--site-border);
    background: #121a23;
}

.aff-line-chart-line {
    stroke: var(--site-primary);
    filter: drop-shadow(0 8px 14px color-mix(in srgb, var(--site-primary) 34%, transparent));
}

.aff-line-chart-point {
    fill: var(--site-primary-hover);
    stroke: var(--site-primary);
}

.aff-line-chart-point:hover {
    fill: #fff;
    stroke: var(--site-primary-hover);
}

#affClickAreaGradient stop {
    stop-color: var(--site-primary);
}

.aff-click-table th,
.aff-click-table td {
    border-color: var(--site-border);
    color: var(--site-text);
}

.aff-click-table th {
    background: var(--site-surface-soft);
    color: var(--site-text-soft);
    font-weight: 800;
}

html[data-theme="dark"] .aff-hero {
    border-color: #5a3a30;
    background:
        radial-gradient(circle at 88% 12%, rgba(229, 138, 97, .13), transparent 30%),
        linear-gradient(135deg, #151b23 0%, #292127 52%, #633724 100%);
}

html[data-theme="dark"] .aff-card,
html[data-theme="dark"] .aff-link-card,
html[data-theme="dark"] .aff-story-item,
html[data-theme="dark"] .aff-empty,
html[data-theme="dark"] .aff-click-detail {
    border-color: var(--site-border) !important;
    background: var(--site-surface) !important;
    color: var(--site-text) !important;
}

html[data-theme="dark"] .aff-check-item,
html[data-theme="dark"] .aff-stat-card,
html[data-theme="dark"] .aff-chart-summary-card,
html[data-theme="dark"] .aff-link-edit {
    border-color: var(--site-border) !important;
    background: var(--site-surface-soft) !important;
}

html[data-theme="dark"] .aff-card-title,
html[data-theme="dark"] .aff-chart-title,
html[data-theme="dark"] .aff-check-title,
html[data-theme="dark"] .aff-link-title,
html[data-theme="dark"] .aff-story-title,
html[data-theme="dark"] .aff-stat-value,
html[data-theme="dark"] .aff-chart-summary-card strong {
    color: var(--site-text) !important;
}

html[data-theme="dark"] .aff-card-subtitle,
html[data-theme="dark"] .aff-chart-desc,
html[data-theme="dark"] .aff-check-desc,
html[data-theme="dark"] .aff-link-meta,
html[data-theme="dark"] .aff-story-meta,
html[data-theme="dark"] .aff-field-help,
html[data-theme="dark"] .aff-stat-label,
html[data-theme="dark"] .aff-chart-summary-card span {
    color: var(--site-text-soft) !important;
}

html[data-theme="dark"] .aff-field input,
html[data-theme="dark"] .aff-field textarea,
html[data-theme="dark"] .aff-story-search {
    border-color: var(--site-border) !important;
    background: var(--site-surface-soft) !important;
    color: var(--site-text) !important;
}

html[data-theme="dark"] .aff-click-table th,
html[data-theme="dark"] .aff-click-table td {
    border-color: var(--site-border) !important;
    color: var(--site-text) !important;
}

html[data-theme="dark"] .aff-click-table th {
    background: var(--site-surface-soft) !important;
    color: var(--site-text-soft) !important;
}

html[data-theme="dark"] .aff-badge.is-success,
html[data-theme="dark"] .aff-check-item.is-ok .aff-check-icon,
html[data-theme="dark"] .aff-alert.is-success {
    border-color: #285a43;
    background: #19382b;
    color: #81d8aa;
}

html[data-theme="dark"] .aff-badge.is-warning,
html[data-theme="dark"] .aff-alert.is-warning {
    border-color: #6a5526;
    background: #40351e;
    color: #f3cf7a;
}

html[data-theme="dark"] .aff-badge.is-danger,
html[data-theme="dark"] .aff-check-item.is-missing .aff-check-icon,
html[data-theme="dark"] .aff-alert.is-error {
    border-color: #6a333b;
    background: #392127;
    color: #f2a2ae;
}

html[data-theme="dark"] .aff-badge.is-neutral,
html[data-theme="dark"] .aff-badge.is-muted {
    background: var(--site-surface-soft);
    color: var(--site-text-soft);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--site-primary) 38%, transparent);
    outline-offset: 2px;
}

@media (max-width: 1100px) {
    .site-header .site-header-row {
        position: relative;
        padding-right: 100px;
    }

    .site-header .site-desktop-nav,
    .site-header-search {
        display: none !important;
    }

    .site-header .theme-toggle,
    .site-header .site-mobile-toggle {
        position: absolute;
        top: 50%;
        margin: 0;
        transform: translateY(-50%);
    }

    .site-header .theme-toggle {
        right: 52px;
    }

    .site-header .site-mobile-toggle {
        right: 0;
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .site-header .site-header-row {
        min-height: 58px;
    }

    #mobileMenu.site-mobile-menu.is-open {
        display: block !important;
        max-height: calc(100vh - 76px);
        overflow-y: auto;
        padding-bottom: 12px;
    }

    #mobileMenu.site-mobile-menu a {
        color: var(--site-text-soft);
    }

    #mobileMenu.site-mobile-menu a:hover {
        background: var(--site-surface-soft) !important;
        color: var(--site-primary);
    }
}

@media (min-width: 1101px) {
    .site-header .site-desktop-nav {
        display: flex !important;
    }

    .site-header .site-mobile-toggle,
    #mobileMenu.site-mobile-menu {
        display: none !important;
    }
}

@media (max-width: 640px) {
    .site-header > .site-shell {
        padding-right: 14px;
        padding-left: 14px;
    }

    .site-header .site-logo-safe,
    .site-header .site-brand-wrap {
        height: 52px;
        max-width: 62px;
    }

    .site-header .site-logo-safe img {
        height: 50px !important;
        max-height: 50px !important;
    }

    .site-main {
        padding: 18px 14px 0 !important;
    }

    .site-footer {
        margin-top: 32px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
