/*
 * Financial Planner - Arqentis brand theme.
 *
 * Source: Arqentis Brand Guidelines v1.0 (financial planning documentation/
 * Arqentis-Brand-Guidelines.pdf). The rules this file follows:
 *   - "One purple, two worlds." Web runs LIGHT: white and lavender, ink text
 *     (#282E38) and BLACK buttons. Brand surfaces run on Brand Night with
 *     white text - here that is the sidebar and the sign-in header.
 *   - Purple is the only brand colour, used sparingly, for accents.
 *   - Never purple text on Brand Night (Purple Light instead), and never small
 *     purple text on lavender tags (Purple Deep instead).
 *   - Geist for everything; weights Light / Regular / Medium / SemiBold only.
 *   - No blues, greens or rainbow gradients in brand graphics. Green and red
 *     survive only as status colours, in the shades the guideline itself uses
 *     for its Do / Don't marks.
 *
 * Loaded after app.min.css and BEFORE app-mobile.css: it re-skins the vendor
 * theme, while the phone rules in app-mobile.css (16px inputs, tab bar) still
 * get the last word.
 *
 * The vendor CSS hard-codes its blue (#3167f3) in component rules instead of
 * reading --bs-primary, so re-pointing the variables alone is not enough; the
 * component blocks below override exactly the rules this app uses.
 */

/* ---------------------------------------------------------------- *
 * 1. Brand tokens + Bootstrap variables (light - the web default)
 * ---------------------------------------------------------------- */

:root,
[data-bs-theme=light] {
    /* The palette, by its guideline names. */
    --aq-purple: #8A38F5;          /* Arqentis Purple - accents */
    --aq-purple-deep: #6E2DC4;     /* hover, text on lavender */
    --aq-purple-light: #A672F8;    /* purple on dark backgrounds */
    --aq-lavender: #E8D7FD;        /* tags and labels */
    --aq-lavender-mist: #F4ECFE;   /* section backgrounds */
    --aq-ink: #0A0C0E;             /* buttons, wordmark */
    --aq-ink-text: #282E38;        /* body text on web */
    --aq-night: #090214;           /* Brand Night - sidebar, sign-in header */
    --aq-slate: #5F6B7C;           /* secondary text */
    --aq-line: #E0E3E8;            /* hairlines */
    --aq-offer-gold: #F59E0B;      /* offers ONLY - deliberately not a status colour */

    /* Type */
    --bs-font-sans-serif: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-size: 0.875rem;
    --bs-body-font-weight: 400;

    /* Surfaces and text */
    --bs-body-color: #282E38;
    --bs-body-color-rgb: 40, 46, 56;
    --bs-body-bg: #FAF7FE;         /* half-way from white to Lavender Mist */
    --bs-body-bg-rgb: 250, 247, 254;
    --bs-emphasis-color: #0A0C0E;
    --bs-emphasis-color-rgb: 10, 12, 14;
    --bs-secondary-color: #5F6B7C;
    --bs-secondary-color-rgb: 95, 107, 124;
    --bs-secondary-bg: #FFFFFF;    /* cards, modals, dropdowns */
    --bs-tertiary-color: rgba(40, 46, 56, 0.5);
    --bs-tertiary-bg: #F4ECFE;
    --bs-tertiary-bg-rgb: 244, 236, 254;
    --bs-heading-color: #0A0C0E;
    --bs-border-color: #E0E3E8;
    --bs-border-radius: 0.5rem;
    --bs-border-radius-lg: 0.75rem;

    /* Primary = Arqentis Purple (accents: links, checks, progress, focus) */
    --bs-primary: #8A38F5;
    --bs-primary-rgb: 138, 56, 245;
    --bs-primary-text-emphasis: #6E2DC4;
    --bs-primary-bg-subtle: #E8D7FD;
    --bs-primary-border-subtle: #D3B7FB;
    --bs-link-color: #8A38F5;
    --bs-link-color-rgb: 138, 56, 245;
    --bs-link-hover-color: #6E2DC4;
    --bs-link-hover-color-rgb: 110, 45, 196;
    --bs-focus-ring-color: rgba(138, 56, 245, 0.25);
    --bs-code-color: #6E2DC4;
    --bs-highlight-bg: #E8D7FD;

    /* Neutrals */
    --bs-secondary: #5F6B7C;
    --bs-secondary-rgb: 95, 107, 124;
    --bs-secondary-text-emphasis: #3B4350;
    --bs-secondary-bg-subtle: #EEF0F3;
    --bs-secondary-border-subtle: #D5D9E0;
    --bs-dark: #0A0C0E;
    --bs-dark-rgb: 10, 12, 14;
    --bs-light: #F4ECFE;
    --bs-light-rgb: 244, 236, 254;

    /* Status colours. Success / danger are the guideline's own Do / Don't
       shades. Warning is a burnt amber, kept clear of Offer Gold so a warning
       never reads as a promotion. Info is neutral slate - no blues. */
    --bs-success: #1F7A4D;
    --bs-success-rgb: 31, 122, 77;
    --bs-success-text-emphasis: #155535;
    --bs-success-bg-subtle: #E6F2EC;
    --bs-success-border-subtle: #A9D3BE;
    --bs-danger: #C62828;
    --bs-danger-rgb: 198, 40, 40;
    --bs-danger-text-emphasis: #8E1C1C;
    --bs-danger-bg-subtle: #FBEAEA;
    --bs-danger-border-subtle: #F0B4B4;
    --bs-warning: #B45309;
    --bs-warning-rgb: 180, 83, 9;
    --bs-warning-text-emphasis: #7C3A06;
    --bs-warning-bg-subtle: #FDF1E4;
    --bs-warning-border-subtle: #F3CFA6;
    --bs-info: #5F6B7C;
    --bs-info-rgb: 95, 107, 124;
    --bs-info-text-emphasis: #3B4350;
    --bs-info-bg-subtle: #EEF0F3;
    --bs-info-border-subtle: #D5D9E0;

    --bs-form-valid-color: #1F7A4D;
    --bs-form-valid-border-color: #1F7A4D;
    --bs-form-invalid-color: #C62828;
    --bs-form-invalid-border-color: #C62828;

    /* Vendor-theme chrome variables (app.min.css) */
    --bs-topbar-bg: #FFFFFF;
    --bs-topbar-b-border-color: #ECE6F5;
    --bs-topbar-nav-icon-bg: #FFFFFF;
    --bs-topbar-nav-icon-color: #282E38;
    --bs-label-color: #282E38;
    --bs-table-head-bg: #F4ECFE;
    --bs-border-secondary: #B8B0C6;
}

