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

/* Top navigation */
.top-nav { display: flex; align-items: center; background: #fff; border-bottom: 2px solid #1a73e8; padding: 0 24px; height: 48px; gap: 0; }
.top-nav a { padding: 12px 20px; font-size: 14px; font-weight: 500; color: #666; text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.top-nav a:hover { color: #1a73e8; background: #f0f4ff; }
.top-nav a.active { color: #1a73e8; border-bottom-color: #1a73e8; }
.top-nav .spacer { flex: 1; }
.top-nav .env-area { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.env-select { padding: 4px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; background: #fff; }
.prod-badge { background: #e8710a; color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 3px; display: none; }
.user-email { color: #666; font-size: 13px; }
.btn-link { background: none; border: none; color: #1a73e8; cursor: pointer; font-size: 13px; text-decoration: underline; }

/* Layout */
.layout { display: flex; height: calc(100vh - 48px); }

/* Sidebar */
.sidebar { width: 320px; min-width: 320px; background: #fff; border-right: 1px solid #ddd; display: flex; flex-direction: column; }
.sidebar-header { padding: 16px; border-bottom: 1px solid #eee; }
.search-box { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; margin-bottom: 8px; }
.filter-row { display: flex; gap: 6px; }
.filter-select { flex: 1; padding: 6px 8px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; background: #fff; }
.template-count { font-size: 12px; color: #888; margin-top: 8px; }
.template-list { flex: 1; overflow-y: auto; }
.template-item { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 0.15s; }
.template-item:hover { background: #f8f8f8; }
.template-item.active { background: #e8f0fe; border-left: 3px solid #1a73e8; }
.template-item .name { font-size: 14px; font-weight: 500; margin-bottom: 3px; }
.template-item .meta { font-size: 12px; color: #888; margin-bottom: 3px; }
.template-item .lang-badge { background: #e8f0fe; color: #1a73e8; padding: 1px 5px; border-radius: 3px; font-size: 10px; margin-right: 3px; display: inline-block; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid #eee; }

/* Main content */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.main-content { flex: 1; overflow-y: auto; padding: 24px; }

/* Cards */
.card { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 20px; margin-bottom: 16px; }
.card h3 { font-size: 16px; margin-bottom: 12px; }

/* Meta fields */
.meta-row { display: flex; margin-bottom: 8px; font-size: 14px; }
.meta-label { width: 120px; color: #888; flex-shrink: 0; }
.meta-value { flex: 1; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 8px 12px; background: #f5f5f5; border-bottom: 1px solid #ddd; font-weight: 500; font-size: 12px; color: #888; text-transform: uppercase; }
.data-table td { padding: 8px 12px; border-bottom: 1px solid #f0f0f0; }
.data-table tr:hover { background: #fafafa; }

/* Buttons */
.btn { padding: 6px 16px; border: 1px solid #ddd; background: #fff; border-radius: 6px; cursor: pointer; font-size: 13px; transition: all 0.15s; }
.btn:hover { background: #f0f0f0; }
.btn-primary { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.btn-primary:hover { background: #1557b0; }
.btn-danger { color: #d93025; border-color: #d93025; }
.btn-danger:hover { background: #fce8e6; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-create-all { background: #ff9800; color: #fff; border-color: #ff9800; white-space: nowrap; }
.btn-create-all:hover { background: #e68a00; }
.btn-create-all:disabled { background: #ccc; border-color: #ccc; }
.btn-icon { padding: 4px 8px; background: none; border: none; cursor: pointer; font-size: 16px; opacity: 0.5; }
.btn-icon:hover { opacity: 1; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.active-toggle { background: #1a73e8; color: #fff; border-color: #1a73e8; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 480px; max-width: 90vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 30px rgba(0,0,0,0.2); }
.modal h3 { margin-bottom: 16px; font-size: 18px; }
.modal-footer { margin-top: 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: #666; margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; border-radius: 8px; font-size: 14px; z-index: 200; animation: fadeIn 0.2s; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.toast-success { background: #0d7c3e; color: #fff; }
.toast-error { background: #d93025; color: #fff; }
.toast-info { background: #333; color: #fff; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: #888; }
.empty-state h3 { font-size: 16px; margin-bottom: 8px; color: #666; }

/* Editor */
.editor-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.editor-header h3 { flex: 1; }
.editor-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.editor-tabs button { padding: 6px 16px; border: 1px solid #ddd; background: #fff; border-radius: 6px 6px 0 0; cursor: pointer; font-size: 13px; }
.editor-tabs button.active { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.code-editor { width: 100%; min-height: 400px; font-family: 'SF Mono', 'Consolas', 'Monaco', monospace; font-size: 13px; line-height: 1.5; padding: 12px; border: 1px solid #ddd; border-radius: 0 0 6px 6px; resize: vertical; tab-size: 2; }
.preview-frame { width: 100%; min-height: 400px; border: 1px solid #ddd; border-radius: 0 0 6px 6px; background: #fff; }
.unsaved-indicator { color: #e8710a; font-size: 13px; font-weight: 500; }
.editor-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }

/* Audits */
.action-create { color: #0d7c3e; font-weight: 500; }
.action-update { color: #1a73e8; font-weight: 500; }
.action-delete { color: #d93025; font-weight: 500; }

.pagination { display: flex; align-items: center; gap: 8px; margin-top: 16px; justify-content: center; }
.pagination button { padding: 6px 12px; }

/* Login */
/* Role badges */
.role-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 3px; }
.role-write { background: #0d7c3e; color: #fff; }
.role-readonly { background: #888; color: #fff; }

.login-container { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card { background: #fff; border-radius: 12px; padding: 40px; width: 380px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); text-align: center; }
.login-card h1 { font-size: 22px; margin-bottom: 8px; }
.login-card p { color: #888; font-size: 14px; margin-bottom: 24px; }
.login-card .error { color: #d93025; font-size: 13px; margin-top: 12px; display: none; }

/* Version footer */
.version-footer { position: fixed; bottom: 0; right: 0; padding: 4px 12px; font-size: 11px; color: #aaa; }
