.insights-page {
    min-height: 100vh;
}

.insights-content {
    width: min(100%, 1200px);
    margin: 0 auto;
}

.insights-header {
    margin-bottom: 28px;
}

.insights-workspace {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    align-items: start;
    gap: 24px;
}

.insights-sidebar {
    align-self: start;
}

.insights-scope-control {
    display: grid;
    gap: 8px;
}

.insights-scope-control > label {
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: var(--weight-semibold);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.insights-scope-control .ui-dropdown,
.insights-scope-control .ui-select {
    width: 100%;
}

.insights-scope-control > p {
    margin: 0;
    color: color-mix(in srgb, var(--text-muted) 68%, transparent);
    font-size: 10px;
    line-height: 1.45;
}

.insights-scope-control > p strong {
    color: var(--text-muted);
    font-weight: var(--weight-semibold);
}

.insights-workspace-content {
    min-width: 0;
}

.insights-section-content.insights-section-content:not(.is-active) {
    display: none;
}

.insights-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.insights-summary-card {
    position: relative;
    overflow: hidden;
    min-height: 132px;
    padding: 18px;
    background:
        radial-gradient(circle at 100% 0%, rgba(255, 255, 255, .045), transparent 48%),
        var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .025);
}

.insights-summary-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--insight-color), transparent 82%);
    opacity: .9;
}

.insights-summary-card.is-reviewed { --insight-color: var(--review); }
.insights-summary-card.is-outcome { --insight-color: var(--success); }
.insights-summary-card.is-quality { --insight-color: #A9C56F; }
.insights-summary-card.is-time { --insight-color: var(--accent); }

.insights-summary-card > strong {
    display: block;
    margin: 15px 0 8px;
    color: var(--text-bright);
    font-size: 27px;
    line-height: 1;
    letter-spacing: -.035em;
}

.insights-summary-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.45;
}

.insights-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    padding-bottom: 48px;
}

@media (max-width: 860px) {
    .insights-workspace {
        grid-template-columns: 1fr;
    }

    .insights-sidebar {
        position: static;
    }

}

.insights-panel {
    min-width: 0;
    padding: 22px 24px 24px;
    background: var(--bg-card);
    border-radius: 18px;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .025);
}

.insights-lifecycle-panel,
.insights-looking-back-panel {
    display: flex;
    flex-direction: column;
}

.insights-panel-heading {
    margin-bottom: 23px;
}

.insights-panel-heading .ui-panel-title {
    margin: 0 0 7px;
}

.insights-panel-heading .ui-helper-sm {
    max-width: 760px;
}

.insights-lifecycle-list {
    flex: 1;
    display: grid;
    align-content: space-between;
    gap: 16px;
    padding-bottom: 11px;
}

.insights-lifecycle-row {
    --stage-color: var(--text-muted);
    display: grid;
    gap: 7px;
}

.insights-lifecycle-row.stage-pending { --stage-color: var(--accent); }
.insights-lifecycle-row.stage-decided { --stage-color: var(--success); }
.insights-lifecycle-row.stage-reviewed { --stage-color: var(--review); }

.insights-lifecycle-row > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 11px;
}

.insights-lifecycle-row strong {
    color: var(--text-primary);
}

.insights-horizontal-track {
    overflow: hidden;
    height: 7px;
    background: var(--surface-subtle);
    border-radius: 999px;
}

.insights-horizontal-track > span {
    display: block;
    height: 100%;
    background: var(--stage-color);
    border-radius: inherit;
    box-shadow: 0 0 12px color-mix(in srgb, var(--stage-color) 30%, transparent);
}

.insights-outcome-chart,
.insights-confidence-chart,
.insights-activity-chart {
    display: grid;
    align-items: end;
    min-height: 205px;
}

