﻿/* ======================================================
   KITSKERK GLOBAL APPLICATION STYLES
   ====================================================== */

:root {
    --sidebar-width: 200px;
    --topbar-height: 5rem;
    --kits-wine: #7a2e3a;
    --kits-wine-dark: #5f1f2d;
    --page-background: #f8f9fa;
    --sidebar-background: #f4f6f8;
}

/* ======================================================
   GLOBAL BASE STYLES
   ====================================================== */

html {
    width: 100%;
    min-width: 0;
    min-height: 100%;
    font-size: 16px;
}

body {
    width: 100%;
    min-width: 0;
    min-height: 100%;
    margin: 0;
    overflow-x: hidden;
    font-family: "General Sans", Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.45;
    color: #2f3437;
    background: var(--page-background);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

img,
svg,
video,
canvas,
iframe {
    max-width: 100%;
}

a,
.btn-link {
    color: #006bb7;
}

    .btn:focus,
    .btn:active:focus,
    .btn-link.nav-link:focus,
    .form-control:focus,
    .form-check-input:focus {
        box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem #258cfb;
    }

/* ======================================================
   FORMS AND VALIDATION
   ====================================================== */

.valid.modified:not([type="checkbox"]) {
    outline: 1px solid #26b050;
}

.invalid,
.validation-message {
    outline: none !important;
    color: #e50000;
}

input.invalid,
select.invalid,
textarea.invalid {
    border: 1px solid #dc3545 !important;
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control::placeholder,
.form-floating > .form-control-plaintext::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control:focus::placeholder,
.form-floating > .form-control-plaintext:focus::placeholder {
    text-align: start;
}

/* ======================================================
   PAGE LAYOUT
   ====================================================== */

#layout {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    overflow: visible;
}

#layout,
#sidenav,
#main,
#main-topbar,
#main .content {
    box-sizing: border-box;
}

/* ======================================================
   SIDEBAR
   ====================================================== */

#sidenav {
    position: fixed;
    top: 0;
    bottom: auto;
    left: calc(var(--sidebar-width) * -1);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    /* Fallback, then modern mobile viewport height */
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
    background-color: var(--sidebar-background);
    border-right: 1px solid #dee2e6;
    box-shadow: none;
    transition: left .3s ease;
    will-change: left;
}

    #sidenav.expanded,
    #layout.sidebar-pinned #sidenav,
    #layout.sidebar-pinned #sidenav.collapsed {
        left: 0;
    }

    #sidenav.collapsed {
        left: calc(var(--sidebar-width) * -1);
    }

    #sidenav * {
        max-width: 100%;
    }

/* Click-outside layer rendered only for an unpinned open sidebar. */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1999;
    background: transparent;
    cursor: default;
}

/* ======================================================
   MAIN CONTENT
   ====================================================== */

#main {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    margin-left: 0;
    overflow-x: hidden;
    overflow-y: visible;
    background: var(--page-background);
    transition: width .3s ease, margin-left .3s ease;
}

/* Desktop/tablet pinned mode: reserve physical sidebar space. */
#layout.sidebar-pinned #main {
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
}

#main .content {
    width: 100%;
    min-width: 0;
    padding-top: 6px;
    padding-bottom: 15px;
}

    /* Prevent wide descendants from forcing the page itself wider. */
    #main .content > * {
        min-width: 0;
    }

/* ======================================================
   SIDEBAR HEADER
   ====================================================== */

#sidenav .heading {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: var(--topbar-height);
    max-height: var(--topbar-height);
    padding: .85rem .5rem;
    border-bottom: 1px solid #dee2e6;
    background-color: var(--sidebar-background);
    box-shadow: none;
    color: var(--kits-wine) !important;
    font-size: 1rem !important;
    font-weight: 600;
}

    #sidenav .heading .sidebar-home-button {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--kits-wine);
        font: inherit;
        cursor: pointer;
    }

        #sidenav .heading .sidebar-home-button:hover,
        #sidenav .heading .sidebar-home-button:focus-visible {
            color: var(--kits-wine-dark);
        }

        #sidenav .heading .sidebar-home-button:focus-visible {
            outline: 2px solid rgba(122, 46, 58, .35);
            outline-offset: 3px;
            border-radius: 6px;
        }

    #sidenav .heading .topbar-logo {
        display: block;
        width: 35px;
        height: auto;
        margin-bottom: 4px;
    }

