html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

:root {
    --mx-bg: #f9fafb;
    --mx-surface: #ffffff;
    --mx-surface-soft: #f3f4f6;
    --mx-sidebar: #1f2937;
    --mx-sidebar-accent: #314155;
    --mx-primary: #0d6efd;
    --mx-primary-dark: #0b5ed7;
    --mx-info: #0dcaf0;
    --mx-info-dark: #0aa7c8;
    --mx-text: #111827;
    --mx-text-soft: #6b7280;
    --mx-border: #e5e7eb;
    --mx-shadow: 0 18px 40px rgba(17, 24, 39, 0.08);
    --mx-radius-lg: 24px;
    --mx-radius-md: 18px;
    --mx-radius-sm: 12px;
    --mx-sidebar-width: clamp(232px, 17vw, 280px);
}

body {
    margin: 0;
    color: var(--mx-text);
    background:
        radial-gradient(circle at top left, rgba(13, 110, 253, 0.05), transparent 28%),
        linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
}

a {
    color: inherit;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.18);
}

.btn:focus-visible,
.nav-link:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.mobile-nav-toggle:focus-visible,
.dashboard-tab:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(20, 89, 217, 0.42);
    outline-offset: 2px;
}

.app-shell {
    min-height: 100vh;
    display: block;
    overflow-x: hidden;
    max-width: 100%;
}

.app-sidebar {
    width: var(--mx-sidebar-width);
    height: 100vh;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(49, 65, 85, 0.35), rgba(17, 24, 39, 0)),
        linear-gradient(180deg, #1f2937 0%, #111827 100%);
    padding: 1.5rem;
    box-shadow: 12px 0 40px rgba(15, 23, 42, 0.18);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1;
    overflow: hidden;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.sidebar-close,
.mobile-nav-toggle {
    display: none;
}

.sidebar-close {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background-size: 0.9rem;
}

.brand-lockup img,
.auth-brand img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.brand-eyebrow,
.auth-brand-mark {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.brand-title,
.auth-brand-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.brand-subtitle {
    margin: 0.35rem 0 0;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.92rem;
    line-height: 1.45;
}

.app-sidebar hr {
    border-color: rgba(255, 255, 255, 0.12);
    opacity: 1;
    margin: 1.25rem 0;
}

.app-nav {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    flex: 1 1 auto;
    gap: 0.35rem;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.2rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.24) transparent;
}

.app-nav .nav-group {
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
}

.app-nav::-webkit-scrollbar {
    width: 6px;
}

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

.app-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.24);
    border-radius: 999px;
}

.app-nav .nav-link {
    color: #d3d9e4;
    border-radius: 14px;
    padding: 0.8rem 0.95rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.app-nav .nav-link:hover,
.app-nav .nav-link:focus,
.app-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(2px);
}

.submenu-link {
    font-size: 0.95rem;
    padding-left: 2.4rem;
}

.nav-section-label {
    color: #d3d9e4;
    padding: 0.8rem 0.95rem 0.45rem;
    font-weight: 600;
}

