@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@100..900&display=swap');
:root {
    --primary-500:#ec008b;
    --bs-primary:#ec008b;
    --bs-primary-rgb:236,0,139;
    --radius-lg:12px;
    --sidebar-width:270px;
    --transition:.25s cubic-bezier(.4,0,.2,1);
    --light-bg:#f5f1ea;
    --light-surface:#fdfbf7;
    --light-text:#2d2a25;
    --light-muted:#7d7468;
    --dark-bg:#222;
    --dark-surface:#242424;
    --dark-surface-2:#262626;
    --dark-text:#e6f1e8;
    --dark-muted:#8fa598;
    scroll-behavior:smooth;
    font-family:"Inter","Roboto","Noto Sans Thai",system-ui,sans-serif;
}
body[data-theme="light"] {
    --bg:var(--light-bg);
    --surface:var(--light-surface);
    --surface-alt:#f0e9df;
    --text:var(--light-text);
    --text-muted:var(--light-muted);
    --border-color:#e1d9ce;
    --gradient-accent:linear-gradient(135deg,#ec008b,#c40273);
}
body[data-theme="dark"] {
    --bg:var(--dark-bg);
    --surface:var(--dark-surface);
    --surface-alt:var(--dark-surface-2);
    --text:var(--dark-text);
    --text-muted:var(--dark-muted);
    --border-color:#24352b;
    --gradient-accent:linear-gradient(135deg,#ec008b,#c40273);
}
html,body {height:100%;}
body {
    font-family:"Noto Sans Thai",sans-serif;
    background:var(--bg);
    color:var(--text);
    font-size:0.9375rem;
    line-height:1.45;
}
a {color:var(--bs-primary);}
a:hover {color:#3f8058;}
::-webkit-scrollbar {width:10px;height:10px;}
::-webkit-scrollbar-track {background:transparent;}
::-webkit-scrollbar-thumb {background:#3d5e48;border-radius:20px;border:2px solid transparent;background-clip:content-box;}
body[data-theme="light"] ::-webkit-scrollbar-thumb {background:#b9c8bb;border:2px solid transparent;background-clip:content-box;}
.layout {
    display:flex;
    gap:1.2rem;
    padding:0.85rem 0.85rem 2rem;
    min-height:100dvh;
}
.sidebar-wrapper {
    position:sticky;
    top:0.85rem;
    height:calc(100dvh - 1.7rem);
    flex:0 0 var(--sidebar-width);
}
.sidebar {
    height:100%;
    background:linear-gradient(to bottom,#292929,#161616);
    color:#f1f6f1;
    border-radius:var(--radius-lg);
    padding:1.1rem 1rem 1rem;
    display:flex;
    flex-direction:column;
    box-shadow:0 4px 18px -4px rgba(20,32,24,.6),0 8px 40px -8px rgba(18,30,22,.7);
}
.sidebar .brand {
    font-weight:600;
    display:flex;
    align-items:center;
    gap:.55rem;
    font-size:1.05rem;
    margin-bottom:1.2rem;
}
.nav.sidebar-nav {
    flex:1;
    overflow-y:auto;
    padding-right:.35rem;
}
.nav.sidebar-nav .nav-link {
    color:#d7e4d5;
    font-weight:500;
    display:flex;
    align-items:center;
    gap:.75rem;
    padding:.6rem .85rem;
    border-radius:10px;
    font-size:.9rem;
    position:relative;
    transition:background .15s,color .15s;
}
.nav.sidebar-nav .nav-link .badge {
    font-size:.6rem;
    letter-spacing:.5px;
}
.nav.sidebar-nav .nav-link.active {
    background:#ec008b;
    color:#fdfbf7;
}
.nav.sidebar-nav .nav-link.active:hover {
    background:#c40273;
    color:#fdfbf7;
}
.nav.sidebar-nav .nav-link:hover {
    background:rgba(141,195,155,.18);
    color:#ffffff;
}
.sidebar .upgrade-box {
    margin-top:.75rem;
    background:linear-gradient(135deg,#ec008b,#db0080);
    padding:1rem;
    border-radius:12px;
    text-align:center;
    color:#1d2c22;
    font-weight:600;
    font-size:.9rem;
    box-shadow:0 4px 12px -2px rgba(36,54,41,.35);
}
.sidebar .upgrade-box .btn {
    font-weight:600;
    margin-top:.5rem;
    --bs-btn-color:#1f3527;
    --bs-btn-bg:#fdfbf7;
    --bs-btn-border-color:#fdfbf7;
    --bs-btn-hover-bg:#ede3d6;
    --bs-btn-hover-border-color:#ede3d6;
}
/* Mobile offcanvas style clone */
#mobileSidebar {
    position:fixed;
    top:.85rem;
    left:.85rem;
    bottom:.85rem;
    width:260px;
    z-index:1050;
    transform:translateX(-130%);
    transition:var(--transition);
    border-radius:var(--radius-lg);
    box-shadow:0 8px 32px -4px rgba(18,30,22,.75);
    background:linear-gradient(to bottom,#292929,#161616);
    display:flex;
    flex-direction:column;
    color:#f1f6f1;
    padding:1rem .85rem;
    backdrop-filter:blur(8px);
}
#mobileSidebar.show {transform:none;}
#mobileSidebar .close-btn {
    position:absolute;top:10px;right:10px;
    background:rgba(255,255,255,.08);
    border:0;
    width:34px;height:34px;
    display:flex;align-items:center;justify-content:center;
    color:#fff;
    border-radius:10px;
}
#mobileSidebar .close-btn:hover {background:rgba(255,255,255,.18);}
#mobileSidebar .brand {
    font-weight:600;
    display:flex;
    align-items:center;
    gap:.55rem;
    font-size:1.05rem;
    margin-bottom:1.2rem;
}
#mobileSidebar .nav.sidebar-nav {
    flex:1;
    overflow-y:auto;
    padding-right:.35rem;
}
#mobileSidebar .nav.sidebar-nav .nav-link {
    color:#d7e4d5;
    font-weight:500;
    display:flex;
    align-items:center;
    gap:.75rem;
    padding:.6rem .85rem;
    border-radius:10px;
    font-size:.9rem;
    position:relative;
    transition:background .15s,color .15s;
}
#mobileSidebar .nav.sidebar-nav .nav-link:hover {
    background:rgba(255,255,255,.12);
    color:#ffffff;
    text-decoration:none;
}
#mobileSidebar .nav.sidebar-nav .nav-link.active {
    background:var(--gradient-accent);
    color:#d7e4d5;
}
#mobileSidebar .upgrade-box {
    margin-top:.75rem;
    background:linear-gradient(135deg,#ec008b,#db0080);
    padding:1rem;
    border-radius:12px;
    text-align:center;
    color:#1d2c22;
    font-weight:600;
    font-size:.9rem;
    box-shadow:0 4px 12px -2px rgba(36,54,41,.35);
}
#mobileSidebar .upgrade-box .btn {
    font-weight:600;
    margin-top:.5rem;
    --bs-btn-color:#1f3527;
    --bs-btn-bg:#fdfbf7;
    --bs-btn-border-color:#fdfbf7;
    --bs-btn-hover-bg:#ede3d6;
    --bs-btn-hover-border-color:#ede3d6;
}
.blur-overlay {
    position:fixed;inset:0;
    backdrop-filter:blur(4px);
    background:rgba(0,0,0,.4);
    z-index:1040;
    opacity:0;visibility:hidden;
    transition:var(--transition);
}
.blur-overlay.show {opacity:1;visibility:visible;}
.topbar {
    background:var(--surface);
    border-radius:var(--radius-lg);
    padding:.55rem 1rem;
    display:flex;
    align-items:center;
    gap:.75rem;
    margin-bottom:1rem;
    box-shadow:0 2px 4px -2px rgba(32,46,36,.15),0 4px 18px -6px rgba(26,38,31,.12);
}
body[data-theme="dark"] .topbar {background:var(--surface-alt);}
.topbar .form-control {
    background:var(--surface-alt);
    border:1px solid var(--border-color);
    color:var(--text);
}
.topbar .btn-icon {
    width:38px;height:38px;
    display:flex;align-items:center;justify-content:center;
    border-radius:10px;
    border:1px solid var(--border-color);
    background:var(--surface-alt);
    color:var(--text);
}
.topbar .btn-icon:hover {
    background:var(--surface-alt);
    border-color:var(--bs-primary);
    color:var(--bs-primary);
}
.mode-toggle input {display:none;}
.mode-toggle .toggle-body {
    width:50px;height:26px;
    background:var(--surface-alt);
    border:1px solid var(--border-color);
    border-radius:30px;
    position:relative;
    cursor:pointer;
    display:flex;
    align-items:center;
    padding:0 4px;
    gap:4px;
    font-size:.75rem;
}
.mode-toggle .knob {
    position:absolute;
    top:2px;
    width:22px;
    height:22px;
    border-radius:50%;
    background:var(--gradient-accent);
    box-shadow:0 2px 6px -1px rgba(19,32,25,.4);
    transition:var(--transition);
}
body[data-theme="light"] .mode-toggle .knob {left:2px;}
body[data-theme="dark"] .mode-toggle .knob {left:calc(100% - 24px);}
.dropdown-menu {
    background:var(--surface);
    border:1px solid var(--border-color);
    color:var(--text);
    border-radius:12px;
    overflow:hidden;
}
.dropdown-item {color:var(--text);}
.dropdown-item:focus,
.dropdown-item:hover {background:var(--surface-alt);color:var(--text);}
.badge-primary {
    background:#ec008b;
}
.card {
    border:1px solid var(--border-color);
    background:var(--surface);
    color:var(--text);
    border-radius:14px;
    position:relative;
    overflow:hidden;
}
body[data-theme="dark"] .card {background:var(--surface-alt);}
.card-header {
    background:transparent;
    border-bottom:1px solid var(--border-color);
    font-weight:600;
}
.stat-card {
    display:flex;
    flex-direction:column;
    gap:.45rem;
}
.stat-card .label {
    font-size:.8rem;
    text-transform:uppercase;
    letter-spacing:.5px;
    color:var(--text-muted);
    font-weight:600;
}
.stat-card .value {
    font-size:1.35rem;
    font-weight:600;
    display:flex;
    align-items:center;
    gap:.45rem;
}
.stat-card .trend {
    font-size:.7rem;
    font-weight:600;
    padding:.25rem .55rem;
    border-radius:30px;
    background:rgba(63,128,88,.12);
    color:#2f7d58;
}
.stat-card .trend.down {
    background:rgba(255,70,70,.15);
    color:#d93030;
}
.grid {
    display:grid;
    gap:1rem;
}
.grid-cols-4 {
    grid-template-columns:repeat(auto-fill,minmax(230px,1fr));
}
.chart-wrapper {
    height:260px;
}
.timeline {
    margin:0;
    padding:0;
    list-style:none;
    position:relative;
}
.timeline li {
    position:relative;
    padding:0 0 .9rem 1.6rem;
}
.timeline li:last-child {padding-bottom:0;}
.timeline li:before {
    content:"";
    position:absolute;
    left:.4rem;top:.3rem;
    width:10px;height:10px;
    background:var(--gradient-accent);
    border-radius:50%;
    box-shadow:0 0 0 4px rgba(91,171,115,.25);
}
.timeline li:after {
    content:"";
    position:absolute;
    left:.43rem;top:.85rem;
    width:2px;bottom:-.3rem;
    background:linear-gradient(#ec008b,transparent 85%);
}
.timeline li:last-child:after {display:none;}
.btn-primary {
    --bs-btn-bg:#ec008b;
    --bs-btn-border-color:#ec008b;
    --bs-btn-hover-bg:#c40273;
    --bs-btn-hover-border-color:#c40273;
    --bs-btn-active-bg:#c40273;
    --bs-btn-active-border-color:#c40273;
    --bs-btn-disabled-bg:#ec008b;
    --bs-btn-disabled-border-color:#ec008b;
}
.btn-outline-primary {
    --bs-btn-color:#c40273;
    --bs-btn-border-color:#ec008b;
    --bs-btn-hover-bg:#ec008b;
    --bs-btn-hover-border-color:#ec008b;
    --bs-btn-active-bg:#c40273;
    --bs-btn-active-border-color:#c40273;
}
.btn-teal {
    --bs-btn-color:#fff;
    --bs-btn-bg:#3d7d5b;
    --bs-btn-border-color:#3d7d5b;
    --bs-btn-hover-color:#fff;
    --bs-btn-hover-bg:#356d4f;
    --bs-btn-hover-border-color:#356d4f;
    --bs-btn-active-color:#fff;
    --bs-btn-active-bg:#2e6044;
    --bs-btn-active-border-color:#2e6044;
    --bs-btn-disabled-bg:#3d7d5b;
    --bs-btn-disabled-border-color:#3d7d5b;
}
.btn-outline-teal {
    --bs-btn-color:#3d7d5b;
    --bs-btn-border-color:#3d7d5b;
    --bs-btn-hover-color:#fff;
    --bs-btn-hover-bg:#356d4f;
    --bs-btn-hover-border-color:#356d4f;
    --bs-btn-active-color:#fff;
    --bs-btn-active-bg:#2e6044;
    --bs-btn-active-border-color:#2e6044;
}
/* Projects table */
.table thead th {
    font-size:.7rem;
    text-transform:uppercase;
    letter-spacing:.75px;
    color:var(--text-muted);
    font-weight:600;
    border-bottom:1px solid var(--border-color);
}
.table tbody td {
    vertical-align:middle;
    font-size:.8rem;
    border-color:var(--border-color);
}
.progress {
    background:var(--surface-alt);
    height:6px;
    border-radius:10px;
}
/* Auth Modals */
.modal-content {
    background:var(--surface);
    color:var(--text);
    border:1px solid var(--border-color);
    border-radius:16px;
}
.form-control {
    background:var(--surface-alt);
    border:1px solid var(--border-color);
    color:var(--text);
}
.form-control:focus {
    background:var(--surface-alt);
    color:var(--text);
    border-color:var(--bs-primary);
    box-shadow:0 0 0 .15rem rgba(91,171,115,.25);
}
/* Responsive */
@media (max-width:1199.98px) {
    .layout {padding:0.75rem;}
    .sidebar-wrapper {display:none;}
}
@media (max-width:767.98px) {
    .topbar {flex-wrap:wrap;}
    .chart-wrapper {height:220px;}
}
.rtl-active {direction:rtl;}
.rtl-active .nav.sidebar-nav .nav-link {justify-content:flex-end;}
.rtl-active .timeline li {padding:0 1.6rem .9rem 0;}
.rtl-active .timeline li:before {left:auto;right:.4rem;}
.rtl-active .timeline li:after {left:auto;right:.43rem;}
:focus-visible {
    outline:2px solid var(--bs-primary);
    outline-offset:2px;
}
.small-muted {font-size:.7rem;color:var(--text-muted);}
.shadow-glow-primary {
    box-shadow:0 0 0 4px rgba(91,171,115,.25);
}
