#card-factory-modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 10000; background: #F9FAFB; font-family: 'Inter', sans-serif;
    display: flex; flex-direction: column;
}
.cf-wrapper { width: 100%; height: 100%; display: flex; flex-direction: column; }
.cf-gallery-layout { display: flex; height: 100%; overflow: hidden; }
.cf-sidebar { width: 260px; background: #FFFFFF; border-right: 1px solid #E5E7EB; display: flex; flex-direction: column; overflow-y: auto; padding: 16px 0; }
.cf-sidebar-title { padding: 0 20px 12px 20px; font-size: 0.7rem; text-transform: uppercase; color: #9CA3AF; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 4px; }
.cf-cat-item { padding: 10px 20px; cursor: pointer; font-size: 0.9rem; color: #4B5563; border-left: 3px solid transparent; transition: all 0.15s; display:flex; align-items:center; justify-content:space-between; }
.cf-cat-item:hover { background: #F3F4F6; color: #111827; }
.cf-cat-item.active { background: #EFF6FF; color: #2563EB; border-left-color: #2563EB; font-weight: 600; }
.cf-main-content { flex: 1; display: flex; flex-direction: column; background: #F9FAFB; position: relative; }
.cf-header { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; border-bottom: 1px solid #E5E7EB; background: #FFFFFF; }
.cf-header h2 { font-size: 1.2rem; font-weight: 600; color: #111827; margin: 0; }
.cf-close-btn { background: none; border: none; color: #6B7280; cursor: pointer; padding: 8px; border-radius: 50%; transition: background 0.2s; }
.cf-close-btn:hover { background: #F3F4F6; color: #EF4444; }
.cf-gallery-grid { padding: 30px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 24px; overflow-y: auto; }
.cf-template-card { background: #FFFFFF; border: 1px solid #E5E7EB; border-radius: 8px; overflow: hidden; cursor: pointer; transition: all 0.2s ease; display: flex; flex-direction: column; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.cf-template-card:hover { transform: translateY(-4px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); border-color: #D1D5DB; }
.cf-template-preview { width: 100%; background: #F3F4F6; overflow: hidden; }
.cf-editor-layout { display: flex; flex-direction: column; height: 100%; background: #E5E7EB; }
.cf-editor-toolbar { height: 60px; background: #FFFFFF; border-bottom: 1px solid #E5E7EB; display: flex; align-items: center; padding: 0 20px; gap: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.01); z-index: 20; }
.cf-tool-btn { display: flex; align-items: center; gap: 8px; background: #FFFFFF; border: 1px solid #D1D5DB; padding: 8px 14px; border-radius: 6px; font-size: 0.85rem; font-weight: 500; color: #374151; cursor: pointer; transition: all 0.2s; }
.cf-tool-btn svg { width: 16px; height: 16px; }
.cf-tool-btn:hover { background: #F9FAFB; border-color: #9CA3AF; }
.cf-tool-btn.primary { background: #2563EB; color: #FFFFFF; border: 1px solid #2563EB; }
.cf-tool-btn.primary:hover { background: #1D4ED8; }
.cf-sep { width: 1px; height: 24px; background: #E5E7EB; margin: 0 4px; }
.cf-canvas-area { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; overflow: auto; position: relative; background-image: radial-gradient(#D1D5DB 1px, transparent 1px); background-size: 20px 20px; }
#cf-card-canvas { box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.2); background: white; transition: transform 0.3s ease; flex-shrink: 0; user-select: none; }
.cf-editable { cursor: text; outline: none; min-width: 10px; border: 1px dashed transparent; transition: border-color 0.1s; pointer-events: auto; padding: 2px; box-sizing: border-box; }
.cf-editable:hover { border-color: rgba(59, 130, 246, 0.5); }
/* Design Panel */
.cf-prop-panel { padding: 0 20px; display: flex; flex-direction: column; gap: 16px; }
.cf-control-group { display: flex; flex-direction: column; gap: 6px; }
.cf-control-group label { font-size: 0.75rem; font-weight: 600; color: #6B7280; }
.cf-input { width: 100%; padding: 8px; border: 1px solid #D1D5DB; border-radius: 6px; font-size: 0.9rem; color: #111827; background: #fff; }
.cf-input:focus { border-color: #2563EB; outline: none; }
.cf-color-input { width: 100%; height: 36px; padding: 2px; border: 1px solid #D1D5DB; border-radius: 6px; cursor: pointer; }
.cf-row { display: flex; gap: 10px; align-items: center; }
.cf-row > * { flex: 1; }
.cf-btn-danger { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; padding: 10px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; }
.cf-btn-danger:hover { background: #FEE2E2; }
input[type=range] { width: 100%; accent-color: #2563EB; }