/* Brand Night sidebar. Wins over app.min.css's html[data-startbar=dark] by
   coming later with the same specificity. */
html[data-startbar=dark] {
    --bs-startbar-bg: #090214;
    --bs-startbar-e-border-color: #1C1230;
    --bs-menu-icon-color: #B8B0C6;
    --bs-menu-link-color: #D9D2E6;
    --bs-menu-link-hover-color: #FFFFFF;
    --bs-menu-link-active-bg-color: rgba(138, 56, 245, 0.18);
    --bs-menu-label-color: #8E84A6;
}

/* Dark mode is not switchable in the UI today (the toggle in base.html is
   commented out), but if it comes back it should be Brand Night, not the
   vendor's blue-grey - and purple text there must be Purple Light. */
html[data-bs-theme=dark] {
    --bs-body-color: #D9D2E6;
    --bs-body-color-rgb: 217, 210, 230;
    --bs-body-bg: #090214;
    --bs-body-bg-rgb: 9, 2, 20;
    --bs-emphasis-color: #FFFFFF;
    --bs-secondary-color: #B8B0C6;
    --bs-secondary-color-rgb: 184, 176, 198;
    --bs-secondary-bg: #120A22;
    --bs-tertiary-bg: #1C1230;
    --bs-heading-color: #FFFFFF;
    --bs-border-color: #2E2242;
    --bs-card-bg: #120A22;
    --bs-primary-text-emphasis: #A672F8;
    --bs-primary-bg-subtle: rgba(138, 56, 245, 0.2);
    --bs-primary-border-subtle: #3D1F66;
    --bs-link-color: #A672F8;
    --bs-link-color-rgb: 166, 114, 248;
    --bs-link-hover-color: #B886F9;
    --bs-link-hover-color-rgb: 184, 134, 249;
    --bs-topbar-bg: #090214;
    --bs-topbar-b-border-color: #1C1230;
    --bs-topbar-nav-icon-bg: #120A22;
    --bs-topbar-nav-icon-color: #D9D2E6;
    --bs-table-head-bg: #1C1230;
}
html[data-bs-theme=dark] .text-primary { color: #A672F8 !important; }

/* ---------------------------------------------------------------- *
 * 2. Typography - Geist, the guideline's four weights
 * ---------------------------------------------------------------- */

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 500;            /* Headline / Title weight */
    letter-spacing: -0.01em;
}

