:root {
    --primary: #4e73df;
    --primary-dark: #2e59d9;
    --sidebar-width: 250px;
    --topbar-height: 70px;
    --body-bg: #f4f7fc;
    --text-main: #273240;
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Noto Sans Thai", sans-serif;
    color: var(--text-main);
}

a,
button {
    transition: all 0.2s ease;
}

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
}

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 15%, rgba(255, 255, 255, 0.14), transparent 25%),
        radial-gradient(circle at 90% 85%, rgba(255, 255, 255, 0.1), transparent 30%),
        linear-gradient(135deg, #224abe, #4e73df 55%, #36b9cc);
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.login-card {
    width: min(980px, 100%);
    overflow: hidden;
    border-radius: 20px;
}

.login-visual {
    min-height: 580px;
    align-items: flex-end;
    padding: 56px;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(20, 50, 130, 0.18), rgba(20, 50, 130, 0.8)),
        linear-gradient(145deg, #36b9cc, #4e73df);
}

.brand-mark {
    display: grid;
    width: 68px;
    height: 68px;
    place-items: center;
    border-radius: 18px;
    font-size: 30px;
    color: var(--primary);
    background: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
}

.login-form {
    padding: 56px 48px;
}

.login-form .form-label {
    font-weight: 600;
}

.login-form .input-group-text,
.login-form .form-control,
.login-form .password-toggle {
    min-height: 54px;
    font-size: 1rem;
    border-color: #dce2ec;
}

.login-form .input-group-text {
    min-width: 50px;
    justify-content: center;
    color: #8590a3;
    background: #f8f9fc;
}

.login-form .form-control:focus {
    border-color: #86a1ed;
    box-shadow: none;
}

.dashboard-page {
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--body-bg);
}

.topbar {
    position: fixed;
    z-index: 1040;
    top: 0;
    right: 0;
    left: 0;
    height: var(--topbar-height);
    padding: 0 24px;
    background: linear-gradient(100deg, #224abe, var(--primary));
    box-shadow: 0 3px 16px rgba(30, 48, 88, 0.15);
}

.topbar .navbar-brand {
    width: calc(var(--sidebar-width) - 24px);
    color: #fff;
}

.brand-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    margin-right: 10px;
    border-radius: 10px;
    color: var(--primary);
    background: #fff;
}

.brand-text {
    font-weight: 700;
    letter-spacing: 0.2px;
}

.user-avatar {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}

.app-shell {
    display: flex;
    min-height: 100vh;
    padding-top: var(--topbar-height);
}

.sidebar {
    position: fixed;
    z-index: 1030;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    color: rgba(255, 255, 255, 0.75);
    background: #192338;
    transition: transform 0.25s ease;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 14px;
}

.sidebar-heading {
    margin: 18px 12px 8px;
    color: rgba(255, 255, 255, 0.38);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-heading:first-child {
    margin-top: 0;
}

.sidebar .nav-item {
    display: flex;
    width: 100%;
    align-items: center;
    margin-bottom: 4px;
    padding: 12px 14px;
    border: 0;
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.68);
    text-align: left;
    text-decoration: none;
    background: transparent;
}

.sidebar .nav-item i {
    width: 28px;
    font-size: 0.95rem;
}

.sidebar .nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar .nav-item.active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 6px 16px rgba(78, 115, 223, 0.3);
}

.sidebar-parent .submenu-chevron {
    width: auto !important;
    font-size: 0.7rem !important;
    transition: transform 0.2s ease;
}

.sidebar-parent[aria-expanded="true"] .submenu-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    margin: 2px 0 8px 18px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-submenu .submenu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.86rem;
    text-decoration: none;
}

.sidebar-submenu .submenu-item i {
    width: 20px;
    font-size: 0.8rem;
}

