/* Neutral dark appearance; component sizes follow the daytime layout. */
@layer apple-proportions {
 :root[data-ads-theme="dark"] {
  color-scheme:dark;
  --night-canvas:#151515;--night-panel:#202020;--night-raised:#2a2a2a;--night-line:#3d3d3d;
  --night-ink:#ededed;--night-label:#bdbdbd;--night-muted:#9e9e9e;--night-link:#91baff;--night-primary:#dedede;
  --ar-canvas:var(--night-canvas)!important;--ar-surface:var(--night-panel)!important;--ar-surface-muted:#272727!important;
  --ar-ink:var(--night-ink)!important;--ar-secondary:var(--night-label)!important;--ar-muted:var(--night-muted)!important;
  --ar-line:#353535!important;--ar-border:var(--night-line)!important;--ar-control-border:#4c4c4c!important;--ar-control-border-hover:#686868!important;
  --ar-button-primary:var(--night-primary)!important;--ar-button-primary-hover:#f1f1f1!important;
  --ar-blue:#8eb9ff!important;--ar-blue-hover:#accaff!important;--ar-link:var(--night-link)!important;
  --ar-blue-soft:#2b2b2b!important;--ar-blue-line:#4b4b4b!important;
  --ar-success:#76d9b0!important;--ar-success-soft:#19362e!important;--ar-success-line:#346854!important;
  --ar-warning:#e9bf7d!important;--ar-warning-soft:#3a2e1f!important;--ar-warning-line:#705639!important;
  --ar-danger:#ff98a4!important;--ar-danger-soft:#3b232e!important;--ar-danger-line:#75424f!important;
  --ar-neutral:#bdbdbd!important;--ar-neutral-soft:#2c2c2c!important;--ar-neutral-line:#454545!important;
  --ar-shadow-float:0 14px 40px rgba(0,0,0,.4),0 2px 7px rgba(0,0,0,.2)!important;
  --ar-focus:0 0 0 3px rgba(91,153,237,.3)!important;
  --ink:var(--night-ink)!important;--muted:var(--night-muted)!important;--paper:var(--night-panel)!important;
  --canvas:var(--night-canvas)!important;--line:var(--night-line)!important;
  --ta-surface-raised:#2b2b2b!important;--ta-glass-shell:rgba(28,28,28,.96)!important;--ta-glass-float:rgba(36,36,36,.98)!important;
  --ta-glass-line:#424242!important;--ta-glass-edge:#4a4a4a!important;
  --ta-primary:var(--night-primary)!important;--ta-primary-hover:#f1f1f1!important;--ta-primary-soft:#2b2b2b!important;
  --ads-control-border:#4c4c4c!important;--ads-control-border-hover:#686868!important;
  --system-scrollbar-size:4px!important;--system-scrollbar-thumb:#858585!important;--system-scrollbar-thumb-hover:#aaa!important;
  --system-table-header-edge:#272727!important;--apple-table-header-bg:#272727!important;--apple-table-key-bg:#303030!important;
  --feedback-error:#ff98a4!important;--feedback-error-border:#75424f!important;--feedback-error-bg:#34232d!important;
  --feedback-success:#76d9b0!important;--feedback-success-border:#346854!important;--feedback-success-bg:#1b312c!important;
  --feedback-warning:#e9bf7d!important;--feedback-warning-border:#705639!important;--feedback-warning-bg:#352d23!important;
  --feedback-info:#91baff!important;--feedback-info-border:#4b4b4b!important;--feedback-info-bg:#22344c!important;
 }
 html body #app-shell .topbar #night-mode-toggle {
  display:inline-flex!important;flex:0 0 36px!important;width:36px!important;min-width:36px!important;height:36px!important;min-height:36px!important;
  align-items:center!important;justify-content:center!important;padding:0!important;border:1px solid var(--ar-border)!important;border-radius:10px!important;
  background:var(--ar-surface)!important;color:var(--ar-secondary)!important;box-shadow:none!important;cursor:pointer;
  transition:background-color 120ms ease,border-color 120ms ease,color 120ms ease!important;
 }
 #night-mode-toggle svg {width:18px;height:18px;display:block;fill:none;stroke:currentColor;stroke-width:1.85;stroke-linecap:round;stroke-linejoin:round;}
 html body #app-shell .topbar #night-mode-toggle:hover {border-color:var(--ar-blue)!important;color:var(--ar-link)!important;background:var(--ar-blue-soft)!important;}
 html body #app-shell .topbar #night-mode-toggle:focus-visible {outline:2px solid var(--ar-blue)!important;outline-offset:2px!important;}
 html[data-ads-theme="dark"] body {background:var(--night-canvas)!important;color:var(--night-ink)!important;}
 html[data-ads-theme="dark"] body #app-shell .topbar,
 html[data-ads-theme="dark"] body #app-shell .sidebar {background:#1b1b1b!important;border-color:#353535!important;}
 html[data-ads-theme="dark"] body #app-shell #view {background:var(--night-canvas)!important;}
 html[data-ads-theme="dark"] :is(.ads-header-logo,.ads-header-symbol,.auth-brand-lockup) {filter:invert(1) hue-rotate(180deg);}
 html[data-ads-theme="dark"] body :is(.sidebar,.topbar) :is(.nav-child,.nav-standalone).active {background:#303030!important;color:#eeeeee!important;border-color:#4a4a4a!important;}
 html[data-ads-theme="dark"] body :is(.custom-select-menu,.date-picker-popover,.store-choice-popover,.member-popover,.account-popover,.website-notification-panel,.trophy-floating,.modal,.apple-confirm-dialog) {background:#242424!important;color:var(--night-ink)!important;border-color:#454545!important;box-shadow:var(--ar-shadow-float)!important;}
 html[data-ads-theme="dark"] body :is(.custom-select-option,.calendar-day,.account-popover-action):hover {background:#333333!important;color:#ededed!important;}
 html[data-ads-theme="dark"] body :is(.custom-select-option.selected,.calendar-day.selected,.pagination-page.active) {background:#dedede!important;color:#181818!important;}
 html[data-ads-theme="dark"] body #app-shell #view .ad-report-comparison strong {color:var(--night-ink)!important;}
 html[data-ads-theme="dark"] body #app-shell #view :is(.ad-report-comparison [data-ad-report-comparison-metric]>span,.ad-report-row-color-tools>span) {color:var(--night-label)!important;}
 html[data-ads-theme="dark"] body :is(input[type="checkbox"],input[type="radio"]):not(:checked):not(:indeterminate) {background-color:#222222!important;border-color:#595959!important;}
 html[data-ads-theme="dark"] body :is(input[type="checkbox"],input[type="radio"]):is(:checked,:indeterminate) {background-color:#347edc!important;border-color:#5b9bef!important;}
 html[data-ads-theme="dark"] body :is(.form-error,.facebook-hierarchy-error):not(:empty) {background:var(--feedback-error-bg)!important;}
 html[data-ads-theme="dark"] body .form-error[data-feedback="info"]:not(:empty) {background:var(--feedback-info-bg)!important;}
 html[data-ads-theme="dark"] body #app-shell #view :is(.wb-realtime,.wb-globe-stage) {background:#151515!important;}
 html[data-ads-theme="dark"] body #app-shell #view :is(.wb-data-panel,.wb-trend,.wb-metric,.wb-product-list,.wb-country-ranking) {background:var(--night-panel)!important;border-color:var(--night-line)!important;}
 html[data-ads-theme="dark"] body #app-shell #view :is(.wb-realtime h1,.wb-realtime h2,.wb-metric>strong,.wb-platform-row strong,.wb-product-name) {color:var(--night-ink)!important;}
 html[data-ads-theme="dark"] body #app-shell #view :is(.wb-metric>span,.wb-axis-timezone,.wb-popup-legend,.wb-product-details,.wb-product-row small) {color:var(--night-label)!important;}
 html[data-ads-theme="dark"] body #app-shell #view .wb-metric-popover {background:#242424!important;border-color:var(--night-line)!important;}
 html[data-ads-theme="dark"] body :is(.trophy-dialog,.egg-claim-card) {color:var(--night-ink)!important;}
 html[data-ads-theme="dark"] body .trophy-floating>header {background:#242424!important;}
 html[data-ads-theme="dark"] body .trophy-floating :is(h2,h3,.trophy-claim-title,.trophy-history-row strong) {color:var(--night-ink)!important;}
 html[data-ads-theme="dark"] body .trophy-floating :is(.trophy-stage,.trophy-viewer,.trophy-inspection-stage) {background:linear-gradient(145deg,#2a2a2a,#1c1c1c)!important;}
 html[data-ads-theme="dark"] body .website-notification-panel :is(strong,b) {color:var(--night-ink)!important;}
 html[data-ads-theme="dark"] body :is(.apple-loading-spinner,.wb-empty) {color:var(--night-muted)!important;}
 @media(prefers-reduced-motion:reduce){html body #app-shell .topbar #night-mode-toggle{transition:none!important;}}
}

@layer apple-proportions {
 html[data-ads-theme="dark"] body img[src^="/icons/bootstrap-"] {filter:brightness(0) invert(.76);}
 html[data-ads-theme="dark"] body :is(td,th)[data-ad-column-color] {color:var(--night-ink)!important;}
 html[data-ads-theme="dark"] body .sidebar-foot .status-dot {background:#42c995!important;box-shadow:0 0 0 2px rgba(66,201,149,.12)!important;}
html[data-ads-theme="dark"] body [data-ad-report-highlight="red"] {--ad-row-highlight:#422631!important;--ad-row-highlight-border:#b8576d!important;--ad-row-highlight-foreground:#ededed!important;}
html[data-ads-theme="dark"] body [data-ad-column-color="red"] {--ad-column-highlight:#422631!important;--ad-column-accent:#b8576d!important;}
html[data-ads-theme="dark"] body [data-ad-report-row-color="red"] {--swatch-color:#422631!important;--swatch-border:#b8576d!important;}
html[data-ads-theme="dark"] body [data-ad-report-highlight="orange"] {--ad-row-highlight:#42301f!important;--ad-row-highlight-border:#c98b54!important;--ad-row-highlight-foreground:#ededed!important;}
html[data-ads-theme="dark"] body [data-ad-column-color="orange"] {--ad-column-highlight:#42301f!important;--ad-column-accent:#c98b54!important;}
html[data-ads-theme="dark"] body [data-ad-report-row-color="orange"] {--swatch-color:#42301f!important;--swatch-border:#c98b54!important;}
html[data-ads-theme="dark"] body [data-ad-report-highlight="yellow"] {--ad-row-highlight:#3b371e!important;--ad-row-highlight-border:#c5b25e!important;--ad-row-highlight-foreground:#ededed!important;}
html[data-ads-theme="dark"] body [data-ad-column-color="yellow"] {--ad-column-highlight:#3b371e!important;--ad-column-accent:#c5b25e!important;}
html[data-ads-theme="dark"] body [data-ad-report-row-color="yellow"] {--swatch-color:#3b371e!important;--swatch-border:#c5b25e!important;}
html[data-ads-theme="dark"] body [data-ad-report-highlight="lime"] {--ad-row-highlight:#303c20!important;--ad-row-highlight-border:#91ad58!important;--ad-row-highlight-foreground:#ededed!important;}
html[data-ads-theme="dark"] body [data-ad-column-color="lime"] {--ad-column-highlight:#303c20!important;--ad-column-accent:#91ad58!important;}
html[data-ads-theme="dark"] body [data-ad-report-row-color="lime"] {--swatch-color:#303c20!important;--swatch-border:#91ad58!important;}
html[data-ads-theme="dark"] body [data-ad-report-highlight="green"] {--ad-row-highlight:#1b3a2f!important;--ad-row-highlight-border:#5bac87!important;--ad-row-highlight-foreground:#ededed!important;}
html[data-ads-theme="dark"] body [data-ad-column-color="green"] {--ad-column-highlight:#1b3a2f!important;--ad-column-accent:#5bac87!important;}
html[data-ads-theme="dark"] body [data-ad-report-row-color="green"] {--swatch-color:#1b3a2f!important;--swatch-border:#5bac87!important;}
html[data-ads-theme="dark"] body [data-ad-report-highlight="cyan"] {--ad-row-highlight:#193842!important;--ad-row-highlight-border:#58a4b6!important;--ad-row-highlight-foreground:#ededed!important;}
html[data-ads-theme="dark"] body [data-ad-column-color="cyan"] {--ad-column-highlight:#193842!important;--ad-column-accent:#58a4b6!important;}
html[data-ads-theme="dark"] body [data-ad-report-row-color="cyan"] {--swatch-color:#193842!important;--swatch-border:#58a4b6!important;}
html[data-ads-theme="dark"] body [data-ad-report-highlight="sky"] {--ad-row-highlight:#1c3448!important;--ad-row-highlight-border:#5e9ec5!important;--ad-row-highlight-foreground:#ededed!important;}
html[data-ads-theme="dark"] body [data-ad-column-color="sky"] {--ad-column-highlight:#1c3448!important;--ad-column-accent:#5e9ec5!important;}
html[data-ads-theme="dark"] body [data-ad-report-row-color="sky"] {--swatch-color:#1c3448!important;--swatch-border:#5e9ec5!important;}
html[data-ads-theme="dark"] body [data-ad-report-highlight="blue"] {--ad-row-highlight:#213654!important;--ad-row-highlight-border:#6a98d0!important;--ad-row-highlight-foreground:#ededed!important;}
html[data-ads-theme="dark"] body [data-ad-column-color="blue"] {--ad-column-highlight:#213654!important;--ad-column-accent:#6a98d0!important;}
html[data-ads-theme="dark"] body [data-ad-report-row-color="blue"] {--swatch-color:#213654!important;--swatch-border:#6a98d0!important;}
html[data-ads-theme="dark"] body [data-ad-report-highlight="navy"] {--ad-row-highlight:#2a304b!important;--ad-row-highlight-border:#828fc3!important;--ad-row-highlight-foreground:#ededed!important;}
html[data-ads-theme="dark"] body [data-ad-column-color="navy"] {--ad-column-highlight:#2a304b!important;--ad-column-accent:#828fc3!important;}
html[data-ads-theme="dark"] body [data-ad-report-row-color="navy"] {--swatch-color:#2a304b!important;--swatch-border:#828fc3!important;}
html[data-ads-theme="dark"] body [data-ad-report-highlight="purple"] {--ad-row-highlight:#362846!important;--ad-row-highlight-border:#a080c7!important;--ad-row-highlight-foreground:#ededed!important;}
html[data-ads-theme="dark"] body [data-ad-column-color="purple"] {--ad-column-highlight:#362846!important;--ad-column-accent:#a080c7!important;}
html[data-ads-theme="dark"] body [data-ad-report-row-color="purple"] {--swatch-color:#362846!important;--swatch-border:#a080c7!important;}
}

@layer apple-proportions {
 html[data-ads-theme="dark"] body .trophy-floating .trophy-primary:not(:disabled) {background:#dedede!important;border-color:#dedede!important;color:#181818!important;}
 html[data-ads-theme="dark"] body .trophy-floating .trophy-primary:not(:disabled):hover {background:#f1f1f1!important;}
}

/* Preserve control artwork: ticks, radio dots and switch thumbs are not surfaces. */
@layer apple-proportions {
 html[data-ads-theme="dark"] body input[type="checkbox"]::before {background:transparent!important;border-right:2px solid #fff!important;border-bottom:2px solid #fff!important;}
 html[data-ads-theme="dark"] body input[type="checkbox"]:indeterminate::before {background:#fff!important;border:0!important;}
 html[data-ads-theme="dark"] body input[type="radio"]::before {background:#fff!important;border:0!important;}
 html[data-ads-theme="dark"] body :is(.facebook-live-switch > span,.facebook-setting-switch > span,.ad-data-schedule-switch span) {background:#606060!important;}
 html[data-ads-theme="dark"] body :is(.facebook-live-switch.is-on > span,.facebook-setting-switch input:checked + span,.ad-data-schedule-switch input:checked + span) {background:#30b568!important;}
 html[data-ads-theme="dark"] body :is(.facebook-live-switch > span,.facebook-setting-switch > span,.ad-data-schedule-switch span)::after {background:#fff!important;box-shadow:0 1px 3px rgba(0,0,0,.3)!important;}
 html[data-ads-theme="dark"] body .facebook-live-switch:not(.is-on) {color:#c4c4c4!important;}
 html[data-ads-theme="dark"] body .facebook-live-switch.is-on {color:#7be1a9!important;}
}

/* Neutral charcoal surfaces, including hover/selection layers. */
@layer apple-proportions {
 :root[data-ads-theme="dark"] {--apple-table-hover:rgba(255,255,255,.035)!important;--apple-table-selected:rgba(255,255,255,.075)!important;--selection-feedback-bg:#2b2b2b!important;--selection-feedback-text:#c4c4c4!important;}
}

/* Neutral separators remain visible against charcoal surfaces. */
@layer apple-proportions {
 :root[data-ads-theme="dark"] {
  --night-line:#4a4a4a;--night-grid:#424242;--ar-line:#4a4a4a!important;--ar-border:#4a4a4a!important;
  --ar-control-border:#606060!important;--ads-control-border:#606060!important;--ar-control-border-hover:#808080!important;--ads-control-border-hover:#808080!important;
  --apple-table-line:#555!important;--apple-table-soft-line:#424242!important;--apple-table-column-line:#424242!important;--ta-glass-line:#4a4a4a!important;--ta-glass-edge:#555!important;
 }
 html[data-ads-theme="dark"] body #app-shell #view table :is(th,td) {border-left:0!important;border-top-color:var(--night-grid)!important;border-bottom-color:var(--night-grid)!important;}
 html[data-ads-theme="dark"] body #app-shell #view table :is(th,td):not(:last-child) {border-right:1px solid var(--night-grid)!important;}
 html[data-ads-theme="dark"] body #app-shell #view table thead th {border-bottom:1px solid #555!important;}
 html[data-ads-theme="dark"] body #app-shell #view table thead th+th {box-shadow:none!important;}
 html[data-ads-theme="dark"] body #app-shell #view table tbody td {border-top:0!important;border-bottom:1px solid var(--night-grid)!important;}
 html[data-ads-theme="dark"] body #app-shell :is(.topbar,.sidebar) {border-color:#484848!important;}
 html[data-ads-theme="dark"] body :is(.custom-select-menu,.date-picker-popover,.store-choice-popover,.member-popover,.account-popover,.website-notification-panel,.trophy-floating,.modal,.apple-confirm-dialog) {border-color:#555!important;}
 html[data-ads-theme="dark"] body :is(.trophy-floating>header,.trophy-floating>footer,.trophy-receipt-row,.checkbox-line:first-child) {border-color:#484848!important;}
}

/* Night controls retain neutral contrast, including scroll thumbs and collapsed progress. */
@layer apple-proportions {
 html[data-ads-theme="dark"] body :is(#app-shell,#modal-root,#login-screen,.trophy-floating) :is(.button.primary,.apple-confirm-button.primary,.pagination-page.active):not(.danger) {
  background:var(--ar-button-primary)!important;border-color:var(--ar-button-primary)!important;color:#181818!important;box-shadow:none!important;
 }
 html[data-ads-theme="dark"] body :is(#app-shell,#modal-root,#login-screen,.trophy-floating) :is(.button.primary,.apple-confirm-button.primary,.pagination-page.active):not(.danger):not(:disabled):hover {
  background:var(--ar-button-primary-hover)!important;border-color:var(--ar-button-primary-hover)!important;color:#181818!important;
 }
 html[data-ads-theme="dark"] body :is(#app-shell,#modal-root,#login-screen,.trophy-floating) :is(.button.primary,.apple-confirm-button.primary):not(.danger):disabled {
  background:#444!important;border-color:#505050!important;color:#a4a4a4!important;opacity:1!important;
 }
 html[data-ads-theme="dark"] body #app-shell #view :is(td,.user-account-actions,.creative-library-card-actions) .button.primary {
  background:#303030!important;border-color:#606060!important;color:#ededed!important;
 }
 html[data-ads-theme="dark"] body #app-shell #view :is(td,.user-account-actions,.creative-library-card-actions) .button.primary:not(:disabled):hover {
  background:#3a3a3a!important;border-color:#808080!important;color:#fff!important;
 }
 html[data-ads-theme="dark"] body .ad-data-progress-shell:not(.open) {border:0!important;box-shadow:none!important;}
 html[data-ads-theme="dark"] body *::-webkit-scrollbar {width:var(--system-scrollbar-size)!important;height:var(--system-scrollbar-size)!important;}
 html[data-ads-theme="dark"] body *::-webkit-scrollbar-thumb {background:var(--system-scrollbar-thumb)!important;border:0!important;}
 html[data-ads-theme="dark"] body *::-webkit-scrollbar-thumb:hover {background:var(--system-scrollbar-thumb-hover)!important;}
}

/* Selected menu ticks follow the label color, including portaled menus. */
@layer apple-proportions {
 html[data-ads-theme="dark"] body .custom-select-option.selected::after {
  color:inherit!important;border-left-color:currentColor!important;border-bottom-color:currentColor!important;
 }
}
