/* Device card polish: scoped overrides for legacy /device/{id}. */

.erpds-device-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    width: 100%;
    margin-bottom: 12px;
}

.erpds-device-actions > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.erpds-device-actions .j_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    float: none;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--erpds-border, #d9e0ea);
    border-radius: 7px;
    background: var(--erpds-surface, #fff);
    color: var(--erpds-text, #0f172a);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.erpds-device-actions > a:hover .j_button,
.erpds-device-actions .j_button:hover {
    border-color: color-mix(in srgb, var(--erpds-accent, #2563b8) 42%, var(--erpds-border, #d9e0ea));
    background: var(--erpds-accent-soft, #e8f1ff);
    color: var(--erpds-accent, #2563b8);
    box-shadow: 0 4px 12px rgba(37, 99, 184, 0.14);
    transform: translateY(-1px);
}

.erpds-device-actions > a:focus-visible {
    outline: 2px solid var(--erpds-accent, #2563b8);
    outline-offset: 2px;
}

.erpds-device-actions > a:active .j_button {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.erpds-device-actions .us-icon-task-card,
.erpds-device-actions .us-icon-task-card2,
.erpds-device-actions .us-icon-task-card3,
.erpds-device-actions .us-icon-task-card4 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 21px;
    line-height: 1;
}

.erpds-device-actions .us-icon-task-card3 {
    font-size: 19px;
}

.erpds-device-actions .j_button_splitter {
    align-self: stretch;
    width: 1px;
    height: 28px;
    margin: 5px 3px;
    background: var(--erpds-border, #d9e0ea);
}

.slider_content_double.erpds-device-page {
    display: grid !important;
    grid-template-columns: minmax(360px, 400px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    width: 100% !important;
}

.slider_content_double.erpds-device-page > .erpds-device-sidebar,
.slider_content_double.erpds-device-page > .erpds-device-main {
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
    float: none !important;
    margin: 0 !important;
}

.slider_content_double.erpds-device-page > .erpds-device-sidebar {
    position: sticky;
    top: calc(var(--erpds-topbar-height, 56px) + 12px);
    align-self: start;
}

.slider_content_double.erpds-device-page > .erpds-device-main {
    position: static !important;
    align-self: start;
}

.erpds-device-sidebar > .label_h3,
.erpds-device-sidebar .label_h3 {
    display: block;
    margin: 14px 0 6px !important;
    font-size: 12px;
    line-height: 1.3;
    font-weight: 700;
    color: var(--erpds-text, #1f2630);
}

.erpds-device-sidebar .div_center img {
    max-width: 100% !important;
    height: auto;
}

.erpds-device-details {
    overflow: hidden;
}

.erpds-device-details .item:not([style*="display:none"]):not([style*="display: none"]) {
    grid-template-columns: 140px minmax(0, 1fr) !important;
    column-gap: 14px !important;
    align-items: center !important;
}

.erpds-device-details .left_data {
    white-space: normal !important;
    text-align: right;
}

.erpds-device-details .item > div:not(.left_data) {
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.erpds-device-details .item > div:not(.left_data) a {
    overflow-wrap: normal;
    word-break: normal;
}

.erpds-device-details .tagSpan {
    display: inline-block;
    margin: 1px 2px 1px 0;
    white-space: nowrap;
}

.erpds-device-ping-card {
    width: 100% !important;
    height: auto !important;
    min-height: 118px;
}

.erpds-device-iface-table {
    display: table !important;
    table-layout: fixed;
    width: 100%;
    max-width: 100%;
    padding-left: 0 !important;
    overflow: hidden;
    border: 1px solid var(--erpds-border, #dde1e8);
    border-radius: var(--erpds-radius, 8px);
    background: var(--erpds-surface, #fff);
    box-shadow: var(--erpds-shadow-sm, 0 1px 2px rgba(15, 23, 42, 0.06));
}

.erpds-device-iface-table > .legend,
.erpds-device-iface-table > .item {
    display: table-row !important;
    width: 100% !important;
    min-width: 0;
    height: auto !important;
}

.erpds-device-iface-table > .item {
    min-height: 45px;
}

.erpds-device-iface-table > .legend {
    background: var(--erpds-surface-2, #f5f7fa);
}

.erpds-device-iface-table > .legend > div,
.erpds-device-iface-table > .item > div {
    display: table-cell !important;
    min-width: 0;
    box-sizing: border-box;
    padding: 6px 8px !important;
    border-right: 1px solid var(--erpds-border-soft, #eef1f5);
    border-bottom: 1px solid var(--erpds-border-soft, #eef1f5);
    font-size: 12px;
    line-height: 1.3;
}

.erpds-device-iface-table > .legend > div:last-child,
.erpds-device-iface-table > .item > div:last-child {
    border-right: none;
}

.erpds-device-iface-table > .legend > div {
    color: var(--erpds-text-muted, #525a66);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.erpds-device-iface-table > .item:nth-of-type(odd) > div:not(.port_green):not(.port_red):not(.port_black):not(.port_gray):not([id^="ifSpeedAnimation"]) {
    background: color-mix(in srgb, var(--erpds-surface-2, #f5f7fa) 55%, transparent);
}

.erpds-device-iface-table > .item:hover > div:not(.port_green):not(.port_red):not(.port_black):not(.port_gray):not([id^="ifSpeedAnimation"]) {
    background: var(--erpds-accent-soft, #e8f1ff);
}

.erpds-device-iface-table .port_number {
    width: 76px;
    color: var(--erpds-text, #1f2630);
    font-weight: 700;
    text-align: center;
    vertical-align: top;
}

.erpds-device-iface-table .port_number .info_block {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--erpds-ok-soft, #e8f5ec);
    color: var(--erpds-ok-text, #1a5c2e);
    font-size: 11px;
    line-height: 1.2;
}

.erpds-device-iface-table .port_traf {
    overflow-wrap: anywhere;
    color: var(--erpds-text, #1f2630);
    vertical-align: top;
}

.erpds-device-iface-table .port_traf[id^="div_portconnect_"] {
    width: auto;
}

.erpds-device-iface-table .port_traf:not([id]) {
    width: 110px;
    max-width: 110px;
    font-size: 11px;
    line-height: 1.25;
}

.erpds-device-iface-table .port_traf a {
    font-weight: 600;
}

.erpds-device-iface-table .port_gray {
    width: 42px;
    text-align: center;
    vertical-align: middle;
    color: var(--erpds-text-muted, #525a66);
    background: var(--erpds-surface-2, #f5f7fa) !important;
}

.erpds-device-iface-table .port_green {
    background: var(--erpds-ok, #2e8540) !important;
    color: #fff !important;
    text-align: center;
}

.erpds-device-iface-table .port_red {
    background: var(--erpds-bad, #b62a26) !important;
    color: #fff !important;
    text-align: center;
}

.erpds-device-iface-table .port_black {
    background: #000 !important;
    color: #fff !important;
    text-align: center;
}

.erpds-device-iface-table .port_black a {
    color: #fff !important;
}

.erpds-device-iface-table [id^="ifSpeedAnimation"] {
    width: 17px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.erpds-device-iface-table > .legend > div:nth-child(1) { width: 76px; }
.erpds-device-iface-table > .legend > div:nth-child(3),
.erpds-device-iface-table > .legend > div:nth-child(4) { width: 42px; }
.erpds-device-iface-table > .legend > div:nth-child(5) { width: 17px; }
.erpds-device-iface-table > .legend > div:nth-child(6) { width: 110px; }

.erpds-device-iface-table script,
.erpds-device-iface-table div[style*="display: none"],
.erpds-device-iface-table div[style*="display:none"] {
    display: none !important;
}

@media (max-width: 1180px) {
    .slider_content_double.erpds-device-page {
        grid-template-columns: minmax(340px, 360px) minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .slider_content_double.erpds-device-page {
        grid-template-columns: minmax(0, 1fr);
    }

    .slider_content_double.erpds-device-page > .erpds-device-sidebar {
        position: static;
    }

    .erpds-device-iface-table {
        display: block !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .erpds-device-iface-table > .legend,
    .erpds-device-iface-table > .item {
        display: grid !important;
        grid-template-columns: 76px 431px 42px 42px 17px 110px;
        min-width: 718px;
    }

    .erpds-device-iface-table > .legend > div,
    .erpds-device-iface-table > .item > div {
        display: block !important;
    }

    .erpds-device-details .item:not([style*="display:none"]):not([style*="display: none"]) {
        grid-template-columns: minmax(0, 1fr) !important;
        row-gap: 4px;
        padding: 9px 0 !important;
    }

    .erpds-device-details .item > div {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .erpds-device-details .left_data {
        text-align: left;
    }
}
