/* AkkaPrints Canva-Like Editor Styles (Light Premium Theme) */

/* Hide the WP Admin Bar in editor to give full screen */
#wpadminbar {
    display: none !important;
}
html {
    margin-top: 0 !important;
}

.akka-editor-body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main, 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.akka-editor-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* ── Top Header ── */
.akka-editor-header {
    height: 60px;
    background-color: var(--bg-surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 20;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); /* Very subtle shadow */
}

.header-left, .header-center, .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-center {
    gap: 8px;
}

.back-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.back-btn:hover {
    color: var(--text-main);
    background: var(--bg-main);
}

.divider {
    height: 24px;
    width: 1px;
    background: var(--border);
}

.product-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-main);
}

.product-price {
    font-weight: 600;
    color: #4b5563;
    margin-right: 8px;
}

/* Undo Redo Buttons */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    color: var(--text-main);
    background: var(--bg-main);
}

.icon-btn:disabled {
    color: #d1d5db;
    cursor: not-allowed;
    background: transparent;
}

.akka-save-btn {
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 2px 4px rgba(255, 77, 46, 0.2);
}

.akka-save-btn:hover {
    background: var(--brand-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(255, 77, 46, 0.25);
}


/* ── Main Layout ── */
.akka-editor-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* ── Left Slim Sidebar ── */
.akka-slim-sidebar {
    width: 80px;
    min-width: 80px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 8px;
    z-index: 60; /* Above the drawer */
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.sidebar-divider {
    width: 60%;
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.sidebar-btn, .upload-label {
    background: transparent;
    border: none;
    color: #4b5563;
    width: 68px;
    height: 68px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-btn i {
    font-size: 26px;
}

.sidebar-btn span {
    font-size: 11px;
    font-weight: 500;
}

.sidebar-btn:hover {
    color: var(--brand);
    background: var(--brand-light); /* Very light orange tint */
}

.upload-label {
    text-align: center;
}


/* ── Workspace ── */
.akka-workspace {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-main);
    overflow: hidden;
}

/* ── Contextual Toolbar ── */
.akka-context-bar {
    height: 0;
    overflow: hidden;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    z-index: 15;
    flex-shrink: 0;
    transition: height 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
}

.akka-context-bar.is-active {
    height: 56px;
    opacity: 1;
    pointer-events: auto;
    overflow: visible;
}

.context-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.context-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 8px;
}

/* Tool Inputs */
.context-select {
    padding: 8px 30px 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: var(--bg-surface);
    font-size: 13px;
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
    outline: none;
    min-width: 170px;
    max-width: 200px;
    transition: border-color 0.2s;
}

.context-select:hover, .context-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(255,77,46,0.1);
}

.context-input {
    width: 64px;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
    color: var(--text-main);
    font-weight: 500;
    transition: border-color 0.2s;
}

.context-input:hover, .context-input:focus {
    border-color: #9ca3af;
    outline: none;
}

.context-icon-btn {
    background: transparent;
    border: none;
    color: #4b5563;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
}

.context-icon-btn:hover {
    background: var(--bg-main);
    color: var(--text-main);
}

.context-icon-btn.is-active {
    background: var(--brand-light);
    color: var(--brand);
}

.context-icon-btn.danger:hover {
    color: #dc2626;
    background: #fef2f2;
}

/* Color Picker & Swatches */
.color-tools-group {
    background: var(--bg-main);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.color-swatches {
    display: flex;
    gap: 8px;
    align-items: center;
}

.swatch-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    padding: 0;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.swatch-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.color-picker-wrapper {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid transparent;
}

.color-picker-wrapper:hover {
    background: var(--bg-main);
    border-color: var(--border);
}

.color-preview {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #000; /* Default */
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05); /* Inner Depth */
}

input[type="color"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    cursor: pointer;
}


/* ── Canvas Area ── */
.akka-canvas-area {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background-color: var(--bg-main);
    /* Soft Light Dot Grid Background */
    background-image: radial-gradient(#d1d5db 1px, transparent 1px);
    background-size: 20px 20px;
}

.canvas-wrapper {
    background: var(--bg-surface);
    box-shadow: 0 20px 50px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.05);
    transition: transform 0.2s ease-out;
}

/* Loading Overlay */
#akka_loading_overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    backdrop-filter: blur(5px);
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 77, 46, 0.2);
    border-left-color: var(--brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   MOBILE HOMEPAGE / EDITOR RESPONSIVENESS
========================================================================== */
@media (max-width: 768px) {
    .akka-editor-header {
        padding: 0 12px;
    }
    
    .product-title {
        display: none; /* Save space on mobile header */
    }
    
    .header-center {
        display: none; /* Hide global undo/redo to save top space */
    }

    .akka-save-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Convert Side Menu into Bottom Tab Bar */
    .akka-editor-main {
        display: block;
    }

    .akka-workspace {
        height: calc(100vh - 60px - 70px - env(safe-area-inset-bottom, 16px));
        height: calc(100dvh - 60px - 70px - env(safe-area-inset-bottom, 16px));
    }

    .akka-slim-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: calc(70px + env(safe-area-inset-bottom, 16px));
        padding-bottom: env(safe-area-inset-bottom, 16px);
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        padding-top: 0;
        padding-left: 0;
        padding-right: 0;
        border-right: none;
        border-top: 1px solid var(--border);
        z-index: 50;
        background-color: var(--bg-surface);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05); /* Extra separation */
    }

    .sidebar-btn, .upload-label {
        width: auto;
        height: 100%;
        flex: 1;
        border-radius: 0;
    }

    .sidebar-divider {
        display: none;
    }

    /* Mobile Toolbar: swipeable inline bar at top of workspace */
    .akka-context-bar {
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        padding: 0 12px;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
        height: 0;
    }
    .akka-context-bar.is-active {
        height: 52px;
    }
    .akka-context-bar::-webkit-scrollbar {
        display: none;
    }

    .context-group {
        flex-shrink: 0;
    }

    .akka-canvas-area {
        padding: 16px; 
    }
}


