/*
 * AI-SOS follow-up history modal (scoped)
 * Applies only when the modal contains `table.sos-follow-history-grid`
 */

.modal:has(table.sos-follow-history-grid) {
    --sfrh-border: #d4e2f7;
    --sfrh-border-strong: #bfd2f0;
    --sfrh-bg: #f3f7ff;
    --sfrh-surface: #f7faff;
    --sfrh-title: #2f456f;
    --sfrh-text: #4a6085;
    --sfrh-muted: #8fa3c3;
    --sfrh-shadow: 0 14px 32px rgba(28, 50, 94, 0.16);
}

.modal:has(table.sos-follow-history-grid) .modal-dialog {
    width: min(95vw, 1060px);
    max-width: 1060px;
    margin: 4vh auto;
}

.modal:has(table.sos-follow-history-grid) .modal-content {
    border: 1px solid var(--sfrh-border);
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(180deg, var(--sfrh-bg) 0%, #ffffff 58%);
    box-shadow: var(--sfrh-shadow);
}

.modal:has(table.sos-follow-history-grid) .modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--sfrh-border);
    background: linear-gradient(120deg, rgba(77, 103, 214, 0.12), rgba(77, 103, 214, 0.04) 48%, #f8fbff 100%);
}

.modal:has(table.sos-follow-history-grid) .modal-title {
    color: var(--sfrh-title);
    font-weight: 700;
    letter-spacing: 0.2px;
}

