﻿.risks-layout {
    display: grid;
    grid-template-columns: 500px minmax(0, 1fr);
    gap: 16px;
    min-height: 100%;
}

.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(3),
    .risk-table td:nth-child(3),
    .risk-table th:nth-child(4),
    .risk-table td:nth-child(4) {
        width: 52px;
        text-align: center;
    }

    .risk-table th:nth-child(5),
    .risk-table td:nth-child(5) {
        width: 90px;
    }

    .risk-table th:nth-child(6),
    .risk-table td:nth-child(6) {
        width: 170px;
    }

.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-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;
    }
}
