/*
 * Light body activity record modal
 * Applies only when the modal contains `table.light-body-record-grid`
 */

.modal:has(table.light-body-record-grid) {
    --lbrm-border: #c9dff0;
    --lbrm-border-strong: #9fc5dd;
    --lbrm-bg: #edf8fc;
    --lbrm-surface: #fbfdff;
    --lbrm-title: #214f67;
    --lbrm-text: #456a7d;
    --lbrm-muted: #7898aa;
    --lbrm-shadow: 0 16px 34px rgba(37, 94, 123, 0.14);
    --lbrm-accent: #2b86a6;
    --lbrm-accent-strong: #1f6680;
    --lbrm-chip-bg: #e9f7fb;
    --lbrm-chip-border: #a9d7e6;
}

.modal:has(table.light-body-record-grid) .modal-dialog {
    width: min(94vw, 1080px);
    max-width: 1080px;
    margin: 4vh auto;
}

.modal:has(table.light-body-record-grid) .modal-content {
    border: 1px solid var(--lbrm-border);
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(180deg, var(--lbrm-bg) 0%, #ffffff 62%);
    box-shadow: var(--lbrm-shadow);
}

.modal:has(table.light-body-record-grid) .modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--lbrm-border);
    background:
        radial-gradient(circle at top right, rgba(71, 169, 199, 0.16), transparent 34%),
        linear-gradient(120deg, rgba(53, 138, 170, 0.16), rgba(53, 138, 170, 0.05) 48%, #fbfdff 100%);
}

.modal:has(table.light-body-record-grid) .modal-title {
    color: var(--lbrm-title);
    font-weight: 700;
    letter-spacing: 0.2px;
}

.modal:has(table.light-body-record-grid) .modal-header .close {
    color: #668da0;
    opacity: 0.92;
    text-shadow: none;
    transition: transform 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.modal:has(table.light-body-record-grid) .modal-header .close:hover {
    color: #426d82;
    opacity: 1;
    transform: rotate(90deg);
}

.modal:has(table.light-body-record-grid) .modal-body {
    padding: 14px 16px 10px;
    max-height: 76vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: transparent;
    scrollbar-width: thin;
    scrollbar-color: rgba(56, 115, 145, 0.28) transparent;
}

.modal:has(table.light-body-record-grid:not(.light-body-record-grid--sleep-comprehensive):not(.light-body-record-grid--sleep-quality)) .modal-body {
    padding-top: 0;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive) .modal-body {
    padding-top: 0;
}

.modal:has(table.light-body-record-grid--sleep-quality) .modal-body {
    padding-top: 0;
}

.modal:has(table.light-body-record-grid) .modal-body::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.modal:has(table.light-body-record-grid) .modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal:has(table.light-body-record-grid) .modal-body::-webkit-scrollbar-thumb {
    background: rgba(56, 115, 145, 0.26);
    border-radius: 999px;
}

.modal:has(table.light-body-record-grid) .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(42, 96, 124, 0.42);
}

.modal:has(table.light-body-record-grid) .grid-box {
    margin-bottom: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    overflow: visible;
}

.modal:has(table.light-body-record-grid) .grid-box .box-body {
    padding: 0;
    background: transparent;
    overflow: visible;
}

.modal:has(table.light-body-record-grid) .dcat-box {
    overflow: visible;
}

.modal:has(table.light-body-record-grid) .grid-box .table-wrapper,
.modal:has(table.light-body-record-grid) .dcat-box > .table-wrapper {
    border: 1px solid var(--lbrm-border);
    border-radius: 14px;
    background: var(--lbrm-surface);
    margin-top: 0 !important;
    overflow: visible !important;
}

table.light-body-record-grid {
    width: 100%;
    margin: 0;
    table-layout: fixed;
    background: transparent;
    border-collapse: separate !important;
    border-spacing: 0 8px !important;
}

table.light-body-record-grid > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 30;
    border: 0 !important;
    background: #eaf5fa !important;
    background-clip: padding-box;
    color: #3e7188 !important;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: normal;
    padding: 8px 12px 6px !important;
    text-align: center !important;
}

