/* Shared platform colours. Section-specific accents may still override these tokens. */
body:is(.portal-shell, .portal-login) {
    --portal-bg: #f0f4f8;
    --portal-surface: #fff;
    --portal-raised: #f6f8fc;
    --portal-input: #fff;
    --portal-text: #172338;
    --portal-muted: #4f5d70;
    --portal-border: #d8e0ec;
    --portal-accent: #4d3cc4;
    --portal-action: #5140c5;
    --portal-accent-soft: #eeebfd;
    --portal-success: #086748;
    --portal-danger: #a92743;
    --portal-warning: #805014;
    --portal-info: #0b6478;
    --portal-focus: #5947d5;
    --portal-scroll: #78859c;
    --portal-glow-shadow: 0 12px 28px rgb(42 52 90 / 14%);
    --bg-body: var(--portal-bg);
    --card-bg: var(--portal-surface);
    --bg-card: var(--portal-surface);
    --text-main: var(--portal-text);
    --text-muted: var(--portal-muted);
    --border-color: var(--portal-border);
    --primary: var(--portal-accent);
    --primary-soft: var(--portal-accent-soft);
    --shadow-hover: var(--portal-glow-shadow);
}
body:is(.portal-shell, .portal-login).dark-mode {
    color-scheme: dark;
    --portal-bg: #101725;
    --portal-surface: #1a2436;
    --portal-raised: #232f45;
    --portal-input: #141e30;
    --portal-text: #eef3fb;
    --portal-muted: #b3c0d6;
    --portal-border: #3a4963;
    --portal-accent: #b9adff;
    --portal-action: #5d4ac8;
    --portal-accent-soft: #2c2a52;
    --portal-success: #78dfb5;
    --portal-danger: #ff9eae;
    --portal-warning: #ffcc83;
    --portal-info: #90dcef;
    --portal-focus: #b9adff;
    --portal-scroll: #96a5bc;
    --portal-glow-shadow: 0 12px 25px rgb(0 0 0 / 30%);
    --bs-body-bg: var(--portal-bg);
    --bs-body-color: var(--portal-text);
    --bs-emphasis-color: var(--portal-text);
    --bs-secondary-color: var(--portal-muted);
    --bs-tertiary-bg: var(--portal-raised);
    --bs-secondary-bg: var(--portal-raised);
    --bs-border-color: var(--portal-border);
    --bs-link-color-rgb: 185, 173, 255;
    --bs-link-hover-color-rgb: 215, 206, 255;
    --accent-primary: var(--portal-accent);
}

