:root {
    --erp-sidebar: #333333;
    --erp-sidebar-border: #f7f7f7;
    --erp-accent: #d26d4a;
    --erp-accent-dark: #b85838;
    --erp-topbar: #eeeeee;
    --erp-bg: #f7f7f7;
    --erp-border: #dddddd;
    --erp-text: #0c0c0c;
    --erp-sidebar-width: 250px;
}

html, body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--erp-bg);
    color: var(--erp-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    font-size: 15px;
}

a {
    color: #2570a9;
}

.erp-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: var(--erp-sidebar-width);
    overflow: hidden;
    color: #fff;
    background: var(--erp-sidebar);
    box-shadow: 0 0 10px rgba(12, 12, 12, .4);
    transition: transform .35s ease;
}

.erp-sidebar-brand {
    display: flex;
    align-items: center;
    height: 50px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .75);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .08em;
    text-decoration: none;
}

.erp-sidebar-brand:hover {
    color: #fff;
}

.erp-sidebar-nav {
    height: calc(100vh - 50px);
    padding-bottom: 80px;
    overflow-y: auto;
}

.erp-sidebar-nav::-webkit-scrollbar {
    width: 5px;
    background: #eee;
}

.erp-sidebar-nav::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: #999;
}

.erp-menu-group {
    border-bottom: 1px solid var(--erp-sidebar-border);
}

.erp-menu-group > summary {
    display: flex;
    align-items: center;
    min-height: 58px;
    padding: 12px 15px;
    cursor: pointer;
    list-style: none;
    color: #fff;
    font-size: 17px;
    user-select: none;
}

.erp-menu-group > summary::-webkit-details-marker {
    display: none;
}

.erp-menu-group > summary::after {
    content: "\F282";
    margin-left: auto;
    font-family: "bootstrap-icons";
    font-size: 13px;
    transition: transform .2s ease;
}

.erp-menu-group[open] > summary::after {
    transform: rotate(180deg);
}

.erp-menu-group[open] > summary {
    box-shadow: 0 0 5px #0c0c0c;
}

.erp-menu-group .menu-icon {
    width: 30px;
    margin-right: 10px;
    text-align: center;
    font-size: 21px;
}

.erp-submenu {
    margin: 0;
    padding: 0;
    background: #fff;
    list-style: none;
}

.erp-submenu li {
    border-bottom: 1px solid var(--erp-border);
}

.erp-submenu li:last-child {
    border-bottom: 0;
}

.erp-submenu a {
    position: relative;
    display: block;
    padding: 10px 20px 10px 40px;
    color: var(--erp-text);
    text-decoration: none;
}

.erp-submenu a::before {
    position: absolute;
    top: 50%;
    left: 18px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--erp-border);
    content: "";
    transform: translate(-50%, -50%);
}

.erp-submenu a::after {
    position: absolute;
    inset: 0 auto 0 17px;
    width: 2px;
    background: var(--erp-border);
    content: "";
}

.erp-submenu a:hover,
.erp-submenu a.active {
    color: #fff;
    background: var(--erp-accent);
}

.erp-submenu a:hover::before,
.erp-submenu a:hover::after,
.erp-submenu a.active::before,
.erp-submenu a.active::after {
    background: #fff;
}

.erp-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    margin-left: var(--erp-sidebar-width);
    padding: 0 20px;
    border-bottom: 1px solid var(--erp-border);
    background: var(--erp-topbar);
    box-shadow: 0 0 5px rgba(12, 12, 12, .2);
    transition: margin-left .35s ease;
}

.erp-menu-toggle,
.erp-user-toggle {
    border: 0;
    background: transparent;
    color: var(--erp-text);
}

.erp-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 15px;
}

.erp-menu-toggle i {
    font-size: 28px;
}

.erp-topbar-title {
    overflow: hidden;
    margin: 0 20px;
    font-size: 17px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erp-user-menu {
    position: relative;
}

.erp-user-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 0;
}

.erp-user-toggle .avatar {
    display: inline-grid;
    width: 31px;
    height: 31px;
    border-radius: 50%;
    background: var(--erp-sidebar);
    color: #fff;
    place-items: center;
}

.erp-user-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    display: none;
    min-width: 160px;
    padding: 8px 14px;
    border: 1px solid var(--erp-border);
    background: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .15);
}

.erp-user-menu.open .erp-user-dropdown {
    display: block;
}

.erp-user-dropdown a {
    display: block;
    padding: 7px 2px;
    border-bottom: 1px solid var(--erp-border);
    color: var(--erp-text);
    text-decoration: none;
}

.erp-user-dropdown a:last-child {
    border-bottom: 0;
}

.erp-content {
    min-height: calc(100vh - 90px);
    margin-left: var(--erp-sidebar-width);
    padding: 20px 20px 80px;
    transition: margin-left .35s ease;
}

.erp-footer {
    margin-left: var(--erp-sidebar-width);
    padding: 15px 20px;
    border-top: 1px solid var(--erp-border);
    color: #777;
    text-align: center;
    transition: margin-left .35s ease;
}

.erp-shell.menu-closed .erp-sidebar {
    transform: translateX(-100%);
}

.erp-shell.menu-closed .erp-topbar,
.erp-shell.menu-closed .erp-content,
.erp-shell.menu-closed .erp-footer {
    margin-left: 0;
}

.erp-overlay {
    position: fixed;
    inset: 0;
    z-index: 1035;
    visibility: hidden;
    background: rgba(0, 0, 0, .38);
    opacity: 0;
    transition: .2s ease;
}