table.light-body-record-grid > thead > tr > th:nth-child(1) {
    width: 7%;
}

table.light-body-record-grid > thead > tr > th:nth-child(2) {
    width: 17%;
}

table.light-body-record-grid > thead > tr > th:nth-child(3) {
    width: 15%;
}

table.light-body-record-grid > thead > tr > th:nth-child(4) {
    width: 23%;
    text-align: left !important;
}

table.light-body-record-grid > thead > tr > th:nth-child(5) {
    width: 18%;
}

table.light-body-record-grid > thead > tr > th:nth-child(6) {
    width: 10%;
}

table.light-body-record-grid > thead > tr > th:nth-child(7) {
    width: 10%;
}

table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > thead > tr > th:nth-child(1) {
    width: 5%;
}

table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > thead > tr > th:nth-child(2) {
    width: 12%;
}

table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > thead > tr > th:nth-child(3) {
    width: 10%;
}

table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > thead > tr > th:nth-child(4),
table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > thead > tr > th:nth-child(5),
table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > thead > tr > th:nth-child(6),
table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > thead > tr > th:nth-child(9) {
    width: 9%;
}

table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > thead > tr > th:nth-child(7),
table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > thead > tr > th:nth-child(8) {
    width: 11%;
}

table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > thead > tr > th:nth-child(10) {
    width: 15%;
}

table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th:nth-child(1) {
    width: 5%;
}

table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th:nth-child(2) {
    width: 8%;
}

table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th:nth-child(3) {
    width: 9%;
}

table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th:nth-child(4),
table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th:nth-child(5),
table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th:nth-child(6) {
    width: 8%;
}

table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th:nth-child(7) {
    width: 8%;
}

table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th:nth-child(8),
table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th:nth-child(9),
table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th:nth-child(12) {
    width: 6%;
}

table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th:nth-child(10),
table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th:nth-child(11) {
    width: 7%;
}

table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th:nth-child(13) {
    width: 14%;
}

.modal:has(table.light-body-record-grid) .grid-column-header {
    display: inline-flex;
    align-items: center;
}

.modal:has(table.light-body-record-grid) .grid-column-header .grid-sort {
    width: 16px;
    height: 16px;
    margin: 0 0 0 6px;
    color: #91b8ca;
    text-decoration: none !important;
}

.modal:has(table.light-body-record-grid) .grid-column-header .grid-sort::before {
    font-size: 12px;
}

.modal:has(table.light-body-record-grid) .grid-column-header .grid-sort.active {
    color: var(--lbrm-accent-strong);
}

