*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --lake: #1B4965;
    --lake-light: #2a5f82;
    --sky: #5FA8D3;
    --sky-hover: #4a95c0;
    --sand: #E8DCC4;
    --sunset: #D4923A;
    --sunset-hover: #c07e2d;
    --pine: #2D4A3E;
    --birch: #F5F1EB;
    --dark: #1a1a1a;
    --white: #ffffff;
    --gray: #6c757d;
    --gray-light: #e9ecef;
    --danger: #dc3545;
    --danger-hover: #c82333;
    --success: #28a745;
}

html {
    scroll-behavior: auto;
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    font-family: 'Raleway', sans-serif;
    color: var(--dark);
    background-color: var(--birch);
    line-height: 1.6;
    min-height: 100vh;
}

h1,
h2,
h3 {
    font-family: 'Libre Baskerville', serif;
}

a {
    text-decoration: none;
    color: inherit;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--lake) 0%, var(--pine) 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-card {
    background: var(--white);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--sunset);
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.5rem;
    color: var(--lake);
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--gray);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Raleway', sans-serif;
    transition: border-color 0.2s;
    background: var(--white);
    color: var(--dark);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--sky);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input[type="datetime-local"] {
    cursor: pointer;
    color-scheme: light;
}

.field-hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: var(--gray);
    font-style: italic;
}

.form-group.checkbox-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.form-group.checkbox-group input[type="checkbox"] {
    width: auto;
    accent-color: var(--sunset);
}

.form-group.checkbox-group label {
    margin-bottom: 0;
}

.error-message {
    background: #f8d7da;
    color: var(--danger);
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.login-btn {
    width: 100%;
    padding: 0.8rem;
    background: var(--sunset);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Raleway', sans-serif;
}

.login-btn:hover {
    background: var(--sunset-hover);
}

.admin-layout {
    display: grid;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
        "header"
        "tabs"
        "main";
    min-height: 100vh;
}

.admin-header {
    grid-area: header;
    background: var(--lake);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 3px solid var(--sunset);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-logo {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid var(--sunset);
}

.header-left h1 {
    font-size: 1.3rem;
    color: var(--white);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.welcome-text {
    font-size: 0.9rem;
    color: var(--sand);
}

.logout-btn {
    padding: 0.4rem 1rem;
    background: transparent;
    color: var(--sand);
    border: 2px solid var(--sand);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
    font-family: 'Raleway', sans-serif;
}

.logout-btn:hover {
    background: var(--sand);
    color: var(--lake);
}

.admin-tabs {
    grid-area: tabs;
    display: flex;
    background: var(--lake-light);
    padding: 0 1.5rem;
    gap: 0.25rem;
}

.tab-btn {
    padding: 0.8rem 1.5rem;
    background: transparent;
    color: var(--sand);
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
    font-family: 'Raleway', sans-serif;
}

.tab-btn:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--white);
    border-bottom-color: var(--sunset);
    background: rgba(255, 255, 255, 0.1);
}

.admin-main {
    grid-area: main;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.tab-content {
    display: none;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    color: var(--lake);
    font-size: 1.5rem;
}

.add-btn {
    padding: 0.6rem 1.2rem;
    background: var(--sunset);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
    font-family: 'Raleway', sans-serif;
}

.add-btn:hover {
    background: var(--sunset-hover);
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

.loading-text {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--gray);
    padding: 2rem;
    font-size: 0.95rem;
}

.schema-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
}

.schema-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.schema-card-header {
    background: var(--lake);
    color: var(--white);
    padding: 0.8rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.schema-card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-family: 'Raleway', sans-serif;
}

.schema-collection-name {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-family: monospace;
}

.schema-card-body {
    padding: 0;
}

.schema-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.schema-table th {
    background: var(--sand-light);
    padding: 0.5rem 0.8rem;
    text-align: left;
    font-weight: 600;
    color: var(--lake);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--sand);
}

