
.editor-page {
    height: calc(100dvh - var(--header-h));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 10px 16px;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(201, 163, 106, .14), transparent 55%),
        linear-gradient(180deg, var(--sand-50), var(--sand-100));
}

.editor-container {
    flex: 1 1 auto;
    min-height: 0;
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.editor-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.editor-back {
    font-size: .78rem;
    font-weight: 600;
    color: var(--ink-soft);
    padding: 6px 12px;
    border-radius: 999px;
    transition: color .2s, background .2s;
}
.editor-back:hover { color: var(--wine-700); background: var(--sand-100); }

.editor-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    width: 130px;
    border: none;
    border-radius: 999px;
    background: var(--wine-700);
    color: var(--sand-50);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: .82rem;
    cursor: pointer;
    transition: background .2s, transform .2s;
}
.editor-next:hover { background: var(--wine-800); transform: translateY(-1px); }

.editor-stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 4px;  
    margin-bottom: 25px;
}

.phone {
    margin-top: 30px;
    position: relative;
    height: 100%;
    max-height: 100%;
    aspect-ratio: 10 / 17;
    max-width: 100%;
    background: #1d1015;
    border-radius: 40px;
    padding: 10px;
    box-shadow:
        0 40px 80px -30px rgba(62, 15, 28, .45),
        0 0 0 5px rgba(62, 15, 28, .06),
        inset 0 0 0 1px rgba(255, 255, 255, .04);
}

.phone::before,
.phone::after {
    content: "";
    position: absolute;
    width: 3px;
    background: #2a151c;
    border-radius: 2px;
}
.phone::before { left: -3px; top: 18%; height: 40px; }
.phone::after  { right: -3px; top: 26%; height: 60px; }

.phone-notch {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 18px;
    background: #1d1015;
    border-radius: 0 0 14px 14px;
    z-index: 2;
}

.phone-home {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    border-radius: 999px;
    background: rgba(251, 246, 239, .35);
    
}

.phone-screen {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 30px;
    overflow: hidden;
    background: #1a0510;   
    overflow: hidden;  
}

.invite-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #1a0510;
    overflow: hidden;
    
}
.invite-preview {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--sand-50);
    scrollbar-width: none;
    
}
.invite-preview::-webkit-scrollbar { display: none; }

.invite-preview-cover {
    position: relative;
    height: 38%;
    min-height: 120px;
    background: linear-gradient(160deg, var(--wine-800), var(--wine-600));
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    transition: background .3s ease;
}
.invite-preview-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 45%, rgba(42, 22, 27, .35));
}

.invite-preview-body {
    padding: 16px 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.invite-preview-tag {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--gold);
}

.invite-preview-title {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    margin: 0;
    color: var(--wine-900);
    line-height: 1.15;
    word-break: break-word;
}

.invite-preview-date {
    font-size: .78rem;
    color: var(--ink-soft);
    margin: 0;
}

.invite-preview-line {
    display: block;
    width: 36px;
    height: 2px;
    background: var(--gold);
    margin: 8px 0 10px;
}

.invite-preview-place {
    font-size: .82rem;
    color: var(--ink);
    margin: 0 0 4px;
    font-weight: 600;
    word-break: break-word;
}

.invite-preview-desc {
    font-size: .76rem;
    color: var(--ink-soft);
    line-height: 1.5;
    margin: 0 0 14px;
    word-break: break-word;
}

.invite-preview-btn {
    align-self: flex-start;
    padding: 9px 18px;
    border: none;
    border-radius: 999px;
    background: var(--wine-700);
    color: var(--sand-50);
    font-weight: 600;
    font-size: .76rem;
    cursor: pointer;
}

.editor-toolbar {
    z-index: 100;
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 6px;
    width: 100%;
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(62, 15, 28, .06);
    margin-bottom: 20px;
}

.tool-btn {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 2px;
    border: none;
    background: transparent;
    border-radius: 14px;
    color: var(--ink-soft);
    font-family: var(--font-body);
    font-size: .68rem;
    font-weight: 600;
    cursor: pointer;
    transition: color .2s;
}

.tool-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--sand-100);
    color: var(--wine-700);
    transition: background .2s, color .2s, transform .2s;
}
.tool-icon svg { width: 20px; height: 20px; display: block; }

.tool-btn:hover .tool-icon {
    background: var(--sand-200);
    transform: translateY(-1px);
}

.tool-btn.is-active { color: var(--wine-800); }
.tool-btn.is-active .tool-icon {
    background: var(--wine-700);
    color: var(--sand-50);
}
.tool-btn.is-active .tool-icon svg { stroke: var(--sand-50); }

