:root {
    --primary-color: #c62828;
    --primary-dark: #8e0000;
    --primary-soft: #ffebee;
    --sidebar-bg: #ffffff;
    --sidebar-soft: #fff8f8;
    --text-dark: #1f2937;
    --text-muted: #64748b;
    --border-color: #e8d5d5;
    --surface: #ffffff;
    --surface-alt: #fffbfb;
    --success: #2e7d32;
    --warning: #e65100;
    --danger: #b71c1c;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: radial-gradient(circle at top right, #fff5f5 0%, #fffbfb 45%, #faf5f5 100%);
    color: var(--text-dark);
    min-height: 100vh;
}

.navbar-custom {
    background: linear-gradient(90deg, #ffffff, #fff8f8);
    padding: 0.8rem 1.4rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 18px rgba(198, 40, 40, 0.08);
}

.navbar-brand-custom {
    color: var(--text-dark) !important;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.2px;
}

.admin-brand-logo {
    height: 34px;
    width: auto;
    display: block;
    object-fit: contain;
}

.admin-login-logo {
    max-width: 230px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.navbar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dark);
}

.navbar-user-info .user-role {
    font-size: 12px;
    color: var(--text-muted);
}

.navbar-logout-btn {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.navbar-logout-btn:hover {
    background: var(--primary-soft);
    border-color: var(--primary-dark);
    color: var(--primary-dark);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e53935, #c62828);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.sidebar {
    background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-soft));
    min-height: calc(100vh - 58px);
    padding: 1rem 0.75rem;
    border-right: 1px solid var(--border-color);
}

.sidebar .nav-link {
    color: var(--text-muted);
    margin: 0.2rem 0;
    padding: 0.7rem 0.85rem;
    font-size: 0.92rem;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    color: var(--primary-dark);
    background: var(--primary-soft);
    border-color: #ffcdd2;
}

.sidebar .nav-link.active {
    color: var(--primary-dark);
    background: var(--primary-soft);
    border-color: #ef9a9a;
    box-shadow: inset 3px 0 0 var(--primary-color);
    font-weight: 600;
}

.sidebar .nav-link i {
    margin-right: 8px;
    width: 20px;
}

.main-content {
    padding: 1.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 1.3rem;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    color: #5d0000;
}

.card {
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.07);
    border-radius: var(--radius);
    background: var(--surface);
}

.card > .card-body.p-0,
.card > .table-responsive {
    overflow: hidden;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.stat-card {
    text-align: center;
    padding: 1.4rem 1rem;
    background: linear-gradient(180deg, #ffffff, #fff8f8);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: var(--primary-dark);
}

.report-group-card .card-header {
    border-bottom: 1px solid var(--border-color);
}

.report-group-card .table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.84rem;
    margin-top: 2px;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 183, 77, 0.25), transparent 35%),
        radial-gradient(circle at 85% 80%, rgba(198, 40, 40, 0.28), transparent 40%),
        linear-gradient(135deg, #3d0a0a, #1a1212);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 430px;
    padding: 1.9rem;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.38);
}

.dispatch-timeline {
    border-left: 3px solid rgba(198, 40, 40, 0.45);
    padding-left: 1.2rem;
    margin-left: 0.3rem;
}

.dispatch-timeline .dispatch-item {
    position: relative;
    margin-bottom: 1.2rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px dashed #f5d0d0;
}

.dispatch-timeline .dispatch-item::before {
    content: '';
    position: absolute;
    left: -1.55rem;
    top: 0.3rem;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.2);
}

.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-alt);
}

.table td {
    vertical-align: middle;
    border-color: #edf2f7;
}

.table-hover tbody tr:hover {
    background: #fff5f5;
}

.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    padding: 0.55rem 0.72rem;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #ef9a9a;
    box-shadow: 0 0 0 0.2rem rgba(198, 40, 40, 0.15);
}