.submenu-group {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.app-logout {
    margin-top: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    min-height: 44px;
}

.app-content {
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    height: 100vh;
    margin-left: var(--mx-sidebar-width);
    width: calc(100% - var(--mx-sidebar-width));
    padding: clamp(1rem, 1.6vw, 1.5rem);
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

.app-content main,
.app-content .container,
.app-content .container-fluid,
.app-content .row,
.app-content .col,
.app-content [class*="col-"] {
    min-width: 0;
    max-width: 100%;
}

@media (min-width: 992px) {
    body {
        overflow: hidden;
    }

    .app-sidebar {
        visibility: visible;
        transform: none;
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--mx-sidebar-width);
        height: 100vh;
        margin: 0;
        border: 0;
        border-radius: 0;
        background-clip: border-box;
    }

    .app-sidebar.show {
        transform: none;
    }
}

@media (max-width: 1399.98px) and (min-width: 992px) {
    .app-sidebar {
        padding: 1.2rem;
    }

    .brand-lockup {
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .brand-lockup img {
        width: 44px;
        height: 44px;
    }

    .app-sidebar hr {
        margin: 1rem 0;
    }

    .app-content {
        padding: 1.2rem;
    }

    .app-nav .nav-link {
        padding: 0.75rem 0.85rem;
        gap: 0.6rem;
    }

    .nav-section-label {
        padding: 0.7rem 0.85rem 0.4rem;
    }

    .submenu-link {
        padding-left: 2.15rem;
    }
}

@media (max-height: 860px) and (min-width: 992px) {
    .app-sidebar {
        padding: 1rem;
    }

    .brand-lockup {
        gap: 0.7rem;
        margin-bottom: 0.65rem;
    }

    .brand-lockup img,
    .auth-brand img {
        width: 40px;
        height: 40px;
    }

    .brand-eyebrow,
    .auth-brand-mark {
        font-size: 0.68rem;
        letter-spacing: 0.14em;
    }

    .brand-title,
    .auth-brand-title {
        font-size: 1rem;
    }

    .app-sidebar hr {
        margin: 0.8rem 0;
    }

    .app-nav {
        gap: 0.25rem;
    }

    .app-nav .nav-link {
        padding: 0.65rem 0.75rem;
        gap: 0.55rem;
        border-radius: 12px;
    }

    .nav-section-label {
        padding: 0.65rem 0.75rem 0.35rem;
        font-size: 0.92rem;
    }

    .submenu-group {
        gap: 0.25rem;
        margin-bottom: 0.2rem;
    }

    .submenu-link {
        font-size: 0.92rem;
        padding-left: 1.95rem;
    }
}

@media (max-height: 760px) and (min-width: 992px) {
    .app-sidebar {
        padding: 0.9rem;
    }

    .brand-lockup {
        margin-bottom: 0.5rem;
    }

    .brand-lockup img,
    .auth-brand img {
        width: 36px;
        height: 36px;
    }

    .brand-eyebrow,
    .auth-brand-mark {
        font-size: 0.64rem;
    }

    .brand-title,
    .auth-brand-title {
        font-size: 0.95rem;
    }

    .app-sidebar hr {
        margin: 0.65rem 0;
    }

    .app-nav .nav-link {
        padding: 0.58rem 0.7rem;
    }

    .nav-section-label {
        padding: 0.55rem 0.7rem 0.3rem;
    }
}

.topbar {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--mx-radius-lg);
    box-shadow: var(--mx-shadow);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    position: sticky;
    top: 1rem;
    z-index: 40;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.topbar-brand-wrap {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.topbar-brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.topbar-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.topbar-subtitle {
    margin: 0;
    color: var(--mx-text-soft);
    font-size: 0.88rem;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    background: var(--mx-surface-soft);
    border: 1px solid var(--mx-border);
    color: var(--mx-text-soft);
    font-size: 0.92rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.page-header h1,
.page-header h2 {
    margin: 0;
    font-weight: 700;
}

.page-header p {
    margin: 0.45rem 0 0;
    color: var(--mx-text-soft);
}

.section-card,
.stat-card,
.auth-card,
.empty-state {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--mx-radius-lg);
    box-shadow: var(--mx-shadow);
}

.section-card {
    padding: 1.4rem;
}

.section-card + .section-card {
    margin-top: 1.25rem;
}

.section-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.section-card-description {
    margin: 0.35rem 0 0;
    color: var(--mx-text-soft);
    font-size: 0.92rem;
}

.stat-card {
    color: #fff;
    padding: 1.25rem;
    min-height: 160px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -20px -40px auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}

.stat-card-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.85;
}

.stat-card h3 {
    margin: 1rem 0 0.35rem;
    font-size: 1.1rem;
}

.stat-card strong {
    display: block;
    font-size: 2rem;
    line-height: 1;
}

.table-shell {
    border: 1px solid var(--mx-border);
    border-radius: var(--mx-radius-md);
    overflow: hidden;
    background: var(--mx-surface);
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
}

.table-shell > .dt-container,
.table-shell > div.dt-container {
    max-width: 100%;
    min-width: 0;
}

.table-shell .table {
    margin-bottom: 0;
    min-width: 640px;
    width: max(100%, 640px);
}

.table-shell .table thead th {
    background: #f8fafc;
    color: var(--mx-text-soft);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom-width: 1px;
    padding: 1rem 0.95rem;
}

.table-shell .table tbody td {
    padding: 1rem 0.95rem;
    vertical-align: middle;
}

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

.btn-brand,
.btn-brand-outline,
.btn-action,
.btn-soft {
    border-radius: 999px;
    padding: 0.7rem 1.15rem;
    font-weight: 600;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.btn-brand {
    color: #fff;
    background: var(--mx-primary);
    border-color: var(--mx-primary);
}

.btn-brand:hover,
.btn-brand:focus {
    color: #fff;
    background: var(--mx-primary-dark);
    border-color: var(--mx-primary-dark);
}

.btn-brand-outline {
    color: var(--mx-primary);
    background: rgba(13, 110, 253, 0.06);
    border: 1px solid rgba(13, 110, 253, 0.16);
}

.btn-brand-outline:hover,
.btn-brand-outline:focus {
    color: var(--mx-primary-dark);
    background: rgba(13, 110, 253, 0.12);
}

.btn-action {
    color: #052c65;
    background: rgba(13, 202, 240, 0.22);
    border: 1px solid rgba(13, 202, 240, 0.32);
}

.btn-action:hover,
.btn-action:focus {
    color: #031633;
    background: rgba(13, 202, 240, 0.34);
}

.btn-soft {
    color: var(--mx-text);
    background: #f8fafc;
    border: 1px solid var(--mx-border);
}

.btn-soft:hover,
.btn-soft:focus {
    background: #eef2f7;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    background: #eef3f8;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 600;
}

.form-label {
    font-weight: 600;
    color: var(--mx-text);
}

.form-control,
.form-select {
    border-radius: 14px;
    border-color: var(--mx-border);
    padding: 0.8rem 0.95rem;
    min-height: 44px;
}

.form-check-input {
    min-width: 1.1rem;
    min-height: 1.1rem;
}

.form-control::file-selector-button {
    border: 0;
    border-right: 1px solid var(--mx-border);
    margin-right: 1rem;
    padding: 0.7rem 1rem;
    background: #f8fafc;
}

.app-content .table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.app-content .table-responsive .table,
.app-content .card-body > table.table {
    min-width: 640px;
}

.app-content .card,
.app-content .section-card,
.app-content .topbar {
    max-width: 100%;
    min-width: 0;
}

.app-content .dt-layout-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.app-content .dt-layout-cell {
    min-width: 0;
    flex: 1 1 280px;
}

.app-content .dt-layout-table {
    width: 100%;
    overflow-x: auto;
    max-width: 100%;
}

.app-content .dt-layout-row .dt-layout-cell.dt-layout-end {
    margin-left: auto;
}

.app-content .dt-layout-start,
.app-content .dt-layout-end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.app-content .dt-layout-end {
    justify-content: flex-end;
}

.app-content .dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.app-content .dt-button,
.app-content button.dt-button,
.app-content div.dt-button,
.app-content a.dt-button,
.app-content .dt-paging-button,
.app-content .dt-paging button,
.app-content .dt-paging a {
    min-height: 44px !important;
    min-width: 44px !important;
}

.app-content button.dt-paging-button,
.app-content .dt-paging button.dt-paging-button {
    padding-inline: 0.75rem !important;
}

.app-content .dt-button:focus-visible,
.app-content button.dt-button:focus-visible,
.app-content div.dt-button:focus-visible,
.app-content a.dt-button:focus-visible,
.app-content .dt-paging-button:focus-visible,
.app-content .dt-paging button:focus-visible,
.app-content .dt-paging a:focus-visible,
.app-content table.dataTable thead th:focus-visible,
.app-content table.dataTable thead td:focus-visible {
    outline: 3px solid rgba(20, 89, 217, 0.42);
    outline-offset: 2px;
}

.app-content .dt-search,
.app-content .dt-length,
.app-content .dt-paging {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.app-content .dt-search label,
.app-content .dt-length label {
    margin: 0;
}

.app-content .dt-search input,
.app-content .dt-length select {
    max-width: 100%;
    min-height: 44px !important;
}

.app-content .dt-column-order {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 44px !important;
    min-height: 44px !important;
}

.app-content #tbl_product tbody a:not(.btn) {
    display: inline-flex;
    align-items: center;
    min-width: 44px;
    min-height: 44px;
}

.app-content .dt-paging nav {
    max-width: 100%;
}

.app-content .dt-paging .pagination {
    flex-wrap: wrap;
    margin-bottom: 0;
}

.app-content .dt-info {
    min-width: 0;
}

.app-content .dt-container,
.app-content .dt-container .dt-layout-row,
.app-content .dt-container .dt-layout-cell,
.app-content .dt-container .dt-layout-full {
    max-width: 100%;
    min-width: 0;
}

.app-content .dt-container table.dataTable {
    width: max(100%, 640px) !important;
}

#calendar {
    max-width: 100%;
}

.fc .fc-toolbar {
    gap: 0.75rem;
}

.fc .fc-toolbar.fc-header-toolbar {
    flex-wrap: wrap;
}

.fc .fc-toolbar-chunk {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.calendar-shell {
    display: grid;
    gap: 1.25rem;
}

.calendar-surface {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--mx-radius-lg);
    box-shadow: var(--mx-shadow);
    padding: 1rem;
    min-width: 0;
}

.status-page {
    max-width: 980px;
    margin: 0 auto;
}

.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    background: #111827;
}

.auth-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.04), transparent 24%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0));
    opacity: 0.85;
    pointer-events: none;
}

