:root {
    color-scheme: light;
    --app-bg: #F6F8FC;
    --app-surface: #ffffff;
    --app-surface-soft: #F8FAFC;
    --app-text: #0F172A;
    --app-muted: #64748B;
    --app-border: #E5EAF2;
    --app-primary: #2563EB;
    --app-primary-dark: #1D4ED8;
    --app-primary-soft: #EFF6FF;
    --app-success: #22C55E;
    --app-danger: #EF4444;
    --app-warning: #F59E0B;
    --app-edit: #4F46E5;
    --app-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
    --app-shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
    --app-sidebar-width: 270px;
}

html {
    font-size: 80%;
}

html[data-app-theme="dark"] {
    color-scheme: dark;
    --bs-body-color: #E5E7EB;
    --bs-secondary-color: #94A3B8;
    --bs-border-color: #273449;
    --app-bg: #0F172A;
    --app-surface: #111827;
    --app-surface-soft: #1E293B;
    --app-text: #E5E7EB;
    --app-muted: #94A3B8;
    --app-border: #273449;
    --app-primary: #60A5FA;
    --app-primary-dark: #3B82F6;
    --app-primary-soft: rgba(96, 165, 250, 0.14);
    --app-success: #4ADE80;
    --app-danger: #F87171;
    --app-warning: #FBBF24;
    --app-edit: #A78BFA;
    --app-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
    --app-shadow-soft: 0 14px 34px rgba(0, 0, 0, 0.22);
}

* {
    letter-spacing: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 56% 0%, rgba(219, 234, 254, 0.7), transparent 34rem),
        linear-gradient(135deg, #F8FAFC 0%, var(--app-bg) 56%, #EEF4FF 100%);
    color: var(--app-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-app-theme="dark"] body {
    background:
        radial-gradient(circle at 58% 0%, rgba(37, 99, 235, 0.2), transparent 34rem),
        linear-gradient(135deg, #020617 0%, var(--app-bg) 58%, #111827 100%);
}

a {
    color: var(--app-primary);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--app-sidebar-width) minmax(0, 1fr);
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.9rem 1.25rem;
    background: #fff;
    border-right: 1px solid #E8EDF5;
    box-shadow: 16px 0 42px rgba(15, 23, 42, 0.035);
    overflow: hidden;
    z-index: 20;
}

html[data-app-theme="dark"] .app-sidebar {
    background: rgba(17, 24, 39, 0.96);
    border-right-color: var(--app-border);
    box-shadow: 16px 0 42px rgba(0, 0, 0, 0.22);
}

.app-brand {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--app-text);
    text-decoration: none;
    font-size: 1.55rem;
    font-weight: 800;
}

.app-brand:hover {
    color: var(--app-text);
}

.app-brand-mark {
    width: 3.9rem;
    height: 3.9rem;
    display: inline-grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, #DBEAFE, #EFF6FF);
    color: var(--app-primary);
    box-shadow: inset 0 -12px 22px rgba(37, 99, 235, 0.08);
    font-size: 1.75rem;
    line-height: 1;
}

html[data-app-theme="dark"] .app-brand-mark {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.34), rgba(96, 165, 250, 0.16));
    box-shadow: inset 0 -12px 22px rgba(96, 165, 250, 0.08);
}

.app-mobile-toggle {
    display: none;
}

.app-nav-collapse {
    min-height: 0;
    flex: 1 1 auto;
    display: block;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.35) transparent;
}

.app-nav-collapse::-webkit-scrollbar {
    width: 0.45rem;
}

.app-nav-collapse::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.35);
}

.app-nav-collapse::-webkit-scrollbar-track {
    background: transparent;
}

.app-sidebar .collapse:not(.show) {
    display: block;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.app-nav-item {
    list-style: none;
}

.app-nav-link,
.app-logout {
    min-height: 3.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    color: #475569;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

html[data-app-theme="dark"] .app-nav-link,
html[data-app-theme="dark"] .app-logout {
    color: #CBD5E1;
}

.app-nav-link:hover,
.app-logout:hover,
.app-nav-link.active {
    color: var(--app-primary);
    background: #EFF6FF;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.04);
}

html[data-app-theme="dark"] .app-nav-link:hover,
html[data-app-theme="dark"] .app-logout:hover,
html[data-app-theme="dark"] .app-nav-link.active {
    background: rgba(96, 165, 250, 0.14);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.08);
}

.app-nav-link:hover,
.app-logout:hover {
    transform: translateX(2px);
}

.app-nav-icon {
    width: 1.95rem;
    height: 1.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.08);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
}