.btn {
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.1px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(90deg, #e53935, #c62828);
    border-color: #b71c1c;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(198, 40, 40, 0.3);
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-warning:hover,
.btn-outline-success:hover,
.btn-outline-danger:hover {
    transform: translateY(-1px);
}

.badge {
    border-radius: 999px;
    padding: 0.4em 0.7em;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-status {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

.alert {
    border-radius: 12px;
    border-width: 1px;
}

.pagination .page-link {
    border-radius: 8px;
    margin: 0 3px;
    border-color: #f0d4d4;
    color: #8e0000;
}

.pagination .page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.qty-pending {
    color: var(--warning);
    font-weight: 700;
}

.qty-complete {
    color: var(--success);
    font-weight: 600;
}

.invoice-upload-card {
    border: 1px solid #ffcdd2;
    border-radius: 12px;
    padding: 14px;
    background: linear-gradient(180deg, #fffbfb, #ffebee);
}

.invoice-upload-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #b71c1c;
    margin-bottom: 8px;
}

.invoice-chip {
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    background: #f0fdf4;
    padding: 10px 12px;
}

.invoice-chip-title {
    font-weight: 700;
    color: #166534;
}

.invoice-chip-amount {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-weight: 700;
    font-size: 0.85rem;
}

.product-thumb,
.product-image-preview {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: #fff;
}

.product-image-preview {
    width: 120px;
    height: 120px;
}

.product-thumb-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--surface-alt);
}

.searchable-choices.is-open {
    z-index: 2001;
}

.searchable-choices {
    position: relative;
    width: 100%;
    margin-bottom: 0;
    font-size: 1rem;
}

.searchable-choices .choices__list--single .choices__item {
    padding: 0;
    line-height: 1.5;
    font-size: 0.9375rem;
}

.searchable-choices .choices__inner {
    min-height: calc(1.5em + 0.75rem + 2px);
    padding: 0.4rem 2.25rem 0.4rem 0.72rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.searchable-choices.is-focused .choices__inner,
.searchable-choices.is-open .choices__inner {
    border-color: #ef9a9a;
    box-shadow: 0 0 0 0.2rem rgba(198, 40, 40, 0.15);
}

.searchable-choices .choices__list--single {
    padding: 0;
}

.searchable-choices .choices__placeholder {
    color: #6c757d;
    opacity: 1;
}

.searchable-choices::after {
    border-color: #343a40 transparent transparent;
    right: 0.85rem;
}

.searchable-choices.is-open::after {
    margin-top: -2.5px;
}

.searchable-choices .choices__list--dropdown,
.searchable-choices .choices__list[aria-expanded] {
    margin-top: 4px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
    overflow: hidden;
    z-index: 2000;
    word-break: normal;
    white-space: normal;
}

.searchable-choices .choices__list--dropdown .choices__input {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.45rem 0.75rem;
    border: 0;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0;
    background: #fff;
    font-size: 0.875rem;
    line-height: 1.35;
    min-height: 0;
}

.searchable-choices .choices__list--dropdown .choices__input:focus {
    outline: none;
    border-bottom-color: #ef9a9a;
}

.searchable-choices .choices__list--dropdown .choices__list {
    max-height: 220px;
    padding: 0.25rem 0;
}

.searchable-choices .choices__list--dropdown .choices__item,
.searchable-choices .choices__list--dropdown .choices__item--choice,
.searchable-choices .choices__list--dropdown .choices__item--selectable,
.searchable-choices .choices__list[aria-expanded] .choices__item,
.searchable-choices .choices__list[aria-expanded] .choices__item--choice,
.searchable-choices .choices__list[aria-expanded] .choices__item--selectable {
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.35;
    min-height: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.searchable-choices .choices__list--dropdown .choices__item--selectable::after,
.searchable-choices .choices__list[aria-expanded] .choices__item--selectable::after {
    display: none !important;
    content: none !important;
}

.searchable-choices .choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: #c62828;
    border-color: #c62828;
    color: #fff;
}

.searchable-choices .has-no-results {
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.35;
    color: var(--text-muted);
}

.searchable-choices.is-disabled .choices__inner {
    background-color: var(--bs-secondary-bg, #e9ecef);
    opacity: 0.7;
}

.card.mb-3 .card-body,
.card .card-body:not(.p-0) {
    overflow: visible;
}

.filter-form .col-md-2,
.filter-form .col-md-3,
.filter-form .col-md-4,
.filter-form .col-md-6,
.filter-form .col-auto {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

@media (max-width: 992px) {
    .main-content {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
