  #residentsTable th, #residentsTable td { box-sizing: border-box; }
  td.editable-cell { background-color: #fff3cd; cursor: pointer; }
  td.editing-mode { background-color: #d1ecf1; }
  
  #residentsTable thead th {
      background-color: #212529 !important;
      color: #fff !important;
      border-color: #454d55 !important; 
  }
  #residentsTable thead .dt-ordering-asc::after,
  #residentsTable thead .dt-ordering-desc::after {
      color: #fff !important;
  }
  tr.filters input[type="text"],
  tr.filters select {
      background-color: #343a40 !important;
      color: #dee2e6 !important;
      border: 1px solid #6c757d !important;
  }
  tr.filters input[type="text"]::placeholder { color: #8c96a0; }
  .filters .select2-container--bootstrap-5 .select2-selection--multiple {
      background-color: #fff !important;
      border: 1px solid #6c757d !important;
  }
  .filters .select2-selection__choice {
      background-color: #495057;
      border-color: #6c757d;
      color: #fff;
  }
  .filters .select2-selection__choice__remove { color: #ced4da; }
  .filters .select2-selection__placeholder { color: #8c96a0; }
  .dataTables_wrapper .dt-fixed-left { border-right: 2px solid #6c757d; }

/* --- Styles for resident list table cell coloring based on rsk_status --- */
table#residentsTable tbody tr.rsk-ada td {
    background-color: #DFF0D8 !important;
    color: #3C763D !important;
}
/* … other rsk_status rows … */
/* ========================================================================== */
/* Styles for resident list table cell coloring based on rsk_status         */
/* ========================================================================== */

/* Status: Ada (Success) */
table#residentsTable tbody tr.rsk-ada td {
    background-color: #d4edda !important;
    color: #155724 !important;
}

/* Status: Hospital (Warning) */
table#residentsTable tbody tr.rsk-hospital td {
    background-color: #fff3cd !important;
    color: #856404 !important;
}

/* Status: Melarikan Diri & Bebas Dalam Pelarian (Danger) */
table#residentsTable tbody tr.rsk-melarikan-diri td,
table#residentsTable tbody tr.rsk-bebas-dalam-pelarian-absconded td {
    background-color: #f8d7da !important;
    color: #721c24 !important;
}

/* Status: Cuti (Primary Info) */
table#residentsTable tbody tr.rsk-cuti td {
    background-color: #d1ecf1 !important;
    color: #0c5460 !important;
}

/* Status: Meninggal Dunia (Custom Purple) */
table#residentsTable tbody tr.rsk-meninggal-dunia td {
    background-color: #e5d9f2 !important; /* Light Purple Background */
    color: #5c3d7a !important;      /* Dark Purple Text */
}

/* Status: Berpindah & Tukar Perintah (Info) */
table#residentsTable tbody tr.rsk-berpindah td,
table#residentsTable tbody tr.rsk-tukar-perintah td {
    background-color: #cce5ff !important;
    color: #004085 !important;
}

/* Status: Bebas (Discaj) (Success Alternate) */
table#residentsTable tbody tr.rsk-bebas-discaj td {
    background-color: #d1e7dd !important;
    color: #0f5132 !important;
}
/* … etc … */

/* --- Styles for "Easy Edit" mode for table#residentsTable --- */
table#residentsTable.easy-edit-active tbody tr td.editable-cell {
    background-color: #FFF3CD !important;
    color: #856404 !important;
    cursor: pointer;
}
table#residentsTable.easy-edit-active tbody tr td.editing-mode {
    background-color: #D1ECF1 !important;
    color: #0C5460 !important;
}

/* --- Styles for elements INSIDE a cell in editing mode (Select2, etc.) --- */
td.editing-mode .select2-container {
    width: 100% !important;
}
.select2-dropdown.rsk-select2-dropdown { /* optional */ }
td.editing-mode .select2-container .select2-selection--single {
    height: calc(1.5em + .5rem + 2px);
    padding: .25rem .5rem;
    font-size: .875rem;
    line-height: 1.5;
}
td.editing-mode .select2-container--bootstrap-5 .select2-selection__rendered {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    display: block;
    line-height: inherit;
    padding-left: 0;
    padding-right: 20px;
    color: #212529;
}
td.editing-mode .select2-container--default .select2-selection__arrow {
    height: calc(1.5em + .5rem);
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
}

/* ========================================================================== */
/* General Helper Styles for Bootstrap Tables                                */
/* ========================================================================== */
/* --- Word wrap helper --- */
.table td.col-wrap,
.table th.col-wrap {
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* --- Action buttons in cells --- */
.table td.action-buttons {
    text-align: left;
}
.table td.action-buttons form,
.table td.action-buttons a.btn {
    display: inline-block;
    margin-right: 5px;
    vertical-align: middle;
}
.table td.action-buttons form:last-of-type,
.table td.action-buttons a.btn:last-of-type {
    margin-right: 0;
}

/* --- Form field styling (new block) --- */
.form-control,
.form-select {
    background-color: #f8f9fa;
    border: 1px solid #adb5bd;
    color: #212529;
}
.form-control:focus,
.form-select:focus {
    background-color: #ffffff;
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13,110,253,0.25);
}

/* --- Print tweaks --- */
@media print {
    .no-print { display: none !important; }
    header, footer { display: none !important; }
    .main-content-area {
        width: 100% !important;
        flex: 0 0 100%;
        max-width: 100%;
    }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; }
    body, .card-body { color: #000 !important; background: #fff !important; }
}

/* --- Select2 border overrides --- */
.select2-container--default .select2-selection--single {
    border: 1px solid #0d6efd;
    padding: 0.375rem 0.75rem;
    height: auto;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
}
.select2-container--default .select2-selection--single:focus,
.select2-container--default .select2-selection--single:hover {
    border-color: #0b5ed7;
    box-shadow: 0 0 0 0.25rem rgba(13,110,253,0.25);
}

/* --- Sidebar accordion tweaks --- */
.accordion-body .list-group-item-action {
    padding: .6rem 2.5rem;
    transition: background .1s, color .1s;
}
.accordion-body .list-group-item-action:hover,
.accordion-body .list-group-item-action:focus {
    background-color: #e2e6ea !important;
    color: #212529 !important;
    font-weight: 500;
    border-radius: .3rem;
}
.accordion-button {
    font-size: 1.1rem;
    font-weight: bold;
}

/* --- Visitor detail print overrides (repeat) --- */
@media print {
    header, footer { display: none !important; }
}

/* ========================================================================== */
/* End of Combined Stylesheet                                                 */
/* ========================================================================== */
