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

:root {
    --bg: #080b12;
    --bg2: #0d1220;
    --bg3: #131a2e;
    --border: #1a2540;
    --border2: #253352;
    --text: #c8d0e0;
    --text2: #7889a8;
    --text3: #4a5670;
    --accent: #4fc3f7;
    --accent2: #29b6f6;
    --accent-dim: rgba(79,195,247,0.15);
    --danger: #ef5350;
    --success: #66bb6a;
    --warning: #ffa726;
    --pink: #ec407a;
    --gold: #ffd54f;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

canvas { touch-action: none; }

.hidden { display: none !important; }

/* ====== REFINED MEDICAL UPLOAD SCREEN ====== */
.screen { width: 100%; height: 100vh; }

#upload-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
    position: relative;
    overflow: hidden;
}

/* Subtle diagonal accent band */
#upload-screen::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 60%;
    height: 140%;
    background: linear-gradient(135deg, transparent 0%, rgba(79,195,247,0.06) 50%, transparent 100%);
    transform: rotate(-8deg);
    pointer-events: none;
    z-index: 0;
}

#upload-screen::after { display: none; }

.upload-wrapper {
    text-align: center;
    max-width: 540px;
    width: 100%;
    padding: 40px 32px;
    background: #fff;
    border-radius: 24px;
    box-shadow:
        0 1px 2px rgba(15,23,42,0.04),
        0 12px 40px rgba(15,23,42,0.08),
        0 2px 8px rgba(15,23,42,0.03);
    position: relative;
    z-index: 1;
    border: 1px solid rgba(15,23,42,0.04);
}

.brand {
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

.brand-logo {
    font-size: 2.8rem;
    color: #0ea5e9;
    margin-bottom: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 20px;
    border: 1px solid #bae6fd;
}

.brand h1 {
    font-size: 1.7rem;
    font-weight: 300;
    color: #0f172a;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.brand h1 span {
    font-weight: 600;
    color: #0ea5e9;
    letter-spacing: -0.5px;
}

.brand p {
    color: #64748b;
    font-size: 0.85rem;
    margin-bottom: 0;
    font-weight: 400;
}

.brand::after { display: none; }

/* Only show "Tomar Foto" on touch devices (mobile/tablet) */
@media (hover: hover) and (pointer: fine) {
    #btn-camera { display: none; }
}

.upload-zone {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    padding: 40px 24px;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fafbfc;
}

.upload-zone:hover {
    border-color: #0ea5e9;
    background: #f0f9ff;
}

.upload-zone::before { display: none; }

.upload-icon-fa {
    font-size: 2.2rem;
    color: #0ea5e9;
    margin-bottom: 14px;
    display: block;
}

.upload-main-text {
    color: #0f172a;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.upload-hint {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 400;
}

.mode-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0 18px;
}

.mode-btn {
    flex: 1;
    max-width: 220px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    color: #64748b;
    padding: 14px 18px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mode-btn:hover {
    border-color: #0ea5e9;
    background: #f0f9ff;
    color: #0f172a;
}

.mode-btn.active {
    background: #f0f9ff;
    border-color: #0ea5e9;
    color: #0f172a;
    box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

.mode-btn i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 1rem;
    color: #0ea5e9;
    background: #e0f2fe;
    border-radius: 9px;
    flex-shrink: 0;
}

.mode-btn.active i {
    background: #0ea5e9;
    color: #fff;
}

.mode-btn span {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
}

.mode-btn small {
    display: block;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 2px;
    font-weight: 400;
}

.preset-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    margin-bottom: 2px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s;
}

.preset-item:hover { border-color: var(--accent); background: var(--accent-dim); }
.preset-item .preset-name { flex: 1; color: var(--text); }
.preset-item .preset-count { color: var(--text3); font-size: 0.65rem; }
.preset-item .preset-delete {
    background: transparent; border: none; color: var(--text3);
    cursor: pointer; padding: 2px 4px; font-size: 0.7rem;
}
.preset-item .preset-delete:hover { color: var(--danger); }

.upload-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 14px;
}