html[data-app-theme="dark"] .app-nav-icon {
    background: rgba(96, 165, 250, 0.12);
}

.app-logout {
    margin-top: auto;
    background: #F8FAFC;
    color: #475569;
}

html[data-app-theme="dark"] .app-logout {
    background: rgba(30, 41, 59, 0.78);
}

.app-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.app-topbar {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.35rem 2.75rem;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid #E8EDF5;
    backdrop-filter: blur(14px);
}

.app-module-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
}

html[data-app-theme="dark"] .app-module-switcher {
    background: rgba(15, 23, 42, 0.44);
}

.app-module-pill {
    min-height: 2.55rem;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.9rem;
    border-radius: 12px;
    color: var(--app-muted);
    text-decoration: none;
    font-weight: 800;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.app-module-pill:hover,
.app-module-pill.active {
    color: var(--app-primary);
    background: var(--app-primary-soft);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.app-module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.app-module-card {
    position: relative;
    min-height: 18rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 2rem;
    color: var(--app-text);
    text-decoration: none;
    overflow: hidden;
    border: 1px solid rgba(229, 234, 242, 0.86);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--app-shadow);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.app-module-card:hover {
    color: var(--app-text);
    transform: translateY(-3px);
    border-color: rgba(37, 99, 235, 0.22);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

html[data-app-theme="dark"] .app-module-card {
    background: rgba(17, 24, 39, 0.94);
    border-color: rgba(148, 163, 184, 0.16);
}

.app-module-card-icon {
    width: 4rem;
    height: 4rem;
    display: inline-grid;
    place-items: center;
    border-radius: 18px;
    background: var(--app-primary-soft);
    color: var(--app-primary);
    font-size: 1.85rem;
}

.app-module-card-title {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 800;
}

.app-module-card-text {
    max-width: 34rem;
    margin: 0.65rem 0 0;
    color: var(--app-muted);
    font-weight: 500;
}

.app-module-card-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--app-primary);
    font-weight: 800;
}

html[data-app-theme="dark"] .app-topbar {
    background: rgba(17, 24, 39, 0.88);
    border-bottom-color: var(--app-border);
}

.app-topbar-date {
    color: #46536c;
    font-weight: 500;
}

html[data-app-theme="dark"] .app-topbar-date,
html[data-app-theme="dark"] .app-profile-toggle {
    color: #CBD5E1;
}

.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-notification {
    position: relative;
    width: 2.8rem;
    height: 2.8rem;
    display: inline-grid;
    place-items: center;
    color: var(--app-text);
    font-size: 1.22rem;
    border: 1px solid transparent;
    border-radius: 14px;
    background: #fff;
}

.app-theme-toggle {
    width: 4.45rem;
    height: 2.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 999px;
    background: #fff;
    color: var(--app-primary);
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.app-theme-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(37, 99, 235, 0.18);
    background: var(--app-primary-soft);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.12);
}

.app-theme-toggle-track {
    position: relative;
    width: 3.75rem;
    height: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    justify-items: center;
    border-radius: 999px;
    background: #EFF6FF;
}

.app-theme-toggle-track i {
    position: relative;
    z-index: 2;
    font-size: 0.98rem;
    line-height: 1;
    transition: color 0.18s ease, opacity 0.18s ease;
}

.app-theme-sun {
    color: #F59E0B;
}

.app-theme-moon {
    color: #64748B;
}

.app-theme-toggle-thumb {
    position: absolute;
    top: 0.2rem;
    left: 0.2rem;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.14);
    transition: transform 0.2s ease, background 0.2s ease;
}

.app-theme-toggle[data-theme="dark"] .app-theme-toggle-thumb {
    transform: translateX(1.75rem);
}

.app-theme-toggle[data-theme="dark"] .app-theme-sun {
    color: #94A3B8;
}

.app-theme-toggle[data-theme="dark"] .app-theme-moon {
    color: #BFDBFE;
}