/* Geist is loaded at 300-600; there is no Bold in the brand. Map the theme's
   700s onto SemiBold so the browser never fakes a bold. */
b, strong, th, .fw-bold, .fw-bolder { font-weight: 600 !important; }
.badge { --bs-badge-font-weight: 600; }

.page-wrapper .page-content .page-title-box .page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--bs-emphasis-color);
    letter-spacing: -0.015em;
}

.card .card-header .card-title { font-weight: 600; letter-spacing: -0.005em; }

/* Inputs and buttons carry their own 13px / 500 from the vendor theme. */
.form-control,
.form-select {
    font-size: var(--bs-body-font-size);
    font-weight: 400;
}
.btn { --bs-btn-font-size: var(--bs-body-font-size); --bs-btn-font-weight: 500; }
.btn-sm { --bs-btn-font-size: 0.8125rem; }

/* ---------------------------------------------------------------- *
 * 3. Buttons - black on the web, purple only on hover / focus
 * ---------------------------------------------------------------- */

.btn-primary,
.btn-dark {
    --bs-btn-color: #FFFFFF;
    --bs-btn-bg: #0A0C0E;
    --bs-btn-border-color: #0A0C0E;
    --bs-btn-hover-color: #FFFFFF;
    --bs-btn-hover-bg: #6E2DC4;             /* Purple Deep: "Hover" */
    --bs-btn-hover-border-color: #6E2DC4;
    --bs-btn-focus-shadow-rgb: 138, 56, 245;
    --bs-btn-active-color: #FFFFFF;
    --bs-btn-active-bg: #5A24A3;
    --bs-btn-active-border-color: #5A24A3;
    --bs-btn-disabled-color: #FFFFFF;
    --bs-btn-disabled-bg: #0A0C0E;
    --bs-btn-disabled-border-color: #0A0C0E;
    -webkit-box-shadow: none;
    box-shadow: none;
}

.btn-outline-primary {
    --bs-btn-color: #6E2DC4;
    --bs-btn-border-color: #6E2DC4;
    --bs-btn-hover-color: #FFFFFF;
    --bs-btn-hover-bg: #6E2DC4;
    --bs-btn-hover-border-color: #6E2DC4;
    --bs-btn-focus-shadow-rgb: 138, 56, 245;
    --bs-btn-active-color: #FFFFFF;
    --bs-btn-active-bg: #5A24A3;
    --bs-btn-active-border-color: #5A24A3;
    --bs-btn-disabled-color: #6E2DC4;
    --bs-btn-disabled-border-color: #6E2DC4;
}

/* Secondary / cancel: lavender, the web's second surface colour. */
.btn-light {
    --bs-btn-color: #282E38;
    --bs-btn-bg: #F4ECFE;
    --bs-btn-border-color: #F4ECFE;
    --bs-btn-hover-color: #0A0C0E;
    --bs-btn-hover-bg: #E8D7FD;
    --bs-btn-hover-border-color: #E8D7FD;
    --bs-btn-focus-shadow-rgb: 138, 56, 245;
    --bs-btn-active-color: #0A0C0E;
    --bs-btn-active-bg: #DCC4FC;
    --bs-btn-active-border-color: #DCC4FC;
    --bs-btn-disabled-color: #5F6B7C;
    --bs-btn-disabled-bg: #F4ECFE;
    --bs-btn-disabled-border-color: #F4ECFE;
    -webkit-box-shadow: none;
    box-shadow: none;
}

.btn-outline-success {
    --bs-btn-color: #1F7A4D;
    --bs-btn-border-color: #1F7A4D;
    --bs-btn-hover-color: #FFFFFF;
    --bs-btn-hover-bg: #1F7A4D;
    --bs-btn-hover-border-color: #1F7A4D;
    --bs-btn-focus-shadow-rgb: 31, 122, 77;
    --bs-btn-active-color: #FFFFFF;
    --bs-btn-active-bg: #155535;
    --bs-btn-active-border-color: #155535;
    --bs-btn-disabled-color: #1F7A4D;
    --bs-btn-disabled-border-color: #1F7A4D;
}

.btn-danger {
    --bs-btn-color: #FFFFFF;
    --bs-btn-bg: #C62828;
    --bs-btn-border-color: #C62828;
    --bs-btn-hover-color: #FFFFFF;
    --bs-btn-hover-bg: #A61F1F;
    --bs-btn-hover-border-color: #A61F1F;
    --bs-btn-focus-shadow-rgb: 198, 40, 40;
    --bs-btn-active-color: #FFFFFF;
    --bs-btn-active-bg: #8E1C1C;
    --bs-btn-active-border-color: #8E1C1C;
    --bs-btn-disabled-color: #FFFFFF;
    --bs-btn-disabled-bg: #C62828;
    --bs-btn-disabled-border-color: #C62828;
    -webkit-box-shadow: none;
    box-shadow: none;
}

