:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 82px;
    --primary-color: #1e3a5f;
    --primary-light: #2d5a8e;
    --sidebar-bg: #1a2332;
    --sidebar-text: #b8c5d6;
    --sidebar-active: #3b82f6;
    --header-bg: #fff;
    --body-bg: #f0f2f5;
    --card-bg: #fff;
    --rate-pill-bg: #f3f0ff;
    --rate-pill-border: #c4b5fd;
    --rate-pill-code: #5b21b6;
}

[data-bs-theme="dark"] {
    --header-bg: #1e2130;
    --body-bg: #141622;
    --card-bg: #1e2130;
    --sidebar-bg: #12141f;
    --rate-pill-bg: #2a2540;
    --rate-pill-border: #5b4b8a;
    --rate-pill-code: #a78bfa;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    margin: 0;
    transition: background 0.2s;
}

/* Login */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8e 50%, #4a7ab5 100%);
}

.login-split {
    display: flex;
    min-height: 100vh;
}

.login-brand {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #fff;
}

.brand-logo {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.login-brand h1 {
    font-size: 2rem;
    font-weight: 700;
}

.login-form-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    max-width: 520px;
}

.login-glass {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 2.5rem;
    color: #1a2332;
}

.login-glass .form-control {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.login-announcements {
    color: rgba(255, 255, 255, 0.85);
    padding: 0 0.5rem;
}

@media (max-width: 768px) {
    .login-split { flex-direction: column; }
    .login-brand { min-height: 200px; }
    .login-form-side { max-width: 100%; }
}

/* App Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease, width 0.3s ease;
}

body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-collapsed-width);
}

.sidebar-brand {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    width: 100%;
    min-height: 52px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
}

.sidebar-fallback-icon {
    font-size: 1.75rem;
    color: #fff;
}

.sidebar-logo-full {
    display: block;
}

.sidebar-logo-favicon {
    display: none;
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 10px;
}

.sidebar-nav { padding: 0.75rem 0; }

.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    padding: 0.6rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.sidebar-nav .nav-link > i:first-child {
    width: 20px;
    min-width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.15);
    border-left-color: var(--sidebar-active);
}

.sidebar-nav .submenu .nav-link {
    padding-left: 2.5rem;
    font-size: 0.85rem;
}

.submenu-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.menu-parent[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.app-header {
    background: var(--header-bg);
    border-bottom: 1px solid rgba(0,0,0,0.08);
    min-height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}

[data-bs-theme="dark"] .app-header {
    border-bottom-color: rgba(255,255,255,0.08);
}

[data-bs-theme="dark"] .sidebar-toggle-btn,
[data-bs-theme="dark"] .page-title {
    color: #e2e8f0 !important;
}

.sidebar-toggle-btn {
    text-decoration: none !important;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
}

.sidebar-backdrop.show {
    display: block;
}

.icon-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-content { flex: 1; }

.card {
    background: var(--card-bg);
}

/* KPI Cards */
.kpi-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.1);
}

.kpi-card-modern .card-body {
    padding: 1.15rem 1.25rem;
}