.sidebar-submenu .submenu-item:hover,
.sidebar-submenu .submenu-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-footer {
    padding: 18px 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.main-content {
    display: flex;
    width: calc(100% - var(--sidebar-width));
    min-height: calc(100vh - var(--topbar-height));
    margin-left: var(--sidebar-width);
    flex-direction: column;
    transition: all 0.25s ease;
}

.stat-card {
    border-radius: 13px;
}

.stat-card .card-body {
    padding: 22px;
}

.stat-label {
    margin-bottom: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.025em;
}

.stat-value {
    margin-bottom: 8px;
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-change {
    color: #8490a5;
    font-size: 0.75rem;
}

.stat-change.positive {
    color: #1cc88a;
}

.stat-change.negative {
    color: #e74a3b;
}

.stat-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 12px;
    font-size: 1.15rem;
}

.icon-primary { color: #4e73df; background: #e8edfc; }
.icon-success { color: #1cc88a; background: #e5f8f1; }
.icon-warning { color: #f6c23e; background: #fff7e2; }
.icon-danger { color: #e74a3b; background: #fce9e7; }

.chart-placeholder {
    height: 285px;
    padding-top: 18px;
}

.chart-bars {
    display: flex;
    height: 230px;
    align-items: flex-end;
    justify-content: space-around;
    gap: 16px;
    padding: 0 12px;
    border-bottom: 1px solid #e4e8f0;
    background: repeating-linear-gradient(to bottom, #edf0f6 0, #edf0f6 1px, transparent 1px, transparent 55px);
}

.chart-bars span {
    width: min(42px, 10%);
    border-radius: 7px 7px 0 0;
    background: linear-gradient(to top, #4e73df, #7c9aef);
}

.chart-labels {
    display: flex;
    justify-content: space-around;
    padding: 12px 12px 0;
    color: #8b95a7;
    font-size: 0.75rem;
}

.activity-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.activity-item:not(:last-child)::after {
    position: absolute;
    top: 42px;
    bottom: -20px;
    left: 19px;
    width: 1px;
    content: "";
    background: #e2e6ee;
}

.activity-icon {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border-radius: 10px;
}

.activity-item p {
    margin: 0 0 2px;
    font-size: 0.9rem;
    font-weight: 600;
}

.activity-item small {
    color: #8a94a6;
    font-size: 0.72rem;
}

.permission-option {
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.permission-option:hover {
    border-color: #b7c6f3 !important;
    background: #f8faff;
}

.customer-address {
    max-width: 280px;
}

.customer-price-selector {
    width: min(440px, 100%);
}

.price-route-card {
    padding: 18px;
    border: 1px solid #d7e1f5;
    border-radius: 12px;
    background: #f7f9fd;
}

.price-input {
    min-height: 44px;
    font-weight: 600;
}

.sticky-save-bar {
    position: sticky;
    z-index: 10;
    bottom: 16px;
    padding: 14px;
    border: 1px solid #e2e7f0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 30px rgba(34, 74, 190, 0.14);
    backdrop-filter: blur(10px);
}

.select2-container--bootstrap-5 .select2-selection {
    min-height: 38px;
}

.shipment-detail-row {
    background: #f8faff;
}

.shipment-preview-image {
    width: 92px;
    height: 92px;
    border: 1px solid #dce3ef;
    border-radius: 10px;
    object-fit: cover;
}

.first-group-heading:first-of-type {
    margin-top: 0 !important;
}

.footer {
    padding: 20px 0;
}

.sidebar-backdrop {
    display: none;
}

body.sidebar-collapsed .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}

body.sidebar-collapsed .main-content {
    width: 100%;
    margin-left: 0;
}

@media (max-width: 991.98px) {
    .topbar .navbar-brand {
        width: auto;
    }

    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
    }

    .main-content {
        width: 100%;
        margin-left: 0;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-backdrop {
        position: fixed;
        z-index: 1020;
        inset: var(--topbar-height) 0 0;
        display: block;
        background: rgba(17, 24, 39, 0.48);
    }
}

@media (max-width: 575.98px) {
    .login-form {
        padding: 38px 26px;
    }

    .topbar {
        padding: 0 14px;
    }

    .brand-text {
        display: none;
    }

    .chart-bars {
        gap: 8px;
    }
}
