:root {
    --bg: #f4f5f1;
    --panel: #ffffff;
    --ink: #151515;
    --muted: #686866;
    --line: #dddcd4;
    --accent: #0f766e;
    --danger: #b42318;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--ink);
    margin: 0;
}

button,
a {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    text-decoration: none;
}

.admin-shell {
    margin: 0 auto;
    max-width: 1320px;
    padding: 24px;
}

.admin-header,
.builder,
.login-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.admin-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 18px;
}

.admin-header p,
.hint,
.save-state {
    color: var(--muted);
    margin: 0;
}

.admin-header h1,
.builder h2 {
    margin: 0;
}

.admin-actions {
    align-items: center;
    display: flex;
    gap: 10px;
}

.admin-actions a,
.admin-actions button,
.builder-tools button,
.builder-toolbar button,
.section-actions button,
.login-panel button {
    background: var(--accent);
    color: #fff;
    padding: 11px 14px;
}

.builder {
    display: grid;
    gap: 0;
    grid-template-columns: 230px minmax(0, 1fr) 320px;
    min-height: 680px;
    overflow: hidden;
}

.builder-tools,
.section-editor,
.builder-canvas {
    padding: 18px;
}

.builder-tools,
.section-editor {
    background: #fbfbf8;
}

.builder-tools {
    border-right: 1px solid var(--line);
    display: grid;
    align-content: start;
    gap: 10px;
    max-height: calc(100vh - 150px);
    overflow: auto;
}

.section-editor {
    border-left: 1px solid var(--line);
}

.builder-toolbar {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-list {
    display: grid;
    gap: 12px;
}

.section-item {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.section-item[draggable="true"] {
    cursor: grab;
}

.section-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.section-item.drag-over {
    border-color: var(--accent);
}

.section-top {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.drag-handle {
    background: #ecefeb;
    color: var(--muted);
    cursor: grab;
    flex: 0 0 auto;
    padding: 9px 10px;
    touch-action: none;
}

.section-title {
    flex: 1;
    min-width: 0;
}

.section-item.dragging {
    opacity: 0.72;
}

.section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.section-actions button {
    min-width: 38px;
    padding: 7px 9px;
}

.section-actions .remove {
    background: var(--danger);
}

.preset-list {
    display: grid;
    gap: 10px;
}

.preset-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    padding: 12px;
}

.preset-card p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
}

.preset-card button {
    background: var(--accent);
    color: #fff;
    padding: 9px 10px;
}

.preset-preview-modal[hidden] {
    display: none;
}

.preset-preview-modal {
    align-items: center;
    background: rgba(0, 0, 0, 0.42);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 22px;
    position: fixed;
    z-index: 40;
}

.preset-preview-dialog {
    background: #fff;
    border-radius: 8px;
    max-height: 88vh;
    max-width: 860px;
    overflow: auto;
    width: 100%;
}

.preset-preview-header,
.preset-preview-footer {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
}

.preset-preview-header {
    border-bottom: 1px solid var(--line);
}

.preset-preview-header p {
    color: var(--muted);
    margin: 0;
}

.preset-preview-body {
    background: #f7f7f3;
    display: grid;
    gap: 10px;
    padding: 16px;
}

.preview-section {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 6px;
    min-height: 64px;
    padding: 14px;
}

.preview-section.slider {
    min-height: 170px;
}

.preview-section span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.preset-preview-footer {
    border-top: 1px solid var(--line);
}

.preset-preview-footer button,
.preset-preview-header button {
    background: var(--accent);
    color: #fff;
    padding: 10px 12px;
}

.field {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
}

.field label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.field input,
.login-panel input {
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    padding: 11px;
    width: 100%;
}

.login-panel {
    display: grid;
    gap: 18px;
    margin: 12vh auto 0;
    max-width: 420px;
    padding: 24px;
}

.login-panel form {
    display: grid;
    gap: 14px;
}

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

    .builder-tools,
    .section-editor {
        border: 0;
        border-bottom: 1px solid var(--line);
    }
}