.tool-label {
    font-size: .66rem;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.editor-drawer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(var(--toolbar-h, 76px) + 20px);
    z-index: 40;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 -12px 40px -16px rgba(62, 15, 28, .35);
    border: 1px solid rgba(62, 15, 28, .08);
    display: flex;
    flex-direction: column;
    max-height: 0;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: max-height .3s ease, opacity .2s ease, transform .3s ease;
}
.editor-drawer.is-open {
    max-height: 55%;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.editor-drawer-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(62, 15, 28, .08);
}
.editor-drawer-title {
    font-size: 1rem;
    margin: 0;
    color: var(--wine-900);
}
.editor-drawer-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--sand-100);
    color: var(--wine-800);
    font-size: .85rem;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background .2s;
}
.editor-drawer-close:hover { background: var(--sand-200); }

.editor-drawer-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 18px;
    -webkit-overflow-scrolling: touch;
}

.drawer-panel { display: none; }
.drawer-panel.is-active { display: block; }

.drawer-hint {
    margin: 0 0 12px;
    color: var(--ink-soft);
    font-size: .88rem;
}

.field { display: block; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field-label {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--wine-700);
    margin-bottom: 5px;
}

.field-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1.5px solid rgba(62, 15, 28, .12);
    background: var(--sand-50);
    font-family: var(--font-body);
    font-size: .92rem;
    color: var(--ink);
    transition: border-color .2s, box-shadow .2s;
}
.field-input:focus {
    outline: none;
    border-color: var(--wine-700);
    box-shadow: 0 0 0 3px rgba(116, 3, 23, .12);
}
.field-textarea { resize: vertical; min-height: 80px; }

.upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 16px;
    border: 2px dashed rgba(62, 15, 28, .2);
    border-radius: var(--radius-sm);
    background: var(--sand-50);
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.upload:hover { border-color: var(--wine-700); background: var(--sand-100); }
.upload-icon { font-size: 1.4rem; color: var(--wine-700); line-height: 1; }
.upload-text { font-size: .86rem; font-weight: 600; color: var(--ink-soft); }

.style-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.style-swatch {
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: .85rem;
    color: var(--sand-50);
    cursor: pointer;
    transition: transform .2s, border-color .2s;
}
.style-swatch:hover { transform: translateY(-2px); }
.style-swatch.is-active { border-color: var(--gold); }