.schema-table td {
    padding: 0.4rem 0.8rem;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.schema-table tr:last-child td {
    border-bottom: none;
}

.schema-table tr:hover {
    background: #fafaf5;
}

.schema-field-name {
    font-family: monospace;
    font-weight: 600;
    color: var(--lake-dark);
    font-size: 0.82rem;
}

.schema-field-type {
    color: var(--sunset);
    font-family: monospace;
    font-size: 0.8rem;
}

.schema-field-note {
    color: var(--gray);
    font-size: 0.75rem;
    font-style: italic;
}

.schema-nested-toggle {
    cursor: pointer;
    user-select: none;
}

.schema-nested-toggle .toggle-icon {
    display: inline-block;
    width: 1em;
    transition: transform 0.15s;
    font-style: normal;
}

.schema-nested-toggle.open .toggle-icon {
    transform: rotate(90deg);
}

.schema-nested-row {
    display: none;
}

.schema-nested-row.visible {
    display: table-row;
}

.schema-nested-row td {
    padding-left: 2rem;
    background: #f9f9f5;
}

.schema-doc-count {
    font-size: 0.8rem;
    color: var(--sand);
    font-weight: normal;
}

.item-card {
    background: var(--white);
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 1px solid var(--gray-light);
    transition: box-shadow 0.2s;
}

.item-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.card-ids {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.id-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--gray-light);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-family: 'Courier New', monospace;
    color: var(--gray);
    word-break: break-all;
}

.id-badge strong {
    color: var(--dark);
    font-family: 'Raleway', sans-serif;
}

.item-card h3 {
    color: var(--lake);
    font-size: 1.1rem;
    margin-top: 0.25rem;
}

.card-description {
    color: var(--dark);
    font-size: 0.9rem;
    flex-grow: 1;
    line-height: 1.5;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 0.25rem;
}

.meta-tag {
    background: var(--sky);
    color: var(--white);
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.meta-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--pine);
}

.meta-status {
    font-size: 0.75rem;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-weight: 600;
}

.meta-status.active {
    background: #d4edda;
    color: var(--success);
}

.meta-status.inactive {
    background: #f8d7da;
    color: var(--danger);
}

.meta-date {
    font-style: italic;
    color: var(--gray);
}

.meta-sort {
    color: var(--gray);
    font-size: 0.75rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-light);
}

.card-reorder-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--gray-light);
}

.drag-handle {
    cursor: grab;
    font-size: 1.3rem;
    color: var(--gray);
    user-select: none;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.drag-handle:hover {
    color: var(--lake);
    background: var(--gray-light);
}

.drag-handle:active {
    cursor: grabbing;
}

.move-buttons {
    display: flex;
    gap: 0.25rem;
}

.move-btn {
    background: var(--gray-light);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    color: var(--gray);
    transition: background 0.2s, color 0.2s;
    font-family: 'Raleway', sans-serif;
    line-height: 1;
}

.move-btn:hover {
    background: var(--sky);
    color: var(--white);
}

.sortable-ghost {
    opacity: 0.3;
    background: var(--sand);
}

.sortable-chosen {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.sortable-drag {
    opacity: 0.9;
}

.edit-btn,
.delete-btn {
    flex: 1;
    padding: 0.45rem 0.75rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s;
    font-family: 'Raleway', sans-serif;
}

.edit-btn {
    background: var(--sky);
    color: var(--white);
}

.edit-btn:hover {
    background: var(--sky-hover);
}

.delete-btn {
    background: var(--danger);
    color: var(--white);
}

.delete-btn:hover {
    background: var(--danger-hover);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--white);
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-light);
}

.modal-header h2 {
    color: var(--lake);
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    line-height: 1;
    padding: 0.25rem;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--dark);
}

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-light);
}

.cancel-btn {
    padding: 0.6rem 1.2rem;
    background: var(--gray-light);
    color: var(--dark);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
    font-family: 'Raleway', sans-serif;
}

.cancel-btn:hover {
    background: #d1d5d9;
}

.save-btn {
    padding: 0.6rem 1.2rem;
    background: var(--sunset);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
    font-family: 'Raleway', sans-serif;
}

.save-btn:hover {
    background: var(--sunset-hover);
}

.back-btn {
    padding: 0.6rem 1.2rem;
    background: var(--gray-light);
    color: var(--dark);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
    font-family: 'Raleway', sans-serif;
    margin-right: auto;
}

.back-btn:hover {
    background: #d1d5d9;
}