.modal:has(table.light-body-record-grid) .grid-column-header .grid-sort:not(.active)::before {
    content: "\e846";
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .dcat-box > .card-header,
.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-box > .card-header {
    margin-bottom: 12px;
    padding: 0 !important;
    border: 0 !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive) .dcat-box > .card-header,
.modal:has(table.light-body-record-grid--sleep-comprehensive) .grid-box > .card-header {
    padding-top: 14px !important;
}

.modal:has(table.light-body-record-grid--sleep-quality) .dcat-box > .card-header,
.modal:has(table.light-body-record-grid--sleep-quality) .grid-box > .card-header {
    padding-top: 14px !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0 0 12px !important;
    padding: 3px;
    border: 1px solid var(--lbrm-border);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(237, 248, 252, 0.98) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 10px 22px rgba(37, 94, 123, 0.08);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group .btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid #83c8dd !important;
    border-radius: 12px !important;
    background: linear-gradient(180deg, #7dccdf 0%, #4a9bb8 55%, #2b748f 100%) !important;
    color: #fbfdff !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    overflow: hidden;
    text-shadow: 0 1px 0 rgba(24, 82, 104, 0.16);
    box-shadow:
        0 14px 26px rgba(43, 116, 143, 0.20),
        inset 0 1px 0 rgba(255, 255, 255, 0.24);
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease,
        filter 0.18s ease,
        background 0.18s ease;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group .btn::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 46%);
    pointer-events: none;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group .btn::after {
    content: "";
    position: absolute;
    top: -70%;
    left: -24%;
    width: 42%;
    height: 240%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
    transform: rotate(18deg) translateX(-140%);
    transition: transform 0.55s ease;
    pointer-events: none;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group .btn:hover,
.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group .btn:focus-visible {
    transform: translateY(-1px) scale(1.01);
    border-color: #6cbdd4 !important;
    box-shadow:
        0 18px 30px rgba(43, 116, 143, 0.24),
        0 0 0 4px rgba(125, 204, 223, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    filter: saturate(1.04);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group .btn:hover::after,
.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group .btn:focus-visible::after {
    transform: rotate(18deg) translateX(360%);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group .btn:focus,
.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group .btn:focus-visible {
    outline: none;
    color: #fbfdff !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group .btn:active,
.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group.show .btn:first-child {
    transform: translateY(1px) scale(0.985);
    background: linear-gradient(180deg, #63c0d7 0%, #348aa7 100%) !important;
    box-shadow:
        0 7px 15px rgba(43, 116, 143, 0.18),
        inset 0 2px 5px rgba(24, 82, 104, 0.18);
    filter: saturate(1.06);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group .btn .feather {
    font-size: 13px;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group .filter-count {
    font-weight: 700;
    color: rgba(251, 253, 255, 0.86);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-button-group .btn + .btn {
    min-width: 38px;
    margin-left: 4px;
    padding: 0 10px;
    border-left: 1px solid #83c8dd !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector,
.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-box {
    border: 1px solid var(--lbrm-border) !important;
    border-radius: 16px !important;
    background: linear-gradient(180deg, #f8fcfe 0%, #eef8fc 100%) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 8px 20px rgba(37, 94, 123, 0.06) !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    padding: 12px 16px;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    row-gap: 10px;
    column-gap: 0;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    line-height: normal;
    overflow: visible !important;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-label {
    float: none;
    width: 76px;
    padding: 0;
    color: #4b7285;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    flex: 0 0 auto;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 0;
    overflow: visible !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    height: auto;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: visible !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    float: none;
}

@keyframes lbrm-selector-active-pulse {
    0%,
    100% {
        box-shadow:
            0 12px 24px rgba(43, 134, 166, 0.22),
            0 0 0 0 rgba(125, 204, 223, 0.14),
            inset 0 1px 0 rgba(255, 255, 255, 0.22);
    }
    50% {
        box-shadow:
            0 15px 28px rgba(43, 134, 166, 0.28),
            0 0 0 7px rgba(125, 204, 223, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.22);
    }
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li > a:first-child {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid #c9dff0;
    border-radius: 999px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(234, 246, 251, 0.92) 100%);
    color: #4b7285;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none !important;
    box-shadow:
        0 3px 8px rgba(43, 111, 141, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.94);
    transition:
        transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.22s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.2s ease,
        color 0.18s ease,
        background 0.18s ease;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li > a:first-child::before,
.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li > a:first-child::after {
    content: "";
    position: absolute;
    pointer-events: none;
    transition:
        opacity 0.2s ease,
        transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li > a:first-child::before {
    inset: 1px 14% auto;
    height: 48%;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0.92;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li > a:first-child::after {
    left: 18%;
    right: 18%;
    bottom: -10px;
    height: 12px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(103, 190, 214, 0.30) 0%, rgba(103, 190, 214, 0) 72%);
    filter: blur(6px);
    opacity: 0;
    transform: translateY(4px) scale(0.84);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li > a:first-child:hover {
    border-color: #a9d7e6;
    background: linear-gradient(180deg, #ffffff 0%, #e1f4fb 100%);
    color: var(--lbrm-accent-strong);
    box-shadow:
        0 10px 18px rgba(43, 134, 166, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);
    transform: translateY(-2px) scale(1.035);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li > a:first-child:hover::after {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li > a:first-child:active {
    border-color: #4a9bb8;
    background: linear-gradient(180deg, #63b9d4 0%, #2b86a6 100%);
    color: #fbfdff;
    box-shadow:
        inset 0 3px 8px rgba(24, 82, 104, 0.24),
        0 3px 8px rgba(43, 116, 143, 0.18);
    transform: translateY(1px) scale(0.97);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li > a:first-child:focus {
    outline: none;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li > a:first-child:focus-visible {
    box-shadow:
        0 0 0 3px rgba(125, 204, 223, 0.26),
        0 10px 20px rgba(43, 134, 166, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li > a:first-child.active,
.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li > a:first-child:focus:not(:focus-visible):not(.active) {
    border-color: #7fc4da;
    background: linear-gradient(180deg, #62b8d2 0%, #348daa 58%, #246f8a 100%);
    color: #fbfdff;
    box-shadow:
        0 12px 24px rgba(43, 134, 166, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options li > a:first-child.active {
    animation: lbrm-selector-active-pulse 2.2s ease-in-out infinite;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options a.add,
.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-selector .select-options a.clear {
    display: none !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-box {
    margin: 12px 0 10px !important;
    padding: 12px 16px !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .filter-box .card-body {
    padding: 0 !important;
    background: transparent !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    margin: 0 -6px !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .filter-input[class*="col-sm-"] {
    flex: 1 1 430px;
    width: auto;
    max-width: none;
    margin-bottom: 10px;
    padding: 0 6px;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .form-group {
    margin-bottom: 0;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .input-group.input-group-sm {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .input-group-prepend {
    display: flex;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .input-group-prepend .input-group-text {
    border: 1px solid var(--lbrm-border);
    border-right: 0;
    border-radius: 14px 0 0 14px;
    background: #f7fcfe;
    color: #4b7285;
    font-size: 13px;
    font-weight: 700;
    padding: 0 12px;
    box-shadow: none;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .input-group > .form-control {
    height: 38px;
    border-color: var(--lbrm-border);
    background: #fcfeff;
    color: #46697b;
    font-size: 13px;
    padding: 8px 12px;
    box-shadow: none;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .input-group > .form-control:first-of-type {
    border-radius: 0;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .input-group > .form-control:last-child {
    border-left: 0;
    border-radius: 0 14px 14px 0;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .input-group-addon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 0 10px;
    border-top: 1px solid var(--lbrm-border);
    border-bottom: 1px solid var(--lbrm-border);
    background: #f5fbfe;
    color: #86a5b5;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .input-group > .form-control:focus {
    border-color: #8bc8dc;
    box-shadow: 0 0 0 3px rgba(125, 204, 223, 0.14);
    position: relative;
    z-index: 2;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .btn-group {
    display: inline-flex;
    align-items: center;
    margin: 0 6px 10px !important;
    height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .btn-group.default,
.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .btn-group.btn-group-sm.default.btn-mini {
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .btn-group .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    box-shadow: none;
    transition: all 0.2s ease;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .btn-group .btn.submit {
    border-color: #7fc4da;
    background: linear-gradient(180deg, #63b8d2 0%, #358eab 56%, #246f8a 100%);
    color: #fbfdff;
    box-shadow: 0 10px 20px rgba(43, 134, 166, 0.18);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .btn-group .btn.submit:hover {
    border-color: #5eb3ce;
    background: linear-gradient(180deg, #56b2ce 0%, #2f86a3 100%);
    transform: translateY(-1px);
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .btn-group .btn.reset {
    border: 1px solid var(--lbrm-border);
    background: #fcfeff;
    color: #4b7285;
}

.modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .btn-group .btn.reset:hover {
    border-color: #a9d7e6;
    background: #eef8fc;
    color: #2f6a82;
}

table.light-body-record-grid > tbody > tr[data-key] > td {
    background: #fbfdff !important;
    border-top: 1px solid #d8e8f1 !important;
    border-bottom: 1px solid #d8e8f1 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    padding: 14px 12px !important;
    color: var(--lbrm-text);
    font-size: 14px;
    line-height: 1.35;
    vertical-align: middle !important;
    text-align: center !important;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

table.light-body-record-grid > tbody > tr > td {
    vertical-align: middle !important;
}

table.light-body-record-grid > tbody > tr[data-key] > td:first-child {
    border-left: 1px solid #d8e8f1 !important;
    border-radius: 12px 0 0 12px;
    color: #547487;
    font-weight: 600;
}

table.light-body-record-grid > tbody > tr[data-key] > td:last-child {
    border-right: 1px solid #d8e8f1 !important;
    border-radius: 0 12px 12px 0;
}

table.light-body-record-grid > tbody > tr[data-key]:hover > td {
    background: #f3fbfe !important;
    border-color: #bdd9e8 !important;
}

table.light-body-record-grid > tbody > tr > td:nth-child(2),
table.light-body-record-grid > tbody > tr > td:nth-child(3),
table.light-body-record-grid > tbody > tr > td:nth-child(6),
table.light-body-record-grid > tbody > tr > td:nth-child(7) {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

table.light-body-record-grid > tbody > tr > td:nth-child(2) .lbrm-chip,
table.light-body-record-grid > tbody > tr > td:nth-child(3) .lbrm-chip,
table.light-body-record-grid > tbody > tr > td:nth-child(6) .lbrm-chip {
    margin-left: auto;
    margin-right: auto;
}

table.light-body-record-grid > tbody > tr[data-key] > td:nth-child(4) {
    text-align: left !important;
}

table.light-body-record-grid > tbody > tr[data-key] > td:nth-child(5) {
    color: #335f75;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08px;
    white-space: nowrap;
}

table.light-body-record-grid > tbody > tr[data-key] > td:nth-child(7) a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    min-width: 74px;
    padding: 0 12px;
    border: 1px solid var(--lbrm-chip-border);
    border-radius: 999px;
    background: linear-gradient(180deg, #f7fcfe 0%, var(--lbrm-chip-bg) 100%);
    color: var(--lbrm-accent-strong);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

table.light-body-record-grid > tbody > tr[data-key] > td:nth-child(7) a:hover {
    border-color: #7fc4da;
    background: #e2f5fb;
    color: #185a73;
    box-shadow: 0 6px 14px rgba(43, 134, 166, 0.14);
    transform: translateY(-1px);
}

table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > thead > tr > th,
table.light-body-record-grid.light-body-record-grid--sleep-quality > thead > tr > th {
    padding-left: 6px !important;
    padding-right: 6px !important;
}

table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > tbody > tr[data-key] > td,
table.light-body-record-grid.light-body-record-grid--sleep-quality > tbody > tr[data-key] > td {
    padding: 12px 6px !important;
    text-align: center !important;
    font-size: 13px;
}

table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > tbody > tr[data-key] > td:nth-child(4),
table.light-body-record-grid.light-body-record-grid--sleep-quality > tbody > tr[data-key] > td:nth-child(4) {
    text-align: center !important;
}

table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > tbody > tr > td .lbrm-chip,
table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > tbody > tr > td .lbrm-metric,
table.light-body-record-grid.light-body-record-grid--sleep-quality > tbody > tr > td .lbrm-chip,
table.light-body-record-grid.light-body-record-grid--sleep-quality > tbody > tr > td .lbrm-metric {
    margin-left: auto;
    margin-right: auto;
}

table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > tbody > tr[data-key] > td:nth-child(5),
table.light-body-record-grid.light-body-record-grid--sleep-quality > tbody > tr[data-key] > td:nth-child(5) {
    color: var(--lbrm-text);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    white-space: normal;
}

table.light-body-record-grid.light-body-record-grid--sleep-comprehensive > tbody > tr[data-key] > td:last-child,
table.light-body-record-grid.light-body-record-grid--sleep-quality > tbody > tr[data-key] > td:last-child {
    color: #335f75;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    white-space: normal;
}

.lbrm-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 13px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    user-select: none;
}

.lbrm-chip--device {
    border: 1px solid #c8dae4;
    background: #f4f9fb;
    color: #4f7184;
}

.lbrm-chip--active {
    border: 1px solid #9fd5e5;
    background: linear-gradient(180deg, #f1fbfe 0%, #dff4fb 100%);
    color: #1f6680;
}

.lbrm-chip--idle {
    border: 1px solid #d9d5bf;
    background: #faf8ef;
    color: #81764e;
}

.lbrm-chip--restore {
    border: 1px solid #b8d6c8;
    background: #f0faf5;
    color: #39735d;
}

.lbrm-chip--voice {
    border: 1px solid #f0d29e;
    background: #fff7e8;
    color: #9a6722;
}

.lbrm-chip--quiet {
    border: 1px solid #cddce5;
    background: #f5f9fb;
    color: #6d8998;
}

.lbrm-metric {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    min-width: 48px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: normal;
    user-select: none;
}

.lbrm-metric--primary {
    border: 1px solid #b5d9e8;
    background: linear-gradient(180deg, #f7fcfe 0%, #e8f6fb 100%);
    color: #286e89;
}

.lbrm-metric--score {
    border: 1px solid #9fd5e5;
    background: linear-gradient(180deg, #ecfaff 0%, #d8f1fa 100%);
    color: #185f7a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.lbrm-metric--quiet {
    border: 1px solid #cddce5;
    background: #f5f9fb;
    color: #6d8998;
}

.lbrm-time {
    color: #335f75;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.lbrm-text {
    display: block;
    min-width: 0;
    color: #44697c;
    font-weight: 600;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-word;
}

table.light-body-record-grid > tbody > tr:not([data-key]) > td {
    background: transparent !important;
    border: 0 !important;
    padding: 0 10px 8px !important;
}

table.light-body-record-grid > tbody > tr:not([data-key]) .table {
    margin: 0;
    border: 1px solid #c9dff0;
    border-radius: 10px;
    overflow: hidden;
    background: #f4fbfe;
}

table.light-body-record-grid > tbody > tr:not([data-key]) .table > thead > tr > th {
    background: #eaf5fa !important;
    color: #3e7188 !important;
    border-bottom: 1px solid #d4e7f1;
    border-top: 0;
    font-size: 12px;
    font-weight: 700;
    padding: 9px 10px;
    white-space: nowrap;
}

table.light-body-record-grid > tbody > tr:not([data-key]) .table > tbody > tr > td {
    border-top: 0;
    border-bottom: 1px solid #d8e8f1;
    color: #456a7d;
    font-size: 13px;
    padding: 9px 10px;
    background: #fbfdff;
}

table.light-body-record-grid > tbody > tr:not([data-key]) .table > tbody > tr:last-child > td {
    border-bottom: 0;
}

.modal:has(table.light-body-record-grid) .grid-box .box-footer {
    border-top: 1px solid #d4e7f1;
    margin-top: 2px;
    padding: 8px 4px 6px;
    background: linear-gradient(180deg, rgba(244, 251, 254, 0.95), rgba(244, 251, 254, 1));
    min-height: 48px;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.modal:has(table.light-body-record-grid) .grid-box .box-footer .pull-left {
    color: #65879a;
    font-weight: 600;
    line-height: 32px;
}

.modal:has(table.light-body-record-grid) .grid-box .pagination {
    margin: 0;
}

.modal:has(table.light-body-record-grid) .grid-box .pagination > li > a,
.modal:has(table.light-body-record-grid) .grid-box .pagination > li > span {
    min-width: 34px;
    height: 34px;
    line-height: 20px;
    margin-left: 6px;
    border-radius: 999px !important;
    border-color: #c9dff0;
    color: #547487;
}

.modal:has(table.light-body-record-grid) .grid-box .pagination > .active > a,
.modal:has(table.light-body-record-grid) .grid-box .pagination > .active > span {
    border-color: #2b86a6 !important;
    background: linear-gradient(135deg, #56aeca, #2b7d9c);
    color: #ffffff !important;
    box-shadow: 0 8px 16px rgba(43, 134, 166, 0.24);
}

@media (max-width: 860px) {
    .modal:has(table.light-body-record-grid) .modal-dialog {
        width: 94vw;
        max-width: 94vw;
    }

    .modal:has(table.light-body-record-grid--sleep-comprehensive, table.light-body-record-grid--sleep-quality) .grid-filter-form .filter-input[class*="col-sm-"] {
        flex-basis: 100%;
    }

    table.light-body-record-grid {
        table-layout: fixed;
    }
}
