/* AF-9182 — VIN-Info dark theme for the vehicle report (Layouts/one_report_layout_new.ctp, vin-info themes only —
   autobaza and automo render the same layout and never get these files). Loaded after the report stylesheets and
   after assets/css/vi-dark.css (generic Bootstrap pieces, toggle, logo). Everything sits under html.dark and under
   @media screen: printing and "save as PDF" keep the light report. */

@media screen {

html.dark {
  --rd-bg:      #0E1520;   /* page */
  --rd-card:    #1B2738;   /* white cards */
  --rd-card-2:  #162131;   /* light-grey panels (bg-light, card headers) */
  --rd-card-3:  #22314A;   /* section header strip */
  --rd-text:    #E4E8EE;
  --rd-muted:   #98A0AB;
  --rd-line:    #2A3646;
  --rd-head:    #8CC0EE;   /* headings, captions: #2d6294 / #294a7a in the light report */
  --rd-link:    #6CC0EE;
  --rd-fill:    #1F4E7A;   /* blue strips under white text */
}

/* ─── Canvas, cards, panels ─────────────────────────────── */
html.dark body,
html.dark .page-wrapper,
html.dark .page-wrapper .page-content,
html.dark .page-content {
  background-color: var(--rd-bg);
  color: var(--rd-text);
}
html.dark .bg-white { background-color: var(--rd-card) !important; }
html.dark .bg-light { background-color: var(--rd-card-2) !important; }
html.dark .card {
  background-color: var(--rd-card);
  border-color: var(--rd-line);
  color: var(--rd-text);
}
html.dark .card-footer { background-color: var(--rd-card-2); border-color: var(--rd-line); }
html.dark .sec-report .card .card-header { background-color: var(--rd-card-3); border-color: var(--rd-line); }
html.dark .sec-report .card .card-second .card-header { background-color: var(--rd-card-2); }
html.dark .card .card-header.card-dark,
html.dark .bg-blue { background-color: var(--rd-fill) !important; }
html.dark .border,
html.dark .border-top,
html.dark .border-bottom { border-color: var(--rd-line) !important; }
/* …but coloured outlines keep their meaning (a stolen-vehicle hit is .border-danger). */
html.dark .border-danger { border-color: #F87171 !important; }
html.dark .border-success { border-color: #52C985 !important; }
html.dark .border-warning { border-color: #FBBF24 !important; }
html.dark .border-info,
html.dark .border-primary { border-color: #6CC0EE !important; }
html.dark .list-group-item { background-color: var(--rd-card); border-color: var(--rd-line); color: var(--rd-text); }

/* ─── Text ──────────────────────────────────────────────── */
/* Headings: at the weight of the bare h1–h6 of pg-mainbody/pg-custom — status colours (green/red/orange titles
   of the summary cards, .text-green, .text-danger…) keep winning, as in the light report. */
:where(html.dark) :is(h1, h2, h3, h4, h5, h6) { color: var(--rd-head); }
html.dark section .htitle,
html.dark .table-report caption,
html.dark .table-flags caption,
html.dark .rcert span,
html.dark .rdeco span,
html.dark .rinfo span { color: var(--rd-head); }
html.dark .fg-blue { color: var(--rd-head) !important; }
html.dark .sec-report .card .card-header.card-dark h3,
html.dark .sec-report .card .card-header.card-dark i { color: #ffffff !important; }
html.dark .text-dark,
html.dark .text-body,
html.dark .unit { color: var(--rd-text) !important; }
html.dark .text-muted,
html.dark .small-gdpr { color: var(--rd-muted) !important; }
html.dark .text-red,
html.dark .text-danger { color: #F87171 !important; }   /* #b21620 is ≈2.3:1 on the dark panels */
html.dark .ab-form label { color: var(--rd-head); }      /* settings switches, Service Advisor form (#294a7a) */
/* High-contrast mode (pg-wcag.css, .removeColors) is mostly white on black already; its five black-text rules
   would put black text on the dark panels. */
html.dark .removeColors .ab-form label,
html.dark .removeColors .ab-form .dataTables_wrapper label,
html.dark .removeColors .btn-link,
html.dark .removeColors .modal-body { color: #ffffff; }
html.dark .removeColors footer { color: #ffffff !important; }
html.dark .btn-link { color: var(--rd-link); }
html.dark .btn-link:hover,
html.dark .btn-link:focus { color: #A9DBF7; }
:where(html.dark) a { color: var(--rd-link); }
:where(html.dark) a:hover { color: #A9DBF7; }
html.dark .main-nav .nav-item a { color: var(--rd-link) !important; }
html.dark .main-nav .nav-item.active a { color: #A9DBF7 !important; }
html.dark footer { color: var(--rd-muted) !important; }

/* ─── Top navigation (Elements/account/nav.ctp) ─────────── */
html.dark .navbar.mainnav.bg-white { background-color: var(--rd-card) !important; }
html.dark .navbar.mainnav .nav-link { color: var(--rd-text); }
html.dark .navbar.mainnav .nav-link:hover { color: var(--rd-link); }
/* Collapsed-menu button (account and report nav on phones, legacy header below xl): Bootstrap's .navbar-light icon is a
   half-transparent black SVG — a white one in the dark theme (Krzysiek's test, 20.11). */
html.dark .navbar-light .navbar-toggler { border-color: rgba(255, 255, 255, 0.35); }
html.dark .navbar-light .navbar-toggler-icon { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 0.92)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); }
html.dark .navbar.mainnav .navbar-nav .active > .nav-link,
html.dark .navbar.mainnav .navbar-nav .nav-link.active { color: #ffffff; }

/* ─── Tables ────────────────────────────────────────────── */
html.dark .table { color: var(--rd-text); }
html.dark .table td,
html.dark .table th { border-color: var(--rd-line) !important; }
html.dark .table-striped tbody tr:nth-of-type(odd),
html.dark .table-report.table-striped tbody tr:nth-of-type(odd),
html.dark .table-striped-fix tbody tr:nth-of-type(odd) td { background-color: rgba(255, 255, 255, 0.03); }
html.dark .table-striped-line tbody tr { border-top-color: var(--rd-line); }
html.dark .table-danger, html.dark .table-danger > td, html.dark .table-danger > th,
html.dark .table-report.table-striped tbody tr.table-danger:nth-of-type(odd) > td { background-color: #3A1D21; }
html.dark .table-warning, html.dark .table-warning > td, html.dark .table-warning > th,
html.dark .table-report.table-striped tbody tr.table-warning:nth-of-type(odd) > td { background-color: #3A2F14; }
html.dark .table-info, html.dark .table-info > td, html.dark .table-info > th,
html.dark .table-report.table-striped tbody tr.table-info:nth-of-type(odd) > td { background-color: #16324A; }
html.dark .table-success, html.dark .table-success > td, html.dark .table-success > th { background-color: #173523; }
html.dark .table-primary, html.dark .table-primary > td, html.dark .table-primary > th { background-color: #1B3550; }  /* user-declared mileage rows */
html.dark .table-secondary, html.dark .table-secondary > td, html.dark .table-secondary > th { background-color: #1F2937; color: var(--rd-muted); }  /* cancelled payments (account) */
html.dark .table-light, html.dark .table-light > td, html.dark .table-light > th { background-color: var(--rd-card-2); }
html.dark .table-active, html.dark .table-active > td, html.dark .table-active > th { background-color: rgba(255, 255, 255, 0.06); }
html.dark .table-hover .table-secondary:hover, html.dark .table-hover .table-secondary:hover > td { background-color: #273447; }
html.dark .table-hover tbody tr:hover { background-color: rgba(255, 255, 255, 0.05); color: var(--rd-text); }

/* ─── Report sections ───────────────────────────────────── */
html.dark .rhist-advisory,
html.dark .rhist-annotation,
html.dark .rhist-failure { border-color: var(--rd-line); background-color: var(--rd-card-2); }   /* all three #f1f1f1 (service data) */
/* AF-9196: advisory and failure boxes too — pg-reports.css tints all three per row; the MOT history (UK) uses them. */
html.dark .table-timeline .table-success :is(.rhist-annotation, .rhist-advisory, .rhist-failure) { background-color: #173523; border-color: #2E6B45; }
html.dark .table-timeline .table-info :is(.rhist-annotation, .rhist-advisory, .rhist-failure) { background-color: #16324A; border-color: #2F5F8A; }
html.dark .table-timeline .table-warning :is(.rhist-annotation, .rhist-advisory, .rhist-failure) { background-color: #3A2F14; border-color: #7A5E22; }
html.dark .table-timeline .table-danger :is(.rhist-annotation, .rhist-advisory, .rhist-failure) { background-color: #3A1D21; border-color: #7F3A40; }
html.dark #service-odometer { background-color: var(--rd-card-2) !important; border-color: var(--rd-line) !important; }
html.dark #service-age tr .service-summary,
html.dark #service-age tr .service-actions-sml { border-color: var(--rd-line) !important; }
html.dark .service-actions-box { background-color: var(--rd-card-2); border-color: var(--rd-line); }
html.dark .vehicle-photos h5 { background-color: rgba(255, 255, 255, 0.03); border-color: var(--rd-line); }
html.dark .cert-bg { background-color: var(--rd-card-2); }
html.dark .cert-bg .cert-bg-in { background-color: var(--rd-card); }
html.dark .event-src { background-color: var(--rd-card-2); border-color: var(--rd-line); }
html.dark .vs-item.vs-base,
html.dark .ve-item.ve-base { border-color: var(--rd-line) !important; }
html.dark .report-disclaimer-box { border-color: var(--rd-line); background-color: rgba(255, 255, 255, 0.03); }

/* Sticky section menu (pg-reports-v2.css) */
html.dark .sec-fixed-menu { border-top-color: var(--rd-line); }
html.dark .sec-fixed-menu .fix-position { background-color: var(--rd-card); border-color: var(--rd-line); }
html.dark .sec-fixed-menu .nav-link { color: var(--rd-text); }

/* High-contrast mode keeps its white cell borders (pg-wcag.css) — the dark line rule above would win otherwise. */
html.dark .removeColors .table td,
html.dark .removeColors .table th { border-color: #ffffff !important; }

/* ─── Valuation v2 section (css/valuation-v2.css, AF-9113: colours are --vv-* tokens under .vv2) ── */
html.dark .vv2 {
  --vv-blue: #8CC0EE;        /* titles, chart lines and range borders — read as light blue on the dark card */
  --vv-blue-dark: #A9DBF7;   /* links */
  --vv-blue-soft: #16324A;
  --vv-blue-mid: #2F5F8A;    /* range band fill */
  --vv-ink: #E4E8EE;
  --vv-ink2: #C3CAD4;
  --vv-muted: #98A0AB;
  --vv-light: #162131;
  --vv-line: #2A3646;
  --vv-line2: #3A4A60;
  --vv-warn-bg: #2B2210;
  --vv-warn-line: #6B5214;
  --vv-warn-ink: #FCD98A;
  --vv-green-text: #52C985;
  --vv-orange-text: #F0A54A;
}
html.dark .vv2 .vv-card { background: var(--rd-card); }
html.dark .vv2 .vv-card-head,
html.dark .vv2 .vv-btn.vv-p { background: var(--rd-fill); border-color: var(--rd-fill); }
html.dark .vv2 .vv-btn.vv-p:hover { background: #2B5F92; }
html.dark .vv2 .vv-btn.vv-s { background: transparent; }
html.dark .vv2 .vv-chart .vv-grid line { stroke: var(--rd-line); }
html.dark .vv2 .vv-chart .vv-me { stroke: var(--rd-card); }

/* ─── Vehicle value over time and damage scale (css/value-history.css, AF-9155/AF-9227: --vh-* tokens under .vh) ── */
html.dark .vh {
  --vh-blue: var(--rd-head);          /* yearly dots */
  --vh-sky: var(--rd-link);           /* price line */
  --vh-band: rgba(108, 192, 238, .16);
  --vh-ad: #F0A54A;                   /* advert price, as --vv-orange-text */
  --vh-ink: var(--rd-text);
  --vh-muted: var(--rd-muted);
  --vh-grid: var(--rd-line);
}
/* Marker outlines take the card colour instead of white; .vh-hit is the transparent hover target and stays bare. */
html.dark .vh .vh-dot circle:not(.vh-hit),
html.dark .vh .vh-ad path { stroke: var(--rd-card); }
html.dark .vd .vd-track {
  background: linear-gradient(90deg, #4A3F22 0 20%, #4D3622 20% 40%, #4B2C27 40% 60%, #45262B 60% 80%, #3D2229 80% 100%);
}
html.dark .vd .vd-track::before {
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(25% - 2px), var(--rd-card) calc(25% - 2px), var(--rd-card) 25%);
}
html.dark .vd .vd-band { border-color: var(--rd-card); box-shadow: 0 0 0 1px rgba(228, 232, 238, .45); }
/* High-contrast mode keeps its light tokens and white outlines (value-history.css) — the dark block above would win otherwise. */
html.dark .removeColors .vh { --vh-blue: #9cc9f5; --vh-ink: #fff; --vh-muted: #ccc; --vh-grid: #555; }
html.dark .removeColors .vh .vh-dot circle:not(.vh-hit),
html.dark .removeColors .vh .vh-ad path { stroke: #fff; }

/* ─── Sidebar (sidebar-themes.css, pg-custom.css) ───────── */
html.dark .light-theme .sidebar-wrapper .sidebar-menu .sidebar-dropdown div,
html.dark .light-theme .sidebar-wrapper .sidebar-footer,
html.dark .light-theme .sidebar-wrapper .sidebar-menu ul li a i { background-color: var(--rd-card-2); }
html.dark .light-theme.sidebar-bg .sidebar-wrapper:before { background-color: var(--rd-card); }
html.dark .light-theme .sidebar-wrapper .sidebar-menu .header-menu span,
html.dark .light-theme .sidebar-wrapper .sidebar-menu .menu-text { color: var(--rd-head); }
/* Sidebar navigation links (sidebar-themes.css: #74726E / #343a40 / #424242 — unreadable on the dark sidebar).
   Navigation only: the blue VIN-check widget (.wdg-vinchecker) keeps its own white links. */
html.dark .light-theme .sidebar-wrapper .sidebar-menu a,
html.dark .light-theme .sidebar-submenu ul li a { color: var(--rd-text); }
html.dark .light-theme .sidebar-wrapper .sidebar-menu a:hover,
html.dark .light-theme .sidebar-wrapper .sidebar-menu a:focus,
html.dark .light-theme .sidebar-wrapper .sidebar-menu li.active > a,
html.dark .light-theme .sidebar-submenu ul li a:hover,
html.dark .light-theme .sidebar-submenu ul li.active a { color: var(--rd-link); }
/* Sidebar header actions (account: Edit profile, Log out; report: Print, Share) — explicit, so they do not depend on
   the :where() link rule (Safari 13 has dark mode but no :where()). The VIN-check widget is outside the header. */
html.dark .light-theme .sidebar-wrapper .sidebar-header a { color: var(--rd-link); }
html.dark .light-theme .sidebar-wrapper .sidebar-header a:hover,
html.dark .light-theme .sidebar-wrapper .sidebar-header a:focus { color: #A9DBF7; }

}

/* The toggle is a screen control. */
@media print {
  .vi-theme-toggle { display: none !important; }
}