html[data-app-theme="dark"] .app-notification,
html[data-app-theme="dark"] .app-theme-toggle {
    background: rgba(30, 41, 59, 0.86);
    border-color: rgba(148, 163, 184, 0.12);
    color: var(--app-text);
}

html[data-app-theme="dark"] .app-theme-toggle-track {
    background: rgba(15, 23, 42, 0.88);
}

html[data-app-theme="dark"] .app-theme-toggle-thumb {
    background: #1E293B;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
}

.app-notification span {
    position: absolute;
    top: 0.15rem;
    right: 0.15rem;
    min-width: 1.05rem;
    height: 1.05rem;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: var(--app-danger);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
}

.app-notification-menu {
    width: min(24rem, calc(100vw - 1.5rem));
    padding: 0;
    overflow: hidden;
}

.app-notification-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--app-border);
}

.app-notification-list {
    max-height: 24rem;
    overflow-y: auto;
}

.app-notification-empty {
    padding: 1rem;
    color: var(--app-muted);
}

.app-notification-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.95rem 1rem;
    color: var(--app-text);
    text-decoration: none;
    border-bottom: 1px solid var(--app-border);
}

.app-notification-item:last-child {
    border-bottom: 0;
}

.app-notification-item:hover {
    color: var(--app-text);
    background: var(--app-primary-soft);
}

.app-notification-item.is-unread {
    background: rgba(37, 99, 235, 0.06);
}

.app-notification-item-icon {
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    background: var(--app-primary-soft);
    color: var(--app-primary);
}

.app-notification-item-body {
    min-width: 0;
    display: grid;
    gap: 0.2rem;
}

.app-notification-item-body .small {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.app-notifications-page-list {
    display: grid;
    gap: 0.85rem;
}

.app-notification-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--app-border);
    border-radius: 18px;
    background: var(--app-surface-soft);
}

.app-notification-card.is-unread {
    background: #EFF6FF;
    border-color: rgba(37, 99, 235, 0.18);
}

.app-notification-card-body {
    min-width: 0;
    flex: 1 1 auto;
}

.category-color-dot {
    width: 0.85rem;
    height: 0.85rem;
    flex: 0 0 auto;
    display: inline-block;
    border-radius: 999px;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
}

.app-avatar {
    width: 3.35rem;
    height: 3.35rem;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: #DBEAFE;
    color: var(--app-primary);
    font-weight: 800;
    box-shadow: inset 0 -12px 24px rgba(37, 99, 235, 0.08);
}

html[data-app-theme="dark"] .app-avatar {
    background: rgba(96, 165, 250, 0.18);
    color: #BFDBFE;
}

.app-avatar-image {
    object-fit: cover;
    background: #fff;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.app-profile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: #475569;
}

.app-main > main.container,
.app-main > main.container-fluid {
    width: min(100%, 1480px);
    max-width: 1480px;
    padding: 2.6rem 2.4rem 1.5rem !important;
    min-width: 0;
}

.app-main > main.container > .d-flex:first-child,
.app-main > main.container-fluid > .d-flex:first-child {
    margin-bottom: 2.6rem !important;
}

h1,
.h1 {
    color: var(--app-text);
    font-weight: 700;
}

h2,
.h2,
h3,
.h3,
h4,
.h4,
h5,
.h5 {
    color: var(--app-text);
    font-weight: 700;
}

.text-secondary {
    color: var(--app-muted) !important;
}

.app-panel {
    min-width: 0;
    max-width: 100%;
    background: #FFFFFF;
    border: 1px solid rgba(229, 234, 242, 0.78);
    border-radius: 24px;
    box-shadow: var(--app-shadow);
    overflow-wrap: anywhere;
}

html[data-app-theme="dark"] .app-panel {
    background: rgba(17, 24, 39, 0.94);
    border-color: rgba(148, 163, 184, 0.16);
    color: var(--app-text);
}

.app-panel.p-4 {
    padding: 1.9rem !important;
}

.app-panel > h2:first-child,
.app-panel > .d-flex:first-child h2 {
    margin-bottom: 0;
}