/* ══════════════════════════════════════════
   TEMPLATES DRAWER
   ══════════════════════════════════════════ */

.akka-templates-drawer {
    position: fixed;
    top: 60px; /* Header height */
    left: 80px; /* Sidebar width */
    width: 300px;
    height: calc(100vh - 60px);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 20px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    z-index: 50;
    /* Start fully off-screen to the left — behind the sidebar */
    transform: translateX(calc(-100% - 80px));
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    visibility: hidden;
}

.akka-templates-drawer.is-open {
    transform: translateX(0);
    pointer-events: all;
    visibility: visible;
}

/* Drawer Header */
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--bg-main);
    flex-shrink: 0;
}

.drawer-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.drawer-close-btn {
    background: var(--bg-main);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    transition: all 0.15s;
}
.drawer-close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Category Tabs */
.drawer-cats {
    display: flex;
    gap: 6px;
    padding: 12px 12px 0;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.drawer-cat-btn {
    background: var(--bg-main);
    border: none;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.drawer-cat-btn:hover {
    background: #ffede9;
    color: var(--brand);
}
.drawer-cat-btn.active {
    background: var(--brand);
    color: var(--bg-surface);
}

/* Template Grid (Scrollable) */
.drawer-grid {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-content: start;
}

.drawer-grid::-webkit-scrollbar { width: 4px; }
.drawer-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Individual Template Card */
.template-card {
    border: 1.5px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-main);
}

.template-card:hover {
    border-color: var(--brand);
    box-shadow: 0 4px 16px rgba(255,77,46,0.15);
    transform: translateY(-2px);
}

.template-card.loading {
    opacity: 0.6;
    pointer-events: none;
    border-color: var(--brand);
}

.template-thumb {
    width: 100%;
    aspect-ratio: 3/2;
    overflow: hidden;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d1d5db;
    font-size: 32px;
}

.template-title {
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    padding: 6px 8px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading & Empty States */
.drawer-loading,
.drawer-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #9ca3af;
    text-align: center;
    gap: 12px;
}

.drawer-empty p {
    font-size: 13px;
    line-height: 1.5;
}

/* Spin animation for loader */
@keyframes akka-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}


/* ══════════════════════════════════════════
   TOAST NOTIFICATION
   ══════════════════════════════════════════ */
.akka-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-main);
    color: var(--bg-surface);
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.akka-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* ══════════════════════════════════════════
   USER DATA FORM OVERLAY
   ══════════════════════════════════════════ */
.akka-form-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.akka-form-card {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255,255,255,0.1);
    overflow: hidden;
    animation: formSlideUp 0.4s ease-out;
}