.load-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155;
    padding: 10px 18px;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.load-btn:hover {
    border-color: #0ea5e9;
    background: #f0f9ff;
    color: #0ea5e9;
}

.load-btn i { color: #0ea5e9; font-size: 0.85rem; }

.upload-tips {
    display: flex;
    gap: 18px;
    justify-content: center;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.tip {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 400;
}

.tip i {
    color: #10b981;
    font-size: 0.7rem;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin: 8px 0;
}

.prop-action-sm {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text2);
    padding: 5px 4px;
    border-radius: 5px;
    font-size: 0.65rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: all 0.15s;
}

.prop-action-sm:hover { border-color: var(--accent); color: var(--accent); }

.phase-tabs {
    display: flex;
    gap: 3px;
}

.phase-tab {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text3);
    padding: 5px 4px;
    border-radius: 5px;
    font-size: 0.65rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}

.phase-tab:hover { border-color: #7c4dff; color: #7c4dff; }
.phase-tab.active { background: rgba(124,77,255,0.15); border-color: #7c4dff; color: #7c4dff; }
.phase-tab i { display: block; font-size: 0.8rem; margin-bottom: 2px; }
.prop-action-sm i { font-size: 0.8rem; }

.load-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 20px auto 0;
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--accent);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.load-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.upload-tips {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 28px;
}

.tip {
    font-size: 0.75rem;
    color: var(--text3);
}

.tip i { color: var(--success); margin-right: 4px; }

/* ====== TOP BAR ====== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 0 12px;
    z-index: 100;
}

.top-left, .top-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-mini {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    margin-left: 4px;
}

.brand-mini i { margin-right: 4px; }

.icon-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text2);
    width: 34px;
    height: 34px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-size: 0.85rem;
}

.icon-btn:hover { background: var(--bg3); color: #fff; }
.icon-btn:disabled { opacity: 0.3; pointer-events: none; }

.separator {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.action-btn {
    background: var(--accent);
    color: var(--bg);
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

.action-btn:hover { background: var(--accent2); }
.action-btn.secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.action-btn.secondary:hover { background: var(--border); }

/* Tool Tabs */
.tool-tabs {
    display: flex;
    gap: 2px;
}

.tab {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text2);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    transition: all 0.15s;
    position: relative;
}

.tab:hover { background: var(--bg3); color: var(--text); }

.tab.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.tab kbd {
    font-size: 0.6rem;
    background: var(--bg);
    color: var(--text3);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: inherit;
}

.tab.active kbd { background: rgba(79,195,247,0.2); color: var(--accent); }

.tab i { font-size: 0.8rem; }

/* ====== EDITOR BODY ====== */
.editor-body {
    display: flex;
    height: calc(100vh - 48px - 28px);
}

/* Panels */
.panel {
    width: 240px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
}

.right-panel {
    border-right: none;
    border-left: 1px solid var(--border);
}

.panel-section {
    padding: 14px;
    border-bottom: 1px solid var(--border);
}

.panel-section h3 {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 500;
}

.panel-section h3 i { margin-right: 5px; width: 14px; text-align: center; }

/* Toggle rows */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 0.8rem;
    color: var(--text2);
    cursor: pointer;
}

.toggle-row:hover { color: var(--text); }

.toggle-row input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
}