.app-section-heading {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.app-section-icon {
    width: 3.4rem;
    height: 3.4rem;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    background: #EFF6FF;
    color: var(--app-primary);
    font-size: 1.5rem;
}

html[data-app-theme="dark"] .app-section-icon {
    background: rgba(96, 165, 250, 0.12);
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    border-radius: 18px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    min-width: 860px;
    margin-bottom: 0;
    color: var(--app-text);
    --bs-table-color: var(--app-text);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--app-border);
}

.table > :not(caption) > * > * {
    min-height: 90px;
    padding: 1.45rem 1rem;
    border-bottom-color: var(--app-border);
    background: transparent;
    vertical-align: middle;
    overflow-wrap: anywhere;
    word-break: normal;
}

.table thead th {
    color: #61708a;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.table td,
.table th {
    max-width: 18rem;
}

.table td.text-end,
.table th.text-end,
.table td:last-child,
.table th:last-child {
    max-width: none;
    white-space: nowrap;
}

.table td .d-inline-flex,
.table td .d-flex {
    min-width: 0;
}

.table tbody tr:last-child > * {
    border-bottom: 0;
}

.table tbody td:first-child .fw-semibold,
.table tbody td.fw-semibold,
.table tbody a.fw-semibold {
    color: var(--app-primary);
    font-weight: 800 !important;
}

.app-table-break {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.app-menu-table {
    min-width: 1180px;
    table-layout: fixed;
}

.app-menu-table th:nth-child(1),
.app-menu-table td:nth-child(1) {
    width: 16%;
}

.app-menu-table th:nth-child(2),
.app-menu-table td:nth-child(2) {
    width: 19%;
}

.app-menu-table th:nth-child(3),
.app-menu-table td:nth-child(3) {
    width: 10%;
}

.app-menu-table th:nth-child(4),
.app-menu-table td:nth-child(4) {
    width: 10%;
}

.app-menu-table th:nth-child(5),
.app-menu-table td:nth-child(5) {
    width: 10%;
}

.app-menu-table th:nth-child(6),
.app-menu-table td:nth-child(6) {
    width: 14%;
}

.app-menu-table th:nth-child(7),
.app-menu-table td:nth-child(7) {
    width: 8%;
}

.app-menu-table th:nth-child(8),
.app-menu-table td:nth-child(8) {
    width: 9%;
}

.app-menu-table th:nth-child(9),
.app-menu-table td:nth-child(9) {
    width: 14%;
}

.app-menu-table td.text-end .d-inline-flex {
    justify-content: flex-start !important;
}

.btn {
    min-height: 42px;
    border-radius: 12px;
    padding: 0.62rem 1.05rem;
    font-weight: 700;
    box-shadow: none;
}

.btn-sm {
    min-height: 38px;
    padding: 0.45rem 0.85rem;
    font-size: 0.86rem;
}

.btn-primary {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    border-color: #2563EB;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.20);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1D4ED8, var(--app-primary-dark));
    border-color: var(--app-primary-dark);
}

.btn-outline-secondary,
.btn-outline-info {
    color: var(--app-primary);
    border-color: rgba(37, 99, 235, 0.65);
    background: #fff;
}

html[data-app-theme="dark"] .btn-outline-secondary,
html[data-app-theme="dark"] .btn-outline-info,
html[data-app-theme="dark"] .btn-outline-primary,
html[data-app-theme="dark"] .btn-outline-edit,
html[data-app-theme="dark"] .btn-outline-success,
html[data-app-theme="dark"] .btn-outline-danger {
    background: rgba(15, 23, 42, 0.34);
}

.btn-outline-secondary:hover,
.btn-outline-info:hover {
    color: #fff;
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-outline-primary,
.btn-outline-edit {
    color: var(--app-edit);
    border-color: rgba(79, 70, 229, 0.68);
    background: #fff;
}

.btn-outline-primary:hover,
.btn-outline-edit:hover {
    color: #fff;
    background: var(--app-edit);
    border-color: var(--app-edit);
}

.btn-outline-success {
    color: var(--app-success);
    border-color: rgba(34, 197, 94, 0.62);
    background: #fff;
}

.btn-outline-success:hover,
.btn-success {
    color: #fff;
    background: var(--app-success);
    border-color: var(--app-success);
}

.btn-outline-danger {
    color: var(--app-danger);
    border-color: rgba(239, 68, 68, 0.62);
    background: #fff;
}

.btn-outline-danger:hover {
    color: #fff;
    background: var(--app-danger);
    border-color: var(--app-danger);
}

.form-control,
.form-select {
    min-height: 2.9rem;
    border-radius: 10px;
    border-color: var(--app-border);
    color: var(--app-text);
    background-color: #fff;
}

html[data-app-theme="dark"] .form-control,
html[data-app-theme="dark"] .form-select {
    color: var(--app-text);
    background-color: #0F172A;
    border-color: var(--app-border);
}

html[data-app-theme="dark"] .form-control::placeholder {
    color: #64748B;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
}

.form-label {
    color: #485772;
    font-weight: 700;
}

html[data-app-theme="dark"] .form-label {
    color: #CBD5E1;
}

.badge {
    border-radius: 8px;
    padding: 0.48rem 0.72rem;
    font-weight: 800;
}

.text-bg-success {
    color: #15803D !important;
    background: #DCFCE7 !important;
}

html[data-app-theme="dark"] .text-bg-success {
    color: #BBF7D0 !important;
    background: rgba(34, 197, 94, 0.16) !important;
}

.text-bg-success::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    display: inline-block;
    margin-right: 0.5rem;
    border-radius: 999px;
    background: #22C55E;
    vertical-align: 0.05rem;
}

.text-bg-secondary {
    color: #566176 !important;
    background: #edf1f7 !important;
}

html[data-app-theme="dark"] .text-bg-secondary,
html[data-app-theme="dark"] .text-bg-light {
    color: #CBD5E1 !important;
    background: rgba(148, 163, 184, 0.14) !important;
}

.text-bg-info {
    color: #075f94 !important;
    background: #e3f5ff !important;
}

html[data-app-theme="dark"] .text-bg-info {
    color: #BAE6FD !important;
    background: rgba(14, 165, 233, 0.16) !important;
}

.text-bg-light {
    color: #59667b !important;
    background: #f5f8fe !important;
}

.alert {
    border: 0;
    border-radius: 14px;
    box-shadow: var(--app-shadow-soft);
}

.modal-content {
    border: 1px solid var(--app-border);
    border-radius: 18px;
    box-shadow: var(--app-shadow);
}

html[data-app-theme="dark"] .modal-content,
html[data-app-theme="dark"] .dropdown-menu {
    background: #111827;
    border-color: var(--app-border);
    color: var(--app-text);
}

.modal-dialog {
    max-width: min(96vw, 720px);
}

.modal-dialog.modal-lg {
    max-width: min(96vw, 860px);
}

.modal-dialog-scrollable .modal-body {
    max-height: calc(100vh - 13rem);
}

.modal-header,
.modal-footer {
    border-color: var(--app-border);
}

.dropdown-menu {
    border: 1px solid var(--app-border);
    border-radius: 14px;
    box-shadow: var(--app-shadow-soft);
}

html[data-app-theme="dark"] .dropdown-item,
html[data-app-theme="dark"] .dropdown-item-text {
    color: var(--app-text);
}

html[data-app-theme="dark"] .dropdown-item:hover,
html[data-app-theme="dark"] .dropdown-item:focus {
    color: var(--app-text);
    background: rgba(96, 165, 250, 0.14);
}

html[data-app-theme="dark"] .dropdown-divider,
html[data-app-theme="dark"] .modal-header,
html[data-app-theme="dark"] .modal-footer {
    border-color: var(--app-border);
}

html[data-app-theme="dark"] .app-notification-item.is-unread,
html[data-app-theme="dark"] .app-notification-card.is-unread {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.18);
}

html[data-app-theme="dark"] .app-notification-item:hover {
    background: rgba(96, 165, 250, 0.14);
}

html[data-app-theme="dark"] .app-notification-card {
    background: rgba(30, 41, 59, 0.74);
}

html[data-app-theme="dark"] .card,
html[data-app-theme="dark"] .list-group-item,
html[data-app-theme="dark"] .bg-white,
html[data-app-theme="dark"] .border {
    background-color: var(--app-surface) !important;
    border-color: var(--app-border) !important;
    color: var(--app-text);
}

html[data-app-theme="dark"] .table {
    color: var(--app-text);
    --bs-table-color: var(--app-text);
    --bs-table-bg: transparent;
    --bs-table-striped-color: var(--app-text);
    --bs-table-hover-color: var(--app-text);
    --bs-table-border-color: var(--app-border);
}

html[data-app-theme="dark"] .table > :not(caption) > * > * {
    color: var(--app-text);
    border-bottom-color: var(--app-border);
}

html[data-app-theme="dark"] .table thead th {
    color: #94A3B8;
}

html[data-app-theme="dark"] .app-table-break,
html[data-app-theme="dark"] .table tbody td,
html[data-app-theme="dark"] .table tbody td span:not(.badge),
html[data-app-theme="dark"] .form-check-label,
html[data-app-theme="dark"] .form-text {
    color: var(--app-text);
}

html[data-app-theme="dark"] .text-secondary,
html[data-app-theme="dark"] .small.text-secondary {
    color: var(--app-muted) !important;
}

html[data-app-theme="dark"] .alert-success {
    color: #BBF7D0;
    background: rgba(34, 197, 94, 0.12);
}

html[data-app-theme="dark"] .alert-danger {
    color: #FECACA;
    background: rgba(239, 68, 68, 0.12);
}

.app-login,
.app-install {
    max-width: 460px;
}

.app-install {
    max-width: 860px;
}

.app-public {
    background: linear-gradient(135deg, #f8fbff, #eef5ff);
}

html[data-app-theme="dark"] .app-public {
    background:
        radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.22), transparent 32rem),
        linear-gradient(135deg, #020617, #0F172A);
}

html[data-app-theme="dark"] .app-public .navbar,
html[data-app-theme="dark"] .navbar {
    background: rgba(17, 24, 39, 0.9) !important;
    border-color: var(--app-border) !important;
}

.app-public .navbar {
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(16px);
}

.app-public main.container {
    padding-top: 4rem;
}

.app-footer {
    margin: auto auto 1.75rem;
    padding-top: 2.5rem;
    color: #8a96ab;
    text-align: center;
    font-weight: 500;
}

@media (max-width: 1399.98px) {
    :root {
        --app-sidebar-width: 248px;
    }

    .app-sidebar {
        padding: 1.55rem 1rem;
    }

    .app-brand {
        font-size: 1.32rem;
    }

    .app-brand-mark {
        width: 3.25rem;
        height: 3.25rem;
        border-radius: 16px;
        font-size: 1.45rem;
    }

    .app-topbar {
        gap: 1.15rem;
        padding: 1.15rem 1.5rem;
    }

    .app-main > main.container,
    .app-main > main.container-fluid {
        padding-right: 1.35rem !important;
        padding-left: 1.35rem !important;
    }

    .app-panel.p-4 {
        padding: 1.35rem !important;
    }

    .table > :not(caption) > * > * {
        padding: 1.1rem 0.85rem;
    }

    .btn-sm {
        padding-right: 0.65rem;
        padding-left: 0.65rem;
    }
}

@media (max-width: 1199.98px) {
    :root {
        --app-sidebar-width: 228px;
    }

    .app-nav-link,
    .app-logout {
        gap: 0.75rem;
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .app-topbar-date {
        display: none;
    }

    .app-module-switcher {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .app-module-pill {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .table {
        min-width: 980px;
    }
}

@media (max-width: 991.98px) {
    .app-shell {
        display: block;
    }

    .app-sidebar {
        position: sticky;
        height: auto;
        min-height: 0;
        padding: 1rem;
        border-right: 0;
        border-bottom: 1px solid var(--app-border);
        overflow: visible;
    }

    .app-brand {
        font-size: 1.35rem;
    }

    .app-brand-mark {
        width: 3rem;
        height: 3rem;
        border-radius: 14px;
    }

    .app-mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 1.25rem;
        right: 1rem;
        min-height: 2.5rem;
        padding: 0 1rem;
        border: 1px solid var(--app-border);
        border-radius: 10px;
        background: #fff;
        color: var(--app-primary);
        font-weight: 800;
    }

    html[data-app-theme="dark"] .app-mobile-toggle {
        background: #111827;
        border-color: var(--app-border);
        color: var(--app-primary);
    }

    .app-nav-collapse:not(.show) {
        display: none;
    }

    .app-nav-collapse.show {
        max-height: calc(100vh - 6.5rem);
        overflow-y: auto;
    }

    .app-sidebar .collapse:not(.show) {
        display: none;
    }

    .app-nav {
        padding-top: 0.75rem;
    }

    .app-nav-link,
    .app-logout {
        min-height: 3.25rem;
    }

    .app-logout {
        margin-top: 0.75rem;
    }

    .app-topbar {
        min-height: 74px;
        padding: 1rem;
        flex-wrap: wrap;
    }

    .app-main > main.container,
    .app-main > main.container-fluid {
        width: 100%;
        max-width: 100%;
        padding: 1.4rem 1rem !important;
    }

    .app-module-switcher {
        order: 2;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .app-module-grid {
        grid-template-columns: 1fr;
    }

    .modal-dialog,
    .modal-dialog.modal-lg {
        max-width: calc(100vw - 1rem);
        margin-right: 0.5rem;
        margin-left: 0.5rem;
    }

    .row {
        --bs-gutter-x: 1rem;
    }
}

@media (max-width: 575.98px) {
    body {
        min-width: 320px;
    }

    .app-topbar {
        justify-content: space-between;
        gap: 0.75rem;
    }

    .app-brand span:last-child {
        max-width: calc(100vw - 8rem);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-module-pill {
        flex: 0 0 auto;
        justify-content: center;
        padding-right: 0.65rem;
        padding-left: 0.65rem;
    }

    .app-topbar-actions {
        gap: 0.45rem;
    }

    .app-topbar-date {
        font-size: 0.9rem;
    }

    .app-avatar {
        width: 2.75rem;
        height: 2.75rem;
    }

    .app-notification {
        width: 2.5rem;
        height: 2.5rem;
    }

    .app-theme-toggle {
        width: 4rem;
        height: 2.5rem;
    }

    .app-theme-toggle-track {
        width: 3.35rem;
        height: 1.82rem;
    }

    .app-theme-toggle-thumb {
        width: 1.42rem;
        height: 1.42rem;
    }

    .app-theme-toggle[data-theme="dark"] .app-theme-toggle-thumb {
        transform: translateX(1.52rem);
    }

    .app-panel.p-4 {
        padding: 1.1rem !important;
        border-radius: 18px;
    }

    .table > :not(caption) > * > * {
        padding: 1rem 0.75rem;
    }

    .table-responsive {
        overflow-x: visible;
        overflow-y: visible;
    }

    .app-menu-table {
        min-width: 0;
        table-layout: auto;
    }

    .table-responsive .table,
    .table-responsive .table thead,
    .table-responsive .table tbody,
    .table-responsive .table tr,
    .table-responsive .table td {
        max-width: 100%;
        display: block;
        width: 100%;
    }

    .table-responsive .table thead {
        display: none;
    }

    .table-responsive .table tbody tr {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
        padding: 1rem 0;
        border-bottom: 1px solid var(--app-border);
    }

    .table-responsive .table tbody tr:last-child {
        border-bottom: 0;
    }

    .table-responsive .table tbody td {
        min-height: 0;
        padding: 0;
        border-bottom: 0;
        white-space: normal;
    }

    .table-responsive .table tbody td.text-end,
    .table-responsive .table tbody td:last-child {
        order: -1;
        text-align: left !important;
    }

    .table-responsive .table tbody td.text-end .d-inline-flex,
    .table-responsive .table tbody td:last-child .d-inline-flex {
        justify-content: flex-start !important;
    }

    .table-responsive .table tbody td .d-inline-flex,
    .table-responsive .table tbody td .d-flex {
        width: 100%;
        gap: 0.5rem !important;
    }

    .table-responsive .table tbody td .btn,
    .table-responsive .table tbody td form .btn {
        flex: 1 1 auto;
    }

    .modal-body,
    .modal-header,
    .modal-footer {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .modal-footer {
        align-items: stretch;
    }

    .modal-footer .btn {
        flex: 1 1 auto;
    }

    .form-control,
    .form-select {
        font-size: 16px;
    }

    .btn {
        width: auto;
    }
}

@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
    }
}
