:root {
    --color-bg: #F0F2F5;
    --color-primary: #D97706;
    --color-secondary: #F59E0B;
    --color-surface: #FFFFFF;
    --color-border: #F0F0F0;
    --color-text: rgba(0, 0, 0, 0.88);
    --color-text-muted: rgba(0, 0, 0, 0.45);
    --color-icon: rgba(0, 0, 0, 0.45);
    --color-sidebar-bg: #FFFFFF;
    --color-sidebar-active: rgba(217, 119, 6, 0.10);
    --radius-xl: 12px;
    --radius-lg: 10px;
    --shadow-soft: 0 6px 16px rgba(0, 0, 0, 0.08);
    --shadow-soft-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --sider-width: 280px;
    --sider-collapsed-width: 64px;
    --topbar-height: 56px;
    --sider-header-height: 96px;

    --bs-body-bg: var(--color-bg);
    --bs-body-color: var(--color-text);
    --bs-border-color: var(--color-border);
    --bs-link-color: var(--color-primary);
    --bs-link-hover-color: #B45309;

    --bs-primary: #D97706;
    --bs-primary-rgb: 217, 119, 6;
    --bs-secondary: #F59E0B;
    --bs-secondary-rgb: 245, 158, 11;
    --bs-warning: #F59E0B;
    --bs-warning-rgb: 245, 158, 11;
}

body {
    background-color: var(--color-bg) !important;
    color: var(--color-text);
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
}

#wrapper {
    display: flex;
    overflow-x: hidden;
    min-height: 100vh;
}

#sidebar-overlay {
    display: none;
}

#sidebar-wrapper {
    min-height: 100vh;
    width: var(--sider-width);
    padding: 0;
    transition: width 0.18s ease;
    background-color: var(--color-sidebar-bg) !important;
    border-right: 1px solid var(--color-border);
}

.sidebar-card {
    height: 100vh;
    border-radius: 0;
    background: var(--color-sidebar-bg);
    box-shadow: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-card .sidebar-heading {
    height: var(--sider-header-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    text-decoration: none;
    width: 100%;
    overflow: hidden;
}

.sidebar-logo:hover {
    color: var(--color-text);
}

.sidebar-logo .logo-img {
    width: 160px;
    max-width: 100%;
    max-height: 84px;
    height: auto;
    object-fit: contain;
}

.sidebar-card .list-group {
    padding: 8px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-card .list-group::-webkit-scrollbar {
    width: 0;
    height: 0;
}

#sidebar-wrapper .list-group-item {
    background-color: transparent !important;
    color: var(--color-text) !important;
    border: none !important;
    transition: background-color 0.15s ease;
    font-weight: 500;
    font-size: 14px;
    border-radius: 8px;
    margin-bottom: 4px;
    padding: 0 12px !important;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

#sidebar-wrapper .list-group-item:hover {
    background-color: rgba(0, 0, 0, 0.04) !important;
}

#sidebar-wrapper .list-group-item.active {
    background-color: var(--color-sidebar-active) !important;
    color: var(--color-primary) !important;
    font-weight: 600;
}

#sidebar-wrapper .list-group-item i {
    color: var(--color-icon) !important;
    font-size: 16px;
}

#sidebar-wrapper .list-group-item.active i {
    color: var(--color-primary) !important;
}

#sidebar-wrapper .list-group-item:hover i {
    color: var(--color-text) !important;
}

#sidebar-wrapper .list-group-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--color-primary);
    border-radius: 3px;
}

#page-content-wrapper {
    flex: 1;
    min-width: 0;
}

#wrapper.sidebar-collapsed #sidebar-wrapper {
    width: var(--sider-collapsed-width);
}

@media (max-width: 991.98px) {
    #wrapper {
        display: block;
    }

    #sidebar-wrapper {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: min(86vw, 320px);
        transform: translateX(-105%);
        transition: transform 0.18s ease;
        z-index: 1040;
        box-shadow: var(--shadow-soft);
    }

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

    #sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 1035;
    }

    #wrapper.sidebar-open #sidebar-overlay {
        display: block;
    }

    #page-content-wrapper {
        width: 100% !important;
    }

    #wrapper.sidebar-collapsed #sidebar-wrapper {
        width: min(86vw, 320px);
    }
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    margin: 0;
    border-radius: 0;
    background: var(--color-surface) !important;
    box-shadow: none;
    border-bottom: 1px solid var(--color-border);
    min-height: var(--topbar-height);
}

.app-content {
    padding-top: 0 !important;
}

.topbar-meta .topbar-title {
    line-height: 1.1;
}

.btn-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    padding: 0;
}

.btn-soft {
    border: 1px solid var(--color-border) !important;
    background: var(--color-surface) !important;
    color: var(--color-text) !important;
}

.btn-soft:hover {
    background: var(--color-surface-2) !important;
    transform: translateY(-1px);
}

@media (min-width: 768px) {
    #page-content-wrapper {
        width: 100%;
    }
}

.card {
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    box-shadow: none;
}

.card-header.bg-primary {
    background-color: var(--color-primary) !important;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
}

.card-header.bg-dark {
    background-color: var(--color-secondary) !important;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
}

.btn-primary {
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    border-radius: 10px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
}

.btn-primary:hover {
    background-color: var(--color-secondary) !important;
    border-color: var(--color-secondary) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.18);
}

.btn-success {
    background-color: #28a745 !important;
    border-radius: 10px;
    font-weight: 600;
}

.text-primary {
    color: var(--color-primary) !important;
}