.batch-progress {
    padding: 0.75rem 0 0.5rem;
    margin-bottom: 0.5rem;
}

.batch-progress-text {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--dark);
    margin-bottom: 0.4rem;
    font-family: 'Raleway', sans-serif;
}

.batch-progress-bar-wrap {
    width: 100%;
    height: 6px;
    background: var(--gray-light);
    border-radius: 3px;
    overflow: hidden;
}

.batch-progress-bar {
    height: 100%;
    background: var(--sunset);
    border-radius: 3px;
    transition: width 0.3s ease;
}

@media (max-width: 768px) {

    .admin-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .items-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .admin-tabs {
        overflow-x: auto;
    }

    .tab-btn {
        white-space: nowrap;
        font-size: 0.85rem;
        padding: 0.7rem 1rem;
    }

    .modal {
        width: 95%;
        max-height: 95vh;
    }
}

.upload-progress-area {
    padding: 1rem 1.5rem;
    background: var(--white);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.upload-progress-entry {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
}

.upload-progress-bar-wrap {
    flex: 1;
    height: 8px;
    background: var(--gray-light);
    border-radius: 4px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    width: 0;
    background: var(--sky);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.upload-status {
    min-width: 140px;
    font-size: 0.8rem;
    text-align: right;
    color: var(--gray);
}

.upload-status.upload-success {
    color: var(--success);
    font-weight: 600;
}

.upload-status.upload-error {
    color: var(--danger);
    font-weight: 600;
}

.upload-preview {
    text-align: center;
    margin-bottom: 1rem;
}

.upload-preview-media {
    max-width: 100%;
    max-height: 250px;
    border-radius: 8px;
    object-fit: contain;
    background: var(--gray-light);
}

.auto-tags-info {
    background: #e8f4fd;
    color: var(--lake);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.section-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    color: var(--lake);
    border-bottom: 1px solid var(--gray-light);
    padding-bottom: 0.25rem;
}

.tag-picker {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 0.5rem;
    background: var(--white);
}

.tag-pills-area {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--sky);
    color: var(--white);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.tag-pill-remove {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
}

.tag-pill-remove:hover {
    opacity: 1;
}

.tag-input-wrap {
    position: relative;
}

.tag-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 0.85rem;
    padding: 0.25rem 0;
    font-family: 'Raleway', sans-serif;
}

.tag-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 180px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.tag-dropdown-item {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.tag-dropdown-item:hover {
    background: var(--gray-light);
}

.tag-dropdown-create {
    color: var(--sky);
    font-weight: 600;
    font-style: italic;
}

.gallery-entries {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.gallery-entry {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.gallery-name-input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: 'Raleway', sans-serif;
}

.gallery-remove-btn {
    background: var(--danger);
    color: var(--white);
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-remove-btn:hover {
    background: var(--danger-hover);
}

.gallery-add-btn {
    background: none;
    border: 1px dashed var(--sky);
    color: var(--sky);
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    align-self: flex-start;
}

.gallery-add-btn:hover {
    background: #e8f4fd;
}

.media-card-thumb-wrap {
    width: 100%;
    max-height: 180px;
    overflow: hidden;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    background: var(--gray-light);
}

.media-card-thumb {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.media-type-badge {
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.photo-badge {
    background: var(--sky) !important;
    color: var(--white) !important;
}

.video-badge {
    background: var(--sunset) !important;
    color: var(--white) !important;
}

.media-card-warning {
    background: #fff3cd;
    color: #856404;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
}

.media-card-galleries,
.media-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.3rem;
    margin-bottom: 0.3rem;
}

.gallery-badge {
    background: var(--pine);
    color: var(--white);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 500;
}

.tag-badge {
    background: var(--gray-light);
    color: var(--dark);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.72rem;
}

.query-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.query-controls {
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    padding: 1rem 1.2rem;
}

.query-control-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.query-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.query-field label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.query-field select,
.query-field input[type="number"] {
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--gray-light);
    border-radius: 5px;
    font-family: 'Raleway', sans-serif;
    font-size: 0.9rem;
    background: var(--birch);
    color: var(--dark);
    min-width: 160px;
}

.query-field input[type="number"] {
    min-width: 80px;
    max-width: 100px;
}

.query-editor-area {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.query-input-group {
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    padding: 0.8rem 1rem;
}

.query-input-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--lake);
    margin-bottom: 0.4rem;
}

.query-hint {
    font-weight: 400;
    color: var(--gray);
    font-size: 0.75rem;
}

.query-textarea {
    width: 100%;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.88rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--gray-light);
    border-radius: 5px;
    background: #1e1e2e;
    color: #cdd6f4;
    resize: vertical;
    line-height: 1.5;
    tab-size: 2;
}

.query-textarea:focus {
    outline: none;
    border-color: var(--sky);
    box-shadow: 0 0 0 2px rgba(95, 168, 211, 0.25);
}

.query-textarea::placeholder {
    color: #585b70;
}

.query-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.query-status {
    font-size: 0.85rem;
    color: var(--gray);
    font-style: italic;
}

.query-status.error {
    color: var(--danger);
    font-style: normal;
    font-weight: 500;
}

.query-output {
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    overflow: hidden;
}

.query-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: var(--lake);
    color: var(--white);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.query-result-count {
    font-weight: 400;
    opacity: 0.85;
}

.query-results {
    padding: 1rem;
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.84rem;
    background: #1e1e2e;
    color: #cdd6f4;
    line-height: 1.55;
    max-height: 500px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.gallery-view {
    display: none;
}

.gallery-view.active {
    display: block;
}

.manage-btn {
    padding: 0.5rem 1rem;
    background: var(--sky);
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    font-family: 'Raleway', sans-serif;
    transition: background 0.2s;
}

.manage-btn:hover {
    background: var(--sky-hover);
}

.gallery-manage-header {
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.gallery-manage-header h2 {
    flex: 1;
    min-width: 200px;
}

.gallery-manage-meta {
    color: var(--gray);
    font-size: 0.85rem;
    font-family: 'Courier New', Courier, monospace;
}

.gallery-manage-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.gallery-manage-pane {
    background: var(--white);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
}

.gallery-manage-pane h3 {
    color: var(--lake);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.gallery-manage-hint {
    color: var(--gray);
    font-size: 0.78rem;
    margin-bottom: 0.5rem;
}

.gallery-manage-search {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: 'Raleway', sans-serif;
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
}

.gallery-manage-search:focus {
    outline: none;
    border-color: var(--sky);
}

.gallery-manage-list {
    overflow-y: auto;
    max-height: 70vh;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    padding: 0.4rem;
    background: var(--birch);
}

.gallery-member-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.5rem;
    background: var(--white);
    border-radius: 6px;
    margin-bottom: 0.4rem;
    border: 1px solid transparent;
    transition: border-color 0.15s, background 0.15s;
}

.gallery-member-row:hover {
    border-color: var(--gray-light);
}

.gallery-member-row-member {
    cursor: grab;
}

.gallery-member-row-member:active {
    cursor: grabbing;
}

.gallery-member-handle {
    color: var(--gray);
    font-size: 1rem;
    user-select: none;
    padding: 0 0.25rem;
}

.gallery-member-thumb {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    background: var(--gray-light);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    font-size: 1.4rem;
}

.gallery-member-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-member-meta {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.gallery-member-meta strong {
    display: block;
    font-size: 0.9rem;
    color: var(--dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery-member-meta small {
    display: block;
    font-size: 0.72rem;
    color: var(--gray);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery-member-actions {
    flex-shrink: 0;
}

.add-btn-inline {
    background: var(--sky);
    color: var(--white);
    border: none;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.add-btn-inline:hover {
    background: var(--sky-hover);
}

.remove-btn-inline {
    background: var(--danger);
    color: var(--white);
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.remove-btn-inline:hover {
    background: var(--danger-hover);
}

.gallery-pill {
    background: var(--lake) !important;
}

.gallery-dropdown {
    max-height: 220px;
}

@media (max-width: 992px) {
    .gallery-manage-grid {
        grid-template-columns: 1fr;
    }

    .gallery-manage-list {
        max-height: 50vh;
    }
}

.admin-archive-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.25rem;
    align-items: start;
    margin-top: 1rem;
}

.admin-archive-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

.admin-archive-sidebar .sidebar-card {
    background: var(--white);
    border: 1px solid rgba(27, 73, 101, 0.12);
    border-radius: 6px;
    padding: 0.85rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.admin-archive-sidebar .sidebar-label {
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--lake);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-archive-sidebar .sidebar-card input[type="search"],
.admin-archive-sidebar .sidebar-card input[type="date"],
.admin-archive-sidebar .sidebar-card select {
    width: 100%;
    padding: 0.45rem 0.55rem;
    font-family: 'Raleway', sans-serif;
    font-size: 0.85rem;
    color: var(--dark);
    background: var(--birch);
    border: 1px solid rgba(27, 73, 101, 0.2);
    border-radius: 4px;
}

.admin-archive-sidebar .sidebar-card input:focus,
.admin-archive-sidebar .sidebar-card select:focus {
    outline: 2px solid var(--sky);
    outline-offset: 1px;
    border-color: var(--sky);
}

.admin-archive-sidebar .sidebar-filters {
    gap: 0.3rem;
}

.admin-archive-sidebar .filter-group {
    border-top: 1px solid rgba(27, 73, 101, 0.1);
    padding: 0.4rem 0;
}

.admin-archive-sidebar .filter-group:first-of-type {
    border-top: none;
    padding-top: 0;
}

.admin-archive-sidebar .filter-group summary {
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--lake);
    cursor: pointer;
    padding: 0.3rem 0;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.admin-archive-sidebar .filter-group summary::-webkit-details-marker {
    display: none;
}

.admin-archive-sidebar .filter-group summary::after {
    content: '+';
    color: var(--sunset);
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1;
    width: 1rem;
    text-align: center;
}

.admin-archive-sidebar .filter-group[open] summary::after {
    content: '\2212';
}

.admin-archive-sidebar .filter-body {
    padding: 0.4rem 0 0.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 220px;
    overflow-y: auto;
}

.admin-archive-sidebar .filter-radio,
.admin-archive-sidebar .filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--dark);
    cursor: pointer;
    line-height: 1.3;
}

.admin-archive-sidebar .filter-radio input,
.admin-archive-sidebar .filter-checkbox input {
    accent-color: var(--sunset);
    flex-shrink: 0;
}

.admin-archive-sidebar .filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    font-size: 0.72rem;
    color: var(--lake);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-archive-sidebar .filter-field input,
.admin-archive-sidebar .filter-field select {
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
}

.admin-archive-sidebar .filter-empty {
    font-size: 0.78rem;
    color: rgba(26, 26, 26, 0.5);
    font-style: italic;
}

.admin-archive-sidebar .reset-btn {
    margin-top: 0.4rem;
    background: transparent;
    color: var(--lake);
    border: 2px solid var(--lake);
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.admin-archive-sidebar .reset-btn:hover {
    background: var(--lake);
    color: var(--birch);
}

.admin-archive-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-archive-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--white);
    border: 1px solid rgba(27, 73, 101, 0.12);
    border-radius: 6px;
    padding: 0.6rem 0.9rem;
}

.admin-archive-results-meta {
    font-size: 0.85rem;
    color: var(--lake);
    font-weight: 500;
    min-height: 1.1rem;
}

.admin-archive-select-actions {
    display: flex;
    gap: 0.5rem;
}

.select-toggle-btn {
    background: transparent;
    color: var(--lake);
    border: 1px solid rgba(27, 73, 101, 0.3);
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    font-family: 'Raleway', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.select-toggle-btn:hover {
    background: var(--lake);
    color: var(--white);
}

.admin-bulk-bar {
    background: var(--lake);
    color: var(--white);
    border-radius: 6px;
    padding: 0.7rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 12px rgba(27, 73, 101, 0.25);
    position: sticky;
    top: 0.5rem;
    z-index: 50;
}

.admin-bulk-bar-summary {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--sand);
    flex-shrink: 0;
}

.admin-bulk-bar-versions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.admin-bulk-bar-versions .bulk-bar-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sand);
    font-weight: 600;
}

.admin-bulk-bar-versions label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--white);
    cursor: pointer;
}

.admin-bulk-bar-versions input[type="checkbox"] {
    accent-color: var(--sunset);
}

.admin-bulk-bar-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    flex-wrap: wrap;
}

.bulk-customize-btn {
    background: transparent;
    color: var(--sand);
    border: 1px solid var(--sand);
    padding: 0.45rem 0.85rem;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.bulk-customize-btn:hover,
.bulk-customize-btn.active {
    background: var(--sand);
    color: var(--lake);
}

.bulk-download-btn {
    background: var(--sunset);
    color: var(--white);
    border: none;
    padding: 0.45rem 1rem;
    border-radius: 5px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
}

.bulk-download-btn:hover {
    background: var(--sunset-hover);
}

.bulk-download-btn:disabled {
    background: var(--gray);
    cursor: not-allowed;
}

.admin-customize-panel {
    background: var(--white);
    border: 1px solid rgba(27, 73, 101, 0.15);
    border-radius: 6px;
    padding: 0.75rem 1rem;
}

.admin-customize-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.admin-customize-panel-header h3 {
    font-size: 1rem;
    color: var(--lake);
    margin: 0;
}

.customize-close-btn {
    background: transparent;
    border: none;
    color: var(--gray);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.admin-customize-panel-body {
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.customize-row {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.5rem;
    background: var(--birch);
    border-radius: 4px;
    font-size: 0.85rem;
}

.customize-row .customize-thumb {
    width: 36px;
    height: 36px;
    background: var(--gray-light);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.customize-row .customize-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.customize-row .customize-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--dark);
    font-weight: 600;
}

.customize-row .customize-versions {
    display: flex;
    gap: 0.6rem;
    white-space: nowrap;
}

.customize-row .customize-versions label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    color: var(--lake);
    cursor: pointer;
}

.customize-row .customize-versions input[type="checkbox"] {
    accent-color: var(--sunset);
}

.admin-archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.archive-shuffle {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.media-card {
    position: relative;
    cursor: pointer;
}

.media-card.selected {
    outline: 3px solid var(--sunset);
    outline-offset: -1px;
}

.media-card-select {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid var(--lake);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: background 0.15s, border-color 0.15s;
}

.media-card-select input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: var(--sunset);
    cursor: pointer;
}

.media-card.selected .media-card-select {
    background: var(--sunset);
    border-color: var(--sunset);
}

.media-card-hidden-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    z-index: 4;
}

.media-card-thumb-wrap {
    position: relative;
}

.download-menu-wrap {
    position: relative;
    display: inline-block;
}

.download-menu-toggle {
    background: var(--lake);
    color: var(--white);
    border: none;
    border-radius: 4px;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.download-menu-toggle:hover {
    background: var(--lake-light);
}

.download-menu {
    position: absolute;
    bottom: calc(100% + 4px);
    right: 0;
    background: var(--white);
    border: 1px solid rgba(27, 73, 101, 0.2);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.3rem 0;
    min-width: 180px;
    z-index: 30;
    display: none;
}

.download-menu.open {
    display: block;
}

.download-menu button {
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    padding: 0.45rem 0.85rem;
    font-size: 0.83rem;
    color: var(--dark);
    cursor: pointer;
    font-family: 'Raleway', sans-serif;
}

.download-menu button:hover {
    background: var(--birch);
    color: var(--lake);
}

.media-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 200;
    display: flex;
    justify-content: flex-end;
    overflow: hidden;
    overscroll-behavior: contain;
}

.media-drawer {
    width: min(1100px, 95vw);
    height: 100vh;
    max-height: 100vh;
    background: var(--white);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
    overflow: hidden;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.25);
}

@supports (height: 100svh) {
    .media-drawer {
        height: 100svh;
        max-height: 100svh;
    }
}

@supports (height: 100dvh) {
    .media-drawer {
        height: 100dvh;
        max-height: 100dvh;
    }
}

.media-drawer-preview {
    background: linear-gradient(180deg, #f6f8fa 0%, #e9eef2 100%);
    color: var(--dark);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    min-width: 0;
    min-height: 0;
}

.media-drawer-close {
    position: absolute;
    top: calc(0.6rem + env(safe-area-inset-top, 0));
    right: 0.6rem;
    background: rgba(27, 73, 101, 0.12);
    color: var(--lake);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
}

.media-drawer-close:hover {
    background: rgba(27, 73, 101, 0.22);
}

.media-drawer-preview-body {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    place-items: center;
    width: 100%;
    overflow: hidden;
    padding: 0.45rem;
}

.media-drawer-preview-body img,
.media-drawer-preview-body video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: auto;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(27, 73, 101, 0.12);
}

.media-drawer-preview-meta {
    padding: 0.6rem 0.4rem 0.2rem;
    font-size: 0.78rem;
    color: rgba(26, 26, 26, 0.72);
    text-align: center;
    word-break: break-all;
}

.media-drawer-panel {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-left: 1px solid rgba(27, 73, 101, 0.1);
    min-width: 0;
    min-height: 0;
}

.media-drawer-tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-light);
}

