.sd {
    display: grid;
    grid-template-columns: minmax(340px, 520px) minmax(320px, 1fr);
    gap: 16px;
    align-items: start;
    width: 100%;
    min-height: 0;
    color: #1f2933;
    font-size: 13px;
}

.sd.sd-studio {
    display: block;
}

.sd-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.sd-toolbar-space {
    flex: 1 1 auto;
}

.sd-menu {
    position: relative;
}

.sd button.is-on {
    background: #e8eef5;
}

.sd-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 6;
    width: 260px;
    background: #fff;
    border: 1px solid #d9e0e7;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(20, 32, 51, 0.16);
    padding: 8px;
}

.sd-popover-wide {
    width: 380px;
}

.sd button.sd-menu-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    background: #fff;
    color: #1b365d;
    border-color: transparent;
    text-align: left;
    padding: 7px 8px;
}

.sd button.sd-menu-item span {
    color: #52606d;
    font-size: 12px;
    font-weight: 400;
}

.sd button.sd-menu-item:hover {
    background: #f4f7fb;
}

.sd-stage {
    position: relative;
    display: flex;
    justify-content: center;
    background: #e6ebf1;
    border-radius: 10px;
    padding: 28px 24px;
    min-height: 280px;
}

.sd-stage.has-inspector {
    padding-right: 336px;
}

.sd-artboard {
    position: relative;
    box-sizing: content-box;
    box-shadow: 0 10px 30px rgba(20, 32, 51, 0.14);
    padding: 18px 0 18px 22px;
    min-height: 120px;
}

.sd-empty {
    min-width: 420px;
    max-width: 100%;
}

.sd-canvas-block {
    position: relative;
    margin: 0 0 2px;
}

.sd-canvas-block:hover {
    outline: 1px dashed #93b4e8;
    outline-offset: 3px;
}

.sd-canvas-block.is-selected,
.sd-canvas-block.is-selected:hover {
    outline: 1px solid #2563eb;
    outline-offset: 3px;
}

.sd-grip {
    position: absolute;
    left: -18px;
    top: 1px;
    color: #94a3b8;
    cursor: grab;
    letter-spacing: -2px;
    user-select: none;
}

.sd-canvas-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    min-height: 22px;
    margin-bottom: 3px;
}

.sd-canvas-piece {
    padding: 0 3px;
    border-radius: 2px;
    cursor: pointer;
}

.sd-canvas-piece:hover {
    outline: 1px dashed #93b4e8;
    outline-offset: 2px;
}

.sd-canvas-piece.is-selected {
    outline: 1px solid #2563eb;
    outline-offset: 2px;
}

.sd-canvas-split {
    display: flex;
    gap: 14px;
    align-items: center;
}

.sd-canvas-stack {
    flex: 1 1 auto;
    min-width: 0;
}

