:root {
    --portal-bg: #eef3fb;
    --portal-surface: rgba(255, 255, 255, 0.9);
    --portal-surface-strong: #ffffff;
    --portal-border: rgba(15, 23, 42, 0.08);
    --portal-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
    --portal-shadow-soft: 0 8px 22px rgba(15, 23, 42, 0.06);
    --portal-text: #0f172a;
    --portal-muted: #64748b;
    --portal-accent: #2563eb;
    --portal-accent-strong: #1d4ed8;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--portal-text);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 30%),
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.09), transparent 24%),
        linear-gradient(180deg, #f8fbff 0%, var(--portal-bg) 100%);
}

a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.site-navbar {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #2563eb 100%);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-navbar .navbar-brand,
.site-navbar .nav-link,
.site-navbar .navbar-text {
    color: rgba(255, 255, 255, 0.96);
}

.site-navbar .navbar-brand:hover,
.site-navbar .nav-link:hover,
.site-navbar .nav-link:focus {
    color: #ffffff;
    text-decoration: none;
}

.site-navbar .nav-link {
    border-radius: 999px;
    padding: 0.6rem 0.9rem;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link:focus {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.site-navbar .dropdown-menu {
    margin-top: 0.75rem;
}

.site-logo {
    height: 40px;
    width: auto;
}

.app-main {
    padding: 1.5rem 0 3rem;
}

.app-main > .container-xxl {
    width: min(98vw, 1900px);
    max-width: 98vw;
}

.report-page .app-main > .container-xxl {
    width: min(99vw, 2200px);
    max-width: 99vw;
}

.report-page .container-fluid {
    padding-left: 0;
    padding-right: 0;
}

.report-page .table-responsive {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.report-page .table-responsive > .table {
    min-width: 100%;
}

.report-page .table {
    min-width: 100%;
}

.report-page .table thead th,
.report-page .table tbody td {
    vertical-align: middle;
}

.report-page .report-toolbar {
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    box-shadow: var(--portal-shadow-soft);
    padding: 1rem 1.15rem;
}

.report-page .report-toolbar .form-label {
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--portal-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.report-page .report-toolbar .btn {
    min-width: 0;
    white-space: nowrap;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--portal-text);
    letter-spacing: -0.02em;
}

.card,
.modal-content,
.dropdown-menu,
.alert {
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    box-shadow: var(--portal-shadow);
}

.card {
    background: var(--portal-surface);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.card-header {
    background: rgba(248, 250, 252, 0.85);
    border-bottom: 1px solid var(--portal-border);
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.table-responsive {
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    background: var(--portal-surface-strong);
    box-shadow: var(--portal-shadow-soft);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
    color: var(--portal-text);
}

.table > :not(caption) > * > * {
    padding: 0.9rem 1rem;
    border-color: var(--portal-border);
}

.table thead th {
    background: rgba(248, 250, 252, 0.96);
    color: var(--portal-muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.list-group-item {
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--portal-border);
}

.form-control,
.form-select {
    border-radius: 0.9rem;
    border-color: var(--portal-border);
    padding: 0.75rem 1rem;
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(37, 99, 235, 0.6);
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.15);
}

.btn {
    border-radius: 0.85rem;
    font-weight: 600;
    padding: 0.65rem 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--portal-accent) 0%, var(--portal-accent-strong) 100%);
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    border-color: transparent;
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger {
    box-shadow: none;
}

.btn-info {
    color: #0f172a;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #93c5fd;
}

.btn-info:hover,
.btn-info:focus {
    color: #0f172a;
    background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
    border-color: #60a5fa;
}

.dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.dt-buttons .dt-button {
    border: 1px solid var(--portal-border) !important;
    border-radius: 0.85rem !important;
    padding: 0.65rem 1rem !important;
    background: rgba(255, 255, 255, 0.88) !important;
    color: var(--portal-text) !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06) !important;
    text-transform: none !important;
    text-shadow: none !important;
}

.dt-buttons .dt-button:hover,
.dt-buttons .dt-button:focus {
    background: #ffffff !important;
    color: var(--portal-text) !important;
    border-color: rgba(37, 99, 235, 0.35) !important;
}

.dt-buttons .dt-button:active,
.dt-buttons .dt-button.active {
    background: #eff6ff !important;
    color: var(--portal-accent-strong) !important;
}

.alert {
    background: rgba(255, 255, 255, 0.88);
}

.dropdown-menu {
    border-radius: 0.95rem;
    box-shadow: var(--portal-shadow);
}

.dropdown-item {
    border-radius: 0.65rem;
    margin: 0.125rem 0.4rem;
    width: auto;
}

.modal-content {
    overflow: hidden;
}

#productImageModal .modal-body {
    padding: 0;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.03);
}

#productImageModal .modal-content {
    border-radius: 1rem;
    overflow: hidden;
}

#modalProductImage {
    max-height: 80vh;
    object-fit: contain;
    padding: 10px;
}

