@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@100..900&display=swap');

:root {
    --primary-500:#1e88e5;
    --bs-primary: #1e88e5;
    --bs-primary-rgb: 30,136,229;
    --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,#1e88e5,#42a5f5);
}
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,#1e88e5,#1565c0);
    --form-select-indicator: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23adb5bd' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
body[data-theme="light"] {
    --form-select-indicator: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
html,body {height:100%;}
body {
    background: var(--bg);
    color: var(--text);
    font-size: 0.9375rem;
    line-height:1.45;
    font-family: "Noto Sans Thai", sans-serif;
}
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,
.nav.sidebar-nav .nav-link:hover {
    background:rgba(255,255,255,.08);
    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);}
.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);}
body[data-theme="dark"] .text-muted {color: var(--text-muted) !important;}
.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(30,136,229,.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:#1e88e5;
    --bs-btn-border-color:#1e88e5;
    --bs-btn-hover-bg:#1565c0;
    --bs-btn-hover-border-color:#1565c0;
    --bs-btn-active-bg:#0d47a1;
    --bs-btn-active-border-color:#0d47a1;
    --bs-btn-disabled-bg:#1e88e5;
    --bs-btn-disabled-border-color:#1e88e5;
}
.btn-outline-primary {
    --bs-btn-color:#1e88e5;
    --bs-btn-border-color:#1e88e5;
    --bs-btn-hover-bg:#1e88e5;
    --bs-btn-hover-border-color:#1565c0;
    --bs-btn-active-bg:#0d47a1;
    --bs-btn-active-border-color:#0d47a1;
}
.btn-teal {
    --bs-btn-color:#fff;
    --bs-btn-bg:#008080;
    --bs-btn-border-color:#008080;
    --bs-btn-hover-bg:#006666;
    --bs-btn-hover-border-color:#006666;
    --bs-btn-active-bg:#004d4d;
    --bs-btn-active-border-color:#004d4d;
    --bs-btn-disabled-bg:#008080;
    --bs-btn-disabled-border-color:#008080;
    color:#fff;
}
a.btn-teal {
    color:#fff;
    text-decoration:none;
}
a.btn-teal:hover {
    color:#fff;
}
.btn-pink {
    --bs-btn-color:#fff;
    --bs-btn-bg:#FF1493;
    --bs-btn-border-color:#FF1493;
    --bs-btn-hover-bg:#e01383;
    --bs-btn-hover-border-color:#e01383;
    --bs-btn-active-bg:#c31274;
    --bs-btn-active-border-color:#c31274;
    --bs-btn-disabled-bg:#FF1493;
    --bs-btn-disabled-border-color:#FF1493;
    color:#fff;
}
a.btn-pink {
    color:#fff;
    text-decoration:none;
}
a.btn-pink:hover {
    color:#fff;
}
.btn-orange {
    --bs-btn-color:#fff;
    --bs-btn-bg:#F49713;
    --bs-btn-border-color:#F49713;
    --bs-btn-hover-bg:#d97f0a;
    --bs-btn-hover-border-color:#d97f0a;
    --bs-btn-active-bg:#b86908;
    --bs-btn-active-border-color:#b86908;
    --bs-btn-disabled-bg:#F49713;
    --bs-btn-disabled-border-color:#F49713;
    color:#fff;
}
a.btn-orange {
    color:#fff;
    text-decoration:none;
}
a.btn-orange:hover {
    color:#fff;
}
.btn-icon
{
    padding-left:15px;
    padding-right:15px;
}
/* Projects table */
.table thead th,
.table tbody 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);
    color: var(--text);
}
.table thead th,
.table tbody td {
    color: inherit;
}
.table {
    color: var(--text);
    background: var(--surface);
    border-color: var(--border-color);
}
.table > :not(caption) > * > * {
    background-color: transparent;
    border-color: var(--border-color);
}
.table-hover > tbody > tr:hover > * {
    background-color: var(--surface-alt);
    color: var(--text);
}
.table-bordered > :not(caption) > * {
    border-width:1px;
}
.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;
}
body[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}
.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);
}
.form-select {
    --bs-form-select-bg-img: var(--form-select-indicator);
    background-color: var(--surface-alt);
    border:1px solid var(--border-color);
    color: var(--text);
}
.form-select:focus {
    background-color: 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);
}

/* Auth Page */
.auth-page {
    background: radial-gradient(circle at top left, rgba(30,136,229,.18), transparent 40%),
                radial-gradient(circle at bottom right, rgba(244,151,19,.18), transparent 35%),
                var(--bg);
    min-height:100dvh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:2rem 1rem;
}
.auth-shell {
    width:100%;
    max-width:980px;
}
.auth-card {
    background: var(--surface);
    border:1px solid var(--border-color);
    border-radius:20px;
    display:grid;
    grid-template-columns: 1.05fr .95fr;
    overflow:hidden;
    box-shadow:0 16px 40px -12px rgba(0,0,0,.35);
}
body[data-theme="dark"] .auth-card {background: var(--surface-alt);}
.auth-aside {
    padding:2.2rem 2.4rem;
    background: linear-gradient(145deg, rgba(30,136,229,.12), rgba(244,151,19,.12));
    border-right:1px solid var(--border-color);
    display:flex;
    flex-direction:column;
    gap:2rem;
}
.auth-brand {
    display:flex;
    align-items:center;
    gap:1rem;
}
.brand-badge {
    width:52px;height:52px;
    border-radius:16px;
    background: var(--gradient-accent);
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
    font-size:1.4rem;
    box-shadow:0 10px 20px -10px rgba(0,0,0,.45);
}
.brand-title {font-weight:700;font-size:1.2rem;}
.brand-subtitle {color: var(--text-muted);font-size:.85rem;}
.auth-highlight {
    background: var(--surface);
    border:1px solid var(--border-color);
    border-radius:16px;
    padding:1.25rem 1.4rem;
    box-shadow:0 10px 24px -16px rgba(0,0,0,.35);
}
.auth-highlight .highlight-title {
    font-weight:600;
    margin-bottom:.35rem;
}
.auth-quote {
    display:flex;
    gap:.75rem;
    align-items:flex-start;
    color: var(--text-muted);
    font-size:.9rem;
}
.auth-quote i {font-size:1.2rem;color: var(--bs-primary);}
.auth-form {
    padding:2.2rem 2.4rem;
    display:flex;
    flex-direction:column;
    gap:1.4rem;
}
.auth-form-head {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:1rem;
}
.auth-form h1 {font-size:1.5rem;font-weight:700;margin:0;}
.auth-form p {color: var(--text-muted);margin:0;}
.auth-input .input-group-text {
    background: var(--surface-alt);
    border:1px solid var(--border-color);
    color: var(--text-muted);
}
.auth-input .form-control {
    border-left:0;
}
.auth-link {
    color: var(--bs-primary);
    text-decoration:none;
    font-weight:500;
}
.auth-link:hover {color:#c76f00;}
.auth-footer {
    display:flex;
    align-items:center;
    justify-content:center;
    gap:.5rem;
    color: var(--text-muted);
    font-size:.85rem;
}
@media (max-width: 991.98px) {
    .auth-card {grid-template-columns: 1fr;}
    .auth-aside {border-right:0;border-bottom:1px solid var(--border-color);}
}
@media (max-width: 575.98px) {
    .auth-aside, .auth-form {padding:1.6rem;}
    .auth-form-head {flex-direction:column;align-items:flex-start;}
}