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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* Login */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.login-box { background: white; padding: 40px; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); width: 100%; max-width: 400px; }
.login-title { font-size: 24px; font-weight: 600; text-align: center; margin-bottom: 30px; color: #333; }
.login-tabs { display: flex; margin-bottom: 30px; border-bottom: 2px solid #e0e0e0; }
.login-tab { flex: 1; padding: 10px; text-align: center; cursor: pointer; color: #666; transition: all 0.3s; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.login-tab.active { color: #667eea; border-bottom-color: #667eea; font-weight: 600; }

/* Header */
.header { background: white; box-shadow: 0 2px 8px rgba(0,0,0,0.08); margin-bottom: 20px; }
.header-content { max-width: 1200px; margin: 0 auto; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; }
.header-title { font-size: 20px; font-weight: 600; color: #333; }
.header-user { display: flex; align-items: center; gap: 15px; }
.user-info { color: #666; font-size: 14px; }
.permission-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; margin-left: 5px; }
.permission-super { background: #ff6b6b; color: white; }
.permission-admin { background: #4ecdc4; color: white; }
.permission-user { background: #95a5a6; color: white; }

/* Nav */
.nav-tabs { display: flex; gap: 10px; margin-bottom: 20px; background: white; padding: 10px 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); flex-wrap: wrap; }
.nav-tab { padding: 10px 20px; cursor: pointer; border-radius: 6px; transition: all 0.3s; color: #666; font-weight: 500; }
.nav-tab:hover { background: #f5f5f5; }
.nav-tab.active { background: #667eea; color: white; }

/* Card */
.card { background: white; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 20px; }
.card-title { font-size: 18px; font-weight: 600; margin-bottom: 20px; color: #333; }

/* Form */
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 500; color: #333; }
.form-input, .form-textarea, .form-select {
    width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; transition: border-color 0.3s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { outline: none; border-color: #667eea; }
.form-textarea { min-height: 100px; resize: vertical; font-family: 'Courier New', monospace; }
.info-text { font-size: 12px; color: #999; margin-top: 5px; }

/* Button */
.btn { padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.3s; }
.btn-primary { background: #667eea; color: white; }
.btn-primary:hover { background: #5568d3; }
.btn-secondary { background: #e0e0e0; color: #666; }
.btn-secondary:hover { background: #d0d0d0; }
.btn-success { background: #51cf66; color: white; }
.btn-success:hover { background: #40c057; }
.btn-danger { background: #ff6b6b; color: white; }
.btn-danger:hover { background: #fa5252; }
.btn-small { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Table */
.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px; text-align: left; border-bottom: 1px solid #e0e0e0; }
.table th { background: #f8f9fa; font-weight: 600; color: #333; }
.table tr:hover { background: #f8f9fa; }

/* Status */
.status-badge { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.status-pending { background: #fff3cd; color: #856404; }
.status-approved { background: #d4edda; color: #155724; }
.status-rejected { background: #f8d7da; color: #721c24; }

/* Toolbar */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 10px; flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; gap: 10px; align-items: center; }
.search-box { display: flex; gap: 10px; }

/* Pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 20px; }
.pagination-info { color: #666; font-size: 14px; }

/* Alert */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal { background: white; border-radius: 8px; padding: 30px; max-width: 700px; width: 90%; max-height: 90vh; overflow-y: auto; }
.modal-header { font-size: 20px; font-weight: 600; margin-bottom: 20px; color: #333; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Loading & Empty */
.loading { text-align: center; padding: 40px; color: #666; }
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-state-icon { font-size: 48px; margin-bottom: 10px; }

/* Code Block */
.code-block { background: #f5f5f5; padding: 15px; border-radius: 6px; font-family: 'Courier New', monospace; font-size: 13px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

/* Permission Checkboxes */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 10px; }
.perm-item { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid #e0e0e0; border-radius: 6px; background: #fafafa; }
.perm-item input { cursor: pointer; }
.perm-item label { cursor: pointer; font-size: 13px; }

/* Role Tags */
.role-tag { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; background: #e3f2fd; color: #1976d2; margin-right: 4px; }

/* Color Picker */
.color-picker-container { position: relative; display: inline-block; }
.color-preview { width: 40px; height: 40px; border-radius: 6px; border: 2px solid #ddd; cursor: pointer; }
.color-panel {
    position: absolute; top: 50px; left: 0; background: white;
    border: 1px solid #ddd; border-radius: 8px; padding: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15); z-index: 100;
    display: none; width: 280px;
}
.color-panel.show { display: block; }
.color-satval { width: 250px; height: 150px; position: relative; margin-bottom: 10px; border-radius: 4px; cursor: crosshair; }
.color-satval-bg { width: 100%; height: 100%; border-radius: 4px; }
.color-satval-cursor { position: absolute; width: 12px; height: 12px; border: 2px solid white; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 2px rgba(0,0,0,0.5); pointer-events: none; }
.color-hue { width: 250px; height: 12px; border-radius: 6px; margin-bottom: 10px; cursor: pointer; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); position: relative; }
.color-hue-cursor { position: absolute; top: -2px; width: 8px; height: 16px; background: white; border: 1px solid #999; border-radius: 2px; transform: translateX(-50%); pointer-events: none; }
.color-hex-row { display: flex; gap: 10px; align-items: center; }
.color-hex-row input { flex: 1; font-family: monospace; }
.color-current-preview { width: 36px; height: 36px; border-radius: 4px; border: 1px solid #ddd; }

/* Shape Drawer */
.shape-drawer { display: grid; grid-template-columns: repeat(8, 36px); grid-template-rows: repeat(8, 36px); gap: 3px; background: #fafafa; padding: 12px; border-radius: 12px; box-shadow: inset 0 0 5px #ddd; margin-top: 10px; }
.shape-drawer-row { display: contents; }
.shape-cell { width: 36px; height: 36px; border: 1.5px solid #ccc; border-radius: 8px; background-color: white; cursor: pointer; transition: background-color 0.2s, border-color 0.2s, transform 0.1s; }
.shape-cell:hover { border-color: #409eff; transform: scale(1.05); }
.shape-cell.active { background-color: #409eff; border-color: #2c7bd4; }
.shape-cell.active:hover { transform: scale(1.05); }
.shape-controls { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 10px; }
    .header-content { flex-direction: column; gap: 10px; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-left, .toolbar-right { width: 100%; }
    .table-container { overflow-x: scroll; }
    .login-box { padding: 30px 20px; }
    .modal { padding: 20px; }
}
