.admin-box {
    max-width: 1400px;
    padding: 22px 24px 30px;
}

.admin-head {
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid #e7edf5;
}

.admin-head h1 {
    margin: 0 0 6px;
    font-size: 28px;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 18px 0 24px;
}

.tabs a {
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f4f8fc;
    border: 1px solid #e2eaf3;
    text-align: center;
    line-height: 1.35;
}

.tabs a.active {
    background: #0b73d9;
    color: #fff;
    border-color: #0b73d9;
    box-shadow: 0 10px 20px rgba(11, 115, 217, .15);
}

.stats {
    margin-top: 12px;
}

.stat {
    padding: 20px 18px;
}

.stat strong {
    font-size: 30px;
}

.form-grid {
    align-items: start;
}

label {
    display: block;
}

table {
    background: #fff;
}

th {
    background: #f7fafc;
}

.card.pick {
    min-height: 100%;
}

.card.pick img {
    border-radius: 10px;
}

.home-product-pick {
    cursor: pointer;
}

.home-product-pick > span:first-of-type {
    font-weight: 700;
    line-height: 1.5;
}

.home-sort {
    display: grid;
    grid-template-columns: auto 82px;
    gap: 8px;
    align-items: center;
    color: #5d6b7c;
    font-size: 13px;
}

.home-sort input {
    margin-top: 0;
    padding: 7px 8px;
}

.media-field-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.media-open-btn {
    white-space: nowrap;
    align-self: end;
}

.editor-actions {
    margin: 8px 0;
}

.html-editor-field textarea {
    min-height: 260px;
    font-family: Consolas, "Microsoft YaHei", monospace;
}

.media-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    padding: 28px;
    background: rgba(13, 27, 43, .45);
}

.media-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-modal-panel {
    width: min(1120px, 100%);
    max-height: 88vh;
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(16, 35, 56, .28);
    padding: 22px;
}

.media-modal-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.media-modal-head h2 {
    margin: 0 0 6px;
}

.media-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #eef3f9;
    color: #344;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.media-tools {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto minmax(240px, 1.2fr);
    gap: 12px;
    align-items: center;
    padding: 14px;
    background: #f7fafc;
    border: 1px solid #e3ebf4;
    border-radius: 14px;
    margin-bottom: 14px;
}

.media-upload-label {
    font-weight: 600;
}

.media-paste-zone {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #9fb4cc;
    border-radius: 10px;
    background: #fff;
    color: #5d6b7c;
    text-align: center;
}

.media-paste-zone:focus {
    border-color: #0b73d9;
    box-shadow: 0 0 0 3px rgba(11, 115, 217, .12);
    outline: none;
}

.media-status {
    margin: 0 0 14px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.media-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border: 1px solid #e1eaf3;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    text-align: left;
}

.media-item:hover {
    border-color: #0b73d9;
    box-shadow: 0 8px 18px rgba(11, 115, 217, .12);
}

.media-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    background: #eaf0f7;
}

.media-item span {
    color: #526071;
    font-size: 12px;
    line-height: 1.45;
    word-break: break-all;
}

@media (max-width: 850px) {
    .admin-box {
        padding: 16px;
    }

    .tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-head h1 {
        font-size: 24px;
    }

    .media-field-row,
    .media-tools {
        grid-template-columns: 1fr;
    }

    .media-modal {
        padding: 12px;
    }
}