.kpi-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.kpi-icon-primary { background: rgba(99, 102, 241, 0.12); color: #6366f1; }
.kpi-icon-info { background: rgba(14, 165, 233, 0.12); color: #0ea5e9; }
.kpi-icon-success { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.kpi-icon-danger { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.kpi-icon-warning { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.kpi-icon-purple { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }

.kpi-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.kpi-danger .kpi-value { color: #dc2626; }

.finance-stat-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.finance-stat-card .card-body {
    padding: 1.15rem 1.25rem;
}

.finance-stat-value.text-success { color: #059669 !important; }
.finance-stat-value.text-warning { color: #d97706 !important; }

.kpi-offer-stats .fw-bold {
    color: #0f172a;
}

/* Dashboard transaction-style widgets */
.dash-tx-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.dash-tx-card .card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.dash-tx-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.dash-tx-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.dash-tx-subtitle {
    font-size: 0.8rem;
    color: #64748b;
}

.dash-tx-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

.dash-tx-badge-success { background: rgba(16, 185, 129, 0.12); color: #059669; }
.dash-tx-badge-warning { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.dash-tx-badge-info { background: rgba(14, 165, 233, 0.12); color: #0284c7; }

.dash-tx-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
}

.dash-tx-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.35rem;
    border-radius: 12px;
    transition: background 0.15s ease;
}

.dash-tx-item-link {
    text-decoration: none;
    color: inherit;
}

.dash-tx-item-link:hover {
    background: rgba(15, 23, 42, 0.04);
}

.dash-tx-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.dash-tx-icon-success { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.dash-tx-icon-info { background: rgba(14, 165, 233, 0.12); color: #0ea5e9; }
.dash-tx-icon-purple { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }
.dash-tx-icon-secondary { background: rgba(100, 116, 139, 0.12); color: #64748b; }
.dash-tx-icon-danger { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.dash-tx-icon-primary { background: rgba(99, 102, 241, 0.12); color: #6366f1; }

.dash-tx-body {
    flex: 1;
    min-width: 0;
}

.dash-tx-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

.dash-tx-meta {
    font-size: 0.75rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-tx-amount {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.dash-tx-amount-positive { color: #059669; }
.dash-tx-amount-negative { color: #dc2626; }
.dash-tx-amount-neutral { color: #0f172a; }

.dash-tx-empty {
    padding: 1.5rem 0.5rem;
    text-align: center;
    font-size: 0.875rem;
}

.dash-tx-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-top: 0.85rem;
    border-top: 1px solid #e2e8f0;
}

[data-bs-theme="dark"] .dash-tx-title,
[data-bs-theme="dark"] .dash-tx-name,
[data-bs-theme="dark"] .dash-tx-amount-neutral {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .dash-tx-item-link:hover {
    background: rgba(255, 255, 255, 0.04);
}

[data-bs-theme="dark"] .dash-tx-footer {
    border-top-color: #334155;
}

.calendar-note-checklist {
    max-height: 140px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.calendar-note-check-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.875rem;
    cursor: pointer;
    user-select: none;
}

.calendar-note-check-item .form-check-input {
    margin: 0;
    flex-shrink: 0;
}

/* DataTables — modern */
.app-table-card .table-responsive {
    padding: 0 0.25rem 0.25rem;
}

.app-datatable + .dt-container,
.app-datatable ~ .dt-container,
div.dt-container {
    padding: 0.75rem 1rem 1rem;
}

div.dt-container .dt-length label,
div.dt-container .dt-search label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

div.dt-container .dt-length select {
    border-radius: 8px;
    padding: 0.35rem 2rem 0.35rem 0.65rem;
    border-color: #e2e8f0;
    font-size: 0.875rem;
}

div.dt-container .dt-search input {
    border-radius: 10px;
    padding: 0.45rem 0.85rem;
    border-color: #e2e8f0;
    font-size: 0.875rem;
    min-width: 200px;
}

div.dt-container .dt-search input:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.15);
}

div.dt-container table.dataTable thead th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.85rem 0.75rem;
}

div.dt-container table.dataTable tbody td {
    padding: 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

div.dt-container .dt-info {
    font-size: 0.85rem;
    color: #64748b;
    padding-top: 0.75rem;
}

div.dt-container .dt-paging {
    padding-top: 0.75rem;
}

div.dt-container .dt-paging .dt-paging-button {
    border-radius: 8px !important;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem !important;
    margin-left: 0.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #e2e8f0 !important;
    background: #fff !important;
    color: #475569 !important;
}

div.dt-container .dt-paging .dt-paging-button:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}

div.dt-container .dt-paging .dt-paging-button.current,
div.dt-container .dt-paging .dt-paging-button.current:hover {
    background: #7c3aed !important;
    border-color: #7c3aed !important;
    color: #fff !important;
}

div.dt-container .dt-paging .dt-paging-button.disabled,
div.dt-container .dt-paging .dt-paging-button.disabled:hover {
    opacity: 0.45;
    background: #f8fafc !important;
}

[data-bs-theme="dark"] div.dt-container .dt-paging .dt-paging-button {
    background: #1e2130 !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] div.dt-container .dt-paging .dt-paging-button.current {
    background: #7c3aed !important;
    border-color: #7c3aed !important;
    color: #fff !important;
}

.modal-pick-table-wrap div.dt-container {
    padding: 0.5rem 0;
}

/* Menu checkbox tree */
.menu-check-item { margin-bottom: 0.5rem; }
.menu-checkbox-tree { max-height: 500px; overflow-y: auto; }

/* Mobile */
@media (max-width: 991px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    body.sidebar-collapsed .app-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    body.sidebar-collapsed .app-main {
        margin-left: 0;
    }
    body.sidebar-collapsed .sidebar-logo-full {
        display: block;
    }
    body.sidebar-collapsed .sidebar-logo-favicon {
        display: none;
    }
    body.sidebar-collapsed .sidebar-nav .nav-link {
        justify-content: flex-start;
        padding: 0.6rem 1.25rem;
        gap: 0.6rem;
    }
    body.sidebar-collapsed .sidebar-nav .nav-link span,
    body.sidebar-collapsed .sidebar-nav .submenu-arrow {
        display: inline !important;
    }
    body.sidebar-collapsed .sidebar-nav .collapse {
        display: block !important;
    }
    .topbar-rate-group {
        max-width: 100%;
        order: 3;
        width: 100%;
        justify-content: flex-end;
    }
    .rate-pill {
        max-width: calc(100vw - 150px);
        overflow: hidden;
    }
    .app-header {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    .app-content {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    #dashboardCalendar .fc-toolbar.fc-header-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    #dashboardCalendar .fc .fc-toolbar-chunk {
        justify-content: center;
        flex-wrap: wrap;
    }
    #dashboardCalendar .fc-daygrid-day-frame {
        min-height: 78px;
    }
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Sidebar logo */
.sidebar-logo-img {
    display: block;
    max-height: 52px;
    max-width: 180px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.18));
}

.sidebar-brand {
    gap: 0.6rem;
}

body.sidebar-collapsed .sidebar-brand {
    padding: 1rem 0.75rem;
}

body.sidebar-collapsed .sidebar-brand-link {
    width: 52px;
    min-height: 52px;
    margin-inline: auto;
}

body.sidebar-collapsed .sidebar-logo-full {
    display: none;
}

body.sidebar-collapsed .sidebar-logo-favicon {
    display: block;
}

body.sidebar-collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding: 0.8rem 0.5rem;
    gap: 0;
}

body.sidebar-collapsed .sidebar-nav .nav-link span,
body.sidebar-collapsed .sidebar-nav .submenu-arrow,
body.sidebar-collapsed .sidebar-nav .collapse {
    display: none !important;
}

body.sidebar-collapsed .sidebar-nav .nav-link > i:first-child {
    margin: 0;
    font-size: 1.1rem;
}

/* Header rates pill — görseldeki mor badge stili */
.topbar-rate-group {
    max-width: 420px;
}

.rate-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--rate-pill-bg);
    border: 1px solid var(--rate-pill-border);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.78rem;
    white-space: nowrap;
    transition: opacity 0.2s ease;
    min-height: 32px;
    box-shadow: 0 10px 24px rgba(91, 33, 182, 0.10);
}

.rate-pill.rate-pill-fade {
    opacity: 0;
}

.rate-pill-code {
    font-weight: 700;
    color: var(--rate-pill-code);
    font-size: 0.82rem;
}

.rate-pill-date {
    font-size: 0.72rem;
}

.rate-pill-sep {
    color: #94a3b8;
    font-weight: 300;
}

.rate-pill-values {
    font-weight: 600;
    color: #334155;
}

[data-bs-theme="dark"] .rate-pill-values {
    color: #e2e8f0;
}

.rate-pill-currency {
    font-weight: 500;
    color: #64748b;
}

#btnTopbarRatesRefresh.spinning i {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.rate-table-code {
    font-weight: 700;
    color: var(--rate-pill-code);
}

.db-version-badge {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Settings */
.logo-preview-box {
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(248,250,252,0.92));
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-preview-box img {
    max-height: 100px;
    max-width: 100%;
}

.favicon-preview-box {
    min-height: 120px;
}

.favicon-preview-box img {
    max-width: 48px;
    max-height: 48px;
}

.rate-card .rate-code {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Calendar — sidebar + main */
.app-calendar-sidebar {
    background: #fafbfc;
}

@media (min-width: 992px) {
    .app-calendar-sidebar {
        max-width: 300px;
        flex: 0 0 300px;
    }

    .app-calendar-main {
        flex: 1 1 auto;
        min-width: 0;
    }
}

.app-calendar-filter-item {
    cursor: pointer;
    color: #334155;
    user-select: none;
}

.app-calendar-filter-item .filter-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

#dashboardCalendarMini {
    --fc-border-color: transparent;
    --fc-today-bg-color: transparent;
}

.mini-month-picker .fc {
    font-size: 0.8rem;
}

.mini-month-picker .fc-toolbar {
    margin-bottom: 0.75rem !important;
    gap: 0.5rem;
}

.mini-month-picker .fc-toolbar-title {
    font-size: 0.95rem !important;
    font-weight: 700;
    color: #1e293b;
    text-transform: capitalize;
    text-align: left;
}

.mini-month-picker .fc-toolbar-chunk {
    display: flex;
    align-items: center;
}

.mini-month-picker .fc-toolbar-chunk:last-child {
    gap: 0.35rem;
}

.mini-month-picker .fc-button {
    border-radius: 50% !important;
    width: 2rem;
    height: 2rem;
    padding: 0 !important;
    font-size: 0.8rem !important;
    box-shadow: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mini-month-picker .fc-button-primary {
    background: #f1f5f9;
    border-color: #f1f5f9;
    color: #64748b;
}

.mini-month-picker .fc-button-primary:hover {
    background: #e2e8f0;
    border-color: #e2e8f0;
    color: #334155;
}

.mini-month-picker .fc-col-header-cell {
    border: none;
}

.mini-month-picker .fc-col-header-cell-cushion {
    font-size: 0.7rem;
    font-weight: 500;
    color: #94a3b8;
    padding: 0.35rem 0;
    text-decoration: none;
}

.mini-month-picker .fc-daygrid-day-frame {
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-month-picker .fc-daygrid-day-top {
    flex-direction: row;
    justify-content: center;
    width: 100%;
}

.mini-month-picker .fc-daygrid-day-number {
    font-size: 0.78rem;
    font-weight: 500;
    color: #334155 !important;
    text-decoration: none !important;
    float: none;
    padding: 0;
    width: 1.85rem;
    height: 1.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
}

.mini-month-picker .fc-day-other .fc-daygrid-day-number {
    color: #cbd5e1 !important;
}

.mini-month-picker .fc-day-today .fc-daygrid-day-number {
    background: #ede9fe;
    color: #7c3aed !important;
    font-weight: 700;
}

.mini-month-picker .fc-daygrid-day.mini-cal-selected .fc-daygrid-day-number {
    background: #ddd6fe;
    color: #6d28d9 !important;
    font-weight: 700;
}

.mini-month-picker .fc-scrollgrid,
.mini-month-picker .fc-theme-standard td,
.mini-month-picker .fc-theme-standard th {
    border: none;
}

.mini-month-picker .fc-daygrid-day {
    cursor: pointer;
}

.mini-month-picker .fc-daygrid-day:hover .fc-daygrid-day-number {
    background: #f1f5f9;
}

.calendar-event-modal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

[data-bs-theme="dark"] .mini-month-picker .fc-toolbar-title {
    color: #f1f5f9;
}

[data-bs-theme="dark"] .mini-month-picker .fc-daygrid-day-number {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .mini-month-picker .fc-day-other .fc-daygrid-day-number {
    color: #475569 !important;
}

[data-bs-theme="dark"] .app-calendar-sidebar {
    background: #1a1d2b;
}

[data-bs-theme="dark"] .app-calendar-filter-item {
    color: #e2e8f0;
}

.dashboard-calendar-card {
    border-radius: 20px;
    overflow: hidden;
}

#dashboardCalendar {
    min-height: 520px;
    width: 100%;
}

#dashboardCalendar .fc {
    width: 100%;
}

#dashboardCalendar .fc-view-harness {
    min-height: 460px;
}

#dashboardCalendar .fc-toolbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-transform: capitalize;
}

#dashboardCalendar .fc-toolbar {
    margin-bottom: 1.25rem;
}

#dashboardCalendar .fc-toolbar.fc-header-toolbar {
    gap: 0.75rem;
    align-items: center;
}

#dashboardCalendar .fc .fc-toolbar-chunk {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#dashboardCalendar .fc-button {
    border-radius: 10px !important;
    font-size: 0.85rem !important;
    font-weight: 600;
    box-shadow: none !important;
    padding: 0.55rem 0.95rem !important;
}

#dashboardCalendar .fc-button-primary {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #475569;
}

#dashboardCalendar .fc-button-primary:hover,
#dashboardCalendar .fc-button-primary:focus {
    background: #ede9fe;
    border-color: #ddd6fe;
    color: #6d28d9;
}

#dashboardCalendar .fc-button-primary:not(:disabled).fc-button-active,
#dashboardCalendar .fc-button-primary:not(:disabled):active {
    background: #ede9fe;
    border-color: #ddd6fe;
    color: #7c3aed;
}

#dashboardCalendar .fc .fc-prev-button,
#dashboardCalendar .fc .fc-next-button {
    width: 40px;
    padding: 0.55rem 0 !important;
}

#dashboardCalendar .fc-theme-standard td,
#dashboardCalendar .fc-theme-standard th,
#dashboardCalendar .fc-scrollgrid {
    border-color: rgba(226, 232, 240, 0.85);
}

#dashboardCalendar .fc-scrollgrid {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.95);
}

#dashboardCalendar .fc-col-header-cell {
    background: #fff;
    padding: 0.3rem 0;
}

#dashboardCalendar .fc-col-header-cell-cushion {
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    padding: 0.8rem 0.35rem;
}