.heading-text {
    margin-top: -5px !important;
}

.footer-logo {
    width: 100%;
    max-width: 65px;
    height: auto;
}

/* ======================================================
   SIDEBAR NAVIGATION
   ====================================================== */

#sidenav .nav-scrollable {
    flex: 1 1 auto;
    min-height: 0;
    /*
     * Extra room at the bottom for:
     * - the phone browser toolbar
     * - iPhone safe-area/home indicator
     * - normal visual spacing
     */
    padding: 7px 0 calc(1rem + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--kits-wine) transparent;
}

    #sidenav .nav-scrollable::-webkit-scrollbar {
        width: 6px;
    }

    #sidenav .nav-scrollable::-webkit-scrollbar-track {
        background: transparent;
    }

    #sidenav .nav-scrollable::-webkit-scrollbar-thumb {
        border-radius: 10px;
        background-color: mediumpurple;
    }

        #sidenav .nav-scrollable::-webkit-scrollbar-thumb:hover {
            background-color: rebeccapurple;
        }

#sidenav .nav-item {
    width: 100%;
    margin: 2px 0;
}

#sidenav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 6px 4px;
    border: 1px solid rgba(222, 222, 222, .45);
    border-radius: 5px;
    background: rgba(252, 252, 252, .35);
    color: #333;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

    #sidenav .nav-link i {
        font-size: 1rem;
        line-height: 1;
    }

    #sidenav .nav-link:hover,
    #sidenav .nav-link:hover i,
    #sidenav .nav-link.active,
    #sidenav .nav-link.active i,
    #sidenav .nav-link.active:hover {
        color: var(--kits-wine);
    }

    #sidenav .nav-link:hover {
        border-color: rgba(184, 134, 11, .1);
        background: rgba(255, 255, 255, .5);
    }

    #sidenav .nav-link.active,
    #sidenav .nav-link.active:hover {
        border-color: rgba(122, 46, 58, .05);
        background: rgba(122, 46, 58, .02);
    }

/* ======================================================
   SIDEBAR FOOTER
   ====================================================== */

#sidenav .sidebar-footer {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 6px 4px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-soft);
    background: var(--sidebar-background);
}

    #sidenav .sidebar-footer a {
        display: block;
        width: 100%;
        color: #333;
        font-size: 0.67rem;
        font-weight: 600;
        line-height: 1.4;
        text-align: center;
        text-decoration: none;
    }

/* ======================================================
   TOP BAR
   ====================================================== */

#main-topbar {
    position: sticky;
    top: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    min-height: var(--topbar-height);
    padding: 0 15px;
    border-bottom: 1px solid #dee2e6;
    background: linear-gradient(90deg, #f4f5f7 0%, #f8f9fa 50%, #f4f5f7 100%);
    box-shadow: none;
}

    #main-topbar .ms-auto {
        display: flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
    }

    #main-topbar .topbar-link {
        margin-left: 0;
        padding: 0;
        color: #333;
        font-size: 0.86rem;
        font-weight: 450;
        text-decoration: none;
    }

        #main-topbar .topbar-link:hover {
            color: var(--kits-wine);
        }

    #main-topbar .topbar-separator {
        padding-right: 5px;
        padding-left: 5px;
        color: #9c9c9c;
    }

/* ======================================================
   TOP-BAR SIDEBAR CONTROLS
   ====================================================== */

.topbar-controls {
    position: relative;
    z-index: 2100;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 2px;
    margin: 3px 0 0;
    font-size: 1.3rem;
}

    .topbar-controls button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        padding: 0;
        border: 0;
        border-radius: 7px;
        background: transparent;
        color: #333;
        cursor: pointer;
        transition: color .15s ease, background-color .15s ease;
    }

        .topbar-controls button:hover,
        .topbar-controls button:focus-visible {
            background: rgba(122, 46, 58, .07);
            color: var(--kits-wine);
        }

        .topbar-controls button:focus-visible {
            outline: 2px solid rgba(122, 46, 58, .35);
            outline-offset: 2px;
        }

    .topbar-controls .pin-btn.pinned {
        background: rgba(122, 46, 58, .08);
        color: var(--kits-wine);
    }

    .topbar-controls i {
        display: block;
        line-height: 1;
    }



/* ======================================================
   TABLES & DRAG SCROLL
   ====================================================== */

.aff-table-escape {
    position: relative;
    overflow: visible;
}