.modal:has(table.sos-follow-history-grid) .modal-header .close {
    color: #7f91ad;
    opacity: 0.86;
    text-shadow: none;
    transition: transform 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.modal:has(table.sos-follow-history-grid) .modal-header .close:hover {
    color: #5e728f;
    opacity: 1;
    transform: rotate(90deg);
}

.modal:has(table.sos-follow-history-grid) .modal-body {
    padding: 14px 16px 10px;
    max-height: 76vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: transparent;
    scrollbar-width: thin;
    scrollbar-color: rgba(80, 100, 130, 0.28) transparent;
}

.modal:has(table.sos-follow-history-grid:not(.sos-follow-history-grid--alarm-main)) .modal-body {
    padding-top: 0;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .modal-body {
    padding-top: 0;
}

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

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

.modal:has(table.sos-follow-history-grid) .modal-body::-webkit-scrollbar-thumb {
    background: rgba(80, 100, 130, 0.25);
    border-radius: 999px;
}

.modal:has(table.sos-follow-history-grid) .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(80, 100, 130, 0.4);
}

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

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

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

.modal:has(table.sos-follow-history-grid:not(.sos-follow-history-grid--alarm-main)) .dcat-box > .card-header:has(.sfrh-list-head),
.modal:has(table.sos-follow-history-grid:not(.sos-follow-history-grid--alarm-main)) .grid-box > .card-header:has(.sfrh-list-head) {
    position: sticky;
    top: 0;
    z-index: 30;
    border: 1px solid var(--sfrh-border);
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
    background: #f8fbff !important;
    overflow: hidden;
}

.modal:has(table.sos-follow-history-grid) .grid-box .table-wrapper,
.modal:has(table.sos-follow-history-grid) .dcat-box > .table-wrapper {
    border: 1px solid var(--sfrh-border);
    border-radius: 14px;
    background: #f8fbff;
    margin-top: 0 !important;
    overflow: hidden;
}

.modal:has(table.sos-follow-history-grid:not(.sos-follow-history-grid--alarm-main)) .dcat-box > .card-header:has(.sfrh-list-head) + .table-wrapper,
.modal:has(table.sos-follow-history-grid:not(.sos-follow-history-grid--alarm-main)) .grid-box > .card-header:has(.sfrh-list-head) + .table-wrapper {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.modal:has(table.sos-follow-history-grid) .sfrh-list-head {
    display: grid;
    grid-template-columns: minmax(0, 0.96fr) minmax(0, 0.96fr) minmax(124px, 0.62fr) minmax(118px, 0.58fr) minmax(0, 1.38fr);
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #dbe7f9;
    background: linear-gradient(180deg, #f4f8ff 0%, #eff5ff 100%);
}

.modal:has(table.sos-follow-history-grid) .sfrh-list-head__item {
    color: #8095b8;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.modal:has(table.sos-follow-history-grid) .sfrh-list-head__item:nth-child(3),
.modal:has(table.sos-follow-history-grid) .sfrh-list-head__item:nth-child(4) {
    justify-self: center;
    text-align: center;
}

.modal:has(table.sos-follow-history-grid) .sfrh-list-head__item:nth-child(5) {
    padding-left: 8px;
}

table.sos-follow-history-grid {
    width: 100%;
    margin: 0;
    background: transparent;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

table.sos-follow-history-grid thead {
    display: none;
}

table.sos-follow-history-grid > tbody > tr {
    background: transparent !important;
}

table.sos-follow-history-grid > tbody > tr > td {
    border: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
}

table.sos-follow-history-grid > tbody > tr + tr > td {
    border-top: 1px solid #e3ecfb !important;
}

.sfrh-row-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.96fr) minmax(0, 0.96fr) minmax(124px, 0.62fr) minmax(118px, 0.58fr) minmax(0, 1.38fr);
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    transition: background-color 0.2s ease;
}

table.sos-follow-history-grid > tbody > tr:hover .sfrh-row-grid {
    background: rgba(224, 236, 255, 0.18);
}

.sfrh-alarm-time,
.sfrh-follow-time {
    min-width: 0;
}

.sfrh-time {
    display: block;
    color: #2e4672;
    line-height: 1.3;
    letter-spacing: 0.1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sfrh-time--alarm {
    font-size: 17px;
    font-weight: 600;
}

.sfrh-time--follow {
    font-size: 17px;
    font-weight: 600;
    color: #2e4672;
}

.sfrh-time--follow::before {
    content: none !important;
}

.sfrh-remark {
    min-width: 0;
}

.sfrh-event,
.sfrh-reason {
    padding-left: 0;
    justify-content: center;
    justify-self: stretch;
    width: 100%;
}

.sfrh-remark {
    padding-left: 8px;
}

.sfrh-remark-text {
    display: block;
    color: var(--sfrh-text);
    font-size: 14px;
    line-height: 1.45;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.sfrh-empty {
    color: #95a9c6;
}

.sfrh-event,
.sfrh-reason {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.sfrh-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 26px;
    padding: 0 11px;
    border-radius: 999px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
    pointer-events: none;
    user-select: none;
    cursor: default;
    margin: 0 auto;
}

.sfrh-reason .sfrh-tag {
    min-width: 76px;
}

.sfrh-tag--event {
    background: #ebf2ff;
    color: #3968b7;
}

.sfrh-tag--daily {
    background: #eef4ff;
    color: #4b679f;
}

.sfrh-tag--debug {
    background: #eef3f7;
    color: #4f718c;
}

.sfrh-tag--alarm {
    background: #fff1e8;
    color: #bc6a38;
}

.sfrh-tag--mistake {
    background: #fff5ea;
    color: #a8782d;
}

.sfrh-tag--patrol {
    background: #f3f2fb;
    color: #66609d;
}

.sfrh-tag--other {
    background: #f3f6fa;
    color: #6a7486;
}

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

.modal:has(table.sos-follow-history-grid--alarm-main) .dcat-box > .card-header,
.modal:has(table.sos-follow-history-grid--alarm-main) .grid-box > .card-header {
    padding-top: 14px !important;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .filter-button-group {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0 0 12px !important;
    padding: 3px;
    border: 1px solid #d3e0f6;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(240, 245, 255, 0.98) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 10px 22px rgba(45, 70, 130, 0.08);
}

.modal:has(table.sos-follow-history-grid--alarm-main) .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 #7f96e4 !important;
    border-radius: 12px !important;
    overflow: hidden;
    background: linear-gradient(180deg, #7890ec 0%, #536bd8 55%, #3f57c4 100%) !important;
    color: #ffffff !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 0 rgba(38, 58, 125, 0.16);
    box-shadow:
        0 14px 26px rgba(77, 103, 214, 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-follow-history-grid--alarm-main) .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-follow-history-grid--alarm-main) .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-follow-history-grid--alarm-main) .filter-button-group .btn:hover,
.modal:has(table.sos-follow-history-grid--alarm-main) .filter-button-group .btn:focus-visible {
    transform: translateY(-1px) scale(1.01);
    border-color: #6f88df !important;
    box-shadow:
        0 18px 30px rgba(77, 103, 214, 0.24),
        0 0 0 4px rgba(120, 144, 236, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    filter: saturate(1.04);
}

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

.modal:has(table.sos-follow-history-grid--alarm-main) .filter-button-group .btn:focus,
.modal:has(table.sos-follow-history-grid--alarm-main) .filter-button-group .btn:focus-visible {
    outline: none;
    color: #ffffff !important;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .filter-button-group .btn:active,
.modal:has(table.sos-follow-history-grid--alarm-main) .filter-button-group.show .btn:first-child {
    transform: translateY(1px) scale(0.985);
    background: linear-gradient(180deg, #667fe3 0%, #455fc8 100%) !important;
    box-shadow:
        0 7px 15px rgba(77, 103, 214, 0.18),
        inset 0 2px 5px rgba(34, 52, 115, 0.18);
    filter: saturate(1.06);
}

.modal:has(table.sos-follow-history-grid--alarm-main) .filter-button-group .btn .feather {
    font-size: 13px;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .filter-button-group .filter-count {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.86);
}

.modal:has(table.sos-follow-history-grid--alarm-main) .filter-button-group .btn + .btn {
    min-width: 38px;
    margin-left: 4px;
    padding: 0 10px;
    border-left: 1px solid #7f96e4 !important;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector,
.modal:has(table.sos-follow-history-grid--alarm-main) .filter-box {
    border: 1px solid var(--sfrh-border) !important;
    border-radius: 16px !important;
    background: linear-gradient(180deg, #f7faff 0%, #eef4ff 100%) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 8px 20px rgba(45, 70, 130, 0.06) !important;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    margin: 0 0 14px;
    padding: 12px 16px;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .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;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector .select-label {
    float: none;
    width: 68px;
    padding: 0;
    color: #425a8a;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    flex: 0 0 auto;
}

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

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector .select-options ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible !important;
    list-style: none;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector .select-options li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    float: none;
    margin: 0;
}

@keyframes sfrh-selector-active-pulse {
    0%,
    100% {
        box-shadow:
            0 12px 24px rgba(77, 103, 214, 0.22),
            0 0 0 0 rgba(120, 144, 236, 0.14),
            inset 0 1px 0 rgba(255, 255, 255, 0.22);
    }
    50% {
        box-shadow:
            0 15px 28px rgba(77, 103, 214, 0.28),
            0 0 0 7px rgba(120, 144, 236, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.22);
    }
}

.modal:has(table.sos-follow-history-grid--alarm-main) .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 #d3e0f6;
    border-radius: 999px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(240, 245, 255, 0.92) 100%);
    color: #4a6085;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none !important;
    box-shadow:
        0 3px 8px rgba(77, 103, 214, 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-follow-history-grid--alarm-main) .grid-selector .select-options li > a:first-child::before,
.modal:has(table.sos-follow-history-grid--alarm-main) .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-follow-history-grid--alarm-main) .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-follow-history-grid--alarm-main) .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(120, 144, 236, 0.28) 0%, rgba(120, 144, 236, 0) 72%);
    filter: blur(6px);
    opacity: 0;
    transform: translateY(4px) scale(0.84);
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector .select-options li > a:first-child:hover {
    border-color: #b8c9ef;
    background: linear-gradient(180deg, #ffffff 0%, #e7eeff 100%);
    color: #3f59c8;
    box-shadow:
        0 10px 18px rgba(77, 103, 214, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);
    transform: translateY(-2px) scale(1.035);
}

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

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector .select-options li > a:first-child:active {
    border-color: #4d67d6;
    background: linear-gradient(180deg, #647de2 0%, #425cc7 100%);
    color: #ffffff;
    box-shadow:
        inset 0 3px 8px rgba(34, 52, 115, 0.24),
        0 3px 8px rgba(77, 103, 214, 0.18);
    transform: translateY(1px) scale(0.97);
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector .select-options li > a:first-child:focus {
    outline: none;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector .select-options li > a:first-child:focus-visible {
    box-shadow:
        0 0 0 3px rgba(120, 144, 236, 0.26),
        0 10px 20px rgba(77, 103, 214, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector .select-options li > a:first-child.active,
.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector .select-options li > a:first-child:focus:not(:focus-visible):not(.active) {
    border-color: #7f96e4;
    background: linear-gradient(180deg, #647de2 0%, #4d67d6 58%, #3f57c4 100%);
    color: #ffffff;
    box-shadow:
        0 12px 24px rgba(77, 103, 214, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector .select-options li > a:first-child.active {
    animation: sfrh-selector-active-pulse 2.2s ease-in-out infinite;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector .select-options a.add,
.modal:has(table.sos-follow-history-grid--alarm-main) .grid-selector .select-options a.clear {
    display: none !important;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .filter-box {
    margin: 12px 0 10px !important;
    padding: 12px 16px !important;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .filter-box .card-body {
    padding: 0 !important;
    background: transparent !important;
}

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

.modal:has(table.sos-follow-history-grid--alarm-main) .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-follow-history-grid--alarm-main) .grid-filter-form .form-group {
    margin-bottom: 0;
}

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

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-filter-form .input-group-prepend {
    display: flex;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-filter-form .input-group-prepend .input-group-text {
    padding: 0 12px;
    border: 1px solid #d3e0f6;
    border-right: 0;
    border-radius: 14px 0 0 14px;
    background: #f8fbff;
    color: #425a8a;
    font-size: 13px;
    font-weight: 700;
    box-shadow: none;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-filter-form .input-group > .form-control {
    height: 38px;
    padding: 8px 12px;
    border-color: #d3e0f6;
    background: #fcfdff;
    color: #4a6085;
    font-size: 13px;
    box-shadow: none;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-filter-form .input-group > .form-control:first-of-type {
    border-radius: 0;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-filter-form .input-group > .form-control:last-child {
    border-left: 0;
    border-radius: 0 14px 14px 0;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .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 #d3e0f6;
    border-bottom: 1px solid #d3e0f6;
    background: #f2f6ff;
    color: #8fa3c3;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-filter-form .input-group > .form-control:focus {
    position: relative;
    z-index: 2;
    border-color: #9fb2eb;
    box-shadow: 0 0 0 3px rgba(120, 144, 236, 0.14);
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-filter-form .btn-group {
    display: inline-flex;
    align-items: center;
    height: auto !important;
    margin: 0 6px 10px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .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-follow-history-grid--alarm-main) .grid-filter-form .btn-group .btn.submit {
    border-color: #7f96e4;
    background: linear-gradient(180deg, #6d86e7 0%, #4d67d6 56%, #3f57c4 100%);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(77, 103, 214, 0.18);
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-filter-form .btn-group .btn.submit:hover {
    border-color: #6f88df;
    background: linear-gradient(180deg, #617be1 0%, #435dc8 100%);
    transform: translateY(-1px);
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-filter-form .btn-group .btn.reset {
    border: 1px solid #d3e0f6;
    background: #fcfdff;
    color: #4a6085;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-filter-form .btn-group .btn.reset:hover {
    border-color: #b8c9ef;
    background: #eef4ff;
    color: #3f59c8;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-box .table-wrapper,
.modal:has(table.sos-follow-history-grid--alarm-main) .dcat-box > .table-wrapper {
    overflow: visible !important;
    border-color: var(--sfrh-border);
    background: #ffffff;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main {
    table-layout: fixed;
    min-width: 820px;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main thead {
    display: table-header-group;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 10px 14px !important;
    border: 0 !important;
    border-bottom: 1px solid #dbe7f9 !important;
    background: linear-gradient(180deg, #f4f8ff 0%, #edf4ff 100%) !important;
    background-clip: padding-box;
    color: #7188ad;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    vertical-align: middle;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > thead > tr > th:nth-child(1),
table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > tbody > tr > td:nth-child(1) {
    width: 22%;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > thead > tr > th:nth-child(2),
table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > tbody > tr > td:nth-child(2) {
    width: 22%;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > thead > tr > th:nth-child(3),
table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > tbody > tr > td:nth-child(3) {
    width: 16%;
    text-align: center;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > thead > tr > th:nth-child(4),
table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > tbody > tr > td:nth-child(4) {
    width: 16%;
    text-align: center;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > thead > tr > th:nth-child(5),
table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > tbody > tr > td:nth-child(5) {
    width: 24%;
    text-align: left;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > tbody > tr {
    background: #ffffff !important;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > tbody > tr > td {
    padding: 14px !important;
    border-top: 1px solid #e3ecfb !important;
    background: #ffffff !important;
    color: var(--sfrh-text);
    font-size: 14px;
    line-height: 1.42;
    vertical-align: middle !important;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > tbody > tr:first-child > td {
    border-top: 0 !important;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main > tbody > tr:hover > td {
    background: #f8fbff !important;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main .sfrh-time {
    display: inline-block;
    max-width: 100%;
}

table.sos-follow-history-grid.sos-follow-history-grid--alarm-main .sfrh-tag {
    margin: 0;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-column-header .grid-sort {
    color: #9aaccc;
}

.modal:has(table.sos-follow-history-grid--alarm-main) .grid-column-header .grid-sort.active {
    color: #4d67d6;
}

.modal:has(table.sos-follow-history-grid) .grid-box .box-footer {
    border-top: 1px solid #dbe7f9;
    margin-top: 6px;
    padding: 8px 4px 6px;
    background: linear-gradient(180deg, rgba(248, 251, 255, 0.95), rgba(248, 251, 255, 1));
    min-height: 48px;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.modal:has(table.sos-follow-history-grid) .grid-box .box-footer .pull-left {
    color: #7085a6;
    font-weight: 600;
    line-height: 32px;
}

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

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

.modal:has(table.sos-follow-history-grid) .grid-box .pagination > .active > a,
.modal:has(table.sos-follow-history-grid) .grid-box .pagination > .active > span {
    border-color: #4d67d6 !important;
    background: linear-gradient(135deg, #4d67d6, #3f59c8);
    color: #ffffff !important;
    box-shadow: 0 8px 16px rgba(77, 103, 214, 0.24);
}

@media (max-width: 980px) {
    .modal:has(table.sos-follow-history-grid) .modal-dialog {
        width: 94vw;
        max-width: 94vw;
    }

    .modal:has(table.sos-follow-history-grid:not(.sos-follow-history-grid--alarm-main)) .dcat-box > .card-header:has(.sfrh-list-head),
    .modal:has(table.sos-follow-history-grid:not(.sos-follow-history-grid--alarm-main)) .grid-box > .card-header:has(.sfrh-list-head) {
        display: none;
    }

    .modal:has(table.sos-follow-history-grid:not(.sos-follow-history-grid--alarm-main)) .dcat-box > .table-wrapper,
    .modal:has(table.sos-follow-history-grid:not(.sos-follow-history-grid--alarm-main)) .grid-box > .table-wrapper {
        border-radius: 14px;
    }

    .modal:has(table.sos-follow-history-grid) .sfrh-list-head {
        display: none;
    }

    .sfrh-row-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .sfrh-alarm-time,
    .sfrh-follow-time {
        padding-right: 0;
    }

    .sfrh-event,
    .sfrh-reason {
        justify-content: flex-start;
    }

    .sfrh-event,
    .sfrh-reason,
    .sfrh-remark {
        padding-left: 0;
    }
}