#dashboardCalendar .fc-daygrid-day-frame {
    min-height: 108px;
    background: #fff;
}

#dashboardCalendar .fc-daygrid-day-number {
    font-size: 0.92rem;
    color: #64748b;
    padding: 0.6rem 0.75rem 0;
}

#dashboardCalendar .fc-day-other .fc-daygrid-day-number {
    color: #cbd5e1;
}

#dashboardCalendar .fc-day-today {
    background: rgba(124, 58, 237, 0.05) !important;
}

#dashboardCalendar .fc-day-today .fc-daygrid-day-number {
    color: #7c3aed;
    font-weight: 700;
}

#dashboardCalendar .fc-col-header-cell-cushion,
#dashboardCalendar .fc-daygrid-day-number,
#dashboardCalendar .fc-list-day-text,
#dashboardCalendar .fc-list-day-side-text {
    color: inherit;
    text-decoration: none;
}

#dashboardCalendar .fc-daygrid-event {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    padding: 0.22rem 0.45rem;
    font-size: 0.78rem;
    font-weight: 600;
}

#dashboardCalendar .fc-list-event {
    cursor: pointer;
}

#dashboardCalendar .fc-h-event {
    background: #ede9fe;
    color: #7c3aed;
}

#dashboardCalendar .fc-list-event-dot {
    border-color: #7c3aed;
}