.drag-scroll-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    cursor: grab;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    scrollbar-width: auto;
    scrollbar-color: rgba(0,0,0,0.10) transparent;
}


    .drag-scroll-wrapper:active {
        cursor: grabbing;
    }

/*.aff-grid-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.84rem;
}

    .aff-grid-table thead th {
        background-color: #f3eefb;
        padding: 10px 14px;
        font-weight: 600;
        border-bottom: 2px solid #dee2e6;
    }

    .aff-grid-table td {
        padding: 8px 14px;
        white-space: nowrap;
        border: 1px dashed rgba(0,0,0,0.05);
    }*/

.aff-row-selected {
    background-color: #e7f1ff;
}

/* ======================================================
   CUSTOM BUTTONS (DESIGN SYSTEM)
   ====================================================== */


/* Light cerulean */
.btn-cerulean-light {
    background-color: #3A8FB7; /* soft cerulean */
    border-color: #2F7A9C;
    color: #fff;
}

    .btn-cerulean-light:hover {
        background-color: #347FA3;
        border-color: #296B88;
        color: #fff;
    }

    .btn-cerulean-light:active,
    .btn-cerulean-light:focus {
        background-color: #2E708F;
        border-color: #255E78;
        box-shadow: 0 0 0 .25rem rgba(58, 143, 183, .35);
        color: #fff;
    }

/* Dark cerulean */
.btn-cerulean-dark {
    background-color: #1F5F73; /* deep cerulean / blue-green */
    border-color: #184E5E;
    color: #fff;
}

    .btn-cerulean-dark:hover {
        background-color: #1B5567;
        border-color: #144652;
        color: #fff;
    }

    .btn-cerulean-dark:active,
    .btn-cerulean-dark:focus {
        background-color: #174A5A;
        border-color: #113C48;
        box-shadow: 0 0 0 .25rem rgba(31, 95, 115, .35);
        color: #fff;
    }

/* Lavender */
.btn-lavender {
    background-color: #7A66B3; /* soft lavender */
    border-color: #A493C6;
    color: white;
}

    .btn-lavender:hover {
        background-color: #6F5CA8;
        border-color: #9886BC;
        color: white;
    }

    .btn-lavender:active,
    .btn-lavender:focus {
        background-color: #A292CC;
        border-color: #8B7AB5;
        box-shadow: 0 0 0 .25rem rgba(184, 167, 217, .4);
        color: #2E2A3A;
    }


.btn-blue {
    background-color: #1B6EC2;
    border-color: #155A9E;
    color: #fff;
}

.btn-grey {
    background-color: #6C757D;
    border-color: #565E64;
    color: #fff;
}

.btn-red {
    background-color: #DC3545;
    border-color: #B02A37;
    color: #fff;
}

.btn-green {
    background-color: #198754;
    border-color: #146C43;
    color: #fff;
}

.btn-gold {
    background-color: #D4AF37;
    border-color: #B8962E;
    color: #fff;
    font-weight: 300;
}

/* Hover states */
.btn-purple:hover {
    background-color: #6d4fb8;
    border-color: #5c3da4;
    color: white;
}

.btn-blue:hover {
    background-color: #1861AC;
    border-color: #124A82;
}

.btn-grey:hover {
    background-color: #5A6268;
    border-color: #4A5156;
}

.btn-red:hover {
    background-color: #C82333;
    border-color: #8E1F2A;
}

.btn-green:hover {
    background-color: #157347;
    border-color: #115C38;
}

.btn-gold:hover {
    background-color: #C9A533;
    border-color: #A8831F;
}

/* Focus + active */
.btn-purple:focus,
.btn-purple:active {
    box-shadow: 0 0 0 .25rem rgba(123, 89, 201, .35);
    color: white;
}

.btn.btn-purple {
    /* base */
    --bs-btn-color: #ffffff;
    --bs-btn-bg: #7B59C9;
    --bs-btn-border-color: #6442B0;
    /* hover */
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: #6d4fb8;
    --bs-btn-hover-border-color: #5c3da4;
    /* active */
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: #6d4fb8;
    --bs-btn-active-border-color: #5c3da4;
    /* disabled — THIS WAS MISSING */
    --bs-btn-disabled-color: #ffffff;
    --bs-btn-disabled-bg: #7B59C9;
    --bs-btn-disabled-border-color: #6442B0;
    /* focus ring */
    --bs-btn-focus-shadow-rgb: 123, 89, 201;
}