.drawer-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.75rem 0.5rem;
    font-family: 'Raleway', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.drawer-tab-btn.active {
    color: var(--lake);
    border-bottom-color: var(--sunset);
}

.media-drawer-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.media-drawer-tab-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 1rem 1.1rem;
    display: none;
}

.media-drawer-tab-content.active {
    display: block;
}

.media-drawer-footer {
    border-top: 1px solid var(--gray-light);
    padding: 0.7rem 1.1rem calc(0.7rem + env(safe-area-inset-bottom, 0));
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    background: var(--birch);
    flex-shrink: 0;
}

.metadata-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.metadata-table tr {
    border-bottom: 1px solid var(--gray-light);
}

.metadata-table tr:last-child {
    border-bottom: none;
}

.metadata-table th {
    text-align: left;
    padding: 0.45rem 0.6rem 0.45rem 0;
    font-weight: 600;
    color: var(--lake);
    width: 45%;
    vertical-align: top;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.metadata-table td {
    padding: 0.45rem 0;
    color: var(--dark);
    word-break: break-word;
}

.drawer-files-section {
    margin-bottom: 1.25rem;
}

.drawer-files-section h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--lake);
    margin-bottom: 0.5rem;
}

.drawer-files-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.drawer-file-btn {
    background: var(--lake);
    color: var(--white);
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.15s;
}