#dashboardCalendar .fc .fc-daygrid-more-link {
    color: #64748b;
    font-size: 0.78rem;
    margin-top: 0.2rem;
}

[data-bs-theme="dark"] #dashboardCalendar .fc-button-primary {
    background: #25293c;
    border-color: #31364d;
    color: #cbd5e1;
}

[data-bs-theme="dark"] #dashboardCalendar .fc-button-primary:hover,
[data-bs-theme="dark"] #dashboardCalendar .fc-button-primary:not(:disabled).fc-button-active {
    background: #3b315f;
    border-color: #55458c;
    color: #ddd6fe;
}

[data-bs-theme="dark"] #dashboardCalendar .fc-col-header-cell,
[data-bs-theme="dark"] #dashboardCalendar .fc-daygrid-day-frame {
    background: #1e2130;
}

[data-bs-theme="dark"] #dashboardCalendar .fc-scrollgrid,
[data-bs-theme="dark"] #dashboardCalendar .fc-theme-standard td,
[data-bs-theme="dark"] #dashboardCalendar .fc-theme-standard th {
    border-color: rgba(71, 85, 105, 0.5);
}

[data-bs-theme="dark"] #dashboardCalendar .fc-daygrid-day-number,
[data-bs-theme="dark"] #dashboardCalendar .fc-col-header-cell-cushion {
    color: #cbd5e1;
}