.btn-blue:focus,
.btn-blue:active {
    box-shadow: 0 0 0 .25rem rgba(27, 110, 194, .35);
}

.btn-grey:focus,
.btn-grey:active {
    box-shadow: 0 0 0 .25rem rgba(108, 117, 125, .35);
}

.btn-red:focus,
.btn-red:active {
    box-shadow: 0 0 0 .25rem rgba(220, 53, 69, .35);
}

.btn-green:focus,
.btn-green:active {
    box-shadow: 0 0 0 .25rem rgba(25, 135, 84, .35);
}

.btn-gold:focus,
.btn-gold:active {
    box-shadow: 0 0 0 .25rem rgba(212, 175, 55, .35);
}

/* Disabled */
.btn:disabled,
.btn.disabled {
    opacity: .65;
    cursor: not-allowed;
    box-shadow: none;
}

/* ======================================================
   ALERTS
   ====================================================== */

.alert-purple {
    background-color: #f0e6ff;
    border: 1px solid #d0b8ff;
    color: #4b0082;
}

.alert-gold {
    background-color: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.35);
    color: #6b5600;
}

.alert-soft {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #333;
}

/* ======================================================
   TOAST / FEEDBACK
   ====================================================== */

.pe-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    pointer-events: none;
}

.pe-toast-content {
    padding: 16px 28px;
    font-size: 0.76rem;
    border-radius: 10px;
    color: #fff;
    box-shadow: none;
    text-align: center;
    width: min(320px, calc(100vw - 24px));
    min-width: 0;
    max-width: calc(100vw - 24px);
    font-weight: 600;
}

    .pe-toast-content.ok {
        background-color: #7b3fe4;
    }

    .pe-toast-content.err {
        background-color: #d93025;
    }

/* ======================================================
   BUTTONS AS LINKS (NAV / INLINE ACTIONS)
   ====================================================== */

.btn-as-link {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    width: 100%;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

    .btn-as-link:hover {
        text-decoration: underline;
    }

/* ======================================================
   SMALL UI HELPERS
   ====================================================== */

.btn-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
    line-height: 1.25;
    min-height: 40px;
}

.section-header {
    background-color: #f4f4f4;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    padding-top: 0.8rem;
}
/* ======================================================
   MODALS — ALWAYS ABOVE TOPBAR
   ====================================================== */

/* Bootstrap modal stack */
.modal {
    z-index: 30000 !important;
}

.modal-backdrop {
    z-index: 29900 !important;
}

/* Safety: modal internals inherit correctly */
.modal-dialog,
.modal-content {
    z-index: 30001 !important;
}

/* ======================================================
   TOPBAR — IMPERSONATION BUTTON
   ====================================================== */

.impersonate-top-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit; /* EXACT same font as topbar text */
    font-size: 0.86rem;
    font-weight: 500;
    color: #d40000; /* strong red */
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    line-height: 1; /* prevents vertical jump */
}


    .impersonate-top-btn:hover {
        color: #b00000; /* darker red on hover */
        text-decoration: underline;
    }

    .impersonate-top-btn:focus {
        outline: none;
        box-shadow: none;
    }
/* ======================================================
   SIDEBAR — IMPERSONATE BUTTON (NAV ITEM)
   ====================================================== */

#sidenav .impersonate-btn {
    display: flex;
    flex-direction: row; /* icon left, text right */
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    background-color: #d63c42; /* strong red */
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.25;
    cursor: pointer;
    text-align: center;
}

    /* icon inside impersonate button */
    #sidenav .impersonate-btn i {
        font-size: 1.1rem;
        line-height: 1;
        color: inherit;
    }

    /* Keep impersonate icon white even on hover */
    #sidenav .impersonate-btn:hover i {
        color: #fff;
    }


    /* hover */
    #sidenav .impersonate-btn:hover {
        background-color: #c5343a;
        color: #ffffff;
    }

    /* focus / keyboard */
    #sidenav .impersonate-btn:focus {
        outline: none;
        box-shadow: 0 0 0 0.2rem rgba(214,60,66,0.35);
    }

/* ======================================================
   DROPDOWN ACTIONS — TOUCH FRIENDLY
   ====================================================== */

/* Dropdown toggle button (the button you click to open it) */
.dropdown-toggle {
    padding: 0.35rem 0.9rem; /* taller hit area */
    line-height: 1.05;
}

