.risks-layout {
    display: grid;
    grid-template-columns: 500px minmax(0, 1fr);
    gap: 16px;
    min-height: 100%;
}

.risk-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.risk-toolbar-topline {
    align-items: center;
    flex-wrap: nowrap;
    margin-bottom: 10px;
}

.risk-header-inline {
    margin-bottom: 0;
}

.risk-toolbar > :first-child {
    flex: 1 1 320px;
    min-width: 0;
}

.risk-toolbar .action-create-btn {
    flex: 0 0 auto;
    align-self: flex-start;
}

.risk-toolbar-topline .action-create-btn {
    align-self: center;
}

.risk-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(96px, 1fr));
    gap: 10px;
}

.risk-kpi-card {
    min-width: 96px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.65);
    border: 1px solid rgba(72, 113, 159, 0.12);
}

.risk-kpi-label {
    display: block;
    margin-bottom: 4px;
    color: var(--text-soft);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.risk-kpi-value {
    color: var(--surface-dark);
    font-size: 1.3rem;
    font-weight: 800;
}

.form-required-marker {
    color: #d64545;
    font-weight: 800;
}

.action-create-btn-neutral,
.action-submit-btn-neutral {
    background: linear-gradient(135deg, rgba(128, 134, 145, 0.96), rgba(167, 173, 184, 0.96));
    color: #fff;
}

.risk-matrix-card,
.risk-table-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.risk-matrix-shell {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
    min-height: 0;
    flex: 1;
}

.risk-y-axis-title {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--surface-dark);
    font-size: 0.94rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.risk-chart-area {
    display: grid;
    grid-template-rows: minmax(0, 1fr) 22px;
    gap: 8px;
    min-height: 0;
}

.risk-plot-column {
    display: inline-grid;
    grid-template-rows: auto 20px;
    gap: 6px;
    width: fit-content;
}

.risk-axis-bottom {
    width: 360px;
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-soft);
    align-items: center;
}

    .risk-axis-bottom span {
        justify-self: center;
    }

.risk-chart-row {
    display: grid;
    grid-template-columns: 26px auto;
    gap: 6px;
    min-height: 0;
    align-items: start;
}

.risk-axis-left {
    height: 360px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-soft);
    padding: 2px 0;
}

.risk-plot-wrapper {
    width: 360px;
    height: 360px;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 0;
    align-self: start;
    justify-self: start;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255,255,255,0.66);
    border: 1px solid rgba(72, 113, 159, 0.14);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}

.risk-plot {
    width: 100%;
    height: 100%;
    display: block;
}

.risk-grid-lines line {
    stroke: rgba(53, 55, 71, 0.22);
    stroke-width: 0.35;
    vector-effect: non-scaling-stroke;
}

.risk-border {
    fill: none;
    stroke: rgba(53, 55, 71, 0.38);
    stroke-width: 0.55;
    vector-effect: non-scaling-stroke;
}

.risk-point-group {
    pointer-events: all;
}

.risk-point-circle {
    fill: rgba(53, 55, 71, 0.95);
    stroke: rgba(255,255,255,0.96);
    stroke-width: 0.35;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.12));
}

.risk-point-text {
    fill: #ffffff;
    font-size: 2.6px;
    font-weight: 800;
    letter-spacing: 0;
    dominant-baseline: middle;
    pointer-events: none;
}

.risk-x-axis-title {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--surface-dark);
    font-size: 0.94rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.risk-table-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.risk-table-wrapper {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border-radius: 16px;
    border: 1px solid rgba(72, 113, 159, 0.12);
    background: rgba(255,255,255,0.55);
}

.risk-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.88rem;
}

    .risk-table thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(241,244,248,0.96));
        color: var(--surface-dark);
        font-weight: 800;
        text-align: left;
        padding: 10px;
        border-bottom: 1px solid rgba(72, 113, 159, 0.16);
        white-space: nowrap;
    }

    .risk-table tbody td {
        padding: 9px 10px;
        border-bottom: 1px solid rgba(72, 113, 159, 0.10);
        color: var(--text);
        vertical-align: top;
        word-break: break-word;
    }

    .risk-table tbody tr:hover {
        background: rgba(130, 208, 213, 0.08);
    }

    .risk-table th:nth-child(1),
    .risk-table td:nth-child(1) {
        width: 54px;
        text-align: center;
    }

    .risk-table th:nth-child(2),
    .risk-table td:nth-child(2) {
        width: 110px;
    }

    .risk-table th:nth-child(4),
    .risk-table td:nth-child(4),
    .risk-table th:nth-child(5),
    .risk-table td:nth-child(5) {
        width: 52px;
        text-align: center;
    }

    .risk-table th:nth-child(6),
    .risk-table td:nth-child(6) {
        width: 124px;
    }

    .risk-table th:nth-child(7),
    .risk-table td:nth-child(7) {
        width: 90px;
    }

    .risk-table th:nth-child(8),
    .risk-table td:nth-child(8) {
        width: 160px;
    }

    .risk-table th:nth-child(9),
    .risk-table td:nth-child(9) {
        width: 128px;
    }

    .risk-table td:nth-child(9) {
        text-align: right;
        vertical-align: middle;
    }

.risk-action-row {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: nowrap;
    width: 100%;
}

.risk-action-row .action-inline-form {
    margin: 0;
    display: inline-flex;
    align-items: center;
}

.risk-table-empty {
    text-align: center;
    color: var(--text-soft);
    padding: 20px;
}

@media (max-width: 1280px) {
    .risks-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .risk-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .risk-toolbar-topline {
        flex-wrap: wrap;
    }

    .risk-kpi-row {
        grid-template-columns: repeat(4, minmax(84px, 1fr));
        gap: 8px;
    }

    .risk-kpi-card {
        min-width: 84px;
        padding: 10px;
    }

    .risk-kpi-label {
        font-size: 0.6rem;
    }

    .risk-kpi-value {
        font-size: 1.08rem;
    }

    .risk-matrix-shell {
        grid-template-columns: 20px minmax(0, 1fr);
        gap: 6px;
    }

    .risk-chart-row {
        grid-template-columns: 22px auto;
        gap: 4px;
    }

    .risk-plot-wrapper,
    .risk-axis-bottom {
        width: 280px;
        height: 280px;
        max-width: 100%;
    }

    .risk-axis-bottom,
    .risk-axis-left {
        font-size: 0.7rem;
    }

    .risk-axis-left {
        height: 280px;
    }

    .risk-point-text {
        font-size: 3px;
    }

    .risk-table {
        font-size: 0.8rem;
    }
}

.risk-table .action-status-badge {
    font-size: 0.58rem;
    padding: 4px 8px;
    min-width: 82px;
    white-space: nowrap;
}
