.psychro-chart-page {
    margin-left: calc(50% - 49vw);
    margin-right: calc(50% - 49vw);
    width: 98vw;
}

.chart-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    width: 100%;
}

.chart-surface {
    background: #fff;
    flex: 0 1 auto;
    margin: 0 auto;
    overflow: hidden;
    order: 1;
    padding: 16px;
    position: relative;
    min-width: 0;
    z-index: 1;
}

.chart-canvas {
    min-width: 0;
    overflow: auto;
    width: fit-content;
}

.chart-canvas svg {
    display: block;
    max-width: 100%;
}

.chart-side-panel {
    background: #fff !important;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
    color: #222 !important;
    flex: 0 0 320px;
    font-size: 12px;
    line-height: 1.4;
    max-height: calc(100vh - 120px);
    opacity: 1;
    order: 2;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 10px;
    position: relative;
    width: 320px;
    word-break: break-word;
    z-index: 10;
}

.chart-side-panel *,
.chart-side-panel label,
.chart-side-panel strong {
    color: inherit;
}

.chart-file-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chart-altitude-control {
    display: grid;
    gap: 3px;
}

.chart-altitude-control input {
    font-size: 12px;
    padding: 2px 4px;
    width: 90px;
}

.chart-point-data-controls {
    display: grid;
    gap: 2px;
    grid-template-columns: 1fr 1fr;
}

.chart-point-data-controls label {
    margin: 0;
}

.chart-ai-panel input,
.chart-ai-panel textarea {
    background: #fff !important;
    color: #222 !important;
    font-size: 12px;
    margin: 4px 0;
    width: 100%;
}

.chart-ai-panel textarea {
    resize: vertical;
}

.chart-ai-status {
    color: #555;
    font-size: 11px;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.chart-ai-candidate {
    border-top: 1px solid #ddd;
    margin-top: 6px;
    padding-top: 6px;
    overflow-wrap: anywhere;
}

.chart-ai-candidate-title {
    font-weight: 600;
}

.chart-ai-candidate-detail {
    color: #555;
    font-size: 11px;
}

.chart-ai-candidate-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.chart-ai-candidates {
    max-height: 260px;
    overflow-y: auto;
}

.ai-candidate-edge {
    pointer-events: none;
    stroke: purple;
    stroke-dasharray: 6 4;
    stroke-width: 2px;
}

.ai-candidate-point {
    fill: rgba(128, 0, 128, 0.2);
    pointer-events: none;
    stroke: purple;
    stroke-width: 2px;
}

.ai-candidate-label {
    fill: purple;
    font-size: 11px;
    pointer-events: none;
    stroke: none;
}

#import_chart_input {
    display: none;
}

.chart-side-panel hr {
    margin: 6px 0;
}

.legend-line {
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
    width: 24px;
}

.legend-rh {
    border-top: 2px solid #000;
}

.legend-twb {
    border-top: 2px solid green;
}

.legend-h {
    border-top: 2px solid red;
}

.legend-edge {
    border-top: 2px solid blue;
}

.axis-label,
.chart-family-label,
.chart-line-label {
    cursor: move;
    fill: #9a9a9a;
    font-size: 12px;
    stroke: none;
}

.label,
.edge-label,
.annotation-label {
    cursor: move;
    fill: #000;
    font-size: 12px;
    stroke: none;
}

.point-data-tuple {
    fill: #555;
    font-size: 10px;
    stroke: none;
}

.chart-title {
    cursor: pointer;
    fill: #4a4a4a;
    font-size: 20px;
    font-weight: 600;
}

.chart-title-background {
    fill: #fff;
    pointer-events: none;
    stroke: #4a4a4a;
    stroke-width: 1.25px;
}

.chart .tick line,
.chart .domain {
    stroke: #d6d6d6;
}

.chart .tick text,
.axis-label {
    fill: #9a9a9a;
}

.axis-label {
    cursor: default;
}

.annotation-arrow {
    cursor: move;
    pointer-events: stroke;
    stroke-dasharray: 4 3;
    stroke-linecap: round;
    stroke-width: 1.5;
}

.annotation-attachment-flash {
    fill: none;
    pointer-events: none;
    stroke: orange;
    stroke-width: 3px;
    stroke-dasharray: none;
}

.family-label-connector,
.chart-label-connector {
    stroke: #b8b8b8;
    stroke-width: 1.25px;
}

.label-background {
    fill: rgba(255, 255, 255, 0.8);
    pointer-events: none;
    stroke: #b8b8b8;
    stroke-width: 1px;
}

.borderless-label-background {
    stroke: none;
}

.axis-label-background {
    fill: rgba(255, 255, 255, 1);
    pointer-events: none;
    stroke: #fff;
    stroke-width: 1px;
}

#annotation_text {
    min-width: 260px;
}

@media (max-width: 1100px) {
    .chart-layout {
        flex-direction: column;
    }

    .chart-side-panel {
        flex: 0 0 auto;
        max-height: none;
        width: 100%;
    }
}

@media print {
    @page {
        margin: 6mm;
        size: A4 landscape;
    }

    nav,
    .navbar,
    .chart-side-panel,
    .chart-file-controls,
    .modal {
        display: none !important;
    }

    html,
    body {
        background: #fff !important;
        height: auto;
        margin: 0;
        overflow: hidden;
        padding: 0;
    }

    body {
        padding-top: 0 !important;
    }

    body > .container {
        max-width: none !important;
        padding: 0 !important;
        width: 100% !important;
    }

    body > .container > .row {
        display: none !important;
    }

    .container-fluid,
    .psychro-chart-page,
    .chart-layout,
    .chart-surface {
        margin: 0;
        padding: 0;
        width: 100%;
    }

    .chart-layout,
    .chart-surface {
        display: block;
        overflow: visible;
    }

    .chart-canvas {
        overflow: visible;
    }

    svg {
        display: block;
        height: 198mm !important;
        max-height: none;
        max-width: none;
        object-fit: contain;
        page-break-inside: avoid;
        width: 285mm !important;
    }
}