/* Dropdown menu items (the actions inside the menu) */
.dropdown-item {
    padding: 0.7rem 1rem; /* ↑ vertical space */
    line-height: 1.3;
    min-height: 25px; /* touch target */
    display: flex;
    align-items: center;
}

/*top bottom padding*/
.dropdown-menu {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}


/* Icons inside dropdown items */
.dropdown-item i {
    margin-right: 0.5rem;
    font-size: 0.84rem;
}

/* ======================================================
   PAGINATION / NAV BUTTONS — TOUCH FRIENDLY
   ====================================================== */

.btn-group .btn.btn-sm {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    min-height: 33px; /* touch comfort */
    line-height: 1.2;
}

/* ======================================================
   BADGES
   ====================================================== */

.badge.bg-purple {
    background-color: #7B59C9; /* same purple as btn-purple */
    color: #ffffff;
}

.badge.bg-orange {
    background-color: #fd7e14; /* orange*/
    color: #ffffff;
}

/* ==== STATUS COLOR */
.text-red {
    color: red; /* Bootstrap red, without semantics */
}

.text-orange {
    color: #fd7e14;
    font-weight: 600;
}

.text-green {
    color: #198754;
    font-weight: 600;
}

.aff-grid-table > tbody > tr > td.text-red {
    color: red;
}

.aff-grid-table > tbody > tr > td.text-orange {
    color: #fd7e14;
}

.aff-grid-table > tbody > tr > td.text-green {
    color: #198754;
}


.text-end-important {
    justify-content: flex-end; /* ← THIS is the real fix */
    text-align: right; /* fallback for non-flex */
}


/* ======================================================
   BOOTSTRAP-COMPATIBLE CUSTOM BUTTON (LAVENDER)
   ====================================================== */

.btn.btn-lavender {
    /* base */
    --bs-btn-color: #ffffff;
    --bs-btn-bg: #7A66B3;
    --bs-btn-border-color: #A493C6;
    /* hover */
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: #6F5CA8;
    --bs-btn-hover-border-color: #9886BC;
    /* active (this is the missing piece) */
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: #6F5CA8;
    --bs-btn-active-border-color: #9886BC;
    /* focus ring */
    --bs-btn-focus-shadow-rgb: 184, 167, 217;
}

.btn.btn-cerulean-light {
    /* base */
    --bs-btn-color: #ffffff;
    --bs-btn-bg: #3A8FB7;
    --bs-btn-border-color: #2F7A9C;
    /* hover */
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: #347FA3;
    --bs-btn-hover-border-color: #296B88;
    /* active */
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: #2E708F;
    --bs-btn-active-border-color: #255E78;
    /* focus ring */
    --bs-btn-focus-shadow-rgb: 58, 143, 183;
}

.btn.btn-cerulean-dark {
    /* base */
    --bs-btn-color: #ffffff;
    --bs-btn-bg: #1F5F73;
    --bs-btn-border-color: #184E5E;
    /* hover */
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: #1B5567;
    --bs-btn-hover-border-color: #144652;
    /* active */
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: #174A5A;
    --bs-btn-active-border-color: #113C48;
    /* focus ring */
    --bs-btn-focus-shadow-rgb: 31, 95, 115;
}


#sidenav .sidebar-footer .footer-content {
    width: 100%;
    text-align: center;
    font-size: 0.67rem;
    font-weight: 550;
}

    #sidenav .sidebar-footer .footer-content .powered-by {
        display: block;
        margin-top: 6px;
    }

    #sidenav .sidebar-footer .footer-content a.dev {
        color: purple;
        font-weight: 600;
        text-decoration: none;
    }

        #sidenav .sidebar-footer .footer-content a.dev:hover {
            text-decoration: underline;
        }


/* Your existing global rule - keep it */
.btn:disabled, .btn.disabled {
    opacity: .65;
    cursor: not-allowed;
    box-shadow: none;
}

/* SPECIFIC override for purple buttons */
.btn.btn-purple:disabled,
.btn.btn-purple.disabled {
    background-color: #7B59C9 !important;
    border-color: #6442B0 !important;
    color: #ffffff !important;
}



.badge.bg-cerulean {
    background-color: #2f8fa3;
    color: #ffffff;
}

    .badge.bg-cerulean:hover {
        background-color: #297f91;
    }

/* ===============================
   CHART + LEGEND (FINAL)
   =============================== */

