:root {
    --brand-primary: #5f5dff;
    --brand-secondary: #00c6ff;
    --brand-surface: #0f172a;
    --sidebar-width: 250px;
    --sidebar-width-collapsed: 78px;
    --card-gradient: linear-gradient(135deg, rgba(95,93,255,0.08), rgba(0,198,255,0.08));
    --card-shadow: 0 10px 40px rgba(15, 23, 42, 0.2);
    --soft-border: 1px solid rgba(255, 255, 255, 0.06);
    --muted-text: #d9deeb;
    --body-bg: radial-gradient(circle at 20% 20%, rgba(95, 93, 255, 0.08), transparent 32%), radial-gradient(circle at 80% 0%, rgba(0, 198, 255, 0.08), transparent 30%), #0b1224;
}

* {
    font-family: 'Space Grotesk', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body.app-body {
    background: var(--body-bg);
    color: #e8edff;
}

.app-wrapper {
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(6px);
    border-right: var(--soft-border);
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
    transition: all 0.25s ease;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.24);
}

.app-sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}

@media (min-width: 992px) {
    .sidebar-hidden .app-sidebar {
        width: 0;
        opacity: 0;
        transform: translateX(-100%);
        pointer-events: none;
        border-right: 0;
        box-shadow: none;
    }
}

.app-sidebar.collapsed .sidebar-link span:not(.badge),
.app-sidebar.collapsed .sidebar-sublink span,
.app-sidebar.collapsed .sidebar-section .fa-chevron-down,
.app-sidebar.collapsed .sidebar-search,
.app-sidebar.collapsed .badge {
    display: none;
}

.app-sidebar.collapsed .sidebar-sublink {
    margin-left: 0;
}

.app-sidebar.collapsed .sidebar-link,
.app-sidebar.collapsed .nav-link {
    justify-content: center;
}

.sidebar-brand {
    height: 74px;
    border-bottom: var(--soft-border);
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #5f5dff, #00c6ff);
    display: grid;
    place-items: center;
    box-shadow: 0 10px 25px rgba(0, 198, 255, 0.35);
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 10px;
}

.topbar-logo {
    height: auto;
    display: block;
}

.sidebar-menu .nav-link,
.sidebar-link {
    color: #e8edff;
    border-radius: 12px;
    padding: 8px 10px;
    font-weight: 500;
    font-size: 0.92rem;
    display: flex;
    gap: 8px;
    align-items: center;
    transition: all 0.2s ease;
    background: transparent;
}

.sidebar-menu .nav-link:hover,
.sidebar-link:hover,
.sidebar-menu .nav-link.active {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.08);
    color: #9ad7ff;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.sidebar-sublink {
    margin-left: 14px;
}

.sidebar-search .form-control,
.sidebar-search .input-group-text {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e8edff;
}

.sidebar-search .form-control::placeholder {
    color: #8ea0c5;
}

.sidebar-menu .badge {
    font-size: 10px;
}

.app-topbar {
    height: 70px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(8px);
    border-bottom: var(--soft-border);
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #5f5dff, #00c6ff) !important;
    color: #fff;
}

.btn-outline-light {
    color: #e8edff;
    border-color: rgba(255,255,255,0.16);
}

.btn-outline-light:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.content-area {
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
    min-height: calc(100vh - 70px);
}

.card-modern {
    background: rgba(255, 255, 255, 0.04);
    border: var(--soft-border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 14px;
}

.card-modern .card-title {
    color: #f2f4ff;
    font-weight: 700;
    font-size: 1.05rem;
}

.card-modern .muted {
    color: var(--muted-text);
}

.gradient-bar {
    width: 48px;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, #5f5dff, #00c6ff);
    display: inline-block;
}

.widget {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
}

.mini-chart {
    width: 90px;
    height: 42px;
}

.btn-soft-primary,
.btn-soft-secondary,
.btn-soft-light {
    background: rgba(255,255,255,0.06);
    color: #e8edff;
    border: var(--soft-border);
}

.btn-soft-primary:hover {
    background: rgba(95,93,255,0.12);
    color: #fff;
}

.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
}

.modern-input .form-control,
.modern-input .input-group-text {
    border-radius: 12px;
    border-color: rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.04);
    color: #e8edff;
    height: 36px;
}

.modern-input .form-control:focus {
    border-color: rgba(0,198,255,0.3);
    box-shadow: 0 0 0 3px rgba(0,198,255,0.18);
}

.modern-input .input-group-text {
    color: #8bb3ff;
}

table.table {
    color: #1f2533;
    background: rgba(255,255,255,0.95);
}

table.table thead th {
    color: #121827;
    border-color: rgba(0,0,0,0.05);
    background: #e9edf8;
}

table.table tbody td {
    color: #222b3d;
    border-color: rgba(0,0,0,0.05);
    vertical-align: middle;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(255,255,255,0.05);
}

.status-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00d68f;
}

.status-pill.inactive .dot {
    background: #ff5d8f;
}

.badge-soft {
    background: rgba(255,255,255,0.08);
    color: #e8edff;
}

