* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: #333; background: #f7f8fa; }

.app-header { background: #fff; padding: 16px 24px; border-bottom: 1px solid #e0e0e0; }
.app-header h1 { font-size: 20px; font-weight: 600; }
.app-header .subtitle { color: #888; font-size: 13px; margin-top: 4px; }

.app-body { display: flex; height: calc(100vh - 72px); }

/* Sidebar */
.sidebar { width: 240px; background: #fff; border-right: 1px solid #e0e0e0; display: flex; flex-direction: column; padding: 16px; gap: 12px; flex-shrink: 0; }
.sidebar h2 { font-size: 14px; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: 0.5px; }
#groups-list { list-style: none; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
#groups-list li { padding: 8px 12px; border-radius: 6px; cursor: pointer; transition: background 0.15s; font-size: 14px; display: flex; align-items: center; gap: 8px; }
#groups-list li:hover { background: #f0f4ff; }
#groups-list li.active { background: #2563eb; color: #fff; }
#groups-list li .group-count { margin-left: auto; font-size: 11px; background: rgba(0,0,0,0.12); padding: 1px 6px; border-radius: 10px; }
#groups-list li.active .group-count { background: rgba(255,255,255,0.25); }

/* Main panel */
.main-panel { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #aaa; gap: 12px; }
.empty-icon { font-size: 48px; }

/* Group editor */
.group-editor { flex: 1; display: flex; flex-direction: column; padding: 16px; gap: 16px; overflow: hidden; }
.group-editor-header { display: flex; align-items: center; gap: 12px; }
.group-name-input { flex: 1; font-size: 18px; font-weight: 600; border: none; border-bottom: 2px solid #e0e0e0; padding: 6px 2px; outline: none; background: transparent; }
.group-name-input:focus { border-bottom-color: #2563eb; }
.group-actions { display: flex; gap: 8px; }

/* Templates panel */
.templates-panel { flex: 1; display: flex; gap: 12px; overflow: hidden; }
.templates-col { flex: 1; display: flex; flex-direction: column; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
.templates-col h3 { padding: 10px 14px; font-size: 13px; font-weight: 600; color: #555; border-bottom: 1px solid #e0e0e0; background: #f9fafb; }
.search-input { width: 100%; padding: 8px 12px; border: none; border-bottom: 1px solid #e0e0e0; font-size: 13px; outline: none; }
.templates-col ul { flex: 1; overflow-y: auto; list-style: none; padding: 4px 0; }
.templates-col li { padding: 7px 14px; cursor: pointer; transition: background 0.12s; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.templates-col li:hover { background: #f0f4ff; }
.templates-col li.selected { background: #dbeafe; }
.templates-col li .tpl-id { color: #aaa; font-size: 11px; }

.templates-arrows { display: flex; flex-direction: column; justify-content: center; gap: 8px; }

/* Buttons */
.btn { padding: 7px 16px; border: none; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; transition: opacity 0.15s; }
.btn:hover { opacity: 0.85; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-success { background: #16a34a; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-secondary { background: #e5e7eb; color: #333; }
.btn-arrow { background: #e5e7eb; color: #333; font-size: 16px; width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px; z-index: 9999; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 9998; }
.modal { background: #fff; padding: 24px; border-radius: 12px; width: 360px; display: flex; flex-direction: column; gap: 16px; }
.modal h3 { font-size: 16px; font-weight: 600; }
.modal-input { width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; outline: none; }
.modal-input:focus { border-color: #2563eb; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