.insights-outcome-chart,
.insights-confidence-chart {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.insights-outcome-column,
.insights-confidence-column,
.insights-activity-column {
    display: grid;
    justify-items: center;
    align-items: end;
    gap: 8px;
    min-width: 0;
    height: 100%;
}

.insights-outcome-column { --outcome-color: var(--text-muted); }
.insights-outcome-column.outcome-1 { --outcome-color: var(--danger); }
.insights-outcome-column.outcome-2 { --outcome-color: #D99A57; }
.insights-outcome-column.outcome-3 { --outcome-color: var(--review); }
.insights-outcome-column.outcome-4 { --outcome-color: #A9C56F; }
.insights-outcome-column.outcome-5 { --outcome-color: var(--success); }

.insights-outcome-column strong,
.insights-confidence-column strong {
    color: var(--text-primary);
    font-size: 12px;
}

.insights-vertical-track,
.insights-confidence-track {
    position: relative;
    overflow: hidden;
    width: 24px;
    height: 112px;
    background: var(--surface-subtle);
    border-radius: 8px 8px 5px 5px;
}

.insights-vertical-track > span,
.insights-confidence-track > span {
    position: absolute;
    inset: auto 0 0;
    min-height: 4px;
    background: var(--outcome-color);
    border-radius: inherit;
}

.insights-outcome-column small,
.insights-confidence-column small {
    min-height: 30px;
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.35;
    text-align: center;
}

.insights-confidence-column {
    --confidence-color: var(--accent);
}

.insights-confidence-column.confidence-1 { --confidence-color: #D99A57; }
.insights-confidence-column.confidence-2 { --confidence-color: #D2B45F; }
.insights-confidence-column.confidence-3 { --confidence-color: #A9C56F; }
.insights-confidence-column.confidence-4 { --confidence-color: #78C78E; }
.insights-confidence-column.confidence-5 { --confidence-color: var(--success); }

.insights-confidence-track > span {
    background: var(--confidence-color);
}

.insights-confidence-column em {
    color: var(--text-subtle);
    font-size: 10px;
    font-style: normal;
}

.insights-activity-chart {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 7px;
}

.insights-activity-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: -9px 0 15px;
}

.insights-activity-legend span {
    --legend-color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 10px;
}

.insights-activity-legend span::before {
    width: 7px;
    height: 7px;
    background: var(--legend-color);
    border-radius: 50%;
    content: "";
}

.insights-activity-legend .stage-created { --legend-color: var(--accent); }
.insights-activity-legend .stage-decided { --legend-color: var(--success); }
.insights-activity-legend .stage-reviewed { --legend-color: var(--review); }

.insights-activity-column {
    position: relative;
    outline: none;
}

.insights-activity-bar {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 100%;
    max-width: 18px;
    height: 125px;
    background: var(--surface-subtle);
    border-radius: 6px 6px 3px 3px;
}

.insights-activity-bar > span {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    transition: filter 160ms ease;
}

.insights-activity-bar .stage-created { background: var(--accent); }
.insights-activity-bar .stage-decided { background: var(--success); }
.insights-activity-bar .stage-reviewed { background: var(--review); }

.insights-activity-column:hover .insights-activity-bar > span,
.insights-activity-column:focus-visible .insights-activity-bar > span { filter: brightness(1.15); }

.insights-activity-tooltip {
    position: absolute;
    z-index: 4;
    left: 50%;
    bottom: calc(100% - 17px);
    width: max-content;
    min-width: 142px;
    padding: 10px 11px;
    background: var(--bg-elevated);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 5px);
    transition: opacity 150ms ease, transform 150ms ease;
}

.insights-activity-column:first-child .insights-activity-tooltip { left: 0; transform: translate(0, 5px); }
.insights-activity-column:last-child .insights-activity-tooltip { right: 0; left: auto; transform: translate(0, 5px); }
.insights-activity-column:hover .insights-activity-tooltip,
.insights-activity-column:focus-visible .insights-activity-tooltip { opacity: 1; transform: translate(-50%, 0); }
.insights-activity-column:first-child:hover .insights-activity-tooltip,
.insights-activity-column:first-child:focus-visible .insights-activity-tooltip,
.insights-activity-column:last-child:hover .insights-activity-tooltip,
.insights-activity-column:last-child:focus-visible .insights-activity-tooltip { transform: translate(0, 0); }

.insights-activity-tooltip > strong {
    display: block;
    margin-bottom: 7px;
    color: var(--text-bright);
    font-size: 10px;
}

.insights-activity-tooltip > span {
    display: grid;
    grid-template-columns: 7px 1fr auto;
    align-items: center;
    gap: 7px;
    color: var(--text-secondary);
    font-size: 10px;
}

.insights-activity-tooltip i {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
}

.insights-activity-tooltip i.stage-created { background: var(--accent); }
.insights-activity-tooltip i.stage-decided { background: var(--success); }
.insights-activity-tooltip i.stage-reviewed { background: var(--review); }
.insights-activity-tooltip b { color: var(--text-primary); }

.insights-activity-column small {
    color: var(--text-muted);
    font-size: 10px;
}

.insights-looking-back-chart {
    flex: 1;
    display: grid;
    align-content: space-between;
    gap: 18px;
    padding: 13px 0 21px;
}

.insights-looking-back-row {
    --choice-color: var(--text-muted);
    display: grid;
    gap: 9px;
    color: var(--text-secondary);
    font-size: 11px;
}

.insights-looking-back-row.choice-same { --choice-color: var(--success); }
.insights-looking-back-row.choice-unsure { --choice-color: var(--review); }
.insights-looking-back-row.choice-different { --choice-color: var(--danger); }

.insights-looking-back-row-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.insights-looking-back-row-heading > span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.insights-looking-back-row i {
    width: 8px;
    height: 8px;
    background: var(--choice-color);
    border-radius: 50%;
    box-shadow: 0 0 10px color-mix(in srgb, var(--choice-color) 28%, transparent);
}

.insights-looking-back-row strong {
    color: var(--text-primary);
    font-size: 11px;
}

.insights-looking-back-row small {
    margin-left: 5px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
}

.insights-looking-back-bar {
    overflow: hidden;
    display: block;
    height: 10px;
    background: var(--surface-subtle);
    border-radius: 999px;
}

.insights-looking-back-bar > span {
    display: block;
    height: 100%;
    background: var(--choice-color);
    border-radius: inherit;
    box-shadow: 0 0 12px color-mix(in srgb, var(--choice-color) 28%, transparent);
    transition: filter 160ms ease;
}

.insights-looking-back-row:hover .insights-looking-back-bar > span {
    filter: brightness(1.14);
}

.insights-looking-back-empty {
    margin: 45px 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
}

.insights-category-panel {
    grid-column: 1 / -1;
}

.insights-category-table {
    display: grid;
    gap: 4px;
}

.insights-category-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) repeat(3, 110px);
    align-items: center;
    min-height: 42px;
    padding: 0 14px;
    background: var(--surface-subtle);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 11px;
}

.insights-category-row.is-heading {
    min-height: 30px;
    background: transparent;
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.insights-category-row strong {
    overflow: hidden;
    color: var(--text-primary);
    font-weight: var(--weight-semibold);
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .insights-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .insights-dashboard-grid { grid-template-columns: 1fr; }
    .insights-category-panel { grid-column: auto; }
    .insights-category-row { grid-template-columns: minmax(120px, 1fr) repeat(3, 70px); }
}

@media (max-width: 620px) {
    .insights-summary-grid { grid-template-columns: 1fr; }
    .insights-panel { padding: 20px 16px; }
    .insights-outcome-chart,
    .insights-confidence-chart { gap: 5px; }
    .insights-category-table { overflow-x: auto; }
    .insights-category-row { min-width: 520px; }
}

/* CONFIDENCE + OUTCOME MATRIX — Individual reviewed decisions and their average path. */
.insights-confidence-panel {
    position: relative;
    grid-column: 1 / -1;
    overflow: hidden;
}

.insights-confidence-panel .insights-panel-heading {
    margin-bottom: 12px;
}

.insights-confidence-chart,
.insights-category-panel {
    display: none;
}

.insights-matrix-wrap {
    position: relative;
    width: 100%;
}

.insights-matrix {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.insights-matrix-cell {
    fill: var(--review);
    fill-opacity: var(--cell-opacity);
}

.insights-average-line {
    fill: none;
    stroke: rgba(225, 232, 242, .38);
    stroke-width: 2;
    stroke-dasharray: 5 7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.insights-decision-point {
    --point-color: var(--review);
    fill: var(--point-color);
    stroke: color-mix(in srgb, var(--point-color) 45%, #fff);
    stroke-width: 1.5;
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--point-color) 35%, transparent));
    cursor: default;
    transform-box: fill-box;
    transform-origin: center;
    transition: transform var(--transition-fast), filter var(--transition-fast), stroke-width var(--transition-fast);
}

.insights-decision-point.outcome-1 { --point-color: var(--danger); }
.insights-decision-point.outcome-2 { --point-color: #D99A57; }
.insights-decision-point.outcome-3 { --point-color: var(--review); }
.insights-decision-point.outcome-4 { --point-color: #A9C56F; }
.insights-decision-point.outcome-5 { --point-color: var(--success); }

.insights-decision-point:hover,
.insights-decision-point:focus-visible {
    stroke-width: 2.5;
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--point-color) 70%, transparent));
    outline: none;
    transform: scale(1.55);
}

.insights-matrix-x-label,
.insights-matrix-y-label,
.insights-matrix-axis-title {
    fill: var(--text-muted);
    font-family: inherit;
}

.insights-matrix-x-label {
    font-size: 10px;
    text-anchor: middle;
}

.insights-matrix-y-label {
    font-size: 10px;
    text-anchor: end;
}

.insights-matrix-axis-title {
    fill: var(--text-secondary);
    font-size: 10px;
    font-weight: var(--weight-semibold);
    letter-spacing: .1em;
    text-anchor: middle;
    text-transform: uppercase;
}

.insights-matrix-axis-title.axis-confidence {
    fill: color-mix(in srgb, var(--success) 82%, var(--text-secondary));
}

.insights-matrix-axis-title.axis-outcome {
    fill: color-mix(in srgb, var(--review) 84%, var(--text-secondary));
}

.insights-matrix-tooltip {
    position: absolute;
    z-index: 4;
    display: grid;
    gap: 6px;
    width: 208px;
    padding: 12px 14px;
    background: #151A22;
    border-radius: 11px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .055);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -100%) translateY(-7px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.insights-matrix-tooltip.is-visible {
    opacity: 1;
    transform: translate(-50%, -100%) translateY(-11px);
}

.insights-matrix-tooltip strong {
    overflow: hidden;
    color: var(--text-bright);
    font-size: 11px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.insights-matrix-tooltip span {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 10px;
}

.insights-matrix-tooltip b {
    color: var(--text-muted);
    font-weight: var(--weight-medium);
}

.insights-matrix-tooltip small {
    color: var(--text-subtle);
    font-size: 10px;
}

.insights-matrix-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 22px;
    margin-top: -7px;
    color: var(--text-muted);
    font-size: 10px;
}

.insights-matrix-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.insights-matrix-legend i {
    display: inline-block;
    flex: 0 0 auto;
}

.insights-matrix-legend .legend-point {
    width: 8px;
    height: 8px;
    background: var(--review);
    border-radius: 50%;
    box-shadow: 0 0 6px color-mix(in srgb, var(--review) 45%, transparent);
}

.insights-matrix-legend .legend-line {
    width: 22px;
    height: 0;
    border-top: 2px dashed rgba(225, 232, 242, .45);
}

@media (max-width: 620px) {
    .insights-matrix-wrap { overflow-x: auto; }
    .insights-matrix { min-width: 720px; }
}

/* DECISION JOURNEYS — Elapsed-time paths through creation, decision, review, and archive. */
.insights-journey-panel {
    position: relative;
    grid-column: 1 / -1;
    overflow: hidden;
}

.insights-journey-controls {
    display: flex;
    align-items: end;
    gap: 12px;
    margin: 0 0 17px;
}

.insights-journey-controls label {
    display: grid;
    gap: 6px;
}

.insights-journey-controls label > span {
    color: var(--text-muted);
    font-size: 10px;
}

.insights-journey-controls .ui-select {
    width: 164px;
}

.insights-journey-count {
    margin: 0 0 9px auto;
    color: var(--text-subtle);
    font-size: 10px;
}

.insights-journey-axis {
    position: relative;
    height: 25px;
    margin: 0 64px 5px 226px;
    color: var(--text-subtle);
    font-size: 10px;
}

.insights-journey-axis::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .035));
}