.card {
    border: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.kpi-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.95));
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .logo-preview-box {
    border-color: rgba(148, 163, 184, 0.10);
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.35);
}

/* Messaging widget */
#btnMessagingToggle.has-unread,
.msg-fab.has-unread {
    border-color: #8b5cf6 !important;
    background: rgba(139, 92, 246, 0.1) !important;
}

#btnMessagingToggle.has-unread #messagingHeaderIcon,
.msg-fab.has-unread i {
    color: #7c3aed;
}

.messaging-unread-badge {
    font-size: 0.65rem;
    min-width: 1.1rem;
    padding: 0.2em 0.45em;
}

.header-profile-link:hover .text-muted {
    color: #6366f1 !important;
}

.header-profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(99, 102, 241, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.header-profile-initial {
    font-size: 0.85rem;
    font-weight: 700;
    color: #6366f1;
}

.msg-widget {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1055;
}

.msg-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.msg-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
    color: #fff;
}

.msg-fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.msg-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(920px, calc(100vw - 2rem));
    height: min(640px, calc(100vh - 6rem));
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    flex-direction: column;
}

.msg-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}

.msg-panel-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

.msg-panel-close {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    text-decoration: none;
}

.msg-panel-close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #6366f1 !important;
}

.msg-panel-inner {
    display: flex;
    flex: 1;
    min-height: 0;
}

