body {
    margin: 0;
    padding: 4px;
    font-family: "Segoe UI", sans-serif;
    background: #f4f6f8;
    color: #212529;
}

body,
table,
input,
select,
button {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-shell {
    max-width: 100%;
}

.top-login-bar {
    padding-top: 0;
}

.app-logo-mini {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.app-title-mini {
    font-size: 0.88rem;
    color: #212529;
    line-height: 1;
}

.summary-mini {
    font-size: 0.68rem;
    margin-bottom: 4px !important;
}

.action-card .btn,
.action-card .form-select,
.action-card .form-control {
    border-radius: 8px;
}

.action-card .card-body {
    padding: 6px !important;
}

.action-session-box {
    max-width: 360px;
}

.mobile-tab-menu {
    margin-bottom: 8px !important;
}

    .mobile-tab-menu .nav-link {
        border-radius: 10px;
        font-size: 0.92rem;
        padding: 8px 10px !important;
    }

.card {
    border-radius: 10px;
}

.card-header {
    padding: 8px !important;
}

.card-body {
    padding: 8px !important;
}

.table-mobile-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.app-table-main,
.result-table-mobile {
    width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

    .app-table-main thead th,
    .result-table-mobile thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        vertical-align: middle;
        white-space: nowrap;
    }

    .app-table-main th,
    .app-table-main td,
    .result-table-mobile th,
    .result-table-mobile td {
        padding: 4px 4px;
        text-align: center;
        vertical-align: middle;
        word-break: break-word;
    }

    .app-table-main thead th {
        background: #ffffff;
        color: #198754;
        font-weight: 700;
    }

.group-header-cup {
    background: #dff3e7 !important;
    color: #198754 !important;
    font-weight: 800;
}

.group-header-cup-sub {
    background: #edf9f1 !important;
    color: #dc3545 !important;
    font-weight: 800;
    min-width: 58px;
}

.group-header-sub {
    background: #dff3e7 !important;
    color: #198754 !important;
    font-weight: 800;
    min-width: 68px;
}

.bg_header {
    background: #dbe7ff !important;
}

.bg_header_support {
    background: #d1e7dd !important;
}

.first_row {
    z-index: 7 !important;
}

.invisible {
    display: none !important;
}

.app-table-main tbody tr:nth-child(even),
.result-table-mobile tbody tr:nth-child(even) {
    background: #fcfcfc;
}

.app-table-main tbody tr:hover,
.result-table-mobile tbody tr:hover {
    background: #eef8f1;
}

.app-table-main input,
.result-table-mobile input,
.mobile-control-lg {
    width: 100%;
    min-height: 42px;
    padding: 4px 6px;
    font-size: 17px;
    font-weight: 600;
    border: 1px solid #ced4da;
    border-radius: 8px;
    text-align: center;
    background: #fff;
}

    .app-table-main input:focus,
    .result-table-mobile input:focus,
    .mobile-control-lg:focus,
    .form-select:focus,
    .form-control:focus {
        outline: none;
        box-shadow: none;
        border-color: #198754;
        background: #f9fff9;
    }

.app-table-main td:nth-child(2) input,
.app-table-main td:nth-child(3) input {
    border: none;
    background: transparent;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    color: #000;
    pointer-events: none;
    min-height: auto;
    padding: 0;
}

.app-table-main td:nth-child(2) input {
    text-align: left;
    padding-left: 2px;
}

.app-table-main td:nth-child(3) input {
    text-align: center;
    padding: 0;
}

input[disabled] {
    color: #000 !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #000 !important;
    background: transparent !important;
    border: none !important;
    font-weight: 700;
    cursor: default;
    pointer-events: none;
}

.sticky-save-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 4;
    padding-top: 4px !important;
}

.save-main-btn {
    min-height: 46px;
    border-radius: 10px;
    font-size: 1rem;
}

.worker-search-box {
    width: 100%;
    max-width: 320px;
}

    .worker-search-box .form-control,
    .worker-search-box .btn {
        min-height: 42px;
        font-size: 16px;
        border-radius: 8px;
        padding: 4px 8px;
    }

.button_row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

    .button_row > button {
        min-width: 110px;
    }

tfoot tr {
    background: #f8f9fa;
    font-weight: bold;
}

#modal_sync_data,
#moda_reset_token {
    background: #0000004d;
}