.auth-shell > * {
    position: relative;
    z-index: 1;
}

.auth-card {
    width: min(100%, 460px);
    padding: 2rem;
}

.auth-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-brand img {
    margin: 0 auto 1rem;
    display: block;
    width: 72px;
    height: 72px;
}

.auth-brand-mark {
    color: var(--mx-primary);
}

.auth-brand-title {
    color: var(--mx-text);
    font-size: 1.5rem;
}

.auth-brand-text {
    margin: 0.45rem auto 0;
    max-width: 32ch;
    color: var(--mx-text-soft);
}

.auth-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--mx-primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer-link:hover,
.auth-footer-link:focus {
    color: var(--mx-primary-dark);
}

.empty-state {
    padding: 2rem;
    text-align: center;
}

/* Legacy bridge: makes older Bootstrap-heavy views follow the same visual system
   while we migrate their markup incrementally. */
.app-content .container.mt-4,
.app-content .container.mt-5,
.app-content .container.py-3 {
    padding-left: 0;
    padding-right: 0;
}

.app-content .card.shadow-lg,
.app-content .card.shadow-sm,
.app-content .card.shadow-lg.rounded-3,
.app-content .card.shadow-sm.border-0 {
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--mx-radius-lg) !important;
    box-shadow: var(--mx-shadow) !important;
    overflow: hidden;
}

