/* SmartCheck status colors shared by PHM and OEE. */
.sc-status-pill {
    border: 1px solid transparent;
}

.sc-status-running {
    color: #0a7a60;
    background-color: #dbffeb;
}

.sc-status-stopped {
    color: #382f47;
    background-color: #eceaed;
}

.sc-status-error {
    color: #ba374e;
    background-color: #ffd2db;
}

.sc-status-offline {
    color: #fff;
    background-color: #666;
}

.sc-status-default {
    color: #37474f;
    background-color: #eceff1;
}

/* Dark mode keeps the semantic accent but removes bright pastel blocks. */
.app-theme-dark .sc-status-running {
    color: #74e8cd;
    background-color: rgba(48, 216, 177, 0.11);
    border-color: rgba(48, 216, 177, 0.28);
}

.app-theme-dark .sc-status-stopped {
    color: #c2c1cd;
    background-color: rgba(146, 146, 159, 0.10);
    border-color: rgba(146, 146, 159, 0.24);
}

.app-theme-dark .sc-status-error {
    color: #ff8aa0;
    background-color: rgba(251, 97, 127, 0.11);
    border-color: rgba(251, 97, 127, 0.30);
}

.app-theme-dark .sc-status-offline,
.app-theme-dark .sc-status-default {
    color: #b8b7c4;
    background-color: rgba(146, 146, 159, 0.09);
    border-color: rgba(146, 146, 159, 0.22);
}

.app-theme-dark .sc-legend-chip {
    border-left-width: 1px;
    border-left-style: solid;
}

.app-theme-dark .sc-legend-error {
    color: #ff8aa0;
    background-color: rgba(251, 97, 127, 0.10);
    border-color: rgba(251, 97, 127, 0.28);
}

.app-theme-dark .sc-legend-ai {
    color: #8eaeff;
    background-color: rgba(73, 131, 251, 0.10);
    border-color: rgba(73, 131, 251, 0.28);
}

.app-theme-dark .sc-legend-pm {
    color: #74e8cd;
    background-color: rgba(48, 216, 177, 0.10);
    border-color: rgba(48, 216, 177, 0.28);
}

.app-theme-dark .sc-legend-alarm {
    color: #d9a0fa;
    background-color: rgba(194, 116, 242, 0.10);
    border-color: rgba(194, 116, 242, 0.28);
}

.app-theme-dark .sc-legend-eff {
    color: #ffbf91;
    background-color: rgba(255, 174, 123, 0.10);
    border-color: rgba(255, 174, 123, 0.28);
}

.app-theme-dark .sc-legend-default {
    color: #b8b7c4;
    background-color: rgba(146, 146, 159, 0.09);
    border-color: rgba(146, 146, 159, 0.22);
}
/* Dashboard Recent에서 진입한 설비 행을 잠시 강조한다. */
.smartcheck-focus-row > td {
    animation: smartcheck-row-focus 4s ease-out;
}

@keyframes smartcheck-row-focus {
    0%, 35% {
        background-color: rgba(24, 130, 254, 0.24);
        box-shadow: inset 0 2px 0 rgba(24, 130, 254, 0.85),
                    inset 0 -2px 0 rgba(24, 130, 254, 0.85);
    }
    100% {
        background-color: transparent;
        box-shadow: none;
    }
}

/* PHM mobile: compact equipment summary with on-demand details. */
.sc-mobile-summary-cell,
.sc-mobile-detail-cell {
    display: none;
}