.modal-header,
.modal-footer {
    padding: 8px !important;
}

.modal-body {
    padding: 8px !important;
}

.alert {
    padding: 8px 10px;
    margin-bottom: 8px;
    border-radius: 8px;
}

.list-group-item {
    padding: 8px !important;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

pre {
    background: #f8f9fa;
    padding: 8px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre-wrap;
    margin-top: 8px;
}

@media (max-width: 991.98px) {
    body {
        padding: 3px;
    }

    .app-logo-mini {
        width: 30px;
        height: 30px;
    }

    .app-title-mini {
        font-size: 0.82rem;
    }

    .summary-mini {
        font-size: 0.64rem;
    }

    .action-card .btn,
    .action-card .form-select,
    .action-card .form-control {
        min-height: 42px;
        font-size: 15px;
        font-weight: 700;
        padding: 4px 8px;
    }

    .mobile-tab-menu .nav-link {
        min-height: 42px;
        font-size: 0.88rem;
        padding: 6px 8px !important;
    }

    .app-table-main,
    .result-table-mobile {
        font-size: 11px;
    }

        .app-table-main th,
        .app-table-main td,
        .result-table-mobile th,
        .result-table-mobile td {
            padding: 3px 3px;
        }

        .app-table-main thead th,
        .result-table-mobile thead th {
            font-size: 11px;
            padding: 4px 3px;
        }

        .app-table-main td,
        .app-table-main th {
            min-width: 64px;
        }

            .app-table-main td:nth-child(1),
            .app-table-main th:nth-child(1) {
                position: sticky;
                left: 0;
                background: #fff;
                z-index: 6;
                min-width: 42px;
                border-right: 1px solid #dee2e6;
            }

            .app-table-main td:nth-child(2),
            .app-table-main th:nth-child(2) {
                min-width: 110px;
            }

            .app-table-main td:nth-child(5),
            .app-table-main th:nth-child(5) {
                min-width: 82px;
            }

    .group-header-cup-sub {
        min-width: 60px;
    }

    .group-header-sub {
        min-width: 64px;
    }

    .app-table-main input,
    .result-table-mobile input,
    .mobile-control-lg {
        min-height: 40px;
        font-size: 17px;
        border-radius: 8px;
        padding: 4px 5px;
    }

    .app-table-main td:nth-child(2) input,
    .app-table-main td:nth-child(3) input {
        font-size: 10px;
        line-height: 1.05;
    }

    .worker-search-box {
        max-width: 100%;
    }

        .worker-search-box .form-control,
        .worker-search-box .btn {
            min-height: 42px;
            font-size: 15px;
            padding: 4px 8px;
        }

    #modal_fetch_data .modal-dialog {
        max-width: 99%;
        margin: 2px auto;
    }

    #modal_fetch_data .modal-content {
        border-radius: 10px;
    }

    #modal_fetch_data .form-control,
    #modal_fetch_data .form-select,
    #modal_fetch_data .btn,
    #modal_result_data .btn,
    #modal_sync_data .btn,
    #moda_reset_token .btn,
    #confirm_modal .btn,
    #modal_conflict_data .btn {
        min-height: 42px;
        font-size: 15px;
        border-radius: 8px;
        padding: 4px 8px;
    }

    #modal_result_data .btn-group button {
        font-size: 11px;
        font-weight: 700;
    }

    .button_row > button {
        flex: 1 1 100%;
    }
}