.insights-journey-axis span {
    position: absolute;
    bottom: 6px;
    transform: translateX(-50%);
    white-space: nowrap;
}

.insights-journey-axis span:first-child { transform: none; }
.insights-journey-axis span:last-child { transform: translateX(-100%); }

.insights-journey-scroll {
    overflow: visible;
}

.insights-journey-scroll.is-expanded {
    max-height: 1400px;
    overflow-y: auto;
    padding-right: 7px;
}

.insights-journey-list {
    display: grid;
    gap: 6px;
}

.insights-journey-row {
    display: grid;
    grid-template-columns: 210px minmax(300px, 1fr) 52px;
    align-items: center;
    gap: 16px;
    min-height: 48px;
    padding: 4px 5px 4px 10px;
    border-radius: 11px;
    transition: background var(--transition-fast);
}

.insights-journey-row:hover {
    background: rgba(255, 255, 255, .022);
}

.insights-journey-identity {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.insights-journey-identity strong {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 10px;
    font-weight: var(--weight-semibold);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.insights-journey-identity span {
    color: var(--text-subtle);
    font-size: 10px;
}

.insights-journey-track {
    position: relative;
    height: 24px;
}

.insights-journey-guide,
.insights-journey-segment {
    position: absolute;
    top: 11px;
    left: 0;
    height: 2px;
    border-radius: 999px;
}

.insights-journey-guide {
    width: 100%;
    background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 3px, transparent 3px 8px);
}

.insights-journey-segment {
    z-index: 1;
    background: var(--accent);
    box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 18%, transparent);
}