.msg-sidebar {
    width: 320px;
    min-width: 280px;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
}

.msg-sidebar-head {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.msg-search-wrap {
    position: relative;
    margin-bottom: 0.75rem;
}

.msg-search-wrap i {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.85rem;
}

.msg-search-wrap input {
    padding-left: 2rem;
    border-radius: 10px;
    background: #f8fafc;
}

.msg-tabs {
    display: flex;
    gap: 0.35rem;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 10px;
}

.msg-tab {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
}

.msg-tab.active {
    background: #fff;
    color: #6366f1;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.msg-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.msg-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    padding: 0.35rem 0.5rem;
}

.msg-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.msg-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 0.65rem 0.6rem;
    border-radius: 12px;
    transition: background 0.15s ease;
    position: relative;
}

.msg-list-item:hover,
.msg-list-item.unread {
    background: #fff;
}

.msg-list-item.unread {
    box-shadow: inset 3px 0 0 #8b5cf6;
}

.msg-list-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.msg-list-avatar.user-tone { background: rgba(14, 165, 233, 0.12); color: #0ea5e9; }
.msg-list-avatar.dept-tone { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.msg-list-avatar.role-tone { background: rgba(16, 185, 129, 0.12); color: #10b981; }

.msg-list-body { flex: 1; min-width: 0; }

.msg-list-top {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: baseline;
}

.msg-list-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-list-time {
    font-size: 0.7rem;
    color: #94a3b8;
    flex-shrink: 0;
}

.msg-list-preview {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-list-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8b5cf6;
    flex-shrink: 0;
}

.msg-empty {
    text-align: center;
    color: #94a3b8;
    padding: 1.5rem 0.75rem;
    font-size: 0.85rem;
}

.msg-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f1f5f9;
}

.msg-main-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.msg-back-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    text-decoration: none;
}

.msg-back-btn:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #6366f1 !important;
}