.app-content .card-header.bg-primary,
.app-content .card-header.bg-success,
.app-content .card-header.bg-info,
.app-content .card-header.bg-warning,
.app-content .card-header.bg-dark {
    background: #f8fafc !important;
    color: var(--mx-text) !important;
    border-bottom: 1px solid var(--mx-border);
}

.app-content .table.table-striped,
.app-content .table.table-hover,
.app-content .table.table-striped.table-bordered {
    margin-bottom: 0;
}

.app-content .table.table-striped thead th,
.app-content .table.table-hover thead th,
.app-content .table.table-striped.table-bordered thead th {
    background: #f8fafc;
    color: var(--mx-text-soft);
    text-transform: uppercase;
    font-size: 0.82rem;
    letter-spacing: 0.06em;
}

.app-content .btn.btn-info {
    color: #052c65;
    background: rgba(13, 202, 240, 0.22);
    border: 1px solid rgba(13, 202, 240, 0.32);
}

.app-content .btn.btn-info:hover,
.app-content .btn.btn-info:focus {
    color: #031633;
    background: rgba(13, 202, 240, 0.34);
}

.app-content .btn.btn-light {
    color: var(--mx-text);
    background: #f8fafc;
    border-color: var(--mx-border) !important;
}

.profile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.profile-hero img {
    width: 128px;
    height: 128px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 1rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 13, 24, 0.66);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

