/*
 * Reusable threat-domain component styling.
 * Threat components render in light DOM and should not depend on RiskManagement.css.
 */

threats-page,
threats-panel {
    display: block;
    width: 100%;
}

threats-panel > .threats-page-workspace {
    display: grid;
    gap: 14px;
    padding: 14px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    box-sizing: border-box;
}

threats-panel threat-table-panel {
    min-height: 0;
    --threats-table-scroll-height: auto;
}

threats-panel threat-table-panel .data-table-scroll[data-layout-mode="fill"] {
    height: var(--threats-table-scroll-height, auto);
    max-height: var(--threats-table-scroll-height, none);
}

threat-editor-panel {
    display: block;
    width: 100%;
}

threat-editor-panel .field-stack {
    display: grid;
    gap: 6px;
}

threat-editor-panel textarea {
    min-height: 96px;
}

threat-editor-panel .hint {
    color: #64748b;
    font-size: 0.82rem;
}

threat-editor-panel .actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

threat-editor-panel .editor-shell {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    box-sizing: border-box;
}

threat-editor-panel .field-grid {
    display: grid;
    gap: 12px;
}

threat-editor-panel .field-row {
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
    gap: 12px;
}

threat-editor-panel .section-title {
    font-weight: 800;
    font-size: 0.95rem;
    color: #0f172a;
}

threat-editor-panel label {
    font-weight: 700;
    font-size: 0.85rem;
    color: #0f172a;
}

threat-editor-panel .checkbox-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

threat-editor-panel ui-checkbox {
    min-width: 0;
}

threat-editor-panel cso-disclosure-panel {
    display: block;
}

threat-editor-panel .section-copy,
threat-editor-panel .collection-empty,
threat-editor-panel .collection-empty-cell {
    color: #64748b;
    font-size: 0.88rem;
    line-height: 1.45;
}

threat-editor-panel .platform-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

threat-editor-panel ui-checkbox.platform-option {
    min-width: 0;
}

threat-editor-panel ui-checkbox.platform-option .checkbox-control-card {
    min-height: 44px;
}

threat-editor-panel ui-checkbox.platform-option[data-custom="true"] {
    --cso-control-bg: rgba(2, 140, 186, 0.05);
    --cso-control-bg-hover: rgba(2, 140, 186, 0.1);
    --cso-border: rgba(2, 140, 186, 0.2);
    --cso-checkbox-action-size: 20px;
    --cso-checkbox-action-font-size: 0.8rem;
}

threat-editor-panel .custom-platform-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

threat-editor-panel .collection-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

threat-editor-panel .collection-table-shell,
threat-editor-panel .controls-table {
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 14px;
    background: #ffffff;
    overflow: hidden;
}

threat-editor-panel .collection-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

threat-editor-panel .collection-table th,
threat-editor-panel .collection-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    text-align: left;
    vertical-align: top;
    font-size: 0.88rem;
    color: #0f172a;
}

threat-editor-panel .collection-table th {
    background: #edf6fb;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

threat-editor-panel .collection-table tbody tr:last-child td {
    border-bottom: none;
}

threat-editor-panel .collection-table tbody tr {
    cursor: pointer;
}

threat-editor-panel .collection-table tbody tr:hover {
    background: rgba(2, 140, 186, 0.06);
}

threat-editor-panel .collection-table tbody tr.is-selected {
    background: rgba(2, 140, 186, 0.12);
}

threat-editor-panel .collection-table-footer .data-table-panel-footer {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

threat-editor-panel .collection-empty-cell {
    text-align: center;
    padding: 18px 12px;
}

threat-editor-panel .inline-editor-shell {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    background: #f8fafc;
}

threat-editor-panel .editor-inline-error {
    color: #b91c1c;
    font-size: 0.88rem;
    font-weight: 700;
}

@media (max-width: 760px) {
    threat-editor-panel .field-row,
    threat-editor-panel .custom-platform-row {
        grid-template-columns: minmax(0, 1fr);
    }
}