.btn-warning {
    --bs-btn-color: #FFFFFF;
    --bs-btn-bg: #B45309;
    --bs-btn-border-color: #B45309;
    --bs-btn-hover-color: #FFFFFF;
    --bs-btn-hover-bg: #963F06;
    --bs-btn-hover-border-color: #963F06;
    --bs-btn-focus-shadow-rgb: 180, 83, 9;
    --bs-btn-active-color: #FFFFFF;
    --bs-btn-active-bg: #7C3A06;
    --bs-btn-active-border-color: #7C3A06;
    --bs-btn-disabled-color: #FFFFFF;
    --bs-btn-disabled-bg: #B45309;
    --bs-btn-disabled-border-color: #B45309;
    -webkit-box-shadow: none;
    box-shadow: none;
}

.btn-link {
    --bs-btn-color: var(--bs-link-color);
    --bs-btn-hover-color: var(--bs-link-hover-color);
    --bs-btn-active-color: var(--bs-link-hover-color);
}

/* ---------------------------------------------------------------- *
 * 4. Forms - purple focus and checks
 * ---------------------------------------------------------------- */

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: #8A38F5;
    -webkit-box-shadow: 0 0 0 3px rgba(138, 56, 245, 0.15);
    box-shadow: 0 0 0 3px rgba(138, 56, 245, 0.15);
}

.form-check-input:checked,
.form-check-input[type=checkbox]:indeterminate {
    background-color: #8A38F5;
    border-color: #8A38F5;
}

.form-switch .form-check-input:focus {
    --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='%23A672F8'/%3e%3c/svg%3e");
}