.insights-journey-segment.stage-decided {
    background: var(--success);
    box-shadow: 0 0 8px color-mix(in srgb, var(--success) 18%, transparent);
}

.insights-journey-segment.stage-reviewed {
    background: var(--review);
    box-shadow: 0 0 8px color-mix(in srgb, var(--review) 18%, transparent);
}

.insights-journey-node {
    --journey-color: var(--accent);
    position: absolute;
    z-index: 2;
    top: 50%;
    width: 9px;
    height: 9px;
    padding: 0;
    background: var(--journey-color);
    border: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--journey-color) 12%, var(--bg-card)), 0 0 9px color-mix(in srgb, var(--journey-color) 36%, transparent);
    cursor: default;
    transform: translate(-50%, -50%);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.insights-journey-node.stage-decided { --journey-color: var(--success); }
.insights-journey-node.stage-reviewed { --journey-color: var(--review); }
.insights-journey-node.stage-archived { --journey-color: var(--text-muted); }

.insights-journey-node.stage-created {
    width: 8px;
    height: 8px;
}

.insights-journey-node.is-latest:not(.stage-created) {
    width: 11px;
    height: 11px;
}

.insights-journey-node:hover,
.insights-journey-node:focus-visible {
    outline: none;
    transform: translate(-50%, -50%) scale(1.5);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--journey-color) 16%, var(--bg-card)), 0 0 14px color-mix(in srgb, var(--journey-color) 62%, transparent);
}

