body {
    background: var(--bg-light);
    font-family: var(--brand-font-family);
    color: var(--text-dark);
}

:root {
    --app-surface-radius: 28px;
    --app-surface-padding: 0.75rem;
    --app-header-radius: 22px;
    --app-header-padding: 0.2rem 0.5rem;
    --app-header-gap: 0.75rem;
}

/* --- Sidebar --- */
.sidebar {
    min-height: 100vh;
    height: 100dvh;
    width: 260px;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease;
}

.sidebar .brand-container {
    padding: 1.5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.sidebar .brand {
    font-weight: 800;
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-color);
    text-decoration: none;
    line-height: 1.1;
}

.sidebar .brand small {
    display: block;
    font-size: 0.80rem;
    color: var(--brand-gray);
    letter-spacing: 0;
    font-weight: 500;
    text-transform: none;
}

.sidebar-toggle {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.sidebar-collapsed .sidebar {
    width: 86px;
}

body.sidebar-collapsed .sidebar .brand-container {
    justify-content: center;
}

body.sidebar-collapsed .sidebar .brand-container .brand {
    display: none;
}

body.sidebar-collapsed .sidebar .brand small,
body.sidebar-collapsed .sidebar .bot-switcher-container,
body.sidebar-collapsed .sidebar .current-site-label,
body.sidebar-collapsed .sidebar .site-nav-label,
body.sidebar-collapsed .sidebar .sidebar-bottom .btn-add-new,
body.sidebar-collapsed .sidebar .bottom-links a span,
body.sidebar-collapsed .sidebar .nav-link span,
body.sidebar-collapsed .sidebar .site-nav-section-title {
    display: none !important;
}

body.sidebar-collapsed .sidebar .brand {
    font-size: 1.05rem;
}

body.sidebar-collapsed .sidebar .sidebar-toggle {
    margin-left: 0;
}

body.sidebar-collapsed .sidebar .nav-link,
body.sidebar-collapsed .sidebar .bottom-links a {
    justify-content: center;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    gap: 0;
    font-size: 0;
}

body.sidebar-collapsed .sidebar .nav-link i,
body.sidebar-collapsed .sidebar .bottom-links a i {
    margin: 0;
    font-size: 1.1rem;
}

body.sidebar-collapsed .sidebar .brand-container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

body.sidebar-collapsed .sidebar .sidebar-toggle i {
    color: var(--sidebar-text) !important;
}

body.sidebar-collapsed .main-wrapper {
    margin-left: 86px;
}

@media (max-width: 991.98px) {
    .main-wrapper {
        margin-left: 0;
    }
}

.sidebar-user-summary {
    padding: 0 1.5rem 0.65rem;
}

.sidebar-user-line {
    color: #e5e7eb;
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.35;
}

.sidebar-menu {
    flex: 1 1 auto;
    min-height: 0;
    padding-top: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #6b7280 #050505;
}

.sidebar-menu::-webkit-scrollbar {
    width: 10px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: #050505;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #4b5563 0%, #6b7280 100%);
    border-radius: 999px;
    border: 2px solid #050505;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #6b7280 0%, #9ca3af 100%);
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    color: var(--sidebar-active);
    background: var(--sidebar-hover);
}

.sidebar .nav-link.active {
    color: var(--sidebar-active);
    background: #141414;
    border-left-color: var(--primary-color);
}

.sidebar .nav-link.active i {
    color: var(--primary-color);
}

.sidebar .nav-link i {
    font-size: 1.1rem;
}

/* --- Bot Switcher Dropdown --- */
.bot-switcher-container {
    padding: 0 1.5rem;
    margin-bottom: 1.5rem;
}

.bot-switcher-btn {
    background: #141414;
    color: #dddddd;
    border: 1px solid #333333;
    border-radius: 0.375rem;
    padding: 0.6rem 1rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.bot-switcher-btn:hover {
    background: #1b1b1b;
    color: #ffffff;
    border-color: #444444;
}

.bot-switcher-menu {
    background: #141414;
    border-radius: 0.375rem;
}

.current-site-dot,
.other-site-dot {
    font-size: 0.5rem;
}

.current-site-dot {
    color: var(--primary-color);
}

.current-site-label {
    font-size: 0.65rem;
    color: var(--brand-gray);
    font-weight: 600;
    letter-spacing: 1px;
}

.site-nav-section-title {
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

/* --- Sidebar Bottom --- */
.sidebar-bottom {
    padding: 1.5rem;
    flex-shrink: 0;
}

.btn-add-new {
    background-color: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
    border: none;
    border-radius: 0.375rem;
    padding: 0.75rem;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.btn-add-new:hover {
    background-color: var(--primary-hover);
    color: #ffffff;
}

.bottom-links {
    margin-top: 1.5rem;
    border-top: 1px solid #222222;
    padding-top: 1rem;
}

.bottom-links a {
    color: var(--sidebar-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 0;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.bottom-links a:hover {
    color: var(--sidebar-active);
}

/* --- Top Navbar --- */
.top-navbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 260px;
    height: 24px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-light);
    z-index: 1030;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 0.6rem;
    line-height: 24px;
}

.top-navbar img {
    display: block;
}

.navbar-brand-text {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1.1rem;
    margin-right: 2rem;
}

.search-bar-container {
    flex-grow: 1;
    max-width: 500px;
    position: relative;
}

.search-bar-container i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.search-bar {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
    background-color: #f9fafb;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.search-bar:focus {
    outline: none;
    border-color: #d1d5db;
    background-color: #ffffff;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
}

.language-switcher {
    display: flex;
    align-items: center;
    margin: 0;
}

.language-trigger {
    border: none;
    background: transparent;
    border-radius: 0;
    padding: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    line-height: 1;
}

.language-trigger img {
    width: 22px;
    height: 16px;
    border-radius: 1px;
    display: block;
    margin-top: 2px;
}

.language-menu {
    min-width: 54px;
}

.language-option {
    display: flex;
    justify-content: center;
    padding: 0.3rem 0.35rem;
}

.language-option img {
    width: 20px;
    height: 15px;
    border-radius: 2px;
}

.nav-actions i {
    font-size: 1.2rem;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-actions i:hover {
    color: var(--text-dark);
}

.top-user-name {
    color: var(--text-dark);
    font-size: 0.94rem;
    font-weight: 500;
    max-width: 210px;
}

.user-menu-trigger {
    border: none;
    background: transparent;
    border-radius: 0;
    min-height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    color: var(--text-dark);
    font-weight: 500;
}

.user-menu-trigger:hover {
    color: #0f172a;
}

.user-menu-trigger i {
    font-size: 0.72rem;
    color: #64748b;
}

.user-name {
    color: var(--text-dark);
    font-size: 1rem;
}

.user-role-badge {
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    padding: 0.3em 0.6em;
}

.user-role-badge--superadmin {
    background-color: #7c3aed;
}

.user-role-badge--admin {
    background-color: #0369a1;
}

.user-role-badge--reports {
    background-color: #065f46;
}

.user-role-badge--viewer {
    background-color: #92400e;
}

.user-role-caption {
    font-size: 0.8rem;
    padding: 0 1rem 0.5rem;
}

.profile-menu {
    border-radius: 0.5rem;
    min-width: 200px;
}

.financial-menu-icon {
    color: #fb923c;
}

.header-user-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.header-lang-switcher {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.header-lang-trigger {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.header-lang-trigger img {
    width: 22px;
    height: 22px;
    object-fit: cover;
    border-radius: 999px;
    box-shadow: 0 0 0 1px #e2e8f0;
    display: block;
}

.header-lang-menu {
    min-width: 58px;
}

.header-lang-option {
    display: flex;
    justify-content: center;
    padding: 0.35rem 0.4rem;
}

.header-lang-option img {
    width: 22px;
    height: 22px;
    object-fit: cover;
    border-radius: 999px;
}

.header-user-trigger {
    border: 0;
    background: transparent;
    padding: 0;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-dark);
    font-weight: 500;
}

.header-user-trigger:hover {
    color: #0f172a;
}

.header-user-trigger i {
    font-size: 0.72rem;
    color: #64748b;
}

.header-user-name {
    color: var(--text-dark);
    font-size: 0.94rem;
    max-width: 180px;
}

/* --- Main Content --- */
.main-wrapper {
    margin-left: 260px;
    margin-top: 0;
    padding: 0.75rem;
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

body.pending-plan .main-wrapper {
    margin-left: 0;
}

.app-body-surface {
    min-height: calc(100vh - 1.5rem);
    padding: var(--app-surface-padding);
    border-radius: var(--app-surface-radius);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 28%),
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 24%),
        linear-gradient(180deg, #f8fbff 0%, #f4f7fb 100%);
}

.wz-shell {
    min-height: auto;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--wz-ink, var(--text-dark));
    font-size: var(--app-font-size-base);
}

.wz-header {
    position: sticky;
    top: 0.75rem;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--app-header-gap);
    margin-bottom: 1rem;
    padding: var(--app-header-padding);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--app-header-radius);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(12px);
}

.wz-header-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.wz-back {
    width: 35px;
    height: 38px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--wz-ink, var(--text-dark));
    background: var(--wz-surface, #ffffff);
    border: 1px solid var(--wz-border, var(--border-light));
    border-radius: 14px;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.wz-back:hover {
    color: var(--wz-primary, var(--primary-color));
    border-color: rgba(37, 99, 235, 0.28);
    transform: translateX(-2px);
}

.wz-title {
    margin: 0;
}

.wz-subtitle {
    margin: 0.3rem 0 0;
}

.app-page-header {
    position: relative;
    top: 0;
    z-index: 15;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: var(--app-header-padding);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--app-header-radius);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(12px);
    overflow: visible;
}

.app-page-header-main {
    min-width: 0;
}

.app-page-kicker {
    margin: 0 0 0.2rem;
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.app-page-title {
    margin: 0;
    color: var(--text-dark);
    letter-spacing: -0.5px;
    font-size: clamp(1.35rem, 2vw, 2rem);
    font-weight: 800;
}

.app-page-badges {
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.app-page-badges--inline {
    margin-top: 0;
}

.tenant-plan-badge {
    background-color: #fff0eb;
    color: var(--primary-color);
    font-size: 0.6rem;
    letter-spacing: 1px;
    padding: 0.4em 0.8em;
    border-radius: 0.25rem;
}

.tenant-plan-badge--free {
    background-color: #198754;
    color: #ffffff;
}

.tenant-plan-badge--standard {
    background-color: #0d6efd;
    color: #ffffff;
}

.tenant-plan-badge--legacy {
    background-color: #6c757d;
    color: #ffffff;
}

.tenant-bots-badge {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
    font-size: 0.6rem;
    padding: 0.4em 0.8em;
    border-radius: 0.25rem;
}

.app-page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.app-page-header .dropdown-menu {
    z-index: 1400;
}

.app-page-action-btn {
    border-radius: 0.375rem;
}

.faq-shell {
    margin-top: 0.35rem;
}

.faq-shell .accordion-item {
    border-radius: var(--app-card-radius);
    border: var(--app-card-border);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.faq-shell .accordion-button {
    font-size: 0.96rem;
    color: var(--text-dark);
    background: #ffffff;
}

.faq-shell .accordion-button:not(.collapsed) {
    color: var(--primary-color);
    background: #fff7f2;
    box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.08);
}

.faq-shell .accordion-button:focus {
    border-color: rgba(255, 90, 31, 0.3);
    box-shadow: 0 0 0 0.2rem rgba(255, 90, 31, 0.15);
}

.faq-shell .accordion-body {
    color: var(--text-muted);
    font-size: var(--app-font-size-base);
}

.faq-section-title {
    letter-spacing: 0.08em;
    font-size: 0.75rem;
}

.faq-section-icon {
    color: var(--text-dark);
}

.faq-code-block {
    font-size: 0.82rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.faq-footnote-callout {
    background: #ffffff;
    border-color: rgba(255, 90, 31, 0.18) !important;
}

.faq-footnote-icon,
.faq-footnote-text {
    color: var(--primary-color);
}

.faq-footnote-text {
    font-size: 0.9rem;
}

.profile-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
    gap: 0.85rem;
    align-items: start;
}

.card.profile-card {
    min-width: 0;
    overflow: visible;
}

.card.profile-card .card-body {
    overflow: visible;
}

.profile-card-heading {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    margin-bottom: 1.1rem;
}

.profile-card-heading h2 {
    margin: 0;
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 800;
}

.profile-card-heading p {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: var(--app-font-size-help);
    line-height: 1.45;
}

.profile-card-icon {
    width: 2.4rem;
    height: 2.4rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    color: var(--primary-color);
    background: #fff0eb;
}

.profile-card-icon--security {
    color: #0f172a;
    background: #f1f5f9;
}

.profile-form {
    max-width: 720px;
}

.profile-readonly-input {
    color: var(--text-muted);
    background-color: #f8fafc;
}

.profile-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

@media (max-width: 991.98px) {
    .profile-shell {
        grid-template-columns: 1fr;
    }

    .faq-shell {
        margin-top: 0.2rem;
    }

    .faq-shell .accordion-button {
        font-size: 0.9rem;
        padding: 0.78rem 0.9rem;
    }

    .faq-shell .accordion-body {
        font-size: 0.9rem;
        padding: 0.82rem 0.9rem;
    }
}

@media (max-width: 767.98px) {
    .faq-section-title {
        font-size: 0.7rem;
        margin-bottom: 0.55rem !important;
        margin-top: 0.7rem !important;
    }

    .faq-shell .accordion-item {
        border-radius: 0.75rem;
        margin-bottom: 0.45rem !important;
    }

    .faq-shell .accordion-button {
        font-size: 0.84rem;
        line-height: 1.35;
        padding: 0.72rem 0.8rem;
    }

    .faq-shell .accordion-body {
        font-size: 0.84rem;
        line-height: 1.55;
        padding: 0.72rem 0.8rem;
    }

    .faq-code-block {
        font-size: 0.74rem;
        overflow-x: auto;
        white-space: pre;
        -webkit-overflow-scrolling: touch;
    }

    .faq-footnote-text {
        font-size: 0.82rem;
    }
}

@media (max-width: 575.98px) {
    .faq-shell {
        margin-top: 0.1rem;
    }

    .faq-shell .accordion-button {
        font-size: 0.8rem;
        padding: 0.65rem 0.72rem;
    }

    .faq-shell .accordion-body {
        font-size: 0.8rem;
        padding: 0.65rem 0.72rem;
    }

    .faq-code-block {
        font-size: 0.68rem;
        padding: 0.62rem !important;
    }
}

.app-page-back-right {
    margin-left: 0.25rem;
}

.app-page-card {
    border-radius: var(--app-card-radius) !important;
    border: var(--app-card-border) !important;
}

.form-control,
.form-select,
.wz-input,
.wz-select,
.wz-textarea {
    border-radius: var(--app-input-radius);
}

.wz-input,
.wz-select,
.wz-textarea,
.wz-file {
    width: 100%;
    color: var(--wz-ink, var(--text-dark));
    background: var(--wz-surface, #ffffff);
    border: 1px solid var(--wz-border, var(--border-light));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.form-control,
.form-select,
.wz-input,
.wz-select {
    min-height: var(--app-input-height);
    padding: var(--app-input-padding-y) var(--app-input-padding-x);
    font-size: var(--app-font-size-base);
}

.wz-textarea {
    min-height: 120px;
    padding: var(--app-input-padding-y) var(--app-input-padding-x);
    font-size: var(--app-font-size-base);
    resize: vertical;
}

.wz-input:focus,
.wz-select:focus,
.wz-textarea:focus {
    outline: 0;
    border-color: rgba(var(--wz-primary-rgb, 255, 90, 31), 0.42);
    box-shadow: 0 0 0 4px rgba(var(--wz-primary-rgb, 255, 90, 31), 0.12);
}

.form-label,
.wz-label {
    font-size: var(--app-font-size-label);
    color: var(--wz-ink, var(--text-dark));
    font-weight: 700;
}

.form-text,
.wz-hint {
    font-size: var(--app-font-size-help);
    color: var(--wz-muted, var(--text-muted));
}

.wz-file {
    min-height: var(--app-input-height);
    padding: var(--app-input-padding-y) var(--app-input-padding-x);
}

.app-navtabs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0px 0 0.85rem;
    padding: 0.4rem;
    border-radius: 14px;
    border: 1px solid #dbe4f0;
    background: rgba(255, 255, 255, 0.92);
}

.app-navtab {
    display: inline-flex;
    align-items: center;
    padding: 0.58rem 0.9rem;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: #516981;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.04rem;
    line-height: 1.1;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.app-navtab:hover {
    color: #1f4f8d;
    background: #f6f9fc;
    border-color: #dbe4f0;
}

.app-navtab.is-active {
    border-color: #dbe4f0;
    background: #ffffff;
    color: #1f2937;
    font-weight: 700;
}

/* --- Modern Cards --- */
.card {
    border: 1px solid var(--border-light);
    border-radius: var(--app-header-radius);
    background: #ffffff;
    transition: box-shadow 0.2s, border-color 0.2s;
    overflow: hidden;
}

.card:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.card-header > i.bi,
.card-header > span > i.bi,
.card-header .fw-semibold > i.bi,
.card-header .card-title i.bi {
    color: var(--text-dark) !important;
}

/* --- Global help tooltip trigger (shared across pages) --- */
.sites-help-tooltip-trigger {
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 0.85rem;
    padding: 0;
    margin-left: 0.35rem;
    line-height: 1;
    vertical-align: middle;
}

.sites-help-tooltip-trigger:hover {
    color: var(--primary-color);
}

.dataTables_wrapper .dataTables_length .form-select,
.dataTables_wrapper .dataTables_filter .form-control {
    min-height: var(--app-input-height);
    border: 1px solid var(--border-light);
    border-radius: var(--app-input-radius);
    color: var(--text-dark);
    background: #ffffff;
}

.dataTables_wrapper .dataTables_filter .form-control:focus,
.dataTables_wrapper .dataTables_length .form-select:focus {
    border-color: rgba(255, 90, 31, 0.42);
    box-shadow: 0 0 0 4px rgba(255, 90, 31, 0.12);
}

.dataTables_wrapper .dataTables_paginate .pagination {
    gap: 0.2rem;
}

.dataTables_wrapper .dataTables_paginate .page-item .page-link {
    color: var(--text-dark);
    border-color: var(--border-light);
    background: #ffffff;
}

.dataTables_wrapper .dataTables_paginate .page-item .page-link:hover {
    color: #ffffff;
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    color: #ffffff;
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
    color: #9ca3af;
    background: #f3f4f6;
    border-color: #e5e7eb;
}

/* --- Buttons --- */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--border-light);
}

.btn-outline-primary:hover {
    background-color: var(--bg-light);
    color: var(--primary-hover);
    border-color: #d1d5db;
}

.app-table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex-wrap: nowrap;
}

.app-table-actions form {
    margin: 0;
    display: inline-flex;
}

.app-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.app-row-actions .btn,
.app-row-actions .app-page-action-btn {
    min-height: 2.4rem;
    padding-top: 0;
    padding-bottom: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.app-icon-btn {
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.65rem;
    border: 1px solid transparent;
    background: #ffffff;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.app-icon-btn i {
    font-size: 1rem;
    line-height: 1;
}

.app-icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.app-icon-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.18rem rgba(15, 23, 42, 0.12);
}

.app-icon-btn--view {
    color: #0284c7;
    border-color: rgba(14, 165, 233, 0.42);
    background: #ffffff;
}

.app-icon-btn--view:hover {
    color: #0369a1;
    border-color: rgba(14, 165, 233, 0.58);
    background: rgba(14, 165, 233, 0.12);
}

.app-icon-btn--edit {
    color: #f59e0b;
    border-color: #fbbf24;
    background: #ffffff;
}

.app-icon-btn--edit:hover {
    color: #d97706;
    border-color: #f59e0b;
    background: #fffbeb;
}

.app-icon-btn--delete,
.app-icon-btn--danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.5);
    background: #ffffff;
}

.app-icon-btn--delete:hover,
.app-icon-btn--danger:hover {
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.68);
    background: rgba(239, 68, 68, 0.1);
}

.app-icon-btn--neutral {
    color: #64748b;
    border-color: #cbd5e1;
    background: #ffffff;
}

.app-icon-btn--neutral:hover {
    color: var(--text-dark);
    border-color: #94a3b8;
    background: #f8fafc;
}

/* --- Login Page (shared baseline, no dedicated per-page file) --- */
body.login-page {
    margin: 0;
    min-height: 100vh;
    font-family: var(--brand-font-family);
    background:
        radial-gradient(80rem 80rem at -10% -20%, rgba(255, 90, 31, 0.12), transparent 42%),
        radial-gradient(70rem 70rem at 120% 120%, rgba(0, 0, 0, 0.08), transparent 40%),
        linear-gradient(140deg, #f8fafc 0%, #f3f4f6 48%, #fff7f3 100%);
    color: var(--text-dark);
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: var(--app-header-radius);
    border: var(--app-card-border);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.12);
    padding: 1.35rem 1.35rem 1.5rem;
}

.login-language-switcher {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.login-language-label {
    font-size: var(--app-font-size-help);
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-muted);
}

.login-language-trigger {
    width: 36px;
    height: 30px;
    border: 1px solid var(--border-light);
    border-radius: 0.5rem;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.login-language-trigger img,
.login-language-option img {
    width: 24px;
    height: 18px;
    border-radius: 2px;
}

.login-language-menu {
    min-width: 58px;
    border-radius: 0.625rem;
    overflow: hidden;
}

.login-language-option {
    display: flex;
    justify-content: center;
    padding: 0.45rem 0.2rem;
}

.login-brand-wrap {
    margin-bottom: 1rem;
}

.login-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.login-brand {
    font-size: clamp(1.3rem, 1.2rem + 0.7vw, 1.65rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    display: flex;
    align-items: center;
}

.login-brand i {
    color: var(--primary-color);
}

.login-brand span {
    color: var(--primary-color);
}

.login-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.login-error-alert {
    font-size: 0.875rem;
}

.login-form-label {
    font-size: var(--app-font-size-label);
    font-weight: 700;
    color: #1f2937;
}

.login-input-group .input-group-text,
.login-input-group .form-control {
    border-color: var(--border-light);
    min-height: var(--app-input-height);
}

.login-input-group .input-group-text {
    border-right: 0;
    background: #fff;
    color: #9ca3af;
    border-top-left-radius: var(--app-input-radius);
    border-bottom-left-radius: var(--app-input-radius);
}

.login-input-group .form-control {
    border-left: 0;
}

.app-icon-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.18rem rgba(15, 23, 42, 0.12);
}

.app-icon-btn--view {
    color: #0284c7;
    border-color: rgba(14, 165, 233, 0.42);
    background: #ffffff;
}

.app-icon-btn--view:hover {
    color: #0369a1;
    border-color: rgba(14, 165, 233, 0.58);
    background: rgba(14, 165, 233, 0.12);
}

.app-icon-btn--edit {
    color: #f59e0b;
    border-color: #fbbf24;
    background: #ffffff;
}

.app-icon-btn--edit:hover {
    color: #d97706;
    border-color: #f59e0b;
    background: #fffbeb;
}

.app-icon-btn--delete,
.app-icon-btn--danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.5);
    background: #ffffff;
}

