/*
 * SOS event record modal (scoped)
 * Applies only when the modal contains `table.sos-event-record-grid`
 */

.modal:has(table.sos-event-record-grid) {
    --saerh-border: #d5e8e1;
    --saerh-border-strong: #b7d7ce;
    --saerh-bg: #f4fbf8;
    --saerh-surface: #fcfffd;
    --saerh-title: #295852;
    --saerh-text: #4d6762;
    --saerh-muted: #7f9e98;
    --saerh-shadow: 0 16px 34px rgba(40, 104, 90, 0.14);
    --saerh-accent: #2f8a79;
    --saerh-accent-strong: #246b5d;
    --saerh-chip-bg: #eff9f5;
    --saerh-chip-border: #b9dfd3;
}

.modal:has(table.sos-event-record-grid) .modal-dialog {
    width: min(92vw, 920px);
    max-width: 920px;
    margin: 5vh auto;
}

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

.modal:has(table.sos-event-record-grid) .modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--saerh-border);
    background:
        radial-gradient(circle at top right, rgba(76, 185, 154, 0.16), transparent 34%),
        linear-gradient(120deg, rgba(63, 143, 126, 0.15), rgba(63, 143, 126, 0.04) 48%, #fbfffe 100%);
}

.modal:has(table.sos-event-record-grid) .modal-title {
    color: var(--saerh-title);
    font-weight: 700;
    letter-spacing: 0.2px;
}

.modal:has(table.sos-event-record-grid) .modal-header .close {
    color: #6e9b92;
    opacity: 0.92;
    text-shadow: none;
    transition: transform 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.modal:has(table.sos-event-record-grid) .modal-header .close:hover {
    color: #3f746a;
    opacity: 1;
    transform: rotate(90deg);
}

.modal:has(table.sos-event-record-grid) .modal-body {
    padding: 0 16px 10px;
    max-height: 76vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: transparent;
    scrollbar-width: thin;
    scrollbar-color: rgba(77, 130, 119, 0.3) transparent;
}

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

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

.modal:has(table.sos-event-record-grid) .modal-body::-webkit-scrollbar-thumb {
    background: rgba(77, 130, 119, 0.28);
    border-radius: 999px;
}

.modal:has(table.sos-event-record-grid) .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(63, 116, 106, 0.42);
}

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

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

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

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

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

table.sos-event-record-grid > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 30;
    border: 0 !important;
    background: #edf7f3 !important;
    background-clip: padding-box;
    color: #427469 !important;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    padding: 8px 12px 6px !important;
}

table.sos-event-record-grid > thead > tr > th:nth-child(1) {
    width: 11%;
}