#loading-overlay.is-visible {
    opacity: 1;
    pointer-events: all;
}

.tcg-loader {
    min-width: 230px;
    padding: 1rem 1.4rem;
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.96));
    border: 1px solid rgba(148, 163, 184, 0.26);
    box-shadow: 0 20px 40px rgba(2, 6, 23, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
}

.tcg-cards {
    width: 88px;
    height: 56px;
    position: relative;
}

.tcg-card {
    position: absolute;
    width: 42px;
    height: 56px;
    border-radius: 7px;
    border: 1px solid rgba(248, 250, 252, 0.55);
    background: linear-gradient(150deg, #f8fafc 0%, #cbd5e1 100%);
    box-shadow: 0 7px 14px rgba(15, 23, 42, 0.35);
    top: 0;
    left: 50%;
    transform-origin: 50% 90%;
    animation: tcgShuffle 1.1s ease-in-out infinite;
}

.tcg-card-1 {
    animation-delay: 0s;
}

.tcg-card-2 {
    animation-delay: 0.18s;
}

.tcg-card-3 {
    animation-delay: 0.36s;
}

.tcg-card-4 {
    animation-delay: 0.54s;
}

.tcg-loader-text {
    margin: 0;
    color: #f8fafc;
    font-size: 0.92rem;
    letter-spacing: 0.01em;
}

@keyframes tcgShuffle {
    0% {
        transform: translateX(-50%) rotate(0deg) scale(1);
    }

    30% {
        transform: translateX(calc(-50% - 21px)) rotate(-16deg) scale(0.98);
    }

    60% {
        transform: translateX(calc(-50% + 21px)) rotate(16deg) scale(0.98);
    }

    100% {
        transform: translateX(-50%) rotate(0deg) scale(1);
    }
}

@media (max-width: 991.98px) {
    body {
        overflow-y: auto;
    }

    .app-shell {
        display: flex;
        flex-direction: column;
    }

    .app-sidebar {
        width: min(88vw, 360px) !important;
        max-width: calc(100vw - 16px);
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0 24px 24px 0;
        position: fixed;
        inset: 0 auto 0 0;
        overflow-y: auto;
        overflow-x: hidden;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1045;
        box-shadow: 18px 0 42px rgba(15, 23, 42, 0.28);
        padding: 1.1rem;
    }

    .app-nav {
        flex-wrap: nowrap !important;
        width: 100%;
        padding-inline: 0;
    }

    .app-nav .nav-group {
        width: 100%;
        max-width: 100%;
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .sidebar-header {
        align-items: center;
    }

    .sidebar-close {
        display: inline-flex;
        flex: 0 0 auto;
        opacity: 0.85;
        margin-top: 0.15rem;
    }

    .brand-lockup {
        margin-bottom: 0;
    }

    .brand-lockup img {
        width: 42px;
        height: 42px;
    }

    .app-sidebar hr {
        margin: 0.9rem 0;
    }

    .app-nav .nav-link {
        padding: 0.72rem 0.8rem;
    }

    .nav-section-label {
        padding: 0.7rem 0.8rem 0.35rem;
    }

    .submenu-link {
        padding-left: 2rem;
    }

    .app-content {
        margin-left: 0;
        width: 100%;
        height: auto;
        min-height: 0;
        overflow: visible;
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .topbar,
    .section-card,
    .stat-card,
    .auth-card {
        border-radius: 20px;
    }

    .topbar {
        top: 0.75rem;
        padding: 0.9rem 1rem;
    }

    .topbar-brand-wrap {
        align-items: flex-start;
        gap: 0.75rem;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: 1px solid var(--mx-border);
        border-radius: 14px;
        background: var(--mx-surface-soft);
        color: var(--mx-text);
        flex: 0 0 auto;
    }

    .mobile-nav-toggle i {
        font-size: 1.35rem;
        line-height: 1;
    }

    .table-shell .table,
    .app-content .table-responsive .table,
    .app-content .card-body > table.table {
        min-width: 560px;
    }

    .app-content .dt-layout-row .dt-layout-cell,
    .app-content .dt-layout-row .dt-layout-cell.dt-layout-end {
        width: 100%;
        margin-left: 0;
        flex-basis: 100%;
    }

    .app-content .dt-layout-end {
        justify-content: flex-start;
    }

    .fc .fc-toolbar-chunk {
        width: 100%;
        justify-content: flex-start;
    }

    .calendar-surface {
        padding: 0.85rem;
    }
}

@media (max-width: 991.98px) and (max-height: 720px) {
    .app-sidebar {
        padding: 0.9rem;
    }

    .brand-lockup img {
        width: 38px;
        height: 38px;
    }

    .brand-title {
        font-size: 1rem;
    }

    .app-sidebar hr {
        margin: 0.7rem 0;
    }

    .app-nav .nav-link {
        padding: 0.62rem 0.7rem;
        font-size: 0.94rem;
    }

    .nav-section-label {
        padding: 0.55rem 0.7rem 0.3rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 767.98px) {
    .app-content {
        padding: 1rem;
        padding-left: max(0.9rem, env(safe-area-inset-left));
        padding-right: max(0.9rem, env(safe-area-inset-right));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .topbar-brand {
        align-items: flex-start;
        gap: 0.7rem;
    }

    .topbar-brand img {
        width: 36px;
        height: 36px;
    }

    .topbar-title {
        font-size: 0.98rem;
    }

    .topbar-subtitle {
        display: none;
    }

    .page-header,
    .section-card-header,
    .topbar-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .section-card {
        padding: 1rem;
    }

    .table-shell .table,
    .app-content .table-responsive .table,
    .app-content .card-body > table.table {
        min-width: 500px;
    }

    .section-card-header > div,
    .section-card-header > .d-flex,
    .section-card-header > form {
        width: 100%;
    }

    .app-content .dt-search,
    .app-content .dt-length,
    .app-content .dt-paging,
    .app-content .dt-buttons {
        width: 100%;
    }

    .app-content .dt-search input,
    .app-content .dt-length select {
        width: 100%;
    }

    .app-content .dt-buttons .dt-button {
        flex: 1 1 auto;
    }

    .fc .fc-toolbar-title {
        font-size: 1.1rem;
    }

    .calendar-surface {
        padding: 0.75rem;
    }

    .fc .fc-button {
        padding: 0.35rem 0.55rem;
        font-size: 0.85rem;
    }

    .topbar {
        top: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    .topbar {
        margin-bottom: 1rem;
        border-radius: 16px;
    }

    .topbar-brand-wrap {
        width: 100%;
    }

    .topbar-meta {
        width: 100%;
        gap: 0.5rem;
    }

    .topbar-chip {
        max-width: 100%;
        min-height: 38px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .page-header,
    .module-hero,
    .section-card,
    .module-panel,
    .auth-card {
        border-radius: 16px;
    }

    .auth-card {
        padding: 1.15rem;
    }

    .auth-brand {
        margin-bottom: 1.25rem;
    }

    .auth-brand img {
        width: 56px;
        height: 56px;
        margin-bottom: 0.75rem;
    }

    .auth-brand-title {
        font-size: 1.28rem;
    }

    .btn,
    .btn-brand,
    .btn-brand-outline,
    .btn-action,
    .btn-soft {
        min-height: 44px;
    }

    .app-content .d-flex.gap-2,
    .app-content .d-flex.gap-3 {
        min-width: 0;
    }

    .app-content .d-flex.gap-2 > .btn,
    .app-content .d-flex.gap-2 > a.btn,
    .app-content .d-flex.gap-3 > .btn,
    .app-content .d-flex.gap-3 > a.btn {
        white-space: normal;
    }
}

@media (max-width: 380px) {
    .app-content {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .auth-shell {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .topbar {
        padding: 0.75rem;
    }

    .mobile-nav-toggle {
        width: 42px;
        height: 42px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