.insights-journey-open-marker {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    border: 1px dashed rgba(255, 255, 255, .14);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.insights-journey-duration {
    color: var(--text-muted);
    font-size: 10px;
    text-align: right;
    white-space: nowrap;
}

.insights-journey-tooltip {
    position: absolute;
    z-index: 6;
    display: grid;
    gap: 6px;
    width: 208px;
    padding: 12px 14px;
    background: #151A22;
    border-radius: 11px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .055);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -100%) translateY(-7px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.insights-journey-tooltip.is-visible {
    opacity: 1;
    transform: translate(-50%, -100%) translateY(-11px);
}

.insights-journey-tooltip strong {
    overflow: hidden;
    color: var(--text-bright);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.insights-journey-tooltip span {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 10px;
}

.insights-journey-tooltip b {
    color: var(--text-muted);
    font-weight: var(--weight-medium);
}

.insights-journey-tooltip small {
    color: var(--text-subtle);
    font-size: 10px;
}

.insights-journey-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 22px;
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 10px;
}

.insights-journey-expand {
    display: block;
    min-width: 120px;
    margin: 18px auto 0;
}

.insights-journey-empty {
    display: grid;
    min-height: 150px;
    place-items: center;
    color: var(--text-muted);
    font-size: 11px;
    text-align: center;
}

.insights-journey-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.insights-journey-legend i {
    display: inline-block;
    flex: 0 0 auto;
}

.insights-journey-legend .legend-time {
    width: 21px;
    border-top: 2px dashed rgba(255, 255, 255, .18);
}

.insights-journey-legend .journey-stage-key {
    gap: 4px;
}

.journey-stage-key i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.journey-stage-key .stage-created { background: var(--accent); }
.journey-stage-key .stage-decided { background: var(--success); }
.journey-stage-key .stage-reviewed { background: var(--review); }
.journey-stage-key .stage-archived { background: var(--text-muted); margin-right: 4px; }

@media (max-width: 760px) {
    .insights-journey-controls { align-items: stretch; flex-direction: column; }
    .insights-journey-controls .ui-select { width: 100%; }
    .insights-journey-count { margin: 0; }
    .insights-journey-axis { margin-left: 146px; }
    .insights-journey-row { grid-template-columns: 130px minmax(300px, 1fr) 48px; }
    .insights-journey-scroll { overflow-x: auto; }
    .insights-journey-list { min-width: 710px; }
}

/* DECISION CALIBRATION — Confidence and decision quality, colored by outcome. */
.insights-calibration-panel {
    position: relative;
    grid-column: 1 / -1;
    overflow: hidden;
}

.insights-calibration-panel .insights-panel-heading {
    margin-bottom: 12px;
}

.insights-calibration-wrap {
    position: relative;
    width: 100%;
}

.insights-calibration {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.insights-calibration-region {
    stroke: rgba(255, 255, 255, .025);
    stroke-width: 1;
}

.insights-calibration-region.region-upper-left { fill: rgba(102, 200, 154, .055); }
.insights-calibration-region.region-upper-right { fill: rgba(102, 200, 154, .09); }
.insights-calibration-region.region-lower-left { fill: rgba(255, 255, 255, .018); }
.insights-calibration-region.region-lower-right { fill: rgba(217, 154, 87, .045); }

.insights-calibration-midline {
    stroke: rgba(221, 229, 240, .12);
    stroke-width: 1;
    stroke-dasharray: 4 7;
}

.insights-calibration-region-label {
    fill: rgba(199, 209, 222, .45);
    font-family: inherit;
    font-size: 10px;
    font-weight: var(--weight-semibold);
    letter-spacing: .06em;
    text-transform: uppercase;
}

.insights-calibration-region-label.is-right {
    text-anchor: end;
}

.insights-calibration-point {
    --point-color: var(--review);
    fill: var(--point-color);
    stroke: color-mix(in srgb, var(--point-color) 45%, #fff);
    stroke-width: 1.5;
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--point-color) 35%, transparent));
    cursor: default;
    transform-box: fill-box;
    transform-origin: center;
    transition: transform var(--transition-fast), filter var(--transition-fast), stroke-width var(--transition-fast);
}

