@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@100..900&display=swap');
:root {
    --primary-500:#F49713;
    --bs-primary: #F49713;
    --bs-primary-rgb: 244,151,19;
    --radius-lg:12px;
    --sidebar-width:270px;
    --transition: .25s cubic-bezier(.4,0,.2,1);
    --light-bg:#f5f7fb;
    --light-surface:#ffffff;
    --light-text:#212529;
    --light-muted:#6c757d;
    --dark-bg:#0f1115;
    --dark-surface:#1d2025;
    --dark-surface-2:#262a30;
    --dark-text:#f1f3f5;
    --dark-muted:#adb5bd;
    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:#eef1f5;
    --text: var(--light-text);
    --text-muted: var(--light-muted);
    --border-color:#dee2e6;
    --gradient-accent:linear-gradient(135deg,#F49713,#ffa940);
}
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:#2f3339;
    --gradient-accent:linear-gradient(135deg,#F49713,#cc6f00);
}
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:#c76f00;}
::-webkit-scrollbar {width:10px;height:10px;}
::-webkit-scrollbar-track {background:transparent;}
::-webkit-scrollbar-thumb {background: #444;border-radius:20px;border:2px solid transparent;background-clip:content-box;}
body[data-theme="light"] ::-webkit-scrollbar-thumb {background:#c8ccd1;border:2px solid transparent;background-clip:content-box;}
/* Layout */
.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,#1a1a1a,#000000);
    color:#fff;
    border-radius: var(--radius-lg);
    padding:1.1rem 1rem 1rem;
    display:flex;
    flex-direction:column;
    box-shadow:0 4px 18px -4px rgba(0,0,0,.55),0 8px 40px -8px rgba(0,0,0,.65);
}
.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:#cfd3da;
    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:#F49713;
    color:#fff;
}
.nav.sidebar-nav .nav-link.active:hover {
    background:#E38602;
    color:#fff;
}
.nav.sidebar-nav .nav-link:hover {
    background:#666666;
    color:#fff;
}
.sidebar .upgrade-box {
    margin-top:.75rem;
    background: linear-gradient(135deg,#F49713,#ffb347);
    padding:1rem;
    border-radius:12px;
    text-align:center;
    color:#222;
    font-weight:600;
    font-size:.9rem;
    box-shadow:0 4px 12px -2px rgba(0,0,0,.35);
}
.sidebar .upgrade-box .btn {
    font-weight:600;
    margin-top:.5rem;
    --bs-btn-color:#1f1f1f;
    --bs-btn-bg:#fff;
    --bs-btn-border-color:#fff;
    --bs-btn-hover-bg:#ffe3c2;
    --bs-btn-hover-border-color:#ffe3c2;
}
/* 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(0,0,0,.65);
    background: linear-gradient(to bottom,#1a1a1a,#000000);
    display:flex;
    flex-direction:column;
    color:#fff;
    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:#cfd3da;
    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,.08);
    color:#fff;
    text-decoration:none;
}
#mobileSidebar .nav.sidebar-nav .nav-link.active {
    background: var(--gradient-accent);
    color:#fff;
}
#mobileSidebar .upgrade-box {
    margin-top:.75rem;
    background: linear-gradient(135deg,#F49713,#ffb347);
    padding:1rem;
    border-radius:12px;
    text-align:center;
    color:#222;
    font-weight:600;
    font-size:.9rem;
    box-shadow:0 4px 12px -2px rgba(0,0,0,.35);
}
#mobileSidebar .upgrade-box .btn {
    font-weight:600;
    margin-top:.5rem;
    --bs-btn-color:#1f1f1f;
    --bs-btn-bg:#fff;
    --bs-btn-border-color:#fff;
    --bs-btn-hover-bg:#ffe3c2;
    --bs-btn-hover-border-color:#ffe3c2;
}
.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 */
.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(0,0,0,.15),0 4px 18px -6px rgba(0,0,0,.08);
}
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(0,0,0,.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:#F49713;
}
.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(15,186,90,.12);
    color:#0a8a45;
}
.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(244,151,19,.25);
}
.timeline li:after {
    content:"";
    position:absolute;
    left:.43rem;top:.85rem;
    width:2px;bottom:-.3rem;
    background: linear-gradient(var(--bs-primary), transparent 85%);
}
.timeline li:last-child:after {display:none;}
/* Buttons customization */
.btn-primary {
    --bs-btn-bg:#F49713;
    --bs-btn-border-color:#F49713;
    --bs-btn-hover-bg:#d87d07;
    --bs-btn-hover-border-color:#d87d07;
    --bs-btn-active-bg:#c06e04;
    --bs-btn-active-border-color:#c06e04;
    --bs-btn-disabled-bg:#F49713;
    --bs-btn-disabled-border-color:#F49713;
}
.btn-outline-primary {
    --bs-btn-color:#F49713;
    --bs-btn-border-color:#F49713;
    --bs-btn-hover-bg:#F49713;
    --bs-btn-hover-border-color:#F49713;
    --bs-btn-active-bg:#d87d07;
    --bs-btn-active-border-color:#d87d07;
}
.btn-teal {
    --bs-btn-color: #fff;
    --bs-btn-bg: #008080;
    --bs-btn-border-color: #008080;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #119191;
    --bs-btn-hover-border-color: #119191;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #119191;
    --bs-btn-active-border-color: #119191;
    --bs-btn-disabled-bg: #008080;
    --bs-btn-disabled-border-color: #008080;
}

.btn-outline-teal {
    --bs-btn-color: #008080;
    --bs-btn-border-color: #008080;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #119191;
    --bs-btn-hover-border-color: #119191;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #119191;
    --bs-btn-active-border-color: #119191;
}

/* 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(244,151,19,.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 styles */
:focus-visible {
    outline:2px solid var(--bs-primary);
    outline-offset:2px;
}
/* Utility */
.small-muted {font-size:.7rem;color:var(--text-muted);}
.shadow-glow-primary {
    box-shadow:0 0 0 4px rgba(244,151,19,.25);
}