img[src*="thumb"] {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    max-width: 100%;
    height: auto;
}

img[src*="thumb"]:hover {
    transform: scale(1.03);
}

.modal-backdrop + .modal-backdrop {
    opacity: 0.5;
}

.dispatch-request-page .dispatch-detail-list dt {
    color: var(--portal-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dispatch-request-page .dispatch-detail-list dd {
    margin-bottom: 0.5rem;
}

.dispatch-request-page .dispatch-mobile-table tbody td[data-label] {
    white-space: normal;
}

.dispatch-request-page .dispatch-mobile-table tbody td {
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    .app-main {
        padding: 1rem 0 2rem;
    }

    .app-main > .container-xxl {
        width: 100%;
        max-width: 100%;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .site-navbar .navbar-brand {
        font-size: 1rem;
    }

    .site-navbar .navbar-collapse {
        padding-top: 0.75rem;
    }

    .site-navbar .nav-link {
        padding: 0.55rem 0.8rem;
    }

    .site-navbar .dropdown-menu {
        width: min(100%, 22rem);
        max-height: calc(100vh - 5rem);
        overflow-y: auto;
    }

    .card-body {
        padding: 1rem;
    }

    .form-control,
    .form-select {
        padding: 0.7rem 0.9rem;
    }

    .form-label {
        margin-bottom: 0.35rem;
    }

    .btn {
        min-height: 44px;
    }

    .table {
        font-size: 0.94rem;
    }

    .table > :not(caption) > * > * {
        padding: 0.7rem 0.8rem;
    }

    .table-responsive {
        border-radius: 0.9rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dt-buttons {
        width: 100%;
    }

    .dt-buttons .dt-button {
        flex: 1 1 100%;
        width: 100%;
    }

    .dataTables_wrapper .row {
        --bs-gutter-x: 0.75rem;
    }

    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        width: 100%;
        float: none;
        text-align: left;
    }

    .dataTables_wrapper .dataTables_filter input,
    .dataTables_wrapper .dataTables_length select {
        width: 100%;
    }

    .report-page .card-body,
    .report-page .glass-panel {
        padding: 1rem;
    }

    .report-page .report-toolbar,
    .report-page .sticky-tools,
    .report-page .card-header.report-toolbar {
        padding: 0.9rem;
    }

    .report-page .row.mb-3,
    .report-page .row.g-2,
    .report-page .row.g-3,
    .report-page .report-toolbar,
    .report-page .glass-panel .row {
        row-gap: 0.75rem;
    }

    .report-page .row.mb-3 > [class*="col-"],
    .report-page .row.g-2 > [class*="col-"],
    .report-page .row.g-3 > [class*="col-"],
    .report-page .report-toolbar > [class*="col-"],
    .report-page .glass-panel .row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }

    .report-page .report-toolbar .btn,
    .report-page .card-header .btn,
    .report-page .sticky-tools .btn {
        width: 100%;
    }

    .report-page .report-toolbar .form-control,
    .report-page .report-toolbar .form-select,
    .report-page .sticky-tools .form-control,
    .report-page .sticky-tools .form-select {
        width: 100%;
    }

    .report-page .table {
        font-size: 0.86rem;
    }

    .report-page .table > :not(caption) > * > * {
        padding: 0.55rem 0.65rem;
    }

    .report-page .table thead th {
        font-size: 0.7rem;
        letter-spacing: 0.03em;
        white-space: nowrap;
    }

    .report-page .dt-buttons {
        width: 100%;
        margin-bottom: 0.75rem;
    }

    .report-page .dt-buttons .dt-button {
        flex: 1 1 100%;
        width: 100%;
    }

    .report-page .period-tabs .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .report-page .period-tabs .nav-link {
        flex: 0 0 auto;
    }

    .report-page .dataTables_wrapper .dataTables_filter,
    .report-page .dataTables_wrapper .dataTables_length,
    .report-page .dataTables_wrapper .dataTables_info,
    .report-page .dataTables_wrapper .dataTables_paginate {
        width: 100%;
        float: none;
        text-align: left;
    }

    .report-page .dataTables_wrapper .dataTables_filter input,
    .report-page .dataTables_wrapper .dataTables_length select {
        width: 100%;
    }

    .report-page .modal-xl,
    .report-page .modal-lg {
        max-width: calc(100% - 1rem);
        margin: 0.5rem auto;
    }

    .report-page .modal-body .table-responsive {
        border-radius: 0.75rem;
    }

    #productImageModal .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    #modalProductImage {
        max-height: 70vh;
    }

    .dispatch-request-page .dispatch-mobile-table thead {
        display: none;
    }

    .dispatch-request-page .dispatch-mobile-table tbody,
    .dispatch-request-page .dispatch-mobile-table tr,
    .dispatch-request-page .dispatch-mobile-table td {
        display: block;
        width: 100%;
    }

    .dispatch-request-page .dispatch-mobile-table tbody tr {
        margin-bottom: 0.85rem;
        border: 1px solid var(--portal-border);
        border-radius: 1rem;
        background: var(--portal-surface-strong);
        box-shadow: var(--portal-shadow-soft);
        overflow: hidden;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td {
        display: flex;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.75rem 0.9rem;
        border-top: 1px solid var(--portal-border);
        align-items: flex-start;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td:first-child {
        border-top: 0;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        color: var(--portal-muted);
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td[data-label="Image"] {
        align-items: center;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td[data-label="Action"] {
        justify-content: flex-end;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td[data-label="Action"]::before {
        flex-basis: auto;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td .form-control,
    .dispatch-request-page .dispatch-mobile-table tbody td .btn {
        width: 100%;
        max-width: 14rem;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td[data-label="Action"] .btn {
        max-width: none;
    }
}

@media (max-width: 576px) {
    .site-navbar .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .site-logo {
        height: 34px;
    }

    .modal-dialog {
        margin: 0.35rem;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0.75rem;
    }

    .alert {
        padding: 0.85rem 1rem;
    }

    .dropdown-menu {
        width: calc(100vw - 1rem);
    }

    .btn-group,
    .btn-toolbar {
        width: 100%;
    }

    .btn-group .btn,
    .btn-toolbar .btn {
        flex: 1 1 auto;
    }

    .input-group {
        width: 100%;
    }

    .dispatch-request-page .card-body {
        padding: 1rem;
    }

    .dispatch-request-page .dispatch-detail-list dt,
    .dispatch-request-page .dispatch-detail-list dd {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .dispatch-request-page .dispatch-detail-list dt {
        margin-bottom: 0.15rem;
    }

    .dispatch-request-page .dispatch-mobile-table tbody tr {
        margin-bottom: 0.7rem;
        border-radius: 0.9rem;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        padding: 0.65rem 0.75rem;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td::before {
        flex-basis: auto;
        font-size: 0.7rem;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td .form-control,
    .dispatch-request-page .dispatch-mobile-table tbody td .btn {
        max-width: none;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td[data-label="Action"] {
        justify-content: flex-start;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td[data-label="Image"] {
        justify-content: flex-start;
    }

    .dispatch-request-page .dispatch-mobile-table tbody td[data-label="Quantity"] .form-control {
        min-width: 0;
    }
}