.drawer-file-btn:hover {
    background: var(--lake-light);
}

.drawer-file-btn.secondary {
    background: var(--sunset);
}

.drawer-file-btn.secondary:hover {
    background: var(--sunset-hover);
}

.drawer-replace-block {
    background: var(--birch);
    border: 1px dashed rgba(27, 73, 101, 0.3);
    border-radius: 6px;
    padding: 0.85rem;
}

.drawer-replace-block p {
    font-size: 0.82rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.drawer-replace-status {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--lake);
}

.drawer-replace-status.error {
    color: var(--danger);
}

.drawer-replace-status.success {
    color: var(--success);
}

@media (max-width: 992px) {
    .admin-archive-layout {
        grid-template-columns: 1fr;
    }

    .admin-archive-sidebar {
        position: static;
        max-height: none;
    }

    .media-drawer {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(210px, 36vh) minmax(0, 1fr);
        width: 100vw;
        max-width: none;
    }

    .media-drawer-preview {
        padding: 0.85rem 0.9rem 0.6rem;
    }
}

@supports (height: 100svh) {
    @media (max-width: 992px) {
        .media-drawer {
            grid-template-rows: minmax(210px, 36svh) minmax(0, 1fr);
        }
    }
}

@supports (height: 100dvh) {
    @media (max-width: 992px) {
        .media-drawer {
            grid-template-rows: minmax(210px, 36dvh) minmax(0, 1fr);
        }
    }
}

/* ---------- Mobile / tablet polish (additive) ---------- */

@media (max-width: 768px) {
    .form-group input,
    .form-group select,
    .form-group textarea,
    .tag-input,
    .gallery-name-input,
    .gallery-manage-search,
    .query-textarea,
    .query-field input[type="number"],
    .query-field select,
    .admin-archive-sidebar .sidebar-card input[type="search"],
    .admin-archive-sidebar .sidebar-card input[type="date"],
    .admin-archive-sidebar .sidebar-card select,
    .admin-archive-sidebar .filter-field input,
    .admin-archive-sidebar .filter-field select {
        font-size: 16px;
    }
}

body.drawer-open {
    position: fixed;
    width: 100%;
    overflow: hidden;
}