@media (max-width: 575.98px) {
    body {
        padding: 2px !important;
    }

    .container-fluid,
    .card-body,
    .card-header,
    .modal-body,
    .modal-header,
    .modal-footer {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }

    .app-title-mini {
        font-size: 0.78rem;
    }

    .summary-mini {
        font-size: 0.6rem;
        margin-bottom: 2px !important;
    }

    .app-table-main,
    .result-table-mobile {
        font-size: 10px;
    }

        .app-table-main thead th,
        .result-table-mobile thead th {
            font-size: 10px;
            padding: 3px 2px;
        }

        .app-table-main td,
        .app-table-main th {
            min-width: 58px;
        }

            .app-table-main td:nth-child(2),
            .app-table-main th:nth-child(2) {
                min-width: 96px;
            }

            .app-table-main td:nth-child(5),
            .app-table-main th:nth-child(5) {
                min-width: 72px;
            }

            .app-table-main td:nth-child(1),
            .app-table-main th:nth-child(1) {
                min-width: 38px;
            }

    .group-header-cup-sub {
        min-width: 54px;
    }

    .group-header-sub {
        min-width: 58px;
    }

    .app-table-main input,
    .result-table-mobile input,
    .mobile-control-lg {
        min-height: 38px;
        font-size: 16px;
        padding: 3px 4px;
    }

    .save-main-btn {
        min-height: 42px;
        font-size: 0.95rem;
    }

    .worker-search-box .form-control,
    .worker-search-box .btn {
        min-height: 40px;
        font-size: 15px;
        padding: 3px 6px;
    }

    .card {
        border-radius: 8px;
    }

    .action-card .btn,
    .action-card .form-select,
    .action-card .form-control,
    #modal_fetch_data .form-control,
    #modal_fetch_data .form-select,
    #modal_fetch_data .btn,
    #modal_result_data .btn,
    #modal_sync_data .btn,
    #moda_reset_token .btn,
    #confirm_modal .btn,
    #modal_conflict_data .btn {
        min-height: 40px;
        font-size: 14px;
        padding: 3px 6px;
        border-radius: 8px;
    }

    .mobile-tab-menu .nav-link {
        min-height: 40px;
        font-size: 0.82rem;
        padding: 5px 6px !important;
        border-radius: 8px;
    }

    .alert {
        padding: 6px 8px;
        margin-bottom: 6px;
    }

    .list-group-item {
        padding: 6px !important;
    }
}

.search-select-native {
    display: none !important;
}

.search-select-box {
    position: relative;
    width: 100%;
}

.search-select-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left !important;
    text-align-last: left !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    background: #fff;
    cursor: pointer;
}

.search-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    color: #111827;
    font-weight: 700;
}

.search-select-arrow {
    flex-shrink: 0;
    color: #64748b;
    font-size: 11px;
    transition: transform .2s ease;
}

.search-select-box.open .search-select-arrow {
    transform: rotate(180deg);
}

.search-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1080;
    padding: 8px;
    border: 1px solid #dbe4ee;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
}

.search-select-box.open .search-select-dropdown {
    display: block;
}

.search-select-search-wrap {
    margin-bottom: 6px;
}

.search-select-input {
    min-width: 0 !important;
    text-align: left !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

.search-select-list {
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #edf2f7;
    border-radius: 8px;
    background: #fff;
}

.search-select-item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid #edf2f7;
    background: #fff;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    cursor: pointer;
}

    .search-select-item:last-child {
        border-bottom: none;
    }

    .search-select-item:hover {
        background: #f8fafc;
    }

    .search-select-item.active {
        background: #eaf8ef;
        color: #198754;
    }

.search-select-empty {
    display: none;
    padding: 8px 10px 2px;
    text-align: left;
    font-size: 12px;
    color: #94a3b8;
}

#div_search .support-label,
#div_search .search-select-toggle,
#div_search .search-select-input,
#div_search .search-select-item {
    text-align: left !important;
}

@media (max-width: 575.98px) {
    .search-select-dropdown {
        padding: 6px;
        border-radius: 8px;
    }

    .search-select-list {
        max-height: 190px;
    }

    .search-select-item {
        padding: 7px 8px;
        font-size: 11px;
    }

    .search-select-input {
        font-size: 11px !important;
    }
}