/* Tooth Library */
.tooth-library {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.lib-tooth {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 2px 4px;
    cursor: pointer;
    text-align: center;
    color: var(--text2);
    transition: all 0.15s;
}

.lib-tooth:hover { border-color: var(--accent); color: var(--accent); }
.lib-tooth.active { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

.lib-tooth svg { width: 22px; height: 32px; display: block; margin: 0 auto 3px; }
.lib-tooth span { font-size: 0.6rem; }

/* Canvas Area */
.canvas-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #060810;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-area canvas {
    position: absolute;
}

#guide-canvas { z-index: 2; pointer-events: none; }
#overlay-canvas { z-index: 3; }
#measure-canvas { z-index: 4; pointer-events: none; }

.canvas-status {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(13,18,32,0.9);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.7rem;
    color: var(--text2);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}

.status-dot.detecting { background: var(--warning); animation: pulse 1s infinite; }

@keyframes pulse {
    0%,100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.zoom-bar {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(13,18,32,0.9);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 20;
}

.zoom-bar button {
    background: transparent;
    border: none;
    color: var(--text2);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-bar button:hover { background: var(--bg3); color: #fff; }
#zoom-level { font-size: 0.7rem; color: var(--text3); min-width: 36px; text-align: center; }

/* ====== RIGHT PANEL PROPS ====== */
.prop-panel {
    padding: 14px;
    border-bottom: 1px solid var(--border);
}

.prop-panel h3 {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    font-weight: 500;
}

.prop-panel h3 i { margin-right: 5px; }

.prop-panel h4 {
    font-size: 0.7rem;
    color: var(--text3);
    margin: 12px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prop-row {
    margin-bottom: 10px;
}

.prop-row label {
    display: block;
    font-size: 0.72rem;
    color: var(--text2);
    margin-bottom: 3px;
}

.prop-row input[type="range"] {
    width: calc(100% - 40px);
    accent-color: var(--accent);
    height: 4px;
    vertical-align: middle;
}

.prop-row select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
}

.val {
    font-size: 0.7rem;
    color: var(--text3);
    display: inline-block;
    width: 36px;
    text-align: right;
}

.prop-action {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
}

.prop-action:hover { border-color: var(--accent); color: var(--accent); }
.prop-action.secondary { color: var(--text3); }
.prop-action.secondary:hover { color: var(--danger); border-color: var(--danger); }

.prop-action.ai-btn {
    background: linear-gradient(135deg, #1a3a5f 0%, #0d2240 100%);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.prop-action.ai-btn:hover {
    background: linear-gradient(135deg, #1e4a70 0%, #1a3a5f 100%);
    color: #fff;
    box-shadow: 0 0 12px rgba(79,195,247,0.3);
}

.prop-action.ai-btn.primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
    color: var(--bg);
    border: none;
    font-size: 0.9rem;
    padding: 10px;
}

.prop-action.ai-btn.primary:hover {
    box-shadow: 0 0 20px rgba(79,195,247,0.5);
    transform: translateY(-1px);
}

.hint-text { font-size: 0.72rem; color: var(--text3); line-height: 1.4; }

/* Shade Grid */
.shade-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
}

.shade-btn {
    border: 2px solid transparent;
    border-radius: 3px;
    padding: 3px 1px;
    font-size: 0.55rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.15s;
}

.shade-btn:hover { border-color: var(--accent); transform: scale(1.1); }
.shade-btn.active { border-color: var(--accent); box-shadow: 0 0 8px var(--accent-dim); }

/* ====== STATUS BAR ====== */
.status-bar {
    height: 28px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    font-size: 0.7rem;
    color: var(--text3);
}

.sep { margin: 0 8px; color: var(--border); }

/* ====== OVERLAYS ====== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8,11,18,0.95);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.overlay-header h2 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #fff;
}

.overlay-header h2 i { color: var(--accent); margin-right: 8px; }

.compare-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.compare-slider {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--border);
    cursor: ew-resize;
    max-width: 900px;
    max-height: 70vh;
}

.compare-slider canvas {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

#after-canvas {
    position: absolute;
    top: 0;
    left: 0;
    clip-path: inset(0 0 0 50%);
}

.slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.slider-line {
    width: 2px;
    height: 100%;
    background: var(--accent);
    margin: 0 auto;
    box-shadow: 0 0 10px rgba(79,195,247,0.5);
}

.slider-grip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
    font-size: 0.9rem;
    box-shadow: 0 0 16px rgba(79,195,247,0.4);
}

.compare-view-toggle {
    display: flex;
    gap: 4px;
}

.toggle-btn {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text2);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.toggle-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.toggle-btn:hover { background: var(--border); color: #fff; }

.compare-side {
    display: flex;
    gap: 16px;
    max-width: 1200px;
    width: 100%;
}

.side-panel {
    flex: 1;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.side-panel canvas {
    width: 100%;
    display: block;
}

.side-label {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.7rem;
    letter-spacing: 2px;
    z-index: 5;
}

.compare-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 900px;
    padding: 10px 0;
    font-size: 0.8rem;
    color: var(--text3);
    letter-spacing: 2px;
}

.overlay-footer {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 16px;
    border-top: 1px solid var(--border);
}

/* Export options */
.export-options {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 40px;
}

.export-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px 24px;
    width: 200px;
    cursor: pointer;
    text-align: center;
    color: var(--text);
    transition: all 0.2s;
}

.export-card:hover { border-color: var(--accent); transform: translateY(-4px); }

.export-card i {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 12px;
}

.export-card span { display: block; font-size: 1rem; font-weight: 500; margin-bottom: 4px; }
.export-card small { font-size: 0.75rem; color: var(--text3); }

/* Loading */
#loading-overlay {
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-content p { color: var(--accent); font-size: 0.9rem; }

/* ====== DESIGNS MODAL — Premium picker ====== */
.designs-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.designs-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8, 11, 18, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.designs-modal-content {
    position: relative;
    background: #fff;
    color: #0f172a;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    border-radius: 20px;
    box-shadow: 0 40px 100px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalScaleIn 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes modalScaleIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.designs-modal-header {
    padding: 24px 28px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.designs-modal-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 3px;
    letter-spacing: -0.3px;
}

.designs-modal-header p {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 400;
}

.designs-modal-close {
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.15s;
}

.designs-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.designs-modal-search {
    padding: 14px 24px;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
    display: flex;
    align-items: center;
}

.designs-modal-search i {
    position: absolute;
    left: 36px;
    color: #94a3b8;
    font-size: 0.85rem;
    pointer-events: none;
}

.designs-modal-search input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #0f172a;
    background: #f8fafc;
    outline: none;
    transition: all 0.15s;
    font-family: inherit;
}

.designs-modal-search input:focus {
    border-color: #0ea5e9;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

.designs-grid {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.designs-empty {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

.design-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.19, 1, 0.22, 1);
    display: flex;
    flex-direction: column;
}

.design-card:hover {
    border-color: #0ea5e9;
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(14,165,233,0.15), 0 4px 10px rgba(15,23,42,0.06);
}

.design-thumb {
    position: relative;
    width: 100%;
    padding-bottom: 75%;
    background: #f1f5f9;
    overflow: hidden;
}

.design-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.design-thumb i {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #cbd5e1;
}

.design-delete, .design-edit {
    position: absolute;
    top: 8px;
    background: rgba(15,23,42,0.75);
    color: #fff;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    opacity: 0;
    transition: all 0.15s;
    z-index: 2;
}

.design-delete { right: 8px; }
.design-edit { right: 44px; }

.design-card:hover .design-delete,
.design-card:hover .design-edit {
    opacity: 1;
}

.design-delete:hover {
    background: #ef4444;
}

.design-edit:hover {
    background: #0ea5e9;
}

.design-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 24px 14px 10px;
    background: linear-gradient(to top, rgba(8,11,18,0.88) 0%, rgba(8,11,18,0.55) 55%, transparent 100%);
    color: #fff;
    pointer-events: none;
}

.design-overlay-primary {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.2px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.design-overlay-sub {
    font-size: 0.72rem;
    opacity: 0.88;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.design-info {
    padding: 10px 14px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.design-meta {
    display: flex;
    gap: 10px;
    font-size: 0.7rem;
    color: #94a3b8;
}

.design-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.design-meta i {
    font-size: 0.65rem;
}

.design-stats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.design-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 100px;
    font-size: 0.68rem;
    font-weight: 500;
}

.design-chip i { font-size: 0.65rem; }

.design-chip.chip-accent {
    background: #e0f2fe;
    color: #0369a1;
}

.designs-modal-footer {
    padding: 14px 28px;
    border-top: 1px solid #f1f5f9;
    font-size: 0.78rem;
    color: #64748b;
    text-align: right;
    background: #fafbfc;
}

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* ====== RESPONSIVE ====== */
@media (max-width: 1100px) {
    .left-panel { display: none; }
    .tab span { display: none; }
    .tab kbd { display: none; }
}

@media (max-width: 768px) {
    .right-panel { width: 200px; }
    .top-bar { padding: 0 6px; }
    .action-btn span { display: none; }
}