table.sos-event-record-grid > thead > tr > th:nth-child(2) {
    width: 31%;
    text-align: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

table.sos-event-record-grid > thead > tr > th:nth-child(3) {
    width: 58%;
}

table.sos-event-record-grid.sos-event-record-grid--sleep-radar > thead > tr > th:nth-child(1) {
    width: 34%;
    text-align: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

table.sos-event-record-grid.sos-event-record-grid--sleep-radar > thead > tr > th:nth-child(2) {
    width: 66%;
    text-align: left !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-sos > thead > tr > th:nth-child(1) {
    width: 9%;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-sos > thead > tr > th:nth-child(2) {
    width: 22%;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-sos > thead > tr > th:nth-child(3) {
    width: 43%;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-sos > thead > tr > th:nth-child(4),
table.sos-event-record-grid.sos-event-record-grid--bracelet-sos > thead > tr > th:nth-child(5) {
    width: 13%;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-trajectory > thead > tr > th:nth-child(1) {
    width: 9%;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-trajectory > thead > tr > th:nth-child(2) {
    width: 48%;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-trajectory > thead > tr > th:nth-child(3),
table.sos-event-record-grid.sos-event-record-grid--bracelet-trajectory > thead > tr > th:nth-child(4) {
    width: 13%;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-trajectory > thead > tr > th:nth-child(5) {
    width: 17%;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring > thead > tr > th:nth-child(1) {
    width: 12%;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring > thead > tr > th:nth-child(2) {
    width: 22%;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring > thead > tr > th:nth-child(3) {
    width: 26%;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring > thead > tr > th:nth-child(4) {
    width: 40%;
}

table.sos-event-record-grid.sos-event-record-grid--blood-reminder > thead > tr > th:nth-child(1) {
    width: 10%;
}

table.sos-event-record-grid.sos-event-record-grid--blood-reminder > thead > tr > th:nth-child(2) {
    width: 36%;
}

table.sos-event-record-grid.sos-event-record-grid--blood-reminder > thead > tr > th:nth-child(3) {
    width: 34%;
}

table.sos-event-record-grid.sos-event-record-grid--blood-reminder > thead > tr > th:nth-child(4) {
    width: 20%;
}

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > thead > tr > th:nth-child(1) {
    width: 12%;
}

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > thead > tr > th:nth-child(2) {
    width: 38%;
}

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > thead > tr > th:nth-child(3) {
    width: 50%;
}

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > thead > tr > th,
table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > tbody > tr[data-key] > td {
    text-align: center !important;
}

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

.modal:has(table.sos-event-record-grid) .grid-column-header .grid-sort {
    width: 16px;
    height: 16px;
    margin: 0 0 0 6px;
    color: #95b9b1;
    text-decoration: none !important;
}

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

.modal:has(table.sos-event-record-grid) .grid-column-header .grid-sort.active {
    color: var(--saerh-accent-strong);
}

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

.modal:has(table.sos-event-record-grid--ai) .dcat-box > .card-header,
.modal:has(table.sos-event-record-grid--ai) .grid-box > .card-header {
    margin-bottom: 12px;
    padding: 0 !important;
    border: 0 !important;
}

.modal:has(table.sos-event-record-grid--ai) .filter-button-group {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0 0 12px !important;
    padding: 3px;
    border: 1px solid #cfe5de;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(237, 248, 243, 0.98) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 10px 22px rgba(47, 106, 94, 0.08);
}

.modal:has(table.sos-event-record-grid--ai) .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 #79c9b7 !important;
    border-radius: 12px !important;
    background: linear-gradient(180deg, #7ad6c3 0%, #49ab98 55%, #2d7e6c 100%) !important;
    color: #f9fffd !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    overflow: hidden;
    text-shadow: 0 1px 0 rgba(20, 75, 63, 0.16);
    box-shadow:
        0 14px 26px rgba(45, 126, 108, 0.2),
        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.sos-event-record-grid--ai) .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.sos-event-record-grid--ai) .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.sos-event-record-grid--ai) .filter-button-group .btn:hover,
.modal:has(table.sos-event-record-grid--ai) .filter-button-group .btn:focus-visible {
    transform: translateY(-1px) scale(1.01);
    border-color: #65c1ac !important;
    box-shadow:
        0 18px 30px rgba(45, 126, 108, 0.24),
        0 0 0 4px rgba(116, 214, 192, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    filter: saturate(1.04);
}

.modal:has(table.sos-event-record-grid--ai) .filter-button-group .btn:hover::after,
.modal:has(table.sos-event-record-grid--ai) .filter-button-group .btn:focus-visible::after {
    transform: rotate(18deg) translateX(360%);
}

.modal:has(table.sos-event-record-grid--ai) .filter-button-group .btn:focus,
.modal:has(table.sos-event-record-grid--ai) .filter-button-group .btn:focus-visible {
    outline: none;
    color: #f9fffd !important;
}

.modal:has(table.sos-event-record-grid--ai) .filter-button-group .btn:active,
.modal:has(table.sos-event-record-grid--ai) .filter-button-group.show .btn:first-child {
    transform: translateY(1px) scale(0.985);
    background: linear-gradient(180deg, #63cab4 0%, #349482 100%) !important;
    box-shadow:
        0 7px 15px rgba(45, 126, 108, 0.18),
        inset 0 2px 5px rgba(19, 72, 61, 0.18);
    filter: saturate(1.06);
}

.modal:has(table.sos-event-record-grid--ai) .filter-button-group .btn .feather {
    font-size: 13px;
}

.modal:has(table.sos-event-record-grid--ai) .filter-button-group .filter-count {
    font-weight: 700;
    color: rgba(249, 255, 253, 0.86);
}

.modal:has(table.sos-event-record-grid--ai) .filter-button-group .btn + .btn {
    min-width: 38px;
    margin-left: 4px;
    padding: 0 10px;
    border-left: 1px solid #79c9b7 !important;
}

.modal:has(table.sos-event-record-grid--ai) .grid-selector,
.modal:has(table.sos-event-record-grid--ai) .filter-box {
    border: 1px solid var(--saerh-border) !important;
    border-radius: 16px !important;
    background: linear-gradient(180deg, #f7fcfa 0%, #eef8f4 100%) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 8px 20px rgba(47, 106, 94, 0.06) !important;
}

.modal:has(table.sos-event-record-grid--ai) .grid-selector {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    padding: 12px 16px;
}

.modal:has(table.sos-event-record-grid--ai) .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.sos-event-record-grid--ai) .grid-selector .select-label {
    float: none;
    width: 68px;
    padding: 0;
    color: #4b756c;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    flex: 0 0 auto;
}

.modal:has(table.sos-event-record-grid--ai) .grid-selector .select-options {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 0;
    overflow: visible !important;
}

.modal:has(table.sos-event-record-grid--ai) .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.sos-event-record-grid--ai) .grid-selector .select-options li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    float: none;
}

@keyframes saerh-selector-active-pulse {
    0%,
    100% {
        box-shadow:
            0 12px 24px rgba(58, 142, 123, 0.22),
            0 0 0 0 rgba(104, 197, 175, 0.14),
            inset 0 1px 0 rgba(255, 255, 255, 0.22);
    }
    50% {
        box-shadow:
            0 15px 28px rgba(58, 142, 123, 0.28),
            0 0 0 7px rgba(104, 197, 175, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.22);
    }
}

.modal:has(table.sos-event-record-grid--ai) .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 #cde4dc;
    border-radius: 999px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(239, 249, 245, 0.92) 100%);
    color: #4b756c;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none !important;
    box-shadow:
        0 3px 8px rgba(58, 121, 108, 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.sos-event-record-grid--ai) .grid-selector .select-options li > a:first-child::before,
.modal:has(table.sos-event-record-grid--ai) .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.sos-event-record-grid--ai) .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.sos-event-record-grid--ai) .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(101, 201, 176, 0.28) 0%, rgba(101, 201, 176, 0) 72%);
    filter: blur(6px);
    opacity: 0;
    transform: translateY(4px) scale(0.84);
}

.modal:has(table.sos-event-record-grid--ai) .grid-selector .select-options li > a:first-child:hover {
    border-color: #acd7cb;
    background: linear-gradient(180deg, #ffffff 0%, #e3f6ef 100%);
    color: var(--saerh-accent-strong);
    box-shadow:
        0 10px 18px rgba(49, 128, 111, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);
    transform: translateY(-2px) scale(1.035);
}

.modal:has(table.sos-event-record-grid--ai) .grid-selector .select-options li > a:first-child:hover::after {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.modal:has(table.sos-event-record-grid--ai) .grid-selector .select-options li > a:first-child:active {
    border-color: #489c88;
    background: linear-gradient(180deg, #5eb59f 0%, #2c8b79 100%);
    color: #fbfffd;
    box-shadow:
        inset 0 3px 8px rgba(26, 78, 66, 0.24),
        0 3px 8px rgba(44, 119, 103, 0.18);
    transform: translateY(1px) scale(0.97);
}

.modal:has(table.sos-event-record-grid--ai) .grid-selector .select-options li > a:first-child:focus {
    outline: none;
}

.modal:has(table.sos-event-record-grid--ai) .grid-selector .select-options li > a:first-child:focus-visible {
    box-shadow:
        0 0 0 3px rgba(121, 207, 186, 0.26),
        0 10px 20px rgba(49, 128, 111, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.modal:has(table.sos-event-record-grid--ai) .grid-selector .select-options li > a:first-child.active,
.modal:has(table.sos-event-record-grid--ai) .grid-selector .select-options li > a:first-child:focus:not(:focus-visible):not(.active) {
    border-color: #7dc9b7;
    background: linear-gradient(180deg, #63bea8 0%, #348f7d 58%, #236d5e 100%);
    color: #fbfffd;
    box-shadow:
        0 12px 24px rgba(58, 142, 123, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.modal:has(table.sos-event-record-grid--ai) .grid-selector .select-options li > a:first-child.active {
    animation: saerh-selector-active-pulse 2.2s ease-in-out infinite;
}

.modal:has(table.sos-event-record-grid--ai) .grid-selector .select-options a.add,
.modal:has(table.sos-event-record-grid--ai) .grid-selector .select-options a.clear {
    display: none !important;
}

.modal:has(table.sos-event-record-grid--ai) .filter-box {
    margin: 12px 0 10px !important;
    padding: 12px 16px !important;
}

.modal:has(table.sos-event-record-grid--ai) .filter-box .card-body {
    padding: 0 !important;
    background: transparent !important;
}

.modal:has(table.sos-event-record-grid--ai) .grid-filter-form .row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    margin: 0 -6px !important;
}

.modal:has(table.sos-event-record-grid--ai) .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.sos-event-record-grid--ai) .grid-filter-form .form-group {
    margin-bottom: 0;
}

.modal:has(table.sos-event-record-grid--ai) .grid-filter-form .input-group.input-group-sm {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
}

.modal:has(table.sos-event-record-grid--ai) .grid-filter-form .input-group-prepend {
    display: flex;
}

.modal:has(table.sos-event-record-grid--ai) .grid-filter-form .input-group-prepend .input-group-text {
    border: 1px solid #cfe6df;
    border-right: 0;
    border-radius: 14px 0 0 14px;
    background: #f7fcfa;
    color: #487267;
    font-size: 13px;
    font-weight: 700;
    padding: 0 12px;
    box-shadow: none;
}

.modal:has(table.sos-event-record-grid--ai) .grid-filter-form .input-group > .form-control {
    height: 38px;
    border-color: #cfe6df;
    background: #fcfffd;
    color: #4b6761;
    font-size: 13px;
    padding: 8px 12px;
    box-shadow: none;
}

.modal:has(table.sos-event-record-grid--ai) .grid-filter-form .input-group > .form-control:first-of-type {
    border-radius: 0;
}

.modal:has(table.sos-event-record-grid--ai) .grid-filter-form .input-group > .form-control:last-child {
    border-left: 0;
    border-radius: 0 14px 14px 0;
}

.modal:has(table.sos-event-record-grid--ai) .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 #cfe6df;
    border-bottom: 1px solid #cfe6df;
    background: #f5fbf8;
    color: #86a59e;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.modal:has(table.sos-event-record-grid--ai) .grid-filter-form .input-group > .form-control:focus {
    border-color: #8fcebf;
    box-shadow: 0 0 0 3px rgba(112, 202, 182, 0.14);
    position: relative;
    z-index: 2;
}

.modal:has(table.sos-event-record-grid--ai) .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.sos-event-record-grid--ai) .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.sos-event-record-grid--ai) .grid-filter-form .btn-group .btn.submit {
    border-color: #76c7b4;
    background: linear-gradient(180deg, #69c5af 0%, #398f7d 56%, #266f60 100%);
    color: #fbfffd;
    box-shadow: 0 10px 20px rgba(49, 128, 111, 0.18);
}

.modal:has(table.sos-event-record-grid--ai) .grid-filter-form .btn-group .btn.submit:hover {
    border-color: #59b39f;
    background: linear-gradient(180deg, #56bba3 0%, #2f8774 100%);
    transform: translateY(-1px);
}

.modal:has(table.sos-event-record-grid--ai) .grid-filter-form .btn-group .btn.reset {
    border: 1px solid #cfe6df;
    background: #fcfffd;
    color: #4c756c;
}

.modal:has(table.sos-event-record-grid--ai) .grid-filter-form .btn-group .btn.reset:hover {
    border-color: #acd7cb;
    background: #eef8f4;
    color: #2e655b;
}

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

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

table.sos-event-record-grid > tbody > tr[data-key] > td:first-child {
    border-left: 1px solid #dcece7 !important;
    border-radius: 12px 0 0 12px;
    color: #55766e;
    font-weight: 600;
}

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

table.sos-event-record-grid > tbody > tr[data-key]:hover > td {
    background: #f5fcfa !important;
    border-color: #c8e3db !important;
}

table.sos-event-record-grid > tbody > tr > td:nth-child(2) {
    text-align: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

table.sos-event-record-grid > tbody > tr > td:nth-child(2) .saerh-chip {
    margin-left: auto;
    margin-right: auto;
}

table.sos-event-record-grid > tbody > tr > td:nth-child(3) {
    color: #416760;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08px;
}

table.sos-event-record-grid.sos-event-record-grid--sleep-radar > tbody > tr > td:nth-child(1) {
    text-align: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

table.sos-event-record-grid.sos-event-record-grid--sleep-radar > tbody > tr > td:nth-child(1) .saerh-chip {
    margin-left: auto;
    margin-right: auto;
}

table.sos-event-record-grid.sos-event-record-grid--sleep-radar > tbody > tr > td:nth-child(2) {
    text-align: left !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    color: #416760;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08px;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-sos > thead > tr > th,
table.sos-event-record-grid.sos-event-record-grid--bracelet-trajectory > thead > tr > th,
table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring > thead > tr > th {
    text-align: left !important;
    white-space: normal;
    padding-left: 12px !important;
    padding-right: 12px !important;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-sos > thead > tr > th:nth-child(1),
table.sos-event-record-grid.sos-event-record-grid--bracelet-trajectory > thead > tr > th:nth-child(1),
table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring > thead > tr > th:nth-child(1) {
    text-align: center !important;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring > thead > tr > th:nth-child(2) {
    text-align: center !important;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-sos > tbody > tr > td,
table.sos-event-record-grid.sos-event-record-grid--bracelet-trajectory > tbody > tr > td,
table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring > tbody > tr > td {
    text-align: left !important;
    word-break: break-word;
    overflow-wrap: anywhere;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-sos > tbody > tr > td:nth-child(1),
table.sos-event-record-grid.sos-event-record-grid--bracelet-trajectory > tbody > tr > td:nth-child(1),
table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring > tbody > tr > td:nth-child(1),
table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring > tbody > tr > td:nth-child(2) {
    text-align: center !important;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-sos > tbody > tr > td:nth-child(2),
table.sos-event-record-grid.sos-event-record-grid--bracelet-trajectory > tbody > tr > td:nth-child(2),
table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring > tbody > tr > td:nth-child(3) {
    padding-left: 12px !important;
    padding-right: 12px !important;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-sos > tbody > tr > td:nth-child(3),
table.sos-event-record-grid.sos-event-record-grid--bracelet-trajectory > tbody > tr > td:nth-child(2),
table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring > tbody > tr > td:nth-child(4) {
    color: #416760;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08px;
}

table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring > tbody > tr > td:nth-child(3) {
    color: #3f6961;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
}

table.sos-event-record-grid.sos-event-record-grid--blood-reminder > thead > tr > th {
    text-align: center !important;
    white-space: normal;
    padding-left: 12px !important;
    padding-right: 12px !important;
}

table.sos-event-record-grid.sos-event-record-grid--blood-reminder > tbody > tr > td {
    text-align: center !important;
}

table.sos-event-record-grid.sos-event-record-grid--blood-reminder > tbody > tr > td:nth-child(2),
table.sos-event-record-grid.sos-event-record-grid--blood-reminder > tbody > tr > td:nth-child(4) {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

table.sos-event-record-grid.sos-event-record-grid--blood-reminder > tbody > tr > td:nth-child(2) .saerh-chip {
    margin-left: auto;
    margin-right: auto;
    white-space: normal;
}

table.sos-event-record-grid.sos-event-record-grid--blood-reminder > tbody > tr[data-key] > td:nth-child(3) {
    color: #3f6961;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08px;
    white-space: nowrap;
}

table.sos-event-record-grid.sos-event-record-grid--blood-reminder > tbody > tr[data-key] > td:nth-child(4) a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    min-width: 74px;
    padding: 0 12px;
    border: 1px solid var(--saerh-chip-border);
    border-radius: 999px;
    background: linear-gradient(180deg, #f6fcfa 0%, var(--saerh-chip-bg) 100%);
    color: var(--saerh-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.sos-event-record-grid.sos-event-record-grid--blood-reminder > tbody > tr[data-key] > td:nth-child(4) a:hover {
    border-color: #8ecfc0;
    background: #e7f7f1;
    color: #1f6658;
    box-shadow: 0 6px 14px rgba(49, 128, 111, 0.14);
    transform: translateY(-1px);
}

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

table.sos-event-record-grid.sos-event-record-grid--blood-reminder > tbody > tr:not([data-key]) .table {
    margin: 0;
    border: 1px solid #cfe5de;
    border-radius: 10px;
    overflow: hidden;
    background: #f7fcfa;
}

table.sos-event-record-grid.sos-event-record-grid--blood-reminder > tbody > tr:not([data-key]) .table > thead > tr > th {
    background: #edf7f3 !important;
    color: #427469 !important;
    border-bottom: 1px solid #d7e8e2;
    border-top: 0;
    font-size: 12px;
    font-weight: 700;
    padding: 9px 10px;
    white-space: nowrap;
}

table.sos-event-record-grid.sos-event-record-grid--blood-reminder > tbody > tr:not([data-key]) .table > tbody > tr > td {
    border-top: 0;
    border-bottom: 1px solid #dcece7;
    color: #4d6762;
    font-size: 13px;
    padding: 9px 10px;
    background: #fbfffe;
}

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

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > tbody > tr > td:nth-child(2) .saerh-chip {
    margin-left: auto;
    margin-right: auto;
}

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > tbody > tr[data-key] > td:nth-child(3) {
    color: #416760;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08px;
    white-space: nowrap;
}

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > thead > tr > th.saerh-ch4-col-id {
    width: 12%;
}

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > thead > tr > th.saerh-ch4-col-event {
    width: 38%;
}

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > thead > tr > th.saerh-ch4-col-time {
    width: 50%;
}

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > tbody > tr > td.saerh-ch4-col-id,
table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > tbody > tr > td:nth-child(1),
table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > tbody > tr > td.saerh-ch4-col-time,
table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > tbody > tr > td:nth-child(3) {
    text-align: center !important;
}

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > tbody > tr > td.saerh-ch4-col-id,
table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > tbody > tr > td:nth-child(1) {
    color: #55766e;
    font-weight: 600;
}

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > tbody > tr > td.saerh-ch4-col-time,
table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > tbody > tr > td:nth-child(3) {
    color: #416760;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08px;
    white-space: nowrap;
}

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > tbody > tr > td.saerh-ch4-col-time .saerh-time,
table.sos-event-record-grid.sos-event-record-grid--institution-ch4 > tbody > tr > td:nth-child(3) .saerh-time {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

table.sos-event-record-grid.sos-event-record-grid--institution-ch4 .saerh-chip {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

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

.saerh-chip--event {
    border: 1px solid var(--saerh-chip-border);
    background: linear-gradient(180deg, #f6fcfa 0%, var(--saerh-chip-bg) 100%);
    color: var(--saerh-accent-strong);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.saerh-time {
    color: #3f6961;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.saerh-address,
.saerh-value,
.saerh-coordinate {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.saerh-coordinate {
    color: #5a7d75;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.modal:has(table.sos-event-record-grid) .grid-box .box-footer {
    border-top: 1px solid #d7e8e2;
    margin-top: 2px;
    padding: 8px 4px 6px;
    background: linear-gradient(180deg, rgba(246, 252, 249, 0.95), rgba(246, 252, 249, 1));
    min-height: 48px;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.modal:has(table.sos-event-record-grid) .grid-box .box-footer .pull-left {
    color: #6b9189;
    font-weight: 600;
    line-height: 32px;
}

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

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

.modal:has(table.sos-event-record-grid) .grid-box .pagination > .active > a,
.modal:has(table.sos-event-record-grid) .grid-box .pagination > .active > span {
    border-color: #3b937f !important;
    background: linear-gradient(135deg, #58b49f, #2f7d6e);
    color: #ffffff !important;
    box-shadow: 0 8px 16px rgba(47, 125, 110, 0.24);
}

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

    .modal:has(table.sos-event-record-grid--ai) .grid-filter-form .filter-input[class*="col-sm-"] {
        flex-basis: 100%;
    }

    table.sos-event-record-grid {
        table-layout: auto;
    }

    table.sos-event-record-grid.sos-event-record-grid--bracelet-sos,
    table.sos-event-record-grid.sos-event-record-grid--bracelet-trajectory,
    table.sos-event-record-grid.sos-event-record-grid--bracelet-monitoring,
    table.sos-event-record-grid.sos-event-record-grid--blood-reminder {
        table-layout: fixed;
    }
}
