:root {
    --st-bg: #f7f1eb;
    --st-ink: #2c2420;
    --st-gold: #c9a96e;
    --st-line: rgba(44, 36, 32, 0.12);
    --st-serif: "Cormorant Garamond", Georgia, serif;
    --st-sans: "DM Sans", sans-serif;
}
html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: var(--st-bg);
    color: var(--st-ink);
    font-family: var(--st-sans);
}
.studio-shell {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.studio-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto;
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--st-line);
    background: #fffdf9;
}
.studio-brand {
    display: flex;
    align-items: center;
    line-height: 0;
    text-decoration: none;
}
.studio-brand img {
    display: block;
    height: 36px;
    width: auto;
    max-width: 168px;
    object-fit: contain;
}
.studio-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--st-line);
    border-radius: 999px;
    color: var(--st-ink);
    background: #fff;
    text-decoration: none;
}
.studio-icon-btn:hover { background: #f3eee7; }
.studio-auth, .studio-panel { display: none; }
.studio-auth.is-on {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}
.studio-panel.is-on {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
.studio-card {
    width: min(640px, calc(100% - 2rem));
    margin: 4rem auto;
    background: #fffdf9;
    padding: 2rem;
    border: 1px solid var(--st-line);
}
.studio-card h1 { font-family: var(--st-serif); font-weight: 500; margin: 0 0 0.6rem; }
.studio-card label, .editor-form label { display: grid; gap: 0.35rem; margin-bottom: 0.9rem; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.editor-form label.studio-check {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    margin-bottom: 0.7rem;
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1.3;
}
.editor-form label.studio-check input[type="checkbox"] {
    appearance: auto;
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
    flex: 0 0 auto;
    align-self: center;
    accent-color: #1a73e8;
}
.studio-card input, .editor-form input, .editor-form textarea, .editor-form select {
    font: inherit;
    text-transform: none;
    letter-spacing: 0;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--st-line);
    background: #fff;
}
.studio-btn, .studio-link-btn {
    appearance: none;
    border: 0;
    background: var(--st-ink);
    color: #f7f1eb;
    padding: 0.75rem 1rem;
    font: inherit;
    cursor: pointer;
}
.studio-btn.ghost, .studio-link-btn.ghost { background: transparent; color: var(--st-ink); border: 1px solid var(--st-line); }
.studio-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.studio-note { color: #7a6c63; line-height: 1.6; }
.studio-error { color: #9d1c28; min-height: 1.2em; }

.studio-layout {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr) 360px;
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
}
.studio-col { border-right: 1px solid var(--st-line); padding: 1rem; overflow: auto; min-height: 0; }
.studio-col:last-child {
    border-right: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.studio-col h2 { font-family: var(--st-serif); font-size: 1.3rem; margin: 0 0 0.8rem; flex: 0 0 auto; }
.editor-form { flex: 1; min-height: 0; overflow: auto; }
.editor-form:has(.card-carousel) {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.editor-form:has(.card-carousel) > label:first-child,
.editor-form:has(.card-carousel) > .studio-note { flex: 0 0 auto; }
.section-card {
    margin: 0 0 0.7rem;
    position: relative;
    cursor: grab;
}
.section-card.is-dragging {
    opacity: 0.55;
    cursor: grabbing;
}
.section-card.is-drop .section-open {
    box-shadow: 0 0 0 2px #c9a96e, 0 8px 18px rgba(8, 51, 40, 0.28);
}
.section-close,
.section-close-spacer {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    margin: 0 0 0.28rem auto;
}
.section-close-spacer {
    visibility: hidden;
    pointer-events: none;
}
.section-close {
    appearance: none;
    border: 1px solid var(--st-line);
    border-radius: 999px;
    background: #fff;
    color: #7a6c63;
    font: inherit;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 6px rgba(44, 36, 32, 0.08);
}
.section-close:hover {
    background: #083328;
    border-color: #083328;
    color: #fff;
}
.section-card.is-off .section-close {
    color: #2f7a45;
    border-color: rgba(47, 122, 69, 0.35);
}
.section-card.is-off .section-close:hover {
    background: #2f7a45;
    border-color: #2f7a45;
    color: #fff;
}
.section-open,
.section-icon {
    appearance: none;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, #0f4a3a 0%, #083328 46%, #041a15 100%);
    color: #fff;
    font: inherit;
    cursor: grab;
    box-shadow: 0 8px 18px rgba(8, 51, 40, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.section-open {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0.72rem 1.1rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
}
.section-open em {
    font-style: normal;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    opacity: 0.7;
}
.section-open:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(8, 51, 40, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.section-open:active { cursor: grabbing; transform: translateY(1px); }
.section-card.is-on .section-open {
    box-shadow: 0 8px 18px rgba(8, 51, 40, 0.3), 0 0 0 2px #fff, 0 0 0 4px #083328;
}
.section-card.is-off .section-open { opacity: 0.5; }
.studio-preview-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}
.preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex: 0 0 auto;
    margin: 0 0 0.8rem;
}
.preview-head h2 {
    margin: 0;
}
.preview-device {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem;
    border: 1px solid var(--st-line);
    border-radius: 999px;
    background: #fff;
}
.preview-device-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: #7a6c63;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
}
.preview-device-btn:hover {
    color: var(--st-ink);
}
.preview-device-btn.is-on {
    background: #083328;
    color: #fff;
}
.preview-scale {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--st-line);
    background: #efe8df;
}
.preview-scale[data-device="mobile"] {
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.55), transparent 42%),
        #d9d0c4;
}
.preview-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 100%;
    border: 0;
    background: #fff;
    transform-origin: top left;
}
.preview-scale[data-device="mobile"] .preview-frame {
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(44, 36, 32, 0.22);
    outline: 1px solid rgba(44, 36, 32, 0.12);
}
.dash {
    width: min(720px, calc(100% - 2rem));
    margin: 2rem auto 4rem;
    background: #fffdf9;
    padding: 2rem;
    border: 1px solid var(--st-line);
    text-align: center;
}
.dash h1 { font-family: var(--st-serif); font-size: clamp(2rem, 6vw, 3.4rem); margin: 0.2rem 0 0.6rem; }
.dash-status { letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.75rem; color: #2f7a45; }
.dash-status.is-off { color: #9d1c28; }
.dash-qr { width: 220px; height: 220px; margin: 1.4rem auto; background: #fff; padding: 0.6rem; }
.dash-qr img { width: 100%; height: 100%; }
.repeat-card { border: 1px solid var(--st-line); padding: 0.8rem; margin-bottom: 0.8rem; background: #fff; }
.card-carousel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.card-carousel-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
}
.card-carousel-meta {
    margin: 0;
    flex: 1 1 6rem;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7a6c63;
}
.card-carousel-nav { min-width: 2.2rem; padding: 0.45rem 0.55rem; }
.card-carousel-toolbar .studio-btn:not(.card-carousel-nav) { flex: 1 1 100%; }
.card-carousel-viewport {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.card-carousel-track {
    display: flex;
    align-items: stretch;
    height: 100%;
    transition: transform 0.28s ease;
}
.card-carousel-track > .repeat-card {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow: auto;
    max-height: 100%;
    box-sizing: border-box;
}
.card-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    flex: 0 0 auto;
}
.card-carousel-dot {
    width: 0.45rem;
    height: 0.45rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--st-line);
    cursor: pointer;
}
.card-carousel-dot.is-on { background: var(--st-ink); }
#inquiry-list { margin-top: 1rem; }
.inquiry-card { text-align: left; text-transform: none; letter-spacing: 0; }
.inquiry-card p { margin: 0.35rem 0; }
.inquiry-edit { margin-top: 0.7rem; padding-top: 0.7rem; border-top: 1px solid var(--st-line); }
.repeat-tools { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 0.9rem; }
.photo-thumb { width: 72px; height: 72px; object-fit: cover; border: 1px solid var(--st-line); }
.photo-remove { color: #9d1c28; }
.gallery-upload { flex: 1 1 100%; }
.gallery-upload > .studio-btn { width: 100%; }
.gal-preview {
    overflow: hidden;
    background: #efe8df;
    margin: 0 0 0.7rem;
}
.gal-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gal-preview.is-portrait { aspect-ratio: 3 / 4; max-height: 240px; }
.gal-preview.is-landscape { aspect-ratio: 4 / 3; max-height: 170px; }
.gal-orient { display: flex; gap: 0.4rem; margin: 0 0 0.75rem; }
.gal-orient-btn {
    flex: 1;
    appearance: none;
    border: 1px solid var(--st-line);
    background: #fff;
    color: var(--st-ink);
    padding: 0.45rem 0.5rem;
    font: inherit;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 999px;
}
.gal-orient-btn.is-on {
    background: #1a1814;
    color: #fff;
    border-color: #1a1814;
}
.hidden { display: none !important; }

.studio-modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 1.2rem;
    background: rgba(8, 51, 40, 0.45);
}
.studio-modal[hidden] { display: none !important; }
.studio-modal-card {
    position: relative;
    width: min(420px, 100%);
    max-height: calc(100vh - 2.4rem);
    overflow: auto;
    background: #fffdf9;
    border: 1px solid var(--st-line);
    padding: 1.75rem 1.5rem 1.5rem;
    box-shadow: 0 24px 60px rgba(8, 51, 40, 0.22);
    box-sizing: border-box;
}
.studio-modal-close {
    position: absolute;
    top: 0.65rem;
    right: 0.75rem;
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--st-ink);
    font-size: 1.55rem;
    line-height: 1;
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
}
.studio-modal-close:hover { color: #083328; }
.studio-modal-kicker {
    margin: 0 0 0.4rem;
    padding-right: 2rem;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #7a6c63;
}
.studio-modal-card h2 {
    margin: 0 0 0.5rem;
    padding-right: 1.5rem;
    font-family: var(--st-serif);
    font-weight: 500;
    font-size: 1.65rem;
    line-height: 1.2;
    color: var(--st-ink);
}
.studio-modal-card > .studio-note {
    margin: 0 0 1.25rem;
    font-size: 0.92rem;
    line-height: 1.55;
}
#publish-inquiry-form {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}
#publish-inquiry-form label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    margin: 0;
    width: 100%;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #5c514a;
    box-sizing: border-box;
}
#publish-inquiry-form input,
#publish-inquiry-form textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--st-line);
    border-radius: 2px;
    background: #fff;
    color: var(--st-ink);
    font: inherit;
    font-size: 0.95rem;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1.4;
}
#publish-inquiry-form input:focus,
#publish-inquiry-form textarea:focus {
    outline: none;
    border-color: #083328;
    box-shadow: 0 0 0 2px rgba(8, 51, 40, 0.12);
}
#publish-inquiry-form input[readonly] {
    background: #f3eee7;
    color: #5c514a;
}
#publish-inquiry-form textarea {
    min-height: 6.5rem;
    resize: vertical;
}
.studio-modal-card .studio-btn {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.85rem 1rem;
    background: #083328;
    color: #fff;
    letter-spacing: 0.04em;
}
.studio-modal-card .studio-btn:hover { background: #0a4334; }
.studio-modal-card .studio-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}
#publish-inquiry-error {
    margin: 0;
    min-height: 0;
    font-size: 0.88rem;
}
.inquiry-crm {
    display: grid;
    gap: 0.9rem;
    margin-top: 1rem;
}
.inquiry-card-head {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    align-items: baseline;
}
.inquiry-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #083328;
    color: #fff;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.inquiry-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

@media (max-width: 1100px) {
    html, body { overflow: auto; height: auto; }
    .studio-shell { height: auto; min-height: 100%; overflow: visible; }
    .studio-panel.is-on { overflow: visible; }
    .studio-layout { grid-template-columns: 1fr; height: auto; overflow: visible; }
    .studio-col:last-child { overflow: visible; }
    .editor-form:has(.card-carousel) { overflow: visible; }
    .card-carousel { min-height: 62vh; }
    .preview-scale { min-height: 70vh; }
}