.pagination .page-link {
    background: rgba(255,255,255,0.04);
    border: var(--soft-border);
    color: #e8edff;
}

.pagination .page-link:hover {
    background: rgba(0,198,255,0.18);
    border-color: rgba(0,198,255,0.3);
}

.form-select,
.form-control,
.btn,
.input-group-text {
    border-radius: 12px;
}

.form-control,
.form-select {
    background: rgba(255,255,255,0.04);
    border: var(--soft-border);
    color: #e8edff;
    height: 38px;
    padding: 6px 12px;
}

.form-select option {
    color: #0b1224;
}

.form-control::placeholder {
    color: #c0cbec;
}

.table-responsive {
    border-radius: 12px;
    border: var(--soft-border);
    background: rgba(255,255,255,0.92);
}

.list-group-item {
    color: #1f2533;
    background: #eef1f8;
    border-color: rgba(0,0,0,0.05);
}

.table a,
.table span,
.table div {
    color: #273046;
}

.table .muted,
.table .text-muted,
.table .form-text {
    color: #4b5676 !important;
}

.table .fw-semibold {
    color: #1c2435;
}

.table .btn-soft-secondary {
    color: #5f5dff;
}

.table .btn-soft-danger {
    color: #ff5d8f;
    border-color: rgba(255,93,143,0.35);
}

.table .btn-soft-danger:hover {
    background: rgba(255,93,143,0.12);
}

label,
.form-label,
.text-muted,
.muted,
.form-text {
    color: #e4e8f2 !important;
}

.btn-soft-primary i { color: #5f5dff; }
.btn-soft-secondary i { color: #00c6ff; }
.btn-soft-light i { color: #f2f4ff; }
.btn-soft-primary, .btn-soft-secondary { color: #e8edff; }
.btn-soft-danger i { color: #ff5d8f; }
.btn-soft-danger { color: #ff5d8f; }

.text-strong {
    color: #1c2435 !important;
}

.table .btn {
    padding: 6px 9px;
}

.po-items-table thead th,
.grn-items-table thead th,
.inv-items-table thead th,
.so-items-table thead th,
.si-items-table thead th {
    background: #2f394d;
    color: #f7f9ff;
    border-color: rgba(0,0,0,0.12);
}

.po-items-table tbody td,
.grn-items-table tbody td,
.inv-items-table tbody td,
.so-items-table tbody td,
.si-items-table tbody td {
    background: #f7f9ff;
}

.po-items-table .form-control,
.po-items-table .input-group-text,
.grn-items-table .form-control,
.grn-items-table .input-group-text,
.inv-items-table .form-control,
.inv-items-table .input-group-text,
.so-items-table .form-control,
.so-items-table .input-group-text,
.si-items-table .form-control,
.si-items-table .input-group-text {
    background: #ffffff;
    border-color: #9aa4bb;
    color: #1f2533;
}

.po-items-table .form-control:focus,
.grn-items-table .form-control:focus,
.inv-items-table .form-control:focus,
.so-items-table .form-control:focus,
.si-items-table .form-control:focus {
    border-color: #4e7bff;
    box-shadow: 0 0 0 0.1rem rgba(78,123,255,0.25);
}

.po-items-table ::placeholder,
.grn-items-table ::placeholder,
.inv-items-table ::placeholder,
.so-items-table ::placeholder,
.si-items-table ::placeholder {
    color: #6d7890;
    opacity: 1;
}

.po-items-table .input-group-text,
.grn-items-table .input-group-text,
.inv-items-table .input-group-text,
.so-items-table .input-group-text,
.si-items-table .input-group-text {
    color: #5a657c;
}

.si-items-table {
    border-collapse: collapse;
}

.si-items-table thead th,
.si-items-table tbody td {
    padding: 2px 4px;
}

.si-items-table .form-control,
.si-items-table .input-group-text {
    height: 50px;
    padding: 10px 12px;
    font-size: 1rem;
    min-width: 0;
}

.po-barcode .form-control,
.grn-barcode .form-control,
.inv-barcode .form-control,
.so-barcode .form-control,
.si-barcode .form-control {
    min-width: 320px;
}

.po-add-row,
.grn-add-row,
.inv-add-row,
.so-add-row,
.si-add-row {
    min-width: 120px;
}

.modal-content {
    background: rgba(15,23,42,0.95);
    border: var(--soft-border);
    color: #e8edff;
}

.modal .btn-close {
    filter: invert(1);
    opacity: 0.75;
}

.modal .btn-close:hover {
    opacity: 1;
}

.tooltip-inner {
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.1);
}

.collapse-toggle i {
    transition: transform 0.2s ease;
}

.collapse.show + .collapse-toggle i,
.sidebar-link[aria-expanded="true"] i.fa-chevron-down {
    transform: rotate(180deg);
}

.search-highlight {
    background: rgba(0,198,255,0.22);
}

@media (max-width: 991px) {
    .app-sidebar {
        position: fixed;
        z-index: 20;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .app-content {
        width: 100%;
    }
}

@page {
    size: A4;
    margin: 12mm;
}