.msg-main-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msg-main-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
}

.msg-main-sub {
    font-size: 0.75rem;
    color: #64748b;
}

.msg-history-wrap {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem 0.5rem;
    min-height: 0;
    position: relative;
}

.msg-history-loader {
    position: absolute;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.msg-history {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding-bottom: 0.5rem;
}

.msg-bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 85%;
}

.msg-bubble-row.mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-bubble-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.msg-bubble-avatar.mine {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.msg-bubble-wrap { min-width: 0; }

.msg-bubble-sender {
    font-size: 0.7rem;
    color: #64748b;
    margin-bottom: 0.15rem;
    padding-left: 0.35rem;
}

.msg-bubble {
    background: #fff;
    border-radius: 14px 14px 14px 4px;
    padding: 0.55rem 0.75rem;
    font-size: 0.875rem;
    color: #0f172a;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    word-break: break-word;
}

.msg-bubble-row.mine .msg-bubble {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #fff;
    border-radius: 14px 14px 4px 14px;
}

.msg-bubble-time {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 0.2rem;
    padding: 0 0.35rem;
}

.msg-compose {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem 1rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.msg-compose input {
    border-radius: 12px;
    flex: 1;
}

.msg-send-btn {
    border-radius: 12px;
    width: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msg-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    text-align: center;
    padding: 2rem;
}

.msg-placeholder i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

@media (max-width: 767.98px) {
    .msg-panel {
        width: calc(100vw - 1rem);
        height: calc(100vh - 5rem);
        right: -0.25rem;
    }

    .msg-sidebar {
        width: 100%;
        min-width: 0;
    }

    .msg-main {
        width: 100%;
    }
}

[data-bs-theme="dark"] .msg-panel {
    background: #1e2130;
    border-color: rgba(71, 85, 105, 0.5);
}

[data-bs-theme="dark"] .msg-panel-head {
    background: #1e2130;
    border-color: #334155;
}

[data-bs-theme="dark"] .msg-panel-title {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .msg-sidebar,
[data-bs-theme="dark"] .msg-main-head,
[data-bs-theme="dark"] .msg-compose {
    background: #1a1d2b;
    border-color: #334155;
}

[data-bs-theme="dark"] .msg-sidebar-head {
    background: #1e2130;
}

[data-bs-theme="dark"] .msg-list-name,
[data-bs-theme="dark"] .msg-main-title {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .msg-bubble {
    background: #25293c;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .msg-main {
    background: #141622;
}

.profile-avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(99, 102, 241, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-initial,
.msg-avatar-initial {
    font-weight: 700;
    font-size: 1.35rem;
    color: #6366f1;
}

.msg-list-avatar img,
.msg-bubble-avatar img,
.msg-main-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

.msg-list-avatar,
.msg-bubble-avatar,
.msg-main-avatar {
    overflow: hidden;
}

.msg-list-avatar.role-tone,
.msg-main-avatar.role-tone {
    background: rgba(16, 185, 129, 0.12);
}

.msg-list-avatar.role-tone .msg-avatar-initial,
.msg-main-avatar.role-tone .msg-avatar-initial {
    color: #10b981;
}

.msg-bubble-avatar .msg-avatar-initial {
    font-size: 0.75rem;
}
