:root {
    --sidebar-width: 260px;
    --sidebar-min-width: 180px;
    --sidebar-max-width: 500px;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

#wrapper {
    display: flex;
    width: 100vw;
    max-width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

#sidebar-wrapper {
    min-height: 100vh;
    width: var(--sidebar-width, 260px);
    min-width: var(--sidebar-width, 260px);
    max-width: var(--sidebar-width, 260px);
    flex: 0 0 var(--sidebar-width, 260px);
    transition: margin-left 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    z-index: 1030;
    position: relative;
    box-sizing: border-box;
    overflow-x: hidden !important;
}

/* Sidebar Nav Items & Responsive Badge Placement */
.sidebar-nav-item {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem !important;
    border: none !important;
    color: #475569;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
    box-sizing: border-box;
    width: 100%;
}

.sidebar-nav-item:hover {
    background-color: #f8fafc;
    color: #1e293b;
}

.sidebar-nav-item.active {
    background-color: #eef2ff !important;
    color: #4f46e5 !important;
    font-weight: 600;
    border-left: 3px solid #4f46e5 !important;
}

.sidebar-icon {
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
}

.sidebar-label-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.2rem 0.4rem;
    flex: 1 1 0%;
    min-width: 0;
}

.sidebar-title {
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
}

.sidebar-badge {
    font-size: 0.66rem !important;
    padding: 0.15rem 0.4rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
    text-align: center;
}

/* Vertical Resizer Handle */
.sidebar-resizer {
    position: absolute;
    top: 0;
    right: -6px;
    bottom: 0;
    width: 12px;
    cursor: col-resize;
    z-index: 1040;
    background-color: transparent;
    transition: background-color 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-resizer-line {
    width: 2px;
    height: 100%;
    background-color: transparent;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    pointer-events: none;
}

.sidebar-resizer:hover .sidebar-resizer-line,
.sidebar-resizer.is-dragging .sidebar-resizer-line {
    background-color: #7c3aed;
    box-shadow: 0 0 6px rgba(124, 58, 237, 0.6);
}

.sidebar-resizer::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 36px;
    border-radius: 4px;
    background-color: #cbd5e1;
    opacity: 0;
    transition: opacity 0.15s ease, background-color 0.15s ease;
    pointer-events: none;
}

.sidebar-resizer:hover::after,
.sidebar-resizer.is-dragging::after {
    opacity: 1;
    background-color: #7c3aed;
}

.sidebar-resizer:hover,
.sidebar-resizer.is-dragging {
    background-color: rgba(124, 58, 237, 0.08);
}

#page-content-wrapper {
    min-width: 0;
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    overflow-x: auto;
    width: auto !important;
    max-width: 100%;
    transition: margin-left 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

/* Sidebar Collapsed / Hidden State */
html.sidebar-collapsed body #sidebar-wrapper,
body.sidebar-collapsed #sidebar-wrapper {
    margin-left: calc(-1 * var(--sidebar-width, 260px)) !important;
}

html.sidebar-collapsed body #page-content-wrapper,
body.sidebar-collapsed #page-content-wrapper {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* While actively dragging to resize */
body.is-resizing-sidebar {
    cursor: col-resize !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}
body.is-resizing-sidebar #sidebar-wrapper,
body.is-resizing-sidebar #page-content-wrapper {
    transition: none !important;
}
body.is-resizing-sidebar * {
    user-select: none !important;
    -webkit-user-select: none !important;
    cursor: col-resize !important;
}

@media (max-width: 768px) {
    #sidebar-wrapper {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        margin-left: calc(-1 * var(--sidebar-width, 260px));
        box-shadow: 0 0 25px rgba(0,0,0,0.25);
    }
    body.sidebar-mobile-open #sidebar-wrapper {
        margin-left: 0 !important;
    }
    #page-content-wrapper {
        width: 100vw !important;
    }
    .sidebar-resizer {
        display: none;
    }
}

.avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%) !important;
}

.bg-elevate-dark, .bg-tpp-dark {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
}