@media (max-width: 600px) {
    .sc-smartcheck-mobile-card {
        width: calc(100% - 16px);
        max-width: calc(100% - 16px);
        height: calc(100dvh - 72px);
        max-height: calc(100dvh - 72px);
        margin: 8px auto;
    }

    .sc-phm-table .mud-table-body .mud-table-row,
    .sc-oee-table .mud-table-body .mud-table-row {
        display: block;
        margin: 8px 6px;
        overflow: hidden;
        border: 1px solid var(--mud-palette-lines-default);
        border-radius: 12px;
        background: var(--mud-palette-surface);
    }

    .sc-phm-table .mud-table-body .mud-table-row > .sc-desktop-cell,
    .sc-oee-table .mud-table-body .mud-table-row > .sc-desktop-cell {
        display: none !important;
    }

    .sc-phm-table .mud-table-body .mud-table-row > .sc-mobile-summary-cell,
    .sc-phm-table .mud-table-body .mud-table-row > .sc-mobile-detail-cell,
    .sc-oee-table .mud-table-body .mud-table-row > .sc-mobile-summary-cell,
    .sc-oee-table .mud-table-body .mud-table-row > .sc-mobile-detail-cell {
        display: block !important;
        width: 100%;
        padding: 0 !important;
        border: 0 !important;
    }

    .sc-mobile-summary-cell::before,
    .sc-mobile-detail-cell::before {
        display: none !important;
    }

    .sc-mobile-summary {
        padding: 13px 14px 12px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .sc-mobile-summary-head,
    .sc-mobile-diag-line {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .sc-mobile-equipment {
        display: flex;
        align-items: baseline;
        min-width: 0;
        gap: 7px;
        font-size: 15px;
    }

    .sc-mobile-equipment strong {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sc-mobile-row-no,
    .sc-mobile-maker,
    .sc-mobile-detail-grid span,
    .sc-mobile-detail-label {
        color: var(--mud-palette-text-secondary);
        font-size: 12px;
    }

    .sc-mobile-maker {
        margin: 3px 0 10px 25px;
    }

    .sc-mobile-diags {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        min-width: 0;
    }

    .sc-mobile-expand-icon {
        flex: 0 0 auto;
        color: var(--mud-palette-text-secondary);
    }

    .sc-mobile-alert-summary {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-top: 10px;
        padding-top: 9px;
        border-top: 1px solid var(--mud-palette-lines-default);
        color: var(--mud-palette-warning);
        font-size: 12px;
    }

    .sc-mobile-kpi-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-top: 10px;
        padding-top: 9px;
        border-top: 1px solid var(--mud-palette-lines-default);
        color: var(--mud-palette-text-secondary);
        font-size: 12px;
    }

    .sc-mobile-kpi-summary strong {
        color: var(--mud-palette-text-primary);
        font-weight: 600;
    }

    .sc-mobile-details {
        padding: 0 14px 14px;
        border-top: 1px solid var(--mud-palette-lines-default);
    }

    .sc-mobile-detail-grid {
        display: grid;
        gap: 8px;
        padding: 12px 0;
    }

    .sc-mobile-detail-grid > div {
        display: flex;
        justify-content: space-between;
        gap: 12px;
    }

    .sc-mobile-detail-grid strong {
        text-align: right;
        font-size: 13px;
        font-weight: 500;
    }

    .sc-mobile-oee-metrics {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 12px 0;
    }

    .sc-mobile-oee-metrics > div {
        padding: 9px 10px;
        border: 1px solid var(--mud-palette-lines-default);
        border-radius: 8px;
        background: var(--mud-palette-background-gray);
    }

    .sc-mobile-oee-metrics span,
    .sc-mobile-oee-metrics strong {
        display: block;
    }

    .sc-mobile-oee-metrics span {
        color: var(--mud-palette-text-secondary);
        font-size: 11px;
    }

    .sc-mobile-oee-metrics strong {
        margin-top: 2px;
        font-size: 15px;
    }

    .sc-mobile-oee-detail-grid {
        padding-top: 0;
        border-top: 1px solid var(--mud-palette-lines-default);
    }

    .sc-mobile-maintenance {
        padding-top: 10px;
        border-top: 1px solid var(--mud-palette-lines-default);
    }

    .sc-mobile-maintenance + .sc-mobile-maintenance {
        margin-top: 11px;
    }

    .sc-mobile-maint-text {
        margin: 4px 0 7px;
        font-size: 13px;
        line-height: 1.4;
        overflow-wrap: anywhere;
    }

    .sc-smartcheck-mobile-legend {
        flex-wrap: nowrap;
        gap: 6px;
        min-height: 38px;
        padding: 6px 8px;
        overflow-x: auto;
        overflow-y: hidden;
        border-top: 1px solid var(--mud-palette-lines-default);
        scrollbar-width: none;
    }

    .sc-smartcheck-mobile-legend::-webkit-scrollbar {
        display: none;
    }

    .sc-smartcheck-mobile-legend .mud-chip {
        flex: 0 0 auto;
        margin: 0 !important;
        white-space: nowrap;
    }

    .sc-smartcheck-mobile-pager-row {
        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
        padding: 0 5px 0 10px;
        flex-wrap: nowrap !important;
        overflow: hidden;
    }

    .sc-smartcheck-equipment-count {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .sc-smartcheck-mobile-pager {
        min-width: 0;
        margin-left: auto;
    }

    .sc-smartcheck-mobile-pager.mud-table-pagination-toolbar {
        height: 48px !important;
        min-height: 48px !important;
        padding: 0 !important;
        flex-wrap: nowrap !important;
        border-top: 0 !important;
    }

    .sc-smartcheck-mobile-pager .mud-table-pagination-caption {
        white-space: nowrap;
    }
}

@media (max-width: 460px) {
    .sc-smartcheck-mobile-pager .mud-table-pagination-caption {
        display: none;
    }

    .sc-smartcheck-mobile-pager-row {
        padding-left: 8px;
    }
}
