﻿html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* ── Brand palette ───────────────────────────────────────── */
/* Brand purple #442374 comes from the VRG squid logo. Bootstrap's "primary"
   is remapped to the purple family so buttons, links, form controls and
   the *-primary utilities follow the brand in both themes.               */

:root,
[data-bs-theme="light"] {
    --vrg-brand: #442374;
    --vrg-focus-rgb: 123, 92, 176;
    --bs-primary: #5b3497;
    --bs-primary-rgb: 91, 52, 151;
    --bs-primary-text-emphasis: #2d174d;
    --bs-primary-bg-subtle: #ece6f5;
    --bs-primary-border-subtle: #c9b8e3;
    --bs-link-color: #5b3497;
    --bs-link-color-rgb: 91, 52, 151;
    --bs-link-hover-color: #442374;
    --bs-link-hover-color-rgb: 68, 35, 116;
    --bs-focus-ring-color: rgba(91, 52, 151, 0.25);
}

/* Dark theme: neutral near-black surfaces (no blue tint) under the brand
   purple navbar, with lavender links and purple accents.                 */
[data-bs-theme="dark"] {
    --vrg-focus-rgb: 165, 134, 232;
    --bs-body-bg: #141414;
    --bs-body-bg-rgb: 20, 20, 20;
    --bs-secondary-bg: #222222;
    --bs-secondary-bg-rgb: 34, 34, 34;
    --bs-tertiary-bg: #1b1b1b;
    --bs-tertiary-bg-rgb: 27, 27, 27;
    --bs-border-color: #2f2f2f;
    --bs-border-color-translucent: rgba(255, 255, 255, 0.1);
    --bs-primary: #8a68d0;
    --bs-primary-rgb: 138, 104, 208;
    --bs-primary-text-emphasis: #c9b3ef;
    --bs-primary-bg-subtle: #221639;
    --bs-primary-border-subtle: #442374;
    --bs-link-color: #a586e8;
    --bs-link-color-rgb: 165, 134, 232;
    --bs-link-hover-color: #c9b3ef;
    --bs-link-hover-color-rgb: 201, 179, 239;
    --bs-focus-ring-color: rgba(165, 134, 232, 0.25);
}
[data-bs-theme="dark"] .nav-pills {
    --bs-nav-pills-link-active-bg: #4b2a85;
}