.portal-shell { color: var(--portal-text); transition: background-color .18s, color .18s; }
.portal-root, .portal-module, .portal-module .report-area { min-inline-size: 0; }
.portal-header {
    position: relative;
    z-index: 1030;
}
.portal-brand-link { display: inline-block; border-radius: 22px; }
.portal-brand-link .logo-box {
    width: 114px;
    height: 100px;
    border-radius: 22px;
    --portal-logo-lift: -15px;
    animation: portal-brand-float 6s ease-in-out infinite;
    background: #f8faff;
    border: 1px solid #dce4f1;
    box-shadow: 0 5px 18px rgb(14 25 46 / 12%);
}
@keyframes portal-brand-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(var(--portal-logo-lift)); }
}
.portal-brand-link img { display: block; max-width: 100%; height: auto; }
.portal-control-col, .portal-greeting, .portal-profile-controls { min-inline-size: 0; }
.portal-profile-label { max-inline-size: 12rem; overflow-wrap: anywhere; }
.portal-shell .top-control-panel { max-width: 100%; flex-shrink: 1; gap: 10px; }
.portal-shell .control-icon-btn { inline-size: 44px; block-size: 44px; }
.portal-shell .user-avatar-box { box-sizing: border-box; }
.portal-shell .greeting-title { overflow-wrap: anywhere; }
.portal-shell .greeting-subtitle { color: var(--portal-muted); opacity: 1; }
.portal-shell .glass-card { border-color: var(--portal-border); }
.portal-notifications-menu {
    --bs-dropdown-min-width: 0;
    top: calc(100% + 8px);
    width: min(360px, calc(100vw - 28px));
    border-radius: 18px;
    background: var(--portal-surface);
    overflow: hidden;
}
.portal-notifications-menu #notif-list-container { max-height: min(350px, 42dvh) !important; }
.portal-notifications-menu .notif-item { overflow-wrap: anywhere; }
.portal-shell .nav-row[hidden], .portal-menu-toggle[hidden] { display: none !important; }
.portal-menu-toggle { display: none; }
.portal-shell .nav-btn { color: var(--portal-accent); border-color: var(--portal-border); }
.portal-shell .nav-btn.active,
.portal-shell .nav-btn:hover { color: #fff !important; background: var(--portal-action); }
.portal-shell .nav-btn::before { display: none; }
.portal-shell .nav-btn.active { transform: none; }
.portal-shell .nav-btn span { overflow-wrap: anywhere; }
.portal-shell :is(a, button, input, select, textarea, [tabindex]):focus-visible,
.portal-login :is(a, button, input):focus-visible {
    outline: 2px solid var(--portal-focus);
    outline-offset: 2px;
}
.portal-shell .table-responsive,
.portal-shell .analytics-grid,
.portal-shell .v-board {
    max-inline-size: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--portal-scroll) transparent;
}
.portal-shell .table-responsive,
.portal-shell .analytics-grid { overflow-x: auto; }
.portal-shell .analytics-week-nav { display: none; }
.portal-shell .portal-admin-widgets > summary { display: none; }
.portal-shell .study-achievements { background: linear-gradient(135deg, var(--portal-surface), var(--portal-raised)); }
.portal-shell .portal-module .choices__inner,
.portal-shell .portal-module .choices__list--dropdown { max-inline-size: 100%; }