/* Allow legends to escape cards safely */
.card,
.card-body,
.chart-block {
    overflow: visible !important;
}

/* Stack chart → legend → buttons */
.chart-block {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Chart container — controls chart size ONLY */
.chart-wrapper {
    position: relative;
    width: 100%;
    max-width: 220px; /* ← THIS is the missing piece */
    aspect-ratio: 1 / 1;
    margin: 0 auto 12px; /* center chart horizontally */
}


    /* Canvas fills wrapper */
    .chart-wrapper canvas {
        width: 100% !important;
        height: 100% !important;
    }

/* Legend list */
.chart-legend {
    list-style: none;
    padding: 0;
    margin: 0;
}

    /* Legend row */
    .chart-legend li {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        font-size: 0.84rem;
        margin-bottom: 6px;
        line-height: 1.2;
    }

/* Color swatch */
.legend-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Scrollable, CENTERED legend */
.chart-legend-scroll {
    max-height: 220px;
    overflow-y: auto;
    margin: 0 auto 14px auto; /* centers legend block */
    width: fit-content; /* shrink to content width */
}

/* Buttons */
.chart-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Mobile tuning */
@media (max-width: 576px) {
    .chart-wrapper {
        max-height: 240px;
        max-width: 160px;
    }

    .chart-legend-scroll {
        max-height: 160px;
    }
}


/* Normalize checkbox appearance in affiliate grid */
.aff-grid-table .form-check-input {
    opacity: 1 !important;
    filter: none !important;
    background-color: #fff;
    border-color: #6c757d;
}

    /* Checked state — Bootstrap default */
    .aff-grid-table .form-check-input:checked {
        background-color: var(--bs-primary);
        border-color: var(--bs-primary);
    }

    /* Focus ring (keyboard + accessibility) */
    .aff-grid-table .form-check-input:focus {
        box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.25);
    }


.btn.btn-cerulean-light:disabled,
.btn.btn-cerulean-light.disabled {
    background-color: #3A8FB7 !important;
    border-color: #2F7A9C !important;
    color: #ffffff !important;
    opacity: .65;
}

.btn.btn-cerulean-dark:disabled,
.btn.btn-cerulean-dark.disabled {
    background-color: #1F5F73 !important;
    border-color: #184E5E !important;
    color: #ffffff !important;
    opacity: .65;
}
/* ======================================================
   BLOCKING OVERLAY (LOGIN CREATION / LONG TASKS)
   ====================================================== */

.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(1px);
    z-index: 40000; /* ABOVE .modal (30000) */
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all; /* BLOCK clicks */
}

.login-overlay-box {
    text-align: center;
    font-weight: 600;
    background: #ffffff;
    padding: 28px 36px;
    border-radius: 12px;
    box-shadow: none;
    width: min(360px, calc(100vw - 24px));
    min-width: 0;
    max-width: calc(100vw - 24px);
    user-select: none;
}



/* Versteek die Blazor navbar toggler checkbox */
.navbar-toggler {
    display: none !important;
}
/* Space under page so content does not touch bottom */
.content {
    padding-bottom: 15px;
}

.badge.bg-wine {
    background-color: #7a2e3a;
    color: #ffffff;
}

    .badge.bg-wine:hover {
        background-color: #6b2732;
    }

.btn.btn-wine {
    /* base */
    --bs-btn-color: #ffffff;
    --bs-btn-bg: #7a2e3a;
    --bs-btn-border-color: #662630;
    /* hover */
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: #6b2732;
    --bs-btn-hover-border-color: #552028;
    /* active */
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: #5c212b;
    --bs-btn-active-border-color: #4a1a22;
    /* disabled */
    --bs-btn-disabled-color: #ffffff;
    --bs-btn-disabled-bg: #7a2e3a;
    --bs-btn-disabled-border-color: #662630;
    /* focus ring */
    --bs-btn-focus-shadow-rgb: 122, 46, 58;
}
/* Lighter wine / soft plum */
.badge.bg-wine-light {
    background-color: #a55663; /* lighter wine */
    color: #ffffff;
}

    .badge.bg-wine-light:hover {
        background-color: #944c58;
    }


.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.modal-card {
    background: white;
    border-radius: 10px;
    padding: 18px;
    width: min(380px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    box-shadow: none;
}


/* =========================
   MODERN SOFT GRID (ADD THIS)
   ========================= */

.aff-grid-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
    font-size: 0.84rem;
}

    /* HEADER */
    .aff-grid-table thead th {
        position: sticky;
        top: 0;
        z-index: 10;
        background: #f9fafb;
        color: #6b7280;
        font-size: 1rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        padding: 12px 16px;
        border-bottom: 1px solid rgba(0,0,0,0.06);
    }