@keyframes formSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-card-header {
    background: linear-gradient(135deg, var(--brand), var(--brand-hover));
    padding: 28px 28px 24px;
    text-align: center;
    color: #fff;
}

.form-card-icon {
    width: 56px; height: 56px;
    background: rgba(255,255,255,0.2);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 12px;
    color: #fff;
}

.form-card-header h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
}

.form-card-subtitle {
    margin: 0;
    font-size: 13px;
    opacity: 0.85;
    line-height: 1.5;
}

.form-card-body {
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 55vh;
    overflow-y: auto;
}

.form-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-field-group label {
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-field-group label .optional-tag {
    font-weight: 400;
    font-size: 11px;
    color: #9ca3af;
    font-style: italic;
}

.form-field-group input,
.form-field-group textarea {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    background: #fafafa;
}

.form-field-group input:focus,
.form-field-group textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(255, 77, 46, 0.1);
    background: #fff;
}

.form-field-group .upload-preview {
    width: 80px; height: 80px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--border);
    display: none;
    margin-top: 6px;
}

.form-card-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--bg-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.akka-btn {
    background: linear-gradient(135deg, var(--brand), var(--brand-hover));
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(255, 77, 46, 0.25);
}

.akka-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 77, 46, 0.35);
}

.akka-btn-secondary {
    background: var(--bg-main);
    color: #4b5563;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.akka-btn-secondary:hover {
    background: var(--border);
    color: var(--text-main);
}

.akka-btn-sm {
    background: var(--bg-main);
    color: #374151;
    border: 1px solid var(--border);
    padding: 8px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.15s;
}

.akka-btn-sm:hover {
    background: var(--brand-light);
    color: var(--brand);
    border-color: #ffcfc5;
}


/* ══════════════════════════════════════════
   SIZE CONFIGURATOR PRESETS
   ══════════════════════════════════════════ */
.size-preset-btn {
    background: var(--bg-main);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s;
}

.size-preset-btn:hover {
    background: #f0f9ff;
    border-color: var(--brand);
    color: var(--brand);
}

.size-preset-btn.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}


/* ══════════════════════════════════════════
   DRAWER SECTION TITLES
   ══════════════════════════════════════════ */
.drawer-section-title {
    padding: 10px 16px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
}


/* ══════════════════════════════════════════
   FIELD BUILDER CARDS
   ══════════════════════════════════════════ */
.field-card {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.field-card-header span {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 4px;
}

.field-card-type {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    background: #dbeafe;
    color: #2563eb;
}

.field-card-type.image { background: var(--brand-light); color: var(--brand); }
.field-card-type.qr_code { background: #d1fae5; color: #059669; }
.field-card-type.barcode { background: #fef3c7; color: #d97706; }

.field-card input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
}

.field-card-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.field-card-controls label {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.field-card-delete {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
}

.field-card-delete:hover {
    color: #dc2626;
}

/* ══════════════════════════════════════════
   FORM VALIDATION ERROR STATE
   ══════════════════════════════════════════ */
.form-field-group.has-error input,
.form-field-group.has-error textarea {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

.form-field-group input[type="file"] {
    padding: 8px;
    background: #fff;
    border: 1.5px dashed #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
}
.form-field-group input[type="file"]:hover {
    border-color: var(--brand);
    background: var(--brand-light);
}
.form-field-group.has-error input[type="file"] {
    border-color: #ef4444 !important;
    background: #fff5f5;
}

/* Footer stacked for error message space */
.form-card-footer {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

/* Bg drawer section height limit */
.drawer-section-title + .drawer-grid {
    max-height: 160px;
    flex: none;
    overflow-y: auto;
}

/* ══════════════════════════════════════════
   FIELD BUILDER DRAWER — Scroll Fix
   ══════════════════════════════════════════ */

/* Scrollable body — grows to fill remaining height */
.field-drawer-body {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    min-height: 0; /* Critical: allows flex child to shrink below content size */
    max-height: 100%;
}

.field-drawer-body::-webkit-scrollbar {
    width: 6px;
}
.field-drawer-body::-webkit-scrollbar-thumb {
    background: #cdd2d8;
    border-radius: 6px;
}

/* Fixed footer — always pinned at bottom, never scrolls away */
.field-drawer-footer {
    flex-shrink: 0;
    padding: 12px;
    border-top: 1px solid var(--bg-main);
    background: var(--bg-surface);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}
