html,
body {
    height: 100%;
    overflow: hidden;
}

body #app {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}

.classdiagram-page .classdiagram-template-select,
.classdiagram-page .classdiagram-source-textarea {
    font-family: Consolas, Monaco, 'Courier New', monospace;
}

.classdiagram-page .flowchart-input-panel .panel-body {
    gap: 6px;
}

.classdiagram-page .classdiagram-workspace {
    height: 100%;
}

.classdiagram-page.structure-container {
    height: calc(100vh - 72px) !important;
    max-height: calc(100vh - 72px) !important;
    overflow: hidden !important;
}

.classdiagram-page .structure-workspace,
.classdiagram-page .structure-input-column,
.classdiagram-page .classdiagram-preview-column,
.classdiagram-page .structure-settings-column {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.classdiagram-page .classdiagram-input-panel,
.classdiagram-page .classdiagram-canvas-panel,
.classdiagram-page .classdiagram-help-panel {
    height: 100%;
    min-height: 100%;
    overflow: hidden;
}

.classdiagram-page .classdiagram-input-panel .panel-body,
.classdiagram-page .classdiagram-help-panel .modern-params-body {
    min-height: 0;
}

.classdiagram-page .classdiagram-input-panel .panel-body {
    overflow-x: hidden;
    overflow-y: auto;
}

.classdiagram-page .classdiagram-template-hint {
    margin-top: 6px;
    color: #64748b;
}

.classdiagram-page .classdiagram-template-picker {
    position: relative;
}

.classdiagram-page .classdiagram-template-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: 40px;
    padding: 8px 12px;
    font-family: "Microsoft YaHei", Arial, sans-serif;
    text-align: left;
}

.classdiagram-page .classdiagram-template-trigger i {
    color: #64748b;
    font-size: 14px;
}

.classdiagram-page .classdiagram-template-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 30;
    overflow: hidden;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
}

.classdiagram-page .classdiagram-template-search-wrap {
    padding: 10px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.classdiagram-page .classdiagram-template-search {
    font-family: "Microsoft YaHei", Arial, sans-serif;
}

.classdiagram-page .classdiagram-template-options {
    max-height: 280px;
    overflow-y: auto;
    padding: 8px 0;
}

.classdiagram-page .classdiagram-template-group {
    padding: 0 8px 8px;
}

.classdiagram-page .classdiagram-template-group:last-child {
    padding-bottom: 0;
}

.classdiagram-page .classdiagram-template-group-label {
    margin: 0 0 6px;
    padding: 0 6px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.classdiagram-page .classdiagram-template-option {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #1e293b;
    font-size: 12px;
    text-align: left;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.classdiagram-page .classdiagram-template-option:hover,
.classdiagram-page .classdiagram-template-option:focus {
    background: #eff6ff;
    color: #1d4ed8;
    outline: none;
}

.classdiagram-page .classdiagram-template-option.is-active {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 700;
}

.classdiagram-page .classdiagram-template-empty {
    padding: 20px 12px;
    color: #64748b;
    font-size: 12px;
    text-align: center;
}

.classdiagram-page .classdiagram-source-group {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.classdiagram-page .classdiagram-source-textarea {
    flex: 1;
    min-height: 0 !important;
    height: auto !important;
}

.classdiagram-preview-shell {
    position: relative;
    height: 100%;
    max-height: none;
    overflow: hidden;
    background: #ffffff;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.classdiagram-preview-shell.is-panning {
    cursor: grabbing;
}

.classdiagram-preview-shell.is-dragging-node {
    cursor: default;
}

#classdiagramPreviewContainer.show-empty .watermark-layer {
    opacity: 0 !important;
    visibility: hidden !important;
}

#classdiagramPreviewContainer:not(.show-empty) .watermark-layer {
    opacity: 1;
    visibility: visible;
}

.classdiagram-svg-viewport {
    position: absolute;
    inset: 0;
    display: none;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.classdiagram-svg-viewport.is-ready {
    display: block;
}

.classdiagram-svg-viewport svg {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    pointer-events: auto;
    will-change: transform;
}

.classdiagram-node {
    cursor: move;
}

#classdiagramWatermarkLayer {
    z-index: 3;
}

.classdiagram-empty-state {
    max-width: 430px;
}

.classdiagram-template-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.classdiagram-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.classdiagram-meta-label {
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
}

.classdiagram-meta-value {
    color: #0f172a;
    font-size: 12px;
    line-height: 1.7;
    word-break: break-word;
}

.classdiagram-preview-column .modern-canvas-body,
.classdiagram-preview-column .canvas-container,
.classdiagram-preview-column .classdiagram-preview-shell {
    height: 100%;
    min-height: 0;
}

.classdiagram-page .classdiagram-export-btn,
.classdiagram-page .classdiagram-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-width: 96px;
    padding: 0 12px;
    height: 30px;
    flex: 0 0 auto;
    white-space: nowrap;
}

.classdiagram-page .classdiagram-export-btn {
    border-color: #10b981;
    background: #10b981;
    color: #fff;
}

.classdiagram-page .classdiagram-export-btn:hover,
.classdiagram-page .classdiagram-export-btn:focus {
    border-color: #059669;
    background: #059669;
    color: #fff;
}

.classdiagram-page .classdiagram-edit-btn {
    border-color: #f59e0b;
    background: #f59e0b;
    color: #fff;
}

.classdiagram-page .classdiagram-edit-btn:hover,
.classdiagram-page .classdiagram-edit-btn:focus {
    border-color: #d97706;
    background: #d97706;
    color: #fff;
}

.classdiagram-page .classdiagram-export-btn span,
.classdiagram-page .classdiagram-edit-btn span {
    font-size: 11px;
    font-weight: 600;
}

.classdiagram-page .classdiagram-input-actions .btn-group {
    flex: 1 1 calc(50% - 6px);
}

@media (max-width: 1680px) {
    .classdiagram-page .flowchart-workspace {
        grid-template-columns: 132px 240px minmax(0, 1fr) 230px;
    }
}

@media (max-width: 1440px) {
    .classdiagram-page .flowchart-workspace {
        grid-template-columns: 120px 225px minmax(0, 1fr) 220px;
    }
}

@media (max-width: 1200px) {
    .classdiagram-page .flowchart-workspace {
        grid-template-columns: 220px minmax(0, 1fr);
        grid-template-areas:
            "tools preview"
            "input preview"
            "settings settings";
    }

    .classdiagram-page .classdiagram-source-textarea {
        height: 420px !important;
        min-height: 420px !important;
    }
}

@media (max-width: 900px) {
    .classdiagram-page .classdiagram-source-textarea {
        height: 360px !important;
        min-height: 360px !important;
    }
}
