/* Embed FDD page — compact iframe shell (no 100vh stretch) */
.embed-shell.embed-shell--fdd {
    min-height: 0;
    height: auto;
    overflow-x: hidden;
}

.embed-shell--fdd .embed-shell-grid {
    position: absolute;
    inset: 0;
}

.embed-fdd-page {
    padding-bottom: 0.35rem;
}

.embed-fdd-page .ops-panel-title {
    margin-bottom: 0.4rem;
    padding-bottom: 0.35rem;
}

.embed-fdd-page .ops-grid .ops-card {
    margin-bottom: 0;
}

/* Compact fault detection hub card */
.embed-fdd-fault-card {
    max-width: 100%;
}

.embed-fdd-fault-card-head {
    margin-bottom: 0.35rem !important;
    padding-bottom: 0 !important;
}

.embed-fdd-fault-card-body {
    grid-template-columns: 1fr auto !important;
    align-items: stretch !important;
    gap: 0.45rem !important;
    padding-top: 0 !important;
}

.embed-fdd-fault-main {
    min-width: 0;
    flex: 1;
}

.embed-fdd-fault-bar-wrap {
    margin-bottom: 0.4rem;
}

.embed-fdd-fault-bar {
    display: flex;
    height: 11px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
}

.embed-fdd-fault-bar-seg {
    height: 100%;
    min-width: 2px;
    transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.embed-fdd-fault-bar-seg--crit {
    background: linear-gradient(90deg, #ef4444, #f87171);
    box-shadow: 0 0 10px rgba(248, 113, 113, 0.45);
}

.embed-fdd-fault-bar-seg--major {
    background: linear-gradient(90deg, #d97706, #fbbf24);
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.35);
}

.embed-fdd-fault-bar-seg--minor {
    background: linear-gradient(90deg, #ea580c, #fb923c);
    box-shadow: 0 0 10px rgba(251, 146, 60, 0.3);
}

.embed-fdd-fault-bar-seg--empty {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
}

.embed-fdd-fault-bar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-top: 0.3rem;
    font-size: 0.58rem;
    font-weight: 600;
    color: #94a3b8;
}

.embed-fdd-fault-bar-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.embed-fdd-fault-bar-legend-item i {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.embed-fdd-fault-bar-legend-item--crit i { background: #f87171; }
.embed-fdd-fault-bar-legend-item--major i { background: #fbbf24; }
.embed-fdd-fault-bar-legend-item--minor i { background: #fb923c; }

.embed-fdd-fault-bar-legend-item--crit { color: #fca5a5; }
.embed-fdd-fault-bar-legend-item--major { color: #fcd34d; }
.embed-fdd-fault-bar-legend-item--minor { color: #fdba74; }

.embed-fdd-fault-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.3rem !important;
    margin-bottom: 0 !important;
}

.embed-fdd-fault-chip {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.28rem !important;
    padding: 0.45rem 0.4rem 0.4rem !important;
    min-height: 3.1rem;
}

.embed-fdd-fault-chip-main {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.35rem;
}

.embed-fdd-fault-chip .ops-fault-num {
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    margin: 0 !important;
}

.embed-fdd-fault-chip .ops-fault-lbl {
    margin-top: 0 !important;
    font-size: 0.55rem !important;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    opacity: 0.82;
    white-space: nowrap;
}

.embed-fdd-fault-chip .embed-fdd-fault-resolved {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.18);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.embed-fdd-fault-chip .embed-fdd-fault-resolved::before {
    content: "\2713";
    font-size: 0.55rem;
    line-height: 1;
    opacity: 0.75;
}

.embed-fdd-fault-chip .embed-fdd-fault-resolved.has-resolved {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.32);
}

.embed-fdd-fault-chip .embed-fdd-fault-resolved.has-resolved::before {
    opacity: 1;
}

.embed-fdd-fault-alert {
    margin-top: 0.4rem !important;
    padding: 0.4rem 0.55rem !important;
    font-size: 0.62rem !important;
}

.embed-fdd-fault-lib-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px;
    align-self: center;
}

.embed-fdd-fault-lib-btn .mud-icon-root {
    font-size: 1.2rem !important;
}

/* Back button + empty states (subset from asset-hub, avoids loading full hub CSS) */
.embed-back-btn {
    color: var(--ops-cyan, #00d4ff) !important;
    text-transform: none !important;
    font-weight: 600 !important;
    font-size: 0.72rem !important;
    letter-spacing: 0.04em;
    padding: 0.15rem 0 !important;
    min-height: unset !important;
}

.embed-empty {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--ops-muted, #94a3b8);
    font-size: 0.75rem;
}

.embed-empty-icon {
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.embed-fdd-page .ops-grid {
    grid-template-columns: 1fr;
    gap: 0.55rem;
}

.embed-fdd-kpis--hub {
    margin-bottom: 0;
    padding: 0 clamp(0.55rem, 2cqw, 0.75rem) clamp(0.55rem, 2cqw, 0.75rem);
    grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
}

.embed-fdd-page .ops-card > .embed-fdd-hub-faults,
.embed-fdd-page .ops-card > .embed-fdd-hub-wo-list,
.embed-fdd-page .ops-card > .ops-loading,
.embed-fdd-page .ops-card > .embed-empty {
    padding: 0 clamp(0.55rem, 2cqw, 0.75rem) clamp(0.55rem, 2cqw, 0.75rem);
}

.embed-fdd-hub-faults {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.15rem 0 0.25rem;
}

.embed-fdd-hub-fault-mix {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: flex-start;
    padding: 0.15rem clamp(0.55rem, 2cqw, 0.75rem) 0.55rem;
}

.embed-fdd-hub-pie-wrap {
    flex: 0 0 148px;
    width: 148px;
    max-width: 100%;
    min-height: 148px;
}

.embed-fdd-hub-pie-captions {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.embed-fdd-hub-pie-caption {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    width: 100%;
    padding: 0.38rem 0.5rem;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.22);
    color: #e2e8f0;
    font-family: inherit;
    font-size: 0.62rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.embed-fdd-hub-pie-caption:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(0, 212, 255, 0.3);
}

.embed-fdd-hub-pie-caption-text {
    flex: 1;
    min-width: 0;
    line-height: 1.35;
    font-weight: 600;
}

.embed-fdd-hub-pie-caption-split {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #64748b;
}

.embed-fdd-hub-pie-caption-meta {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
    font-variant-numeric: tabular-nums;
}

.embed-fdd-hub-pie-caption-meta strong {
    color: #00d4ff;
    font-size: 0.78rem;
}

.embed-fdd-hub-pie-caption-meta span {
    color: #64748b;
    font-size: 0.55rem;
    font-weight: 600;
}

.embed-fdd-hub-pie-caption--crit {
    border-color: rgba(248, 113, 113, 0.22);
}

.embed-fdd-hub-pie-caption--major {
    border-color: rgba(251, 191, 36, 0.2);
}

.embed-fdd-hub-pie-caption--minor {
    border-color: rgba(251, 146, 60, 0.18);
}

.embed-fdd-hub-fault {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.45rem 0.55rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.22);
    color: var(--ops-text, #f1f5f9);
    font-family: inherit;
    font-size: 0.68rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.embed-fdd-hub-fault--crit {
    border-color: rgba(248, 113, 113, 0.28);
    background: linear-gradient(90deg, rgba(248, 113, 113, 0.1), rgba(15, 23, 42, 0.85));
}

.embed-fdd-hub-fault--major {
    border-color: rgba(251, 191, 36, 0.26);
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.08), rgba(15, 23, 42, 0.85));
}

.embed-fdd-hub-fault--minor {
    border-color: rgba(251, 146, 60, 0.24);
    background: linear-gradient(90deg, rgba(251, 146, 60, 0.07), rgba(15, 23, 42, 0.85));
}

.embed-fdd-hub-fault-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    line-height: 1.3;
}

.embed-fdd-hub-fault-count {
    flex-shrink: 0;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--ops-cyan, #00d4ff);
    font-variant-numeric: tabular-nums;
}

.embed-fdd-hub-fault:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.embed-fdd-hub-fault--crit:hover:not(:disabled) {
    border-color: rgba(248, 113, 113, 0.45);
    box-shadow: 0 4px 16px rgba(248, 113, 113, 0.12);
}

.embed-fdd-hub-fault--major:hover:not(:disabled) {
    border-color: rgba(251, 191, 36, 0.45);
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.12);
}

.embed-fdd-hub-fault--minor:hover:not(:disabled) {
    border-color: rgba(251, 146, 60, 0.45);
    box-shadow: 0 4px 16px rgba(251, 146, 60, 0.12);
}

.embed-fdd-hub-fault:active:not(:disabled) {
    transform: scale(0.98);
}

.embed-fdd-hub-wo-list {
    max-height: none;
}

.embed-fdd-hub-wo-list .ops-wo-card:last-child {
    margin-bottom: 0;
}

.embed-fdd--display-only button,
.embed-fdd--display-only .embed-fdd-lib-card {
    pointer-events: none;
    cursor: default;
}

.embed-fdd--display-only button:disabled {
    opacity: 1;
}

/* Embed FDD dashboard — dark theme aligned with Operations embed */
.embed-fdd {
    width: 100%;
}

.embed-fdd-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
    margin-bottom: 0.65rem;
}

.embed-fdd-kpi {
    text-align: center;
    padding: 0.5rem 0.35rem;
    border-radius: 10px;
    border: 1px solid rgba(0, 212, 255, 0.12);
    background: rgba(0, 0, 0, 0.22);
}

.embed-fdd-kpi strong {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    color: var(--ops-cyan, #00d4ff);
}

.embed-fdd-kpi span {
    font-size: 0.52rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ops-muted, #94a3b8);
}

.embed-fdd-panel {
    border-radius: 12px;
    border: 1px solid rgba(0, 212, 255, 0.14);
    background: linear-gradient(165deg, rgba(20, 27, 45, 0.92), rgba(7, 11, 18, 0.96));
    margin-bottom: 0.55rem;
    overflow: hidden;
}

.embed-fdd-panel-head {
    padding: 0.45rem 0.65rem;
    font-size: 0.58rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #f472b6;
    background: rgba(244, 114, 182, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.embed-fdd-panel-body {
    padding: 0.65rem;
}

.embed-fdd-fault-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
    min-width: 0;
}

.embed-fdd-fault-mix-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: flex-start;
}

.embed-fdd-donut-wrap {
    flex: 0 0 160px;
    max-width: 180px;
    min-width: 140px;
}

.embed-fdd-cause-chart {
    margin-bottom: 0.65rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.embed-fdd-fault-line {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.55rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.62rem;
    line-height: 1.35;
    color: #cbd5e1;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.embed-fdd-fault-line:hover {
    background: rgba(0, 212, 255, 0.06);
    border-color: rgba(0, 212, 255, 0.2);
}

.embed-fdd-fault-line--on {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.35);
    font-weight: 700;
    color: #f1f5f9;
}

.embed-fdd-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 3px;
}

.embed-fdd-defect-primary {
    font-size: clamp(0.78rem, 3cqw, 0.92rem);
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.35;
    margin-bottom: 0.35rem;
}

.embed-fdd-defect-meta {
    font-size: 0.58rem;
    color: #94a3b8;
    line-height: 1.45;
}

.embed-fdd-defect-rec {
    margin-top: 0.45rem;
    padding: 0.45rem 0.55rem;
    border-left: 3px solid #059669;
    border-radius: 0 8px 8px 0;
    background: rgba(5, 150, 105, 0.08);
    font-size: 0.6rem;
    color: #a7f3d0;
    line-height: 1.45;
}

.embed-fdd-dist-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
}

@media (min-width: 520px) {
    .embed-fdd-dist-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.embed-fdd-dist-block {
    border-radius: 10px;
    padding: 0.5rem 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
}

.embed-fdd-dist-title {
    font-size: 0.52rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}

.embed-fdd-dist-title--asset { color: #38bdf8; }
.embed-fdd-dist-title--cause { color: #fb7185; }
.embed-fdd-dist-title--remedy { color: #34d399; }

.embed-fdd-dist-row {
    margin-bottom: 0.45rem;
}

.embed-fdd-dist-row:last-child {
    margin-bottom: 0;
}

.embed-fdd-dist-label {
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
    font-size: 0.55rem;
    color: #cbd5e1;
    line-height: 1.3;
    margin-bottom: 0.2rem;
}

.embed-fdd-dist-badge {
    flex-shrink: 0;
    font-weight: 800;
    color: #94a3b8;
}

.embed-fdd-dist-bar-wrap {
    height: 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.15);
    overflow: hidden;
}

.embed-fdd-dist-bar {
    height: 100%;
    border-radius: 999px;
    min-width: 4px;
}

.embed-fdd-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid rgba(0, 212, 255, 0.1);
}

.embed-fdd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.58rem;
}

.embed-fdd-table th {
    text-align: left;
    padding: 0.45rem 0.55rem;
    font-size: 0.52rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7dd3fc;
    background: rgba(0, 212, 255, 0.06);
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
}

.embed-fdd-table td {
    padding: 0.45rem 0.55rem;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: top;
}

.embed-fdd-rec-group {
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.embed-fdd-rec-group:last-child {
    border-bottom: none;
}

.embed-fdd-rec-title {
    font-size: 0.62rem;
    font-weight: 700;
    color: #fcd34d;
    margin-bottom: 0.25rem;
}

.embed-fdd-rec-steps {
    margin: 0;
    padding-left: 1rem;
    font-size: 0.58rem;
    color: #94a3b8;
    line-height: 1.45;
}

.embed-fdd-wo-section {
    margin-top: 0.55rem;
}

.embed-fdd-wo-section-head {
    font-size: 0.58rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ops-muted, #94a3b8);
    margin-bottom: 0.4rem;
}