.style-swatch[data-style="wine"] { background: linear-gradient(135deg, var(--wine-800), var(--wine-600)); }
.style-swatch[data-style="gold"] { background: linear-gradient(135deg, #A9834A, var(--gold-soft)); color: var(--wine-900); }
.style-swatch[data-style="rose"] { background: linear-gradient(135deg, #C98B95, #F2D9DD); color: var(--wine-900); }
.style-swatch[data-style="dark"] { background: linear-gradient(135deg, #2A161B, #4E1424); }

.music-list { display: flex; flex-direction: column; gap: 6px; }
.music-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--sand-50);
    border: 1.5px solid rgba(62, 15, 28, .1);
    font-size: .9rem;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.music-item:hover { border-color: var(--wine-700); }
.music-item input { accent-color: var(--wine-700); }

@media (max-width: 640px) {
    .editor-page { padding: 8px 10px; }
    .editor-container { gap: 6px; }
    .phone { border-radius: 32px; padding: 8px; }
    .phone-screen { border-radius: 24px; }
    .tool-icon { width: 34px; height: 34px; }
    .tool-icon svg { width: 18px; height: 18px; }
    .tool-label { font-size: .58rem; }
    .editor-drawer.is-open { max-height: 62%; }
    .editor-drawer {bottom: calc(var(--toolbar-h, 76px) + 12px);}
}

@media (max-width: 400px) {
    .editor-page { padding: 6px 8px; }
    .tool-icon { width: 30px; height: 30px; }
    .tool-icon svg { width: 16px; height: 16px; }
    .tool-label { font-size: .52rem; }
    .editor-next { padding: 7px 14px; font-size: .74rem; }
    .editor-back { font-size: .72rem; padding: 5px 8px; }
}


.design-swatches {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}
.design-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform .2s, border-color .2s;
}
.design-swatch:hover { transform: scale(1.08); }
.design-swatch.is-active { border-color: var(--wine-900); }

.design-swatch[data-style="wine"] { background: linear-gradient(135deg, #4E1424, #7A2440); }
.design-swatch[data-style="gold"] { background: linear-gradient(135deg, #A9834A, #DCC08F); }
.design-swatch[data-style="rose"] { background: linear-gradient(135deg, #C98B95, #F2D9DD); }
.design-swatch[data-style="sky"]  { background: linear-gradient(135deg, #8BB3C9, #D9EDF5); }
.design-swatch[data-style="mint"] { background: linear-gradient(135deg, #7FB89B, #D4EBE0); }
.design-swatch[data-style="dark"] { background: linear-gradient(135deg, #2A161B, #4E1424); }

.field--color {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.field-color {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    background: transparent;
}
.field-color::-webkit-color-swatch-wrapper { padding: 0; }
.field-color::-webkit-color-swatch {
    border: 2px solid rgba(62,15,28,.15);
    border-radius: 8px;
}
.field-input--sm {
    flex: 1;
    min-width: 100px;
}

.photo-previews {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 14px;
}
.photo-preview {
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    background: var(--sand-100);
    padding: 0;
    cursor: pointer;
    transition: border-color .2s, transform .2s;
}
.photo-preview:hover { transform: translateY(-2px); }
.photo-preview.is-active { border-color: var(--wine-700); }
.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dress-row,
.plan-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}
.plan-row .plan-time {
    flex: 0 0 80px;
}

.btn-remove {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: var(--sand-100);
    color: var(--wine-800);
    cursor: pointer;
    flex-shrink: 0;
}
.btn-remove:hover { background: var(--sand-200); }

.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1.5px dashed var(--wine-700);
    background: transparent;
    color: var(--wine-700);
    border-radius: 8px;
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    margin-top: 6px;
}
.btn-add:hover { background: var(--sand-100); }

.copy-row {
    display: flex;
    gap: 6px;
}
.btn-copy {
    padding: 0 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--wine-700);
    color: var(--sand-50);
    font-weight: 600;
    font-size: .85rem;
    white-space: nowrap;
    cursor: pointer;
}
.btn-block {
    display: flex;
    width: 100%;
    margin-top: 18px;
    justify-content: center;
}
.upload--sm {
    padding: 16px 12px;
    font-size: .85rem;
}

.tool-btn--next .tool-icon {
    background: var(--wine-700);
    color: var(--sand-50);
}
.tool-btn--next:hover .tool-icon { background: var(--wine-800); }


/* Превью загруженного фото */
.upload-preview {
    position: relative;
    margin-top: 12px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.15);
    background: rgba(0,0,0,.2);
}
.upload-preview img {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    display: block;
}
.upload-remove {
    position: absolute;
    top: 8px; right: 8px;
    width: 28px; height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.65);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: grid;
    place-items: center;
}
.upload-remove:hover { background: #c2367a; }

/* Состояния лейбла */
.upload.is-loading {
    opacity: .7;
    pointer-events: none;
}
.upload.is-loading .upload-icon { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.upload.is-done {
    border-color: #4a9a72;
    background: rgba(74,154,114,.08);
}
.upload.is-done .upload-icon { color: #4a9a72; }

/* Маленький бейдж "Загружено" */
.upload-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 10px;
    background: #4a9a72;
    color: #fff;
    vertical-align: middle;
}


/* =====================================================
   ПЛАН — нормальная раскладка на телефоне
   ===================================================== */

/* базовая строка — как есть на десктопе */
.plan-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}

/* время — фиксированная ширина, чтобы не сжималось */
.plan-row .plan-time {
    flex: 0 0 80px;
    min-width: 0;
}

/* занятие и подпись — равные, не сжимаются в ноль */
.plan-row [data-plan="activity"],
.plan-row [data-plan="note"] {
    flex: 1 1 0;
    min-width: 0;
}

/* ---------- Телефон: в столбик ---------- */
@media (max-width: 640px) {
    .plan-row {
        display: grid;
        grid-template-columns: 1fr auto;      /* текст + кнопка ✕ */
        grid-template-areas:
            "time   remove"
            "act    act"
            "note   note";
        gap: 6px;
        align-items: center;
        padding: 10px;
        margin-bottom: 10px;
        border-radius: 10px;
        background: var(--sand-50);
        border: 1px solid rgba(62, 15, 28, .08);
    }

    .plan-row .plan-time {
        grid-area: time;
        flex: unset;
        width: 100%;
    }
    .plan-row [data-plan="activity"] { grid-area: act; }
    .plan-row [data-plan="note"]     { grid-area: note; }

    .plan-row .btn-remove {
        grid-area: remove;
        align-self: center;
        justify-self: end;
    }

    /* инпуты на всю ширину ячейки */
    .plan-row .field-input {
        width: 100%;
        font-size: .88rem;
        padding: 9px 10px;
    }

    /* время — чуть крупнее, оно главное */
    .plan-row .plan-time {
        font-weight: 600;
        max-width: 120px;
    }

    /* подпись — визуально легче */
    .plan-row [data-plan="note"] {
        font-style: italic;
        color: var(--ink-soft);
    }
}