.insights-calibration-point.outcome-1 { --point-color: var(--danger); }
.insights-calibration-point.outcome-2 { --point-color: #D99A57; }
.insights-calibration-point.outcome-3 { --point-color: var(--review); }
.insights-calibration-point.outcome-4 { --point-color: #A9C56F; }
.insights-calibration-point.outcome-5 { --point-color: var(--success); }

.insights-calibration-point:hover,
.insights-calibration-point:focus-visible {
    stroke-width: 2.5;
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--point-color) 70%, transparent));
    outline: none;
    transform: scale(1.55);
}

.insights-calibration-x-label,
.insights-calibration-y-label,
.insights-calibration-axis-title {
    fill: var(--text-muted);
    font-family: inherit;
}

.insights-calibration-x-label {
    font-size: 10px;
    text-anchor: middle;
}

.insights-calibration-y-label {
    font-size: 10px;
    text-anchor: end;
}

.insights-calibration-axis-title {
    font-size: 10px;
    font-weight: var(--weight-semibold);
    letter-spacing: .1em;
    text-anchor: middle;
    text-transform: uppercase;
}

.insights-calibration-axis-title.axis-confidence {
    fill: color-mix(in srgb, var(--success) 82%, var(--text-secondary));
}

.insights-calibration-axis-title.axis-quality {
    fill: color-mix(in srgb, var(--review) 84%, var(--text-secondary));
}