.text-purple, .text-indigo { color: #4f46e5 !important; }
.bg-purple, .bg-indigo { background-color: #4f46e5 !important; }
.bg-purple-subtle, .bg-indigo-subtle { background-color: #e0e7ff !important; color: #3730a3 !important; }
.border-purple, .border-indigo { border-color: #4f46e5 !important; }

/* TPP Specific Badges & Levels */
.badge-tier-1 { background-color: #e2e8f0; color: #334155; border: 1px solid #cbd5e1; }
.badge-tier-2 { background-color: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-tier-3 { background-color: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.badge-tier-4 { background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%); color: #065f46; border: 1px solid #a7f3d0; box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2); }

.tpp-score-gauge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.fs-7 { font-size: 0.875rem !important; }
.fs-8 { font-size: 0.8rem !important; }
.fs-9 { font-size: 0.725rem !important; }

/* Kanban Board Styling */
.kanban-board {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    padding-bottom: 1.5rem;
    min-height: calc(100vh - 240px);
    -webkit-overflow-scrolling: touch;
}

.kanban-board::-webkit-scrollbar {
    height: 8px;
}

.kanban-board::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 4px;
}

.kanban-board::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

.kanban-board::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.kanban-column {
    width: 290px;
    min-width: 290px;
    flex-shrink: 0;
    background-color: #f1f5f9;
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
}

.kanban-cards {
    flex: 1;
    min-height: 150px;
}

.kanban-card {
    background-color: #ffffff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08) !important;
}

.cursor-grab {
    cursor: grab;
}

.cursor-grab:active {
    cursor: grabbing;
}

.poe-checkbox:checked + div .task-title {
    text-decoration: line-through;
    color: #64748b;
}

.cursor-help {
    cursor: help !important;
}

.table th.cursor-help:hover {
    background-color: rgba(37, 99, 235, 0.08) !important;
    transition: background-color 0.15s ease;
}

/* Playbook Pillar Navigation in Business Admin */
#playbookPillarTabs .list-group-item {
    cursor: pointer;
    text-align: left;
    background-color: #ffffff;
    color: #475569;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

#playbookPillarTabs .list-group-item:hover:not(.active) {
    background-color: #f8fafc;
    color: #1e293b;
}

#playbookPillarTabs .list-group-item.active {
    background-color: #7c3aed !important;
    border-color: #7c3aed !important;
    color: #ffffff !important;
    font-weight: 600;
}

#playbookPillarTabs .list-group-item.active .section-badge {
    background-color: #ffffff !important;
    color: #7c3aed !important;
}

#playbookPillarTabs .list-group-item:not(.active) .section-badge {
    background-color: #ede9fe !important;
    color: #6d28d9 !important;
}

/* ============================================================ */
/* FIXED BOTTOM APPLICATION FOOTER & NOTICE BANNER STACK       */
/* ============================================================ */
.app-fixed-bottom-bar {
    position: fixed;
    bottom: 0;
    right: 0;
    left: var(--sidebar-width, 260px);
    z-index: 1025;
    display: flex;
    flex-direction: column;
    transition: left 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
}

html.sidebar-collapsed body .app-fixed-bottom-bar,
body.sidebar-collapsed .app-fixed-bottom-bar {
    left: 0 !important;
}

body.is-resizing-sidebar .app-fixed-bottom-bar {
    transition: none !important;
}

@media (max-width: 768px) {
    .app-fixed-bottom-bar {
        left: 0 !important;
    }
}

.app-fixed-bottom-bar .app-footer {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    box-shadow: none !important;
    margin: 0 !important;
    z-index: 1020;
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding-top: 0.55rem !important;
    padding-bottom: 0.55rem !important;
}

/* Hide evaluation banner when any popup/modal/offcanvas is open */
body.modal-open .vsr-evaluation-ticker-wrapper,
body.offcanvas-open .vsr-evaluation-ticker-wrapper,
.modal .vsr-evaluation-ticker-wrapper,
.modal-dialog .vsr-evaluation-ticker-wrapper,
.swal2-container .vsr-evaluation-ticker-wrapper {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Standalone app-footer fallback */
.app-footer {
    position: fixed;
    bottom: 0;
    right: 0;
    left: var(--sidebar-width, 260px);
    z-index: 1020;
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.04);
    padding-top: 0.65rem !important;
    padding-bottom: 0.65rem !important;
    transition: left 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

html.sidebar-collapsed body .app-footer,
body.sidebar-collapsed .app-footer {
    left: 0 !important;
}

body.is-resizing-sidebar .app-footer {
    transition: none !important;
}

@media (max-width: 768px) {
    .app-footer {
        left: 0 !important;
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
}

/* Ensure page content has bottom padding so content doesn't get hidden behind fixed footer */
#page-content-wrapper > .container-fluid {
    padding-bottom: 6.5rem !important;
    min-height: calc(100vh - 110px);
}

/* Auth Pages Fixed Bottom Footer */
.auth-fixed-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1030;
    background: rgba(10, 4, 22, 0.92);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(168, 85, 247, 0.2);
    padding: 0.55rem 1rem;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.45);
}

body.auth-page {
    padding-bottom: 5.5rem !important;
}

/* ============================================================ */
/* UNIFIED ROLE BADGES FOR HIGH CONTRAST & READABILITY         */
/* ============================================================ */
.role-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.24rem 0.65rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    border-radius: 6px;
    line-height: 1.2;
    text-transform: uppercase;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.role-tag-closer {
    background-color: #059669 !important;
    color: #ffffff !important;
}

.role-tag-setter {
    background-color: #7c3aed !important;
    color: #ffffff !important;
}

.role-tag-sdr {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

.role-tag-servc {
    background-color: #d97706 !important;
    color: #ffffff !important;
}

.role-tag-asisv {
    background-color: #475569 !important;
    color: #ffffff !important;
}

/* ============================================================ */
/* PURPLE BUTTON UTILITIES (BRAND COHESION)                    */
/* ============================================================ */
.btn-purple {
    background-color: #7c3aed !important;
    border-color: #7c3aed !important;
    color: #ffffff !important;
}
.btn-purple:hover, .btn-purple:focus, .btn-purple:active {
    background-color: #6d28d9 !important;
    border-color: #6d28d9 !important;
    color: #ffffff !important;
}

.btn-outline-purple {
    color: #7c3aed !important;
    border: 1px solid #7c3aed !important;
    background-color: transparent !important;
}
.btn-outline-purple:hover, .btn-outline-purple:focus, .btn-outline-purple:active {
    background-color: #7c3aed !important;
    border-color: #7c3aed !important;
    color: #ffffff !important;
}