/* Theme-aware surfaces; actual status and badge backgrounds carry their own colours. */
.portal-shell.dark-mode :is(.glass-card, .card, .dropdown-menu, .modal-content, .offcanvas) {
    --bs-dropdown-bg: var(--portal-surface);
    --bs-dropdown-border-color: var(--portal-border);
    --bs-dropdown-link-color: var(--portal-text);
    --bs-dropdown-link-hover-color: var(--portal-text);
    --bs-dropdown-link-hover-bg: var(--portal-raised);
    --bs-modal-bg: var(--portal-surface);
    --bs-modal-color: var(--portal-text);
    --bs-modal-border-color: var(--portal-border);
    --bs-card-bg: var(--portal-surface);
    --bs-card-color: var(--portal-text);
    --bs-card-border-color: var(--portal-border);
    color: var(--portal-text);
}
.portal-shell.dark-mode .dropdown-menu,
.portal-shell.dark-mode .modal-content { background-color: var(--portal-surface); }
.portal-shell.dark-mode .dropdown-item { color: var(--portal-text); }
.portal-shell.dark-mode .dropdown-item:is(:hover, :focus) { background-color: var(--portal-raised); }
.portal-shell.dark-mode :is(.text-dark, .text-body) { color: var(--portal-text) !important; }
.portal-shell.dark-mode :is(.text-secondary, .text-muted, .text-body-secondary) { color: var(--portal-muted) !important; }
.portal-shell.dark-mode .text-primary { color: var(--portal-accent) !important; }
.portal-shell.dark-mode :is(.text-success, .diff-up, .val-positive) { color: var(--portal-success) !important; }
.portal-shell.dark-mode :is(.text-danger, .diff-down, .val-negative) { color: var(--portal-danger) !important; }
.portal-shell.dark-mode .text-warning { color: var(--portal-warning) !important; }
.portal-shell.dark-mode .text-info { color: var(--portal-info) !important; }
.portal-shell.dark-mode :is(.bg-white, .bg-light) {
    background-color: var(--portal-raised) !important;
    color: var(--portal-text) !important;
}
.portal-shell.dark-mode .bday-card {
    background: var(--portal-surface) !important;
    border-color: #6f5361 !important;
}
.portal-shell.dark-mode .bday-card .fw-800.small { color: var(--portal-text) !important; }
.portal-shell.dark-mode :is(.list-group, .list-group-item) {
    --bs-list-group-bg: var(--portal-surface);
    --bs-list-group-color: var(--portal-text);
    --bs-list-group-border-color: var(--portal-border);
    --bs-list-group-action-hover-color: var(--portal-text);
    --bs-list-group-action-hover-bg: var(--portal-raised);
}
.portal-shell.dark-mode :is(.table, .table-light) {
    --bs-table-color: var(--portal-text);
    --bs-table-bg: var(--portal-surface);
    --bs-table-border-color: var(--portal-border);
    --bs-table-striped-color: var(--portal-text);
    --bs-table-striped-bg: var(--portal-raised);
    --bs-table-hover-color: var(--portal-text);
    --bs-table-hover-bg: var(--portal-raised);
}
.portal-shell.dark-mode :is(.table-dark, .table-light) {
    --bs-table-color: var(--portal-text);
    --bs-table-bg: var(--portal-raised);
    --bs-table-border-color: var(--portal-border);
}
.portal-shell.dark-mode :is(.form-control, .form-select, .input-group-text) {
    --bs-secondary-bg: var(--portal-raised);
    --bs-body-color: var(--portal-text);
    background-color: var(--portal-input);
    border-color: var(--portal-border);
}
.portal-shell.dark-mode .form-control::placeholder,
.portal-login.dark-mode .form-control::placeholder { color: var(--portal-muted); opacity: 1; }
.portal-shell.dark-mode .form-select option { background: var(--portal-input); color: var(--portal-text); }
.portal-shell.dark-mode .form-control:is(:disabled, [readonly]),
.portal-shell.dark-mode .form-select:disabled { background-color: var(--portal-raised); }
.portal-shell.dark-mode .form-check-input:not(:checked) { border-color: var(--portal-scroll); }
.portal-shell.dark-mode .btn-light {
    --bs-btn-color: var(--portal-text);
    --bs-btn-bg: var(--portal-raised);
    --bs-btn-border-color: var(--portal-border);
    --bs-btn-hover-color: var(--portal-text);
    --bs-btn-hover-bg: #2c3b55;
    --bs-btn-hover-border-color: var(--portal-scroll);
}
.portal-shell.dark-mode .btn-outline-dark {
    --bs-btn-color: var(--portal-text);
    --bs-btn-border-color: var(--portal-scroll);
    --bs-btn-hover-bg: var(--portal-text);
    --bs-btn-hover-color: var(--portal-bg);
}
.portal-shell.dark-mode .btn-outline-primary {
    --bs-btn-color: var(--portal-accent);
    --bs-btn-border-color: #8373df;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--portal-action);
    --bs-btn-hover-border-color: var(--portal-accent);
}
.portal-shell.dark-mode .btn-outline-secondary {
    --bs-btn-color: var(--portal-muted);
    --bs-btn-border-color: var(--portal-scroll);
    --bs-btn-hover-bg: var(--portal-raised);
    --bs-btn-hover-color: var(--portal-text);
}
.portal-shell.dark-mode .btn-outline-info {
    --bs-btn-color: var(--portal-info);
    --bs-btn-border-color: var(--portal-info);
}
.portal-shell.dark-mode .btn-outline-success {
    --bs-btn-color: var(--portal-success);
    --bs-btn-border-color: var(--portal-success);
}
.portal-shell.dark-mode .btn-outline-danger {
    --bs-btn-color: var(--portal-danger);
    --bs-btn-border-color: var(--portal-danger);
}
.portal-shell.dark-mode .portal-module[data-portal-page="docs"] :is(.btn-white, .hover-bg-white:hover) {
    background-color: var(--portal-raised) !important;
    color: var(--portal-text);
    border-color: var(--portal-border);
}
.portal-shell :is(.csi-modal-content, .contact-modal-content) {
    max-width: calc(100% - 24px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
}
.portal-shell.dark-mode .portal-module :is(.csi-modal-content, .contact-modal-content) { background: var(--portal-surface); }
.portal-shell.dark-mode .portal-module :is(.stats-nav-link.active, .week-header, .nav-pills-custom .nav-link.active, .week-head, .item-owned, .contact-btn:hover) {
    background: var(--portal-action) !important;
    color: #fff !important;
}
.portal-shell.dark-mode .portal-module .fin-table :is(th, td:first-child) { background: var(--portal-raised); border-color: var(--portal-border) !important; }
.portal-shell.dark-mode .portal-module .fin-table :is(.row-red, .row-red td:first-child, .col-fact) { background: #392839 !important; }
.portal-shell.dark-mode .portal-module .fin-table :is(.row-yellow, .row-yellow td:first-child) { background: #3b3128; }
.portal-shell.dark-mode .portal-module .fin-table :is(.row-green, .row-green td:first-child, .col-plan) { background: #203b37 !important; }
.portal-shell.dark-mode .portal-module :is(.fin-input, .b-input) {
    color: var(--portal-text);
    background: var(--portal-input);
    border-color: var(--portal-border);
}
.portal-shell.dark-mode .portal-module .fin-input:focus { background: var(--portal-input); }
.portal-shell.dark-mode .portal-module .fin-table .contact-btn:not(:hover) { background: var(--portal-input); }
.portal-shell.dark-mode .choices__inner,
.portal-shell.dark-mode .choices__list :is(.choices__item, .choices__list) {
    color: var(--portal-text);
}
.portal-shell.dark-mode .choices .choices__inner {
    background: var(--portal-input) !important;
    border-color: var(--portal-border) !important;
}
.portal-shell.dark-mode .choices__list--multiple .choices__item {
    background-color: var(--portal-action);
    border-color: #8373df;
    color: #fff;
}
.portal-shell.dark-mode .choices__input::placeholder { color: var(--portal-muted); opacity: 1; }
.portal-shell.dark-mode .ql-snow .ql-stroke { stroke: var(--portal-muted); }
.portal-shell.dark-mode .ql-snow .ql-fill { fill: var(--portal-muted); }
.portal-shell.dark-mode .ql-snow .ql-picker { color: var(--portal-text); }
.portal-shell.dark-mode .ql-snow .ql-picker-options { background: var(--portal-raised); }
.portal-shell.dark-mode :is(.ql-toolbar.ql-snow, .ql-container.ql-snow) { border-color: var(--portal-border); }
.portal-shell.dark-mode .ql-editor.ql-blank::before { color: var(--portal-muted); }
.portal-shell.dark-mode .portal-module .nav-link-custom {
    background: var(--portal-raised);
    border-color: var(--portal-border);
    color: var(--portal-text);
}
.portal-shell.dark-mode .portal-module .total-stat-box {
    background: var(--portal-surface);
    border-color: var(--portal-border);
}
.portal-shell.dark-mode .portal-module .analytics-grid .stat-row { border-color: var(--portal-border); }
.portal-shell.dark-mode .portal-module .analytics-grid [aria-invalid="true"] { border-color: var(--portal-danger); }
.portal-shell.dark-mode .portal-module .kpi-name { color: var(--portal-muted); }
.portal-shell.dark-mode .portal-module :is(.btn-eg-blue, .btn-eg-purple) { color: var(--portal-accent); }
.portal-shell.dark-mode .portal-module .btn-eg-green { color: var(--portal-success); }
.portal-shell.dark-mode .portal-module .btn-eg-red { color: var(--portal-danger); }
.portal-shell.dark-mode .portal-module .badge-auto { color: var(--portal-warning); }
.portal-shell.dark-mode #captureArea { background: var(--portal-surface) !important; border-color: var(--portal-border) !important; }
.portal-shell.dark-mode #mainTable { border-color: var(--portal-border) !important; }
.portal-shell.dark-mode #mainTable :is(.sticky-col, .sticky-header-top) {
    background: var(--portal-raised) !important;
    border-color: var(--portal-border) !important;
    box-shadow: none !important;
}
.portal-shell.dark-mode #mainTable .schedule-weekend {
    background: #3a293b !important;
    color: var(--portal-danger) !important;
}
.portal-shell.dark-mode #mainTable .cell-hover[style*="background-color"] { box-shadow: none; }
.portal-shell.dark-mode #financeTable th { background-color: var(--portal-raised) !important; }
.portal-shell.dark-mode #financeTable input { border-color: var(--portal-border) !important; }
.portal-shell.dark-mode #financeTable td:has(.vacation_paid_cb:checked) .vacation {
    background: #214537 !important;
    color: var(--portal-success) !important;
}
.portal-shell.dark-mode .portal-module[data-portal-page="crm"] .modal-body .list-group-item {
    background: var(--portal-raised) !important;
    border-color: var(--portal-border) !important;
}
.portal-shell.dark-mode .portal-module[data-portal-page="crm"] .modal-body .list-group-item :is(input[type="text"], textarea) {
    color: var(--portal-text) !important;
}
.portal-shell.dark-mode .portal-module[data-portal-page="crm"] #ec_title {
    background: var(--portal-input) !important;
    color: var(--portal-text) !important;
    border-color: var(--portal-border) !important;
}
.portal-shell.dark-mode .portal-module[data-portal-page="crm"] .v-col { background-color: var(--portal-raised); }
.portal-shell.dark-mode .portal-module[data-portal-page="crm"] .v-task-card { background-color: var(--portal-surface) !important; }
.portal-shell.dark-mode .portal-module[data-portal-page="profile"] {
    --prof-bg-card: var(--portal-surface);
    --prof-bg-light: var(--portal-raised);
    --prof-primary: var(--portal-accent);
    --prof-border: var(--portal-border);
}
.portal-shell .portal-module[data-portal-page="profile"] .stat-card.blue { background: linear-gradient(135deg, #4925ce, #17538b); }
.portal-shell .portal-module[data-portal-page="profile"] .stat-card.green { background: linear-gradient(135deg, #11685e, #146148); }

/* Login follows the same saved theme and can scroll with a software keyboard open. */
body.portal-login {
    min-height: 100vh;
    min-height: 100svh;
    overflow-x: hidden;
    overflow-y: auto;
    color: var(--portal-text);
}
.portal-login .login-ambience { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.portal-login .login-card { position: relative; }
.portal-login .login-theme-btn {
    position: absolute;
    right: 14px;
    top: 14px;
    inline-size: 44px;
    block-size: 44px;
    display: grid;
    place-items: center;
    color: var(--portal-accent);
    background: var(--portal-raised);
    border: 1px solid var(--portal-border);
    border-radius: 50%;
}
.portal-login.dark-mode { background: radial-gradient(ellipse at top left, #24204a, var(--portal-bg) 65%); }
.portal-login.dark-mode .login-card { background: var(--portal-surface); border-color: var(--portal-border); }
.portal-login.dark-mode .portal-desc { color: var(--portal-muted); }
.portal-login .btn-login:not(:disabled) { background: linear-gradient(135deg, #4835b9, #593bb3); color: #fff; }
.portal-login.dark-mode .form-control {
    color: var(--portal-text);
    background: var(--portal-input);
    border-color: var(--portal-border);
}
.portal-login.dark-mode .input-icon-wrapper i { color: var(--portal-muted); }
.portal-login.dark-mode .alert-custom { color: var(--portal-danger); background: #382333; border-color: #785065; }

@media (max-width: 1199.98px) {
    .portal-shell .portal-header { margin-bottom: 1.5rem !important; }
    .portal-shell .top-control-panel { backdrop-filter: none; -webkit-backdrop-filter: none; }
    .portal-shell .top-control-panel .dropdown { position: static; }
    .portal-shell .portal-notifications-menu {
        inset: calc(100% + 5px) 12px auto auto !important;
        transform: none !important;
        margin: 0 !important;
    }
}
@media (max-width: 767.98px) {
    .portal-shell .portal-root {
        max-width: none;
        padding-top: max(12px, env(safe-area-inset-top)) !important;
        padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
    }
    .portal-shell .portal-header {
        display: grid;
        grid-template-columns: 60px minmax(0, 1fr);
        column-gap: 12px;
        row-gap: 10px;
        margin: 0 0 12px !important;
    }
    .portal-shell .portal-header > * { padding: 0; margin: 0 !important; width: auto; text-align: left !important; }
    .portal-shell .portal-brand-link .logo-box { --portal-logo-lift: -3px; width: 60px; height: 56px; padding: 5px; border-radius: 14px; }
    .portal-shell .greeting-title { font-size: clamp(1rem, 4.6vw, 1.4rem); }
    .portal-shell .greeting-subtitle { font-size: .77rem; margin: .25rem 0; }
    .portal-shell .portal-greeting > small { font-size: .73rem; margin: 0 !important; }
    .portal-shell .portal-control-col { grid-column: 1 / -1; }
    .portal-shell .top-control-panel {
        width: 100%;
        gap: 5px;
        padding: 5px;
        border-radius: 16px;
        background: var(--portal-surface);
        border: 1px solid var(--portal-border);
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .portal-shell .portal-notifications-menu {
        inset: calc(100% + 5px) 0 auto 0 !important;
        width: 100%;
    }
    .portal-shell .top-control-panel .divider-vertical,
    .portal-shell .portal-profile-label { display: none; }
    .portal-shell .portal-profile-controls,
    .portal-shell .portal-session-controls { gap: 5px !important; }
    .portal-shell .user-avatar-box { inline-size: 44px; block-size: 44px; }
    .portal-shell .user-avatar-box .portal-avatar { width: 100%; height: 100%; }
    .portal-shell .portal-menu-toggle {
        width: 100%;
        min-height: 44px;
        padding: 8px 13px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border: 1px solid var(--portal-border);
        border-radius: 13px;
        color: var(--portal-text);
        background: var(--portal-surface);
        font-weight: 800;
    }
    .portal-shell .portal-menu-toggle[aria-expanded="true"] .portal-menu-chevron { transform: rotate(180deg); }
    .portal-shell .portal-navigation { margin-bottom: 12px; }
    .portal-shell .nav-row {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 7px !important;
        justify-content: stretch;
        padding: 8px 0 4px;
        overflow: visible;
        margin: 0;
    }
    .portal-shell .nav-item-box { min-width: 0 !important; max-width: none; }
    .portal-shell .nav-btn { height: 58px; padding: 4px 2px; border-radius: 13px; box-shadow: none; font-size: .72rem; }
    .portal-shell .nav-btn i { font-size: 1.2rem; margin-bottom: 2px; }
    .portal-shell .portal-breadcrumb { margin-bottom: 12px !important; padding-inline: 12px !important; font-size: .81rem; }
    .portal-shell .breadcrumb { align-items: baseline; }
    .portal-shell :is(.glass-card, .prof-glass-card, .stats-filter-card, .v-col) {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    .portal-shell .bg-sphere { animation: none; opacity: .13; }
    .portal-shell :is(.game-btn-pulse, .notif-badge, .rocket-icon, .progress-bar-animated-custom, .progress-bar-animated-custom::after) {
        animation: none;
    }
    .portal-shell .portal-module > :is(.container, .container-fluid) { padding-inline: 0; }
    .portal-shell .portal-module :is(.glass-card.p-4, .glass-card.p-5, .prof-glass-card.p-4, .stats-filter-card) {
        padding: 12px !important;
    }
    .portal-shell :is(.portal-module, .modal-body) :is(.form-control, .form-select, .month-input, .fin-input, .b-input) {
        max-width: 100%;
        font-size: 1rem;
        min-height: 40px;
    }
    .portal-shell .portal-module .input-group { width: auto !important; max-width: 100%; }
    .portal-shell .portal-module .input-group > :is(.form-control,.form-select) { min-width: 0; }
    .portal-shell .portal-module .table-responsive :is(.form-control, .form-select) { min-height: 36px; }
    .portal-shell .portal-module #financeTable :is(.compensation_comment, .premium_comment, .payment_comment, .off_avans_comment, .off_zp_comment, .extra_pay_comment, .deduction_comment, .vacation_comment) {
        height: auto !important;
        padding: 3px 6px !important;
        font-size: 1rem !important;
        min-height: 36px;
    }
    .portal-shell .portal-module #financeTable .finance-kpi-cell,
    .portal-shell .portal-module #financeTable [data-fin-extra] { min-inline-size: 110px; }
    .portal-shell .portal-module #financeTable :is(th, td):first-child {
        position: sticky;
        left: 0;
        min-width: 104px;
        max-width: 116px;
        white-space: normal;
        overflow-wrap: anywhere;
        border-inline-end: 1px solid var(--portal-border);
    }
    .portal-shell .portal-module #financeTable thead th:first-child { z-index: 110; }
    .portal-shell .portal-module #financeTable tbody td:first-child {
        z-index: 2;
        background: var(--portal-surface);
        box-shadow: none;
    }
    .portal-shell .portal-module .table-responsive :is(.sticky-col, #mainTable .sticky-col) {
        min-width: 112px !important;
        width: clamp(112px, 34vw, 172px) !important;
        max-width: clamp(112px, 34vw, 172px) !important;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .portal-shell .portal-module .table-responsive .sticky-col > .d-flex { flex-wrap: wrap; }
    .portal-shell .portal-module #mainTable .cell-hover { min-width: 38px; height: 40px; }
    .portal-shell .schedule-quick-tools { flex-wrap: wrap; gap: 6px; }
    .portal-shell .schedule-quick-tools > span { flex-basis: 100%; }
    .portal-shell .schedule-quick-tools .form-switch { margin-left: .25rem !important; }
    .portal-shell .schedule-summary { --bs-gutter-x: .375rem; --bs-gutter-y: .5rem; margin-bottom: .75rem !important; }
    .portal-shell .schedule-summary-tile { width: calc(100% / 3); }
    .portal-shell .schedule-summary-tile .glass-card {
        padding: 8px 4px !important;
        height: 100%;
        flex-direction: column;
        gap: 3px;
        text-align: center;
        border-radius: 13px;
    }
    .portal-shell .schedule-summary-tile .glass-card > .rounded-circle { width: 26px !important; height: 26px !important; margin: 0 !important; }
    .portal-shell .schedule-summary-tile .glass-card > .rounded-circle .bi { font-size: .9rem !important; }
    .portal-shell .schedule-summary-tile small { font-size: .68rem; }
    .portal-shell .portal-admin-widgets { margin-bottom: 12px; }
    .portal-shell .portal-admin-widgets > summary {
        display: list-item;
        min-height: 44px;
        padding: 10px 13px;
        border: 1px solid var(--portal-border);
        border-radius: 13px;
        background: var(--portal-surface);
        font-weight: 700;
    }
    .portal-shell .portal-admin-widgets[open] > summary { margin-bottom: 10px; }
    .portal-shell .portal-module :is(.stats-nav-link, .nav-link-custom) {
        padding: 8px 11px;
        min-height: 40px;
    }
    .portal-shell .portal-module .stats-filter-card .btn { max-width: 100%; white-space: normal; }
    .portal-shell .portal-module .docs-header-tools { width: 100%; flex-wrap: wrap; gap: 8px !important; }
    .portal-shell .portal-module .docs-header-tools > div { flex: 1 1 100%; min-width: 0; }
    .portal-shell .portal-module #partnerSearch { min-width: 0 !important; }
    .portal-shell .portal-module .study-header-actions { justify-content: flex-start !important; flex-wrap: wrap; }
    .portal-shell .portal-module .study-header-actions .btn { min-height: 40px; padding-inline: 11px !important; }
    .portal-shell .portal-module .opiu-table-wrapper table { min-width: 375px; }
    .portal-shell .portal-module[data-portal-page="stats"] canvas { max-inline-size: 100%; }
    .portal-shell .portal-module .fin-table :is(th, td):first-child {
        width: 120px;
        min-width: 120px !important;
        max-width: 120px;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .portal-shell .analytics-week-nav {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
        margin: 0 0 9px;
        font-size: .82rem;
        color: var(--portal-muted);
    }
    .portal-shell .analytics-week-nav a { min-width: 36px; min-height: 36px; display: inline-grid; place-items: center; }
    .portal-shell .analytics-grid { scroll-snap-type: x proximity; }
    .portal-shell .analytics-grid .week-col {
        flex: 0 0 100%;
        min-width: 0;
        scroll-snap-align: start;
    }
    .portal-shell .analytics-grid .stat-row { display: grid; grid-template-columns: minmax(82px, 1fr) minmax(0, 1.45fr); gap: 6px; }
    .portal-shell .analytics-grid .stat-name,
    .portal-shell .analytics-grid .stat-inputs { width: auto; min-width: 0; }
    .portal-shell .analytics-grid .stat-inputs { flex-wrap: wrap; }
    .portal-shell .analytics-grid .stat-inputs input { flex: 1 1 52px; min-width: 0; width: auto !important; }
    .portal-shell .analytics-grid .stat-diff { min-width: 0; flex: 0 0 auto; margin-left: 0; }
    .portal-shell .portal-module .crm-board-actions { flex-wrap: wrap; }
    .portal-shell .portal-module .crm-board-actions button { padding-inline: 10px !important; min-height: 42px; }
    .portal-shell .portal-module .v-board {
        height: auto;
        max-height: none;
        min-height: 0;
        gap: 12px;
        padding-inline: 0;
        scroll-snap-type: x proximity;
    }
    .portal-shell .portal-module .v-board .v-col {
        flex: 0 0 min(330px, 91%);
        width: min(330px, 91%);
        min-width: 0;
        max-height: min(70dvh, 680px);
        scroll-snap-align: start;
    }
    .portal-shell .portal-module .v-col :is(.col-title, .task-title) { overflow-wrap: anywhere; }
    .portal-shell .portal-module .v-col-header { padding: 12px; gap: 6px; }
    .portal-shell .portal-module .v-col-header > .d-flex { min-width: 0; }
    .portal-shell .portal-module .v-col-header .col-title { max-width: 48vw !important; }
    .portal-shell .modal :is(.modal-header, .modal-body, .modal-footer) { padding-inline: 12px !important; }
    .portal-shell .modal :is(.modal-header, .modal-footer) { gap: 6px; }
    .portal-shell .modal .modal-title { min-inline-size: 0; overflow-wrap: anywhere; }
    .portal-shell .modal .btn-close { min-width: 20px; min-height: 20px; flex: 0 0 auto; }
    .portal-shell .portal-module :is(.ql-editor, .article-content, .rich-content) { overflow-wrap: anywhere; }
    .portal-shell .portal-module :is(.ql-editor, .article-content, .rich-content) :is(img,video,iframe) { max-width: 100%; }
    .portal-shell .portal-module .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .portal-shell .portal-module .info-box { padding: 9px; overflow-wrap: anywhere; }
    .portal-shell .portal-module .game-card-wrapper { max-width: 100%; }
    .portal-shell .security-banner { margin-top: 20px; }
    .portal-shell .portal-error { max-width: calc(100vw - 20px); inset: auto 10px 10px; }
    .portal-login .login-wrapper { padding: 12px; }
    .portal-login .login-card { padding: 24px 16px; backdrop-filter: none; -webkit-backdrop-filter: none; }
    .portal-login .bg-sphere { animation: none; opacity: .25; }
}
@media (max-width: 359.98px) {
    .portal-shell .nav-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .portal-shell .top-control-panel { gap: 2px; padding-inline: 3px; }
    .portal-shell .portal-session-controls { gap: 2px !important; }
}
@media (hover: none) {
    .portal-shell :is(.hover-bounce, .prof-hover-bounce, .v-task-card, .nav-btn, .control-icon-btn):hover { transform: none; }
    .portal-shell .nav-btn:not(.active):hover { color: var(--portal-accent) !important; background: var(--portal-surface); }
}
@media (prefers-reduced-motion: reduce) {
    body:is(.portal-shell, .portal-login),
    body:is(.portal-shell, .portal-login) :is(.animate__animated, .portal-header, .nav-btn, .bg-sphere,
        .control-icon-btn, .user-avatar-box, .game-btn-pulse, .notif-badge, .kpi-page, .fade-in-section,
        .rocket-icon, .login-card, .logo-box, .glass-card, .prof-glass-card,
        .progress-bar-animated-custom, .progress-bar-animated-custom::after) {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