.btn-primary {
    --bs-btn-bg: #5b3497;
    --bs-btn-border-color: #5b3497;
    --bs-btn-hover-bg: #4c2b80;
    --bs-btn-hover-border-color: #4c2b80;
    --bs-btn-focus-shadow-rgb: 123, 92, 176;
    --bs-btn-active-bg: #442374;
    --bs-btn-active-border-color: #442374;
    --bs-btn-disabled-bg: #5b3497;
    --bs-btn-disabled-border-color: #5b3497;
}
.btn-outline-primary {
    --bs-btn-color: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: #5b3497;
    --bs-btn-hover-border-color: #5b3497;
    --bs-btn-focus-shadow-rgb: 123, 92, 176;
    --bs-btn-active-bg: #442374;
    --bs-btn-active-border-color: #442374;
    --bs-btn-disabled-color: var(--bs-primary);
    --bs-btn-disabled-border-color: var(--bs-primary);
}
.nav-pills {
    --bs-nav-pills-link-active-bg: #5b3497;
}
.pagination {
    --bs-pagination-focus-box-shadow: 0 0 0 0.25rem var(--bs-focus-ring-color);
    --bs-pagination-active-bg: #5b3497;
    --bs-pagination-active-border-color: #5b3497;
}
.list-group {
    --bs-list-group-active-bg: #5b3497;
    --bs-list-group-active-border-color: #5b3497;
}
.dropdown-menu {
    --bs-dropdown-link-active-bg: #5b3497;
}
.progress,
.progress-stacked {
    --bs-progress-bar-bg: #5b3497;
}
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: #ad99cb;
}
.form-check-input:checked,
.form-check-input[type="checkbox"]:indeterminate {
    background-color: #5b3497;
    border-color: #5b3497;
}
.form-switch .form-check-input:focus:not(:checked) {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23ad99cb'/%3e%3c/svg%3e");
}
.form-select:focus {
    box-shadow: 0 0 0 0.25rem var(--bs-focus-ring-color);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem var(--bs-body-bg), 0 0 0 0.25rem rgba(var(--vrg-focus-rgb), 0.5);
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ── Navbar (brand purple) ────────────────────────────── */

.vrg-navbar {
    background-color: var(--vrg-brand);
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
    margin-bottom: 1.5rem;
}

.vrg-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.5);
}
.vrg-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.vrg-navbar .navbar-brand {
    color: #fff;
    transition: opacity 0.2s ease;
}
.vrg-navbar .navbar-brand:hover {
    opacity: 0.85;
}
.vrg-brand-mark {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

/* ── Brand logo (hub, login) ─────────────────────────────── */
/* Two renders of the same mark: brand blue for light, white for dark.
   The blue mark sits on the dark navbar in both themes, so it always uses the white render. */
.vrg-hub-logo {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}
.vrg-login-logo {
    width: 96px;
    height: 96px;
}
.vrg-logo-dark { display: none; }
[data-bs-theme="dark"] .vrg-logo-light { display: none; }
[data-bs-theme="dark"] .vrg-logo-dark { display: inline-block; }

.vrg-navbar .nav-link {
    transition: color 0.2s ease;
}
.vrg-navbar .nav-link:hover,
.vrg-navbar .nav-link:focus {
    color: #d6c6f3 !important;
}

/* ── Release Notes Modal ─────────────────────────────── */

.release-modal .modal-content {
    border: none;
}
.release-modal-header {
    background: #1c1033;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 1.1rem 1.5rem;
    align-items: flex-start;
}
.release-modal-eyebrow {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #b69ae6;
    margin-bottom: 0.2rem;
}
.release-modal-title {
    color: #f8fafc;
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
}
.release-modal-body {
    background: #160c28;
    color: #cbd5e1;
    padding: 1.25rem 1.5rem;
}
.release-modal-footer {
    background: #1c1033;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.release-version-header {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
    padding-bottom: 0.4rem;
    margin-top: 2rem;
    border-bottom: 2px solid rgba(182,154,230,0.35);
    margin-bottom: 0.75rem;
}
.release-version-header.mt-0 {
    margin-top: 0;
}
.release-section-title {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #b69ae6;
    border-bottom: 1px solid rgba(182,154,230,0.2);
    padding-bottom: 0.3rem;
    margin-top: 1.1rem;
    margin-bottom: 0.5rem;
}
.release-items {
    list-style: none;
    padding: 0;
    margin: 0 0 0.25rem 0;
}
.release-items li {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.88rem;
    line-height: 1.5;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.release-items li:last-child {
    border-bottom: none;
}
.release-badge {
    font-size: 0.58rem;
    font-weight: 700;
    padding: 0.18rem 0.45rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    flex-shrink: 0;
    line-height: 1.4;
}
.release-badge-new          { background: #052e16; color: #4ade80; border: 1px solid #166534; }
.release-badge-improvement  { background: #0c1a3a; color: #93c5fd; border: 1px solid #1e40af; }
.release-badge-fix          { background: #3b1a00; color: #fbbf24; border: 1px solid #92400e; }
.release-badge-change       { background: #1c1c2e; color: #94a3b8; border: 1px solid #334155; }

/* ── What's New navbar trigger ───────────────────────── */

.release-trigger-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.85);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    line-height: 1.5;
    align-self: center;
}
.release-trigger-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(255,255,255,0.65);
}

/* ── Dark mode toggle (navbar) ───────────────────────────── */

.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    align-self: center;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.theme-toggle-btn:hover,
.theme-toggle-btn:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.65);
    outline: none;
}
/* Mobile: sits beside the ? button in the header row, so match its 44px touch target. */
@media (max-width: 575.98px) {
    .navbar-tour-wrapper .theme-toggle-btn {
        width: 44px;
        height: 44px;
    }
}

/* ── Dark theme adjustments ──────────────────────────────── */
/* Bootstrap 5.3 restyles its own components from data-bs-theme; these
   cover the site's custom pieces that use fixed colours. Use Bootstrap
   CSS variables (--bs-body-bg, --bs-border-color, ...) in new styles so
   they adapt without needing a rule here.                               */

[data-bs-theme="dark"] .vrg-navbar {
    background-color: #3a1e66;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

[data-bs-theme="dark"] .release-modal .modal-content {
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Bootstrap's "light" contextual variants are fixed near-white even under
   data-bs-theme="dark". The grids use them for headers, panels and neutral
   badges, so map them to the theme's tertiary surface instead.            */
[data-bs-theme="dark"] .table-light {
    --bs-table-bg: var(--bs-tertiary-bg);
    --bs-table-color: var(--bs-body-color);
    --bs-table-border-color: var(--bs-border-color);
    --bs-table-striped-bg: var(--bs-tertiary-bg);
    --bs-table-striped-color: var(--bs-body-color);
    --bs-table-hover-bg: var(--bs-tertiary-bg);
    --bs-table-hover-color: var(--bs-body-color);
}
[data-bs-theme="dark"] .bg-light {
    background-color: var(--bs-tertiary-bg) !important;
}
[data-bs-theme="dark"] .text-bg-light {
    color: var(--bs-body-color) !important;
    background-color: var(--bs-tertiary-bg) !important;
}

/* ── Data protection (wwwroot/js/data-protection.js) ──────────
   Signed-in pages get <body data-protect>: page text can't be selected
   (form fields still can, so editing works), and printing produces a
   blank page with a notice instead of the data.                     */
body[data-protect] {
    -webkit-user-select: none;
    user-select: none;
}
body[data-protect] input,
body[data-protect] textarea,
body[data-protect] select,
body[data-protect] [contenteditable=""],
body[data-protect] [contenteditable="true"],
body[data-protect] [data-allow-copy] {
    -webkit-user-select: text;
    user-select: text;
}
/* ── Copy buttons (<copy-value>, wwwroot/js/copy-value.js) ─────
   The one sanctioned way to copy a value: a small clipboard icon
   beside a part number, company name or email. Theme-safe — the
   glyph is currentColor on the theme's secondary/primary colours. */
.vrg-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2; /* stay clickable above .stretched-link overlays */
    margin-left: .25rem;
    padding: .1rem .2rem;
    border: 0;
    border-radius: .25rem;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: .8em;
    line-height: 1;
    vertical-align: baseline;
    cursor: pointer;
    opacity: .65;
}
.vrg-copy-btn:hover,
.vrg-copy-btn:focus-visible {
    color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
    opacity: 1;
}
.vrg-copy-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .35);
}
.vrg-copy-toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    z-index: 2000;
    padding: .4rem .9rem;
    border-radius: .5rem;
    font-size: .9rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease-in-out;
}
.vrg-copy-toast.show {
    opacity: 1;
}
/* ── Part dashboard side tabs + drawers (Pages/Modules/Search) ── */
.vrg-side-tabs {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1030;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.vrg-side-tab {
    writing-mode: vertical-rl;
    padding: .75rem .4rem;
    border-radius: .5rem 0 0 .5rem;
    white-space: nowrap;
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .2);
}
.vrg-side-tab .badge {
    writing-mode: horizontal-tb;
    margin-top: .35rem;
}
.vrg-has-side-tabs {
    padding-right: 2.75rem;
}
.vrg-side-drawer {
    --bs-offcanvas-width: 44rem;
}
/* ── Shared document drawer (VRG-89, _Layout #doc-drawer, document-drawer.js) ── */
/* Same width as the part dashboard's drawers; full width on phones. */
.vrg-doc-drawer {
    --bs-offcanvas-width: 44rem;
}
@media (max-width: 575.98px) {
    .vrg-doc-drawer {
        --bs-offcanvas-width: 100vw;
    }
}
/* ── Rep Opportunities accordion (Pages/Modules/Reports) ── */
/* An open customer's header stays pinned while its long match table scrolls past. */
.rep-sticky-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background-color: var(--bs-accordion-btn-bg);
}
.rep-sticky-header:has(> .accordion-button:not(.collapsed)) {
    background-color: var(--bs-accordion-active-bg);
    box-shadow: 0 .25rem .5rem rgba(0, 0, 0, .12);
}
@media print {
    body[data-protect] > * {
        display: none !important;
    }
    body[data-protect]::before {
        content: "Printing is disabled for VRG Components. This attempt has been recorded.";
        display: block;
        padding: 2rem;
        font-size: 1.25rem;
    }
}