.insights-calibration-tooltip {
    position: absolute;
    z-index: 6;
    display: grid;
    gap: 6px;
    width: 218px;
    padding: 12px 14px;
    background: #151A22;
    border-radius: 11px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .055);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -100%) translateY(-7px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.insights-calibration-tooltip.is-visible {
    opacity: 1;
    transform: translate(-50%, -100%) translateY(-11px);
}

.insights-calibration-tooltip strong {
    overflow: hidden;
    color: var(--text-bright);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.insights-calibration-tooltip span {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 10px;
}

.insights-calibration-tooltip b {
    color: var(--text-muted);
    font-weight: var(--weight-medium);
}

.insights-calibration-tooltip small {
    color: var(--text-subtle);
    font-size: 10px;
}

.insights-calibration-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 22px;
    margin-top: -7px;
    color: var(--text-muted);
    font-size: 10px;
}

.insights-calibration-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.insights-calibration-legend i {
    display: inline-block;
    flex: 0 0 auto;
}

.insights-calibration-legend .legend-point,
.calibration-outcome-key i {
    width: 8px;
    height: 8px;
    background: var(--review);
    border-radius: 50%;
}

.calibration-outcome-key { gap: 4px !important; }
.calibration-outcome-key i.outcome-1 { background: var(--danger); }
.calibration-outcome-key i.outcome-2 { background: #D99A57; }
.calibration-outcome-key i.outcome-3 { background: var(--review); }
.calibration-outcome-key i.outcome-4 { background: #A9C56F; }
.calibration-outcome-key i.outcome-5 { background: var(--success); margin-right: 4px; }

@media (max-width: 620px) {
    .insights-calibration-wrap { overflow-x: auto; }
    .insights-calibration { min-width: 720px; }
}

/* OUTCOME FLOW — Confidence to outcome to the choice a user would make now. */
.insights-flow-panel {
    position: relative;
    grid-column: 1 / -1;
    order: -1;
    overflow: hidden;
}

.insights-flow-panel .insights-panel-heading {
    margin-bottom: 10px;
}

.insights-flow-wrap {
    position: relative;
    width: 100%;
}

.insights-flow {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.insights-flow-stage-title {
    fill: var(--text-secondary);
    font-family: inherit;
    font-size: 10px;
    font-weight: var(--weight-semibold);
    letter-spacing: .08em;
    text-anchor: middle;
    text-transform: uppercase;
}

.insights-flow-stage-title.stage-confidence { fill: color-mix(in srgb, var(--success) 82%, var(--text-secondary)); }
.insights-flow-stage-title.stage-outcome { fill: color-mix(in srgb, var(--review) 84%, var(--text-secondary)); }
.insights-flow-stage-title.stage-chooseAgain { fill: var(--text-secondary); }

.insights-flow-link {
    fill: none;
    stroke: rgba(139, 124, 255, .22);
    stroke-width: var(--flow-width);
    stroke-linecap: butt;
    cursor: default;
    opacity: .72;
    outline: none;
    transition:
        opacity 180ms ease,
        stroke 180ms ease,
        filter 180ms ease;
}

.insights-flow-link.stage-outcome.target-1 { stroke: color-mix(in srgb, var(--danger) 48%, transparent); }
.insights-flow-link.stage-outcome.target-2 { stroke: rgba(217, 154, 87, .34); }
.insights-flow-link.stage-outcome.target-3 { stroke: rgba(139, 124, 255, .30); }
.insights-flow-link.stage-outcome.target-4 { stroke: rgba(169, 197, 111, .32); }
.insights-flow-link.stage-outcome.target-5 { stroke: color-mix(in srgb, var(--success) 43%, transparent); }
.insights-flow-link.stage-chooseAgain { stroke: rgba(191, 201, 215, .20); }
.insights-flow-link.stage-chooseAgain.target-different { stroke: rgba(211, 111, 111, .28); }
.insights-flow-link.stage-chooseAgain.target-same { stroke: rgba(102, 200, 154, .28); }

.insights-flow-wrap.has-active-flow .insights-flow-link,
.insights-flow-wrap.has-active-flow .insights-flow-node-group {
    opacity: .15;
}

.insights-flow-wrap.has-active-flow .insights-flow-link.is-active,
.insights-flow-wrap.has-active-flow .insights-flow-node-group.is-active {
    opacity: 1;
}

.insights-flow-node-group {
    cursor: default;
    outline: none;
    opacity: 1;
    transition: opacity var(--transition-fast);
}

.insights-flow-node-group {
    --node-color: var(--text-muted);
}

.insights-flow-node {
    fill: var(--node-color);
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--node-color) 28%, transparent));
}

.insights-flow-node-group.stage-confidence.node-1 { --node-color: #D99A57; }
.insights-flow-node-group.stage-confidence.node-2 { --node-color: #D2B45F; }
.insights-flow-node-group.stage-confidence.node-3 { --node-color: #A9C56F; }
.insights-flow-node-group.stage-confidence.node-4 { --node-color: #78C78E; }
.insights-flow-node-group.stage-confidence.node-5 { --node-color: var(--success); }
.insights-flow-node-group.stage-outcome.node-1 { --node-color: var(--danger); }
.insights-flow-node-group.stage-outcome.node-2 { --node-color: #D99A57; }
.insights-flow-node-group.stage-outcome.node-3 { --node-color: var(--review); }
.insights-flow-node-group.stage-outcome.node-4 { --node-color: #A9C56F; }
.insights-flow-node-group.stage-outcome.node-5 { --node-color: var(--success); }
.insights-flow-node-group.stage-chooseAgain.node-different { --node-color: var(--danger); }
.insights-flow-node-group.stage-chooseAgain.node-unsure { --node-color: var(--review); }
.insights-flow-node-group.stage-chooseAgain.node-same { --node-color: var(--success); }

.insights-flow-node-label,
.insights-flow-node-count {
    fill: var(--text-muted);
    font-family: inherit;
    font-size: 10px;
    text-anchor: end;
}

.insights-flow-node-label {
    font-size: 10px;
}

.insights-flow-node-label.is-right,
.insights-flow-node-count.is-right {
    text-anchor: start;
}

.insights-flow-node-count {
    fill: var(--text-bright);
    font-size: 10px;
    font-weight: var(--weight-semibold);
    text-anchor: middle;
}

.insights-flow-count-bubble {
    fill: var(--node-color);
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--node-color) 30%, transparent));
}

.insights-flow-node-group:hover .insights-flow-node-label,
.insights-flow-node-group:focus-visible .insights-flow-node-label {
    fill: var(--text-primary);
}

.insights-flow-tooltip {
    position: absolute;
    z-index: 8;
    display: grid;
    gap: 7px;
    width: 238px;
    padding: 13px 15px;
    background: #151A22;
    border-radius: 11px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .055);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -100%) translateY(-7px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.insights-flow-tooltip.is-visible {
    opacity: 1;
    transform: translate(-50%, -100%) translateY(-11px);
}

.insights-flow-tooltip > strong {
    overflow: hidden;
    color: var(--text-bright);
    font-size: 11px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.insights-flow-tooltip > span {
    color: var(--text-secondary);
    font-size: 10px;
}

.insights-flow-tooltip-decisions {
    display: grid;
    gap: 4px;
    padding-top: 3px;
}

.insights-flow-tooltip-decisions small {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.insights-flow-tooltip-decisions small::before {
    content: "•";
    margin-right: 6px;
    color: var(--text-subtle);
}

.insights-flow-tooltip-decisions small.is-more {
    color: var(--text-subtle);
    font-style: italic;
}

.insights-flow-tooltip-decisions small.is-more::before { content: ""; margin: 0; }

.insights-flow-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: -5px;
    color: var(--text-muted);
    font-size: 10px;
}

.insights-flow-legend i {
    display: inline-block;
    width: 25px;
    height: 5px;
    background: rgba(139, 124, 255, .3);
    border-radius: 999px;
}

.insights-flow-empty {
    display: grid;
    min-height: 220px;
    place-items: center;
    color: var(--text-muted);
    font-size: 11px;
    text-align: center;
}

@media (max-width: 620px) {
    .insights-flow-wrap { overflow-x: auto; }
    .insights-flow { min-width: 760px; }
}