.paging-bar {
    letter-spacing: 0.04em;
    color: #6b7280;
    font-size: 0.8rem; /* match your table header */
}

    .paging-bar .btn {
        border-color: rgba(0,0,0,0.06);
        background-color: #fff;
        color: #6b7280;
        font-size: 0.8rem; /* match your table header */
        letter-spacing: 0.04em;
    }

    .paging-bar select {
        font-size: 0.8rem;
    }

    .paging-bar .btn:hover {
        background-color: #f7f9fb;
        border-color: rgba(0,0,0,0.06);
        color: #374151;
    }

    .paging-bar .btn:disabled {
        background-color: #fafafa;
        color: #9ca3af;
        border-color: rgba(0,0,0,0.04);
    }




/* CELLS */
.aff-grid-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    white-space: nowrap;
}

/* ROW HOVER */
.aff-grid-table tbody tr:hover {
    background-color: #f7f9fb;
}

/* FIRST COLUMN STICKY */
/*.aff-grid-table th:first-child,
    .aff-grid-table td:first-child {
        position: sticky;
        left: 0;
        background: #ffffff;
        z-index: 11;
    }*/


.member-row-selected td {
    background-color: #fdf7f8 !important;
}


.member-row-selected {
    box-shadow: inset 3px 0 0 #7a2e3a;
}

.aff-grid-table tbody tr.member-row-selected:hover td {
    background-color: #fdf7f8 !important;
}


/* LEFT BURGUNDY ACCENT */
.member-row-selected td:first-child {
    box-shadow: inset 3px 0 0 #7a2e3a;
}

/* KEEP IT ON HOVER */


/* WRAPPER LOOK */


/* WRAPPER LOOK */


/* Chrome / Edge */
.drag-scroll-wrapper::-webkit-scrollbar {
    height: 10px; /* ← bigger = easier to grab */
}

.drag-scroll-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.drag-scroll-wrapper::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.10);
    border-radius: 10px;
}

/* Hover = clearer */
.drag-scroll-wrapper:hover::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.20);
}

.alert-wine {
    background-color: #fdf7f8;
    border: 1px solid rgba(122, 46, 58, 0.25);
    color: #7a2e3a;
}

    .alert-wine h1,
    .alert-wine h2,
    .alert-wine h3,
    .alert-wine h4,
    .alert-wine h5,
    .alert-wine h6,
    .alert-wine p {
        color: inherit;
        margin-bottom: 0;
    }


.required-star {
    color: #dc3545;
}

.required-field {
    border: 1px solid #dc3545;
    background-color: #fff5f5;
}



/* ======================================================
   CONTROLLED TYPOGRAPHY AND FLAT PAGE SURFACES
   ====================================================== */

h1, .h1 {
    font-size: 1.8rem;
    line-height: 1.2;
}

h2, .h2 {
    font-size: 1.55rem;
    line-height: 1.25;
}

h3, .h3 {
    font-size: 1.3rem;
    line-height: 1.3;
}

h4, .h4 {
    font-size: 1.12rem;
    line-height: 1.35;
}

h5, .h5 {
    font-size: 1rem;
    line-height: 1.4;
}

h6, .h6 {
    font-size: 0.92rem;
    line-height: 1.4;
}

small,
.small {
    font-size: 0.8rem;
}

label,
.form-label,
.col-form-label {
    font-size: 0.88rem;
    font-weight: 600;
}

.form-control,
.form-select,
.input-group-text,
.btn,
.dropdown-item {
    font-size: 0.88rem;
}

.table {
    font-size: 0.86rem;
}

/* No general page/card shadow unless a Bootstrap shadow class is requested. */
#main,
#main-topbar,
#main .content,
#main .card:not(.shadow):not(.shadow-sm):not(.shadow-lg) {
    box-shadow: none !important;
}

/* ======================================================
   PHONE SIDEBAR AND MOBILE TYPOGRAPHY
   ====================================================== */