.bg-primary {
    background-color: var(--color-primary) !important;
}

.bg-warning {
    background-color: var(--color-secondary) !important;
}

.text-warning {
    color: var(--color-secondary) !important;
}

.bg-dark {
    background-color: var(--color-primary) !important;
}

.text-muted {
    color: var(--color-text-muted) !important;
}

.btn-outline-primary {
    color: var(--color-primary) !important;
    border-color: rgba(217, 119, 6, 0.35) !important;
}

.btn-outline-primary:hover {
    color: #fff !important;
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

.btn-outline-secondary {
    color: #92400E !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}

.btn-outline-secondary:hover {
    color: #111827 !important;
    background-color: rgba(245, 158, 11, 0.18) !important;
    border-color: rgba(245, 158, 11, 0.18) !important;
}

.form-control,
.form-select {
    border-radius: 12px;
    background-color: #ffffff;
    border: 1px solid #D9D9D9;
    box-shadow: none !important;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(217, 119, 6, 0.6);
    box-shadow: 0 0 0 0.2rem rgba(217, 119, 6, 0.18) !important;
}

.form-control:hover,
.form-select:hover {
    border-color: rgba(0, 0, 0, 0.25);
}

.form-control::placeholder {
    color: rgba(0, 0, 0, 0.35);
}

.input-group-text {
    background-color: #ffffff !important;
    border: 1px solid #D9D9D9 !important;
    color: rgba(0, 0, 0, 0.45) !important;
}

.table {
    --bs-table-bg: transparent;
}

.table thead th {
    background-color: rgba(231, 229, 228, 0.35);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.8px;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}

.table tbody tr {
    border-color: rgba(0,0,0,0.04);
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.badge {
    font-weight: 600;
    padding: 0.5em 1em;
}

.badge.bg-primary {
    background-color: var(--color-primary) !important;
}

.badge.bg-warning {
    background-color: var(--color-secondary) !important;
    color: #111827 !important;
}

.logo-container img {
    max-width: 130px;
    height: auto;
}

.report-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.report-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 34px 0 rgba(0,0,0,0.07);
}

.kpi-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: none;
}

.kpi-card .kpi-label {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 600;
}

.kpi-card .kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.05;
    color: #111827;
}

.kpi-card .kpi-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(245, 158, 11, 0.14);
    color: var(--color-primary);
}

.badge-soft-success {
    background: #ECFDF5;
    color: #065F46;
    border: 1px solid rgba(6, 95, 70, 0.12);
}

.badge-soft-warning {
    background: #FFFBEB;
    color: #92400E;
    border: 1px solid rgba(146, 64, 14, 0.14);
}

.badge-soft-danger {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid rgba(153, 27, 27, 0.14);
}

.table-zebra tbody tr:nth-child(even) {
    background-color: rgba(248, 247, 244, 0.7);
}

.topbar-search .form-control {
    border-radius: 999px;
    min-width: 320px;
    background: #F5F5F5;
    border: 1px solid #F5F5F5;
}

.avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.18);
    color: #92400E;
    font-weight: 700;
    border: 1px solid rgba(146, 64, 14, 0.12);
}

.hint {
    position: relative;
    outline: none;
}

.hint[data-hint] {
    cursor: help;
}

.hint[data-hint]::before,
.hint[data-hint]::after {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.hint[data-hint]::after {
    content: attr(data-hint);
    left: 12px;
    top: calc(100% + 12px);
    z-index: 2000;
    max-width: 320px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    box-shadow: var(--shadow-soft-sm);
    color: var(--color-text);
    font-size: 12px;
    line-height: 1.35;
    transform: translateY(-4px);
}

.hint[data-hint]::before {
    content: "";
    left: 24px;
    top: calc(100% + 6px);
    z-index: 2001;
    width: 10px;
    height: 10px;
    background: #FFFBEB;
    border-left: 1px solid #FDE68A;
    border-top: 1px solid #FDE68A;
    transform: translateY(-4px) rotate(45deg);
}

.hint[data-hint]:hover::before,
.hint[data-hint]:hover::after,
.hint[data-hint]:focus::before,
.hint[data-hint]:focus::after {
    opacity: 1;
    transform: translateY(0);
}

#wrapper.sidebar-collapsed #sidebar-wrapper .menu-text {
    display: none;
}

#wrapper.sidebar-collapsed #sidebar-wrapper .sidebar-heading {
    height: var(--topbar-height);
}

#wrapper.sidebar-collapsed #sidebar-wrapper .logo-img {
    width: 44px;
    max-height: 44px;
}

#wrapper.sidebar-collapsed #sidebar-wrapper .list-group-item {
    justify-content: center;
    padding: 0 !important;
}

#wrapper.sidebar-collapsed #sidebar-wrapper .list-group-item i {
    margin-right: 0 !important;
}

#wrapper.sidebar-collapsed #sidebar-wrapper .list-group-item.active::before {
    top: 10px;
    bottom: 10px;
}

.container-fluid.app-content {
    padding: 24px !important;
}

@media (max-width: 991.98px) {
    .container-fluid.app-content {
        padding: 16px !important;
    }

    .card > .card-body:not(.p-0) {
        padding: 16px !important;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 575.98px) {
    .form-control,
    .form-select {
        font-size: 16px;
    }
}

.btn-outline-secondary,
.btn-outline-danger,
.btn-outline-primary,
.btn-outline-light {
    border-radius: 10px;
}

.login-card {
    border: 1px solid rgba(0,0,0,0.05);
}