.app-icon-btn--delete:hover,
.app-icon-btn--danger:hover {
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.68);
    background: rgba(239, 68, 68, 0.1);
}

.app-icon-btn--neutral {
    color: #64748b;
    border-color: #cbd5e1;
    background: #ffffff;
}

.app-icon-btn--neutral:hover {
    color: var(--text-dark);
    border-color: #94a3b8;
    background: #f8fafc;
}

/* --- Login Page (shared baseline, no dedicated per-page file) --- */
body.login-page {
    margin: 0;
    min-height: 100vh;
    font-family: var(--brand-font-family);
    background:
        radial-gradient(80rem 80rem at -10% -20%, rgba(255, 90, 31, 0.12), transparent 42%),
        radial-gradient(70rem 70rem at 120% 120%, rgba(0, 0, 0, 0.08), transparent 40%),
        linear-gradient(140deg, #f8fafc 0%, #f3f4f6 48%, #fff7f3 100%);
    color: var(--text-dark);
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: var(--app-header-radius);
    border: var(--app-card-border);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.12);
    padding: 1.35rem 1.35rem 1.5rem;
}

.login-language-switcher {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.login-language-label {
    font-size: var(--app-font-size-help);
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-muted);
}

.login-language-trigger {
    width: 36px;
    height: 30px;
    border: 1px solid var(--border-light);
    border-radius: 0.5rem;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.login-language-trigger img,
.login-language-option img {
    width: 24px;
    height: 18px;
    border-radius: 2px;
}

.login-language-menu {
    min-width: 58px;
    border-radius: 0.625rem;
    overflow: hidden;
}

.login-language-option {
    display: flex;
    justify-content: center;
    padding: 0.45rem 0.2rem;
}

.login-brand-wrap {
    margin-bottom: 1rem;
}

.login-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.login-brand {
    font-size: clamp(1.3rem, 1.2rem + 0.7vw, 1.65rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    display: flex;
    align-items: center;
}

.login-brand i {
    color: var(--primary-color);
}

.login-brand span {
    color: var(--primary-color);
}

.login-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.login-error-alert {
    font-size: 0.875rem;
}

.login-form-label {
    font-size: var(--app-font-size-label);
    font-weight: 700;
    color: #1f2937;
}

.login-input-group .input-group-text,
.login-input-group .form-control {
    border-color: var(--border-light);
    min-height: var(--app-input-height);
}

.login-input-group .input-group-text {
    border-right: 0;
    background: #fff;
    color: #9ca3af;
    border-top-left-radius: var(--app-input-radius);
    border-bottom-left-radius: var(--app-input-radius);
}

.login-input-group .form-control {
    border-left: 0;
    padding-left: 8px;
    border-top-right-radius: var(--app-input-radius);
    border-bottom-right-radius: var(--app-input-radius);
}

.login-input-group:focus-within .form-control {
    box-shadow: none;
    border-color: #86b7fe;
    z-index: 5;
}

.login-input-group:focus-within .input-group-text {
    border-color: #86b7fe;
    color: #0d6efd;
    z-index: 5;
}

.login-input-group:focus-within {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    border-radius: var(--app-input-radius);
}

/* --- Password toggle button (eye icon inside input-group) --- */
.password-toggle-btn {
    cursor: pointer;
    background: #fff;
    border-color: var(--border-light);
    border-left: 0;
    color: #9ca3af;
    min-height: var(--app-input-height);
    border-top-right-radius: var(--app-input-radius);
    border-bottom-right-radius: var(--app-input-radius);
    transition: color 0.15s ease;
}

.password-toggle-btn:hover {
    color: #6b7280;
}

.password-toggle-btn:focus {
    outline: 0;
    box-shadow: none;
}

/* When toggle follows input, remove right border-radius from input */
.form-control.password-with-toggle {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: 0;
}

.input-group:has(.password-with-toggle) {
    border-radius: var(--app-input-radius);
}

.input-group:has(.password-with-toggle):focus-within .form-control.password-with-toggle {
    box-shadow: none;
    border-color: #86b7fe;
    z-index: 5;
}

/* Focus-within on input-group: match toggle border color to focus ring */
.input-group:has(.password-with-toggle):focus-within .password-toggle-btn {
    border-color: #86b7fe;
    color: #0d6efd;
    z-index: 5;
}

.input-group:has(.password-with-toggle):focus-within {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    border-radius: var(--app-input-radius);
}

.login-btn-submit {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 0.625rem;
    background: var(--primary-color);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.login-btn-submit:hover,
.login-btn-submit:focus {
    background: var(--primary-hover);
    color: #fff;
}

/* ===== Global App Page Header Responsive ===== */

@media (max-width: 991.98px) {
    .app-page-header {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .app-page-header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 767.98px) {
    .app-page-header {
        padding: 0.75rem 1rem;
    }

    .app-page-header-actions {
        gap: 0.4rem;
        flex-wrap: wrap;
    }

    .app-page-header-actions .btn {
        font-size: 0.78rem;
        padding: 0.4rem 0.7rem;
    }

    .app-page-title {
        font-size: clamp(1.1rem, 1.8vw, 1.5rem);
    }
}

@media (max-width: 575.98px) {
    .app-page-header {
        padding: 0.6rem 0.75rem;
        margin-bottom: 0.5rem;
        border-radius: 0.75rem;
    }

    .app-page-header-actions .btn {
        font-size: 0.72rem;
        padding: 0.35rem 0.6rem;
    }

    .app-page-kicker {
        font-size: 0.65rem;
    }
}

/* ── Notification Bell ──────────────────────────────────────────────── */
.notification-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.notification-bell-trigger {
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    padding: 6px 8px;
    border-radius: 8px;
    color: var(--text-muted, #64748b);
    font-size: 1.25rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.notification-bell-trigger:hover {
    background: var(--primary-light, #fff0eb);
    color: var(--primary-color, #ff5a1f);
}

.notification-bell--pulse .notification-bell-trigger {
    animation: notificationPulse 1.2s ease;
    background: var(--primary-light, #fff0eb);
    color: var(--primary-color, #ff5a1f);
}

@keyframes notificationPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 90, 31, 0.36);
        transform: scale(1);
    }
    45% {
        box-shadow: 0 0 0 9px rgba(255, 90, 31, 0);
        transform: scale(1.06);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 90, 31, 0);
        transform: scale(1);
    }
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    background: #dc2626;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid #fff;
}

.notification-dropdown {
    width: 360px;
    max-height: 420px;
    border-radius: var(--app-input-radius, 8px);
    overflow: hidden;
    padding: 0;
}

.notification-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
    background: var(--bg-light, #f9fafb);
}

.notification-dropdown-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dark, #1e293b);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.notification-mark-read-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--primary-color, #ff5a1f);
    cursor: pointer;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0;
    text-align: right;
    white-space: nowrap;
}

.notification-mark-read-btn:hover,
.notification-mark-read-btn:focus {
    color: var(--primary-hover, #e04b18);
    text-decoration: underline;
}

.notification-mark-read-btn:disabled {
    cursor: default;
    opacity: 0.55;
    text-decoration: none;
}

.notification-dropdown-body {
    max-height: 320px;
    overflow-y: auto;
    padding: 6px 0;
}

.notification-item {
    appearance: none;
    width: 100%;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
    color: inherit;
    cursor: default;
    display: flex;
    gap: 12px;
    padding: 12px 18px;
    position: relative;
    text-align: left;
    transition: background 0.12s ease, box-shadow 0.12s ease;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover,
.notification-item:focus {
    background: var(--bg-light, #f9fafb);
    outline: none;
}

.notification-item--unread {
    cursor: pointer;
    background: #fffaf7;
}

.notification-item--unread::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--primary-color, #ff5a1f);
}

.notification-item-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-light, #f9fafb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.notification-item--unread .notification-item-icon {
    background: var(--primary-light, #fff0eb);
}

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-message {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-dark, #1e293b);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-item--unread .notification-item-message {
    font-weight: 600;
}

.notification-item-time {
    font-size: 0.68rem;
    color: var(--text-muted, #94a3b8);
    margin-top: 4px;
    display: block;
}

.notification-dropdown-empty {
    padding: 32px 18px;
    text-align: center;
    color: var(--text-muted, #94a3b8);
}

.notification-dropdown-empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
    opacity: 0.5;
}

.notification-dropdown-empty p {
    margin: 0;
    font-size: 0.8rem;
}

.notification-live-toast {
    position: fixed;
    right: 24px;
    top: 24px;
    z-index: 1085;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(360px, calc(100vw - 32px));
    padding: 12px 16px;
    border-radius: var(--app-input-radius, 8px);
    background: var(--primary-color, #ff5a1f);
    color: var(--brand-white, #ffffff);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.35;
    animation: notificationToastIn 0.18s ease-out;
}

.notification-live-toast i {
    flex: 0 0 auto;
    font-size: 1rem;
}

.notification-live-toast--hide {
    animation: notificationToastOut 0.22s ease-in forwards;
}

@keyframes notificationToastIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes notificationToastOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@media (max-width: 575.98px) {
    .notification-dropdown {
        width: 290px;
    }

    .notification-live-toast {
        left: 16px;
        right: 16px;
        top: 16px;
    }
}