/* ── Gross profit running chart (VRG-106) ──
   Series colours are the dataviz reference palette slots 1-2, validated (scripts/validate_palette.js) against
   this site's light (#fff) and dark (#141414) surfaces: blue = this period, orange (dashed) = previous period. */
.gp-chart { --gp-cur: #2a78d6; --gp-prev: #eb6834; }
[data-bs-theme="dark"] .gp-chart, [data-bs-theme="dark"] .gp-legend, [data-bs-theme="dark"] .gp-tooltip { --gp-cur: #3987e5; --gp-prev: #d95926; }
.gp-legend { --gp-cur: #2a78d6; --gp-prev: #eb6834; vertical-align: middle; }
.gp-line-cur, .gp-line-prev { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.gp-line-cur { stroke: var(--gp-cur); }
.gp-line-prev { stroke: var(--gp-prev); stroke-dasharray: 5 4; }
.gp-grid { stroke: var(--bs-border-color); stroke-width: 1; opacity: .6; }
.gp-zero { stroke: var(--bs-secondary-color); stroke-width: 1; }
.gp-axis { fill: var(--bs-secondary-color); font-size: 11px; }
.gp-label { fill: var(--bs-body-color); font-size: 12px; }
.gp-crosshair { stroke: var(--bs-secondary-color); stroke-width: 1; stroke-dasharray: 2 3; pointer-events: none; }
.gp-tooltip { --gp-cur: #2a78d6; --gp-prev: #eb6834; position: absolute; pointer-events: none; z-index: 5; font-size: .8rem; padding: .35rem .5rem;
    background: var(--bs-body-bg); color: var(--bs-body-color); border: 1px solid var(--bs-border-color); border-radius: .375rem; box-shadow: var(--bs-box-shadow-sm); white-space: nowrap; }
.gp-swatch { display: inline-block; width: 10px; height: 2px; margin-right: 6px; vertical-align: middle; }
.gp-swatch-cur { background: var(--gp-cur); }
.gp-swatch-prev { background: var(--gp-prev); }
