/* ── editor.css ─────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: #f0f0ed;
    color: #1a1a1a;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    height: 54px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    z-index: 100;
    flex-shrink: 0;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #111;
    font-weight: 700;
    font-size: .95rem;
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.name-inline {
    border: none;
    font-size: .95rem;
    font-weight: 600;
    color: #111;
    background: transparent;
    outline: none;
    padding: 4px 6px;
    border-radius: 6px;
    min-width: 180px;
}

.name-inline:hover,
.name-inline:focus {
    background: #f5f5f5;
}

.pill {
    padding: 3px 10px;
    border-radius: 100px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.pill.draft {
    background: #f0f0f0;
    color: #888;
}

.pill.live {
    background: #e6f4ec;
    color: #2d7a4f;
}

.topbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tbtn {
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #333;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: .15s;
}

.tbtn:hover {
    background: #f5f5f5;
}

.tbtn-primary {
    background: #1a1a2e;
    color: #fff;
    border-color: #1a1a2e;
}

.tbtn-primary:hover {
    background: #0f0f1e;
}

/* Layout */
.editor-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 80px;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 4px;
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, .55);
    cursor: pointer;
    width: 68px;
    transition: .15s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.nav-item.active {
    background: rgba(255, 255, 255, .15);
    color: #fff;
}

.nav-icon {
    font-size: 1.2rem;
}

.nav-label {
    font-size: .6rem;
    font-weight: 600;
    letter-spacing: .04em;
}

/* Main */
.editor-main {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

.tab-panel {
    display: none;
    max-width: 900px;
}

.tab-panel.active {
    display: block;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.panel-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #111;
}

.panel-sub {
    color: #888;
    font-size: .82rem;
    margin-top: 3px;
    max-width: 520px;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #e8e8e6;
}

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

.card-title {
    font-size: .9rem;
    font-weight: 700;
    color: #111;
}

.mb16 {
    margin-bottom: 16px;
}

.mb12 {
    margin-bottom: 12px;
}

.mt8 {
    margin-top: 8px;
}

.mt12 {
    margin-top: 12px;
}

.card-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.center-card {
    text-align: center;
    padding: 40px 20px;
}

/* Buttons */
.btn-primary {
    padding: 9px 18px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: .15s;
}

.btn-primary:hover {
    background: #0f0f1e;
}

.btn-primary.big-btn {
    padding: 13px 28px;
    font-size: .95rem;
}

.btn-ghost {
    padding: 9px 18px;
    background: #f5f5f5;
    color: #444;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: .15s;
}

.btn-ghost:hover {
    background: #ebebeb;
}

.btn-danger {
    padding: 9px 18px;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: .15s;
}

.btn-danger:hover {
    background: #fee2e2;
}

.icon-btn {
    padding: 7px 12px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    color: #444;
    transition: .15s;
}

.icon-btn:hover {
    background: #ebebeb;
}

.ml-auto {
    margin-left: auto;
}

/* Floor plan */
.floorplan-wrap {
    position: relative;
    background: #fafaf8;
    border-radius: 10px;
    border: 1px solid #e8e8e6;
    overflow: hidden;
}

#floorplan {
    display: block;
    width: 100%;
    height: auto;
    cursor: crosshair;
    max-height: 420px;
}

.fp-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, .5);
    color: #fff;
    padding: 5px 14px;
    border-radius: 100px;
    font-size: .72rem;
    pointer-events: none;
    white-space: nowrap;
}

/* Collections */
.collection-item {
    border: 1px solid #eeeeec;
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

.coll-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fafaf8;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.coll-num {
    width: 26px;
    height: 26px;
    background: #1a1a2e;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.coll-name {
    font-weight: 600;
    font-size: .85rem;
    flex: 1;
}

.coll-count {
    font-size: .75rem;
    color: #888;
}

.coll-body {
    padding: 14px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 60px;
}

/* Artwork cards in collection */
.aw-card {
    width: 90px;
    cursor: pointer;
    text-align: center;
}

.aw-thumb {
    width: 90px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: .15s;
}

.aw-card:hover .aw-thumb {
    border-color: #1a1a2e;
}

.aw-card-name {
    font-size: .67rem;
    color: #666;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aw-add-btn {
    width: 90px;
    height: 70px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    background: #fafaf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #bbb;
    cursor: pointer;
    transition: .15s;
}

.aw-add-btn:hover {
    border-color: #999;
    color: #888;
}

/* Form fields */
.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.field label {
    font-size: .75rem;
    font-weight: 600;
    color: #555;
}

.field-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.field-hint {
    font-size: .75rem;
    color: #aaa;
}

.flabel-hint {
    font-size: .72rem;
    color: #aaa;
    font-weight: 400;
}

.flex1 {
    flex: 1;
}

.finput {
    padding: 9px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: .85rem;
    color: #111;
    outline: none;
    font-family: inherit;
    transition: border-color .2s;
    background: #fafafa;
}

.finput:focus {
    border-color: #1a1a2e;
    background: #fff;
}

.ftextarea {
    padding: 9px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: .85rem;
    color: #111;
    outline: none;
    font-family: inherit;
    resize: vertical;
    background: #fafafa;
}

.ftextarea:focus {
    border-color: #1a1a2e;
    background: #fff;
}

.fselect {
    padding: 9px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: .85rem;
    color: #111;
    outline: none;
    font-family: inherit;
    background: #fafafa;
    cursor: pointer;
}

.frange {
    width: 100%;
    accent-color: #1a1a2e;
}

.range-val {
    font-size: .75rem;
    color: #888;
    min-width: 35px;
    text-align: right;
}

.color-input {
    width: 44px;
    height: 36px;
    padding: 2px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    background: #fafafa;
}

/* Upload boxes */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.upload-box {
    border: 2px dashed #d0d0ce;
    border-radius: 12px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: .2s;
    overflow: hidden;
    position: relative;
    background: #fafaf8;
}

.upload-box:hover {
    border-color: #999;
    background: #f4f4f2;
}

.up-placeholder {
    text-align: center;
    padding: 16px;
}

.up-icon {
    font-size: 1.8rem;
    margin-bottom: 6px;
}

.up-label {
    font-size: .82rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 3px;
}

.up-hint {
    font-size: .72rem;
    color: #aaa;
}

.audio-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    width: 100%;
}

