/* ========================================================================== */
/* ADMIN → SYSTEM — MODALS (logs / device-details / security-details)         */
/* ========================================================================== */

/* ── backdrop ── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 17, 32, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
    padding: 20px;
}

/* ── base logs modal shell ── */
.logs-modal {
    width: min(980px, 92vw);
    max-height: 82vh;
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(2, 42, 70, 0.15);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: logsSlideUp 0.24s ease-out;
}

@keyframes logsSlideUp {
    from {
        opacity: 0;
        transform: translateY(26px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logs-modal .modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(2, 42, 70, 0.12);
}

.logs-modal .close-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    color: #425466;
    font-size: 1.5rem;
    line-height: 1;
}

.logs-modal .close-btn:hover {
    color: #1f2a37;
}

/* ── modal body ── */
.logs-body {
    padding: 14px 18px 18px;
    overflow: auto;
    min-height: 220px;
}

.logs-modal .logs-pre {
    margin: 0;
    padding: 12px;
    border-radius: 8px;
    background: #0b1220;
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.82rem;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

.logs-empty {
    margin: 0;
    color: #425466;
    font-size: 0.92rem;
}

/* ================================================================ */
/* SM MODAL REDESIGN                                                 */
/* ================================================================ */

/* ── hero header ── */
.sm-modal .sm-modal-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(2, 42, 70, 0.12);
    gap: 12px;
    flex-shrink: 0;
}

.sm-modal-hero-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sm-modal-hero-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(45, 100, 216, 0.10);
    color: #2d64d8;
}

/* per-modal icon accent variants */
.sm-icon-security { background: rgba(194, 65, 12, 0.10); color: #c2410c; }
.sm-icon-device   { background: rgba(3, 47, 79, 0.10);   color: #032f4f; }
.sm-icon-issues   { color: #b45309; }
.sm-icon-ok       { color: #15803d; }

.sm-modal-hero-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #032f4f;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 380px;
}

.sm-modal-hero-sub {
    font-size: 0.78rem;
    color: #4f6b80;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    margin-top: 2px;
}

/* ── icon close button ── */
.sm-modal .sm-close-btn {
    position: static;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #425466;
    background: transparent;
    transition: background 0.15s ease, color 0.15s ease;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}

.sm-modal .sm-close-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #032f4f;
}

/* ── meta chip bar ── */
.sm-modal-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-bottom: 1px solid rgba(2, 42, 70, 0.07);
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* text-only chips — icon wrapper hidden via CSS, not removed from DOM */
.sm-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(2, 42, 70, 0.06);
    color: #032f4f;
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: 0.02rem;
}

.sm-meta-chip-icon {
    display: inline-flex;
    align-items: center;
}

.sm-chip-live { background: rgba(21, 128, 61, 0.10); color: #166534; }
.sm-chip-warn { background: rgba(180, 83, 9, 0.10);  color: #92400e; }

/* ── state containers: loading / empty / error ── */
.sm-modal-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px;
    text-align: center;
}

.sm-modal-state.sm-state-compact { padding: 20px; }

.sm-state-icon {
    color: rgba(3, 47, 79, 0.22);
    display: flex;
    align-items: center;
}

.sm-modal-state.sm-state-error .sm-state-icon { color: #dc2626; }
.sm-modal-state.sm-state-ok    .sm-state-icon { color: #16a34a; }

/* hourglass spin for loading state */
.sm-state-loading .mud-icon-root {
    animation: sm-spin 1.6s linear infinite;
}

@keyframes sm-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.sm-state-text {
    font-size: 0.88rem;
    color: #425466;
    max-width: 300px;
    line-height: 1.5;
}

/* ── log / code block tweaks ── */
.sm-log-block {
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    margin-top: 4px;
}

/* colored top-border to distinguish modal type */
.sm-log-security { border-top: 3px solid #c2410c; }
.sm-log-issues   { border-top: 3px solid #b45309; }

/* ── device modal width override ── */
.sm-device-modal { width: min(640px, 92vw); }

/* ── glanceable stats row (device modal) ── */
.sm-device-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 14px 20px 0;
    flex-shrink: 0;
}

@media (max-width: 479.98px) {
    .sm-device-stats { grid-template-columns: 1fr 1fr; }
}

.sm-stat-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(2, 42, 70, 0.04);
    border: 1px solid rgba(2, 42, 70, 0.07);
}

.sm-stat-chip-icon {
    display: flex;
    align-items: center;
    color: #4f6b80;
    flex-shrink: 0;
}

.sm-stat-chip-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.sm-stat-chip-label {
    font-size: 0.70rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    color: #4f6b80;
}

.sm-stat-chip-value {
    font-size: 1.1rem;
    font-weight: 720;
    color: #032f4f;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.sm-val-ok   { color: #15803d; }
.sm-val-warn { color: #b45309; }
.sm-val-crit { color: #b91c1c; }

/* ── last-status meta row (device modal) ── */
.sm-device-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 0.83rem;
    color: #425466;
    border-bottom: 1px solid rgba(2, 42, 70, 0.07);
    flex-shrink: 0;
}

.sm-device-meta-icon {
    display: inline-flex;
    align-items: center;
    color: #4f6b80;
}

.sm-device-body { min-height: 80px; }

/* ── status badge (device modal hero) ── */
.sm-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.04rem;
    text-transform: uppercase;
}

.sm-badge-ok      { background: rgba(21, 128, 61, 0.12);  color: #15803d; }
.sm-badge-warn    { background: rgba(180, 83, 9, 0.12);   color: #b45309; }
.sm-badge-offline { background: rgba(0, 0, 0, 0.08);      color: #425466; }

/* ── hero right group (badge + close btn) ── */
.sm-hero-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── issues section label ── */
.sm-section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.055rem;
    color: #032f4f;
    padding: 12px 0 8px;
}

.sm-section-label-icon {
    display: inline-flex;
    align-items: center;
}