.erp-content > .d-flex:first-of-type,
.erp-content > h1:first-child {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--erp-border);
}

.erp-content h1.h3 {
    font-size: 21px;
    font-weight: 600;
}

.card {
    border: 1px solid var(--erp-border);
    border-radius: 5px;
    box-shadow: 2px 2px 5px rgba(12, 12, 12, .16);
}

.card-header {
    border-bottom-color: var(--erp-border);
    background: #f1f1f1;
}

.metric {
    box-shadow: 2px 2px 5px rgba(12, 12, 12, .14);
}

.metric .metric-label {
    margin-bottom: 6px;
    color: #6c757d;
    font-size: 13px;
}

.metric .metric-value {
    overflow: hidden;
    font-size: clamp(17px, 1.5vw, 23px);
    font-weight: 650;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erp-filter {
    overflow: hidden;
}

.erp-filter > summary {
    display: flex;
    align-items: center;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.erp-filter > summary::-webkit-details-marker {
    display: none;
}

.erp-filter > summary::after {
    margin-left: auto;
    content: "\F282";
    font-family: "bootstrap-icons";
    transition: transform .2s ease;
}

.erp-filter[open] > summary::after {
    transform: rotate(180deg);
}

.erp-filter .form-label {
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}

.erp-filter .btn {
    white-space: nowrap;
}

.report-chart {
    position: relative;
    height: 360px;
}

.table {
    --bs-table-hover-bg: rgba(210, 109, 74, .08);
    margin-bottom: 0;
}

.table thead th {
    padding-top: .7rem;
    padding-bottom: .7rem;
    border-bottom-width: 1px;
    background: #f3f3f3;
    white-space: nowrap;
}

.table tbody tr:nth-child(even) td {
    background: rgba(0, 0, 0, .018);
}

.btn {
    border-radius: 2px;
}

.btn-primary {
    border-color: var(--erp-accent);
    background: var(--erp-accent);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--erp-accent-dark);
    background: var(--erp-accent-dark);
}

.btn-outline-primary {
    border-color: var(--erp-accent);
    color: var(--erp-accent-dark);
}

.btn-outline-primary:hover {
    border-color: var(--erp-accent);
    background: var(--erp-accent);
}

.form-control,
.form-select {
    border-radius: 2px;
}

input[type="date"],
input[type="datetime-local"] {
    cursor: pointer;
}

.product-filter {
    position: relative;
    min-width: 240px;
}

.product-filter-dropdown {
    position: fixed;
    z-index: 1060;
    max-height: 280px;
    overflow-y: auto;
    padding: 5px;
    border: 1px solid var(--erp-border);
    border-radius: 3px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(0, 0, 0, .18);
}

.product-filter-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.product-filter-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 10px;
    border-radius: 2px;
    cursor: pointer;
}

.product-filter-list li:hover,
.product-filter-list li.active {
    background: rgba(210, 109, 74, .12);
}

.product-filter-list small {
    flex: none;
    color: #6c757d;
}

.product-filter-empty {
    margin: 0;
    padding: 10px;
    color: #6c757d;
    text-align: center;
}

.alert {
    border-radius: 3px;
}

.erp-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: #f8f9fa;
}

.erp-login-card {
    width: 100%;
    max-width: 420px;
    border: 0;
    background: #fff;
    box-shadow: 0 2px 10px rgba(12, 12, 12, .12);
}

.erp-login-card .card-body {
    padding: 34px 24px 24px;
}

.erp-login-mark {
    margin: 8px auto 32px;
    color: #bc8a55;
    text-align: center;
}

.erp-login-mark .mark-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: .2em;
}

.erp-login-mark .mark-subtitle {
    font-size: 11px;
    letter-spacing: .45em;
}

.erp-login-card .input-group-text {
    min-width: 42px;
    justify-content: center;
    border-radius: 2px 0 0 2px;
}

.erp-login-card .card-footer {
    border-top: 1px solid var(--erp-border);
    background: #fafafa;
    color: #6c757d;
    text-align: center;
}

@media (max-width: 1100px) {
    .erp-content > .d-flex:first-of-type {
        flex-wrap: wrap;
        gap: 12px;
    }

    .erp-content > .d-flex:first-of-type form {
        display: flex;
        flex: 1 1 100%;
        flex-wrap: wrap;
    }

    .erp-content > .d-flex:first-of-type form .form-control {
        flex: 1 1 150px;
        width: auto;
    }
}

@media (max-width: 767px) {
    .erp-sidebar {
        transform: translateX(-100%);
    }

    .erp-topbar,
    .erp-content,
    .erp-footer {
        margin-left: 0;
    }

    .erp-shell.menu-open .erp-sidebar {
        transform: translateX(0);
    }

    .erp-shell.menu-open .erp-overlay {
        visibility: visible;
        opacity: 1;
    }

    .erp-topbar {
        padding: 0 15px;
    }

    .erp-topbar-title {
        display: none;
    }

    .erp-content {
        padding: 18px 15px 60px;
    }

    .erp-content > .d-flex:first-of-type {
        align-items: stretch !important;
        flex-direction: column;
        gap: 12px;
    }

    .erp-content > .d-flex:first-of-type form {
        flex-wrap: wrap;
    }

    .erp-user-toggle .user-name {
        display: none;
    }

    .report-chart {
        height: 300px;
    }
}