@media (max-width: 767.98px) {
    body {
        font-size: 1rem;
        line-height: 1.5;
    }

    h1, .h1 {
        font-size: 1.65rem;
    }

    h2, .h2 {
        font-size: 1.45rem;
    }

    h3, .h3 {
        font-size: 1.28rem;
    }

    h4, .h4 {
        font-size: 1.12rem;
    }

    h5, .h5 {
        font-size: 1rem;
    }

    h6, .h6 {
        font-size: 0.95rem;
    }

    small,
    .small {
        font-size: 0.9rem;
    }

    label,
    .form-label,
    .col-form-label {
        font-size: 0.95rem;
    }

    .form-control,
    .form-select,
    .input-group-text,
    .btn,
    .dropdown-item {
        font-size: 1rem;
    }

    .form-control,
    .form-select {
        min-height: 42px;
    }

    .table,
    .aff-grid-table {
        font-size: 0.92rem;
    }

        .aff-grid-table thead th {
            font-size: 0.82rem;
        }

    .paging-bar,
    .paging-bar .btn,
    .paging-bar select {
        font-size: 0.92rem;
    }

    .topbar-controls .pin-btn {
        display: none !important;
    }

    #layout.sidebar-pinned #main {
        width: 100%;
        margin-left: 0;
    }

    #layout.sidebar-pinned .topbar-controls,
    #layout.small-screen .topbar-controls {
        position: relative;
        top: auto;
        left: auto;
        z-index: 2100;
        max-width: none;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    #main-topbar {
        min-height: 4.25rem;
        padding-right: 10px;
        padding-left: 10px;
    }

        #main-topbar .topbar-link,
        .impersonate-top-btn {
            font-size: 0.95rem;
        }

    .topbar-controls button {
        width: 42px;
        height: 42px;
    }

    #main .content {
        padding-right: 12px !important;
        padding-left: 12px !important;
    }

    #sidenav .heading {
        font-size: 1.05rem !important;
    }

    #sidenav .nav-link {
        min-height: 48px;
        padding: 8px 5px;
        font-size: 0.92rem;
        line-height: 1.2;
    }

        #sidenav .nav-link i {
            font-size: 1.1rem;
        }

    #sidenav .sidebar-footer,
    #sidenav .sidebar-footer a,
    #sidenav .sidebar-footer .footer-content {
        font-size: 0.78rem;
    }

    #sidenav .impersonate-btn {
        min-height: 44px;
        font-size: 0.92rem;
    }

    .dropdown-item {
        min-height: 44px;
    }

    .btn-group .btn.btn-sm {
        min-height: 40px;
    }

    .chart-legend li {
        font-size: 0.94rem;
    }
}

@media (max-width: 360px) {
    body {
        font-size: 0.97rem;
    }

    #main .content {
        padding-right: 8px !important;
        padding-left: 8px !important;
    }

    #main-topbar {
        padding-right: 6px;
        padding-left: 6px;
    }

    h1, .h1 {
        font-size: 1.5rem;
    }

    h2, .h2 {
        font-size: 1.32rem;
    }

    h3, .h3 {
        font-size: 1.2rem;
    }

    .form-control,
    .form-select,
    .input-group-text,
    .btn {
        font-size: 0.96rem;
    }
}

@media (max-width: 767.98px) {
    #sidenav {
        height: 100svh;
        height: 100dvh;
        max-height: 100dvh;
    }

        #sidenav .nav-scrollable {
            padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
        }
}

/* ======================================================
   KITSKERK TABLE ACTION MENU
   Menu is temporarily moved to <body> while open,
   so the horizontally scrolling table cannot clip it.
   ====================================================== */

.kitskerk-actions {
    position: relative;
}

.kitskerk-actions-menu {
    display: none;
    width: 250px;
    max-width: calc(100vw - 20px);
    margin: 0;
    padding: 0.25rem 0;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0,0,0,.16);
    z-index: 50000;
}

    .kitskerk-actions-menu.kitskerk-actions-open {
        display: block;
        position: fixed;
    }

.kitskerk-action-item {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 42px;
    padding: 0.7rem 1rem;
    border: 0;
    background: transparent;
    color: #2f3437;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

    .kitskerk-action-item:hover,
    .kitskerk-action-item:focus {
        background: #f8f9fa;
        color: #212529;
        outline: none;
    }

    .kitskerk-action-item i {
        flex: 0 0 20px;
        width: 20px;
        margin-right: 0.5rem;
        text-align: center;
    }

.kitskerk-action-divider {
    margin: 0.25rem 0;
    border-top: 1px solid #dee2e6;
}