.form-range::-webkit-slider-thumb { background-color: #8A38F5; }
.form-range::-webkit-slider-thumb:active { background-color: #D3B7FB; }
.form-range::-moz-range-thumb { background-color: #8A38F5; }
.form-range::-moz-range-thumb:active { background-color: #D3B7FB; }

/* ---------------------------------------------------------------- *
 * 5. Components that hard-code the vendor blue
 * ---------------------------------------------------------------- */

.progress,
.progress-stacked {
    --bs-progress-bg: #F4ECFE;
    --bs-progress-bar-bg: #8A38F5;
}

.nav-pills {
    --bs-nav-pills-link-active-bg: #0A0C0E;
}

.nav-tabs .nav-item.show .nav-link,
.nav-tabs .nav-link.active {
    border-bottom: 2px solid #8A38F5 !important;
    color: var(--bs-emphasis-color);
}

.pagination {
    --bs-pagination-active-bg: #0A0C0E;
    --bs-pagination-active-border-color: #0A0C0E;
}

.list-group {
    --bs-list-group-active-bg: #8A38F5;
    --bs-list-group-active-border-color: #8A38F5;
}

/* Highlighted table rows (the Corrections "Pool" total, skipped goals). */
.table-primary {
    --bs-table-color: #0A0C0E;
    --bs-table-bg: #F4ECFE;
    --bs-table-border-color: #E8D7FD;
    --bs-table-striped-bg: #EEE2FD;
    --bs-table-striped-color: #0A0C0E;
    --bs-table-active-bg: #E8D7FD;
    --bs-table-active-color: #0A0C0E;
    --bs-table-hover-bg: #EEE2FD;
    --bs-table-hover-color: #0A0C0E;
}
.table-light {
    --bs-table-color: #282E38;
    --bs-table-bg: #F7F5FA;
    --bs-table-border-color: #E6E1EE;
    --bs-table-striped-bg: #F1EEF5;
    --bs-table-striped-color: #282E38;
    --bs-table-active-bg: #E6E1EE;
    --bs-table-active-color: #282E38;
    --bs-table-hover-bg: #F1EEF5;
    --bs-table-hover-color: #282E38;
}

.dropdown-menu {
    --bs-dropdown-link-hover-bg: #F4ECFE;
    --bs-dropdown-link-active-bg: #E8D7FD;
    --bs-dropdown-link-active-color: #0A0C0E;
    --bs-dropdown-border-color: #ECE6F5;
    --bs-dropdown-box-shadow: 0 12px 32px rgba(9, 2, 20, 0.08);
}

/* Small purple text on a lavender tag is a guideline "don't" - it is too
   faint (3.9:1). Tags take Purple Deep (5.5:1) instead. */
.bg-primary-subtle.text-primary,
.bg-primary-subtle .text-primary {
    color: #6E2DC4 !important;
}

/* Cards: white on the lavender page, a hairline and a soft night-tinted shadow. */
.card {
    --bs-card-border-color: #ECE6F5;
    --bs-card-border-radius: 0.75rem;
    --bs-card-inner-border-radius: calc(0.75rem - 1px);
    -webkit-box-shadow: 0 1px 2px rgba(9, 2, 20, 0.04), 0 8px 24px rgba(9, 2, 20, 0.03);
    box-shadow: 0 1px 2px rgba(9, 2, 20, 0.04), 0 8px 24px rgba(9, 2, 20, 0.03);
}

.modal {
    --bs-modal-border-radius: 0.75rem;
    --bs-modal-border-color: #ECE6F5;
}

/* The vendor paints modal headers charcoal (#25282d) with a white title; make
   that Brand Night, and lift the muted subtitle and the close X, which were
   both dark-on-dark. */
.modal-header {
    background-color: #090214;
    border-bottom-color: #1C1230;
}
.modal-header .text-muted { color: #B8B0C6 !important; }
.modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.8;
}

.alert-primary {
    --bs-alert-color: #6E2DC4;
    --bs-alert-bg: #F4ECFE;
    --bs-alert-border-color: #E8D7FD;
}

::selection { background: #E8D7FD; color: #0A0C0E; }

/* ---------------------------------------------------------------- *
 * 6. Sidebar (Brand Night) and top bar
 * ---------------------------------------------------------------- */

.startbar .brand {
    border-bottom: 1px solid var(--bs-startbar-e-border-color);
}

.startbar .startbar-menu .navbar-nav .menu-label {
    /* Guideline "Eyebrow": caps, tracked +30%. */
    letter-spacing: 0.3em;
    font-weight: 500;
}

.startbar .startbar-menu .navbar-nav .nav-item .nav-link {
    font-size: 13.5px;
    font-weight: 400;
}

/* Active item: white text, Purple Light icon (purple TEXT is not allowed on
   Brand Night), and a purple sliver on the left edge echoing the brand's
   diagonal accent. */
.startbar .startbar-menu .navbar-nav .nav-item .nav-link.active,
.startbar .startbar-menu .navbar-nav .nav-item.active .nav-link.active {
    color: #FFFFFF;
    font-weight: 500;
    background-color: var(--bs-menu-link-active-bg-color);
}
.startbar .startbar-menu .navbar-nav .nav-item .nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #8A38F5;
}
.startbar .startbar-menu .navbar-nav .nav-item .nav-link.active .menu-icon,
.startbar .startbar-menu .navbar-nav .nav-item.active .nav-link.active .menu-icon {
    color: #A672F8;
}
.startbar .startbar-menu .navbar-nav .nav-item .nav-link:not(.active):hover {
    background-color: rgba(255, 255, 255, 0.04);
}

/* Muted spans inside the dark menu would otherwise use the light-theme grey. */
.startbar .text-muted { color: var(--bs-menu-label-color) !important; }

.startbar-overlay { background-color: rgba(9, 2, 20, 0.45); }

/* ---------------------------------------------------------------- *
 * 7. Sign-in pages - Brand Night header with the reverse logo
 * ---------------------------------------------------------------- */

.auth-header-box {
    position: relative;
    overflow: hidden;
    /* .rounded-top uses the 8px base radius; the card around it is 12px. */
    border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0 !important;
    /* A faint purple glow from the corner, as on the guideline cover. Purple
       gradients are on-brand; rainbow ones are not. */
    background:
        radial-gradient(120% 140% at 100% 100%, rgba(138, 56, 245, 0.28) 0%, rgba(138, 56, 245, 0) 55%),
        #090214 !important;
}
.auth-header-box .text-muted { color: #B8B0C6 !important; }

/* The two purple slivers from the guideline cover, bottom-right of the header. */
.auth-header-box::after {
    content: "";
    position: absolute;
    right: -6px;
    bottom: 0;
    width: 86px;
    height: 8px;
    background:
        linear-gradient(#8A38F5, #8A38F5) left / 38px 100% no-repeat,
        linear-gradient(#8A38F5, #8A38F5) right / 38px 100% no-repeat;
    transform: skewX(-35deg);
    pointer-events: none;
}
