/*
  AvLu optional dark theme
  Deep navy work surfaces preserve the existing proof and risk color language.
*/

.v13-theme-toggle {
  --v13-toggle-width: 68px;
  --v13-toggle-height: 34px;
  --v13-toggle-min-height: 34px;
  --v13-toggle-knob-size: 26px;
  --v13-toggle-travel: 34px;
  --v13-toggle-track: linear-gradient(180deg, #283740 0%, #18252d 48%, #0e171e 100%);
  --v13-toggle-track-border: #405c66;
  --v13-toggle-knob: linear-gradient(180deg, #a9bcbe 0%, #7c9296 52%, #536a70 100%);
  --v13-toggle-knob-ink: #0b1b23;
  --v13-toggle-cue: #72c9cd;
  --v13-toggle-cue-soft: rgba(114, 201, 205, .22);
  width: var(--v13-toggle-width);
  min-width: var(--v13-toggle-width);
  height: var(--v13-toggle-height);
  min-height: var(--v13-toggle-min-height);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  padding: 3px;
  appearance: none;
  border: 1px solid var(--v13-toggle-track-border);
  border-radius: 999px;
  color: var(--v13-toggle-knob-ink);
  background: var(--v13-toggle-track);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .13),
    inset 0 -2px 3px rgba(0, 0, 0, .5),
    0 2px 0 rgba(0, 0, 0, .38),
    0 5px 12px rgba(0, 0, 0, .24);
  cursor: pointer;
  font-size: 0;
  line-height: 1;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.v13-theme-toggle::before,
.v13-theme-toggle::after {
  position: absolute;
  top: 50%;
  z-index: 0;
  font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
  font-size: .72rem;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%);
  transition: color 150ms ease, opacity 150ms ease, text-shadow 150ms ease;
}

.v13-theme-toggle::before {
  left: 9px;
  content: "☀";
  color: #e7bb71;
  opacity: 1;
  text-shadow: 0 0 7px rgba(231, 187, 113, .22);
}

.v13-theme-toggle::after {
  right: 9px;
  content: "☾";
  color: #a9c4c8;
  opacity: .46;
}

.v13-theme-toggle[data-theme-state="light"] {
  --v13-toggle-knob: linear-gradient(180deg, #b9c9ca 0%, #8ea4a6 52%, #647b80 100%);
  --v13-toggle-knob-ink: #10252d;
  --v13-toggle-cue: #82b9bb;
  --v13-toggle-cue-soft: rgba(130, 185, 187, .2);
  border-color: #536a72;
}

.v13-theme-toggle[data-theme-state="light"]::before {
  opacity: 1;
}

.v13-theme-toggle[data-theme-state="light"]::after {
  opacity: .42;
}

.v13-theme-toggle[data-theme-state="dark"] {
  --v13-toggle-knob: linear-gradient(180deg, #1e5962 0%, #123d47 52%, #0b2732 100%);
  --v13-toggle-knob-ink: #d9ffff;
  --v13-toggle-cue: #6fe3e7;
  --v13-toggle-cue-soft: rgba(111, 227, 231, .3);
  border-color: #4daeb4;
  background: linear-gradient(180deg, #253b42 0%, #16272e 48%, #0c171d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .12),
    inset 0 -2px 3px rgba(0, 0, 0, .54),
    0 2px 0 rgba(0, 0, 0, .4),
    0 0 0 1px rgba(111, 227, 231, .1),
    0 5px 13px rgba(0, 0, 0, .28);
}

.v13-theme-toggle[data-theme-state="dark"]::before {
  opacity: .42;
}

.v13-theme-toggle[data-theme-state="dark"]::after {
  color: #baf7f6;
  opacity: 1;
  text-shadow: 0 0 8px rgba(111, 227, 231, .3);
}

.v13-theme-toggle [data-theme-icon] {
  position: relative;
  z-index: 1;
  display: inline-grid;
  flex: 0 0 var(--v13-toggle-knob-size);
  width: var(--v13-toggle-knob-size);
  height: var(--v13-toggle-knob-size);
  place-items: center;
  border: 1px solid var(--v13-toggle-cue);
  border-radius: 50%;
  color: var(--v13-toggle-knob-ink);
  background: var(--v13-toggle-knob);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .22),
    inset 0 -2px 3px rgba(0, 0, 0, .38),
    0 0 0 1px var(--v13-toggle-cue-soft),
    0 2px 6px rgba(0, 0, 0, .48);
  font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
  font-size: 0;
  line-height: 1;
  transform: translateX(0);
  transition: transform 180ms cubic-bezier(.2, .8, .2, 1), color 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.v13-theme-toggle [data-theme-icon]::before {
  content: "☀";
  font-size: .76rem;
}

.v13-theme-toggle[data-theme-state="dark"] [data-theme-icon] {
  transform: translateX(var(--v13-toggle-travel));
}

.v13-theme-toggle[data-theme-state="dark"] [data-theme-icon]::before {
  content: "☾";
}

.v13-theme-toggle:hover {
  transform: translateY(-1px);
  border-color: #76e9e9;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .15),
    inset 0 -2px 3px rgba(0, 0, 0, .5),
    0 0 0 1px rgba(118, 233, 233, .16),
    0 7px 16px rgba(12, 46, 52, .38);
}

.v13-theme-toggle:focus-visible {
  outline: 2px solid #72e5e5;
  outline-offset: 3px;
  box-shadow:
    0 0 0 5px rgba(114, 229, 229, .2),
    inset 0 1px 0 rgba(255, 255, 255, .14),
    inset 0 -2px 3px rgba(0, 0, 0, .5);
}

.v13-theme-toggle:active,
.v13-theme-toggle[aria-pressed="true"]:active {
  transform: translateY(1px);
}

.v13-theme-toggle:active [data-theme-icon],
.v13-theme-toggle[aria-pressed="true"]:active [data-theme-icon] {
  box-shadow:
    0 0 0 1px rgba(114, 229, 229, .34),
    inset 0 1px 0 rgba(255, 255, 255, .15),
    0 1px 3px rgba(0, 0, 0, .52);
}

.v13-theme-toggle--floating {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 300;
}

body:not(.route-presentation) .v13-header__actions:not(.has-theme-toggle)::before {
  flex: 0 0 var(--v13-toggle-width);
  width: var(--v13-toggle-width);
  min-width: var(--v13-toggle-width);
  height: var(--v13-toggle-height);
  content: "";
  visibility: hidden;
  pointer-events: none;
}

.v13-theme-toggle .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --v13-blue: #4f8cff;
  --v13-blue-dark: #3577ee;
  --v13-blue-soft: #132b50;
  --v13-navy: #f3f7ff;
  --v13-navy-2: #d8e5fb;
  --v13-green: #4ad29a;
  --v13-green-soft: #0d3027;
  --v13-red: #ff7785;
  --v13-red-soft: #3a1821;
  --v13-amber: #f3b758;
  --v13-amber-soft: #392a13;
  --v13-ink: #edf3ff;
  --v13-muted: #b5c1d5;
  --v13-subtle: #8f9db4;
  --v13-line: #263752;
  --v13-line-strong: #3a4d6b;
  --v13-surface: #0b1627;
  --v13-surface-alt: #101d31;
  --v13-shadow-sm: 0 3px 14px rgba(0, 0, 0, .24);
  --v13-shadow-md: 0 16px 40px rgba(0, 0, 0, .34);
  --v13-shadow-lg: 0 28px 68px rgba(0, 0, 0, .44);
  --ref-blue: #4f8cff;
  --ref-blue-dark: #3577ee;
  --ref-navy: #06152b;
  --ref-navy-2: #0a2344;
  --ref-ink: #edf3ff;
  --ref-copy: #b5c1d5;
  --ref-muted: #96a5bc;
  --ref-line: #283a56;
  --ref-soft: #101e32;
  --ref-blue-soft: #132c53;
  --ref-green: #4ad29a;
  --ref-red: #ff7785;
  --ref-amber: #f3b758;
  --ref-shadow: 0 16px 38px rgba(0, 0, 0, .36);
  --ref-shadow-soft: 0 7px 20px rgba(0, 0, 0, .26);
}

/* Body-level premium tokens otherwise override the dark risk colors inherited from the root. */
html[data-theme="dark"] body.avlu-v13 {
  --v13-green: #4ad29a;
  --v13-red: #ff7785;
  --v13-amber: #f3b758;
  --v13-subtle: #aab7ca;
}

html[data-theme="dark"] body.avlu-v13,
html[data-theme="dark"] body.avlu-v13.reference-target,
html[data-theme="dark"] .avlu-v13.client-page {
  color: var(--v13-ink);
  background:
    radial-gradient(circle at 82% -8%, rgba(49, 116, 232, .2), transparent 30%),
    radial-gradient(circle at 5% 18%, rgba(31, 88, 178, .12), transparent 28%),
    linear-gradient(180deg, #07101f 0%, #0a1526 48%, #07101f 100%);
  color-scheme: dark;
}

html[data-theme="dark"] .v13-header,
html[data-theme="dark"] .reference-target .v13-header {
  border-bottom-color: rgba(58, 77, 107, .75);
  background: rgba(7, 16, 31, .9);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
}

html[data-theme="dark"] .v13-nav a:hover,
html[data-theme="dark"] .v13-nav a:focus-visible,
html[data-theme="dark"] .v13-nav a[aria-current="page"] {
  color: #f8fbff;
  background: #14243b;
}

html[data-theme="dark"] :is(
  .v13-menu,
  .v13-btn--secondary,
  .v13-product,
  .v13-kpi,
  .v13-proof-card,
  .v13-feature-card,
  .v13-role-card,
  .v13-reason,
  .v13-faq details,
  .v13-process-card,
  .v13-table-card,
  .v13-distribution-card,
  .v13-evidence,
  .v13-evidence-callout,
  .v13-ledger-card,
  .v13-evidence-checks li,
  .client-vin-steps li,
  .client-panel,
  .client-search-form,
  .client-search-results-panel,
  .client-intake-form,
  .client-paste-hero,
  .client-btn--secondary,
  .client-advanced-search,
  .v13-mini-dashboard,
  .v13-detail-card,
  .v13-proof-box,
  .v13-use-card,
  .v13-compare-wrap,
  .v13-contact-card,
  .v13-quote-preview,
  .v13-validation-form,
  .v13-validation-output,
  .v13-campaign-summary,
  .v13-campaign-summary__head > span,
  .v13-campaign-summary__metrics div,
  .v13-submission-receipt > div,
  .v13-evidence-toolbar,
  .v13-ledger-table-wrap,
  .client-strip-card,
  .client-decision-control,
  .client-package-output,
  .admin-lifecycle,
  .admin-card,
  .v13-legal-panel,
  .v13-login-card,
  .product-flow-card,
  .review-meta-pill,
  .case-walkthrough,
  .case-boundary-card,
  .case-method-grid article,
  .case-quote-file,
  .case-quote-inputs,
  .case-quote-inputs > div,
  .case-quote-proof,
  .case-template-file,
  .case-template-file__grid > div,
  .case-status-key,
  .ref-dashboard,
  .ref-dashboard__head,
  .ref-dash-card,
  .ref-card,
  .ref-stat-strip,
  .ref-faq-grid details,
  .target-evidence-scorecard,
  .target-evidence-scorecard__total,
  .v13-evidence__item,
  .v13-queue-metrics > div,
  .ref-panel,
  .ref-help-card,
  .source-query-item,
  .source-query-card,
  .ref-source-candidates > *,
  .ref-review-hero,
  .ref-review-metrics,
  .ref-review-package,
  .client-package-grid
) {
  color: var(--v13-ink);
  border-color: var(--v13-line) !important;
  background: var(--v13-surface) !important;
  box-shadow: var(--v13-shadow-sm);
}

html[data-theme="dark"] :is(
  .ref-section--soft,
  .v13-section--soft,
  .client-section--soft,
  .client-section--cta,
  .product-flow-strip,
  .v13-legal-shell,
  .v13-login-shell,
  .target-review-desk #review,
  .target-review-desk #package,
  .target-review-desk #admin-controls,
  .target-review-desk .client-decision-strip,
  .target-source-search .ref-source-query-list
) {
  border-color: var(--v13-line) !important;
  background: var(--v13-surface-alt) !important;
}

html[data-theme="dark"] .v13-quote-impact {
  color: #fff;
  background: linear-gradient(135deg, #0d2a4b, #113764) !important;
}

html[data-theme="dark"] .v13-quote-impact :is(span, strong) {
  color: #fff;
}

html[data-theme="dark"] .v13-quote-impact > div > span {
  color: #cbdaf0;
}

html[data-theme="dark"] .avlu-v13 .v13-quote-stack .is-delta,
html[data-theme="dark"] .avlu-v13 .v13-output-metrics .is-delta {
  border-color: #765929;
  background: #241d12;
}

html[data-theme="dark"] .avlu-v13 .v13-quote-stack .is-delta span,
html[data-theme="dark"] .avlu-v13 .v13-output-metrics .is-delta span {
  color: #dbe5f5;
}

html[data-theme="dark"] .avlu-v13 .v13-quote-stack .is-delta strong,
html[data-theme="dark"] .avlu-v13 .v13-output-metrics .is-delta strong {
  color: #f3b758;
}

html[data-theme="dark"] .case-quote-standard {
  border-color: var(--v13-line);
  background:
    radial-gradient(circle at 82% 16%, rgba(56, 139, 253, .12), transparent 32%),
    var(--v13-surface-alt);
}

html[data-theme="dark"] .case-quote-equation {
  background: linear-gradient(145deg, #06162d, #092a53) !important;
}

html[data-theme="dark"] :is(
  .case-quote-file__head > div > strong,
  .case-template-file__head > div > strong,
  .case-quote-inputs strong,
  .case-template-file__grid > div strong,
  .case-status-key > div strong
) {
  color: var(--v13-ink);
}

html[data-theme="dark"] :is(
  .case-quote-inputs span,
  .case-quote-inputs small,
  .case-quote-proof li,
  .case-template-file__grid > div p,
  .case-status-key > div p,
  .case-file-label
) {
  color: var(--v13-muted);
}

html[data-theme="dark"] :is(
  .case-quote-inputs .is-variance,
  .case-quote-proof__boundary,
  .case-template-file__gate
) {
  border-color: rgba(219, 169, 76, .32) !important;
  color: #f4d28e;
  background: rgba(127, 78, 5, .2) !important;
}

html[data-theme="dark"] :is(input, select, textarea),
html[data-theme="dark"] .ref-field :is(input, select, textarea),
html[data-theme="dark"] .v13-validation-fieldset :is(input, select, textarea),
html[data-theme="dark"] .v13-evidence-toolbar select {
  color: var(--v13-ink) !important;
  border-color: var(--v13-line-strong) !important;
  background: #0a1728 !important;
  box-shadow: none;
}

html[data-theme="dark"] :is(input, textarea)::placeholder {
  color: #7f8ea7;
  opacity: 1;
}

html[data-theme="dark"] :is(.ref-page-hero, .v13-page-hero, .v13-product, .case-walkthrough-hero) {
  border-color: var(--v13-line);
  background:
    radial-gradient(circle at 84% 10%, rgba(56, 126, 244, .16), transparent 30%),
    linear-gradient(180deg, #091527 0%, #0c192b 100%) !important;
}

html[data-theme="dark"] :is(.ref-dashboard__body, .ref-dashboard__top, .ref-proof-card, .ref-comps-card) {
  border-color: var(--v13-line) !important;
  background-color: #0d1a2d;
}

html[data-theme="dark"] .ref-scenario-label {
  color: #b7c9e7;
  border-color: #2b4469;
  background: #14243b;
}

html[data-theme="dark"] :is(.ref-dashboard__rail, .client-sidebar, .v13-footer) {
  color: #eaf2ff;
  background: linear-gradient(155deg, #020912 0%, #06182f 58%, #08254c 100%) !important;
}

html[data-theme="dark"] .v13-footer {
  border-top: 1px solid #18365f;
  box-shadow: 0 -20px 55px rgba(0, 0, 0, .26);
}

html[data-theme="dark"] :is(.v13-footer, .v13-footer a, .v13-footer h3, .v13-footer p, .ref-dashboard__rail, .ref-dashboard__rail *) {
  color: #eaf2ff;
}

html[data-theme="dark"] .ref-dashboard__rail span.is-active {
  color: #fff;
  background: #0754d8;
}

html[data-theme="dark"] .dealer-difference-card__avlu strong {
  color: #9cc0ff;
}

html[data-theme="dark"] .dealer-difference-table tbody td:nth-child(2) {
  color: #9cc0ff;
}

html[data-theme="dark"] :is(.ref-eyebrow, .v13-eyebrow, .client-eyebrow, .ref-faq-head a, .v13-login-back) {
  color: #75a7ff !important;
}

html[data-theme="dark"] .client-status {
  color: #9cc0ff;
}

html[data-theme="dark"] .admin-danger,
html[data-theme="dark"] .admin-danger:hover,
html[data-theme="dark"] .admin-danger:focus-visible {
  color: #fff;
  border-color: #a92d3c;
  background: #a92d3c;
}

html[data-theme="dark"] :is(.case-proof-board, .ref-cta, .v13-cta, .client-callout) {
  border-color: rgba(116, 166, 255, .3) !important;
  box-shadow: 0 20px 48px rgba(0, 0, 0, .34);
}

html[data-theme="dark"] :is(.ref-tip, .v13-legal-note, .source-score-card, .target-source-search .source-query-card--priority) {
  border-color: #294a77 !important;
  background: linear-gradient(145deg, #102747, #0d1c31) !important;
}

html[data-theme="dark"] :is(.v13-btn--light, .ref-cta .v13-btn) {
  color: #07162d;
  border-color: #fff;
  background: #fff;
}

html[data-theme="dark"] :is(.is-red, .client-strip-card--warn strong) {
  color: var(--v13-red) !important;
}

html[data-theme="dark"] :is(.is-amber, .client-status--warn) {
  color: var(--v13-amber) !important;
}

html[data-theme="dark"] :is(.is-green, .client-status--ready) {
  color: var(--v13-green) !important;
}

html[data-theme="dark"] .v13-runtime-boundary {
  border-color: #29476f;
  background: #101f34;
}

html[data-theme="dark"] .v13-runtime-boundary[data-state="preview"] {
  border-color: #765929;
  background: #241d12;
}

html[data-theme="dark"] .v13-runtime-boundary[data-state="candidate"] {
  border-color: #245f45;
  background: #10261d;
}

html[data-theme="dark"] .v13-runtime-boundary strong {
  color: var(--v13-heading);
}

html[data-theme="dark"] .v13-runtime-noscript {
  border-color: #765929;
  background: #241d12;
  color: #ffe1a6;
}

html[data-theme="dark"] table :is(th, td) {
  border-color: var(--v13-line) !important;
}

html[data-theme="dark"] table th {
  color: #dce7fa;
  background: #101f34 !important;
}

html[data-theme="dark"] table tr:hover td {
  background: #12233b !important;
}

@media (max-width: 980px) {
  html[data-theme="dark"] .v13-nav {
    border-color: var(--v13-line);
    background: #0b1829 !important;
  }
}

@media (max-width: 720px) {
  .v13-theme-toggle,
  body:not(.route-presentation) .v13-header__actions:not(.has-theme-toggle)::before {
    --v13-toggle-width: 60px;
    --v13-toggle-height: 44px;
    --v13-toggle-min-height: 44px;
    --v13-toggle-knob-size: 22px;
    --v13-toggle-travel: 30px;
  }

  .v13-theme-toggle::before,
  .v13-theme-toggle::after {
    font-size: .64rem;
  }

  .v13-theme-toggle::before {
    left: 7px;
  }

  .v13-theme-toggle::after {
    right: 7px;
  }

  .v13-theme-toggle [data-theme-icon]::before {
    font-size: .7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .v13-theme-toggle {
    transition: none;
  }
}
