.spdf-editor {
    width: min(1400px, calc(100% - 32px));
    margin: 50px auto;
    font-family: Arial, Helvetica, sans-serif;
    color: #111827;
}

.spdf-editor__header {
    margin-bottom: 32px;
    text-align: center;
}

.spdf-editor__header h1 {
    margin: 0 0 12px;
    font-size: clamp(38px, 6vw, 58px);
    line-height: 1.1;
}

.spdf-editor__header p {
    margin: 0;
    color: #6b7280;
    font-size: 18px;
}

.spdf-editor-upload {
    max-width: 900px;
    margin: 0 auto;
    padding: 75px 24px;
    border: 3px dashed #c4b5fd;
    border-radius: 22px;
    background: #f5f3ff;
    text-align: center;
    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}

.spdf-editor-upload.is-dragging {
    border-color: #6d28d9;
    background: #ede9fe;
}

.spdf-editor-upload p {
    margin: 18px 0 0;
    color: #6b7280;
}

.spdf-editor-button,
.spdf-editor-tool {
    padding: 14px 20px;
    border: 0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.spdf-editor-button {
    background: #6d28d9;
    color: #ffffff;
}

.spdf-editor-button:hover {
    background: #5b21b6;
}

.spdf-editor-tool {
    border: 1px solid #ddd6fe;
    background: #ffffff;
    color: #4c1d95;
}

.spdf-editor-tool:hover,
.spdf-editor-tool.is-active {
    border-color: #6d28d9;
    background: #f5f3ff;
}

.spdf-editor-tool--danger {
    border-color: #fecaca;
    color: #dc2626;
}

.spdf-editor-tool:disabled,
.spdf-editor-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.spdf-editor-workspace {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    min-height: 700px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 12px 35px rgba(31, 41, 55, 0.1);
}

.spdf-editor-toolbar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px;
    border-right: 1px solid #e5e7eb;
    background: #fafafa;
}

.spdf-editor-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: #4b5563;
    font-size: 14px;
    font-weight: 700;
}

.spdf-editor-field input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

.spdf-editor-field input[type="color"] {
    width: 100%;
    height: 44px;
    padding: 4px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
}

.spdf-editor-document {
    min-width: 0;
    padding: 26px;
    overflow: auto;
    background: #e5e7eb;
}

.spdf-editor-status {
    margin-bottom: 18px;
    color: #4c1d95;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
}

.spdf-editor-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.spdf-editor-page {
    position: relative;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    background: #ffffff;
}

.spdf-editor-page canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.spdf-editor-overlay {
    position: absolute;
    inset: 0;
    overflow: hidden;
    cursor: crosshair;
}

.spdf-editor-text {
    position: absolute;
    min-width: 30px;
    padding: 3px 5px;
    border: 1px dashed transparent;
    line-height: 1.2;
    white-space: nowrap;
    cursor: move;
    user-select: none;
}

.spdf-editor-text:hover {
    border-color: #8b5cf6;
}

.spdf-editor-text.is-selected {
    border: 1px solid #6d28d9;
    background: rgba(245, 243, 255, 0.75);
}

.spdf-editor-text input {
    min-width: 80px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

@media (max-width: 850px) {
    .spdf-editor-workspace {
        grid-template-columns: 1fr;
    }

    .spdf-editor-toolbar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        border-right: 0;
        border-bottom: 1px solid #e5e7eb;
    }
}

@media (max-width: 550px) {
    .spdf-editor {
        width: min(100% - 16px, 1400px);
    }

    .spdf-editor-toolbar {
        grid-template-columns: 1fr;
    }

    .spdf-editor-document {
        padding: 12px;
    }
}

.spdf-editor-text--editable {
    box-sizing: border-box;
    padding: 1px 3px;
    border: 1px solid transparent;
    background: transparent;
    line-height: 1.05;
    white-space: pre;
    cursor: text;
}

.spdf-editor-text--editable:hover {
    border-color: rgba(109, 40, 217, 0.45);
    background: rgba(255, 255, 255, 0.28);
}

.spdf-editor-text--editable.is-selected {
    z-index: 20;
    border: 1px solid #6d28d9;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 2px rgba(109, 40, 217, 0.12);
}

.spdf-editor-text__content {
    display: inline-block;
    min-width: 10px;
    min-height: 1em;
    outline: none;
    white-space: pre;
}

.spdf-editor-text__move {
    display: none;
    position: absolute;
    top: -25px;
    left: -1px;
    width: 25px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 5px 5px 0 0;
    background: #6d28d9;
    color: #ffffff;
    font-size: 14px;
    cursor: move;
    touch-action: none;
}

.spdf-editor-text.is-selected .spdf-editor-text__move {
    display: grid;
    place-items: center;
}

.spdf-editor-text.is-moving {
    opacity: 0.75;
}

.spdf-editor-overlay {
    cursor: default;
}

.spdf-editor-tool.is-active + * {
    position: relative;
}