.sd-canvas-logo {
    flex: 0 0 auto;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sd-canvas-logo img {
    display: block;
    max-width: 100%;
    height: auto;
    border: 0;
}

.sd-canvas-logo:has(span),
.sd-canvas-html {
    border: 1px dashed #c5d0db;
    background: #f8fafc;
    color: #6b7280;
    font-size: 11px;
    padding: 8px;
}

.sd-canvas-banner {
    width: 100%;
}

.sd-canvas-bar {
    padding: 8px 12px;
    margin-bottom: 6px;
}

.sd-canvas-icon {
    display: inline-block;
    height: auto;
    border: 0;
    vertical-align: middle;
}

.sd-canvas-sep {
    padding: 0 6px;
}

.sd-canvas-divider {
    border-top: 1px solid #d9e0e7;
    margin: 8px 0;
    height: 1px;
}

.sd-canvas-spacer {
    background: repeating-linear-gradient(90deg, #e5e7eb, #e5e7eb 6px, transparent 6px, transparent 10px);
    background-position: center;
    background-size: auto 1px;
    background-repeat: repeat-x;
}

.sd-canvas-button {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 4px;
    font-weight: 700;
}

.sd-canvas-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.sd-canvas-text {
    white-space: pre-wrap;
}

.sd-inspector {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 300px;
    max-height: calc(100% - 24px);
    overflow: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(20, 32, 51, 0.18);
    padding: 12px;
    z-index: 5;
}

.sd-inspector-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.sd-html-drawer {
    margin-top: 12px;
    background: #fff;
    border: 1px solid #d9e0e7;
    border-radius: 8px;
    padding: 12px;
}

.sd-panel,
.sd-preview {
    background: #fff;
    border: 1px solid #d9e0e7;
    border-radius: 8px;
    padding: 12px;
}

.sd-preview {
    position: sticky;
    top: 8px;
}

.sd h2 {
    margin: 0 0 8px;
    font-size: 15px;
    color: #1b365d;
}

.sd h3 {
    margin: 14px 0 6px;
    font-size: 13px;
    color: #1b365d;
}

.sd p.sd-note {
    margin: 0 0 10px;
    color: #52606d;
    line-height: 1.4;
}

.sd-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.sd label.sd-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1 1 120px;
    min-width: 110px;
    font-size: 12px;
    color: #52606d;
}

.sd input[type="text"],
.sd input[type="number"],
.sd input[type="url"],
.sd select,
.sd textarea {
    width: 100%;
    border: 1px solid #c5d0db;
    border-radius: 4px;
    padding: 6px 8px;
    font: inherit;
    color: #1f2933;
    background: #fff;
}

.sd textarea {
    min-height: 72px;
    resize: vertical;
}

.sd-step {
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e4e9ee;
}

.sd-step:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.sd-layouts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.sd button.sd-layout {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    background: #fff;
    color: #1b365d;
    border: 1px solid #c5d2e3;
    border-radius: 6px;
    padding: 8px 10px;
    text-align: left;
}

.sd button.sd-layout strong {
    font-size: 13px;
}

.sd button.sd-layout span {
    color: #52606d;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.35;
}

.sd button.sd-layout:hover {
    border-color: #1b365d;
    background: #f4f7fb;
}

.sd-replace-row {
    align-items: flex-end;
}

.sd-palette {
    display: grid;
    grid-template-columns: 92px 42px minmax(110px, 1fr);
    gap: 6px 8px;
    align-items: center;
    margin-bottom: 10px;
}

.sd-palette span {
    color: #52606d;
}

.sd-color-choice {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.sd-color-choice select,
.sd-color-choice input[type="text"] {
    width: auto;
    min-width: 140px;
}

.sd-html {
    margin-top: 10px;
}

.sd-html summary {
    cursor: pointer;
    color: #1b365d;
    font-weight: 600;
}

.sd-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sd-colors label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #52606d;
}

.sd input[type="color"] {
    width: 36px;
    height: 28px;
    padding: 0;
    border: 1px solid #c5d0db;
    background: #fff;
}

.sd-blocks {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0;
}

.sd-block {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    border: 1px solid #d9e0e7;
    background: #f7f9fb;
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
}

.sd-block.is-selected {
    border-color: #1b365d;
    background: #e8eef5;
}

.sd-actions,
.sd-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.sd button {
    border: 1px solid #1b365d;
    background: #1b365d;
    color: #fff;
    border-radius: 4px;
    padding: 5px 9px;
    font: inherit;
    cursor: pointer;
}

.sd button.sd-quiet {
    background: #fff;
    color: #1b365d;
}

.sd button:disabled {
    opacity: 0.5;
    cursor: default;
}

.sd-token {
    background: #eef3f8;
    color: #1b365d;
    border: 1px solid #c5d2e3;
}

.sd-preview-frame {
    width: 100%;
    min-height: 420px;
    border: 1px solid #e4e9ee;
    background: #f4f6f8;
    border-radius: 4px;
}

.sd-source {
    width: 100%;
    min-height: 120px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
}

.sd-error {
    background: #fdecec;
    color: #8a1f1f;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 8px;
}

.sd-line {
    display: grid;
    grid-template-columns: 1fr 1.4fr 90px auto auto;
    gap: 6px;
    margin-bottom: 6px;
    align-items: center;
}

.sd-line-editor {
    margin-top: 8px;
}

.sd-part {
    border: 1px solid #d9e0e7;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
    background: #f7f9fb;
}

.sd-part.is-selected {
    border-color: #1b365d;
    background: #fff;
}

.sd-part-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
    font-weight: 600;
}

.sd-part-head .sd-actions {
    margin: 0;
}

.sd-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #52606d;
}

@media (max-width: 980px) {
    .sd {
        grid-template-columns: 1fr;
    }

    .sd-stage.has-inspector {
        padding-right: 24px;
        flex-direction: column;
        align-items: center;
    }

    .sd-inspector {
        position: static;
        width: min(100%, 420px);
        max-height: none;
        margin-top: 12px;
    }

    .sd-empty {
        min-width: 0;
    }

    .sd-preview {
        position: static;
    }

    .sd-line {
        grid-template-columns: 1fr;
    }
}