.audio-name {
    font-size: .8rem;
    color: #555;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-btn {
    background: none;
    border: none;
    color: #dc2626;
    font-size: 1rem;
    cursor: pointer;
}

/* Toggle */
.toggle {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.tslider {
    position: absolute;
    inset: 0;
    background: #ddd;
    border-radius: 100px;
    transition: .2s;
    cursor: pointer;
}

.tslider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: .2s;
}

.toggle input:checked+.tslider {
    background: #1a1a2e;
}

.toggle input:checked+.tslider::before {
    transform: translateX(18px);
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0ee;
    gap: 12px;
}

.toggle-row:last-child {
    border-bottom: none;
}

.trow-label {
    font-size: .85rem;
    font-weight: 600;
    color: #222;
}

.trow-sub {
    font-size: .75rem;
    color: #999;
    margin-top: 1px;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.setting-group {
    background: #fafaf8;
    border-radius: 10px;
    padding: 14px;
}

.sg-title {
    font-size: .8rem;
    font-weight: 700;
    color: #444;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* Share */
.share-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-label {
    font-size: .82rem;
    color: #666;
    white-space: nowrap;
    min-width: 90px;
}

.url-field {
    display: flex;
    align-items: center;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
}

.url-prefix {
    padding: 0 10px;
    font-size: .82rem;
    color: #999;
    background: #f0f0f0;
    border-right: 1px solid #e0e0e0;
    white-space: nowrap;
    height: 38px;
    display: flex;
    align-items: center;
}

.slug-input {
    border: none;
    background: transparent;
}

.slug-input:focus {
    background: transparent;
}

/* Status block */
.status-block {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 10px;
    background: #fafaf8;
    border: 1px solid #eee;
}

.published-block {
    background: #f0faf4;
    border-color: #c6e9d4;
}

.status-icon {
    font-size: 1.5rem;
}

.status-title {
    font-weight: 700;
    font-size: .9rem;
}

.status-sub {
    font-size: .78rem;
    color: #888;
    margin-top: 2px;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e8e8e6;
    border-radius: 14px;
    padding: 18px 16px;
    text-align: center;
}

.stat-icon {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.stat-val {
    font-size: 1.7rem;
    font-weight: 700;
    color: #111;
    margin-bottom: 2px;
}

.stat-label {
    font-size: .75rem;
    color: #888;
}

.stat-delta {
    font-size: .72rem;
    margin-top: 4px;
}

.stat-delta.positive {
    color: #2d7a4f;
}

.chart-wrap {
    padding: 8px 0;
}

/* Top artworks */
.top-aw-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.top-aw-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    background: #fafaf8;
}

.top-aw-rank {
    font-size: .75rem;
    font-weight: 700;
    color: #aaa;
    min-width: 20px;
}

.top-aw-img {
    width: 48px;
    height: 36px;
    object-fit: cover;
    border-radius: 6px;
}

.top-aw-info {
    flex: 1;
}

.top-aw-name {
    font-size: .83rem;
    font-weight: 600;
    color: #111;
}

.top-aw-meta {
    font-size: .73rem;
    color: #888;
}

.top-aw-clicks {
    font-size: .83rem;
    font-weight: 700;
    color: #1a1a2e;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f0f0f0;
    border: none;
    font-size: .85rem;
    cursor: pointer;
}

.modal-body {
    display: flex;
    gap: 20px;
    padding: 20px 24px;
}

.modal-img-wrap {
    flex-shrink: 0;
    width: 180px;
}

.modal-img-wrap img {
    width: 180px;
    height: 135px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    margin-bottom: 8px;
    background: #f0f0f0;
}

.change-img-btn {
    width: 100%;
    padding: 7px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    font-size: .75rem;
    cursor: pointer;
    color: #555;
}

.modal-fields {
    flex: 1;
}

.modal-section-title {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #aaa;
    margin: 14px 0 10px;
}

.modal-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #f0f0f0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1a1a2e;
    color: #fff;
    padding: 10px 22px;
    border-radius: 100px;
    font-size: .82rem;
    z-index: 600;
    opacity: 0;
    transition: .3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 700px) {

    .settings-grid,
    .upload-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .modal-body {
        flex-direction: column;
    }

    .modal-img-wrap {
        width: 100%;
    }

    .modal-img-wrap img {
        width: 100%;
        height: 180px;
    }
}