.font-sarabun {
    font-family: 'Sarabun', sans-serif;
}

:root {
    --brand-primary: #2563eb;
    --brand-primary-dark: #1d4ed8;
    --brand-accent: #0f172a;
    --panel-border: #e7eaee;
    --panel-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

html {
    height: 100%;
}

body {
    background: #f5f7fb;
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
}

.main-content-motion {
    animation: mainContentEnter 240ms ease-out both;
}

.dashboard-shell {
    max-width: 1280px;
    margin: 0 auto;
}

.panel-modern {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    box-shadow: var(--panel-shadow);
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        border-color 180ms ease,
        background-color 180ms ease;
}

.panel-modern:hover {
    border-color: #dbe3ee;
    box-shadow: 0 22px 52px rgba(15, 23, 42, 0.1);
}

.panel-subtle {
    border: 1px solid #eef1f4;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        border-color 180ms ease;
}

.panel-subtle:hover {
    border-color: #dbe3ee;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.modern-btn {
    border-radius: 12px;
    transition: all 0.2s ease;
}

.modern-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.14);
}

.table-modern thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.enterprise-shell {
    width: 100%;
    max-width: none;
    margin: 0;
}

.enterprise-topbar {
    background: #ffffff;
    border: 1px solid #edf1f5;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 14px;
}

@media (min-width: 768px) {
    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .metric-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.metric-card {
    position: relative;
    border-radius: 14px;
    padding: 16px;
    color: #ffffff;
    overflow: hidden;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14);
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        filter 180ms ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
    filter: saturate(1.04);
}

.metric-card::after {
    content: '';
    position: absolute;
    right: -22px;
    bottom: -22px;
    width: 96px;
    height: 96px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
}

.metric-blue {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
}

.metric-amber {
    background: linear-gradient(135deg, #f59e0b, #f97316);
}

.metric-emerald {
    background: linear-gradient(135deg, #10b981, #059669);
}

.metric-light {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #111827;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.metric-light::after {
    display: none;
}

.analytics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 1200px) {
    .analytics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.chart-panel {
    border-radius: 14px;
    border: 1px solid #edf1f6;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
    padding: 16px;
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        border-color 180ms ease;
}

.chart-panel:hover {
    transform: translateY(-1px);
    border-color: #dbeafe;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.donut-demo {
    width: 180px;
    height: 180px;
    margin: 14px auto 2px;
    border-radius: 999px;
    background: conic-gradient(#4f46e5 var(--p), #e6edf5 0);
    position: relative;
}

.donut-demo::after {
    content: '';
    position: absolute;
    inset: 22px;
    border-radius: 999px;
    background: #ffffff;
}

.bars-demo {
    display: flex;
    align-items: end;
    gap: 18px;
    height: 190px;
    padding: 8px 6px 0;
}

.bars-demo > div {
    flex: 1;
    background: linear-gradient(180deg, #22d3ee, #14b8a6);
    border-radius: 10px 10px 0 0;
    box-shadow: inset 0 -10px 24px rgba(255, 255, 255, 0.15);
}

.app-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #7c3aed);
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.6);
    z-index: 9999;
    transition: width 220ms ease, opacity 180ms ease;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9800;
}

.loading-overlay-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 16px 18px;
    min-width: 220px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
}

.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 999px;
    animation: spin 0.8s linear infinite;
}

@keyframes mainContentEnter {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.92);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-pop-in {
    animation: popIn 0.25s ease-out forwards;
}

.modal-scroll {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f3f4f6;
}

.modal-scroll::-webkit-scrollbar {
    width: 10px;
}

.modal-scroll::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.modal-scroll::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 999px;
}
